From: support Date: Mon, 24 Oct 2022 14:22:54 +0000 (+0000) Subject: Built motion from commit 8356fca3.|2.6.19 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=b3456b2d6c5cf4531dfb04a472e575b98e0b2da6;p=motion2.git Built motion from commit 8356fca3.|2.6.19 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 95247ef..1704d8f 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-21T11:07:24.689Z", + "time": "2022-10-24T14:15:10.937Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 2984e78..b3eccbe 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-21T11:07:24.689Z", + "time": "2022-10-24T14:15:10.937Z", "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 4a67956..f8875fb 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 _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 +var _0x7584=['VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','sequelize','exports'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x7584,0x10e));var _0x4758=function(_0x168720,_0x38bf6a){_0x168720=_0x168720-0x0;var _0x7eeeb8=_0x7584[_0x168720];return _0x7eeeb8;};'use strict';var Sequelize=require(_0x4758('0x0'));module[_0x4758('0x1')]={'name':{'type':Sequelize[_0x4758('0x2')],'get':function(_0x34622b){return this[_0x4758('0x3')](_0x4758('0x4'));}},'action':{'type':Sequelize[_0x4758('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x4758('0x6'),_0x4758('0x7'),_0x4758('0x8'),'jscripty',_0x4758('0x9'),_0x4758('0xa'),_0x4758('0xb'),'script']],'msg':_0x4758('0xc')}},'comment':_0x4758('0xc')},'data1':{'type':Sequelize[_0x4758('0x5')](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[_0x4758('0x5')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x4758('0xd')},'data5':{'type':Sequelize[_0x4758('0x5')](0x1000),'comments':_0x4758('0xe')},'data6':{'type':Sequelize['STRING'],'comments':_0x4758('0xf')},'data7':{'type':Sequelize['TEXT'],'comments':_0x4758('0x10')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 62c2c8f..f3cbc75 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 _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 +var _0x739f=['body','Action','find','params','destroy','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','undefined','count','offset','limit','Content-Range','apply','save','update','then','sendStatus','error','stack','name','send'];(function(_0x3679bd,_0x44f12){var _0x1d0ed0=function(_0xafdb4a){while(--_0xafdb4a){_0x3679bd['push'](_0x3679bd['shift']());}};_0x1d0ed0(++_0x44f12);}(_0x739f,0x120));var _0xf739=function(_0x150768,_0x2d1aff){_0x150768=_0x150768-0x0;var _0xfed081=_0x739f[_0x150768];return _0xfed081;};'use strict';var emlformat=require(_0xf739('0x0'));var rimraf=require(_0xf739('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf739('0x2'));var rp=require(_0xf739('0x3'));var moment=require(_0xf739('0x4'));var BPromise=require(_0xf739('0x5'));var Mustache=require('mustache');var util=require(_0xf739('0x6'));var path=require('path');var sox=require(_0xf739('0x7'));var csv=require(_0xf739('0x8'));var ejs=require(_0xf739('0x9'));var fs=require('fs');var fs_extra=require(_0xf739('0xa'));var _=require(_0xf739('0xb'));var squel=require(_0xf739('0xc'));var crypto=require(_0xf739('0xd'));var jsforce=require(_0xf739('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf739('0xf'));var Papa=require('papaparse');var Redis=require(_0xf739('0x10'));var authService=require(_0xf739('0x11'));var qs=require(_0xf739('0x12'));var as=require(_0xf739('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf739('0x14'))(_0xf739('0x15'));var utils=require(_0xf739('0x16'));var config=require(_0xf739('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf739('0x18'))['db'];function respondWithStatusCode(_0x16af1d,_0x287b7c){_0x287b7c=_0x287b7c||0xcc;return function(_0x4ea912){if(_0x4ea912){return _0x16af1d['sendStatus'](_0x287b7c);}return _0x16af1d[_0xf739('0x19')](_0x287b7c)['end']();};}function respondWithResult(_0x135d18,_0x1f691f){_0x1f691f=_0x1f691f||0xc8;return function(_0x49a0bd){if(_0x49a0bd){return _0x135d18[_0xf739('0x19')](_0x1f691f)[_0xf739('0x1a')](_0x49a0bd);}};}function respondWithFilteredResult(_0x4d55ca,_0x2601e3){return function(_0x3789a3){if(_0x3789a3){var _0x2936a5=typeof _0x2601e3['offset']===_0xf739('0x1b')&&typeof _0x2601e3['limit']===_0xf739('0x1b');var _0x83ddae=_0x3789a3[_0xf739('0x1c')];var _0x39199c=_0x2936a5?0x0:_0x2601e3[_0xf739('0x1d')];var _0x4be4ed=_0x2936a5?_0x3789a3[_0xf739('0x1c')]:_0x2601e3[_0xf739('0x1d')]+_0x2601e3[_0xf739('0x1e')];var _0x3e863a;if(_0x4be4ed>=_0x83ddae){_0x4be4ed=_0x83ddae;_0x3e863a=0xc8;}else{_0x3e863a=0xce;}_0x4d55ca[_0xf739('0x19')](_0x3e863a);return _0x4d55ca['set'](_0xf739('0x1f'),_0x39199c+'-'+_0x4be4ed+'/'+_0x83ddae)['json'](_0x3789a3);}return null;};}function patchUpdates(_0x2c622f){return function(_0x5b05aa){try{jsonpatch[_0xf739('0x20')](_0x5b05aa,_0x2c622f,!![]);}catch(_0x1ad349){return BPromise['reject'](_0x1ad349);}return _0x5b05aa[_0xf739('0x21')]();};}function saveUpdates(_0x5b7f10,_0x1bab69){return function(_0x564f85){if(_0x564f85){return _0x564f85[_0xf739('0x22')](_0x5b7f10)['then'](function(_0x2c528f){return _0x2c528f;});}return null;};}function removeEntity(_0x34f7a6,_0x5eaf47){return function(_0x15dc5a){if(_0x15dc5a){return _0x15dc5a['destroy']()[_0xf739('0x23')](function(){_0x34f7a6[_0xf739('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x355370,_0xea2ec3){return function(_0x31e2a1){if(!_0x31e2a1){_0x355370[_0xf739('0x24')](0x194);}return _0x31e2a1;};}function handleError(_0x3c53fc,_0x3b7c2d){_0x3b7c2d=_0x3b7c2d||0x1f4;return function(_0x3146bc){logger[_0xf739('0x25')](_0x3146bc[_0xf739('0x26')]);if(_0x3146bc[_0xf739('0x27')]){delete _0x3146bc[_0xf739('0x27')];}_0x3c53fc[_0xf739('0x19')](_0x3b7c2d)[_0xf739('0x28')](_0x3146bc);};}exports[_0xf739('0x22')]=function(_0x318b87,_0x163c45){if(_0x318b87['body']['id']){delete _0x318b87[_0xf739('0x29')]['id'];}return db[_0xf739('0x2a')][_0xf739('0x2b')]({'where':{'id':_0x318b87[_0xf739('0x2c')]['id']}})['then'](handleEntityNotFound(_0x163c45,null))[_0xf739('0x23')](saveUpdates(_0x318b87[_0xf739('0x29')],null))[_0xf739('0x23')](respondWithResult(_0x163c45,null))['catch'](handleError(_0x163c45,null));};exports[_0xf739('0x2d')]=function(_0x48cf56,_0x1d02c8){return db[_0xf739('0x2a')][_0xf739('0x2b')]({'where':{'id':_0x48cf56[_0xf739('0x2c')]['id']}})[_0xf739('0x23')](handleEntityNotFound(_0x1d02c8,null))[_0xf739('0x23')](removeEntity(_0x1d02c8,null))[_0xf739('0x2e')](handleError(_0x1d02c8,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 2f4c293..ff63f42 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 _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 +var _0xab06=['bluebird','request-promise','rimraf','../../config/environment','./action.attributes','exports','Action','tools_actions','lodash','util','../../config/logger','api','moment'];(function(_0x16f5d5,_0x184bb0){var _0x1b9f8c=function(_0x224d6d){while(--_0x224d6d){_0x16f5d5['push'](_0x16f5d5['shift']());}};_0x1b9f8c(++_0x184bb0);}(_0xab06,0xe5));var _0x6ab0=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xab06[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0x6ab0('0x0'));var util=require(_0x6ab0('0x1'));var logger=require(_0x6ab0('0x2'))(_0x6ab0('0x3'));var moment=require(_0x6ab0('0x4'));var BPromise=require(_0x6ab0('0x5'));var rp=require(_0x6ab0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6ab0('0x7'));var config=require(_0x6ab0('0x8'));var attributes=require(_0x6ab0('0x9'));module[_0x6ab0('0xa')]=function(_0x20f900,_0x2afae6){return _0x20f900['define'](_0x6ab0('0xb'),attributes,{'tableName':_0x6ab0('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 220bc24..469cb9b 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 _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 +var _0x7a54=['info','Action,\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(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x34b1da,_0x4ce1d8){_0x34b1da=_0x34b1da-0x0;var _0x136f6c=_0x7a54[_0x34b1da];return _0x136f6c;};'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')]('Action,\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/action/index.js b/server/api/action/index.js index b86fb56..d29baf5 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 _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 +var _0x9db5=['/:id','isAuthenticated','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put'];(function(_0x4afe3b,_0x255e0d){var _0x2c22d1=function(_0x313847){while(--_0x313847){_0x4afe3b['push'](_0x4afe3b['shift']());}};_0x2c22d1(++_0x255e0d);}(_0x9db5,0x1e4));var _0x59db=function(_0x584693,_0x5464c2){_0x584693=_0x584693-0x0;var _0x5e28cd=_0x9db5[_0x584693];return _0x5e28cd;};'use strict';var multer=require(_0x59db('0x0'));var util=require(_0x59db('0x1'));var path=require(_0x59db('0x2'));var timeout=require(_0x59db('0x3'));var express=require(_0x59db('0x4'));var router=express[_0x59db('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x59db('0x6'));var interaction=require(_0x59db('0x7'));var config=require(_0x59db('0x8'));var controller=require(_0x59db('0x9'));router[_0x59db('0xa')](_0x59db('0xb'),auth[_0x59db('0xc')](),controller['update']);router[_0x59db('0xd')](_0x59db('0xb'),auth[_0x59db('0xc')](),controller['destroy']);module[_0x59db('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 7740aaa..0886085 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 _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 +var _0x1883=['exports','STRING','TEXT','sequelize'];(function(_0x5c396c,_0x3b75c3){var _0x514f6c=function(_0x368b1a){while(--_0x368b1a){_0x5c396c['push'](_0x5c396c['shift']());}};_0x514f6c(++_0x3b75c3);}(_0x1883,0xab));var _0x3188=function(_0x2bb3a8,_0x3d3f2e){_0x2bb3a8=_0x2bb3a8-0x0;var _0x3fe3f4=_0x1883[_0x2bb3a8];return _0x3fe3f4;};'use strict';var Sequelize=require(_0x3188('0x0'));module[_0x3188('0x1')]={'name':{'type':Sequelize[_0x3188('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3188('0x2')]},'parent':{'type':Sequelize[_0x3188('0x2')]},'table':{'type':Sequelize[_0x3188('0x2')]},'conditions':{'type':Sequelize[_0x3188('0x3')]},'joins':{'type':Sequelize[_0x3188('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 579a9f5..9754d6b 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 _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 +var _0x6c0d=['dbH','sendStatus','status','json','offset','undefined','limit','set','apply','reject','save','update','then','get','CustomReports','UserProfileResource','end','error','name','send','map','AnalyticCustomReport','type','key','model','keys','query','filters','intersection','fields','attributes','nolimit','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','show','params','rawAttributes','length','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','destroy','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','function','replace','format','groupBy','orderBy','order','joins','includes','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','parse','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','GROUP_CONCAT(%s)','IS\x20NULL','value','DESC','alias','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','runReport','DATE(%s)','metric','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/license/util','../../mysqldb'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6c0d,0x132));var _0xd6c0=function(_0x5eb6d6,_0x2839a0){_0x5eb6d6=_0x5eb6d6-0x0;var _0x588167=_0x6c0d[_0x5eb6d6];return _0x588167;};'use strict';var emlformat=require(_0xd6c0('0x0'));var rimraf=require(_0xd6c0('0x1'));var zipdir=require(_0xd6c0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd6c0('0x3'));var moment=require(_0xd6c0('0x4'));var BPromise=require(_0xd6c0('0x5'));var Mustache=require('mustache');var util=require(_0xd6c0('0x6'));var path=require(_0xd6c0('0x7'));var sox=require(_0xd6c0('0x8'));var csv=require('to-csv');var ejs=require(_0xd6c0('0x9'));var fs=require('fs');var fs_extra=require(_0xd6c0('0xa'));var _=require(_0xd6c0('0xb'));var squel=require(_0xd6c0('0xc'));var crypto=require(_0xd6c0('0xd'));var jsforce=require(_0xd6c0('0xe'));var deskjs=require(_0xd6c0('0xf'));var toCsv=require(_0xd6c0('0x10'));var querystring=require(_0xd6c0('0x11'));var Papa=require(_0xd6c0('0x12'));var Redis=require('ioredis');var authService=require(_0xd6c0('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6c0('0x14'));var logger=require('../../config/logger')(_0xd6c0('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd6c0('0x16'));var db=require(_0xd6c0('0x17'))['db'];var dbH=require(_0xd6c0('0x17'))[_0xd6c0('0x18')];function respondWithStatusCode(_0x40658a,_0x588141){_0x588141=_0x588141||0xcc;return function(_0x3483a3){if(_0x3483a3){return _0x40658a[_0xd6c0('0x19')](_0x588141);}return _0x40658a[_0xd6c0('0x1a')](_0x588141)['end']();};}function respondWithResult(_0x179274,_0x56ff84){_0x56ff84=_0x56ff84||0xc8;return function(_0x5a19f0){if(_0x5a19f0){return _0x179274[_0xd6c0('0x1a')](_0x56ff84)[_0xd6c0('0x1b')](_0x5a19f0);}};}function respondWithFilteredResult(_0x3539c9,_0xe8122){return function(_0x4f4870){if(_0x4f4870){var _0x4e5afe=typeof _0xe8122[_0xd6c0('0x1c')]===_0xd6c0('0x1d')&&typeof _0xe8122[_0xd6c0('0x1e')]===_0xd6c0('0x1d');var _0x151d07=_0x4f4870['count'];var _0x3d4157=_0x4e5afe?0x0:_0xe8122[_0xd6c0('0x1c')];var _0x59dc7f=_0x4e5afe?_0x4f4870['count']:_0xe8122[_0xd6c0('0x1c')]+_0xe8122['limit'];var _0x4c3da8;if(_0x59dc7f>=_0x151d07){_0x59dc7f=_0x151d07;_0x4c3da8=0xc8;}else{_0x4c3da8=0xce;}_0x3539c9[_0xd6c0('0x1a')](_0x4c3da8);return _0x3539c9[_0xd6c0('0x1f')]('Content-Range',_0x3d4157+'-'+_0x59dc7f+'/'+_0x151d07)['json'](_0x4f4870);}return null;};}function patchUpdates(_0x286821){return function(_0xf5159d){try{jsonpatch[_0xd6c0('0x20')](_0xf5159d,_0x286821,!![]);}catch(_0x5928de){return BPromise[_0xd6c0('0x21')](_0x5928de);}return _0xf5159d[_0xd6c0('0x22')]();};}function saveUpdates(_0x459c33,_0x3e7ce8){return function(_0x2bab46){if(_0x2bab46){return _0x2bab46[_0xd6c0('0x23')](_0x459c33)[_0xd6c0('0x24')](function(_0x4fa905){return _0x4fa905;});}return null;};}function removeEntity(_0x2cc6c1,_0x49ebc8){return function(_0xf97d4c){if(_0xf97d4c){return _0xf97d4c['destroy']()[_0xd6c0('0x24')](function(){var _0x3e66f2=_0xf97d4c[_0xd6c0('0x25')]({'plain':!![]});var _0x4ac378=_0xd6c0('0x26');return db[_0xd6c0('0x27')]['destroy']({'where':{'type':_0x4ac378,'resourceId':_0x3e66f2['id']}})[_0xd6c0('0x24')](function(){return _0xf97d4c;});})['then'](function(){_0x2cc6c1[_0xd6c0('0x1a')](0xcc)[_0xd6c0('0x28')]();});}};}function handleEntityNotFound(_0x1d6563,_0x310d9f){return function(_0xede467){if(!_0xede467){_0x1d6563[_0xd6c0('0x19')](0x194);}return _0xede467;};}function handleError(_0x5516b7,_0x27b5de){_0x27b5de=_0x27b5de||0x1f4;return function(_0x5a7627){logger[_0xd6c0('0x29')](_0x5a7627['stack']);if(_0x5a7627[_0xd6c0('0x2a')]){delete _0x5a7627['name'];}_0x5516b7['status'](_0x27b5de)[_0xd6c0('0x2b')](_0x5a7627);};}exports['index']=function(_0x1ff7e2,_0x34ada0){var _0x13b092={},_0x3e9edf={},_0x14b86d={'count':0x0,'rows':[]};var _0x45447e=_[_0xd6c0('0x2c')](db[_0xd6c0('0x2d')]['rawAttributes'],function(_0x4ae7c9){return{'name':_0x4ae7c9['fieldName'],'type':_0x4ae7c9[_0xd6c0('0x2e')][_0xd6c0('0x2f')]};});_0x3e9edf[_0xd6c0('0x30')]=_['map'](_0x45447e,_0xd6c0('0x2a'));_0x3e9edf['query']=_[_0xd6c0('0x31')](_0x1ff7e2[_0xd6c0('0x32')]);_0x3e9edf[_0xd6c0('0x33')]=_[_0xd6c0('0x34')](_0x3e9edf[_0xd6c0('0x30')],_0x3e9edf['query']);_0x13b092['attributes']=_[_0xd6c0('0x34')](_0x3e9edf['model'],qs['fields'](_0x1ff7e2[_0xd6c0('0x32')][_0xd6c0('0x35')]));_0x13b092[_0xd6c0('0x36')]=_0x13b092[_0xd6c0('0x36')]['length']?_0x13b092[_0xd6c0('0x36')]:_0x3e9edf[_0xd6c0('0x30')];if(!_0x1ff7e2['query']['hasOwnProperty'](_0xd6c0('0x37'))){_0x13b092[_0xd6c0('0x1e')]=qs[_0xd6c0('0x1e')](_0x1ff7e2[_0xd6c0('0x32')]['limit']);_0x13b092[_0xd6c0('0x1c')]=qs['offset'](_0x1ff7e2['query'][_0xd6c0('0x1c')]);}_0x13b092['order']=qs['sort'](_0x1ff7e2['query']['sort']);_0x13b092[_0xd6c0('0x38')]=qs['filters'](_[_0xd6c0('0x39')](_0x1ff7e2['query'],_0x3e9edf[_0xd6c0('0x33')]),_0x45447e);if(_0x1ff7e2['query'][_0xd6c0('0x3a')]){_0x13b092[_0xd6c0('0x38')]=_[_0xd6c0('0x3b')](_0x13b092[_0xd6c0('0x38')],{'$or':_[_0xd6c0('0x2c')](_0x45447e,function(_0x5eaf1e){if(_0x5eaf1e[_0xd6c0('0x2e')]!==_0xd6c0('0x3c')){var _0x5e622a={};_0x5e622a[_0x5eaf1e[_0xd6c0('0x2a')]]={'$like':'%'+_0x1ff7e2['query'][_0xd6c0('0x3a')]+'%'};return _0x5e622a;}})});}_0x13b092=_[_0xd6c0('0x3b')]({},_0x13b092,_0x1ff7e2[_0xd6c0('0x3d')]);var _0x2e4abc={'where':_0x13b092['where']};return db[_0xd6c0('0x2d')][_0xd6c0('0x3e')](_0x2e4abc)['then'](function(_0xfe9c36){_0x14b86d[_0xd6c0('0x3e')]=_0xfe9c36;if(_0x1ff7e2['query']['includeAll']){_0x13b092[_0xd6c0('0x3f')]=[{'all':!![]}];}return db[_0xd6c0('0x2d')][_0xd6c0('0x40')](_0x13b092);})[_0xd6c0('0x24')](function(_0x57043e){_0x14b86d['rows']=_0x57043e;return _0x14b86d;})[_0xd6c0('0x24')](respondWithFilteredResult(_0x34ada0,_0x13b092))['catch'](handleError(_0x34ada0,null));};exports[_0xd6c0('0x41')]=function(_0x6a6a55,_0x32528c){var _0x1662a0={'raw':![],'where':{'id':_0x6a6a55[_0xd6c0('0x42')]['id']}},_0x402e08={};_0x402e08[_0xd6c0('0x30')]=_[_0xd6c0('0x31')](db[_0xd6c0('0x2d')][_0xd6c0('0x43')]);_0x402e08[_0xd6c0('0x32')]=_['keys'](_0x6a6a55[_0xd6c0('0x32')]);_0x402e08['filters']=_[_0xd6c0('0x34')](_0x402e08[_0xd6c0('0x30')],_0x402e08['query']);_0x1662a0[_0xd6c0('0x36')]=_[_0xd6c0('0x34')](_0x402e08[_0xd6c0('0x30')],qs[_0xd6c0('0x35')](_0x6a6a55[_0xd6c0('0x32')][_0xd6c0('0x35')]));_0x1662a0[_0xd6c0('0x36')]=_0x1662a0[_0xd6c0('0x36')][_0xd6c0('0x44')]?_0x1662a0[_0xd6c0('0x36')]:_0x402e08['model'];if(_0x6a6a55[_0xd6c0('0x32')][_0xd6c0('0x45')]){_0x1662a0['include']=[{'all':!![]}];}_0x1662a0=_[_0xd6c0('0x3b')]({},_0x1662a0,_0x6a6a55[_0xd6c0('0x3d')]);return db[_0xd6c0('0x2d')][_0xd6c0('0x46')](_0x1662a0)[_0xd6c0('0x24')](handleEntityNotFound(_0x32528c,null))['then'](respondWithResult(_0x32528c,null))[_0xd6c0('0x47')](handleError(_0x32528c,null));};exports[_0xd6c0('0x48')]=function(_0x54c5e3,_0x131e56){return db['AnalyticCustomReport'][_0xd6c0('0x48')](_0x54c5e3[_0xd6c0('0x49')],{})['then'](function(_0x34c550){var _0x5b341a=_0x54c5e3[_0xd6c0('0x4a')][_0xd6c0('0x25')]({'plain':!![]});if(!_0x5b341a)throw new Error(_0xd6c0('0x4b'));if(_0x5b341a[_0xd6c0('0x4c')]===_0xd6c0('0x4a')){var _0x1f3ba4=_0x34c550[_0xd6c0('0x25')]({'plain':!![]});var _0x3b6fa8='Reports';return db[_0xd6c0('0x4d')][_0xd6c0('0x46')]({'where':{'name':_0x3b6fa8,'userProfileId':_0x5b341a[_0xd6c0('0x4e')]},'raw':!![]})[_0xd6c0('0x24')](function(_0x214b6f){if(_0x214b6f&&_0x214b6f['autoAssociation']===0x0){return db[_0xd6c0('0x27')][_0xd6c0('0x48')]({'name':_0x1f3ba4['name'],'resourceId':_0x1f3ba4['id'],'type':'CustomReports','sectionId':_0x214b6f['id']},{})[_0xd6c0('0x24')](function(){return _0x34c550;});}else{return _0x34c550;}})[_0xd6c0('0x47')](function(_0x223e21){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x223e21);throw _0x223e21;});}return _0x34c550;})[_0xd6c0('0x24')](respondWithResult(_0x131e56,0xc9))['catch'](handleError(_0x131e56,null));};exports[_0xd6c0('0x23')]=function(_0x3678f9,_0x49d710){if(_0x3678f9['body']['id']){delete _0x3678f9['body']['id'];}return db[_0xd6c0('0x2d')][_0xd6c0('0x46')]({'where':{'id':_0x3678f9[_0xd6c0('0x42')]['id']}})[_0xd6c0('0x24')](handleEntityNotFound(_0x49d710,null))[_0xd6c0('0x24')](saveUpdates(_0x3678f9['body'],null))['then'](respondWithResult(_0x49d710,null))[_0xd6c0('0x47')](handleError(_0x49d710,null));};exports[_0xd6c0('0x4f')]=function(_0x591b53,_0x4238de){return db[_0xd6c0('0x2d')][_0xd6c0('0x46')]({'where':{'id':_0x591b53['params']['id']}})[_0xd6c0('0x24')](handleEntityNotFound(_0x4238de,null))['then'](removeEntity(_0x4238de,null))[_0xd6c0('0x47')](handleError(_0x4238de,null));};exports[_0xd6c0('0x50')]=function(_0x498ce6,_0x1098a0){var _0x505703=0xa;var _0x29f404=[_0xd6c0('0x51'),_0xd6c0('0x52'),_0xd6c0('0x53'),_0xd6c0('0x54')];var _0x5cec3b={'SUM':_0xd6c0('0x55'),'COUNT':_0xd6c0('0x56'),'COUNT DISTINCT':_0xd6c0('0x57'),'MAX':_0xd6c0('0x58'),'MIN':_0xd6c0('0x59'),'AVG':_0xd6c0('0x5a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xd6c0('0x5b'),'GROUP_CONCAT DESC':_0xd6c0('0x5c')};var _0x6de914={'SEC_TO_TIME':_0xd6c0('0x5d'),'DATE':'DATE(%s)','HOUR':_0xd6c0('0x5e'),'ROUND':_0xd6c0('0x5f'),'UNIX_TIMESTAMP':_0xd6c0('0x60')};var _0x411ed7=function(_0x472f69){return!_['includes'](['IS\x20NULL',_0xd6c0('0x61'),_0xd6c0('0x62'),_0xd6c0('0x63')],_0x472f69);};var _0x36f732=function(_0x44f925){if(!_0x44f925||!_0x44f925[_0xd6c0('0x64')]['length']){return'';}for(var _0x1c4b99='(',_0x44abf7=0x0;_0x44abf7<_0x44f925[_0xd6c0('0x64')][_0xd6c0('0x44')];_0x44abf7+=0x1){_0x44abf7>0x0&&(_0x1c4b99+='\x20'+_0x44f925[_0xd6c0('0x65')]+'\x20');_0x1c4b99+=_0x44f925[_0xd6c0('0x64')][_0x44abf7][_0xd6c0('0x66')]?_0x36f732(_0x44f925['rules'][_0x44abf7]['group']):_0x44f925[_0xd6c0('0x64')][_0x44abf7][_0xd6c0('0x67')]+'\x20'+_0x44f925[_0xd6c0('0x64')][_0x44abf7][_0xd6c0('0x68')]+(_0x411ed7(_0x44f925[_0xd6c0('0x64')][_0x44abf7][_0xd6c0('0x68')])?'\x20'+_0x44f925[_0xd6c0('0x64')][_0x44abf7]['value']:'');}return _0x1c4b99+')';};var _0x476029={'where':{'id':_0x498ce6[_0xd6c0('0x42')]['id']}},_0x534e89,_0x1f535c,_0x31e22c,_0x32008e,_0x843577;_0x476029=_[_0xd6c0('0x3b')]({},_0x476029,_0x498ce6[_0xd6c0('0x3d')]);return db[_0xd6c0('0x2d')][_0xd6c0('0x46')](_0x476029)[_0xd6c0('0x24')](function(_0xdb60ec){if(_0xdb60ec){_0x534e89=_0xdb60ec;return _0xdb60ec[_0xd6c0('0x69')]();}return null;})['then'](function(_0x195c3a){if(_0x195c3a){if(!_0x195c3a[_0xd6c0('0x44')]){throw new db[(_0xd6c0('0x6a'))][(_0xd6c0('0x6b'))](_0xd6c0('0x6c'),0x193);}_0x1f535c=_0x195c3a;return db[_0xd6c0('0x6d')]['findAll']({'raw':!![]});}return null;})[_0xd6c0('0x24')](function(_0x4edf53){if(_0x4edf53){_0x31e22c=_[_0xd6c0('0x6e')](_0x4edf53,'id');var _0x1ae949;var _0x289123=squel[_0xd6c0('0x6f')]();_0x289123[_0xd6c0('0x70')](_0x534e89[_0xd6c0('0x71')]);for(var _0x544b23=0x0;_0x544b23<_0x1f535c[_0xd6c0('0x44')];_0x544b23+=0x1){_0x1ae949=_0x1f535c[_0x544b23][_0xd6c0('0x72')]?_0x31e22c[_0x1f535c[_0x544b23]['MetricId']]['metric']:_0x1f535c[_0x544b23][_0xd6c0('0x67')];_0x1ae949=_0x1f535c[_0x544b23][_0xd6c0('0x73')]?_[_0xd6c0('0x74')](_0x5cec3b[_0x1f535c[_0x544b23][_0xd6c0('0x73')]],'%s',_0x1ae949):_0x1ae949;_0x1ae949=_0x1f535c[_0x544b23][_0xd6c0('0x75')]?_[_0xd6c0('0x74')](_0x6de914[_0x1f535c[_0x544b23][_0xd6c0('0x75')]],'%s',_0x1ae949):_0x1ae949;if(_0x1f535c[_0x544b23][_0xd6c0('0x76')]){_0x289123[_0xd6c0('0x66')](_0x1ae949);}_0x1f535c[_0x544b23][_0xd6c0('0x77')]&&_0x289123[_0xd6c0('0x78')](_0x1ae949,_0x1f535c[_0x544b23]['orderBy']==='DESC'?![]:!![]);_0x289123[_0xd6c0('0x67')](_0x1ae949,_0x1f535c[_0x544b23]['alias']||_0x1ae949);}if(_0x534e89[_0xd6c0('0x79')]){_0x534e89[_0xd6c0('0x79')]=JSON['parse'](_0x534e89[_0xd6c0('0x79')]);for(var _0x1a8d4f=0x0;_0x1a8d4f<_0x534e89[_0xd6c0('0x79')]['length'];_0x1a8d4f+=0x1){if(_0x534e89[_0xd6c0('0x79')][_0x1a8d4f][_0xd6c0('0x2e')]&&_[_0xd6c0('0x7a')](_0x29f404,_0x534e89[_0xd6c0('0x79')][_0x1a8d4f][_0xd6c0('0x2e')])&&_0x534e89['joins'][_0x1a8d4f][_0xd6c0('0x7b')]&&_0x534e89['joins'][_0x1a8d4f][_0xd6c0('0x7c')]&&_0x534e89[_0xd6c0('0x79')][_0x1a8d4f]['foreignKey']){_0x289123[_0x534e89[_0xd6c0('0x79')][_0x1a8d4f]['type']](_0x534e89[_0xd6c0('0x79')][_0x1a8d4f]['foreignTable'],null,util['format'](_0xd6c0('0x7d'),_0x534e89['table'],_0x534e89['joins'][_0x1a8d4f][_0xd6c0('0x7b')],_0x534e89[_0xd6c0('0x79')][_0x1a8d4f][_0xd6c0('0x7c')],_0x534e89['joins'][_0x1a8d4f][_0xd6c0('0x7e')]));}}}if(_0x534e89['conditions']){_0x534e89[_0xd6c0('0x7f')]=JSON[_0xd6c0('0x80')](_0x534e89['conditions']);_0x289123[_0xd6c0('0x38')](_0x36f732(_0x534e89[_0xd6c0('0x7f')][_0xd6c0('0x66')]));}_0x843577=_0x289123[_0xd6c0('0x81')]();_0x289123[_0xd6c0('0x1e')](_0x505703);_0x289123[_0xd6c0('0x1c')](0x0);logger[_0xd6c0('0x82')](_0xd6c0('0x83'),_0x289123[_0xd6c0('0x84')]());return dbH[_0xd6c0('0x85')][_0xd6c0('0x32')](_0x289123['toString'](),{'type':dbH[_0xd6c0('0x85')][_0xd6c0('0x86')][_0xd6c0('0x87')]});}})[_0xd6c0('0x24')](respondWithResult(_0x1098a0,null))[_0xd6c0('0x47')](handleError(_0x1098a0,null));};function runReport(_0x338ddb,_0x53dca2,_0x482480){var _0x553a2d=_0x53dca2[_0xd6c0('0x2a')];var _0x16afbb=0xa;var _0x2b1b7d=[_0xd6c0('0x51'),_0xd6c0('0x52'),_0xd6c0('0x53'),_0xd6c0('0x54')];var _0x52b3ac={'SUM':_0xd6c0('0x55'),'COUNT':_0xd6c0('0x56'),'COUNT DISTINCT':_0xd6c0('0x57'),'MAX':_0xd6c0('0x58'),'MIN':_0xd6c0('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xd6c0('0x88'),'GROUP_CONCAT ASC':_0xd6c0('0x5b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x28cca5={'SEC_TO_TIME':_0xd6c0('0x5d'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xd6c0('0x5f'),'UNIX_TIMESTAMP':_0xd6c0('0x60')};var _0x48d850=function(_0x17a723){return!_[_0xd6c0('0x7a')]([_0xd6c0('0x89'),_0xd6c0('0x61'),'IS\x20EMPTY',_0xd6c0('0x63')],_0x17a723);};var _0x2aa196=function(_0x334df0){if(!_0x334df0||!_0x334df0[_0xd6c0('0x64')]['length']){return'';}for(var _0x356e59='(',_0x433495=0x0;_0x433495<_0x334df0[_0xd6c0('0x64')][_0xd6c0('0x44')];_0x433495+=0x1){_0x433495>0x0&&(_0x356e59+='\x20'+_0x334df0['operator']+'\x20');_0x356e59+=_0x334df0[_0xd6c0('0x64')][_0x433495]['group']?_0x2aa196(_0x334df0[_0xd6c0('0x64')][_0x433495][_0xd6c0('0x66')]):_0x334df0[_0xd6c0('0x64')][_0x433495][_0xd6c0('0x67')]+'\x20'+_0x334df0[_0xd6c0('0x64')][_0x433495][_0xd6c0('0x68')]+(_0x48d850(_0x334df0[_0xd6c0('0x64')][_0x433495][_0xd6c0('0x68')])?'\x20'+_0x334df0[_0xd6c0('0x64')][_0x433495][_0xd6c0('0x8a')]:'');}return _0x356e59+')';};var _0x510e9d={'where':{'id':_0x338ddb['id']}},_0x3e8ab7,_0xca6637,_0x5ac4e5,_0x1b31fc,_0x5a3e9e;_0x510e9d=_[_0xd6c0('0x3b')]({},_0x510e9d,_0x482480);return db[_0xd6c0('0x2d')]['find'](_0x510e9d)[_0xd6c0('0x24')](function(_0x32b486){if(_0x32b486){_0x3e8ab7=_0x32b486;return _0x32b486[_0xd6c0('0x69')]();}return null;})['then'](function(_0xf8018b){if(_0xf8018b){if(!_0xf8018b[_0xd6c0('0x44')]){throw new db[(_0xd6c0('0x6a'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xca6637=_0xf8018b;return db[_0xd6c0('0x6d')][_0xd6c0('0x40')]({'raw':!![]});}return null;})[_0xd6c0('0x24')](function(_0xea5743){if(_0xea5743){_0x5ac4e5=_['keyBy'](_0xea5743,'id');var _0x229b67;var _0x3d44ae=squel[_0xd6c0('0x6f')]();_0x3d44ae[_0xd6c0('0x70')](_0x3e8ab7[_0xd6c0('0x71')]);for(var _0x4455ca=0x0;_0x4455ca<_0xca6637[_0xd6c0('0x44')];_0x4455ca+=0x1){_0x229b67=_0xca6637[_0x4455ca][_0xd6c0('0x72')]?_0x5ac4e5[_0xca6637[_0x4455ca][_0xd6c0('0x72')]]['metric']:_0xca6637[_0x4455ca][_0xd6c0('0x67')];_0x229b67=_0xca6637[_0x4455ca][_0xd6c0('0x73')]?_[_0xd6c0('0x74')](_0x52b3ac[_0xca6637[_0x4455ca][_0xd6c0('0x73')]],'%s',_0x229b67):_0x229b67;_0x229b67=_0xca6637[_0x4455ca][_0xd6c0('0x75')]?_[_0xd6c0('0x74')](_0x28cca5[_0xca6637[_0x4455ca]['format']],'%s',_0x229b67):_0x229b67;if(_0xca6637[_0x4455ca][_0xd6c0('0x76')]){_0x3d44ae[_0xd6c0('0x66')](_0x229b67);}_0xca6637[_0x4455ca][_0xd6c0('0x77')]&&_0x3d44ae[_0xd6c0('0x78')](_0x229b67,_0xca6637[_0x4455ca]['orderBy']===_0xd6c0('0x8b')?![]:!![]);_0x3d44ae['field'](_0x229b67,_0xca6637[_0x4455ca][_0xd6c0('0x8c')]||_0x229b67);}if(_0x3e8ab7['joins']){_0x3e8ab7[_0xd6c0('0x79')]=JSON['parse'](_0x3e8ab7[_0xd6c0('0x79')]);for(var _0xa8c5b=0x0;_0xa8c5b<_0x3e8ab7[_0xd6c0('0x79')][_0xd6c0('0x44')];_0xa8c5b+=0x1){if(_0x3e8ab7['joins'][_0xa8c5b][_0xd6c0('0x2e')]&&_[_0xd6c0('0x7a')](_0x2b1b7d,_0x3e8ab7[_0xd6c0('0x79')][_0xa8c5b]['type'])&&_0x3e8ab7[_0xd6c0('0x79')][_0xa8c5b][_0xd6c0('0x7b')]&&_0x3e8ab7[_0xd6c0('0x79')][_0xa8c5b][_0xd6c0('0x7c')]&&_0x3e8ab7[_0xd6c0('0x79')][_0xa8c5b][_0xd6c0('0x7e')]){_0x3d44ae[_0x3e8ab7[_0xd6c0('0x79')][_0xa8c5b]['type']](_0x3e8ab7[_0xd6c0('0x79')][_0xa8c5b][_0xd6c0('0x7c')],null,util[_0xd6c0('0x75')](_0xd6c0('0x7d'),_0x3e8ab7[_0xd6c0('0x71')],_0x3e8ab7[_0xd6c0('0x79')][_0xa8c5b][_0xd6c0('0x7b')],_0x3e8ab7['joins'][_0xa8c5b][_0xd6c0('0x7c')],_0x3e8ab7[_0xd6c0('0x79')][_0xa8c5b]['foreignKey']));}}}if(_0x3e8ab7[_0xd6c0('0x7f')]){_0x3e8ab7[_0xd6c0('0x7f')]=JSON['parse'](_0x3e8ab7['conditions']);_0x3d44ae['where'](_0x2aa196(_0x3e8ab7[_0xd6c0('0x7f')][_0xd6c0('0x66')]));}_0x5a3e9e=_0x3d44ae['clone']();_0x3d44ae[_0xd6c0('0x1e')](_0x16afbb);_0x3d44ae[_0xd6c0('0x1c')](0x0);return;}})[_0xd6c0('0x24')](function(){if(_0x53dca2[_0xd6c0('0x8d')]===_0xd6c0('0x8e')){return null;}var _0x4854dc=_[_0xd6c0('0x3b')](_0x53dca2,{'name':_0x53dca2[_0xd6c0('0x8f')]||_0x53dca2[_0xd6c0('0x2a')]||_0x3e8ab7[_0xd6c0('0x2a')],'basename':_0x553a2d,'savename':util['format'](_0xd6c0('0x90'),_0x53dca2[_0xd6c0('0x2a')]||_0x3e8ab7['name'],require(_0xd6c0('0x91'))[_0xd6c0('0x92')](0x4),_0x53dca2['output']||_0xd6c0('0x93')),'reportId':_0x3e8ab7['id'],'reportType':_0xd6c0('0x94')});return db['AnalyticExtractedReport'][_0xd6c0('0x48')](_0x4854dc,{'raw':!![]});})[_0xd6c0('0x24')](function(_0x58b017){if(_0x3e8ab7['table']===_0xd6c0('0x95')){_0x5a3e9e[_0xd6c0('0x38')](_0x3e8ab7['table']+_0xd6c0('0x96'),_0x53dca2[_0xd6c0('0x97')],_0x53dca2[_0xd6c0('0x98')]);}else{_0x5a3e9e[_0xd6c0('0x38')](_0x3e8ab7[_0xd6c0('0x71')]+_0xd6c0('0x99'),_0x53dca2['startDate'],_0x53dca2[_0xd6c0('0x98')]);}if(_0x58b017){logger[_0xd6c0('0x9a')](_0xd6c0('0x9b'),_0x5a3e9e['toString']());require(_0xd6c0('0x9c'))[_0xd6c0('0x9d')](path[_0xd6c0('0x51')](__dirname,_0xd6c0('0x9e'),_0x58b017[_0xd6c0('0x8d')]),[_0x58b017['id'],_0x5a3e9e['toString'](),path[_0xd6c0('0x51')](__dirname,_0xd6c0('0x9f'),_0x58b017[_0xd6c0('0xa0')]),_0x553a2d]);return _0x58b017;}else{var _0x144198=squel[_0xd6c0('0x6f')]();_0x144198['from']('('+_0x5a3e9e[_0xd6c0('0x84')]()+')','countTable');_0x144198[_0xd6c0('0x67')](_0xd6c0('0xa1'),_0xd6c0('0x3e'));_0x5a3e9e['limit'](_0x53dca2['limit']||_0x16afbb);_0x5a3e9e[_0xd6c0('0x1c')](_0x53dca2[_0xd6c0('0x1c')]||0x0);return dbH[_0xd6c0('0x85')][_0xd6c0('0x32')](_0x144198['toString'](),{'type':dbH[_0xd6c0('0x85')][_0xd6c0('0x86')][_0xd6c0('0x87')]})[_0xd6c0('0x24')](function(_0x50fbfc){if(!_0x50fbfc['length']){_0x1b31fc=0x0;}else{_0x1b31fc=_0x50fbfc[0x0][_0xd6c0('0x3e')]||0x0;}return dbH[_0xd6c0('0x85')]['query'](_0x5a3e9e[_0xd6c0('0x84')](),{'type':dbH[_0xd6c0('0x85')][_0xd6c0('0x86')]['SELECT']});})[_0xd6c0('0x24')](function(_0x3cb3d7){return{'rows':_0x3cb3d7||[],'count':_0x1b31fc};});}});}exports['run']=function(_0x584735,_0x3ae0e1){return runReport(_0x584735[_0xd6c0('0x42')],_0x584735[_0xd6c0('0x32')],_0x584735['options'])[_0xd6c0('0x24')](respondWithResult(_0x3ae0e1,null))['catch'](handleError(_0x3ae0e1,null));};exports[_0xd6c0('0xa2')]=runReport;exports['query']=function(_0x3ea24a,_0x12ac9c){var _0xf22810=0xa;var _0x500cc5=[_0xd6c0('0x51'),_0xd6c0('0x52'),_0xd6c0('0x53'),_0xd6c0('0x54')];var _0x5aa210={'SUM':_0xd6c0('0x55'),'COUNT':_0xd6c0('0x56'),'COUNT DISTINCT':_0xd6c0('0x57'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xd6c0('0x5a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xd6c0('0x5b'),'GROUP_CONCAT DESC':_0xd6c0('0x5c')};var _0x253b81={'SEC_TO_TIME':_0xd6c0('0x5d'),'DATE':_0xd6c0('0xa3'),'HOUR':_0xd6c0('0x5e'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xd6c0('0x60')};var _0x302827=function(_0x2edf03){return!_[_0xd6c0('0x7a')](['IS\x20NULL',_0xd6c0('0x61'),'IS\x20EMPTY',_0xd6c0('0x63')],_0x2edf03);};var _0x5e9f76=function(_0x400402){if(!_0x400402||!_0x400402['rules'][_0xd6c0('0x44')]){return'';}for(var _0xee779b='(',_0x224e55=0x0;_0x224e55<_0x400402[_0xd6c0('0x64')][_0xd6c0('0x44')];_0x224e55+=0x1){_0x224e55>0x0&&(_0xee779b+='\x20'+_0x400402[_0xd6c0('0x65')]+'\x20');_0xee779b+=_0x400402[_0xd6c0('0x64')][_0x224e55][_0xd6c0('0x66')]?_0x5e9f76(_0x400402[_0xd6c0('0x64')][_0x224e55]['group']):_0x400402['rules'][_0x224e55]['field']+'\x20'+_0x400402[_0xd6c0('0x64')][_0x224e55][_0xd6c0('0x68')]+(_0x302827(_0x400402[_0xd6c0('0x64')][_0x224e55][_0xd6c0('0x68')])?'\x20'+_0x400402[_0xd6c0('0x64')][_0x224e55][_0xd6c0('0x8a')]:'');}return _0xee779b+')';};var _0x156956={'where':{'id':_0x3ea24a[_0xd6c0('0x42')]['id']}},_0xe3d9c2,_0x282dda,_0x3192ab,_0x49ad70,_0x453263;_0x156956=_[_0xd6c0('0x3b')]({},_0x156956,_0x3ea24a[_0xd6c0('0x3d')]);return db[_0xd6c0('0x2d')][_0xd6c0('0x46')](_0x156956)[_0xd6c0('0x24')](function(_0x288243){if(_0x288243){_0xe3d9c2=_0x288243;return _0x288243[_0xd6c0('0x69')]();}return null;})['then'](function(_0x315b3a){if(_0x315b3a){if(!_0x315b3a['length']){throw new db[(_0xd6c0('0x6a'))][(_0xd6c0('0x6b'))](_0xd6c0('0x6c'),0x193);}_0x282dda=_0x315b3a;return db[_0xd6c0('0x6d')]['findAll']({'raw':!![]});}return null;})[_0xd6c0('0x24')](function(_0x44be1f){if(_0x44be1f){_0x3192ab=_['keyBy'](_0x44be1f,'id');var _0x565089;var _0x3c0bef=squel[_0xd6c0('0x6f')]();_0x3c0bef[_0xd6c0('0x70')](_0xe3d9c2['table']);for(var _0x4aebf4=0x0;_0x4aebf4<_0x282dda[_0xd6c0('0x44')];_0x4aebf4+=0x1){_0x565089=_0x282dda[_0x4aebf4][_0xd6c0('0x72')]?_0x3192ab[_0x282dda[_0x4aebf4][_0xd6c0('0x72')]][_0xd6c0('0xa4')]:_0x282dda[_0x4aebf4][_0xd6c0('0x67')];_0x565089=_0x282dda[_0x4aebf4][_0xd6c0('0x73')]?_['replace'](_0x5aa210[_0x282dda[_0x4aebf4][_0xd6c0('0x73')]],'%s',_0x565089):_0x565089;_0x565089=_0x282dda[_0x4aebf4][_0xd6c0('0x75')]?_[_0xd6c0('0x74')](_0x253b81[_0x282dda[_0x4aebf4][_0xd6c0('0x75')]],'%s',_0x565089):_0x565089;if(_0x282dda[_0x4aebf4][_0xd6c0('0x76')]){_0x3c0bef[_0xd6c0('0x66')](_0x565089);}_0x282dda[_0x4aebf4][_0xd6c0('0x77')]&&_0x3c0bef[_0xd6c0('0x78')](_0x565089,_0x282dda[_0x4aebf4][_0xd6c0('0x77')]===_0xd6c0('0x8b')?![]:!![]);_0x3c0bef['field'](_0x565089,_0x282dda[_0x4aebf4][_0xd6c0('0x8c')]||_0x565089);}if(_0xe3d9c2[_0xd6c0('0x79')]){_0xe3d9c2[_0xd6c0('0x79')]=JSON[_0xd6c0('0x80')](_0xe3d9c2['joins']);for(var _0x52449e=0x0;_0x52449e<_0xe3d9c2[_0xd6c0('0x79')]['length'];_0x52449e+=0x1){if(_0xe3d9c2[_0xd6c0('0x79')][_0x52449e][_0xd6c0('0x2e')]&&_['includes'](_0x500cc5,_0xe3d9c2[_0xd6c0('0x79')][_0x52449e][_0xd6c0('0x2e')])&&_0xe3d9c2[_0xd6c0('0x79')][_0x52449e][_0xd6c0('0x7b')]&&_0xe3d9c2[_0xd6c0('0x79')][_0x52449e][_0xd6c0('0x7c')]&&_0xe3d9c2[_0xd6c0('0x79')][_0x52449e]['foreignKey']){_0x3c0bef[_0xe3d9c2[_0xd6c0('0x79')][_0x52449e][_0xd6c0('0x2e')]](_0xe3d9c2[_0xd6c0('0x79')][_0x52449e][_0xd6c0('0x7c')],null,util[_0xd6c0('0x75')]('%s.%s\x20=\x20%s.%s',_0xe3d9c2['table'],_0xe3d9c2[_0xd6c0('0x79')][_0x52449e]['parentKey'],_0xe3d9c2[_0xd6c0('0x79')][_0x52449e]['foreignTable'],_0xe3d9c2[_0xd6c0('0x79')][_0x52449e]['foreignKey']));}}}if(_0xe3d9c2[_0xd6c0('0x7f')]){_0xe3d9c2[_0xd6c0('0x7f')]=JSON[_0xd6c0('0x80')](_0xe3d9c2['conditions']);_0x3c0bef['where'](_0x5e9f76(_0xe3d9c2[_0xd6c0('0x7f')][_0xd6c0('0x66')]));}_0x453263=_0x3c0bef[_0xd6c0('0x81')]();_0x3c0bef[_0xd6c0('0x1e')](_0xf22810);_0x3c0bef['offset'](0x0);logger['debug'](_0xd6c0('0x83'),_0x3c0bef[_0xd6c0('0x84')]());return dbH['sequelize'][_0xd6c0('0x32')](_0x3c0bef[_0xd6c0('0x84')](),{'type':dbH[_0xd6c0('0x85')][_0xd6c0('0x86')]['SELECT']});}})[_0xd6c0('0x24')](function(){return{'sql':_0x453263['toString']()};})[_0xd6c0('0x24')](respondWithResult(_0x12ac9c,null))[_0xd6c0('0x47')](handleError(_0x12ac9c,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index bbbbc70..210aecb 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 _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 +var _0x739a=['exports','define','analytics_custom_reports','util','../../config/logger','api','moment','bluebird','path','./analyticCustomReport.attributes'];(function(_0x49fb2d,_0x34b0ca){var _0x29996c=function(_0x36fcf5){while(--_0x36fcf5){_0x49fb2d['push'](_0x49fb2d['shift']());}};_0x29996c(++_0x34b0ca);}(_0x739a,0xe9));var _0xa739=function(_0x14e393,_0x5ef7b3){_0x14e393=_0x14e393-0x0;var _0x5b5ffa=_0x739a[_0x14e393];return _0x5b5ffa;};'use strict';var _=require('lodash');var util=require(_0xa739('0x0'));var logger=require(_0xa739('0x1'))(_0xa739('0x2'));var moment=require(_0xa739('0x3'));var BPromise=require(_0xa739('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa739('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa739('0x6'));module[_0xa739('0x7')]=function(_0x522db8,_0xcde1f5){return _0x522db8[_0xa739('0x8')]('AnalyticCustomReport',attributes,{'tableName':_0xa739('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 02b3f22..6a9d18d 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 _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 +var _0x8d88=['stringify','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s'];(function(_0x26d70d,_0x1c9224){var _0x43d4e3=function(_0x130b27){while(--_0x130b27){_0x26d70d['push'](_0x26d70d['shift']());}};_0x43d4e3(++_0x1c9224);}(_0x8d88,0x7e));var _0x88d8=function(_0x2ba279,_0x4297a0){_0x2ba279=_0x2ba279-0x0;var _0xea4ae1=_0x8d88[_0x2ba279];return _0xea4ae1;};'use strict';var _=require(_0x88d8('0x0'));var util=require(_0x88d8('0x1'));var moment=require('moment');var BPromise=require(_0x88d8('0x2'));var rs=require(_0x88d8('0x3'));var fs=require('fs');var Redis=require(_0x88d8('0x4'));var db=require(_0x88d8('0x5'))['db'];var utils=require(_0x88d8('0x6'));var logger=require(_0x88d8('0x7'))(_0x88d8('0x8'));var config=require(_0x88d8('0x9'));var jayson=require(_0x88d8('0xa'));var client=jayson[_0x88d8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51cc60,_0x5a31a9,_0x1696af){return new BPromise(function(_0x1bdfbb,_0x43bf47){return client[_0x88d8('0xc')](_0x51cc60,_0x1696af)[_0x88d8('0xd')](function(_0x3e9e75){logger['info'](_0x88d8('0xe'),_0x5a31a9,_0x88d8('0xf'));logger[_0x88d8('0x10')](_0x88d8('0x11'),_0x5a31a9,'request\x20sent',JSON[_0x88d8('0x12')](_0x3e9e75));if(_0x3e9e75[_0x88d8('0x13')]){if(_0x3e9e75[_0x88d8('0x13')]['code']===0x1f4){logger[_0x88d8('0x13')](_0x88d8('0xe'),_0x5a31a9,_0x3e9e75[_0x88d8('0x13')]['message']);return _0x43bf47(_0x3e9e75['error'][_0x88d8('0x14')]);}logger[_0x88d8('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5a31a9,_0x3e9e75[_0x88d8('0x13')][_0x88d8('0x14')]);return _0x1bdfbb(_0x3e9e75[_0x88d8('0x13')][_0x88d8('0x14')]);}else{logger[_0x88d8('0x15')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5a31a9,_0x88d8('0xf'));_0x1bdfbb(_0x3e9e75[_0x88d8('0x16')][_0x88d8('0x14')]);}})[_0x88d8('0x17')](function(_0x453714){logger[_0x88d8('0x13')](_0x88d8('0xe'),_0x5a31a9,_0x453714);_0x43bf47(_0x453714);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 3a8576c..48babc1 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 _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 +var _0xca43=['get','isAuthenticated','index','run','/:id/query','query','post','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller'];(function(_0x53ba51,_0x2f2321){var _0x2e776e=function(_0x16b5cf){while(--_0x16b5cf){_0x53ba51['push'](_0x53ba51['shift']());}};_0x2e776e(++_0x2f2321);}(_0xca43,0x98));var _0x3ca4=function(_0x533b52,_0xe4951d){_0x533b52=_0x533b52-0x0;var _0x57c72d=_0xca43[_0x533b52];return _0x57c72d;};'use strict';var multer=require(_0x3ca4('0x0'));var util=require(_0x3ca4('0x1'));var path=require('path');var timeout=require(_0x3ca4('0x2'));var express=require(_0x3ca4('0x3'));var router=express['Router']();var fs_extra=require(_0x3ca4('0x4'));var auth=require(_0x3ca4('0x5'));var interaction=require(_0x3ca4('0x6'));var config=require('../../config/environment');var controller=require(_0x3ca4('0x7'));router[_0x3ca4('0x8')]('/',auth[_0x3ca4('0x9')](),controller[_0x3ca4('0xa')]);router[_0x3ca4('0x8')]('/:id',auth[_0x3ca4('0x9')](),controller['show']);router[_0x3ca4('0x8')]('/:id/preview',auth[_0x3ca4('0x9')](),controller['preview']);router[_0x3ca4('0x8')]('/:id/run',auth['isAuthenticated'](),controller[_0x3ca4('0xb')]);router['get'](_0x3ca4('0xc'),auth[_0x3ca4('0x9')](),controller[_0x3ca4('0xd')]);router[_0x3ca4('0xe')]('/',auth[_0x3ca4('0x9')](),controller['create']);router[_0x3ca4('0xf')](_0x3ca4('0x10'),auth[_0x3ca4('0x9')](),controller[_0x3ca4('0x11')]);router['delete'](_0x3ca4('0x10'),auth[_0x3ca4('0x9')](),controller[_0x3ca4('0x12')]);module[_0x3ca4('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index d8b9c75..1b844a3 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 _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 +var _0x33c5=['STRING','TEXT','exports'];(function(_0x5ebcef,_0x3f589b){var _0x156a55=function(_0x47be86){while(--_0x47be86){_0x5ebcef['push'](_0x5ebcef['shift']());}};_0x156a55(++_0x3f589b);}(_0x33c5,0xe6));var _0x533c=function(_0x336df4,_0x52c1dc){_0x336df4=_0x336df4-0x0;var _0x580d8c=_0x33c5[_0x336df4];return _0x580d8c;};'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 4919e33..30baa99 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 _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 +var _0x0295=['default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','fork','../../files/reports','COUNT(*)','SELECT','run','runReport','MAX(%s)','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','get','UserProfileResource','destroy','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','autoAssociation','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','from','table','MetricId','metric','function','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','group','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20EMPTY','operator','getFields','findAll','select','replace','output','web','%s-%s.%s','randomstring','generate','csv'];(function(_0x6606cf,_0x3ddf46){var _0x2787e6=function(_0x52e736){while(--_0x52e736){_0x6606cf['push'](_0x6606cf['shift']());}};_0x2787e6(++_0x3ddf46);}(_0x0295,0x1f0));var _0x5029=function(_0x1f94b0,_0x58c657){_0x1f94b0=_0x1f94b0-0x0;var _0x5cba72=_0x0295[_0x1f94b0];return _0x5cba72;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];var dbH=require(_0x5029('0x14'))['dbH'];function respondWithStatusCode(_0x4fa22d,_0x49f836){_0x49f836=_0x49f836||0xcc;return function(_0x4aebb6){if(_0x4aebb6){return _0x4fa22d[_0x5029('0x15')](_0x49f836);}return _0x4fa22d[_0x5029('0x16')](_0x49f836)[_0x5029('0x17')]();};}function respondWithResult(_0x434630,_0x2c0b33){_0x2c0b33=_0x2c0b33||0xc8;return function(_0x11c24b){if(_0x11c24b){return _0x434630[_0x5029('0x16')](_0x2c0b33)[_0x5029('0x18')](_0x11c24b);}};}function respondWithFilteredResult(_0x10bf55,_0x326923){return function(_0x457c73){if(_0x457c73){var _0x353cba=typeof _0x326923[_0x5029('0x19')]===_0x5029('0x1a')&&typeof _0x326923[_0x5029('0x1b')]==='undefined';var _0x1ed567=_0x457c73[_0x5029('0x1c')];var _0x35de81=_0x353cba?0x0:_0x326923[_0x5029('0x19')];var _0x8cea01=_0x353cba?_0x457c73[_0x5029('0x1c')]:_0x326923[_0x5029('0x19')]+_0x326923['limit'];var _0x226a5c;if(_0x8cea01>=_0x1ed567){_0x8cea01=_0x1ed567;_0x226a5c=0xc8;}else{_0x226a5c=0xce;}_0x10bf55['status'](_0x226a5c);return _0x10bf55[_0x5029('0x1d')](_0x5029('0x1e'),_0x35de81+'-'+_0x8cea01+'/'+_0x1ed567)[_0x5029('0x18')](_0x457c73);}return null;};}function patchUpdates(_0x3cf0fb){return function(_0x4b5854){try{jsonpatch['apply'](_0x4b5854,_0x3cf0fb,!![]);}catch(_0x4c9184){return BPromise['reject'](_0x4c9184);}return _0x4b5854[_0x5029('0x1f')]();};}function saveUpdates(_0x853a34,_0x1eb228){return function(_0x2bbbcb){if(_0x2bbbcb){return _0x2bbbcb[_0x5029('0x20')](_0x853a34)[_0x5029('0x21')](function(_0x125c26){return _0x125c26;});}return null;};}function removeEntity(_0x356dac,_0x3e857d){return function(_0x4ceaae){if(_0x4ceaae){return _0x4ceaae['destroy']()['then'](function(){var _0x588d90=_0x4ceaae[_0x5029('0x22')]({'plain':!![]});var _0x51093c='DefaultReports';return db[_0x5029('0x23')][_0x5029('0x24')]({'where':{'type':_0x51093c,'resourceId':_0x588d90['id']}})[_0x5029('0x21')](function(){return _0x4ceaae;});})['then'](function(){_0x356dac[_0x5029('0x16')](0xcc)[_0x5029('0x17')]();});}};}function handleEntityNotFound(_0x5e45c4,_0x2b6d99){return function(_0x31f0a0){if(!_0x31f0a0){_0x5e45c4[_0x5029('0x15')](0x194);}return _0x31f0a0;};}function handleError(_0x4a24b9,_0x32da06){_0x32da06=_0x32da06||0x1f4;return function(_0x251f99){logger[_0x5029('0x25')](_0x251f99['stack']);if(_0x251f99[_0x5029('0x26')]){delete _0x251f99[_0x5029('0x26')];}_0x4a24b9['status'](_0x32da06)[_0x5029('0x27')](_0x251f99);};}exports[_0x5029('0x28')]=function(_0x4434ff,_0x1c3dd9){var _0x196830={},_0x2a1ed6={},_0x44255a={'count':0x0,'rows':[]};var _0x465153=_[_0x5029('0x29')](db[_0x5029('0x2a')][_0x5029('0x2b')],function(_0x4519c8){return{'name':_0x4519c8['fieldName'],'type':_0x4519c8[_0x5029('0x2c')]['key']};});_0x2a1ed6[_0x5029('0x2d')]=_['map'](_0x465153,'name');_0x2a1ed6[_0x5029('0x2e')]=_[_0x5029('0x2f')](_0x4434ff[_0x5029('0x2e')]);_0x2a1ed6['filters']=_[_0x5029('0x30')](_0x2a1ed6[_0x5029('0x2d')],_0x2a1ed6[_0x5029('0x2e')]);_0x196830[_0x5029('0x31')]=_[_0x5029('0x30')](_0x2a1ed6[_0x5029('0x2d')],qs[_0x5029('0x32')](_0x4434ff[_0x5029('0x2e')][_0x5029('0x32')]));_0x196830['attributes']=_0x196830[_0x5029('0x31')][_0x5029('0x33')]?_0x196830[_0x5029('0x31')]:_0x2a1ed6[_0x5029('0x2d')];if(!_0x4434ff['query'][_0x5029('0x34')](_0x5029('0x35'))){_0x196830[_0x5029('0x1b')]=qs['limit'](_0x4434ff['query'][_0x5029('0x1b')]);_0x196830[_0x5029('0x19')]=qs['offset'](_0x4434ff['query'][_0x5029('0x19')]);}_0x196830[_0x5029('0x36')]=qs[_0x5029('0x37')](_0x4434ff[_0x5029('0x2e')][_0x5029('0x37')]);_0x196830[_0x5029('0x38')]=qs[_0x5029('0x39')](_[_0x5029('0x3a')](_0x4434ff[_0x5029('0x2e')],_0x2a1ed6[_0x5029('0x39')]),_0x465153);if(_0x4434ff[_0x5029('0x2e')][_0x5029('0x3b')]){_0x196830[_0x5029('0x38')]=_[_0x5029('0x3c')](_0x196830['where'],{'$or':_['map'](_0x465153,function(_0x73797c){if(_0x73797c[_0x5029('0x2c')]!==_0x5029('0x3d')){var _0x48c9eb={};_0x48c9eb[_0x73797c[_0x5029('0x26')]]={'$like':'%'+_0x4434ff[_0x5029('0x2e')]['filter']+'%'};return _0x48c9eb;}})});}_0x196830=_[_0x5029('0x3c')]({},_0x196830,_0x4434ff['options']);var _0x506f0d={'where':_0x196830['where']};return db[_0x5029('0x2a')][_0x5029('0x1c')](_0x506f0d)[_0x5029('0x21')](function(_0x78768){_0x44255a[_0x5029('0x1c')]=_0x78768;if(_0x4434ff[_0x5029('0x2e')][_0x5029('0x3e')]){_0x196830[_0x5029('0x3f')]=[{'all':!![]}];}return db[_0x5029('0x2a')]['findAll'](_0x196830);})[_0x5029('0x21')](function(_0x236455){_0x44255a[_0x5029('0x40')]=_0x236455;return _0x44255a;})[_0x5029('0x21')](respondWithFilteredResult(_0x1c3dd9,_0x196830))[_0x5029('0x41')](handleError(_0x1c3dd9,null));};exports[_0x5029('0x42')]=function(_0x5658a7,_0x259db8){var _0xa1580a={'raw':!![],'where':{'id':_0x5658a7[_0x5029('0x43')]['id']}},_0x9434ed={};_0x9434ed[_0x5029('0x2d')]=_['keys'](db[_0x5029('0x2a')][_0x5029('0x2b')]);_0x9434ed[_0x5029('0x2e')]=_[_0x5029('0x2f')](_0x5658a7[_0x5029('0x2e')]);_0x9434ed[_0x5029('0x39')]=_[_0x5029('0x30')](_0x9434ed[_0x5029('0x2d')],_0x9434ed[_0x5029('0x2e')]);_0xa1580a['attributes']=_[_0x5029('0x30')](_0x9434ed[_0x5029('0x2d')],qs[_0x5029('0x32')](_0x5658a7[_0x5029('0x2e')]['fields']));_0xa1580a['attributes']=_0xa1580a[_0x5029('0x31')][_0x5029('0x33')]?_0xa1580a[_0x5029('0x31')]:_0x9434ed[_0x5029('0x2d')];if(_0x5658a7[_0x5029('0x2e')][_0x5029('0x3e')]){_0xa1580a[_0x5029('0x3f')]=[{'all':!![]}];}_0xa1580a=_[_0x5029('0x3c')]({},_0xa1580a,_0x5658a7[_0x5029('0x44')]);return db[_0x5029('0x2a')][_0x5029('0x45')](_0xa1580a)[_0x5029('0x21')](handleEntityNotFound(_0x259db8,null))[_0x5029('0x21')](respondWithResult(_0x259db8,null))[_0x5029('0x41')](handleError(_0x259db8,null));};exports[_0x5029('0x46')]=function(_0x175cc0,_0x10fc07){return db[_0x5029('0x2a')][_0x5029('0x46')](_0x175cc0[_0x5029('0x47')],{})[_0x5029('0x21')](function(_0x489457){var _0x1069c4=_0x175cc0['user'][_0x5029('0x22')]({'plain':!![]});if(!_0x1069c4)throw new Error(_0x5029('0x48'));if(_0x1069c4['role']==='user'){var _0x319bff=_0x489457['get']({'plain':!![]});var _0x4aaa43=_0x5029('0x49');return db[_0x5029('0x4a')][_0x5029('0x45')]({'where':{'name':_0x4aaa43,'userProfileId':_0x1069c4['userProfileId']},'raw':!![]})['then'](function(_0x1510bb){if(_0x1510bb&&_0x1510bb[_0x5029('0x4b')]===0x0){return db['UserProfileResource'][_0x5029('0x46')]({'name':_0x319bff['name'],'resourceId':_0x319bff['id'],'type':_0x5029('0x4c'),'sectionId':_0x1510bb['id']},{})['then'](function(){return _0x489457;});}else{return _0x489457;}})[_0x5029('0x41')](function(_0x27e1c0){logger[_0x5029('0x25')](_0x5029('0x4d'),_0x27e1c0);throw _0x27e1c0;});}return _0x489457;})[_0x5029('0x21')](respondWithResult(_0x10fc07,0xc9))[_0x5029('0x41')](handleError(_0x10fc07,null));};exports[_0x5029('0x20')]=function(_0xa25013,_0x586936){if(_0xa25013[_0x5029('0x47')]['id']){delete _0xa25013['body']['id'];}return db[_0x5029('0x2a')][_0x5029('0x45')]({'where':{'id':_0xa25013['params']['id']}})[_0x5029('0x21')](handleEntityNotFound(_0x586936,null))['then'](saveUpdates(_0xa25013['body'],null))['then'](respondWithResult(_0x586936,null))[_0x5029('0x41')](handleError(_0x586936,null));};exports['destroy']=function(_0x49d1db,_0x353ae4){return db[_0x5029('0x2a')]['find']({'where':{'id':_0x49d1db[_0x5029('0x43')]['id']}})['then'](handleEntityNotFound(_0x353ae4,null))['then'](removeEntity(_0x353ae4,null))[_0x5029('0x41')](handleError(_0x353ae4,null));};exports[_0x5029('0x4e')]=function(_0x81e39c,_0x448273){var _0x164179=0xa;var _0x4e8d9f=[_0x5029('0x4f'),_0x5029('0x50'),_0x5029('0x51'),_0x5029('0x52')];var _0x4dca54={'SUM':_0x5029('0x53'),'COUNT':_0x5029('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x5029('0x55'),'AVG':_0x5029('0x56'),'GROUP_CONCAT':_0x5029('0x57'),'GROUP_CONCAT ASC':_0x5029('0x58'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4208ab={'SEC_TO_TIME':_0x5029('0x59'),'DATE':_0x5029('0x5a'),'HOUR':_0x5029('0x5b'),'ROUND':_0x5029('0x5c'),'UNIX_TIMESTAMP':_0x5029('0x5d')};var _0x59a718=function(_0x560324){return!_[_0x5029('0x5e')]([_0x5029('0x5f'),_0x5029('0x60'),'IS\x20EMPTY',_0x5029('0x61')],_0x560324);};var _0x2d439a=function(_0x105638){if(!_0x105638||!_0x105638[_0x5029('0x62')][_0x5029('0x33')]){return'';}for(var _0x5264c6='(',_0x2ec5d0=0x0;_0x2ec5d0<_0x105638[_0x5029('0x62')][_0x5029('0x33')];_0x2ec5d0+=0x1){_0x2ec5d0>0x0&&(_0x5264c6+='\x20'+_0x105638['operator']+'\x20');_0x5264c6+=_0x105638[_0x5029('0x62')][_0x2ec5d0]['group']?_0x2d439a(_0x105638[_0x5029('0x62')][_0x2ec5d0]['group']):_0x105638[_0x5029('0x62')][_0x2ec5d0][_0x5029('0x63')]+'\x20'+_0x105638[_0x5029('0x62')][_0x2ec5d0][_0x5029('0x64')]+(_0x59a718(_0x105638[_0x5029('0x62')][_0x2ec5d0][_0x5029('0x64')])?'\x20'+_0x105638['rules'][_0x2ec5d0][_0x5029('0x65')]:'');}return _0x5264c6+')';};var _0x19220d={'where':{'id':_0x81e39c['params']['id']}},_0x1ff8df,_0x151562,_0x389700,_0x506f74,_0x13ca47;_0x19220d=_[_0x5029('0x3c')]({},_0x19220d,_0x81e39c['options']);return db[_0x5029('0x2a')]['find'](_0x19220d)[_0x5029('0x21')](function(_0x54daf9){if(_0x54daf9){_0x1ff8df=_0x54daf9;return _0x54daf9['getFields']();}return null;})[_0x5029('0x21')](function(_0x575f09){if(_0x575f09){if(!_0x575f09[_0x5029('0x33')]){throw new db[(_0x5029('0x66'))][(_0x5029('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x151562=_0x575f09;return db[_0x5029('0x68')]['findAll']({'raw':!![]});}return null;})[_0x5029('0x21')](function(_0x255dfb){if(_0x255dfb){_0x389700=_[_0x5029('0x69')](_0x255dfb,'id');var _0x1cca02;var _0x1deed7=squel['select']();_0x1deed7[_0x5029('0x6a')](_0x1ff8df[_0x5029('0x6b')]);for(var _0x5890ac=0x0;_0x5890ac<_0x151562[_0x5029('0x33')];_0x5890ac+=0x1){_0x1cca02=_0x151562[_0x5890ac][_0x5029('0x6c')]?_0x389700[_0x151562[_0x5890ac][_0x5029('0x6c')]][_0x5029('0x6d')]:_0x151562[_0x5890ac][_0x5029('0x63')];_0x1cca02=_0x151562[_0x5890ac][_0x5029('0x6e')]?_['replace'](_0x4dca54[_0x151562[_0x5890ac]['function']],'%s',_0x1cca02):_0x1cca02;_0x1cca02=_0x151562[_0x5890ac][_0x5029('0x6f')]?_['replace'](_0x4208ab[_0x151562[_0x5890ac][_0x5029('0x6f')]],'%s',_0x1cca02):_0x1cca02;if(_0x151562[_0x5890ac][_0x5029('0x70')]){_0x1deed7['group'](_0x1cca02);}_0x151562[_0x5890ac][_0x5029('0x71')]&&_0x1deed7['order'](_0x1cca02,_0x151562[_0x5890ac]['orderBy']===_0x5029('0x72')?![]:!![]);_0x1deed7[_0x5029('0x63')](_0x1cca02,_0x151562[_0x5890ac][_0x5029('0x73')]||_0x1cca02);}if(_0x1ff8df[_0x5029('0x74')]){_0x1ff8df['joins']=JSON[_0x5029('0x75')](_0x1ff8df[_0x5029('0x74')]);for(var _0x4a2ce8=0x0;_0x4a2ce8<_0x1ff8df[_0x5029('0x74')][_0x5029('0x33')];_0x4a2ce8+=0x1){if(_0x1ff8df['joins'][_0x4a2ce8]['type']&&_['includes'](_0x4e8d9f,_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x2c')])&&_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x76')]&&_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x77')]&&_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x78')]){_0x1deed7[_0x1ff8df[_0x5029('0x74')][_0x4a2ce8]['type']](_0x1ff8df['joins'][_0x4a2ce8][_0x5029('0x77')],null,util[_0x5029('0x6f')](_0x5029('0x79'),_0x1ff8df[_0x5029('0x6b')],_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x76')],_0x1ff8df[_0x5029('0x74')][_0x4a2ce8]['foreignTable'],_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x78')]));}}}if(_0x1ff8df[_0x5029('0x7a')]){_0x1ff8df['conditions']=JSON[_0x5029('0x75')](_0x1ff8df[_0x5029('0x7a')]);_0x1deed7[_0x5029('0x38')](_0x2d439a(_0x1ff8df['conditions'][_0x5029('0x7b')]));}_0x13ca47=_0x1deed7[_0x5029('0x7c')]();_0x1deed7[_0x5029('0x1b')](_0x164179);_0x1deed7['offset'](0x0);logger[_0x5029('0x7d')](_0x5029('0x7e'),_0x1deed7['toString']());return dbH[_0x5029('0x7f')][_0x5029('0x2e')](_0x1deed7[_0x5029('0x80')](),{'type':dbH[_0x5029('0x7f')][_0x5029('0x81')]['SELECT']});}})[_0x5029('0x21')](respondWithResult(_0x448273,null))[_0x5029('0x41')](handleError(_0x448273,null));};function runReport(_0x426d70,_0xe6ac28,_0x153cdc){var _0x5e7f50=_0xe6ac28[_0x5029('0x26')];var _0x202c51=0xa;var _0x344203=['join',_0x5029('0x50'),_0x5029('0x51'),_0x5029('0x52')];var _0x3e47bd={'SUM':_0x5029('0x53'),'COUNT':_0x5029('0x54'),'COUNT DISTINCT':_0x5029('0x82'),'MAX':'MAX(%s)','MIN':_0x5029('0x55'),'AVG':_0x5029('0x56'),'GROUP_CONCAT':_0x5029('0x57'),'GROUP_CONCAT ASC':_0x5029('0x58'),'GROUP_CONCAT DESC':_0x5029('0x83')};var _0x4c40d1={'SEC_TO_TIME':_0x5029('0x59'),'DATE':_0x5029('0x5a'),'HOUR':_0x5029('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5029('0x5d')};var _0x41e2d8=function(_0x51098a){return!_['includes'](['IS\x20NULL',_0x5029('0x60'),_0x5029('0x84'),_0x5029('0x61')],_0x51098a);};var _0x4007c8=function(_0x3dc05a){if(!_0x3dc05a||!_0x3dc05a['rules'][_0x5029('0x33')]){return'';}for(var _0x2e4782='(',_0x2c0540=0x0;_0x2c0540<_0x3dc05a['rules']['length'];_0x2c0540+=0x1){_0x2c0540>0x0&&(_0x2e4782+='\x20'+_0x3dc05a[_0x5029('0x85')]+'\x20');_0x2e4782+=_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x7b')]?_0x4007c8(_0x3dc05a[_0x5029('0x62')][_0x2c0540]['group']):_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x63')]+'\x20'+_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x64')]+(_0x41e2d8(_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x64')])?'\x20'+_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x65')]:'');}return _0x2e4782+')';};var _0x5aecc2={'where':{'id':_0x426d70['id']}},_0x159450,_0x556c7a,_0x48bbe2,_0x3e3150,_0x533ee2;_0x5aecc2=_[_0x5029('0x3c')]({},_0x5aecc2,_0x153cdc);return db[_0x5029('0x2a')][_0x5029('0x45')](_0x5aecc2)[_0x5029('0x21')](function(_0x1b6f4c){if(_0x1b6f4c){_0x159450=_0x1b6f4c;return _0x1b6f4c[_0x5029('0x86')]();}return null;})[_0x5029('0x21')](function(_0x1d6092){if(_0x1d6092){if(!_0x1d6092['length']){throw new db['Sequelize'][(_0x5029('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x556c7a=_0x1d6092;return db['AnalyticMetric'][_0x5029('0x87')]({'raw':!![]});}return null;})['then'](function(_0x4b25ed){if(_0x4b25ed){_0x48bbe2=_[_0x5029('0x69')](_0x4b25ed,'id');var _0xb8da0b;var _0x13e07e=squel[_0x5029('0x88')]();_0x13e07e[_0x5029('0x6a')](_0x159450['table']);for(var _0x38c02a=0x0;_0x38c02a<_0x556c7a[_0x5029('0x33')];_0x38c02a+=0x1){_0xb8da0b=_0x556c7a[_0x38c02a][_0x5029('0x6c')]?_0x48bbe2[_0x556c7a[_0x38c02a]['MetricId']][_0x5029('0x6d')]:_0x556c7a[_0x38c02a][_0x5029('0x63')];_0xb8da0b=_0x556c7a[_0x38c02a][_0x5029('0x6e')]?_[_0x5029('0x89')](_0x3e47bd[_0x556c7a[_0x38c02a][_0x5029('0x6e')]],'%s',_0xb8da0b):_0xb8da0b;_0xb8da0b=_0x556c7a[_0x38c02a]['format']?_['replace'](_0x4c40d1[_0x556c7a[_0x38c02a][_0x5029('0x6f')]],'%s',_0xb8da0b):_0xb8da0b;if(_0x556c7a[_0x38c02a][_0x5029('0x70')]){_0x13e07e['group'](_0xb8da0b);}_0x556c7a[_0x38c02a][_0x5029('0x71')]&&_0x13e07e[_0x5029('0x36')](_0xb8da0b,_0x556c7a[_0x38c02a][_0x5029('0x71')]===_0x5029('0x72')?![]:!![]);_0x13e07e[_0x5029('0x63')](_0xb8da0b,_0x556c7a[_0x38c02a][_0x5029('0x73')]||_0xb8da0b);}if(_0x159450[_0x5029('0x74')]){_0x159450[_0x5029('0x74')]=JSON['parse'](_0x159450['joins']);for(var _0x4243c3=0x0;_0x4243c3<_0x159450['joins'][_0x5029('0x33')];_0x4243c3+=0x1){if(_0x159450['joins'][_0x4243c3][_0x5029('0x2c')]&&_[_0x5029('0x5e')](_0x344203,_0x159450[_0x5029('0x74')][_0x4243c3]['type'])&&_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x76')]&&_0x159450[_0x5029('0x74')][_0x4243c3]['foreignTable']&&_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x78')]){_0x13e07e[_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x2c')]](_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x77')],null,util[_0x5029('0x6f')](_0x5029('0x79'),_0x159450[_0x5029('0x6b')],_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x76')],_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x77')],_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x78')]));}}}if(_0x159450[_0x5029('0x7a')]){_0x159450[_0x5029('0x7a')]=JSON[_0x5029('0x75')](_0x159450['conditions']);_0x13e07e[_0x5029('0x38')](_0x4007c8(_0x159450[_0x5029('0x7a')][_0x5029('0x7b')]));}_0x533ee2=_0x13e07e[_0x5029('0x7c')]();_0x13e07e[_0x5029('0x1b')](_0x202c51);_0x13e07e['offset'](0x0);return;}})[_0x5029('0x21')](function(){if(_0xe6ac28[_0x5029('0x8a')]===_0x5029('0x8b')){return null;}var _0xf7729c=_[_0x5029('0x3c')](_0xe6ac28,{'name':_0xe6ac28['fullPath']||_0xe6ac28[_0x5029('0x26')]||_0x159450[_0x5029('0x26')],'basename':_0x5e7f50,'savename':util[_0x5029('0x6f')](_0x5029('0x8c'),_0xe6ac28[_0x5029('0x26')]||_0x159450['name'],require(_0x5029('0x8d'))[_0x5029('0x8e')](0x4),_0xe6ac28[_0x5029('0x8a')]||_0x5029('0x8f')),'reportId':_0x159450['id'],'reportType':_0x5029('0x90')});return db[_0x5029('0x91')][_0x5029('0x46')](_0xf7729c,{'raw':!![]});})[_0x5029('0x21')](function(_0x4a7535){if(_0x159450['table']===_0x5029('0x92')){_0x533ee2[_0x5029('0x38')](_0x159450[_0x5029('0x6b')]+_0x5029('0x93'),_0xe6ac28[_0x5029('0x94')],_0xe6ac28['endDate']);}else{_0x533ee2[_0x5029('0x38')](_0x159450['table']+_0x5029('0x95'),_0xe6ac28[_0x5029('0x94')],_0xe6ac28[_0x5029('0x96')]);}if(_0x4a7535){logger[_0x5029('0x97')](_0x5029('0x98'),_0x533ee2[_0x5029('0x80')]());require('child_process')[_0x5029('0x99')](path[_0x5029('0x4f')](__dirname,'../../components/export/',_0x4a7535[_0x5029('0x8a')]),[_0x4a7535['id'],_0x533ee2[_0x5029('0x80')](),path['join'](__dirname,_0x5029('0x9a'),_0x4a7535['savename']),_0x5e7f50]);return _0x4a7535;}else{var _0x54c0f3=squel['select']();_0x54c0f3['from']('('+_0x533ee2[_0x5029('0x80')]()+')','countTable');_0x54c0f3[_0x5029('0x63')](_0x5029('0x9b'),'count');_0x533ee2[_0x5029('0x1b')](_0xe6ac28[_0x5029('0x1b')]||_0x202c51);_0x533ee2['offset'](_0xe6ac28[_0x5029('0x19')]||0x0);return dbH[_0x5029('0x7f')]['query'](_0x54c0f3[_0x5029('0x80')](),{'type':dbH[_0x5029('0x7f')]['QueryTypes'][_0x5029('0x9c')]})[_0x5029('0x21')](function(_0x17c755){if(!_0x17c755[_0x5029('0x33')]){_0x3e3150=0x0;}else{_0x3e3150=_0x17c755[0x0][_0x5029('0x1c')]||0x0;}return dbH[_0x5029('0x7f')]['query'](_0x533ee2[_0x5029('0x80')](),{'type':dbH['sequelize'][_0x5029('0x81')][_0x5029('0x9c')]});})[_0x5029('0x21')](function(_0x3ebe00){return{'rows':_0x3ebe00||[],'count':_0x3e3150};});}});}exports[_0x5029('0x9d')]=function(_0x2138cc,_0x331af8){return runReport(_0x2138cc[_0x5029('0x43')],_0x2138cc[_0x5029('0x2e')],_0x2138cc[_0x5029('0x44')])[_0x5029('0x21')](respondWithResult(_0x331af8,null))[_0x5029('0x41')](handleError(_0x331af8,null));};exports[_0x5029('0x9e')]=runReport;exports[_0x5029('0x2e')]=function(_0x9de076,_0x2ac88e){var _0x55ee4f=0xa;var _0x1fa9eb=[_0x5029('0x4f'),_0x5029('0x50'),_0x5029('0x51'),_0x5029('0x52')];var _0x405d47={'SUM':'SUM(%s)','COUNT':_0x5029('0x54'),'COUNT DISTINCT':_0x5029('0x82'),'MAX':_0x5029('0x9f'),'MIN':_0x5029('0x55'),'AVG':_0x5029('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x5029('0x58'),'GROUP_CONCAT DESC':_0x5029('0x83')};var _0x29c3a2={'SEC_TO_TIME':_0x5029('0x59'),'DATE':_0x5029('0x5a'),'HOUR':_0x5029('0x5b'),'ROUND':_0x5029('0x5c'),'UNIX_TIMESTAMP':_0x5029('0x5d')};var _0xb39e9d=function(_0x124c5e){return!_['includes']([_0x5029('0x5f'),'IS\x20NOT\x20NULL',_0x5029('0x84'),_0x5029('0x61')],_0x124c5e);};var _0x120acc=function(_0x21bb22){if(!_0x21bb22||!_0x21bb22['rules'][_0x5029('0x33')]){return'';}for(var _0x339112='(',_0x5d7c1a=0x0;_0x5d7c1a<_0x21bb22[_0x5029('0x62')][_0x5029('0x33')];_0x5d7c1a+=0x1){_0x5d7c1a>0x0&&(_0x339112+='\x20'+_0x21bb22['operator']+'\x20');_0x339112+=_0x21bb22[_0x5029('0x62')][_0x5d7c1a][_0x5029('0x7b')]?_0x120acc(_0x21bb22['rules'][_0x5d7c1a]['group']):_0x21bb22[_0x5029('0x62')][_0x5d7c1a]['field']+'\x20'+_0x21bb22['rules'][_0x5d7c1a][_0x5029('0x64')]+(_0xb39e9d(_0x21bb22['rules'][_0x5d7c1a][_0x5029('0x64')])?'\x20'+_0x21bb22[_0x5029('0x62')][_0x5d7c1a]['value']:'');}return _0x339112+')';};var _0x327299={'where':{'id':_0x9de076['params']['id']}},_0x3463cc,_0x590cc2,_0x3ac39a,_0x37c47b,_0x62e4af;_0x327299=_[_0x5029('0x3c')]({},_0x327299,_0x9de076['options']);return db[_0x5029('0x2a')][_0x5029('0x45')](_0x327299)[_0x5029('0x21')](function(_0x5e7ec8){if(_0x5e7ec8){_0x3463cc=_0x5e7ec8;return _0x5e7ec8[_0x5029('0x86')]();}return null;})[_0x5029('0x21')](function(_0x5aa480){if(_0x5aa480){if(!_0x5aa480[_0x5029('0x33')]){throw new db[(_0x5029('0x66'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x590cc2=_0x5aa480;return db[_0x5029('0x68')][_0x5029('0x87')]({'raw':!![]});}return null;})['then'](function(_0x5842a5){if(_0x5842a5){_0x3ac39a=_['keyBy'](_0x5842a5,'id');var _0x313bdb;var _0x1d38e0=squel[_0x5029('0x88')]();_0x1d38e0['from'](_0x3463cc[_0x5029('0x6b')]);for(var _0x581237=0x0;_0x581237<_0x590cc2[_0x5029('0x33')];_0x581237+=0x1){_0x313bdb=_0x590cc2[_0x581237]['MetricId']?_0x3ac39a[_0x590cc2[_0x581237]['MetricId']]['metric']:_0x590cc2[_0x581237]['field'];_0x313bdb=_0x590cc2[_0x581237][_0x5029('0x6e')]?_[_0x5029('0x89')](_0x405d47[_0x590cc2[_0x581237][_0x5029('0x6e')]],'%s',_0x313bdb):_0x313bdb;_0x313bdb=_0x590cc2[_0x581237][_0x5029('0x6f')]?_[_0x5029('0x89')](_0x29c3a2[_0x590cc2[_0x581237]['format']],'%s',_0x313bdb):_0x313bdb;if(_0x590cc2[_0x581237][_0x5029('0x70')]){_0x1d38e0[_0x5029('0x7b')](_0x313bdb);}_0x590cc2[_0x581237][_0x5029('0x71')]&&_0x1d38e0[_0x5029('0x36')](_0x313bdb,_0x590cc2[_0x581237][_0x5029('0x71')]===_0x5029('0x72')?![]:!![]);_0x1d38e0['field'](_0x313bdb,_0x590cc2[_0x581237][_0x5029('0x73')]||_0x313bdb);}if(_0x3463cc[_0x5029('0x74')]){_0x3463cc[_0x5029('0x74')]=JSON['parse'](_0x3463cc['joins']);for(var _0xd05bc9=0x0;_0xd05bc9<_0x3463cc[_0x5029('0x74')][_0x5029('0x33')];_0xd05bc9+=0x1){if(_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x2c')]&&_[_0x5029('0x5e')](_0x1fa9eb,_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x2c')])&&_0x3463cc['joins'][_0xd05bc9][_0x5029('0x76')]&&_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x77')]&&_0x3463cc['joins'][_0xd05bc9][_0x5029('0x78')]){_0x1d38e0[_0x3463cc['joins'][_0xd05bc9][_0x5029('0x2c')]](_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x77')],null,util[_0x5029('0x6f')](_0x5029('0x79'),_0x3463cc[_0x5029('0x6b')],_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x76')],_0x3463cc['joins'][_0xd05bc9]['foreignTable'],_0x3463cc['joins'][_0xd05bc9][_0x5029('0x78')]));}}}if(_0x3463cc[_0x5029('0x7a')]){_0x3463cc[_0x5029('0x7a')]=JSON[_0x5029('0x75')](_0x3463cc[_0x5029('0x7a')]);_0x1d38e0['where'](_0x120acc(_0x3463cc[_0x5029('0x7a')][_0x5029('0x7b')]));}_0x62e4af=_0x1d38e0[_0x5029('0x7c')]();_0x1d38e0[_0x5029('0x1b')](_0x55ee4f);_0x1d38e0[_0x5029('0x19')](0x0);logger['debug'](_0x5029('0x7e'),_0x1d38e0[_0x5029('0x80')]());return dbH[_0x5029('0x7f')][_0x5029('0x2e')](_0x1d38e0[_0x5029('0x80')](),{'type':dbH[_0x5029('0x7f')][_0x5029('0x81')][_0x5029('0x9c')]});}})[_0x5029('0x21')](function(){return{'sql':_0x62e4af[_0x5029('0x80')]()};})[_0x5029('0x21')](respondWithResult(_0x2ac88e,null))[_0x5029('0x41')](handleError(_0x2ac88e,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index ac2aa58..37c5be6 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 _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 +var _0xca93=['../../config/environment','./analyticDefaultReport.attributes','exports','analytics_default_reports','util','../../config/logger','api','moment','path','rimraf'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xca93,0xae));var _0x3ca9=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xca93[_0x12d033];return _0x3b4e80;};'use strict';var _=require('lodash');var util=require(_0x3ca9('0x0'));var logger=require(_0x3ca9('0x1'))(_0x3ca9('0x2'));var moment=require(_0x3ca9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ca9('0x4'));var rimraf=require(_0x3ca9('0x5'));var config=require(_0x3ca9('0x6'));var attributes=require(_0x3ca9('0x7'));module[_0x3ca9('0x8')]=function(_0x10bfa1,_0x31e32b){return _0x10bfa1['define']('AnalyticDefaultReport',attributes,{'tableName':_0x3ca9('0x9'),'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 47bec05..1d8e83d 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 _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 +var _0x503b=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x503b,0x73));var _0xb503=function(_0x486805,_0x12bd34){_0x486805=_0x486805-0x0;var _0x2e9173=_0x503b[_0x486805];return _0x2e9173;};'use strict';var _=require(_0xb503('0x0'));var util=require(_0xb503('0x1'));var moment=require(_0xb503('0x2'));var BPromise=require(_0xb503('0x3'));var rs=require(_0xb503('0x4'));var fs=require('fs');var Redis=require(_0xb503('0x5'));var db=require(_0xb503('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb503('0x7'));var config=require(_0xb503('0x8'));var jayson=require(_0xb503('0x9'));var client=jayson[_0xb503('0xa')][_0xb503('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39a8b7,_0x1d7b1b,_0x34504b){return new BPromise(function(_0x4409de,_0x4e15cd){return client[_0xb503('0xc')](_0x39a8b7,_0x34504b)['then'](function(_0x354eb0){logger['info'](_0xb503('0xd'),_0x1d7b1b,_0xb503('0xe'));logger['debug'](_0xb503('0xf'),_0x1d7b1b,_0xb503('0xe'),JSON[_0xb503('0x10')](_0x354eb0));if(_0x354eb0[_0xb503('0x11')]){if(_0x354eb0[_0xb503('0x11')][_0xb503('0x12')]===0x1f4){logger[_0xb503('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x1d7b1b,_0x354eb0[_0xb503('0x11')][_0xb503('0x13')]);return _0x4e15cd(_0x354eb0['error'][_0xb503('0x13')]);}logger[_0xb503('0x11')](_0xb503('0xd'),_0x1d7b1b,_0x354eb0[_0xb503('0x11')][_0xb503('0x13')]);return _0x4409de(_0x354eb0[_0xb503('0x11')][_0xb503('0x13')]);}else{logger[_0xb503('0x14')](_0xb503('0xd'),_0x1d7b1b,'request\x20sent');_0x4409de(_0x354eb0[_0xb503('0x15')][_0xb503('0x13')]);}})[_0xb503('0x16')](function(_0x89df0f){logger[_0xb503('0x11')](_0xb503('0xd'),_0x1d7b1b,_0x89df0f);_0x4e15cd(_0x89df0f);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 9770a73..f382753 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 _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 +var _0xc97e=['Router','fs-extra','../../config/environment','./analyticDefaultReport.controller','index','get','/:id','isAuthenticated','show','/:id/preview','preview','run','/:id/query','query','post','put','update','delete','exports','multer','path','connect-timeout'];(function(_0x17dde4,_0x5c5ada){var _0x2a1076=function(_0x2b9df8){while(--_0x2b9df8){_0x17dde4['push'](_0x17dde4['shift']());}};_0x2a1076(++_0x5c5ada);}(_0xc97e,0x19f));var _0xec97=function(_0x291a25,_0x31ae01){_0x291a25=_0x291a25-0x0;var _0x380fab=_0xc97e[_0x291a25];return _0x380fab;};'use strict';var multer=require(_0xec97('0x0'));var util=require('util');var path=require(_0xec97('0x1'));var timeout=require(_0xec97('0x2'));var express=require('express');var router=express[_0xec97('0x3')]();var fs_extra=require(_0xec97('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xec97('0x5'));var controller=require(_0xec97('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xec97('0x7')]);router[_0xec97('0x8')](_0xec97('0x9'),auth[_0xec97('0xa')](),controller[_0xec97('0xb')]);router[_0xec97('0x8')](_0xec97('0xc'),auth[_0xec97('0xa')](),controller[_0xec97('0xd')]);router['get']('/:id/run',auth[_0xec97('0xa')](),controller[_0xec97('0xe')]);router[_0xec97('0x8')](_0xec97('0xf'),auth['isAuthenticated'](),controller[_0xec97('0x10')]);router[_0xec97('0x11')]('/',auth[_0xec97('0xa')](),controller['create']);router[_0xec97('0x12')](_0xec97('0x9'),auth[_0xec97('0xa')](),controller[_0xec97('0x13')]);router[_0xec97('0x14')](_0xec97('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xec97('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 561ad9a..edf937b 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 _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 +var _0xbae3=['scheduled','sequelize','exports','STRING','ENUM','pdf','xlsx','csv','DATE','Loading','manual'];(function(_0x3a4318,_0x13c6eb){var _0x36d746=function(_0x508617){while(--_0x508617){_0x3a4318['push'](_0x3a4318['shift']());}};_0x36d746(++_0x13c6eb);}(_0xbae3,0x90));var _0x3bae=function(_0x5ddc6a,_0x5aa4ee){_0x5ddc6a=_0x5ddc6a-0x0;var _0x5d297e=_0xbae3[_0x5ddc6a];return _0x5d297e;};'use strict';var Sequelize=require(_0x3bae('0x0'));var moment=require('moment');module[_0x3bae('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x3bae('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x3bae('0x3')]('csv',_0x3bae('0x4'),_0x3bae('0x5')),'allowNull':![],'defaultValue':_0x3bae('0x6')},'savename':{'type':Sequelize[_0x3bae('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x3bae('0x7')]},'endDate':{'type':Sequelize[_0x3bae('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x3bae('0x8')},'type':{'type':Sequelize[_0x3bae('0x3')](_0x3bae('0x9'),_0x3bae('0xa')),'allowNull':![],'defaultValue':_0x3bae('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index a406b43..1949d08 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 _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 +var _0x2617=['where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ExtractedReports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','basename','savename','output','existsSync','join','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','download','root','%s.%s','toLowerCase','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','get','UserProfileResource','destroy','error','name','send','AnalyticExtractedReport','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort'];(function(_0x4a71f0,_0x5a7b6c){var _0x3b169c=function(_0x342d80){while(--_0x342d80){_0x4a71f0['push'](_0x4a71f0['shift']());}};_0x3b169c(++_0x5a7b6c);}(_0x2617,0xd9));var _0x7261=function(_0x10bfbf,_0x1c839e){_0x10bfbf=_0x10bfbf-0x0;var _0xca4140=_0x2617[_0x10bfbf];return _0xca4140;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7261('0x0'));var jsonpatch=require(_0x7261('0x1'));var rp=require('request-promise');var moment=require(_0x7261('0x2'));var BPromise=require(_0x7261('0x3'));var Mustache=require(_0x7261('0x4'));var util=require('util');var path=require('path');var sox=require(_0x7261('0x5'));var csv=require(_0x7261('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7261('0x7'));var crypto=require(_0x7261('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x7261('0x9'));var toCsv=require(_0x7261('0x6'));var querystring=require(_0x7261('0xa'));var Papa=require(_0x7261('0xb'));var Redis=require('ioredis');var authService=require(_0x7261('0xc'));var qs=require(_0x7261('0xd'));var as=require(_0x7261('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7261('0xf'))(_0x7261('0x10'));var utils=require('../../config/utils');var config=require(_0x7261('0x11'));var licenseUtil=require(_0x7261('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3273af,_0x74b3e7){_0x74b3e7=_0x74b3e7||0xcc;return function(_0x229233){if(_0x229233){return _0x3273af[_0x7261('0x13')](_0x74b3e7);}return _0x3273af[_0x7261('0x14')](_0x74b3e7)[_0x7261('0x15')]();};}function respondWithResult(_0x58eeb1,_0x4dafb3){_0x4dafb3=_0x4dafb3||0xc8;return function(_0x19cc84){if(_0x19cc84){return _0x58eeb1[_0x7261('0x14')](_0x4dafb3)[_0x7261('0x16')](_0x19cc84);}};}function respondWithFilteredResult(_0x5d0d40,_0x2a421b){return function(_0xe3bb86){if(_0xe3bb86){var _0x2d47e4=typeof _0x2a421b[_0x7261('0x17')]===_0x7261('0x18')&&typeof _0x2a421b['limit']===_0x7261('0x18');var _0x85d3cb=_0xe3bb86[_0x7261('0x19')];var _0x4ad066=_0x2d47e4?0x0:_0x2a421b[_0x7261('0x17')];var _0x4fdefd=_0x2d47e4?_0xe3bb86[_0x7261('0x19')]:_0x2a421b[_0x7261('0x17')]+_0x2a421b['limit'];var _0x3a3db5;if(_0x4fdefd>=_0x85d3cb){_0x4fdefd=_0x85d3cb;_0x3a3db5=0xc8;}else{_0x3a3db5=0xce;}_0x5d0d40[_0x7261('0x14')](_0x3a3db5);return _0x5d0d40[_0x7261('0x1a')](_0x7261('0x1b'),_0x4ad066+'-'+_0x4fdefd+'/'+_0x85d3cb)[_0x7261('0x16')](_0xe3bb86);}return null;};}function patchUpdates(_0x439359){return function(_0x26bb55){try{jsonpatch[_0x7261('0x1c')](_0x26bb55,_0x439359,!![]);}catch(_0x236bb1){return BPromise[_0x7261('0x1d')](_0x236bb1);}return _0x26bb55['save']();};}function saveUpdates(_0x374710,_0x32edc7){return function(_0x1adf45){if(_0x1adf45){return _0x1adf45[_0x7261('0x1e')](_0x374710)[_0x7261('0x1f')](function(_0x374e96){return _0x374e96;});}return null;};}function removeEntity(_0x278022,_0x54d7cd){return function(_0x237dc3){if(_0x237dc3){return _0x237dc3['destroy']()[_0x7261('0x1f')](function(){var _0x2d5587=_0x237dc3[_0x7261('0x20')]({'plain':!![]});var _0x30e5eb='ExtractedReports';return db[_0x7261('0x21')][_0x7261('0x22')]({'where':{'type':_0x30e5eb,'resourceId':_0x2d5587['id']}})['then'](function(){return _0x237dc3;});})['then'](function(){_0x278022[_0x7261('0x14')](0xcc)[_0x7261('0x15')]();});}};}function handleEntityNotFound(_0x1ef32f,_0x365d38){return function(_0x3362b4){if(!_0x3362b4){_0x1ef32f[_0x7261('0x13')](0x194);}return _0x3362b4;};}function handleError(_0x5dec5b,_0x17bef8){_0x17bef8=_0x17bef8||0x1f4;return function(_0x5a3099){logger[_0x7261('0x23')](_0x5a3099['stack']);if(_0x5a3099[_0x7261('0x24')]){delete _0x5a3099[_0x7261('0x24')];}_0x5dec5b[_0x7261('0x14')](_0x17bef8)[_0x7261('0x25')](_0x5a3099);};}exports['index']=function(_0x36350e,_0x386f1d){var _0x5b5d10={},_0x2d32e3={},_0x49f058={'count':0x0,'rows':[]};var _0x49537b=_['map'](db[_0x7261('0x26')][_0x7261('0x27')],function(_0x5a502a){return{'name':_0x5a502a['fieldName'],'type':_0x5a502a[_0x7261('0x28')][_0x7261('0x29')]};});_0x2d32e3['model']=_[_0x7261('0x2a')](_0x49537b,'name');_0x2d32e3[_0x7261('0x2b')]=_[_0x7261('0x2c')](_0x36350e['query']);_0x2d32e3[_0x7261('0x2d')]=_[_0x7261('0x2e')](_0x2d32e3[_0x7261('0x2f')],_0x2d32e3[_0x7261('0x2b')]);_0x5b5d10[_0x7261('0x30')]=_['intersection'](_0x2d32e3['model'],qs['fields'](_0x36350e[_0x7261('0x2b')][_0x7261('0x31')]));_0x5b5d10[_0x7261('0x30')]=_0x5b5d10[_0x7261('0x30')][_0x7261('0x32')]?_0x5b5d10[_0x7261('0x30')]:_0x2d32e3[_0x7261('0x2f')];if(!_0x36350e['query'][_0x7261('0x33')](_0x7261('0x34'))){_0x5b5d10['limit']=qs[_0x7261('0x35')](_0x36350e[_0x7261('0x2b')][_0x7261('0x35')]);_0x5b5d10[_0x7261('0x17')]=qs[_0x7261('0x17')](_0x36350e[_0x7261('0x2b')]['offset']);}_0x5b5d10[_0x7261('0x36')]=qs[_0x7261('0x37')](_0x36350e[_0x7261('0x2b')][_0x7261('0x37')]);_0x5b5d10[_0x7261('0x38')]=qs[_0x7261('0x2d')](_[_0x7261('0x39')](_0x36350e['query'],_0x2d32e3[_0x7261('0x2d')]),_0x49537b);if(_0x36350e[_0x7261('0x2b')][_0x7261('0x3a')]){_0x5b5d10[_0x7261('0x38')]=_[_0x7261('0x3b')](_0x5b5d10[_0x7261('0x38')],{'$or':_[_0x7261('0x2a')](_0x49537b,function(_0xa68837){if(_0xa68837[_0x7261('0x28')]!==_0x7261('0x3c')){var _0x2514cb={};_0x2514cb[_0xa68837[_0x7261('0x24')]]={'$like':'%'+_0x36350e['query'][_0x7261('0x3a')]+'%'};return _0x2514cb;}})});}_0x5b5d10=_['merge']({},_0x5b5d10,_0x36350e[_0x7261('0x3d')]);var _0x2a9a76={'where':_0x5b5d10[_0x7261('0x38')]};return db[_0x7261('0x26')][_0x7261('0x19')](_0x2a9a76)[_0x7261('0x1f')](function(_0x2e995d){_0x49f058[_0x7261('0x19')]=_0x2e995d;if(_0x36350e[_0x7261('0x2b')][_0x7261('0x3e')]){_0x5b5d10[_0x7261('0x3f')]=[{'all':!![]}];}return db[_0x7261('0x26')][_0x7261('0x40')](_0x5b5d10);})[_0x7261('0x1f')](function(_0x47b0b7){_0x49f058[_0x7261('0x41')]=_0x47b0b7;return _0x49f058;})[_0x7261('0x1f')](respondWithFilteredResult(_0x386f1d,_0x5b5d10))[_0x7261('0x42')](handleError(_0x386f1d,null));};exports[_0x7261('0x43')]=function(_0x258bcd,_0x4c95f5){var _0x538e96={'raw':!![],'where':{'id':_0x258bcd['params']['id']}},_0x10b861={};_0x10b861[_0x7261('0x2f')]=_[_0x7261('0x2c')](db[_0x7261('0x26')][_0x7261('0x27')]);_0x10b861[_0x7261('0x2b')]=_[_0x7261('0x2c')](_0x258bcd['query']);_0x10b861[_0x7261('0x2d')]=_[_0x7261('0x2e')](_0x10b861[_0x7261('0x2f')],_0x10b861['query']);_0x538e96[_0x7261('0x30')]=_[_0x7261('0x2e')](_0x10b861['model'],qs[_0x7261('0x31')](_0x258bcd[_0x7261('0x2b')][_0x7261('0x31')]));_0x538e96[_0x7261('0x30')]=_0x538e96[_0x7261('0x30')][_0x7261('0x32')]?_0x538e96[_0x7261('0x30')]:_0x10b861[_0x7261('0x2f')];if(_0x258bcd[_0x7261('0x2b')][_0x7261('0x3e')]){_0x538e96[_0x7261('0x3f')]=[{'all':!![]}];}_0x538e96=_[_0x7261('0x3b')]({},_0x538e96,_0x258bcd['options']);return db[_0x7261('0x26')][_0x7261('0x44')](_0x538e96)[_0x7261('0x1f')](handleEntityNotFound(_0x4c95f5,null))['then'](respondWithResult(_0x4c95f5,null))['catch'](handleError(_0x4c95f5,null));};exports[_0x7261('0x45')]=function(_0xe74cc4,_0x300acf){return db[_0x7261('0x26')][_0x7261('0x45')](_0xe74cc4[_0x7261('0x46')],{})['then'](function(_0xf733e6){var _0x5baebb=_0xe74cc4[_0x7261('0x47')][_0x7261('0x20')]({'plain':!![]});if(!_0x5baebb)throw new Error(_0x7261('0x48'));if(_0x5baebb['role']==='user'){var _0x36f8c7=_0xf733e6['get']({'plain':!![]});var _0x2809c6=_0x7261('0x49');return db['UserProfileSection']['find']({'where':{'name':_0x2809c6,'userProfileId':_0x5baebb[_0x7261('0x4a')]},'raw':!![]})['then'](function(_0x18a7c2){if(_0x18a7c2&&_0x18a7c2[_0x7261('0x4b')]===0x0){return db[_0x7261('0x21')][_0x7261('0x45')]({'name':_0x36f8c7[_0x7261('0x24')],'resourceId':_0x36f8c7['id'],'type':_0x18a7c2[_0x7261('0x24')],'sectionId':_0x18a7c2['id']},{})[_0x7261('0x1f')](function(){return _0xf733e6;});}else{return _0xf733e6;}})[_0x7261('0x42')](function(_0x4aadc6){logger['error'](_0x7261('0x4c'),_0x4aadc6);throw _0x4aadc6;});}return _0xf733e6;})[_0x7261('0x1f')](respondWithResult(_0x300acf,0xc9))[_0x7261('0x42')](handleError(_0x300acf,null));};exports[_0x7261('0x1e')]=function(_0x52f1b5,_0x19db0e){if(_0x52f1b5['body']['id']){delete _0x52f1b5[_0x7261('0x46')]['id'];}return db[_0x7261('0x26')][_0x7261('0x44')]({'where':{'id':_0x52f1b5[_0x7261('0x4d')]['id']}})['then'](handleEntityNotFound(_0x19db0e,null))[_0x7261('0x1f')](saveUpdates(_0x52f1b5[_0x7261('0x46')],null))[_0x7261('0x1f')](respondWithResult(_0x19db0e,null))[_0x7261('0x42')](handleError(_0x19db0e,null));};exports['destroy']=function(_0x5c78ef,_0x470fee){return db['AnalyticExtractedReport'][_0x7261('0x44')]({'where':{'id':_0x5c78ef['params']['id']}})[_0x7261('0x1f')](handleEntityNotFound(_0x470fee,null))[_0x7261('0x1f')](removeEntity(_0x470fee,null))[_0x7261('0x42')](handleError(_0x470fee,null));};exports['download']=function(_0x38d838,_0x2611a6,_0x16d818){return db[_0x7261('0x26')][_0x7261('0x44')]({'where':{'id':_0x38d838[_0x7261('0x4d')]['id']},'attributes':[_0x7261('0x24'),_0x7261('0x4e'),_0x7261('0x4f'),_0x7261('0x50')],'raw':!![]})[_0x7261('0x1f')](handleEntityNotFound(_0x2611a6,null))[_0x7261('0x1f')](function(_0x14006f){if(_0x14006f){if(!fs[_0x7261('0x51')](path[_0x7261('0x52')](config['root'],_0x7261('0x53'),_0x14006f[_0x7261('0x4f')]))){throw new db[(_0x7261('0x54'))][(_0x7261('0x55'))](_0x7261('0x56'));}if(_0x38d838[_0x7261('0x2b')]['exists']){return _0x2611a6[_0x7261('0x13')](0xc8);}return _0x2611a6[_0x7261('0x57')](path[_0x7261('0x52')](config[_0x7261('0x58')],_0x7261('0x53'),_0x14006f[_0x7261('0x4f')]),util['format'](_0x7261('0x59'),_0x14006f[_0x7261('0x4e')]||_0x14006f['name'],_0x14006f['output'][_0x7261('0x5a')]()));}})[_0x7261('0x42')](handleError(_0x2611a6,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index cc5f0d8..608e47b 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 _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 +var _0x08e4=['analytics_extracted_reports','lodash','../../config/logger','api','bluebird','path','../../config/environment','exports','define','AnalyticExtractedReport'];(function(_0x1f1a97,_0xadfc15){var _0x29fc6a=function(_0x38c180){while(--_0x38c180){_0x1f1a97['push'](_0x1f1a97['shift']());}};_0x29fc6a(++_0xadfc15);}(_0x08e4,0xbf));var _0x408e=function(_0x100a26,_0x6df99c){_0x100a26=_0x100a26-0x0;var _0x371ec4=_0x08e4[_0x100a26];return _0x371ec4;};'use strict';var _=require(_0x408e('0x0'));var util=require('util');var logger=require(_0x408e('0x1'))(_0x408e('0x2'));var moment=require('moment');var BPromise=require(_0x408e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x408e('0x4'));var rimraf=require('rimraf');var config=require(_0x408e('0x5'));var attributes=require('./analyticExtractedReport.attributes');module[_0x408e('0x6')]=function(_0x3c1381,_0x3ddc9b){return _0x3c1381[_0x408e('0x7')](_0x408e('0x8'),attributes,{'tableName':_0x408e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 214c0b4..12ca829 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 _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 +var _0x330c=['then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0xda3cf9,_0x45a4dc){var _0x22e4b3=function(_0x14361f){while(--_0x14361f){_0xda3cf9['push'](_0xda3cf9['shift']());}};_0x22e4b3(++_0x45a4dc);}(_0x330c,0x14e));var _0xc330=function(_0x4a52df,_0x52142d){_0x4a52df=_0x4a52df-0x0;var _0x38aa1a=_0x330c[_0x4a52df];return _0x38aa1a;};'use strict';var _=require('lodash');var util=require(_0xc330('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc330('0x1'));var fs=require('fs');var Redis=require(_0xc330('0x2'));var db=require(_0xc330('0x3'))['db'];var utils=require(_0xc330('0x4'));var logger=require(_0xc330('0x5'))('rpc');var config=require(_0xc330('0x6'));var jayson=require(_0xc330('0x7'));var client=jayson[_0xc330('0x8')][_0xc330('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x360d53,_0x1d9ffa,_0x560fdb){return new BPromise(function(_0x404a8d,_0x3e19ef){return client[_0xc330('0xa')](_0x360d53,_0x560fdb)[_0xc330('0xb')](function(_0x2a3d7b){logger[_0xc330('0xc')](_0xc330('0xd'),_0x1d9ffa,_0xc330('0xe'));logger[_0xc330('0xf')](_0xc330('0x10'),_0x1d9ffa,_0xc330('0xe'),JSON[_0xc330('0x11')](_0x2a3d7b));if(_0x2a3d7b[_0xc330('0x12')]){if(_0x2a3d7b['error'][_0xc330('0x13')]===0x1f4){logger[_0xc330('0x12')](_0xc330('0xd'),_0x1d9ffa,_0x2a3d7b[_0xc330('0x12')][_0xc330('0x14')]);return _0x3e19ef(_0x2a3d7b[_0xc330('0x12')]['message']);}logger[_0xc330('0x12')](_0xc330('0xd'),_0x1d9ffa,_0x2a3d7b['error'][_0xc330('0x14')]);return _0x404a8d(_0x2a3d7b[_0xc330('0x12')][_0xc330('0x14')]);}else{logger[_0xc330('0xc')](_0xc330('0xd'),_0x1d9ffa,'request\x20sent');_0x404a8d(_0x2a3d7b[_0xc330('0x15')][_0xc330('0x14')]);}})[_0xc330('0x16')](function(_0x5f5ab7){logger[_0xc330('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1d9ffa,_0x5f5ab7);_0x3e19ef(_0x5f5ab7);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index dc20746..0a37384 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 _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 +var _0x6d47=['put','update','delete','/:id','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','show','/:id/download','download','post','create'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x6d47,0x16a));var _0x76d4=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x6d47[_0xa6cc5c];return _0x44803d;};'use strict';var multer=require('multer');var util=require(_0x76d4('0x0'));var path=require(_0x76d4('0x1'));var timeout=require('connect-timeout');var express=require(_0x76d4('0x2'));var router=express[_0x76d4('0x3')]();var fs_extra=require(_0x76d4('0x4'));var auth=require(_0x76d4('0x5'));var interaction=require(_0x76d4('0x6'));var config=require(_0x76d4('0x7'));var controller=require(_0x76d4('0x8'));router[_0x76d4('0x9')]('/',auth[_0x76d4('0xa')](),controller['index']);router[_0x76d4('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x76d4('0xb')]);router[_0x76d4('0x9')](_0x76d4('0xc'),auth[_0x76d4('0xa')](),controller[_0x76d4('0xd')]);router[_0x76d4('0xe')]('/',auth[_0x76d4('0xa')](),controller[_0x76d4('0xf')]);router[_0x76d4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x76d4('0x11')]);router[_0x76d4('0x12')](_0x76d4('0x13'),auth[_0x76d4('0xa')](),controller[_0x76d4('0x14')]);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 5c11f80..4e746c5 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 _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 +var _0x3c72=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x150d3d,_0x2cf026){var _0x5943ec=function(_0x179d45){while(--_0x179d45){_0x150d3d['push'](_0x150d3d['shift']());}};_0x5943ec(++_0x2cf026);}(_0x3c72,0x96));var _0x23c7=function(_0x472904,_0x8d115d){_0x472904=_0x472904-0x0;var _0x3335c2=_0x3c72[_0x472904];return _0x3335c2;};'use strict';var Sequelize=require(_0x23c7('0x0'));module[_0x23c7('0x1')]={'field':{'type':Sequelize[_0x23c7('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x23c7('0x3')]},'format':{'type':Sequelize[_0x23c7('0x3')]},'groupBy':{'type':Sequelize[_0x23c7('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x23c7('0x3')]},'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 3f77877..6d11d3d 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 _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 +var _0xfc99=['lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','save','update','then','destroy','name','send','map','AnalyticFieldReport','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','keys','find','create','bulkCreate','body','params','ids','addFields','findOne','sequelize','transaction','CustomReportId','findAll','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra'];(function(_0x11da29,_0x5402c1){var _0x434192=function(_0x4c2665){while(--_0x4c2665){_0x11da29['push'](_0x11da29['shift']());}};_0x434192(++_0x5402c1);}(_0xfc99,0x139));var _0x9fc9=function(_0x30d6a5,_0x546523){_0x30d6a5=_0x30d6a5-0x0;var _0x3cd234=_0xfc99[_0x30d6a5];return _0x3cd234;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9fc9('0x0'));var zipdir=require(_0x9fc9('0x1'));var jsonpatch=require(_0x9fc9('0x2'));var rp=require('request-promise');var moment=require(_0x9fc9('0x3'));var BPromise=require(_0x9fc9('0x4'));var Mustache=require(_0x9fc9('0x5'));var util=require(_0x9fc9('0x6'));var path=require(_0x9fc9('0x7'));var sox=require(_0x9fc9('0x8'));var csv=require('to-csv');var ejs=require(_0x9fc9('0x9'));var fs=require('fs');var fs_extra=require(_0x9fc9('0xa'));var _=require(_0x9fc9('0xb'));var squel=require(_0x9fc9('0xc'));var crypto=require(_0x9fc9('0xd'));var jsforce=require(_0x9fc9('0xe'));var deskjs=require(_0x9fc9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9fc9('0x10'));var Papa=require('papaparse');var Redis=require(_0x9fc9('0x11'));var authService=require(_0x9fc9('0x12'));var qs=require(_0x9fc9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9fc9('0x14'))(_0x9fc9('0x15'));var utils=require(_0x9fc9('0x16'));var config=require(_0x9fc9('0x17'));var licenseUtil=require(_0x9fc9('0x18'));var db=require(_0x9fc9('0x19'))['db'];function respondWithStatusCode(_0x5d0c2d,_0x17438f){_0x17438f=_0x17438f||0xcc;return function(_0x31bd6d){if(_0x31bd6d){return _0x5d0c2d[_0x9fc9('0x1a')](_0x17438f);}return _0x5d0c2d[_0x9fc9('0x1b')](_0x17438f)[_0x9fc9('0x1c')]();};}function respondWithResult(_0x17b4ef,_0x31cf8e){_0x31cf8e=_0x31cf8e||0xc8;return function(_0x12693e){if(_0x12693e){return _0x17b4ef[_0x9fc9('0x1b')](_0x31cf8e)[_0x9fc9('0x1d')](_0x12693e);}};}function respondWithFilteredResult(_0x46255e,_0x3e4ad9){return function(_0xd245af){if(_0xd245af){var _0x3bac71=typeof _0x3e4ad9['offset']===_0x9fc9('0x1e')&&typeof _0x3e4ad9[_0x9fc9('0x1f')]==='undefined';var _0x405378=_0xd245af[_0x9fc9('0x20')];var _0x4e64b0=_0x3bac71?0x0:_0x3e4ad9['offset'];var _0x24f6ef=_0x3bac71?_0xd245af[_0x9fc9('0x20')]:_0x3e4ad9[_0x9fc9('0x21')]+_0x3e4ad9[_0x9fc9('0x1f')];var _0x57d610;if(_0x24f6ef>=_0x405378){_0x24f6ef=_0x405378;_0x57d610=0xc8;}else{_0x57d610=0xce;}_0x46255e[_0x9fc9('0x1b')](_0x57d610);return _0x46255e['set'](_0x9fc9('0x22'),_0x4e64b0+'-'+_0x24f6ef+'/'+_0x405378)[_0x9fc9('0x1d')](_0xd245af);}return null;};}function patchUpdates(_0xee665c){return function(_0x4a4b67){try{jsonpatch['apply'](_0x4a4b67,_0xee665c,!![]);}catch(_0x3dca58){return BPromise['reject'](_0x3dca58);}return _0x4a4b67[_0x9fc9('0x23')]();};}function saveUpdates(_0x1768dc,_0x927799){return function(_0x193061){if(_0x193061){return _0x193061[_0x9fc9('0x24')](_0x1768dc)[_0x9fc9('0x25')](function(_0x33e529){return _0x33e529;});}return null;};}function removeEntity(_0x15c9a6,_0x459e0c){return function(_0x5386d8){if(_0x5386d8){return _0x5386d8[_0x9fc9('0x26')]()['then'](function(){_0x15c9a6['status'](0xcc)[_0x9fc9('0x1c')]();});}};}function handleEntityNotFound(_0xa2de9,_0x1b0e2b){return function(_0x17f015){if(!_0x17f015){_0xa2de9[_0x9fc9('0x1a')](0x194);}return _0x17f015;};}function handleError(_0x204317,_0x254165){_0x254165=_0x254165||0x1f4;return function(_0xd432a6){logger['error'](_0xd432a6['stack']);if(_0xd432a6[_0x9fc9('0x27')]){delete _0xd432a6[_0x9fc9('0x27')];}_0x204317['status'](_0x254165)[_0x9fc9('0x28')](_0xd432a6);};}exports['index']=function(_0xeca997,_0x1fb709){var _0x145773={},_0x5c9567={},_0x5e5083={'count':0x0,'rows':[]};var _0x60dc6=_[_0x9fc9('0x29')](db[_0x9fc9('0x2a')][_0x9fc9('0x2b')],function(_0xcbc709){return{'name':_0xcbc709[_0x9fc9('0x2c')],'type':_0xcbc709['type'][_0x9fc9('0x2d')]};});_0x5c9567[_0x9fc9('0x2e')]=_[_0x9fc9('0x29')](_0x60dc6,_0x9fc9('0x27'));_0x5c9567[_0x9fc9('0x2f')]=_['keys'](_0xeca997[_0x9fc9('0x2f')]);_0x5c9567[_0x9fc9('0x30')]=_[_0x9fc9('0x31')](_0x5c9567[_0x9fc9('0x2e')],_0x5c9567['query']);_0x145773['attributes']=_['intersection'](_0x5c9567[_0x9fc9('0x2e')],qs[_0x9fc9('0x32')](_0xeca997[_0x9fc9('0x2f')][_0x9fc9('0x32')]));_0x145773[_0x9fc9('0x33')]=_0x145773[_0x9fc9('0x33')][_0x9fc9('0x34')]?_0x145773[_0x9fc9('0x33')]:_0x5c9567[_0x9fc9('0x2e')];if(!_0xeca997[_0x9fc9('0x2f')][_0x9fc9('0x35')](_0x9fc9('0x36'))){_0x145773[_0x9fc9('0x1f')]=qs[_0x9fc9('0x1f')](_0xeca997[_0x9fc9('0x2f')][_0x9fc9('0x1f')]);_0x145773[_0x9fc9('0x21')]=qs[_0x9fc9('0x21')](_0xeca997[_0x9fc9('0x2f')][_0x9fc9('0x21')]);}_0x145773['order']=qs['sort'](_0xeca997['query'][_0x9fc9('0x37')]);_0x145773['where']=qs['filters'](_[_0x9fc9('0x38')](_0xeca997[_0x9fc9('0x2f')],_0x5c9567[_0x9fc9('0x30')]),_0x60dc6);if(_0xeca997[_0x9fc9('0x2f')][_0x9fc9('0x39')]){_0x145773[_0x9fc9('0x3a')]=_[_0x9fc9('0x3b')](_0x145773['where'],{'$or':_[_0x9fc9('0x29')](_0x60dc6,function(_0x3ac275){if(_0x3ac275[_0x9fc9('0x3c')]!==_0x9fc9('0x3d')){var _0x14f8a5={};_0x14f8a5[_0x3ac275[_0x9fc9('0x27')]]={'$like':'%'+_0xeca997[_0x9fc9('0x2f')]['filter']+'%'};return _0x14f8a5;}})});}_0x145773=_[_0x9fc9('0x3b')]({},_0x145773,_0xeca997[_0x9fc9('0x3e')]);var _0x2e6dce={'where':_0x145773[_0x9fc9('0x3a')]};return db[_0x9fc9('0x2a')][_0x9fc9('0x20')](_0x2e6dce)[_0x9fc9('0x25')](function(_0x1171b2){_0x5e5083[_0x9fc9('0x20')]=_0x1171b2;if(_0xeca997[_0x9fc9('0x2f')][_0x9fc9('0x3f')]){_0x145773[_0x9fc9('0x40')]=[{'all':!![]}];}return db['AnalyticFieldReport']['findAll'](_0x145773);})['then'](function(_0x4294d9){_0x5e5083[_0x9fc9('0x41')]=_0x4294d9;return _0x5e5083;})['then'](respondWithFilteredResult(_0x1fb709,_0x145773))[_0x9fc9('0x42')](handleError(_0x1fb709,null));};exports[_0x9fc9('0x43')]=function(_0x51720f,_0x22b242){var _0x4404bb={'raw':![],'where':{'id':_0x51720f['params']['id']}},_0xa75615={};_0xa75615['model']=_['keys'](db[_0x9fc9('0x2a')][_0x9fc9('0x2b')]);_0xa75615['query']=_[_0x9fc9('0x44')](_0x51720f[_0x9fc9('0x2f')]);_0xa75615[_0x9fc9('0x30')]=_['intersection'](_0xa75615[_0x9fc9('0x2e')],_0xa75615[_0x9fc9('0x2f')]);_0x4404bb['attributes']=_['intersection'](_0xa75615[_0x9fc9('0x2e')],qs['fields'](_0x51720f[_0x9fc9('0x2f')]['fields']));_0x4404bb[_0x9fc9('0x33')]=_0x4404bb[_0x9fc9('0x33')]['length']?_0x4404bb['attributes']:_0xa75615[_0x9fc9('0x2e')];if(_0x51720f['query']['includeAll']){_0x4404bb[_0x9fc9('0x40')]=[{'all':!![]}];}_0x4404bb=_[_0x9fc9('0x3b')]({},_0x4404bb,_0x51720f[_0x9fc9('0x3e')]);return db[_0x9fc9('0x2a')][_0x9fc9('0x45')](_0x4404bb)[_0x9fc9('0x25')](handleEntityNotFound(_0x22b242,null))[_0x9fc9('0x25')](respondWithResult(_0x22b242,null))[_0x9fc9('0x42')](handleError(_0x22b242,null));};exports[_0x9fc9('0x46')]=function(_0x4a5f29,_0x2b9c84){return db[_0x9fc9('0x2a')][_0x9fc9('0x46')](_0x4a5f29['body'],{})[_0x9fc9('0x25')](respondWithResult(_0x2b9c84,0xc9))[_0x9fc9('0x42')](handleError(_0x2b9c84,null));};exports[_0x9fc9('0x47')]=function(_0xc4256c,_0x4365a2){return db[_0x9fc9('0x2a')]['bulkCreate'](_0xc4256c[_0x9fc9('0x48')],{'raw':![],'individualHooks':!![]})[_0x9fc9('0x25')](respondWithResult(_0x4365a2,0xc9))[_0x9fc9('0x42')](handleError(_0x4365a2,null));};exports['update']=function(_0x5bb800,_0x298347){if(_0x5bb800[_0x9fc9('0x48')]['id']){delete _0x5bb800[_0x9fc9('0x48')]['id'];}return db[_0x9fc9('0x2a')][_0x9fc9('0x45')]({'where':{'id':_0x5bb800[_0x9fc9('0x49')]['id']}})[_0x9fc9('0x25')](handleEntityNotFound(_0x298347,null))[_0x9fc9('0x25')](saveUpdates(_0x5bb800[_0x9fc9('0x48')],null))[_0x9fc9('0x25')](respondWithResult(_0x298347,null))[_0x9fc9('0x42')](handleError(_0x298347,null));};exports['destroy']=function(_0x23b400,_0x3be468){return db['AnalyticFieldReport'][_0x9fc9('0x45')]({'where':{'id':_0x23b400[_0x9fc9('0x49')]['id']}})[_0x9fc9('0x25')](handleEntityNotFound(_0x3be468,null))[_0x9fc9('0x25')](removeEntity(_0x3be468,null))['catch'](handleError(_0x3be468,null));};exports['bulkDestroy']=function(_0xafb44c,_0x255dac){return db[_0x9fc9('0x2a')][_0x9fc9('0x26')]({'where':{'id':_0xafb44c[_0x9fc9('0x2f')][_0x9fc9('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0x9fc9('0x25')](respondWithResult(_0x255dac,0xcc))[_0x9fc9('0x42')](handleError(_0x255dac,null));};exports[_0x9fc9('0x4b')]=function(_0x2d91b8,_0x2be401,_0xb1c2d9){return db['AnalyticCustomReport'][_0x9fc9('0x4c')]({'where':{'id':_0x2d91b8['params']['id']}})[_0x9fc9('0x25')](handleEntityNotFound(_0x2be401,null))['then'](function(_0x371168){if(_0x371168){return db[_0x9fc9('0x4d')][_0x9fc9('0x4e')](function(_0x506b83){return db[_0x9fc9('0x2a')][_0x9fc9('0x26')]({'where':{'CustomReportId':_0x2d91b8['params']['id']},'transaction':_0x506b83})['then'](function(_0x3846c1){var _0x319378=_[_0x9fc9('0x29')](_0x2d91b8['body'],function(_0x28df42){delete _0x28df42['id'];_0x28df42[_0x9fc9('0x4f')]=_0x2d91b8[_0x9fc9('0x49')]['id'];return _0x28df42;});return db[_0x9fc9('0x2a')][_0x9fc9('0x47')](_0x319378,{'transaction':_0x506b83});});})[_0x9fc9('0x25')](function(){return db[_0x9fc9('0x2a')][_0x9fc9('0x50')]({'where':{'CustomReportId':_0x2d91b8['params']['id']}});});}})[_0x9fc9('0x25')](respondWithResult(_0x2be401,null))[_0x9fc9('0x42')](handleError(_0x2be401,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 4550573..9889750 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 _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 +var _0xa26f=['moment','bluebird','request-promise','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','api'];(function(_0x4d666c,_0x55ad25){var _0x7fd845=function(_0x2f75c8){while(--_0x2f75c8){_0x4d666c['push'](_0x4d666c['shift']());}};_0x7fd845(++_0x55ad25);}(_0xa26f,0x6b));var _0xfa26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa26f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfa26('0x0'));var util=require('util');var logger=require(_0xfa26('0x1'))(_0xfa26('0x2'));var moment=require(_0xfa26('0x3'));var BPromise=require(_0xfa26('0x4'));var rp=require(_0xfa26('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfa26('0x6'));module[_0xfa26('0x7')]=function(_0x105ee2,_0x145116){return _0x105ee2[_0xfa26('0x8')](_0xfa26('0x9'),attributes,{'tableName':_0xfa26('0xa'),'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 40626ba..418e2c4 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 _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 +var _0x270c=['info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x36a236,_0x3cc5fc){var _0xa4ab27=function(_0xac60ea){while(--_0xac60ea){_0x36a236['push'](_0x36a236['shift']());}};_0xa4ab27(++_0x3cc5fc);}(_0x270c,0xd8));var _0xc270=function(_0x441d52,_0x4ca1c4){_0x441d52=_0x441d52-0x0;var _0x32f501=_0x270c[_0x441d52];return _0x32f501;};'use strict';var _=require(_0xc270('0x0'));var util=require(_0xc270('0x1'));var moment=require(_0xc270('0x2'));var BPromise=require('bluebird');var rs=require(_0xc270('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc270('0x4'))['db'];var utils=require(_0xc270('0x5'));var logger=require(_0xc270('0x6'))(_0xc270('0x7'));var config=require(_0xc270('0x8'));var jayson=require(_0xc270('0x9'));var client=jayson[_0xc270('0xa')][_0xc270('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd0c690,_0x4dc56c,_0x55f797){return new BPromise(function(_0x419169,_0x3ad41c){return client[_0xc270('0xc')](_0xd0c690,_0x55f797)[_0xc270('0xd')](function(_0x5c25ea){logger[_0xc270('0xe')](_0xc270('0xf'),_0x4dc56c,_0xc270('0x10'));logger[_0xc270('0x11')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x4dc56c,_0xc270('0x10'),JSON[_0xc270('0x12')](_0x5c25ea));if(_0x5c25ea[_0xc270('0x13')]){if(_0x5c25ea[_0xc270('0x13')][_0xc270('0x14')]===0x1f4){logger['error'](_0xc270('0xf'),_0x4dc56c,_0x5c25ea['error'][_0xc270('0x15')]);return _0x3ad41c(_0x5c25ea[_0xc270('0x13')]['message']);}logger[_0xc270('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4dc56c,_0x5c25ea['error'][_0xc270('0x15')]);return _0x419169(_0x5c25ea[_0xc270('0x13')][_0xc270('0x15')]);}else{logger[_0xc270('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4dc56c,_0xc270('0x10'));_0x419169(_0x5c25ea[_0xc270('0x16')][_0xc270('0x15')]);}})['catch'](function(_0x4b292c){logger[_0xc270('0x13')](_0xc270('0xf'),_0x4dc56c,_0x4b292c);_0x3ad41c(_0x4b292c);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 047e535..a382724 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(_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 +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(_0x4dc5eb,_0x8e2c9a){var _0x55a235=function(_0x4269c4){while(--_0x4269c4){_0x4dc5eb['push'](_0x4dc5eb['shift']());}};_0x55a235(++_0x8e2c9a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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 c91bd65..b3f222a 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 _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 +var _0x6c9c=['name','STRING','TEXT','sequelize','exports'];(function(_0x1b1464,_0x59069e){var _0x32d77b=function(_0x19fec5){while(--_0x19fec5){_0x1b1464['push'](_0x1b1464['shift']());}};_0x32d77b(++_0x59069e);}(_0x6c9c,0x12a));var _0xc6c9=function(_0x7246ee,_0x2c46a9){_0x7246ee=_0x7246ee-0x0;var _0x4ae624=_0x6c9c[_0x7246ee];return _0x4ae624;};'use strict';var Sequelize=require(_0xc6c9('0x0'));module[_0xc6c9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc6c9('0x2')},'table':{'type':Sequelize[_0xc6c9('0x3')]},'metric':{'type':Sequelize[_0xc6c9('0x4')]},'description':{'type':Sequelize[_0xc6c9('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 1fd776d..4894cca 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 _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 +var _0xf2ca=['filter','merge','map','type','VIRTUAL','options','AnalyticMetric','count','includeAll','findAll','rows','catch','keys','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','get','Metrics','UserProfileResource','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x56b9ab,_0x2a36bd){var _0x1fad82=function(_0x377a41){while(--_0x377a41){_0x56b9ab['push'](_0x56b9ab['shift']());}};_0x1fad82(++_0x2a36bd);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x20f96d,_0x23e67f){_0x20f96d=_0x20f96d-0x0;var _0x9a7524=_0xf2ca[_0x20f96d];return _0x9a7524;};'use strict';var emlformat=require(_0xaf2c('0x0'));var rimraf=require(_0xaf2c('0x1'));var zipdir=require(_0xaf2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf2c('0x3'));var moment=require(_0xaf2c('0x4'));var BPromise=require(_0xaf2c('0x5'));var Mustache=require(_0xaf2c('0x6'));var util=require(_0xaf2c('0x7'));var path=require(_0xaf2c('0x8'));var sox=require('sox');var csv=require(_0xaf2c('0x9'));var ejs=require(_0xaf2c('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xb'));var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0x9'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];function respondWithStatusCode(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xcc;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0x18')](_0x59a59b);}return _0x285dac[_0xaf2c('0x19')](_0x59a59b)[_0xaf2c('0x1a')]();};}function respondWithResult(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0xc8;return function(_0x152c73){if(_0x152c73){return _0x18a8a5[_0xaf2c('0x19')](_0x293ca6)[_0xaf2c('0x1b')](_0x152c73);}};}function respondWithFilteredResult(_0x2119c8,_0x1d0633){return function(_0x6ac8e){if(_0x6ac8e){var _0x2b4d13=typeof _0x1d0633[_0xaf2c('0x1c')]===_0xaf2c('0x1d')&&typeof _0x1d0633[_0xaf2c('0x1e')]==='undefined';var _0x3ca650=_0x6ac8e['count'];var _0x278a28=_0x2b4d13?0x0:_0x1d0633[_0xaf2c('0x1c')];var _0x1d544a=_0x2b4d13?_0x6ac8e['count']:_0x1d0633[_0xaf2c('0x1c')]+_0x1d0633[_0xaf2c('0x1e')];var _0x1fec4c;if(_0x1d544a>=_0x3ca650){_0x1d544a=_0x3ca650;_0x1fec4c=0xc8;}else{_0x1fec4c=0xce;}_0x2119c8[_0xaf2c('0x19')](_0x1fec4c);return _0x2119c8[_0xaf2c('0x1f')](_0xaf2c('0x20'),_0x278a28+'-'+_0x1d544a+'/'+_0x3ca650)['json'](_0x6ac8e);}return null;};}function patchUpdates(_0x35e712){return function(_0x164bcb){try{jsonpatch[_0xaf2c('0x21')](_0x164bcb,_0x35e712,!![]);}catch(_0x3bfd3f){return BPromise[_0xaf2c('0x22')](_0x3bfd3f);}return _0x164bcb['save']();};}function saveUpdates(_0x396646,_0xbf6f62){return function(_0x18153c){if(_0x18153c){return _0x18153c['update'](_0x396646)['then'](function(_0x29cbdf){return _0x29cbdf;});}return null;};}function removeEntity(_0x303546,_0x1cafad){return function(_0x99f78d){if(_0x99f78d){return _0x99f78d['destroy']()[_0xaf2c('0x23')](function(){var _0xf1a7cf=_0x99f78d[_0xaf2c('0x24')]({'plain':!![]});var _0x3c1ae6=_0xaf2c('0x25');return db[_0xaf2c('0x26')][_0xaf2c('0x27')]({'where':{'type':_0x3c1ae6,'resourceId':_0xf1a7cf['id']}})['then'](function(){return _0x99f78d;});})[_0xaf2c('0x23')](function(){_0x303546[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();});}};}function handleEntityNotFound(_0x410536,_0x4b7cf2){return function(_0x3fb190){if(!_0x3fb190){_0x410536['sendStatus'](0x194);}return _0x3fb190;};}function handleError(_0x38db1b,_0x42f980){_0x42f980=_0x42f980||0x1f4;return function(_0x15466b){logger['error'](_0x15466b[_0xaf2c('0x28')]);if(_0x15466b[_0xaf2c('0x29')]){delete _0x15466b[_0xaf2c('0x29')];}_0x38db1b['status'](_0x42f980)[_0xaf2c('0x2a')](_0x15466b);};}exports[_0xaf2c('0x2b')]=function(_0x42e2a5,_0x19364e){var _0x59d858={},_0x3da072={},_0x4072ff={'count':0x0,'rows':[]};var _0x1be1ef=_['map'](db['AnalyticMetric'][_0xaf2c('0x2c')],function(_0x4c9b4f){return{'name':_0x4c9b4f[_0xaf2c('0x2d')],'type':_0x4c9b4f['type'][_0xaf2c('0x2e')]};});_0x3da072[_0xaf2c('0x2f')]=_['map'](_0x1be1ef,_0xaf2c('0x29'));_0x3da072[_0xaf2c('0x30')]=_['keys'](_0x42e2a5[_0xaf2c('0x30')]);_0x3da072[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x3da072[_0xaf2c('0x2f')],_0x3da072[_0xaf2c('0x30')]);_0x59d858[_0xaf2c('0x33')]=_['intersection'](_0x3da072[_0xaf2c('0x2f')],qs['fields'](_0x42e2a5[_0xaf2c('0x30')]['fields']));_0x59d858[_0xaf2c('0x33')]=_0x59d858['attributes'][_0xaf2c('0x34')]?_0x59d858['attributes']:_0x3da072[_0xaf2c('0x2f')];if(!_0x42e2a5['query'][_0xaf2c('0x35')](_0xaf2c('0x36'))){_0x59d858[_0xaf2c('0x1e')]=qs[_0xaf2c('0x1e')](_0x42e2a5[_0xaf2c('0x30')]['limit']);_0x59d858['offset']=qs[_0xaf2c('0x1c')](_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x1c')]);}_0x59d858[_0xaf2c('0x37')]=qs[_0xaf2c('0x38')](_0x42e2a5[_0xaf2c('0x30')]['sort']);_0x59d858[_0xaf2c('0x39')]=qs[_0xaf2c('0x31')](_['pick'](_0x42e2a5[_0xaf2c('0x30')],_0x3da072[_0xaf2c('0x31')]),_0x1be1ef);if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x3a')]){_0x59d858[_0xaf2c('0x39')]=_[_0xaf2c('0x3b')](_0x59d858[_0xaf2c('0x39')],{'$or':_[_0xaf2c('0x3c')](_0x1be1ef,function(_0x296ca8){if(_0x296ca8[_0xaf2c('0x3d')]!==_0xaf2c('0x3e')){var _0x43f606={};_0x43f606[_0x296ca8[_0xaf2c('0x29')]]={'$like':'%'+_0x42e2a5['query']['filter']+'%'};return _0x43f606;}})});}_0x59d858=_['merge']({},_0x59d858,_0x42e2a5[_0xaf2c('0x3f')]);var _0x3cb075={'where':_0x59d858[_0xaf2c('0x39')]};return db[_0xaf2c('0x40')][_0xaf2c('0x41')](_0x3cb075)[_0xaf2c('0x23')](function(_0x51c441){_0x4072ff[_0xaf2c('0x41')]=_0x51c441;if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x42')]){_0x59d858['include']=[{'all':!![]}];}return db['AnalyticMetric'][_0xaf2c('0x43')](_0x59d858);})['then'](function(_0x181787){_0x4072ff[_0xaf2c('0x44')]=_0x181787;return _0x4072ff;})[_0xaf2c('0x23')](respondWithFilteredResult(_0x19364e,_0x59d858))[_0xaf2c('0x45')](handleError(_0x19364e,null));};exports['show']=function(_0x2091eb,_0x532d5f){var _0x2056b8={'raw':!![],'where':{'id':_0x2091eb['params']['id']}},_0x8ebb65={};_0x8ebb65[_0xaf2c('0x2f')]=_['keys'](db[_0xaf2c('0x40')][_0xaf2c('0x2c')]);_0x8ebb65[_0xaf2c('0x30')]=_[_0xaf2c('0x46')](_0x2091eb[_0xaf2c('0x30')]);_0x8ebb65[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x8ebb65[_0xaf2c('0x2f')],_0x8ebb65[_0xaf2c('0x30')]);_0x2056b8['attributes']=_['intersection'](_0x8ebb65[_0xaf2c('0x2f')],qs['fields'](_0x2091eb['query']['fields']));_0x2056b8[_0xaf2c('0x33')]=_0x2056b8[_0xaf2c('0x33')][_0xaf2c('0x34')]?_0x2056b8[_0xaf2c('0x33')]:_0x8ebb65['model'];if(_0x2091eb[_0xaf2c('0x30')]['includeAll']){_0x2056b8[_0xaf2c('0x47')]=[{'all':!![]}];}_0x2056b8=_['merge']({},_0x2056b8,_0x2091eb[_0xaf2c('0x3f')]);return db[_0xaf2c('0x40')][_0xaf2c('0x48')](_0x2056b8)[_0xaf2c('0x23')](handleEntityNotFound(_0x532d5f,null))[_0xaf2c('0x23')](respondWithResult(_0x532d5f,null))['catch'](handleError(_0x532d5f,null));};exports[_0xaf2c('0x49')]=function(_0x26afee,_0x4b3ca4){return db['AnalyticMetric'][_0xaf2c('0x49')](_0x26afee['body'],{})[_0xaf2c('0x23')](function(_0x23642b){var _0x17b9ec=_0x26afee[_0xaf2c('0x4a')][_0xaf2c('0x24')]({'plain':!![]});if(!_0x17b9ec)throw new Error(_0xaf2c('0x4b'));if(_0x17b9ec[_0xaf2c('0x4c')]===_0xaf2c('0x4a')){var _0x31ccfe=_0x23642b[_0xaf2c('0x24')]({'plain':!![]});var _0x371486='Metrics';return db[_0xaf2c('0x4d')][_0xaf2c('0x48')]({'where':{'name':_0x371486,'userProfileId':_0x17b9ec['userProfileId']},'raw':!![]})['then'](function(_0x56d7ce){if(_0x56d7ce&&_0x56d7ce[_0xaf2c('0x4e')]===0x0){return db[_0xaf2c('0x26')]['create']({'name':_0x31ccfe[_0xaf2c('0x29')],'resourceId':_0x31ccfe['id'],'type':_0x56d7ce[_0xaf2c('0x29')],'sectionId':_0x56d7ce['id']},{})[_0xaf2c('0x23')](function(){return _0x23642b;});}else{return _0x23642b;}})[_0xaf2c('0x45')](function(_0x265748){logger[_0xaf2c('0x4f')](_0xaf2c('0x50'),_0x265748);throw _0x265748;});}return _0x23642b;})['then'](respondWithResult(_0x4b3ca4,0xc9))[_0xaf2c('0x45')](handleError(_0x4b3ca4,null));};exports[_0xaf2c('0x51')]=function(_0x5771e5,_0x245797){if(_0x5771e5[_0xaf2c('0x52')]['id']){delete _0x5771e5[_0xaf2c('0x52')]['id'];}return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x5771e5[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x245797,null))[_0xaf2c('0x23')](saveUpdates(_0x5771e5[_0xaf2c('0x52')],null))[_0xaf2c('0x23')](respondWithResult(_0x245797,null))[_0xaf2c('0x45')](handleError(_0x245797,null));};exports[_0xaf2c('0x27')]=function(_0x411e84,_0x2356a0){return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x411e84[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x2356a0,null))[_0xaf2c('0x23')](removeEntity(_0x2356a0,null))[_0xaf2c('0x45')](handleError(_0x2356a0,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 5d3ce64..2a190f3 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 _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 +var _0xa63f=['request-promise','path','rimraf','../../config/environment','define','AnalyticMetric','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5d0288,_0x348df1){var _0x45ebd9=function(_0x180208){while(--_0x180208){_0x5d0288['push'](_0x5d0288['shift']());}};_0x45ebd9(++_0x348df1);}(_0xa63f,0x1b6));var _0xfa63=function(_0x1ff2ec,_0x386e86){_0x1ff2ec=_0x1ff2ec-0x0;var _0x405683=_0xa63f[_0x1ff2ec];return _0x405683;};'use strict';var _=require(_0xfa63('0x0'));var util=require(_0xfa63('0x1'));var logger=require(_0xfa63('0x2'))(_0xfa63('0x3'));var moment=require(_0xfa63('0x4'));var BPromise=require(_0xfa63('0x5'));var rp=require(_0xfa63('0x6'));var fs=require('fs');var path=require(_0xfa63('0x7'));var rimraf=require(_0xfa63('0x8'));var config=require(_0xfa63('0x9'));var attributes=require('./analyticMetric.attributes');module['exports']=function(_0x20d4f6,_0x41efce){return _0x20d4f6[_0xfa63('0xa')](_0xfa63('0xb'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 43e438b..25d7d96 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 _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 +var _0x5976=['catch','lodash','util','moment','bluebird','../../config/utils','rpc','jayson/promise','client','http','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x4674f7,_0x23a007){var _0x203744=function(_0x368466){while(--_0x368466){_0x4674f7['push'](_0x4674f7['shift']());}};_0x203744(++_0x23a007);}(_0x5976,0xf1));var _0x6597=function(_0x5da675,_0x2ead75){_0x5da675=_0x5da675-0x0;var _0x330a76=_0x5976[_0x5da675];return _0x330a76;};'use strict';var _=require(_0x6597('0x0'));var util=require(_0x6597('0x1'));var moment=require(_0x6597('0x2'));var BPromise=require(_0x6597('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6597('0x4'));var logger=require('../../config/logger')(_0x6597('0x5'));var config=require('../../config/environment');var jayson=require(_0x6597('0x6'));var client=jayson[_0x6597('0x7')][_0x6597('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x190136,_0x290224,_0x52cfb5){return new BPromise(function(_0x5640c5,_0x27f70a){return client[_0x6597('0x9')](_0x190136,_0x52cfb5)['then'](function(_0x1f3b05){logger[_0x6597('0xa')](_0x6597('0xb'),_0x290224,_0x6597('0xc'));logger[_0x6597('0xd')](_0x6597('0xe'),_0x290224,_0x6597('0xc'),JSON[_0x6597('0xf')](_0x1f3b05));if(_0x1f3b05['error']){if(_0x1f3b05['error'][_0x6597('0x10')]===0x1f4){logger[_0x6597('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x290224,_0x1f3b05[_0x6597('0x11')]['message']);return _0x27f70a(_0x1f3b05[_0x6597('0x11')][_0x6597('0x12')]);}logger[_0x6597('0x11')](_0x6597('0xb'),_0x290224,_0x1f3b05[_0x6597('0x11')][_0x6597('0x12')]);return _0x5640c5(_0x1f3b05[_0x6597('0x11')][_0x6597('0x12')]);}else{logger[_0x6597('0xa')]('AnalyticMetric,\x20%s,\x20%s',_0x290224,_0x6597('0xc'));_0x5640c5(_0x1f3b05['result'][_0x6597('0x12')]);}})[_0x6597('0x13')](function(_0x3f48ce){logger[_0x6597('0x11')](_0x6597('0xb'),_0x290224,_0x3f48ce);_0x27f70a(_0x3f48ce);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 7e16d7f..cf9a299 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 _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 +var _0xbfe8=['isAuthenticated','/:id','show','post','create','put','update','delete','destroy','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get'];(function(_0x13ce0f,_0x354d4c){var _0x1beae8=function(_0x25a40b){while(--_0x25a40b){_0x13ce0f['push'](_0x13ce0f['shift']());}};_0x1beae8(++_0x354d4c);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0x5cef78,_0xa9e03f){_0x5cef78=_0x5cef78-0x0;var _0x258f09=_0xbfe8[_0x5cef78];return _0x258f09;};'use strict';var multer=require('multer');var util=require(_0x8bfe('0x0'));var path=require('path');var timeout=require(_0x8bfe('0x1'));var express=require(_0x8bfe('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8bfe('0x3'));var interaction=require(_0x8bfe('0x4'));var config=require('../../config/environment');var controller=require(_0x8bfe('0x5'));router[_0x8bfe('0x6')]('/',auth[_0x8bfe('0x7')](),controller['index']);router[_0x8bfe('0x6')](_0x8bfe('0x8'),auth[_0x8bfe('0x7')](),controller[_0x8bfe('0x9')]);router[_0x8bfe('0xa')]('/',auth[_0x8bfe('0x7')](),controller[_0x8bfe('0xb')]);router[_0x8bfe('0xc')](_0x8bfe('0x8'),auth[_0x8bfe('0x7')](),controller[_0x8bfe('0xd')]);router[_0x8bfe('0xe')](_0x8bfe('0x8'),auth[_0x8bfe('0x7')](),controller[_0x8bfe('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 3daeb74..0fa9e0b 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 _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 +var _0xad72=['sequelize'];(function(_0x2e9dc3,_0x483bc6){var _0x130dd1=function(_0x4edfa9){while(--_0x4edfa9){_0x2e9dc3['push'](_0x2e9dc3['shift']());}};_0x130dd1(++_0x483bc6);}(_0xad72,0x1d8));var _0x2ad7=function(_0x24b5b5,_0x5c6b40){_0x24b5b5=_0x24b5b5-0x0;var _0x30a619=_0xad72[_0x24b5b5];return _0x30a619;};'use strict';var Sequelize=require(_0x2ad7('0x0'));module['exports']={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 04447ff..2a472e0 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 _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 +var _0x6d84=['rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body'];(function(_0x2836fc,_0x87ccde){var _0x118908=function(_0x13045f){while(--_0x13045f){_0x2836fc['push'](_0x2836fc['shift']());}};_0x118908(++_0x87ccde);}(_0x6d84,0x16d));var _0x46d8=function(_0x37ff05,_0x4c302f){_0x37ff05=_0x37ff05-0x0;var _0x2ea4eb=_0x6d84[_0x37ff05];return _0x2ea4eb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x46d8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x46d8('0x1'));var rp=require(_0x46d8('0x2'));var moment=require(_0x46d8('0x3'));var BPromise=require(_0x46d8('0x4'));var Mustache=require(_0x46d8('0x5'));var util=require(_0x46d8('0x6'));var path=require(_0x46d8('0x7'));var sox=require('sox');var csv=require(_0x46d8('0x8'));var ejs=require(_0x46d8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x46d8('0xa'));var squel=require(_0x46d8('0xb'));var crypto=require('crypto');var jsforce=require(_0x46d8('0xc'));var deskjs=require(_0x46d8('0xd'));var toCsv=require(_0x46d8('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x46d8('0xe'));var authService=require(_0x46d8('0xf'));var qs=require(_0x46d8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x46d8('0x11'))(_0x46d8('0x12'));var utils=require(_0x46d8('0x13'));var config=require(_0x46d8('0x14'));var licenseUtil=require(_0x46d8('0x15'));var db=require(_0x46d8('0x16'))['db'];function respondWithStatusCode(_0x21ba9a,_0x5c1dcb){_0x5c1dcb=_0x5c1dcb||0xcc;return function(_0x252883){if(_0x252883){return _0x21ba9a[_0x46d8('0x17')](_0x5c1dcb);}return _0x21ba9a[_0x46d8('0x18')](_0x5c1dcb)[_0x46d8('0x19')]();};}function respondWithResult(_0x41f8c8,_0x4aba5f){_0x4aba5f=_0x4aba5f||0xc8;return function(_0xc865c4){if(_0xc865c4){return _0x41f8c8[_0x46d8('0x18')](_0x4aba5f)[_0x46d8('0x1a')](_0xc865c4);}};}function respondWithFilteredResult(_0x16b13f,_0xeab073){return function(_0x213e0f){if(_0x213e0f){var _0x3d3501=typeof _0xeab073[_0x46d8('0x1b')]==='undefined'&&typeof _0xeab073[_0x46d8('0x1c')]==='undefined';var _0x1654c8=_0x213e0f[_0x46d8('0x1d')];var _0x325fb0=_0x3d3501?0x0:_0xeab073[_0x46d8('0x1b')];var _0x4e9c4=_0x3d3501?_0x213e0f[_0x46d8('0x1d')]:_0xeab073[_0x46d8('0x1b')]+_0xeab073[_0x46d8('0x1c')];var _0x353afd;if(_0x4e9c4>=_0x1654c8){_0x4e9c4=_0x1654c8;_0x353afd=0xc8;}else{_0x353afd=0xce;}_0x16b13f[_0x46d8('0x18')](_0x353afd);return _0x16b13f['set'](_0x46d8('0x1e'),_0x325fb0+'-'+_0x4e9c4+'/'+_0x1654c8)[_0x46d8('0x1a')](_0x213e0f);}return null;};}function patchUpdates(_0x346c6f){return function(_0x2d215f){try{jsonpatch[_0x46d8('0x1f')](_0x2d215f,_0x346c6f,!![]);}catch(_0x1086ab){return BPromise[_0x46d8('0x20')](_0x1086ab);}return _0x2d215f[_0x46d8('0x21')]();};}function saveUpdates(_0x16a9d5,_0x228ea0){return function(_0x26ceae){if(_0x26ceae){return _0x26ceae[_0x46d8('0x22')](_0x16a9d5)[_0x46d8('0x23')](function(_0x5a0a0c){return _0x5a0a0c;});}return null;};}function removeEntity(_0x189b77,_0x2f3abb){return function(_0x4d7bba){if(_0x4d7bba){return _0x4d7bba[_0x46d8('0x24')]()[_0x46d8('0x23')](function(){_0x189b77[_0x46d8('0x18')](0xcc)[_0x46d8('0x19')]();});}};}function handleEntityNotFound(_0x3f3455,_0x552bff){return function(_0x4131e2){if(!_0x4131e2){_0x3f3455[_0x46d8('0x17')](0x194);}return _0x4131e2;};}function handleError(_0xe3cdf7,_0x332319){_0x332319=_0x332319||0x1f4;return function(_0x2c83fe){logger[_0x46d8('0x25')](_0x2c83fe[_0x46d8('0x26')]);if(_0x2c83fe[_0x46d8('0x27')]){delete _0x2c83fe[_0x46d8('0x27')];}_0xe3cdf7['status'](_0x332319)['send'](_0x2c83fe);};}exports[_0x46d8('0x28')]=function(_0x38e54f,_0x1dda95){var _0x356eb4={},_0x2f80d8={},_0x3056c7={'count':0x0,'rows':[]};var _0x46e988=_[_0x46d8('0x29')](db[_0x46d8('0x2a')][_0x46d8('0x2b')],function(_0x5add04){return{'name':_0x5add04[_0x46d8('0x2c')],'type':_0x5add04[_0x46d8('0x2d')][_0x46d8('0x2e')]};});_0x2f80d8[_0x46d8('0x2f')]=_[_0x46d8('0x29')](_0x46e988,'name');_0x2f80d8[_0x46d8('0x30')]=_[_0x46d8('0x31')](_0x38e54f[_0x46d8('0x30')]);_0x2f80d8['filters']=_[_0x46d8('0x32')](_0x2f80d8['model'],_0x2f80d8[_0x46d8('0x30')]);_0x356eb4[_0x46d8('0x33')]=_[_0x46d8('0x32')](_0x2f80d8[_0x46d8('0x2f')],qs[_0x46d8('0x34')](_0x38e54f[_0x46d8('0x30')]['fields']));_0x356eb4[_0x46d8('0x33')]=_0x356eb4[_0x46d8('0x33')][_0x46d8('0x35')]?_0x356eb4[_0x46d8('0x33')]:_0x2f80d8[_0x46d8('0x2f')];if(!_0x38e54f[_0x46d8('0x30')][_0x46d8('0x36')](_0x46d8('0x37'))){_0x356eb4['limit']=qs[_0x46d8('0x1c')](_0x38e54f['query'][_0x46d8('0x1c')]);_0x356eb4[_0x46d8('0x1b')]=qs[_0x46d8('0x1b')](_0x38e54f[_0x46d8('0x30')][_0x46d8('0x1b')]);}_0x356eb4['order']=qs[_0x46d8('0x38')](_0x38e54f[_0x46d8('0x30')]['sort']);_0x356eb4[_0x46d8('0x39')]=qs['filters'](_[_0x46d8('0x3a')](_0x38e54f[_0x46d8('0x30')],_0x2f80d8[_0x46d8('0x3b')]),_0x46e988);if(_0x38e54f[_0x46d8('0x30')][_0x46d8('0x3c')]){_0x356eb4[_0x46d8('0x39')]=_[_0x46d8('0x3d')](_0x356eb4[_0x46d8('0x39')],{'$or':_[_0x46d8('0x29')](_0x46e988,function(_0x191b72){if(_0x191b72[_0x46d8('0x2d')]!=='VIRTUAL'){var _0x909cf2={};_0x909cf2[_0x191b72[_0x46d8('0x27')]]={'$like':'%'+_0x38e54f[_0x46d8('0x30')]['filter']+'%'};return _0x909cf2;}})});}_0x356eb4=_[_0x46d8('0x3d')]({},_0x356eb4,_0x38e54f[_0x46d8('0x3e')]);var _0x3a6a7c={'where':_0x356eb4[_0x46d8('0x39')]};return db[_0x46d8('0x2a')][_0x46d8('0x1d')](_0x3a6a7c)['then'](function(_0x20c2ef){_0x3056c7[_0x46d8('0x1d')]=_0x20c2ef;if(_0x38e54f[_0x46d8('0x30')]['includeAll']){_0x356eb4[_0x46d8('0x3f')]=[{'all':!![]}];}return db[_0x46d8('0x2a')][_0x46d8('0x40')](_0x356eb4);})[_0x46d8('0x23')](function(_0x5cd75b){_0x3056c7[_0x46d8('0x41')]=_0x5cd75b;return _0x3056c7;})[_0x46d8('0x23')](respondWithFilteredResult(_0x1dda95,_0x356eb4))[_0x46d8('0x42')](handleError(_0x1dda95,null));};exports[_0x46d8('0x43')]=function(_0x4904c5,_0xc19889){var _0x376e04={'raw':!![],'where':{'id':_0x4904c5[_0x46d8('0x44')]['id']}},_0x2013b4={};_0x2013b4[_0x46d8('0x2f')]=_[_0x46d8('0x31')](db['AnalyticTreeReport']['rawAttributes']);_0x2013b4[_0x46d8('0x30')]=_['keys'](_0x4904c5['query']);_0x2013b4[_0x46d8('0x3b')]=_[_0x46d8('0x32')](_0x2013b4[_0x46d8('0x2f')],_0x2013b4[_0x46d8('0x30')]);_0x376e04[_0x46d8('0x33')]=_['intersection'](_0x2013b4['model'],qs['fields'](_0x4904c5[_0x46d8('0x30')][_0x46d8('0x34')]));_0x376e04[_0x46d8('0x33')]=_0x376e04[_0x46d8('0x33')][_0x46d8('0x35')]?_0x376e04['attributes']:_0x2013b4[_0x46d8('0x2f')];if(_0x4904c5[_0x46d8('0x30')][_0x46d8('0x45')]){_0x376e04[_0x46d8('0x3f')]=[{'all':!![]}];}_0x376e04=_[_0x46d8('0x3d')]({},_0x376e04,_0x4904c5[_0x46d8('0x3e')]);return db['AnalyticTreeReport'][_0x46d8('0x46')](_0x376e04)[_0x46d8('0x23')](handleEntityNotFound(_0xc19889,null))['then'](respondWithResult(_0xc19889,null))[_0x46d8('0x42')](handleError(_0xc19889,null));};exports[_0x46d8('0x47')]=function(_0x41e1c5,_0x127807){return db[_0x46d8('0x2a')][_0x46d8('0x47')](_0x41e1c5[_0x46d8('0x48')],{})[_0x46d8('0x23')](respondWithResult(_0x127807,0xc9))[_0x46d8('0x42')](handleError(_0x127807,null));};exports[_0x46d8('0x22')]=function(_0x27cb2f,_0x29c7ac){if(_0x27cb2f['body']['id']){delete _0x27cb2f[_0x46d8('0x48')]['id'];}return db[_0x46d8('0x2a')][_0x46d8('0x46')]({'where':{'id':_0x27cb2f[_0x46d8('0x44')]['id']}})[_0x46d8('0x23')](handleEntityNotFound(_0x29c7ac,null))[_0x46d8('0x23')](saveUpdates(_0x27cb2f['body'],null))[_0x46d8('0x23')](respondWithResult(_0x29c7ac,null))['catch'](handleError(_0x29c7ac,null));};exports[_0x46d8('0x24')]=function(_0x5b9dc5,_0x16ee70){return db['AnalyticTreeReport'][_0x46d8('0x46')]({'where':{'id':_0x5b9dc5[_0x46d8('0x44')]['id']}})[_0x46d8('0x23')](handleEntityNotFound(_0x16ee70,null))[_0x46d8('0x23')](removeEntity(_0x16ee70,null))[_0x46d8('0x42')](handleError(_0x16ee70,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 4dd0610..9e5fc1f 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 _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 +var _0x556e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','analytics_report_trees','lodash','util','../../config/logger','api'];(function(_0x195a3c,_0x3537a3){var _0x4ed367=function(_0x11878b){while(--_0x11878b){_0x195a3c['push'](_0x195a3c['shift']());}};_0x4ed367(++_0x3537a3);}(_0x556e,0xa5));var _0xe556=function(_0x3e5147,_0x33eef9){_0x3e5147=_0x3e5147-0x0;var _0x18c779=_0x556e[_0x3e5147];return _0x18c779;};'use strict';var _=require(_0xe556('0x0'));var util=require(_0xe556('0x1'));var logger=require(_0xe556('0x2'))(_0xe556('0x3'));var moment=require(_0xe556('0x4'));var BPromise=require(_0xe556('0x5'));var rp=require(_0xe556('0x6'));var fs=require('fs');var path=require(_0xe556('0x7'));var rimraf=require(_0xe556('0x8'));var config=require(_0xe556('0x9'));var attributes=require('./analyticTreeReport.attributes');module[_0xe556('0xa')]=function(_0x4fcda9,_0x23600e){return _0x4fcda9[_0xe556('0xb')]('AnalyticTreeReport',attributes,{'tableName':_0xe556('0xc'),'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 56fad57..a749e30 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(_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 +var _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x5e3fc1,_0x109138){var _0x5885c0=function(_0x9825b6){while(--_0x9825b6){_0x5e3fc1['push'](_0x5e3fc1['shift']());}};_0x5885c0(++_0x109138);}(_0x1261,0x144));var _0x1126=function(_0xef4cf0,_0x16c9c3){_0xef4cf0=_0xef4cf0-0x0;var _0x497ad2=_0x1261[_0xef4cf0];return _0x497ad2;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 1e18548..4cd2191 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 _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 +var _0x85ed=['show','post','create','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','/:id'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x85ed,0xa6));var _0xd85e=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x85ed[_0x2dadb9];return _0x2f0097;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd85e('0x0'));var express=require(_0xd85e('0x1'));var router=express[_0xd85e('0x2')]();var fs_extra=require(_0xd85e('0x3'));var auth=require(_0xd85e('0x4'));var interaction=require(_0xd85e('0x5'));var config=require(_0xd85e('0x6'));var controller=require(_0xd85e('0x7'));router['get']('/',auth[_0xd85e('0x8')](),controller['index']);router['get'](_0xd85e('0x9'),auth[_0xd85e('0x8')](),controller[_0xd85e('0xa')]);router[_0xd85e('0xb')]('/',auth[_0xd85e('0x8')](),controller[_0xd85e('0xc')]);router['put'](_0xd85e('0x9'),auth[_0xd85e('0x8')](),controller['update']);router[_0xd85e('0xd')](_0xd85e('0x9'),auth[_0xd85e('0x8')](),controller[_0xd85e('0xe')]);module[_0xd85e('0xf')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index f780c66..0a6728f 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 _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 +var _0xdace=['STRING','sequelize'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xdace,0xc5));var _0xedac=function(_0x18abd2,_0x22d4b3){_0x18abd2=_0x18abd2-0x0;var _0x1dcad6=_0xdace[_0x18abd2];return _0x1dcad6;};'use strict';var Sequelize=require(_0xedac('0x0'));module['exports']={'name':{'type':Sequelize[_0xedac('0x1')]},'basename':{'type':Sequelize[_0xedac('0x1')]},'type':{'type':Sequelize[_0xedac('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 81f3377..8a1695d 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 _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 +var _0x5dd4=['catch','params','options','find','clone','merge','omit','createdAt','updatedAt','body','originalname','filename','file','mimetype','create','join','root','offline-chat/','basename','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','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','undefined','limit','count','offset','apply','reject','save','update','then','destroy','error','stack','name','index','Attachment','rawAttributes','fieldName','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x4b4921,_0x79b24f){var _0x569da4=function(_0x48de87){while(--_0x48de87){_0x4b4921['push'](_0x4b4921['shift']());}};_0x569da4(++_0x79b24f);}(_0x5dd4,0x1c7));var _0x45dd=function(_0x28ae11,_0x12043f){_0x28ae11=_0x28ae11-0x0;var _0x32bb34=_0x5dd4[_0x28ae11];return _0x32bb34;};'use strict';var emlformat=require(_0x45dd('0x0'));var rimraf=require(_0x45dd('0x1'));var zipdir=require(_0x45dd('0x2'));var jsonpatch=require(_0x45dd('0x3'));var rp=require(_0x45dd('0x4'));var moment=require(_0x45dd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x45dd('0x6'));var util=require(_0x45dd('0x7'));var path=require(_0x45dd('0x8'));var sox=require(_0x45dd('0x9'));var csv=require(_0x45dd('0xa'));var ejs=require(_0x45dd('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x45dd('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x45dd('0xd'));var toCsv=require(_0x45dd('0xa'));var querystring=require('querystring');var Papa=require(_0x45dd('0xe'));var Redis=require('ioredis');var authService=require(_0x45dd('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x45dd('0x10'));var hardwareService=require(_0x45dd('0x11'));var logger=require(_0x45dd('0x12'))(_0x45dd('0x13'));var utils=require(_0x45dd('0x14'));var config=require(_0x45dd('0x15'));var licenseUtil=require(_0x45dd('0x16'));var db=require(_0x45dd('0x17'))['db'];function respondWithStatusCode(_0x32ee1e,_0x3a5386){_0x3a5386=_0x3a5386||0xcc;return function(_0x1d1add){if(_0x1d1add){return _0x32ee1e[_0x45dd('0x18')](_0x3a5386);}return _0x32ee1e[_0x45dd('0x19')](_0x3a5386)[_0x45dd('0x1a')]();};}function respondWithResult(_0x1d77be,_0x3df0e4){_0x3df0e4=_0x3df0e4||0xc8;return function(_0x58f340){if(_0x58f340){return _0x1d77be['status'](_0x3df0e4)[_0x45dd('0x1b')](_0x58f340);}};}function respondWithFilteredResult(_0x506ae8,_0x501fa1){return function(_0x4432e5){if(_0x4432e5){var _0xc669e6=typeof _0x501fa1['offset']===_0x45dd('0x1c')&&typeof _0x501fa1[_0x45dd('0x1d')]==='undefined';var _0x2b2117=_0x4432e5[_0x45dd('0x1e')];var _0x38a0e5=_0xc669e6?0x0:_0x501fa1[_0x45dd('0x1f')];var _0x519e80=_0xc669e6?_0x4432e5[_0x45dd('0x1e')]:_0x501fa1['offset']+_0x501fa1[_0x45dd('0x1d')];var _0x78668;if(_0x519e80>=_0x2b2117){_0x519e80=_0x2b2117;_0x78668=0xc8;}else{_0x78668=0xce;}_0x506ae8[_0x45dd('0x19')](_0x78668);return _0x506ae8['set']('Content-Range',_0x38a0e5+'-'+_0x519e80+'/'+_0x2b2117)[_0x45dd('0x1b')](_0x4432e5);}return null;};}function patchUpdates(_0xb8af59){return function(_0x2c3cf6){try{jsonpatch[_0x45dd('0x20')](_0x2c3cf6,_0xb8af59,!![]);}catch(_0x4b3aa1){return BPromise[_0x45dd('0x21')](_0x4b3aa1);}return _0x2c3cf6[_0x45dd('0x22')]();};}function saveUpdates(_0x42f0cb,_0x21c9bb){return function(_0x2d163e){if(_0x2d163e){return _0x2d163e[_0x45dd('0x23')](_0x42f0cb)[_0x45dd('0x24')](function(_0x1a49b0){return _0x1a49b0;});}return null;};}function removeEntity(_0x4529b9,_0x53dce9){return function(_0x1166f5){if(_0x1166f5){return _0x1166f5[_0x45dd('0x25')]()[_0x45dd('0x24')](function(){_0x4529b9['status'](0xcc)[_0x45dd('0x1a')]();});}};}function handleEntityNotFound(_0xd737e1,_0x16a666){return function(_0x4844bb){if(!_0x4844bb){_0xd737e1[_0x45dd('0x18')](0x194);}return _0x4844bb;};}function handleError(_0x32b4df,_0x16113b){_0x16113b=_0x16113b||0x1f4;return function(_0x3dc351){logger[_0x45dd('0x26')](_0x3dc351[_0x45dd('0x27')]);if(_0x3dc351['name']){delete _0x3dc351[_0x45dd('0x28')];}_0x32b4df[_0x45dd('0x19')](_0x16113b)['send'](_0x3dc351);};}exports[_0x45dd('0x29')]=function(_0x10721f,_0xf10b68){var _0x3a3651={},_0x3d848e={},_0x5ea7dc={'count':0x0,'rows':[]};var _0x2edd22=_['map'](db[_0x45dd('0x2a')][_0x45dd('0x2b')],function(_0x59fed7){return{'name':_0x59fed7[_0x45dd('0x2c')],'type':_0x59fed7['type'][_0x45dd('0x2d')]};});_0x3d848e[_0x45dd('0x2e')]=_[_0x45dd('0x2f')](_0x2edd22,'name');_0x3d848e['query']=_[_0x45dd('0x30')](_0x10721f[_0x45dd('0x31')]);_0x3d848e[_0x45dd('0x32')]=_['intersection'](_0x3d848e['model'],_0x3d848e[_0x45dd('0x31')]);_0x3a3651[_0x45dd('0x33')]=_[_0x45dd('0x34')](_0x3d848e[_0x45dd('0x2e')],qs['fields'](_0x10721f[_0x45dd('0x31')][_0x45dd('0x35')]));_0x3a3651[_0x45dd('0x33')]=_0x3a3651['attributes'][_0x45dd('0x36')]?_0x3a3651[_0x45dd('0x33')]:_0x3d848e[_0x45dd('0x2e')];if(!_0x10721f[_0x45dd('0x31')][_0x45dd('0x37')](_0x45dd('0x38'))){_0x3a3651[_0x45dd('0x1d')]=qs[_0x45dd('0x1d')](_0x10721f[_0x45dd('0x31')]['limit']);_0x3a3651['offset']=qs[_0x45dd('0x1f')](_0x10721f[_0x45dd('0x31')][_0x45dd('0x1f')]);}_0x3a3651[_0x45dd('0x39')]=qs[_0x45dd('0x3a')](_0x10721f[_0x45dd('0x31')][_0x45dd('0x3a')]);_0x3a3651[_0x45dd('0x3b')]=qs[_0x45dd('0x32')](_['pick'](_0x10721f[_0x45dd('0x31')],_0x3d848e[_0x45dd('0x32')]),_0x2edd22);if(_0x10721f[_0x45dd('0x31')][_0x45dd('0x3c')]){_0x3a3651[_0x45dd('0x3b')]=_['merge'](_0x3a3651[_0x45dd('0x3b')],{'$or':_['map'](_0x2edd22,function(_0x3c19ca){if(_0x3c19ca[_0x45dd('0x3d')]!==_0x45dd('0x3e')){var _0x4c68c7={};_0x4c68c7[_0x3c19ca[_0x45dd('0x28')]]={'$like':'%'+_0x10721f['query'][_0x45dd('0x3c')]+'%'};return _0x4c68c7;}})});}_0x3a3651=_['merge']({},_0x3a3651,_0x10721f['options']);var _0x20447a={'where':_0x3a3651[_0x45dd('0x3b')]};return db[_0x45dd('0x2a')]['count'](_0x20447a)[_0x45dd('0x24')](function(_0x4dcd81){_0x5ea7dc[_0x45dd('0x1e')]=_0x4dcd81;if(_0x10721f[_0x45dd('0x31')][_0x45dd('0x3f')]){_0x3a3651[_0x45dd('0x40')]=[{'all':!![]}];}return db[_0x45dd('0x2a')][_0x45dd('0x41')](_0x3a3651);})[_0x45dd('0x24')](function(_0x2db898){_0x5ea7dc[_0x45dd('0x42')]=_0x2db898;return _0x5ea7dc;})[_0x45dd('0x24')](respondWithFilteredResult(_0xf10b68,_0x3a3651))[_0x45dd('0x43')](handleError(_0xf10b68,null));};exports['show']=function(_0x200b1d,_0x2a867c){var _0x467cae={'raw':!![],'where':{'id':_0x200b1d[_0x45dd('0x44')]['id']}},_0x461b73={};_0x461b73[_0x45dd('0x2e')]=_[_0x45dd('0x30')](db[_0x45dd('0x2a')][_0x45dd('0x2b')]);_0x461b73[_0x45dd('0x31')]=_[_0x45dd('0x30')](_0x200b1d[_0x45dd('0x31')]);_0x461b73[_0x45dd('0x32')]=_[_0x45dd('0x34')](_0x461b73[_0x45dd('0x2e')],_0x461b73[_0x45dd('0x31')]);_0x467cae['attributes']=_[_0x45dd('0x34')](_0x461b73['model'],qs['fields'](_0x200b1d['query'][_0x45dd('0x35')]));_0x467cae[_0x45dd('0x33')]=_0x467cae['attributes'][_0x45dd('0x36')]?_0x467cae[_0x45dd('0x33')]:_0x461b73[_0x45dd('0x2e')];if(_0x200b1d['query'][_0x45dd('0x3f')]){_0x467cae[_0x45dd('0x40')]=[{'all':!![]}];}_0x467cae=_['merge']({},_0x467cae,_0x200b1d[_0x45dd('0x45')]);return db[_0x45dd('0x2a')][_0x45dd('0x46')](_0x467cae)[_0x45dd('0x24')](handleEntityNotFound(_0x2a867c,null))['then'](respondWithResult(_0x2a867c,null))[_0x45dd('0x43')](handleError(_0x2a867c,null));};exports[_0x45dd('0x47')]=function(_0x1b47a3,_0x56f2ea){var _0x494aa1={'where':{'id':_0x1b47a3['params']['id']}},_0x1daa8d={};_0x1daa8d[_0x45dd('0x2e')]=_['keys'](db[_0x45dd('0x2a')][_0x45dd('0x2b')]);_0x494aa1[_0x45dd('0x33')]=_[_0x45dd('0x34')](_0x1daa8d[_0x45dd('0x2e')],qs['fields'](_0x1b47a3[_0x45dd('0x31')][_0x45dd('0x35')]));_0x494aa1[_0x45dd('0x33')]=_0x494aa1['attributes'][_0x45dd('0x36')]?_0x494aa1['attributes']:_0x1daa8d['model'];if(_0x1b47a3[_0x45dd('0x31')]['includeAll']){_0x494aa1[_0x45dd('0x40')]=[{'all':!![]}];}_0x494aa1=_[_0x45dd('0x48')]({},_0x494aa1,_0x1b47a3[_0x45dd('0x45')]);return db[_0x45dd('0x2a')][_0x45dd('0x46')](_0x494aa1)[_0x45dd('0x24')](handleEntityNotFound(_0x56f2ea,null))[_0x45dd('0x24')](function(_0x1729ad){if(_0x1729ad){var _0x5631ff=_0x1729ad['get']({'plain':!![]});_0x5631ff=qs[_0x45dd('0x49')](_0x5631ff,['id',_0x45dd('0x4a'),_0x45dd('0x4b')]);_0x1b47a3[_0x45dd('0x4c')]=_[_0x45dd('0x49')](_0x1b47a3['body'],['id',_0x45dd('0x4a'),_0x45dd('0x4b')]);return db[_0x45dd('0x2a')]['create'](_['merge'](_0x5631ff,_0x1b47a3[_0x45dd('0x4c')]),{'include':_0x1b47a3[_0x45dd('0x31')][_0x45dd('0x3f')]?[{'all':!![]}]:undefined});}})[_0x45dd('0x24')](respondWithResult(_0x56f2ea,0xc9))[_0x45dd('0x43')](handleError(_0x56f2ea,null));};exports['update']=function(_0x273c9b,_0xa0b1e6){if(_0x273c9b['body']['id']){delete _0x273c9b[_0x45dd('0x4c')]['id'];}return db[_0x45dd('0x2a')]['find']({'where':{'id':_0x273c9b[_0x45dd('0x44')]['id']}})[_0x45dd('0x24')](handleEntityNotFound(_0xa0b1e6,null))[_0x45dd('0x24')](saveUpdates(_0x273c9b[_0x45dd('0x4c')],null))[_0x45dd('0x24')](respondWithResult(_0xa0b1e6,null))[_0x45dd('0x43')](handleError(_0xa0b1e6,null));};exports[_0x45dd('0x25')]=function(_0x1b1c79,_0x152e9e){return db[_0x45dd('0x2a')][_0x45dd('0x46')]({'where':{'id':_0x1b1c79['params']['id']}})['then'](handleEntityNotFound(_0x152e9e,null))[_0x45dd('0x24')](removeEntity(_0x152e9e,null))[_0x45dd('0x43')](handleError(_0x152e9e,null));};exports['create']=function(_0x5660d8,_0x48dc20,_0x439904){_0x5660d8[_0x45dd('0x4c')]['name']=_0x5660d8['file'][_0x45dd('0x4d')];_0x5660d8[_0x45dd('0x4c')]['basename']=_0x5660d8['file'][_0x45dd('0x4e')];_0x5660d8[_0x45dd('0x4c')][_0x45dd('0x3d')]=_0x5660d8[_0x45dd('0x4f')][_0x45dd('0x50')];return db[_0x45dd('0x2a')][_0x45dd('0x51')](_0x5660d8[_0x45dd('0x4c')])[_0x45dd('0x24')](respondWithResult(_0x48dc20,0xc9))[_0x45dd('0x43')](handleError(_0x48dc20,null));};exports['download']=function(_0x512ea1,_0x310b9e,_0x4601f7){return db[_0x45dd('0x2a')]['findOne']({'where':{'id':_0x512ea1[_0x45dd('0x44')]['id']},'raw':!![]})[_0x45dd('0x24')](handleEntityNotFound(_0x310b9e,null))[_0x45dd('0x24')](function(_0x38647e){if(_0x38647e){var _0x33d1fe=_0x38647e['ChatOfflineMessageId']!==null;var _0x298b06=path[_0x45dd('0x52')](config[_0x45dd('0x53')],'server/files/attachments/');if(_0x33d1fe){_0x298b06=path[_0x45dd('0x52')](_0x298b06,_0x45dd('0x54'));}var _0x545601=path['join'](_0x298b06,_0x38647e[_0x45dd('0x55')]);return _0x310b9e[_0x45dd('0x56')](_0x545601);}})[_0x45dd('0x43')](handleError(_0x310b9e,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 6eff7c1..1e8a37c 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 _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 +var _0x910d=['./attachment.attributes','exports','Attachment','util','../../config/logger','api','moment','request-promise','path'];(function(_0x30ec9b,_0xc6365a){var _0x4c74a6=function(_0x5da73e){while(--_0x5da73e){_0x30ec9b['push'](_0x30ec9b['shift']());}};_0x4c74a6(++_0xc6365a);}(_0x910d,0x93));var _0xd910=function(_0x544765,_0x22fc47){_0x544765=_0x544765-0x0;var _0x2224ee=_0x910d[_0x544765];return _0x2224ee;};'use strict';var _=require('lodash');var util=require(_0xd910('0x0'));var logger=require(_0xd910('0x1'))(_0xd910('0x2'));var moment=require(_0xd910('0x3'));var BPromise=require('bluebird');var rp=require(_0xd910('0x4'));var fs=require('fs');var path=require(_0xd910('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd910('0x6'));module[_0xd910('0x7')]=function(_0x5d796b,_0x40ac58){return _0x5d796b['define'](_0xd910('0x8'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 46b0d58..04e1b51 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 _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 +var _0x81d5=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateAttachment','Attachment','body','options','raw','then','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x14082b,_0x3672d6){var _0x53a93d=function(_0x514882){while(--_0x514882){_0x14082b['push'](_0x14082b['shift']());}};_0x53a93d(++_0x3672d6);}(_0x81d5,0x1ab));var _0x581d=function(_0x50ec08,_0x9f5571){_0x50ec08=_0x50ec08-0x0;var _0x4824ae=_0x81d5[_0x50ec08];return _0x4824ae;};'use strict';var _=require(_0x581d('0x0'));var util=require(_0x581d('0x1'));var moment=require('moment');var BPromise=require(_0x581d('0x2'));var rs=require(_0x581d('0x3'));var fs=require('fs');var Redis=require(_0x581d('0x4'));var db=require(_0x581d('0x5'))['db'];var utils=require(_0x581d('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x581d('0x7'));var jayson=require(_0x581d('0x8'));var client=jayson[_0x581d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16067b,_0x2f32bf,_0x43124c){return new BPromise(function(_0x497368,_0xf1a3b6){return client['request'](_0x16067b,_0x43124c)['then'](function(_0x5d8fa3){logger[_0x581d('0xa')](_0x581d('0xb'),_0x2f32bf,_0x581d('0xc'));logger[_0x581d('0xd')](_0x581d('0xe'),_0x2f32bf,'request\x20sent',JSON[_0x581d('0xf')](_0x5d8fa3));if(_0x5d8fa3[_0x581d('0x10')]){if(_0x5d8fa3[_0x581d('0x10')][_0x581d('0x11')]===0x1f4){logger[_0x581d('0x10')](_0x581d('0xb'),_0x2f32bf,_0x5d8fa3[_0x581d('0x10')][_0x581d('0x12')]);return _0xf1a3b6(_0x5d8fa3[_0x581d('0x10')][_0x581d('0x12')]);}logger['error'](_0x581d('0xb'),_0x2f32bf,_0x5d8fa3[_0x581d('0x10')]['message']);return _0x497368(_0x5d8fa3['error']['message']);}else{logger['info'](_0x581d('0xb'),_0x2f32bf,'request\x20sent');_0x497368(_0x5d8fa3[_0x581d('0x13')][_0x581d('0x12')]);}})['catch'](function(_0x1890d0){logger['error'](_0x581d('0xb'),_0x2f32bf,_0x1890d0);_0xf1a3b6(_0x1890d0);});});}exports[_0x581d('0x14')]=function(_0x1e059d){var _0x42f7db=this;return new Promise(function(_0x1f790f,_0x2cff0d){return db[_0x581d('0x15')]['create'](_0x1e059d[_0x581d('0x16')],{'raw':_0x1e059d[_0x581d('0x17')]?_0x1e059d[_0x581d('0x17')][_0x581d('0x18')]===undefined?!![]:![]:!![]})[_0x581d('0x19')](function(_0x2a2aba){logger[_0x581d('0xa')](_0x581d('0x14'),_0x1e059d);logger[_0x581d('0xd')](_0x581d('0x14'),_0x1e059d,JSON[_0x581d('0xf')](_0x2a2aba));_0x1f790f(_0x2a2aba);})[_0x581d('0x1a')](function(_0x5add13){logger[_0x581d('0x10')](_0x581d('0x14'),_0x5add13[_0x581d('0x12')],_0x1e059d);_0x2cff0d(_0x42f7db[_0x581d('0x10')](0x1f4,_0x5add13[_0x581d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index f9e1939..1309d00 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 _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 +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(_0x5e3d82,_0x97b075){var _0x18b0b7=function(_0x5633c4){while(--_0x5633c4){_0x5e3d82['push'](_0x5e3d82['shift']());}};_0x18b0b7(++_0x97b075);}(_0x757a,0xde));var _0xa757=function(_0x32c68d,_0x3eea58){_0x32c68d=_0x32c68d-0x0;var _0x23a39d=_0x757a[_0x32c68d];return _0x23a39d;};'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 diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index c3deac3..d09b27e 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 _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 +var _0x71fd=['Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','password','role','disabled','blocked','blockedAt','admin','user','agent','domain','add','minutes','getLicense','catch','send','message','login','signToken','online','use','ad-login','User','passport-local','moment','util','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x71fd,0x1c1));var _0xd71f=function(_0x1a2b00,_0x49c0d6){_0x1a2b00=_0x1a2b00-0x0;var _0x5c3cfb=_0x71fd[_0x1a2b00];return _0x5c3cfb;};'use strict';var passport=require('passport');var LocalStrategy=require(_0xd71f('0x0'))['Strategy'];var moment=require(_0xd71f('0x1'));var ActiveDirectory=require('activedirectory2');var BPromise=require('bluebird');var util=require(_0xd71f('0x2'));var db=require('../../mysqldb')['db'];var authService=require(_0xd71f('0x3'));var utils=require(_0xd71f('0x4'));var config=require(_0xd71f('0x5'));var logger=require(_0xd71f('0x6'))(_0xd71f('0x7'));function isActiveDirectoryConfigured(_0x2be03c){var _0x44073b=![];if(typeof _0x2be03c[_0xd71f('0x8')]!==_0xd71f('0x9')){_0x44073b=_0x2be03c['activedirectory']['baseDN']&&_0x2be03c['activedirectory']['url']&&_0x2be03c[_0xd71f('0x8')]['domain'];}return _0x44073b;}function adAuthenticate(_0x347f92,_0x27be32,_0x1d2ad0){return new BPromise(function(_0x3b4781,_0x5f2ccf){try{var _0xb68675=new ActiveDirectory(_0x347f92);_0xb68675['authenticate'](_0x27be32,_0x1d2ad0,function(_0x19e2f5,_0xcd5619){if(_0x19e2f5){logger[_0xd71f('0xa')]('Error\x20authenticate\x20%s:\x20%s',_0x27be32,util[_0xd71f('0xb')](_0x19e2f5,{'showHidden':![],'depth':null}));_0x5f2ccf(_0xd71f('0xc'));}else if(!_0xcd5619){logger['error'](_0xd71f('0xd'),_0x27be32);_0x5f2ccf(_0xd71f('0xc'));}else{_0x3b4781(_0xcd5619);}});}catch(_0x3672d7){_0x5f2ccf(_0x3672d7);}});}function ActiveDirectoryAuthenticate(_0x48f224,_0x1a571a,_0x970cc6,_0x223177){var _0x39c85e,_0x13cecd;if(!isActiveDirectoryConfigured(config)){logger[_0xd71f('0xa')](_0xd71f('0xe'),_0x1a571a);return _0x223177(null,![],{'message':_0xd71f('0xc')});}return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xd71f('0xf'),_0xd71f('0x10')],'raw':!![]})[_0xd71f('0x11')](function(_0x5db4a0){_0x39c85e=_0x5db4a0;if(!_0x39c85e[_0xd71f('0xf')]){logger['error'](_0xd71f('0x12'),_0x1a571a);throw new Error(_0xd71f('0xc'));}return _0x48f224[_0xd71f('0x13')]({'attributes':['id',_0xd71f('0x14'),_0xd71f('0x15'),'salt',_0xd71f('0x16'),_0xd71f('0x17'),_0xd71f('0x18'),_0xd71f('0x19'),'online'],'where':{'name':_0x1a571a,'role':{'$or':[_0xd71f('0x1a'),_0xd71f('0x1b'),_0xd71f('0x1c')]},'adSsoEnabled':!![]}});})[_0xd71f('0x11')](function(_0x33013e){if(!_0x33013e||_0x33013e&&_0x33013e['name']!==_0x1a571a){throw new Error(_0xd71f('0xc'));}_0x13cecd=_0x33013e;var _0x1fc148=_0x13cecd['name']+'@'+config['activedirectory'][_0xd71f('0x1d')];return adAuthenticate(config['activedirectory'],_0x1fc148,_0x970cc6);})[_0xd71f('0x11')](function(_0xdec4bd){if(_0x13cecd[_0xd71f('0x17')]){throw new Error(_0xd71f('0xc'));}if(_0x39c85e[_0xd71f('0x10')]>0x0){if(_0x13cecd[_0xd71f('0x18')]){if(moment(_0x13cecd[_0xd71f('0x19')])[_0xd71f('0x1e')](_0x39c85e['blockDuration'],_0xd71f('0x1f'))>moment()){throw new Error(_0xd71f('0xc'));}return utils['clearBlockUser'](_0x13cecd,0x0,![],null)['then'](function(){return utils[_0xd71f('0x20')](_0x13cecd);})['then'](function(){return _0x223177(null,_0x13cecd);});}else{return utils['getLicense'](_0x13cecd)[_0xd71f('0x11')](function(){return _0x223177(null,_0x13cecd);});}}else{return utils[_0xd71f('0x20')](_0x13cecd)[_0xd71f('0x11')](function(){return _0x223177(null,_0x13cecd);});}})[_0xd71f('0x21')](function(_0x199893){return _0x223177(null,![],_0x199893);});}function handleError(_0x2215fe,_0x4f2a5a,_0x5883c3){return _0x2215fe['status'](_0x4f2a5a||0x1f4)[_0xd71f('0x22')]({'message':_0x5883c3?_0x5883c3[_0xd71f('0x23')]||_0x5883c3:''});}exports[_0xd71f('0x24')]=function(_0x2eb63d,_0x4920b3,_0x597948){passport['authenticate']('ad-login',function(_0x4153a9,_0x397001,_0x2c9005){var _0x5ccd04=_0x4153a9||_0x2c9005;if(_0x5ccd04){return handleError(_0x4920b3,0x191,_0x5ccd04);}if(!_0x397001){return handleError(_0x4920b3,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x71403c={'payload':{'id':_0x397001['id'],'role':_0x397001['role']},'options':{'expiresIn':0x15180}};return authService[_0xd71f('0x25')](_0x71403c)[_0xd71f('0x11')](function(_0x5e2aa7){_0x4920b3['json']({'id':_0x397001['id'],'token':_0x5e2aa7,'statusCall':'','isAlreadyLogged':_0x397001[_0xd71f('0x26')]});});}})(_0x2eb63d,_0x4920b3,_0x597948);};passport[_0xd71f('0x27')](_0xd71f('0x28'),new LocalStrategy({'usernameField':_0xd71f('0x14'),'passwordField':_0xd71f('0x15')},function(_0x3661bb,_0x163b00,_0x2e75ea){return ActiveDirectoryAuthenticate(db[_0xd71f('0x29')],_0x3661bb,_0x163b00,_0x2e75ea);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 37376e4..b26494c 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 _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 +var _0xeebb=['exports','Router','./authActiveDirectory.controller','post','login'];(function(_0x2a526f,_0x1410a1){var _0x2aa6d0=function(_0x3c9690){while(--_0x3c9690){_0x2a526f['push'](_0x2a526f['shift']());}};_0x2aa6d0(++_0x1410a1);}(_0xeebb,0xbf));var _0xbeeb=function(_0xf31126,_0x16ce8c){_0xf31126=_0xf31126-0x0;var _0x1c27b7=_0xeebb[_0xf31126];return _0x1c27b7;};'use strict';var express=require('express');var router=express[_0xbeeb('0x0')]();var controller=require(_0xbeeb('0x1'));router[_0xbeeb('0x2')]('/',controller[_0xbeeb('0x3')]);module[_0xbeeb('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 e7c25ca..e1d5e06 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(_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 +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(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x7a54,0x106));var _0x47a5=function(_0x46c46a,_0x203b08){_0x46c46a=_0x46c46a-0x0;var _0x43bd58=_0x7a54[_0x46c46a];return _0x43bd58;};'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 8c6ac54..f0f22f6 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 _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 +var _0x591a=['callback','isMiddleware','setTokenCookie','express','passport','Router','../user/user.controller.js','../../components/auth/service','login','get','/callback'];(function(_0x1ca9eb,_0x99a10b){var _0x2e284e=function(_0x1196a4){while(--_0x1196a4){_0x1ca9eb['push'](_0x1ca9eb['shift']());}};_0x2e284e(++_0x99a10b);}(_0x591a,0x163));var _0xa591=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x591a[_0xaa0309];return _0x5de7ce;};'use strict';var express=require(_0xa591('0x0'));var passport=require(_0xa591('0x1'));var router=express[_0xa591('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0xa591('0x3'));var authService=require(_0xa591('0x4'));router['get']('/',controller[_0xa591('0x5')]);router[_0xa591('0x6')](_0xa591('0x7'),controller[_0xa591('0x8')],authService[_0xa591('0x9')],userController[_0xa591('0x5')],authService[_0xa591('0xa')]);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 37903e8..013ec3a 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 _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 +var _0x6ee3=['signToken','json','online','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','Reset\x20Email\x20sent!','params','token','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','resetPasswordExpires','Password\x20reset!','use','passport','passport-local','Strategy','jayson/promise','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','findOne','allowedLoginAttempts','blockDuration','name','password','salt','role','disabled','blocked','loginAttempts','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockedAt','add','minutes','clearBlockUser','then','catch','getLicense','MailAccount','find','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','email','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','status','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.'];(function(_0x1d442f,_0x10ca71){var _0x7a2cba=function(_0xde90f0){while(--_0xde90f0){_0x1d442f['push'](_0x1d442f['shift']());}};_0x7a2cba(++_0x10ca71);}(_0x6ee3,0x1bf));var _0x36ee=function(_0x3b7f7a,_0x5d46f3){_0x3b7f7a=_0x3b7f7a-0x0;var _0x169981=_0x6ee3[_0x3b7f7a];return _0x169981;};'use strict';var util=require('util');var passport=require(_0x36ee('0x0'));var LocalStrategy=require(_0x36ee('0x1'))[_0x36ee('0x2')];var jayson=require(_0x36ee('0x3'));var _=require(_0x36ee('0x4'));var rs=require('randomstring');var moment=require(_0x36ee('0x5'));var db=require(_0x36ee('0x6'))['db'];var authService=require(_0x36ee('0x7'));var utils=require(_0x36ee('0x8'));var client=jayson[_0x36ee('0x9')][_0x36ee('0xa')]({'port':0x232b});function localAuthenticate(_0x2a29d7,_0x10ba3d,_0x56355a,_0x9c6aa){var _0x33b487,_0xf7e53;return db['Setting'][_0x36ee('0xb')]({'where':{'id':0x1},'attributes':[_0x36ee('0xc'),_0x36ee('0xd')],'raw':!![]})['then'](function(_0x51f06b){_0x33b487=_0x51f06b;return _0x2a29d7[_0x36ee('0xb')]({'attributes':['id',_0x36ee('0xe'),_0x36ee('0xf'),_0x36ee('0x10'),_0x36ee('0x11'),_0x36ee('0x12'),_0x36ee('0x13'),'blockedAt',_0x36ee('0x14')],'where':{'name':_0x10ba3d,'role':{'$or':['admin',_0x36ee('0x15'),_0x36ee('0x16')]}}});})['then'](function(_0x3fa53c){if(!_0x3fa53c||_0x3fa53c&&_0x3fa53c[_0x36ee('0xe')]!==_0x10ba3d){throw new Error(_0x36ee('0x17'));}else{_0xf7e53=_0x3fa53c;return _0xf7e53;}})['then'](function(){_0xf7e53[_0x36ee('0x18')](_0x56355a,function(_0x98ac6d,_0x525bf2){var _0x5e6138=_0xf7e53[_0x36ee('0x14')]+0x1;if(_0x98ac6d){return _0x9c6aa(_0x98ac6d);}else if(!_0x525bf2){if(_0xf7e53['disabled']){return _0x9c6aa(null,![],{'message':_0x36ee('0x17')});}else if(_0x33b487[_0x36ee('0xc')]>0x0){if(_0xf7e53['blocked']){if(_0x33b487[_0x36ee('0xd')]>0x0){if(moment(_0xf7e53[_0x36ee('0x19')])[_0x36ee('0x1a')](_0x33b487[_0x36ee('0xd')],_0x36ee('0x1b'))>moment()){return _0x9c6aa(null,![],{'message':_0x36ee('0x17')});}else{return utils[_0x36ee('0x1c')](_0xf7e53,_0x5e6138,![],null)[_0x36ee('0x1d')](function(){return _0x9c6aa(null,![],{'message':_0x36ee('0x17')});});}}else{return _0x9c6aa(null,![],{'message':_0x36ee('0x17')});}}else{if(_0x5e6138>=_0x33b487[_0x36ee('0xc')]){return utils['clearBlockUser'](_0xf7e53,0x0,!![],moment())['then'](function(){return _0x9c6aa(null,![],{'message':_0x36ee('0x17')});});}else{return utils[_0x36ee('0x1c')](_0xf7e53,_0x5e6138,![],null)[_0x36ee('0x1d')](function(){return _0x9c6aa(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x9c6aa(null,![],{'message':_0x36ee('0x17')});}}else{if(_0xf7e53[_0x36ee('0x12')]){return _0x9c6aa(null,![],{'message':_0x36ee('0x17')});}else if(_0x33b487['allowedLoginAttempts']>0x0){if(_0xf7e53['blocked']){if(_0x33b487[_0x36ee('0xd')]>0x0){if(moment(_0xf7e53[_0x36ee('0x19')])[_0x36ee('0x1a')](_0x33b487['blockDuration'],'minutes')>moment()){return _0x9c6aa(null,![],{'message':_0x36ee('0x17')});}else{return utils[_0x36ee('0x1c')](_0xf7e53,0x0,![],null)[_0x36ee('0x1d')](function(){return utils['getLicense'](_0xf7e53);})[_0x36ee('0x1d')](function(){return _0x9c6aa(null,_0xf7e53);});}}else{return _0x9c6aa(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils['clearBlockUser'](_0xf7e53,0x0,![],null)[_0x36ee('0x1d')](function(){return utils['getLicense'](_0xf7e53);})[_0x36ee('0x1d')](function(){return _0x9c6aa(null,_0xf7e53);})[_0x36ee('0x1e')](function(_0x1a0c90){return _0x9c6aa(null,![],_0x1a0c90);});}}else{if(_0xf7e53[_0x36ee('0x13')]){return _0x9c6aa(null,![],{'message':_0x36ee('0x17')});}else{return utils[_0x36ee('0x1f')](_0xf7e53)[_0x36ee('0x1d')](function(){return _0x9c6aa(null,_0xf7e53);});}}}});})['catch'](function(_0x487993){return _0x9c6aa(null,![],_0x487993);});}function sendServiceMail(_0x59dc0e){return db[_0x36ee('0x20')][_0x36ee('0x21')]({'where':{'service':!![]},'attributes':['id',_0x36ee('0xe'),'email'],'include':[{'model':db[_0x36ee('0x22')],'as':_0x36ee('0x23'),'include':[{'model':db[_0x36ee('0x24')],'as':'CloudProvider'}]}]})['then'](function(_0x49b2ad){if(!_0x49b2ad){throw new Error(_0x36ee('0x25'));}var _0x3db155=_0x49b2ad[_0x36ee('0x26')]();var _0x4b16ec={'account':_0x3db155,'message':_['merge']({'from':util[_0x36ee('0x27')](_0x36ee('0x28'),_0x49b2ad[_0x36ee('0xe')],_0x49b2ad[_0x36ee('0x29')]||_0x49b2ad[_0x36ee('0x23')][_0x36ee('0x15')])},_0x59dc0e)};return client[_0x36ee('0x2a')](_0x36ee('0x2b'),_0x4b16ec);})[_0x36ee('0x1d')](function(_0x5b8362){if(_0x5b8362['error']){throw new Error(util[_0x36ee('0x27')](_0x36ee('0x2c'),_0x5b8362[_0x36ee('0x2d')][_0x36ee('0x2e')]||JSON[_0x36ee('0x2f')](_0x5b8362['error'])));}return!![];});}function handleError(_0x233292,_0x191038,_0x286422){return _0x233292[_0x36ee('0x30')](_0x191038||0x1f4)['send']({'message':_0x286422?_0x286422['message']||_0x286422:''});}exports['login']=function(_0x51d1ce,_0x23b951,_0x5d98ec){passport[_0x36ee('0x18')](_0x36ee('0x31'),function(_0x30d572,_0x454f02,_0xe9e918){var _0xa9478a=_0x30d572||_0xe9e918;if(_0xa9478a){return handleError(_0x23b951,0x191,_0xa9478a);}if(!_0x454f02){return handleError(_0x23b951,0x194,{'message':_0x36ee('0x32')});}else{var _0x6d75e8={'payload':{'id':_0x454f02['id'],'role':_0x454f02[_0x36ee('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0x36ee('0x33')](_0x6d75e8)[_0x36ee('0x1d')](function(_0x2ea2d9){_0x23b951[_0x36ee('0x34')]({'id':_0x454f02['id'],'token':_0x2ea2d9,'statusCall':'','isAlreadyLogged':_0x454f02[_0x36ee('0x35')]});});}})(_0x51d1ce,_0x23b951,_0x5d98ec);};exports['forgot']=function(_0x293875,_0x3b5626){if(!_0x293875[_0x36ee('0x36')][_0x36ee('0x29')]){return handleError(_0x3b5626,0x1f4,{'message':_0x36ee('0x37')});}var _0x3ead73=rs[_0x36ee('0x38')]();_0x293875[_0x36ee('0x36')][_0x36ee('0x29')]=_0x293875['body'][_0x36ee('0x29')][_0x36ee('0x39')]()[_0x36ee('0x3a')]();var _0x5dd304;return db[_0x36ee('0x3b')][_0x36ee('0xb')]({'where':{'id':0x1},'attributes':[_0x36ee('0xc'),_0x36ee('0xd')],'raw':!![]})[_0x36ee('0x1d')](function(_0xd39078){_0x5dd304=_0xd39078;return db[_0x36ee('0x3c')][_0x36ee('0x21')]({'where':{'email':_0x293875[_0x36ee('0x36')][_0x36ee('0x29')]}});})[_0x36ee('0x1d')](function(_0x12897c){if(!_0x12897c){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x12897c[_0x36ee('0x12')]){throw new Error(_0x36ee('0x3d'));}if(_0x12897c['blocked']){if(moment(_0x12897c[_0x36ee('0x19')])[_0x36ee('0x1a')](_0x5dd304[_0x36ee('0xd')],_0x36ee('0x1b'))>moment()){throw new Error(_0x36ee('0x3e'));}else{_0x12897c[_0x36ee('0x13')]=![];_0x12897c['blockedAt']=null;}}_0x12897c[_0x36ee('0x3f')]=_0x3ead73;_0x12897c['resetPasswordExpires']=Date[_0x36ee('0x40')]()+0x36ee80;return _0x12897c[_0x36ee('0x41')]();})['then'](function(){return sendServiceMail({'to':_0x293875['body'][_0x36ee('0x29')],'subject':_0x36ee('0x42'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x36ee('0x43')+'https://'+_0x293875['headers']['host']+_0x36ee('0x44')+_0x3ead73+'\x0a\x0a'+_0x36ee('0x45')});})['then'](function(){_0x3b5626[_0x36ee('0x30')](0xc8)[_0x36ee('0x46')]({'message':_0x36ee('0x47')});})[_0x36ee('0x1e')](function(_0x3ddbe1){return handleError(_0x3b5626,0x1f4,_0x3ddbe1);});};exports['reset']=function(_0x1f151b,_0x36e173){return db[_0x36ee('0x3c')]['find']({'where':{'resetPasswordToken':_0x1f151b[_0x36ee('0x48')][_0x36ee('0x49')],'resetPasswordExpires':{'$gt':Date[_0x36ee('0x40')]()}}})[_0x36ee('0x1d')](function(_0x5c7b86){if(!_0x5c7b86){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0x36ee('0xb')]({'attributes':['id',_0x36ee('0x4a'),_0x36ee('0x4b'),_0x36ee('0x4c')]})['then'](function(_0x513fcd){if(_0x513fcd[_0x36ee('0x4a')])authService[_0x36ee('0x4d')](_0x1f151b[_0x36ee('0x36')][_0x36ee('0xf')]);if(!_0x513fcd[_0x36ee('0x4b')]||!_0x5c7b86[_0x36ee('0x4e')])return _0x5c7b86;authService[_0x36ee('0x4f')](_0x1f151b['body'][_0x36ee('0xf')],_0x5c7b86[_0x36ee('0x4e')],_0x513fcd[_0x36ee('0x4c')]);return _0x5c7b86;})[_0x36ee('0x1d')](function(){_0x5c7b86[_0x36ee('0xf')]=_0x1f151b[_0x36ee('0x36')][_0x36ee('0xf')];_0x5c7b86[_0x36ee('0x3f')]=null;_0x5c7b86[_0x36ee('0x50')]=null;return _0x5c7b86[_0x36ee('0x41')]();});})[_0x36ee('0x1d')](function(){_0x36e173['status'](0xc8)['send']({'message':_0x36ee('0x51')});})[_0x36ee('0x1e')](function(_0x2ae270){return handleError(_0x36e173,0x1f4,_0x2ae270);});};passport[_0x36ee('0x52')](_0x36ee('0x31'),new LocalStrategy({'usernameField':'name','passwordField':_0x36ee('0xf')},function(_0xe40a70,_0x15a74c,_0x5d2168){return localAuthenticate(db['User'],_0xe40a70,_0x15a74c,_0x5d2168);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 0c2b112..65111be 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 _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 +var _0x840c=['express','Router','./authLocal.controller','login','/forgot','forgot','/reset/:token','reset'];(function(_0x54295c,_0xb3d2f7){var _0x515533=function(_0x550118){while(--_0x550118){_0x54295c['push'](_0x54295c['shift']());}};_0x515533(++_0xb3d2f7);}(_0x840c,0x70));var _0xc840=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x840c[_0x220dbb];return _0x2b77de;};'use strict';var express=require(_0xc840('0x0'));var router=express[_0xc840('0x1')]();var controller=require(_0xc840('0x2'));router['post']('/',controller[_0xc840('0x3')]);router['post'](_0xc840('0x4'),controller[_0xc840('0x5')]);router['post'](_0xc840('0x6'),controller[_0xc840('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index b3c6646..e78f64f 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 _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 +var _0x824b=['exports','STRING','INTEGER','sequelize'];(function(_0x261357,_0x1e92d1){var _0x20e25d=function(_0x4c48ba){while(--_0x4c48ba){_0x261357['push'](_0x261357['shift']());}};_0x20e25d(++_0x1e92d1);}(_0x824b,0xa7));var _0xb824=function(_0x10fd8f,_0x1dda79){_0x10fd8f=_0x10fd8f-0x0;var _0xaff74a=_0x824b[_0x10fd8f];return _0xaff74a;};'use strict';var Sequelize=require(_0xb824('0x0'));module[_0xb824('0x1')]={'name':{'type':Sequelize[_0xb824('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xb824('0x2')]},'description':{'type':Sequelize[_0xb824('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xb824('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index b173539..774a638 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 _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 +var _0xa5ea=['../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','Automation','findAll','catch','show','include','options','find','create','body','params','Condition','addConditions','ids','getConditions','nolimit','addActions','Action','omit','getActions','findOne','eml-format','rimraf','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0xa5ea,0x186));var _0xaa5e=function(_0x1e63d1,_0x544ce6){_0x1e63d1=_0x1e63d1-0x0;var _0x12d5a8=_0xa5ea[_0x1e63d1];return _0x12d5a8;};'use strict';var emlformat=require(_0xaa5e('0x0'));var rimraf=require(_0xaa5e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xaa5e('0x2'));var BPromise=require(_0xaa5e('0x3'));var Mustache=require(_0xaa5e('0x4'));var util=require('util');var path=require(_0xaa5e('0x5'));var sox=require('sox');var csv=require(_0xaa5e('0x6'));var ejs=require(_0xaa5e('0x7'));var fs=require('fs');var fs_extra=require(_0xaa5e('0x8'));var _=require(_0xaa5e('0x9'));var squel=require('squel');var crypto=require(_0xaa5e('0xa'));var jsforce=require(_0xaa5e('0xb'));var deskjs=require(_0xaa5e('0xc'));var toCsv=require(_0xaa5e('0x6'));var querystring=require(_0xaa5e('0xd'));var Papa=require('papaparse');var Redis=require(_0xaa5e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xaa5e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa5e('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xaa5e('0x11'));var config=require(_0xaa5e('0x12'));var licenseUtil=require(_0xaa5e('0x13'));var db=require(_0xaa5e('0x14'))['db'];function respondWithStatusCode(_0x24b1fd,_0x4a4057){_0x4a4057=_0x4a4057||0xcc;return function(_0x1a5ed9){if(_0x1a5ed9){return _0x24b1fd['sendStatus'](_0x4a4057);}return _0x24b1fd['status'](_0x4a4057)[_0xaa5e('0x15')]();};}function respondWithResult(_0x4ecc79,_0x27cf09){_0x27cf09=_0x27cf09||0xc8;return function(_0x21d2c3){if(_0x21d2c3){return _0x4ecc79[_0xaa5e('0x16')](_0x27cf09)[_0xaa5e('0x17')](_0x21d2c3);}};}function respondWithFilteredResult(_0xb272a,_0x3f4e16){return function(_0x5171c6){if(_0x5171c6){var _0x397873=typeof _0x3f4e16[_0xaa5e('0x18')]===_0xaa5e('0x19')&&typeof _0x3f4e16[_0xaa5e('0x1a')]===_0xaa5e('0x19');var _0x3df07c=_0x5171c6[_0xaa5e('0x1b')];var _0x12f455=_0x397873?0x0:_0x3f4e16[_0xaa5e('0x18')];var _0x51ec98=_0x397873?_0x5171c6[_0xaa5e('0x1b')]:_0x3f4e16[_0xaa5e('0x18')]+_0x3f4e16[_0xaa5e('0x1a')];var _0x21490d;if(_0x51ec98>=_0x3df07c){_0x51ec98=_0x3df07c;_0x21490d=0xc8;}else{_0x21490d=0xce;}_0xb272a[_0xaa5e('0x16')](_0x21490d);return _0xb272a[_0xaa5e('0x1c')](_0xaa5e('0x1d'),_0x12f455+'-'+_0x51ec98+'/'+_0x3df07c)[_0xaa5e('0x17')](_0x5171c6);}return null;};}function patchUpdates(_0x1a0853){return function(_0x496844){try{jsonpatch['apply'](_0x496844,_0x1a0853,!![]);}catch(_0x46eb83){return BPromise[_0xaa5e('0x1e')](_0x46eb83);}return _0x496844[_0xaa5e('0x1f')]();};}function saveUpdates(_0x3a78e7,_0x2908a2){return function(_0x323963){if(_0x323963){return _0x323963[_0xaa5e('0x20')](_0x3a78e7)[_0xaa5e('0x21')](function(_0x3030c7){return _0x3030c7;});}return null;};}function removeEntity(_0xf696ae,_0x58aded){return function(_0x2757df){if(_0x2757df){return _0x2757df[_0xaa5e('0x22')]()[_0xaa5e('0x21')](function(){_0xf696ae[_0xaa5e('0x16')](0xcc)[_0xaa5e('0x15')]();});}};}function handleEntityNotFound(_0x4af6ea,_0xd10360){return function(_0x250b73){if(!_0x250b73){_0x4af6ea[_0xaa5e('0x23')](0x194);}return _0x250b73;};}function handleError(_0x3212f2,_0x340d78){_0x340d78=_0x340d78||0x1f4;return function(_0x3ef033){logger[_0xaa5e('0x24')](_0x3ef033['stack']);if(_0x3ef033['name']){delete _0x3ef033[_0xaa5e('0x25')];}_0x3212f2[_0xaa5e('0x16')](_0x340d78)[_0xaa5e('0x26')](_0x3ef033);};}exports[_0xaa5e('0x27')]=function(_0x588d56,_0x462c26){var _0x1cd772={},_0x44888d={},_0x2dfc8b={'count':0x0,'rows':[]};var _0x39f3c9=_[_0xaa5e('0x28')](db['Automation'][_0xaa5e('0x29')],function(_0x2ff81c){return{'name':_0x2ff81c[_0xaa5e('0x2a')],'type':_0x2ff81c[_0xaa5e('0x2b')][_0xaa5e('0x2c')]};});_0x44888d[_0xaa5e('0x2d')]=_[_0xaa5e('0x28')](_0x39f3c9,_0xaa5e('0x25'));_0x44888d[_0xaa5e('0x2e')]=_[_0xaa5e('0x2f')](_0x588d56[_0xaa5e('0x2e')]);_0x44888d[_0xaa5e('0x30')]=_[_0xaa5e('0x31')](_0x44888d[_0xaa5e('0x2d')],_0x44888d['query']);_0x1cd772[_0xaa5e('0x32')]=_[_0xaa5e('0x31')](_0x44888d['model'],qs[_0xaa5e('0x33')](_0x588d56[_0xaa5e('0x2e')][_0xaa5e('0x33')]));_0x1cd772[_0xaa5e('0x32')]=_0x1cd772[_0xaa5e('0x32')][_0xaa5e('0x34')]?_0x1cd772[_0xaa5e('0x32')]:_0x44888d[_0xaa5e('0x2d')];if(!_0x588d56[_0xaa5e('0x2e')][_0xaa5e('0x35')]('nolimit')){_0x1cd772['limit']=qs['limit'](_0x588d56['query']['limit']);_0x1cd772['offset']=qs[_0xaa5e('0x18')](_0x588d56[_0xaa5e('0x2e')][_0xaa5e('0x18')]);}_0x1cd772[_0xaa5e('0x36')]=qs[_0xaa5e('0x37')](_0x588d56[_0xaa5e('0x2e')][_0xaa5e('0x37')]);_0x1cd772['where']=qs['filters'](_[_0xaa5e('0x38')](_0x588d56[_0xaa5e('0x2e')],_0x44888d[_0xaa5e('0x30')]),_0x39f3c9);if(_0x588d56[_0xaa5e('0x2e')][_0xaa5e('0x39')]){_0x1cd772[_0xaa5e('0x3a')]=_[_0xaa5e('0x3b')](_0x1cd772[_0xaa5e('0x3a')],{'$or':_[_0xaa5e('0x28')](_0x39f3c9,function(_0x223f2c){if(_0x223f2c[_0xaa5e('0x2b')]!==_0xaa5e('0x3c')){var _0x1bc253={};_0x1bc253[_0x223f2c[_0xaa5e('0x25')]]={'$like':'%'+_0x588d56['query'][_0xaa5e('0x39')]+'%'};return _0x1bc253;}})});}_0x1cd772=_[_0xaa5e('0x3b')]({},_0x1cd772,_0x588d56['options']);var _0xde949d={'where':_0x1cd772[_0xaa5e('0x3a')]};return db['Automation'][_0xaa5e('0x1b')](_0xde949d)[_0xaa5e('0x21')](function(_0x5b58bb){_0x2dfc8b['count']=_0x5b58bb;if(_0x588d56[_0xaa5e('0x2e')][_0xaa5e('0x3d')]){_0x1cd772['include']=[{'all':!![]}];}return db[_0xaa5e('0x3e')][_0xaa5e('0x3f')](_0x1cd772);})['then'](function(_0x18fdac){_0x2dfc8b['rows']=_0x18fdac;return _0x2dfc8b;})[_0xaa5e('0x21')](respondWithFilteredResult(_0x462c26,_0x1cd772))[_0xaa5e('0x40')](handleError(_0x462c26,null));};exports[_0xaa5e('0x41')]=function(_0x59c162,_0x182fdc){var _0x2be7fd={'raw':![],'where':{'id':_0x59c162['params']['id']}},_0xec50e5={};_0xec50e5[_0xaa5e('0x2d')]=_[_0xaa5e('0x2f')](db[_0xaa5e('0x3e')][_0xaa5e('0x29')]);_0xec50e5[_0xaa5e('0x2e')]=_[_0xaa5e('0x2f')](_0x59c162[_0xaa5e('0x2e')]);_0xec50e5[_0xaa5e('0x30')]=_['intersection'](_0xec50e5[_0xaa5e('0x2d')],_0xec50e5['query']);_0x2be7fd[_0xaa5e('0x32')]=_[_0xaa5e('0x31')](_0xec50e5[_0xaa5e('0x2d')],qs[_0xaa5e('0x33')](_0x59c162[_0xaa5e('0x2e')][_0xaa5e('0x33')]));_0x2be7fd[_0xaa5e('0x32')]=_0x2be7fd[_0xaa5e('0x32')][_0xaa5e('0x34')]?_0x2be7fd[_0xaa5e('0x32')]:_0xec50e5['model'];if(_0x59c162[_0xaa5e('0x2e')][_0xaa5e('0x3d')]){_0x2be7fd[_0xaa5e('0x42')]=[{'all':!![]}];}_0x2be7fd=_['merge']({},_0x2be7fd,_0x59c162[_0xaa5e('0x43')]);return db[_0xaa5e('0x3e')][_0xaa5e('0x44')](_0x2be7fd)[_0xaa5e('0x21')](handleEntityNotFound(_0x182fdc,null))[_0xaa5e('0x21')](respondWithResult(_0x182fdc,null))[_0xaa5e('0x40')](handleError(_0x182fdc,null));};exports[_0xaa5e('0x45')]=function(_0x3f6770,_0x457110){return db['Automation']['create'](_0x3f6770['body'],{})[_0xaa5e('0x21')](respondWithResult(_0x457110,0xc9))[_0xaa5e('0x40')](handleError(_0x457110,null));};exports['update']=function(_0x54cf13,_0x21ed5a){if(_0x54cf13[_0xaa5e('0x46')]['id']){delete _0x54cf13[_0xaa5e('0x46')]['id'];}return db[_0xaa5e('0x3e')][_0xaa5e('0x44')]({'where':{'id':_0x54cf13[_0xaa5e('0x47')]['id']}})[_0xaa5e('0x21')](handleEntityNotFound(_0x21ed5a,null))[_0xaa5e('0x21')](saveUpdates(_0x54cf13[_0xaa5e('0x46')],null))[_0xaa5e('0x21')](respondWithResult(_0x21ed5a,null))['catch'](handleError(_0x21ed5a,null));};exports['destroy']=function(_0x2167c0,_0x27c1ea){return db[_0xaa5e('0x3e')][_0xaa5e('0x44')]({'where':{'id':_0x2167c0['params']['id']}})[_0xaa5e('0x21')](handleEntityNotFound(_0x27c1ea,null))['then'](removeEntity(_0x27c1ea,null))['catch'](handleError(_0x27c1ea,null));};exports['addConditions']=function(_0x5c8375,_0x596d56,_0x5e1d33){return db[_0xaa5e('0x48')][_0xaa5e('0x44')]({'where':{'id':_0x5c8375[_0xaa5e('0x47')]['id']}})[_0xaa5e('0x21')](handleEntityNotFound(_0x596d56,null))[_0xaa5e('0x21')](function(_0x615eb7){if(_0x615eb7){return _0x615eb7[_0xaa5e('0x49')](_0x5c8375[_0xaa5e('0x46')][_0xaa5e('0x4a')],_['omit'](_0x5c8375[_0xaa5e('0x46')],[_0xaa5e('0x4a'),'id'])||{});}})[_0xaa5e('0x21')](respondWithResult(_0x596d56,null))[_0xaa5e('0x40')](handleError(_0x596d56,null));};exports[_0xaa5e('0x4b')]=function(_0x2130e8,_0x2f372f,_0x43b1d9){var _0x527c08={};var _0x4f2809={};var _0x152851;var _0x4d61c4;return db[_0xaa5e('0x3e')]['findOne']({'where':{'id':_0x2130e8['params']['id']}})[_0xaa5e('0x21')](handleEntityNotFound(_0x2f372f,null))[_0xaa5e('0x21')](function(_0x35c93a){if(_0x35c93a){_0x152851=_0x35c93a;_0x4f2809['model']=_[_0xaa5e('0x2f')](db[_0xaa5e('0x48')]['rawAttributes']);_0x4f2809[_0xaa5e('0x2e')]=_['keys'](_0x2130e8[_0xaa5e('0x2e')]);_0x4f2809[_0xaa5e('0x30')]=_[_0xaa5e('0x31')](_0x4f2809['model'],_0x4f2809[_0xaa5e('0x2e')]);_0x527c08[_0xaa5e('0x32')]=_[_0xaa5e('0x31')](_0x4f2809[_0xaa5e('0x2d')],qs['fields'](_0x2130e8[_0xaa5e('0x2e')][_0xaa5e('0x33')]));_0x527c08[_0xaa5e('0x32')]=_0x527c08['attributes'][_0xaa5e('0x34')]?_0x527c08[_0xaa5e('0x32')]:_0x4f2809['model'];_0x527c08['order']=qs[_0xaa5e('0x37')](_0x2130e8[_0xaa5e('0x2e')][_0xaa5e('0x37')]);_0x527c08[_0xaa5e('0x3a')]=qs[_0xaa5e('0x30')](_[_0xaa5e('0x38')](_0x2130e8['query'],_0x4f2809[_0xaa5e('0x30')]));if(_0x2130e8[_0xaa5e('0x2e')]['filter']){_0x527c08['where']=_[_0xaa5e('0x3b')](_0x527c08['where'],{'$or':_[_0xaa5e('0x28')](_0x527c08[_0xaa5e('0x32')],function(_0x1bd929){var _0x3ec969={};_0x3ec969[_0x1bd929]={'$like':'%'+_0x2130e8['query'][_0xaa5e('0x39')]+'%'};return _0x3ec969;})});}_0x527c08=_[_0xaa5e('0x3b')]({},_0x527c08,_0x2130e8['options']);return _0x152851[_0xaa5e('0x4b')](_0x527c08);}})[_0xaa5e('0x21')](function(_0x46ed0d){if(_0x46ed0d){_0x4d61c4=_0x46ed0d[_0xaa5e('0x34')];if(!_0x2130e8['query'][_0xaa5e('0x35')](_0xaa5e('0x4c'))){_0x527c08['limit']=qs[_0xaa5e('0x1a')](_0x2130e8[_0xaa5e('0x2e')][_0xaa5e('0x1a')]);_0x527c08[_0xaa5e('0x18')]=qs['offset'](_0x2130e8[_0xaa5e('0x2e')][_0xaa5e('0x18')]);}return _0x152851['getConditions'](_0x527c08);}})['then'](function(_0x576251){if(_0x576251){return _0x576251?{'count':_0x4d61c4,'rows':_0x576251}:null;}})[_0xaa5e('0x21')](respondWithResult(_0x2f372f,null))[_0xaa5e('0x40')](handleError(_0x2f372f,null));};exports[_0xaa5e('0x4d')]=function(_0x587587,_0x40908a,_0x55289c){return db[_0xaa5e('0x4e')][_0xaa5e('0x44')]({'where':{'id':_0x587587[_0xaa5e('0x47')]['id']}})[_0xaa5e('0x21')](handleEntityNotFound(_0x40908a,null))[_0xaa5e('0x21')](function(_0x4cb275){if(_0x4cb275){return _0x4cb275[_0xaa5e('0x4d')](_0x587587['body'][_0xaa5e('0x4a')],_[_0xaa5e('0x4f')](_0x587587[_0xaa5e('0x46')],[_0xaa5e('0x4a'),'id'])||{});}})[_0xaa5e('0x21')](respondWithResult(_0x40908a,null))[_0xaa5e('0x40')](handleError(_0x40908a,null));};exports[_0xaa5e('0x50')]=function(_0x51e283,_0x599aad,_0x1bb708){var _0xd73dc4={};var _0x52f5ee={};var _0x493366;var _0x1f6bda;return db[_0xaa5e('0x3e')][_0xaa5e('0x51')]({'where':{'id':_0x51e283[_0xaa5e('0x47')]['id']}})[_0xaa5e('0x21')](handleEntityNotFound(_0x599aad,null))['then'](function(_0x5fc8ab){if(_0x5fc8ab){_0x493366=_0x5fc8ab;_0x52f5ee[_0xaa5e('0x2d')]=_['keys'](db['Action']['rawAttributes']);_0x52f5ee[_0xaa5e('0x2e')]=_['keys'](_0x51e283[_0xaa5e('0x2e')]);_0x52f5ee['filters']=_[_0xaa5e('0x31')](_0x52f5ee[_0xaa5e('0x2d')],_0x52f5ee[_0xaa5e('0x2e')]);_0xd73dc4[_0xaa5e('0x32')]=_['intersection'](_0x52f5ee['model'],qs[_0xaa5e('0x33')](_0x51e283[_0xaa5e('0x2e')]['fields']));_0xd73dc4[_0xaa5e('0x32')]=_0xd73dc4[_0xaa5e('0x32')][_0xaa5e('0x34')]?_0xd73dc4['attributes']:_0x52f5ee[_0xaa5e('0x2d')];_0xd73dc4['order']=qs[_0xaa5e('0x37')](_0x51e283[_0xaa5e('0x2e')]['sort']);_0xd73dc4['where']=qs[_0xaa5e('0x30')](_[_0xaa5e('0x38')](_0x51e283[_0xaa5e('0x2e')],_0x52f5ee[_0xaa5e('0x30')]));if(_0x51e283[_0xaa5e('0x2e')]['filter']){_0xd73dc4['where']=_[_0xaa5e('0x3b')](_0xd73dc4[_0xaa5e('0x3a')],{'$or':_[_0xaa5e('0x28')](_0xd73dc4[_0xaa5e('0x32')],function(_0x291d80){var _0x4b9912={};_0x4b9912[_0x291d80]={'$like':'%'+_0x51e283['query'][_0xaa5e('0x39')]+'%'};return _0x4b9912;})});}_0xd73dc4=_['merge']({},_0xd73dc4,_0x51e283['options']);return _0x493366['getActions'](_0xd73dc4);}})[_0xaa5e('0x21')](function(_0x34bb3f){if(_0x34bb3f){_0x1f6bda=_0x34bb3f[_0xaa5e('0x34')];if(!_0x51e283['query'][_0xaa5e('0x35')](_0xaa5e('0x4c'))){_0xd73dc4[_0xaa5e('0x1a')]=qs['limit'](_0x51e283['query'][_0xaa5e('0x1a')]);_0xd73dc4[_0xaa5e('0x18')]=qs[_0xaa5e('0x18')](_0x51e283[_0xaa5e('0x2e')][_0xaa5e('0x18')]);}return _0x493366[_0xaa5e('0x50')](_0xd73dc4);}})[_0xaa5e('0x21')](function(_0x272c2c){if(_0x272c2c){return _0x272c2c?{'count':_0x1f6bda,'rows':_0x272c2c}:null;}})['then'](respondWithResult(_0x599aad,null))[_0xaa5e('0x40')](handleError(_0x599aad,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 8126c7d..6bcaa7c 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 _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 +var _0x1842=['../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5a6d51,_0x46c33a){var _0x3090f2=function(_0x1c5d95){while(--_0x1c5d95){_0x5a6d51['push'](_0x5a6d51['shift']());}};_0x3090f2(++_0x46c33a);}(_0x1842,0x114));var _0x2184=function(_0x429247,_0x4a7289){_0x429247=_0x429247-0x0;var _0x2ef8d5=_0x1842[_0x429247];return _0x2ef8d5;};'use strict';var _=require(_0x2184('0x0'));var util=require(_0x2184('0x1'));var logger=require(_0x2184('0x2'))(_0x2184('0x3'));var moment=require(_0x2184('0x4'));var BPromise=require(_0x2184('0x5'));var rp=require(_0x2184('0x6'));var fs=require('fs');var path=require(_0x2184('0x7'));var rimraf=require(_0x2184('0x8'));var config=require(_0x2184('0x9'));var attributes=require(_0x2184('0xa'));module[_0x2184('0xb')]=function(_0x2bb649,_0x46d357){return _0x2bb649[_0x2184('0xc')](_0x2184('0xd'),attributes,{'tableName':_0x2184('0xe'),'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 417f447..4b59614 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 _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 +var _0x1c77=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird'];(function(_0x102789,_0x24217f){var _0x4aeb4f=function(_0x48bbcb){while(--_0x48bbcb){_0x102789['push'](_0x102789['shift']());}};_0x4aeb4f(++_0x24217f);}(_0x1c77,0xed));var _0x71c7=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0x1c77[_0x519756];return _0x37047e;};'use strict';var _=require('lodash');var util=require(_0x71c7('0x0'));var moment=require(_0x71c7('0x1'));var BPromise=require(_0x71c7('0x2'));var rs=require(_0x71c7('0x3'));var fs=require('fs');var Redis=require(_0x71c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x71c7('0x5'));var logger=require(_0x71c7('0x6'))(_0x71c7('0x7'));var config=require(_0x71c7('0x8'));var jayson=require(_0x71c7('0x9'));var client=jayson[_0x71c7('0xa')][_0x71c7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57fb10,_0x57bbb6,_0x2c25a4){return new BPromise(function(_0x244867,_0x229b00){return client[_0x71c7('0xc')](_0x57fb10,_0x2c25a4)['then'](function(_0x1f5fc9){logger['info']('Automation,\x20%s,\x20%s',_0x57bbb6,_0x71c7('0xd'));logger[_0x71c7('0xe')](_0x71c7('0xf'),_0x57bbb6,_0x71c7('0xd'),JSON[_0x71c7('0x10')](_0x1f5fc9));if(_0x1f5fc9['error']){if(_0x1f5fc9[_0x71c7('0x11')][_0x71c7('0x12')]===0x1f4){logger[_0x71c7('0x11')](_0x71c7('0x13'),_0x57bbb6,_0x1f5fc9['error'][_0x71c7('0x14')]);return _0x229b00(_0x1f5fc9[_0x71c7('0x11')][_0x71c7('0x14')]);}logger[_0x71c7('0x11')](_0x71c7('0x13'),_0x57bbb6,_0x1f5fc9[_0x71c7('0x11')]['message']);return _0x244867(_0x1f5fc9['error'][_0x71c7('0x14')]);}else{logger[_0x71c7('0x15')](_0x71c7('0x13'),_0x57bbb6,_0x71c7('0xd'));_0x244867(_0x1f5fc9[_0x71c7('0x16')][_0x71c7('0x14')]);}})[_0x71c7('0x17')](function(_0x115262){logger['error'](_0x71c7('0x13'),_0x57bbb6,_0x115262);_0x229b00(_0x115262);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 5b05f1e..5947e4b 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 _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 +var _0x26bc=['/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./automation.controller','isAuthenticated','index','get','show','/:id/conditions','getConditions','/:id/actions','getActions','create','post','addConditions','put'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x26bc,0x162));var _0xc26b=function(_0x534382,_0x286bcc){_0x534382=_0x534382-0x0;var _0x44e48d=_0x26bc[_0x534382];return _0x44e48d;};'use strict';var multer=require(_0xc26b('0x0'));var util=require(_0xc26b('0x1'));var path=require(_0xc26b('0x2'));var timeout=require(_0xc26b('0x3'));var express=require(_0xc26b('0x4'));var router=express['Router']();var fs_extra=require(_0xc26b('0x5'));var auth=require(_0xc26b('0x6'));var interaction=require(_0xc26b('0x7'));var config=require('../../config/environment');var controller=require(_0xc26b('0x8'));router['get']('/',auth[_0xc26b('0x9')](),controller[_0xc26b('0xa')]);router[_0xc26b('0xb')]('/:id',auth[_0xc26b('0x9')](),controller[_0xc26b('0xc')]);router[_0xc26b('0xb')](_0xc26b('0xd'),auth[_0xc26b('0x9')](),controller[_0xc26b('0xe')]);router[_0xc26b('0xb')](_0xc26b('0xf'),auth[_0xc26b('0x9')](),controller[_0xc26b('0x10')]);router['post']('/',auth[_0xc26b('0x9')](),controller[_0xc26b('0x11')]);router[_0xc26b('0x12')](_0xc26b('0xd'),auth[_0xc26b('0x9')](),controller[_0xc26b('0x13')]);router['post'](_0xc26b('0xf'),auth['isAuthenticated'](),controller['addActions']);router[_0xc26b('0x14')](_0xc26b('0x15'),auth[_0xc26b('0x9')](),controller[_0xc26b('0x16')]);router['delete'](_0xc26b('0x15'),auth[_0xc26b('0x9')](),controller[_0xc26b('0x17')]);module[_0xc26b('0x18')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 0e127fe..a85e825 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 _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 +var _0x3cbd=['Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','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)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.'];(function(_0x2f30f8,_0x157438){var _0x91be2b=function(_0x111518){while(--_0x111518){_0x2f30f8['push'](_0x2f30f8['shift']());}};_0x91be2b(++_0x157438);}(_0x3cbd,0xf5));var _0xd3cb=function(_0x158cfc,_0x3ff9e0){_0x158cfc=_0x158cfc-0x0;var _0x38baee=_0x3cbd[_0x158cfc];return _0x38baee;};'use strict';var Sequelize=require(_0xd3cb('0x0'));module[_0xd3cb('0x1')]={'name':{'type':Sequelize[_0xd3cb('0x2')],'unique':_0xd3cb('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xd3cb('0x4')](_0xd3cb('0x5')),'allowNull':![],'defaultValue':_0xd3cb('0x5')},'description':{'type':Sequelize[_0xd3cb('0x2')]},'active':{'type':Sequelize[_0xd3cb('0x6')],'defaultValue':0x0,'comment':_0xd3cb('0x7')},'limitCalls':{'type':Sequelize[_0xd3cb('0x8')](0x4)[_0xd3cb('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xd3cb('0xa')},'dialOriginateCallerIdName':{'type':Sequelize[_0xd3cb('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xd3cb('0x8')](0x3)[_0xd3cb('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd3cb('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0xd3cb('0x8')](0x3)[_0xd3cb('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd3cb('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xd3cb('0x8')](0x5)[_0xd3cb('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd3cb('0xd')},'dialBusyMaxRetry':{'type':Sequelize[_0xd3cb('0x8')](0x3)[_0xd3cb('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xd3cb('0x8')](0x5)[_0xd3cb('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd3cb('0x9')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xd3cb('0x8')](0x5)[_0xd3cb('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xd3cb('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xd3cb('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xd3cb('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xd3cb('0x4')](_0xd3cb('0xf'),'never','onlyIfOpen'),'defaultValue':_0xd3cb('0xf')},'dialAMDActive':{'type':Sequelize[_0xd3cb('0x6')],'defaultValue':0x0,'comment':_0xd3cb('0x10')},'dialAMDInitialSilence':{'type':Sequelize[_0xd3cb('0x8')](0x9)[_0xd3cb('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xd3cb('0x8')](0x9)[_0xd3cb('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xd3cb('0x8')](0x9)[_0xd3cb('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xd3cb('0x11')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xd3cb('0x8')](0x9)[_0xd3cb('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd3cb('0x12')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xd3cb('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xd3cb('0x13')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xd3cb('0x8')](0x9)[_0xd3cb('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xd3cb('0x14')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xd3cb('0x8')](0x9)[_0xd3cb('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xd3cb('0x8')](0x5)[_0xd3cb('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd3cb('0x15')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xd3cb('0x8')](0x9)[_0xd3cb('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC','ASC'),'defaultValue':_0xd3cb('0x16')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xd3cb('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd3cb('0x17')},'dialCutDigit':{'type':Sequelize[_0xd3cb('0x8')](0x3)[_0xd3cb('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd3cb('0x18')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd3cb('0x8')](0x3)[_0xd3cb('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd3cb('0x19')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xd3cb('0x8')](0x5)[_0xd3cb('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd3cb('0x1a')},'dialDropMaxRetry':{'type':Sequelize[_0xd3cb('0x8')](0x3)[_0xd3cb('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd3cb('0x1b')},'dialDropRetryFrequency':{'type':Sequelize[_0xd3cb('0x8')](0x5)[_0xd3cb('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd3cb('0x1c')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd3cb('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xd3cb('0x8')](0x3)[_0xd3cb('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd3cb('0x1d')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd3cb('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd3cb('0x1e')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xd3cb('0x8')](0x3)[_0xd3cb('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd3cb('0x1f')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xd3cb('0x8')](0x5)[_0xd3cb('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index dc68ad5..e722bf3 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 _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 +var _0xa249=['send','index','map','Campaign','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','clone','omit','updatedAt','createdAt','user','findOne','CmHopper','sort','pick','getHopperHistories','CampaignId','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','format','YYYY-MM-DD\x20HH:mm:ss','addLists','ids','dialCheckDuplicateType','always','into','cm_hopper','phone','scheduledAt','ListId','select','field','NOW()','ContactId','toString','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)','from','onlyIfOpen','insert','fromQuery','CmListId','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','join','h.ListId\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','spread','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name'];(function(_0x12977a,_0x44a4a7){var _0x3e5bfe=function(_0x10afe8){while(--_0x10afe8){_0x12977a['push'](_0x12977a['shift']());}};_0x3e5bfe(++_0x44a4a7);}(_0xa249,0x183));var _0x9a24=function(_0x4fe6a4,_0x2d05c3){_0x4fe6a4=_0x4fe6a4-0x0;var _0x24fb98=_0xa249[_0x4fe6a4];return _0x24fb98;};'use strict';var emlformat=require(_0x9a24('0x0'));var rimraf=require(_0x9a24('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9a24('0x2'));var rp=require(_0x9a24('0x3'));var moment=require('moment');var BPromise=require(_0x9a24('0x4'));var Mustache=require('mustache');var util=require(_0x9a24('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9a24('0x6'));var fs=require('fs');var fs_extra=require(_0x9a24('0x7'));var _=require(_0x9a24('0x8'));var squel=require(_0x9a24('0x9'));var crypto=require(_0x9a24('0xa'));var jsforce=require(_0x9a24('0xb'));var deskjs=require(_0x9a24('0xc'));var toCsv=require(_0x9a24('0xd'));var querystring=require(_0x9a24('0xe'));var Papa=require(_0x9a24('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9a24('0x10'));var as=require(_0x9a24('0x11'));var hardwareService=require(_0x9a24('0x12'));var logger=require('../../config/logger')(_0x9a24('0x13'));var utils=require('../../config/utils');var config=require(_0x9a24('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9a24('0x15'))['db'];function respondWithStatusCode(_0xf809b7,_0x3d278b){_0x3d278b=_0x3d278b||0xcc;return function(_0x41f522){if(_0x41f522){return _0xf809b7[_0x9a24('0x16')](_0x3d278b);}return _0xf809b7['status'](_0x3d278b)[_0x9a24('0x17')]();};}function respondWithResult(_0x3d166d,_0x2bc767){_0x2bc767=_0x2bc767||0xc8;return function(_0x301a26){if(_0x301a26){return _0x3d166d[_0x9a24('0x18')](_0x2bc767)['json'](_0x301a26);}};}function respondWithFilteredResult(_0x519709,_0x714fd5){return function(_0x306c6d){if(_0x306c6d){var _0x25202f=typeof _0x714fd5['offset']===_0x9a24('0x19')&&typeof _0x714fd5[_0x9a24('0x1a')]===_0x9a24('0x19');var _0x2ffc6b=_0x306c6d[_0x9a24('0x1b')];var _0x402532=_0x25202f?0x0:_0x714fd5[_0x9a24('0x1c')];var _0xa438fe=_0x25202f?_0x306c6d[_0x9a24('0x1b')]:_0x714fd5[_0x9a24('0x1c')]+_0x714fd5[_0x9a24('0x1a')];var _0x164ab2;if(_0xa438fe>=_0x2ffc6b){_0xa438fe=_0x2ffc6b;_0x164ab2=0xc8;}else{_0x164ab2=0xce;}_0x519709['status'](_0x164ab2);return _0x519709[_0x9a24('0x1d')]('Content-Range',_0x402532+'-'+_0xa438fe+'/'+_0x2ffc6b)['json'](_0x306c6d);}return null;};}function patchUpdates(_0x4b775a){return function(_0x114921){try{jsonpatch[_0x9a24('0x1e')](_0x114921,_0x4b775a,!![]);}catch(_0x4d8fa8){return BPromise[_0x9a24('0x1f')](_0x4d8fa8);}return _0x114921[_0x9a24('0x20')]();};}function saveUpdates(_0x69d2e9,_0x430594){return function(_0x101477){if(_0x101477){return _0x101477[_0x9a24('0x21')](_0x69d2e9)[_0x9a24('0x22')](function(_0x390c66){return _0x390c66;});}return null;};}function removeEntity(_0x159f65,_0x5ace5c){return function(_0x1ea7e7){if(_0x1ea7e7){return _0x1ea7e7[_0x9a24('0x23')]()[_0x9a24('0x22')](function(){var _0x5e8c24=_0x1ea7e7[_0x9a24('0x24')]({'plain':!![]});var _0x5b2469=_0x9a24('0x25');return db[_0x9a24('0x26')][_0x9a24('0x23')]({'where':{'type':_0x5b2469,'resourceId':_0x5e8c24['id']}})['then'](function(){return _0x1ea7e7;});})[_0x9a24('0x22')](function(){_0x159f65[_0x9a24('0x18')](0xcc)[_0x9a24('0x17')]();});}};}function handleEntityNotFound(_0x4c6d7f,_0x350276){return function(_0x5e0d10){if(!_0x5e0d10){_0x4c6d7f[_0x9a24('0x16')](0x194);}return _0x5e0d10;};}function handleError(_0x564030,_0x457c9b){_0x457c9b=_0x457c9b||0x1f4;return function(_0x2fa061){logger[_0x9a24('0x27')](_0x2fa061[_0x9a24('0x28')]);if(_0x2fa061[_0x9a24('0x29')]){delete _0x2fa061['name'];}_0x564030['status'](_0x457c9b)[_0x9a24('0x2a')](_0x2fa061);};}exports[_0x9a24('0x2b')]=function(_0xf6b084,_0x1bd06c){var _0x27b5fb={},_0x34d053={},_0x1fe151={'count':0x0,'rows':[]};var _0x26e7c3=_[_0x9a24('0x2c')](db[_0x9a24('0x2d')][_0x9a24('0x2e')],function(_0xab849f){return{'name':_0xab849f['fieldName'],'type':_0xab849f[_0x9a24('0x2f')][_0x9a24('0x30')]};});_0x34d053[_0x9a24('0x31')]=_['map'](_0x26e7c3,'name');_0x34d053[_0x9a24('0x32')]=_[_0x9a24('0x33')](_0xf6b084[_0x9a24('0x32')]);_0x34d053[_0x9a24('0x34')]=_[_0x9a24('0x35')](_0x34d053['model'],_0x34d053[_0x9a24('0x32')]);_0x27b5fb[_0x9a24('0x36')]=_[_0x9a24('0x35')](_0x34d053[_0x9a24('0x31')],qs[_0x9a24('0x37')](_0xf6b084[_0x9a24('0x32')][_0x9a24('0x37')]));_0x27b5fb[_0x9a24('0x36')]=_0x27b5fb[_0x9a24('0x36')][_0x9a24('0x38')]?_0x27b5fb[_0x9a24('0x36')]:_0x34d053[_0x9a24('0x31')];if(!_0xf6b084['query'][_0x9a24('0x39')](_0x9a24('0x3a'))){_0x27b5fb[_0x9a24('0x1a')]=qs[_0x9a24('0x1a')](_0xf6b084[_0x9a24('0x32')][_0x9a24('0x1a')]);_0x27b5fb[_0x9a24('0x1c')]=qs[_0x9a24('0x1c')](_0xf6b084['query'][_0x9a24('0x1c')]);}_0x27b5fb[_0x9a24('0x3b')]=qs['sort'](_0xf6b084['query']['sort']);_0x27b5fb['where']=qs['filters'](_['pick'](_0xf6b084[_0x9a24('0x32')],_0x34d053['filters']),_0x26e7c3);if(_0xf6b084['query'][_0x9a24('0x3c')]){_0x27b5fb['where']=_[_0x9a24('0x3d')](_0x27b5fb[_0x9a24('0x3e')],{'$or':_[_0x9a24('0x2c')](_0x26e7c3,function(_0x5af9b3){if(_0x5af9b3['type']!==_0x9a24('0x3f')){var _0x3695eb={};_0x3695eb[_0x5af9b3[_0x9a24('0x29')]]={'$like':'%'+_0xf6b084[_0x9a24('0x32')][_0x9a24('0x3c')]+'%'};return _0x3695eb;}})});}_0x27b5fb=_[_0x9a24('0x3d')]({},_0x27b5fb,_0xf6b084['options']);var _0xe964c5={'where':_0x27b5fb[_0x9a24('0x3e')]};return db['Campaign'][_0x9a24('0x1b')](_0xe964c5)[_0x9a24('0x22')](function(_0x4d94f2){_0x1fe151[_0x9a24('0x1b')]=_0x4d94f2;if(_0xf6b084[_0x9a24('0x32')][_0x9a24('0x40')]){_0x27b5fb[_0x9a24('0x41')]=[{'all':!![]}];}return db['Campaign'][_0x9a24('0x42')](_0x27b5fb);})[_0x9a24('0x22')](function(_0x6689c1){_0x1fe151[_0x9a24('0x43')]=_0x6689c1;return _0x1fe151;})['then'](respondWithFilteredResult(_0x1bd06c,_0x27b5fb))[_0x9a24('0x44')](handleError(_0x1bd06c,null));};exports[_0x9a24('0x45')]=function(_0x360a23,_0x390391){var _0x40b480={'raw':![],'where':{'id':_0x360a23[_0x9a24('0x46')]['id']}},_0x5d8e69={};_0x5d8e69['model']=_[_0x9a24('0x33')](db['Campaign'][_0x9a24('0x2e')]);_0x5d8e69[_0x9a24('0x32')]=_[_0x9a24('0x33')](_0x360a23[_0x9a24('0x32')]);_0x5d8e69[_0x9a24('0x34')]=_[_0x9a24('0x35')](_0x5d8e69[_0x9a24('0x31')],_0x5d8e69[_0x9a24('0x32')]);_0x40b480['attributes']=_[_0x9a24('0x35')](_0x5d8e69[_0x9a24('0x31')],qs[_0x9a24('0x37')](_0x360a23['query'][_0x9a24('0x37')]));_0x40b480[_0x9a24('0x36')]=_0x40b480['attributes'][_0x9a24('0x38')]?_0x40b480[_0x9a24('0x36')]:_0x5d8e69[_0x9a24('0x31')];if(_0x360a23[_0x9a24('0x32')]['includeAll']){_0x40b480[_0x9a24('0x41')]=[{'all':!![]}];}_0x40b480=_[_0x9a24('0x3d')]({},_0x40b480,_0x360a23[_0x9a24('0x47')]);return db[_0x9a24('0x2d')][_0x9a24('0x48')](_0x40b480)['then'](handleEntityNotFound(_0x390391,null))['then'](respondWithResult(_0x390391,null))[_0x9a24('0x44')](handleError(_0x390391,null));};exports[_0x9a24('0x49')]=function(_0x107232,_0x107254){return db[_0x9a24('0x2d')]['create'](_0x107232[_0x9a24('0x4a')],{})[_0x9a24('0x22')](function(_0x58da5c){var _0xaaecd9=_0x107232['user'][_0x9a24('0x24')]({'plain':!![]});if(!_0xaaecd9)throw new Error(_0x9a24('0x4b'));if(_0xaaecd9[_0x9a24('0x4c')]==='user'){var _0x2328c3=_0x58da5c[_0x9a24('0x24')]({'plain':!![]});var _0x332ef8=_0x9a24('0x25');return db[_0x9a24('0x4d')][_0x9a24('0x48')]({'where':{'name':_0x332ef8,'userProfileId':_0xaaecd9[_0x9a24('0x4e')]},'raw':!![]})[_0x9a24('0x22')](function(_0x5d0f2a){if(_0x5d0f2a&&_0x5d0f2a[_0x9a24('0x4f')]===0x0){return db['UserProfileResource'][_0x9a24('0x49')]({'name':_0x2328c3[_0x9a24('0x29')],'resourceId':_0x2328c3['id'],'type':_0x5d0f2a[_0x9a24('0x29')],'sectionId':_0x5d0f2a['id']},{})[_0x9a24('0x22')](function(){return _0x58da5c;});}else{return _0x58da5c;}})[_0x9a24('0x44')](function(_0x5ce00b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ce00b);throw _0x5ce00b;});}return _0x58da5c;})[_0x9a24('0x22')](respondWithResult(_0x107254,0xc9))[_0x9a24('0x44')](handleError(_0x107254,null));};exports[_0x9a24('0x50')]=function(_0x2dc6e3,_0x5eca2d){var _0x31b843={'where':{'id':_0x2dc6e3[_0x9a24('0x46')]['id']}},_0x4f33e3={};_0x4f33e3['model']=_[_0x9a24('0x33')](db['Campaign'][_0x9a24('0x2e')]);_0x31b843[_0x9a24('0x36')]=_['intersection'](_0x4f33e3[_0x9a24('0x31')],qs[_0x9a24('0x37')](_0x2dc6e3[_0x9a24('0x32')][_0x9a24('0x37')]));_0x31b843[_0x9a24('0x36')]=_0x31b843[_0x9a24('0x36')]['length']?_0x31b843[_0x9a24('0x36')]:_0x4f33e3[_0x9a24('0x31')];if(_0x2dc6e3[_0x9a24('0x32')][_0x9a24('0x40')]){_0x31b843['include']=[{'all':!![]}];}_0x31b843=_[_0x9a24('0x3d')]({},_0x31b843,_0x2dc6e3[_0x9a24('0x47')]);return db[_0x9a24('0x2d')][_0x9a24('0x48')](_0x31b843)[_0x9a24('0x22')](handleEntityNotFound(_0x5eca2d,null))[_0x9a24('0x22')](function(_0x4cd161){if(_0x4cd161){var _0x310574=_0x4cd161[_0x9a24('0x24')]({'plain':!![]});_0x310574=qs[_0x9a24('0x51')](_0x310574,['id','createdAt',_0x9a24('0x52')]);_0x2dc6e3[_0x9a24('0x4a')]=_[_0x9a24('0x51')](_0x2dc6e3[_0x9a24('0x4a')],['id',_0x9a24('0x53'),_0x9a24('0x52')]);return db['Campaign']['create'](_[_0x9a24('0x3d')](_0x310574,_0x2dc6e3[_0x9a24('0x4a')]),{'include':_0x2dc6e3[_0x9a24('0x32')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x396228){var _0x1bbdde=_0x2dc6e3[_0x9a24('0x54')]['get']({'plain':!![]});if(!_0x1bbdde)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1bbdde[_0x9a24('0x4c')]===_0x9a24('0x54')){var _0x4cf532=_0x396228['get']({'plain':!![]});var _0x7d3e6b=_0x9a24('0x25');return db[_0x9a24('0x4d')]['find']({'where':{'name':_0x7d3e6b,'userProfileId':_0x1bbdde[_0x9a24('0x4e')]},'raw':!![]})[_0x9a24('0x22')](function(_0x512751){if(_0x512751&&_0x512751['autoAssociation']===0x0){return db[_0x9a24('0x26')]['create']({'name':_0x4cf532[_0x9a24('0x29')],'resourceId':_0x4cf532['id'],'type':_0x512751[_0x9a24('0x29')],'sectionId':_0x512751['id']},{})[_0x9a24('0x22')](function(){return _0x396228;});}else{return _0x396228;}})[_0x9a24('0x44')](function(_0x33934f){logger[_0x9a24('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33934f);throw _0x33934f;});}return _0x396228;});}})[_0x9a24('0x22')](respondWithResult(_0x5eca2d,0xc9))[_0x9a24('0x44')](handleError(_0x5eca2d,null));};exports[_0x9a24('0x21')]=function(_0x2fc00b,_0x4bc395){if(_0x2fc00b[_0x9a24('0x4a')]['id']){delete _0x2fc00b['body']['id'];}return db['Campaign'][_0x9a24('0x48')]({'where':{'id':_0x2fc00b[_0x9a24('0x46')]['id']}})['then'](handleEntityNotFound(_0x4bc395,null))['then'](saveUpdates(_0x2fc00b['body'],null))['then'](respondWithResult(_0x4bc395,null))[_0x9a24('0x44')](handleError(_0x4bc395,null));};exports[_0x9a24('0x23')]=function(_0x16fa6e,_0x5c834f){return db[_0x9a24('0x2d')][_0x9a24('0x48')]({'where':{'id':_0x16fa6e['params']['id']}})[_0x9a24('0x22')](handleEntityNotFound(_0x5c834f,null))[_0x9a24('0x22')](removeEntity(_0x5c834f,null))[_0x9a24('0x44')](handleError(_0x5c834f,null));};exports['getHoppers']=function(_0x5e8f71,_0x32fd4e,_0x105a01){var _0x535319={'raw':!![],'where':{}};var _0x4d7ee7={};var _0x908b2c={'count':0x0,'rows':[]};return db[_0x9a24('0x2d')][_0x9a24('0x55')]({'where':{'id':_0x5e8f71[_0x9a24('0x46')]['id']}})[_0x9a24('0x22')](handleEntityNotFound(_0x32fd4e,null))[_0x9a24('0x22')](function(_0x50dbd3){if(_0x50dbd3){_0x4d7ee7['model']=_[_0x9a24('0x33')](db[_0x9a24('0x56')][_0x9a24('0x2e')]);_0x4d7ee7[_0x9a24('0x32')]=_[_0x9a24('0x33')](_0x5e8f71[_0x9a24('0x32')]);_0x4d7ee7['filters']=_[_0x9a24('0x35')](_0x4d7ee7[_0x9a24('0x31')],_0x4d7ee7['query']);_0x535319[_0x9a24('0x36')]=_[_0x9a24('0x35')](_0x4d7ee7['model'],qs[_0x9a24('0x37')](_0x5e8f71['query'][_0x9a24('0x37')]));_0x535319[_0x9a24('0x36')]=_0x535319['attributes'][_0x9a24('0x38')]?_0x535319[_0x9a24('0x36')]:_0x4d7ee7[_0x9a24('0x31')];if(!_0x5e8f71[_0x9a24('0x32')][_0x9a24('0x39')](_0x9a24('0x3a'))){_0x535319[_0x9a24('0x1a')]=qs['limit'](_0x5e8f71['query'][_0x9a24('0x1a')]);_0x535319[_0x9a24('0x1c')]=qs[_0x9a24('0x1c')](_0x5e8f71[_0x9a24('0x32')][_0x9a24('0x1c')]);}_0x535319[_0x9a24('0x3b')]=qs[_0x9a24('0x57')](_0x5e8f71['query'][_0x9a24('0x57')]);_0x535319[_0x9a24('0x3e')]=qs[_0x9a24('0x34')](_[_0x9a24('0x58')](_0x5e8f71[_0x9a24('0x32')],_0x4d7ee7[_0x9a24('0x34')]));_0x535319[_0x9a24('0x3e')]['CampaignId']=_0x50dbd3['id'];if(_0x5e8f71['query'][_0x9a24('0x3c')]){_0x535319[_0x9a24('0x3e')]=_[_0x9a24('0x3d')](_0x535319[_0x9a24('0x3e')],{'$or':_[_0x9a24('0x2c')](_0x535319[_0x9a24('0x36')],function(_0x17e62a){var _0xd31ed7={};_0xd31ed7[_0x17e62a]={'$like':'%'+_0x5e8f71[_0x9a24('0x32')][_0x9a24('0x3c')]+'%'};return _0xd31ed7;})});}_0x535319=_[_0x9a24('0x3d')]({},_0x535319,_0x5e8f71['options']);return db[_0x9a24('0x56')][_0x9a24('0x1b')]({'where':_0x535319[_0x9a24('0x3e')]})[_0x9a24('0x22')](function(_0x1012b4){_0x908b2c[_0x9a24('0x1b')]=_0x1012b4;if(_0x5e8f71['query'][_0x9a24('0x40')]){_0x535319[_0x9a24('0x41')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x535319);})[_0x9a24('0x22')](function(_0x294029){_0x908b2c[_0x9a24('0x43')]=_0x294029;return _0x908b2c;});}})[_0x9a24('0x22')](respondWithFilteredResult(_0x32fd4e,_0x535319))[_0x9a24('0x44')](handleError(_0x32fd4e,null));};exports[_0x9a24('0x59')]=function(_0x3515be,_0x1ad182,_0x205306){var _0x4df613={'raw':!![],'where':{}};var _0x2c7cb1={};var _0x2ab856={'count':0x0,'rows':[]};return db[_0x9a24('0x2d')]['findOne']({'where':{'id':_0x3515be[_0x9a24('0x46')]['id']}})[_0x9a24('0x22')](handleEntityNotFound(_0x1ad182,null))[_0x9a24('0x22')](function(_0xbbcb07){if(_0xbbcb07){_0x2c7cb1[_0x9a24('0x31')]=_[_0x9a24('0x33')](db['CmHopperHistory'][_0x9a24('0x2e')]);_0x2c7cb1[_0x9a24('0x32')]=_[_0x9a24('0x33')](_0x3515be[_0x9a24('0x32')]);_0x2c7cb1[_0x9a24('0x34')]=_['intersection'](_0x2c7cb1[_0x9a24('0x31')],_0x2c7cb1[_0x9a24('0x32')]);_0x4df613[_0x9a24('0x36')]=_['intersection'](_0x2c7cb1[_0x9a24('0x31')],qs[_0x9a24('0x37')](_0x3515be['query']['fields']));_0x4df613[_0x9a24('0x36')]=_0x4df613[_0x9a24('0x36')]['length']?_0x4df613[_0x9a24('0x36')]:_0x2c7cb1[_0x9a24('0x31')];if(!_0x3515be[_0x9a24('0x32')][_0x9a24('0x39')]('nolimit')){_0x4df613[_0x9a24('0x1a')]=qs[_0x9a24('0x1a')](_0x3515be[_0x9a24('0x32')][_0x9a24('0x1a')]);_0x4df613['offset']=qs[_0x9a24('0x1c')](_0x3515be[_0x9a24('0x32')][_0x9a24('0x1c')]);}_0x4df613[_0x9a24('0x3b')]=qs[_0x9a24('0x57')](_0x3515be[_0x9a24('0x32')][_0x9a24('0x57')]);_0x4df613[_0x9a24('0x3e')]=qs[_0x9a24('0x34')](_[_0x9a24('0x58')](_0x3515be[_0x9a24('0x32')],_0x2c7cb1[_0x9a24('0x34')]));_0x4df613[_0x9a24('0x3e')][_0x9a24('0x5a')]=_0xbbcb07['id'];if(_0x3515be[_0x9a24('0x32')][_0x9a24('0x3c')]){_0x4df613[_0x9a24('0x3e')]=_[_0x9a24('0x3d')](_0x4df613[_0x9a24('0x3e')],{'$or':_[_0x9a24('0x2c')](_0x4df613[_0x9a24('0x36')],function(_0x495e82){var _0x413be6={};_0x413be6[_0x495e82]={'$like':'%'+_0x3515be[_0x9a24('0x32')][_0x9a24('0x3c')]+'%'};return _0x413be6;})});}_0x4df613=_[_0x9a24('0x3d')]({},_0x4df613,_0x3515be[_0x9a24('0x47')]);return db['CmHopperHistory'][_0x9a24('0x1b')]({'where':_0x4df613[_0x9a24('0x3e')]})[_0x9a24('0x22')](function(_0x31efa9){_0x2ab856[_0x9a24('0x1b')]=_0x31efa9;if(_0x3515be[_0x9a24('0x32')][_0x9a24('0x40')]){_0x4df613[_0x9a24('0x41')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x9a24('0x42')](_0x4df613);})['then'](function(_0x43d4d3){_0x2ab856[_0x9a24('0x43')]=_0x43d4d3;return _0x2ab856;});}})[_0x9a24('0x22')](respondWithFilteredResult(_0x1ad182,_0x4df613))[_0x9a24('0x44')](handleError(_0x1ad182,null));};exports[_0x9a24('0x5b')]=function(_0x3d6b22,_0x195276,_0x37f0d3){var _0x4428fe={'raw':!![],'where':{}};var _0x4cc2db={};var _0x1061cc={'count':0x0,'rows':[]};return db[_0x9a24('0x2d')][_0x9a24('0x55')]({'where':{'id':_0x3d6b22[_0x9a24('0x46')]['id']}})[_0x9a24('0x22')](handleEntityNotFound(_0x195276,null))[_0x9a24('0x22')](function(_0x2ed0cc){if(_0x2ed0cc){_0x4cc2db[_0x9a24('0x31')]=_[_0x9a24('0x33')](db[_0x9a24('0x5c')]['rawAttributes']);_0x4cc2db['query']=_[_0x9a24('0x33')](_0x3d6b22['query']);_0x4cc2db[_0x9a24('0x34')]=_[_0x9a24('0x35')](_0x4cc2db[_0x9a24('0x31')],_0x4cc2db['query']);_0x4428fe[_0x9a24('0x36')]=_[_0x9a24('0x35')](_0x4cc2db[_0x9a24('0x31')],qs[_0x9a24('0x37')](_0x3d6b22[_0x9a24('0x32')][_0x9a24('0x37')]));_0x4428fe[_0x9a24('0x36')]=_0x4428fe[_0x9a24('0x36')]['length']?_0x4428fe[_0x9a24('0x36')]:_0x4cc2db['model'];if(!_0x3d6b22[_0x9a24('0x32')][_0x9a24('0x39')](_0x9a24('0x3a'))){_0x4428fe[_0x9a24('0x1a')]=qs[_0x9a24('0x1a')](_0x3d6b22[_0x9a24('0x32')][_0x9a24('0x1a')]);_0x4428fe[_0x9a24('0x1c')]=qs[_0x9a24('0x1c')](_0x3d6b22[_0x9a24('0x32')][_0x9a24('0x1c')]);}_0x4428fe['order']=qs[_0x9a24('0x57')](_0x3d6b22[_0x9a24('0x32')]['sort']);_0x4428fe[_0x9a24('0x3e')]=qs[_0x9a24('0x34')](_[_0x9a24('0x58')](_0x3d6b22[_0x9a24('0x32')],_0x4cc2db[_0x9a24('0x34')]));_0x4428fe['where'][_0x9a24('0x5a')]=_0x2ed0cc['id'];if(_0x3d6b22['query'][_0x9a24('0x3c')]){_0x4428fe[_0x9a24('0x3e')]=_[_0x9a24('0x3d')](_0x4428fe[_0x9a24('0x3e')],{'$or':_[_0x9a24('0x2c')](_0x4428fe[_0x9a24('0x36')],function(_0x1334c6){var _0x4f586e={};_0x4f586e[_0x1334c6]={'$like':'%'+_0x3d6b22[_0x9a24('0x32')][_0x9a24('0x3c')]+'%'};return _0x4f586e;})});}_0x4428fe=_[_0x9a24('0x3d')]({},_0x4428fe,_0x3d6b22[_0x9a24('0x47')]);return db['CmHopperFinal']['count']({'where':_0x4428fe[_0x9a24('0x3e')]})[_0x9a24('0x22')](function(_0x49d96e){_0x1061cc[_0x9a24('0x1b')]=_0x49d96e;if(_0x3d6b22[_0x9a24('0x32')][_0x9a24('0x40')]){_0x4428fe[_0x9a24('0x41')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x9a24('0x42')](_0x4428fe);})[_0x9a24('0x22')](function(_0x12694a){_0x1061cc[_0x9a24('0x43')]=_0x12694a;return _0x1061cc;});}})['then'](respondWithFilteredResult(_0x195276,_0x4428fe))[_0x9a24('0x44')](handleError(_0x195276,null));};exports['getHopperBlacks']=function(_0x215fea,_0x3cefd6,_0x3ae878){var _0x39e70e={'raw':!![],'where':{}};var _0x2c31fd={};var _0x3cec8a={'count':0x0,'rows':[]};return db[_0x9a24('0x2d')][_0x9a24('0x55')]({'where':{'id':_0x215fea['params']['id']}})['then'](handleEntityNotFound(_0x3cefd6,null))[_0x9a24('0x22')](function(_0x99271c){if(_0x99271c){_0x2c31fd[_0x9a24('0x31')]=_[_0x9a24('0x33')](db[_0x9a24('0x5d')][_0x9a24('0x2e')]);_0x2c31fd[_0x9a24('0x32')]=_[_0x9a24('0x33')](_0x215fea[_0x9a24('0x32')]);_0x2c31fd[_0x9a24('0x34')]=_[_0x9a24('0x35')](_0x2c31fd[_0x9a24('0x31')],_0x2c31fd['query']);_0x39e70e[_0x9a24('0x36')]=_[_0x9a24('0x35')](_0x2c31fd['model'],qs[_0x9a24('0x37')](_0x215fea[_0x9a24('0x32')][_0x9a24('0x37')]));_0x39e70e[_0x9a24('0x36')]=_0x39e70e['attributes'][_0x9a24('0x38')]?_0x39e70e[_0x9a24('0x36')]:_0x2c31fd['model'];if(!_0x215fea[_0x9a24('0x32')]['hasOwnProperty'](_0x9a24('0x3a'))){_0x39e70e[_0x9a24('0x1a')]=qs[_0x9a24('0x1a')](_0x215fea[_0x9a24('0x32')][_0x9a24('0x1a')]);_0x39e70e[_0x9a24('0x1c')]=qs[_0x9a24('0x1c')](_0x215fea['query']['offset']);}_0x39e70e['order']=qs[_0x9a24('0x57')](_0x215fea[_0x9a24('0x32')][_0x9a24('0x57')]);_0x39e70e[_0x9a24('0x3e')]=qs[_0x9a24('0x34')](_[_0x9a24('0x58')](_0x215fea[_0x9a24('0x32')],_0x2c31fd[_0x9a24('0x34')]));_0x39e70e[_0x9a24('0x3e')][_0x9a24('0x5a')]=_0x99271c['id'];if(_0x215fea[_0x9a24('0x32')][_0x9a24('0x3c')]){_0x39e70e['where']=_['merge'](_0x39e70e[_0x9a24('0x3e')],{'$or':_[_0x9a24('0x2c')](_0x39e70e[_0x9a24('0x36')],function(_0x1b3ab1){var _0x32abba={};_0x32abba[_0x1b3ab1]={'$like':'%'+_0x215fea[_0x9a24('0x32')][_0x9a24('0x3c')]+'%'};return _0x32abba;})});}_0x39e70e=_[_0x9a24('0x3d')]({},_0x39e70e,_0x215fea['options']);return db[_0x9a24('0x5d')][_0x9a24('0x1b')]({'where':_0x39e70e[_0x9a24('0x3e')]})['then'](function(_0x34362f){_0x3cec8a[_0x9a24('0x1b')]=_0x34362f;if(_0x215fea[_0x9a24('0x32')]['includeAll']){_0x39e70e[_0x9a24('0x41')]=[{'all':!![]}];}return db[_0x9a24('0x5d')]['findAll'](_0x39e70e);})[_0x9a24('0x22')](function(_0x5a0d1d){_0x3cec8a[_0x9a24('0x43')]=_0x5a0d1d;return _0x3cec8a;});}})[_0x9a24('0x22')](respondWithFilteredResult(_0x3cefd6,_0x39e70e))['catch'](handleError(_0x3cefd6,null));};exports[_0x9a24('0x5e')]=function(_0x47deba,_0x2ee974,_0x2ab48b){var _0x4266ef={};var _0x6274cb={};var _0x24b278;var _0x4831bc;return db[_0x9a24('0x2d')][_0x9a24('0x55')]({'where':{'id':_0x47deba[_0x9a24('0x46')]['id']}})[_0x9a24('0x22')](handleEntityNotFound(_0x2ee974,null))[_0x9a24('0x22')](function(_0x5057dc){if(_0x5057dc){_0x24b278=_0x5057dc;_0x6274cb[_0x9a24('0x31')]=_[_0x9a24('0x33')](db[_0x9a24('0x5f')][_0x9a24('0x2e')]);_0x6274cb[_0x9a24('0x32')]=_[_0x9a24('0x33')](_0x47deba[_0x9a24('0x32')]);_0x6274cb[_0x9a24('0x34')]=_[_0x9a24('0x35')](_0x6274cb['model'],_0x6274cb[_0x9a24('0x32')]);_0x4266ef[_0x9a24('0x36')]=_[_0x9a24('0x35')](_0x6274cb[_0x9a24('0x31')],qs[_0x9a24('0x37')](_0x47deba['query'][_0x9a24('0x37')]));_0x4266ef[_0x9a24('0x36')]=_0x4266ef[_0x9a24('0x36')]['length']?_0x4266ef[_0x9a24('0x36')]:_0x6274cb[_0x9a24('0x31')];_0x4266ef[_0x9a24('0x3b')]=qs['sort'](_0x47deba[_0x9a24('0x32')][_0x9a24('0x57')]);_0x4266ef['where']=qs['filters'](_[_0x9a24('0x58')](_0x47deba[_0x9a24('0x32')],_0x6274cb[_0x9a24('0x34')]));if(_0x47deba['query'][_0x9a24('0x3c')]){_0x4266ef[_0x9a24('0x3e')]=_['merge'](_0x4266ef[_0x9a24('0x3e')],{'$or':_[_0x9a24('0x2c')](_0x4266ef[_0x9a24('0x36')],function(_0x1b5d66){var _0x38e634={};_0x38e634[_0x1b5d66]={'$like':'%'+_0x47deba['query'][_0x9a24('0x3c')]+'%'};return _0x38e634;})});}_0x4266ef=_[_0x9a24('0x3d')]({},_0x4266ef,_0x47deba[_0x9a24('0x47')]);return _0x24b278[_0x9a24('0x5e')](_0x4266ef);}})[_0x9a24('0x22')](function(_0x23fdc6){if(_0x23fdc6){_0x4831bc=_0x23fdc6['length'];if(!_0x47deba[_0x9a24('0x32')]['hasOwnProperty'](_0x9a24('0x3a'))){_0x4266ef[_0x9a24('0x1a')]=qs[_0x9a24('0x1a')](_0x47deba[_0x9a24('0x32')]['limit']);_0x4266ef[_0x9a24('0x1c')]=qs[_0x9a24('0x1c')](_0x47deba[_0x9a24('0x32')]['offset']);}return _0x24b278['getLists'](_0x4266ef);}})[_0x9a24('0x22')](function(_0x19f7a9){if(_0x19f7a9){return _0x19f7a9?{'count':_0x4831bc,'rows':_0x19f7a9}:null;}})[_0x9a24('0x22')](respondWithResult(_0x2ee974,null))[_0x9a24('0x44')](handleError(_0x2ee974,null));};exports['addLists']=function(_0xb10d,_0x5d1f90,_0x2515d9){var _0x75249f,_0x12b3ff;var _0x55d4eb=[];var _0x4dc9c1=moment()[_0x9a24('0x60')](_0x9a24('0x61'));return db[_0x9a24('0x2d')][_0x9a24('0x48')]({'where':{'id':_0xb10d['params']['id']}})[_0x9a24('0x22')](handleEntityNotFound(_0x5d1f90,null))[_0x9a24('0x22')](function(_0x3a8349){if(_0x3a8349){_0x12b3ff=_0x3a8349;return _0x3a8349[_0x9a24('0x62')](_0xb10d[_0x9a24('0x4a')][_0x9a24('0x63')],_['omit'](_0xb10d[_0x9a24('0x4a')],[_0x9a24('0x63'),'id'])||{});}return null;})['spread'](function(_0x31dd79){var _0x47142e;var _0x44b0a5;_0x75249f=_0x31dd79||[];var _0xbd051b=[];if(_0x31dd79){for(var _0x26c9eb=0x0;_0x26c9eb<_0x31dd79['length'];_0x26c9eb+=0x1){var _0x3dfaeb=_0x31dd79[_0x26c9eb][_0x9a24('0x24')]({'plain':!![]});_0x12b3ff['dialCheckDuplicateType']=_0xb10d[_0x9a24('0x4a')][_0x9a24('0x64')]?_0xb10d[_0x9a24('0x4a')][_0x9a24('0x64')]:_0x12b3ff[_0x9a24('0x64')];switch(_0x12b3ff[_0x9a24('0x64')]){case _0x9a24('0x65'):_0x47142e=squel['insert']()[_0x9a24('0x66')](_0x9a24('0x67'))['fromQuery']([_0x9a24('0x68'),_0x9a24('0x69'),'ContactId',_0x9a24('0x6a'),_0x9a24('0x5a'),_0x9a24('0x53'),_0x9a24('0x52')],squel[_0x9a24('0x6b')]()[_0x9a24('0x6c')](_0x9a24('0x68'),'phone')['field'](_0x9a24('0x6d'),'scheduledAt')['field']('id',_0x9a24('0x6e'))[_0x9a24('0x6c')](_0x3dfaeb['CmListId'][_0x9a24('0x6f')](),_0x9a24('0x6a'))[_0x9a24('0x6c')](_0xb10d[_0x9a24('0x46')]['id'][_0x9a24('0x6f')](),_0x9a24('0x5a'))['field']('\x27'+_0x4dc9c1+'\x27',_0x9a24('0x53'))[_0x9a24('0x6c')]('\x27'+_0x4dc9c1+'\x27',_0x9a24('0x52'))['from'](_0x9a24('0x70'))[_0x9a24('0x3e')](_0x9a24('0x71'))[_0x9a24('0x3e')](_0x9a24('0x72'),_0x3dfaeb['CmListId'][_0x9a24('0x6f')]())[_0x9a24('0x3e')](_0x9a24('0x73'))[_0x9a24('0x3e')](_0x9a24('0x74'),squel[_0x9a24('0x6b')]()[_0x9a24('0x6c')](_0x9a24('0x75'))['from'](_0x9a24('0x76'))['where'](_0x9a24('0x77'),_0xb10d[_0x9a24('0x46')]['id'][_0x9a24('0x6f')]()))['where'](_0x9a24('0x74'),squel[_0x9a24('0x6b')]()[_0x9a24('0x6c')](_0x9a24('0x78'))[_0x9a24('0x79')](_0x9a24('0x67'))[_0x9a24('0x3e')](_0x9a24('0x77'),_0xb10d[_0x9a24('0x46')]['id']['toString']())))[_0x9a24('0x6f')]();break;case _0x9a24('0x7a'):_0x47142e=squel[_0x9a24('0x7b')]()[_0x9a24('0x66')]('cm_hopper')[_0x9a24('0x7c')]([_0x9a24('0x68'),'scheduledAt','ContactId',_0x9a24('0x6a'),_0x9a24('0x5a'),_0x9a24('0x53'),_0x9a24('0x52')],squel[_0x9a24('0x6b')]()[_0x9a24('0x6c')](_0x9a24('0x68'),_0x9a24('0x68'))[_0x9a24('0x6c')](_0x9a24('0x6d'),_0x9a24('0x69'))[_0x9a24('0x6c')]('id','ContactId')[_0x9a24('0x6c')](_0x3dfaeb[_0x9a24('0x7d')][_0x9a24('0x6f')](),_0x9a24('0x6a'))[_0x9a24('0x6c')](_0xb10d[_0x9a24('0x46')]['id'][_0x9a24('0x6f')](),_0x9a24('0x5a'))[_0x9a24('0x6c')]('\x27'+_0x4dc9c1+'\x27',_0x9a24('0x53'))['field']('\x27'+_0x4dc9c1+'\x27',_0x9a24('0x52'))[_0x9a24('0x79')](_0x9a24('0x70'))[_0x9a24('0x3e')](_0x9a24('0x71'))[_0x9a24('0x3e')](_0x9a24('0x72'),_0x3dfaeb[_0x9a24('0x7d')]['toString']())[_0x9a24('0x3e')](_0x9a24('0x73'))[_0x9a24('0x3e')](_0x9a24('0x74'),squel['select']()[_0x9a24('0x6c')](_0x9a24('0x78'))[_0x9a24('0x79')]('cm_hopper')[_0x9a24('0x3e')](_0x9a24('0x77'),_0xb10d[_0x9a24('0x46')]['id'][_0x9a24('0x6f')]())))[_0x9a24('0x6f')]();break;default:_0x47142e=squel[_0x9a24('0x7b')]()[_0x9a24('0x66')](_0x9a24('0x67'))[_0x9a24('0x7c')](['phone',_0x9a24('0x69'),_0x9a24('0x6e'),_0x9a24('0x6a'),'CampaignId',_0x9a24('0x53'),_0x9a24('0x52')],squel[_0x9a24('0x6b')]()['field'](_0x9a24('0x68'),_0x9a24('0x68'))['field'](_0x9a24('0x6d'),_0x9a24('0x69'))[_0x9a24('0x6c')]('id','ContactId')[_0x9a24('0x6c')](_0x3dfaeb[_0x9a24('0x7d')]['toString'](),'ListId')['field'](_0xb10d[_0x9a24('0x46')]['id'][_0x9a24('0x6f')](),'CampaignId')['field']('\x27'+_0x4dc9c1+'\x27','createdAt')[_0x9a24('0x6c')]('\x27'+_0x4dc9c1+'\x27',_0x9a24('0x52'))['from'](_0x9a24('0x70'))[_0x9a24('0x3e')](_0x9a24('0x71'))[_0x9a24('0x3e')](_0x9a24('0x72'),_0x3dfaeb[_0x9a24('0x7d')][_0x9a24('0x6f')]())['where'](_0x9a24('0x73')))[_0x9a24('0x6f')]();}_0x44b0a5=squel[_0x9a24('0x7b')]()[_0x9a24('0x66')](_0x9a24('0x7e'))['fromQuery']([_0x9a24('0x7f'),_0x9a24('0x69'),_0x9a24('0x68'),_0x9a24('0x80'),_0x9a24('0x53'),'updatedAt'],squel[_0x9a24('0x6b')]()['field'](_0x9a24('0x81'),'id')[_0x9a24('0x6c')](_0x9a24('0x6d'),_0x9a24('0x69'))[_0x9a24('0x6c')](_0x9a24('0x82'),_0x9a24('0x68'))['field'](_0x9a24('0x83'),_0x9a24('0x80'))[_0x9a24('0x6c')]('\x27'+_0x4dc9c1+'\x27',_0x9a24('0x53'))[_0x9a24('0x6c')]('\x27'+_0x4dc9c1+'\x27',_0x9a24('0x52'))[_0x9a24('0x79')]('cm_contact_has_items','ci')[_0x9a24('0x84')]('cm_hopper','h','h.ContactId\x20=\x20ci.CmContactId')[_0x9a24('0x3e')](_0x9a24('0x85'),_0x3dfaeb['CmListId']['toString']())[_0x9a24('0x3e')]('h.CampaignId=?',_0xb10d[_0x9a24('0x46')]['id'][_0x9a24('0x6f')]())[_0x9a24('0x3e')]('h.createdAt\x20=\x20?',_0x4dc9c1))[_0x9a24('0x6f')]();_0xbd051b[_0x9a24('0x86')](db[_0x9a24('0x87')][_0x9a24('0x32')](_0x47142e));_0x55d4eb['push'](db['sequelize'][_0x9a24('0x32')](_0x44b0a5));}return BPromise[_0x9a24('0x88')](_0xbd051b);}})['then'](function(){return BPromise[_0x9a24('0x88')](_0x55d4eb);})[_0x9a24('0x22')](function(){return _0x75249f;})[_0x9a24('0x22')](respondWithResult(_0x5d1f90,null))[_0x9a24('0x44')](handleError(_0x5d1f90,null));};exports[_0x9a24('0x89')]=function(_0x51e966,_0x47373e,_0x332d7d){return db['Campaign']['find']({'where':{'id':_0x51e966['params']['id']}})[_0x9a24('0x22')](handleEntityNotFound(_0x47373e,null))[_0x9a24('0x22')](function(_0x755c02){if(_0x755c02){return _0x755c02[_0x9a24('0x89')](_0x51e966['query'][_0x9a24('0x63')]);}})[_0x9a24('0x22')](function(_0xf4ff27){if(_0xf4ff27){return db[_0x9a24('0x56')][_0x9a24('0x23')]({'where':{'ListId':_0x51e966[_0x9a24('0x32')][_0x9a24('0x63')],'CampaignId':_0x51e966[_0x9a24('0x46')]['id']}})[_0x9a24('0x22')](function(){return _0xf4ff27;});}})[_0x9a24('0x22')](respondWithStatusCode(_0x47373e,null))['catch'](handleError(_0x47373e,null));};exports[_0x9a24('0x8a')]=function(_0x4d4d95,_0x27f57a,_0x592c2e){var _0x1a09f1={};var _0xcd0a9d={};var _0x511904;var _0x14f46c;return db[_0x9a24('0x2d')][_0x9a24('0x55')]({'where':{'id':_0x4d4d95[_0x9a24('0x46')]['id']}})[_0x9a24('0x22')](handleEntityNotFound(_0x27f57a,null))[_0x9a24('0x22')](function(_0x1919b4){if(_0x1919b4){_0x511904=_0x1919b4;_0xcd0a9d[_0x9a24('0x31')]=_['keys'](db[_0x9a24('0x5f')][_0x9a24('0x2e')]);_0xcd0a9d['query']=_[_0x9a24('0x33')](_0x4d4d95[_0x9a24('0x32')]);_0xcd0a9d[_0x9a24('0x34')]=_['intersection'](_0xcd0a9d['model'],_0xcd0a9d['query']);_0x1a09f1[_0x9a24('0x36')]=_['intersection'](_0xcd0a9d[_0x9a24('0x31')],qs[_0x9a24('0x37')](_0x4d4d95['query']['fields']));_0x1a09f1[_0x9a24('0x36')]=_0x1a09f1[_0x9a24('0x36')]['length']?_0x1a09f1[_0x9a24('0x36')]:_0xcd0a9d[_0x9a24('0x31')];_0x1a09f1[_0x9a24('0x3b')]=qs[_0x9a24('0x57')](_0x4d4d95[_0x9a24('0x32')][_0x9a24('0x57')]);_0x1a09f1[_0x9a24('0x3e')]=qs['filters'](_[_0x9a24('0x58')](_0x4d4d95[_0x9a24('0x32')],_0xcd0a9d[_0x9a24('0x34')]));if(_0x4d4d95['query'][_0x9a24('0x3c')]){_0x1a09f1[_0x9a24('0x3e')]=_['merge'](_0x1a09f1[_0x9a24('0x3e')],{'$or':_[_0x9a24('0x2c')](_0x1a09f1[_0x9a24('0x36')],function(_0x4fe3c6){var _0x5eb669={};_0x5eb669[_0x4fe3c6]={'$like':'%'+_0x4d4d95[_0x9a24('0x32')]['filter']+'%'};return _0x5eb669;})});}_0x1a09f1=_[_0x9a24('0x3d')]({},_0x1a09f1,_0x4d4d95[_0x9a24('0x47')]);return _0x511904[_0x9a24('0x8a')](_0x1a09f1);}})[_0x9a24('0x22')](function(_0x94a4b4){if(_0x94a4b4){_0x14f46c=_0x94a4b4['length'];if(!_0x4d4d95[_0x9a24('0x32')][_0x9a24('0x39')](_0x9a24('0x3a'))){_0x1a09f1[_0x9a24('0x1a')]=qs[_0x9a24('0x1a')](_0x4d4d95[_0x9a24('0x32')]['limit']);_0x1a09f1['offset']=qs['offset'](_0x4d4d95[_0x9a24('0x32')][_0x9a24('0x1c')]);}return _0x511904['getBlackLists'](_0x1a09f1);}})['then'](function(_0x1df19d){if(_0x1df19d){return _0x1df19d?{'count':_0x14f46c,'rows':_0x1df19d}:null;}})['then'](respondWithResult(_0x27f57a,null))['catch'](handleError(_0x27f57a,null));};exports[_0x9a24('0x8b')]=function(_0x367a33,_0xb76f8c,_0x15b2bc){var _0x261e8e,_0x481c99;var _0xca1c3b=[];var _0x207b8a=moment()[_0x9a24('0x60')](_0x9a24('0x61'));return db[_0x9a24('0x2d')][_0x9a24('0x48')]({'where':{'id':_0x367a33[_0x9a24('0x46')]['id']}})[_0x9a24('0x22')](handleEntityNotFound(_0xb76f8c,null))[_0x9a24('0x22')](function(_0x102ddb){if(_0x102ddb){_0x481c99=_0x102ddb;return _0x102ddb[_0x9a24('0x8b')](_0x367a33['body'][_0x9a24('0x63')],_[_0x9a24('0x51')](_0x367a33[_0x9a24('0x4a')],[_0x9a24('0x63'),'id'])||{});}return null;})[_0x9a24('0x8c')](function(_0x3ca726){var _0xcca833;var _0x2e93a5;_0x261e8e=_0x3ca726||[];var _0x1446fd=[];if(_0x3ca726){for(var _0x43d418=0x0;_0x43d418<_0x3ca726[_0x9a24('0x38')];_0x43d418+=0x1){var _0x50be1d=_0x3ca726[_0x43d418][_0x9a24('0x24')]({'plain':!![]});_0xcca833=squel[_0x9a24('0x7b')]()['into'](_0x9a24('0x8d'))['fromQuery']([_0x9a24('0x68'),_0x9a24('0x6e'),_0x9a24('0x6a'),_0x9a24('0x5a'),_0x9a24('0x53'),_0x9a24('0x52')],squel['select']()['field'](_0x9a24('0x68'),_0x9a24('0x68'))[_0x9a24('0x6c')]('id',_0x9a24('0x6e'))[_0x9a24('0x6c')](_0x50be1d[_0x9a24('0x7d')][_0x9a24('0x6f')](),'ListId')[_0x9a24('0x6c')](_0x367a33['params']['id'][_0x9a24('0x6f')](),_0x9a24('0x5a'))[_0x9a24('0x6c')]('NOW()','createdAt')['field'](_0x9a24('0x6d'),_0x9a24('0x52'))['from'](_0x9a24('0x70'))[_0x9a24('0x3e')](_0x9a24('0x71'))[_0x9a24('0x3e')](_0x9a24('0x72'),_0x50be1d['CmListId'][_0x9a24('0x6f')]())[_0x9a24('0x3e')]('phone\x20IS\x20NOT\x20NULL'))[_0x9a24('0x6f')]();_0x1446fd[_0x9a24('0x86')](db['sequelize'][_0x9a24('0x32')](_0xcca833));}return BPromise[_0x9a24('0x88')](_0x1446fd);}})[_0x9a24('0x22')](function(){return _0x261e8e;})[_0x9a24('0x22')](respondWithResult(_0xb76f8c,null))[_0x9a24('0x44')](handleError(_0xb76f8c,null));};exports[_0x9a24('0x8e')]=function(_0x3da758,_0x55c1f1,_0x54e9aa){return db['Campaign']['find']({'where':{'id':_0x3da758[_0x9a24('0x46')]['id']}})[_0x9a24('0x22')](handleEntityNotFound(_0x55c1f1,null))['then'](function(_0x3cfe34){if(_0x3cfe34){return _0x3cfe34[_0x9a24('0x8e')](_0x3da758[_0x9a24('0x32')][_0x9a24('0x63')]);}})[_0x9a24('0x22')](function(_0x2a1135){if(_0x2a1135){return db[_0x9a24('0x5d')][_0x9a24('0x23')]({'where':{'ListId':_0x3da758['query'][_0x9a24('0x63')],'CampaignId':_0x3da758[_0x9a24('0x46')]['id']}})[_0x9a24('0x22')](function(){return _0x2a1135;});}})[_0x9a24('0x22')](respondWithStatusCode(_0x55c1f1,null))[_0x9a24('0x44')](handleError(_0x55c1f1,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index aab47d9..65aaace 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(_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 +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0xb2e670,_0x436e56){var _0x598b6b=function(_0x5ecdd8){while(--_0x5ecdd8){_0xb2e670['push'](_0xb2e670['shift']());}};_0x598b6b(++_0x436e56);}(_0x7a54,0x106));var _0x47a5=function(_0x435db1,_0x125741){_0x435db1=_0x435db1-0x0;var _0x15f756=_0x7a54[_0x435db1];return _0x15f756;};'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 ce6cbdd..c0c74e9 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 _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 +var _0x26bc=['message','result','catch','Campaign','findAll','options','raw','where','limit','include','model','map','attributes','GetCampaign','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x26bc,0x162));var _0xc26b=function(_0xaf1fb8,_0x2c04c6){_0xaf1fb8=_0xaf1fb8-0x0;var _0x325c52=_0x26bc[_0xaf1fb8];return _0x325c52;};'use strict';var _=require(_0xc26b('0x0'));var util=require(_0xc26b('0x1'));var moment=require(_0xc26b('0x2'));var BPromise=require(_0xc26b('0x3'));var rs=require(_0xc26b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc26b('0x5'))['db'];var utils=require(_0xc26b('0x6'));var logger=require(_0xc26b('0x7'))('rpc');var config=require(_0xc26b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc26b('0x9')][_0xc26b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13d90e,_0x5c2f6f,_0x11c6f5){return new BPromise(function(_0x453491,_0x465c89){return client[_0xc26b('0xb')](_0x13d90e,_0x11c6f5)[_0xc26b('0xc')](function(_0x1fb2b5){logger[_0xc26b('0xd')](_0xc26b('0xe'),_0x5c2f6f,_0xc26b('0xf'));logger[_0xc26b('0x10')]('Campaign,\x20%s,\x20%s,\x20%s',_0x5c2f6f,_0xc26b('0xf'),JSON[_0xc26b('0x11')](_0x1fb2b5));if(_0x1fb2b5[_0xc26b('0x12')]){if(_0x1fb2b5[_0xc26b('0x12')][_0xc26b('0x13')]===0x1f4){logger[_0xc26b('0x12')]('Campaign,\x20%s,\x20%s',_0x5c2f6f,_0x1fb2b5[_0xc26b('0x12')]['message']);return _0x465c89(_0x1fb2b5['error'][_0xc26b('0x14')]);}logger[_0xc26b('0x12')](_0xc26b('0xe'),_0x5c2f6f,_0x1fb2b5[_0xc26b('0x12')]['message']);return _0x453491(_0x1fb2b5[_0xc26b('0x12')][_0xc26b('0x14')]);}else{logger[_0xc26b('0xd')](_0xc26b('0xe'),_0x5c2f6f,_0xc26b('0xf'));_0x453491(_0x1fb2b5[_0xc26b('0x15')]['message']);}})[_0xc26b('0x16')](function(_0x2713f6){logger['error'](_0xc26b('0xe'),_0x5c2f6f,_0x2713f6);_0x465c89(_0x2713f6);});});}exports['GetCampaign']=function(_0x4802c7){var _0x7e6ed0=this;return new Promise(function(_0x47e75b,_0x47104f){return db[_0xc26b('0x17')][_0xc26b('0x18')]({'raw':_0x4802c7[_0xc26b('0x19')]?_0x4802c7['options'][_0xc26b('0x1a')]===undefined?!![]:![]:!![],'where':_0x4802c7[_0xc26b('0x19')]?_0x4802c7[_0xc26b('0x19')][_0xc26b('0x1b')]||null:null,'attributes':_0x4802c7[_0xc26b('0x19')]?_0x4802c7[_0xc26b('0x19')]['attributes']||null:null,'limit':_0x4802c7[_0xc26b('0x19')]?_0x4802c7['options'][_0xc26b('0x1c')]||null:null,'include':_0x4802c7[_0xc26b('0x19')]?_0x4802c7[_0xc26b('0x19')][_0xc26b('0x1d')]?_['map'](_0x4802c7[_0xc26b('0x19')][_0xc26b('0x1d')],function(_0x176f29){return{'model':db[_0x176f29[_0xc26b('0x1e')]],'as':_0x176f29['as'],'attributes':_0x176f29['attributes'],'include':_0x176f29[_0xc26b('0x1d')]?_[_0xc26b('0x1f')](_0x176f29['include'],function(_0x4c0095){return{'model':db[_0x4c0095[_0xc26b('0x1e')]],'as':_0x4c0095['as'],'attributes':_0x4c0095[_0xc26b('0x20')],'include':_0x4c0095[_0xc26b('0x1d')]?_[_0xc26b('0x1f')](_0x4c0095[_0xc26b('0x1d')],function(_0x20a84f){return{'model':db[_0x20a84f['model']],'as':_0x20a84f['as'],'attributes':_0x20a84f[_0xc26b('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e44e2){logger[_0xc26b('0xd')](_0xc26b('0x21'),_0x4802c7);logger['debug'](_0xc26b('0x21'),_0x4802c7,JSON[_0xc26b('0x11')](_0x3e44e2));_0x47e75b(_0x3e44e2);})[_0xc26b('0x16')](function(_0x1dd5d4){logger[_0xc26b('0x12')](_0xc26b('0x21'),_0x1dd5d4['message'],_0x4802c7);_0x47104f(_0x7e6ed0[_0xc26b('0x12')](0x1f4,_0x1dd5d4['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 662a43b..791f305 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 _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 +var _0xa39b=['index','get','/:id','show','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperBlacks','getLists','/:id/blacklists','post','create','/:id/clone','clone','addLists','addBlackLists','update','delete','/:id/lists','removeLists','removeBlackLists','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','isAuthenticated'];(function(_0x4503f6,_0x3babaf){var _0x2277d1=function(_0x1c005a){while(--_0x1c005a){_0x4503f6['push'](_0x4503f6['shift']());}};_0x2277d1(++_0x3babaf);}(_0xa39b,0xee));var _0xba39=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xa39b[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0xba39('0x0'));var util=require(_0xba39('0x1'));var path=require(_0xba39('0x2'));var timeout=require(_0xba39('0x3'));var express=require(_0xba39('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xba39('0x5'));var interaction=require(_0xba39('0x6'));var config=require(_0xba39('0x7'));var controller=require(_0xba39('0x8'));router['get']('/',auth[_0xba39('0x9')](),controller[_0xba39('0xa')]);router[_0xba39('0xb')](_0xba39('0xc'),auth['isAuthenticated'](),controller[_0xba39('0xd')]);router['get']('/:id/hoppers',auth[_0xba39('0x9')](),controller[_0xba39('0xe')]);router[_0xba39('0xb')]('/:id/hopper_histories',auth[_0xba39('0x9')](),controller[_0xba39('0xf')]);router[_0xba39('0xb')](_0xba39('0x10'),auth[_0xba39('0x9')](),controller['getHopperFinals']);router[_0xba39('0xb')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0xba39('0x11')]);router[_0xba39('0xb')]('/:id/lists',auth[_0xba39('0x9')](),controller[_0xba39('0x12')]);router[_0xba39('0xb')](_0xba39('0x13'),auth[_0xba39('0x9')](),controller['getBlackLists']);router[_0xba39('0x14')]('/',auth[_0xba39('0x9')](),controller[_0xba39('0x15')]);router[_0xba39('0x14')](_0xba39('0x16'),auth[_0xba39('0x9')](),controller[_0xba39('0x17')]);router[_0xba39('0x14')]('/:id/lists',auth['isAuthenticated'](),controller[_0xba39('0x18')]);router[_0xba39('0x14')](_0xba39('0x13'),auth['isAuthenticated'](),controller[_0xba39('0x19')]);router['put'](_0xba39('0xc'),auth['isAuthenticated'](),controller[_0xba39('0x1a')]);router[_0xba39('0x1b')](_0xba39('0xc'),auth[_0xba39('0x9')](),controller['destroy']);router['delete'](_0xba39('0x1c'),auth[_0xba39('0x9')](),controller[_0xba39('0x1d')]);router[_0xba39('0x1b')](_0xba39('0x13'),auth['isAuthenticated'](),controller[_0xba39('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index c25d1d3..0fe392e 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 _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 +var _0xdecd=['medium','VIRTUAL','getDataValue','key','sequelize','exports','STRING'];(function(_0x470b0a,_0x2889d6){var _0x4463f6=function(_0x2b5f0e){while(--_0x2b5f0e){_0x470b0a['push'](_0x470b0a['shift']());}};_0x4463f6(++_0x2889d6);}(_0xdecd,0x7b));var _0xddec=function(_0x55979e,_0x4fb9a6){_0x55979e=_0x55979e-0x0;var _0x1846a3=_0xdecd[_0x55979e];return _0x1846a3;};'use strict';var Sequelize=require(_0xddec('0x0'));module[_0xddec('0x1')]={'key':{'type':Sequelize[_0xddec('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':_0xddec('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xddec('0x2')]},'name':{'type':Sequelize[_0xddec('0x4')],'get':function(){return this[_0xddec('0x5')](_0xddec('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 481ccc5..302ba44 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 _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 +var _0x5d51=['role','CannedAnswers','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','then','destroy','get','UserProfileResource','error','stack','name','send','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','fields','attributes','length','nolimit','order','sort','where','pick','filters','filter','merge','options','include','findAll','rows','show','params','intersection','includeAll','find','catch','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x4c4c55,_0x4d2d85){var _0x281771=function(_0x87abba){while(--_0x87abba){_0x4c4c55['push'](_0x4c4c55['shift']());}};_0x281771(++_0x4d2d85);}(_0x5d51,0x10e));var _0x15d5=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5d51[_0x465028];return _0xb783d4;};'use strict';var emlformat=require(_0x15d5('0x0'));var rimraf=require(_0x15d5('0x1'));var zipdir=require(_0x15d5('0x2'));var jsonpatch=require(_0x15d5('0x3'));var rp=require(_0x15d5('0x4'));var moment=require(_0x15d5('0x5'));var BPromise=require(_0x15d5('0x6'));var Mustache=require(_0x15d5('0x7'));var util=require(_0x15d5('0x8'));var path=require(_0x15d5('0x9'));var sox=require(_0x15d5('0xa'));var csv=require('to-csv');var ejs=require(_0x15d5('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x15d5('0xc'));var squel=require(_0x15d5('0xd'));var crypto=require('crypto');var jsforce=require(_0x15d5('0xe'));var deskjs=require(_0x15d5('0xf'));var toCsv=require(_0x15d5('0x10'));var querystring=require(_0x15d5('0x11'));var Papa=require('papaparse');var Redis=require(_0x15d5('0x12'));var authService=require(_0x15d5('0x13'));var qs=require(_0x15d5('0x14'));var as=require(_0x15d5('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x15d5('0x16'));var config=require(_0x15d5('0x17'));var licenseUtil=require(_0x15d5('0x18'));var db=require(_0x15d5('0x19'))['db'];function respondWithStatusCode(_0x41fb10,_0x1456c1){_0x1456c1=_0x1456c1||0xcc;return function(_0x2a66fc){if(_0x2a66fc){return _0x41fb10[_0x15d5('0x1a')](_0x1456c1);}return _0x41fb10[_0x15d5('0x1b')](_0x1456c1)[_0x15d5('0x1c')]();};}function respondWithResult(_0x159e1a,_0x53f92f){_0x53f92f=_0x53f92f||0xc8;return function(_0x36451d){if(_0x36451d){return _0x159e1a[_0x15d5('0x1b')](_0x53f92f)['json'](_0x36451d);}};}function respondWithFilteredResult(_0x2d2177,_0x26edc7){return function(_0x40c16a){if(_0x40c16a){var _0x1e6372=typeof _0x26edc7[_0x15d5('0x1d')]==='undefined'&&typeof _0x26edc7[_0x15d5('0x1e')]===_0x15d5('0x1f');var _0x45cdbf=_0x40c16a[_0x15d5('0x20')];var _0x2dce49=_0x1e6372?0x0:_0x26edc7[_0x15d5('0x1d')];var _0x458b56=_0x1e6372?_0x40c16a[_0x15d5('0x20')]:_0x26edc7['offset']+_0x26edc7['limit'];var _0x3dfeb2;if(_0x458b56>=_0x45cdbf){_0x458b56=_0x45cdbf;_0x3dfeb2=0xc8;}else{_0x3dfeb2=0xce;}_0x2d2177[_0x15d5('0x1b')](_0x3dfeb2);return _0x2d2177[_0x15d5('0x21')](_0x15d5('0x22'),_0x2dce49+'-'+_0x458b56+'/'+_0x45cdbf)[_0x15d5('0x23')](_0x40c16a);}return null;};}function patchUpdates(_0x268a07){return function(_0x1ae1e7){try{jsonpatch[_0x15d5('0x24')](_0x1ae1e7,_0x268a07,!![]);}catch(_0x27e8c7){return BPromise['reject'](_0x27e8c7);}return _0x1ae1e7[_0x15d5('0x25')]();};}function saveUpdates(_0x96308b,_0x4ed1df){return function(_0x4ce02f){if(_0x4ce02f){return _0x4ce02f['update'](_0x96308b)[_0x15d5('0x26')](function(_0x5301ce){return _0x5301ce;});}return null;};}function removeEntity(_0x35e5e8,_0xaf1756){return function(_0x167e58){if(_0x167e58){return _0x167e58[_0x15d5('0x27')]()[_0x15d5('0x26')](function(){var _0x2f39aa=_0x167e58[_0x15d5('0x28')]({'plain':!![]});var _0x1c83cd='CannedAnswers';return db[_0x15d5('0x29')][_0x15d5('0x27')]({'where':{'type':_0x1c83cd,'resourceId':_0x2f39aa['id']}})[_0x15d5('0x26')](function(){return _0x167e58;});})[_0x15d5('0x26')](function(){_0x35e5e8[_0x15d5('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x315e86,_0xf46229){return function(_0x4d37fb){if(!_0x4d37fb){_0x315e86[_0x15d5('0x1a')](0x194);}return _0x4d37fb;};}function handleError(_0x39c374,_0x77db2f){_0x77db2f=_0x77db2f||0x1f4;return function(_0x2bff18){logger[_0x15d5('0x2a')](_0x2bff18[_0x15d5('0x2b')]);if(_0x2bff18[_0x15d5('0x2c')]){delete _0x2bff18['name'];}_0x39c374[_0x15d5('0x1b')](_0x77db2f)[_0x15d5('0x2d')](_0x2bff18);};}exports['index']=function(_0x52152e,_0x3225c6){var _0x3e55a9={},_0x2e45d2={},_0xf26651={'count':0x0,'rows':[]};var _0x492d57=_[_0x15d5('0x2e')](db[_0x15d5('0x2f')][_0x15d5('0x30')],function(_0x37d70c){return{'name':_0x37d70c[_0x15d5('0x31')],'type':_0x37d70c[_0x15d5('0x32')][_0x15d5('0x33')]};});_0x2e45d2[_0x15d5('0x34')]=_[_0x15d5('0x2e')](_0x492d57,_0x15d5('0x2c'));_0x2e45d2[_0x15d5('0x35')]=_[_0x15d5('0x36')](_0x52152e[_0x15d5('0x35')]);_0x2e45d2['filters']=_['intersection'](_0x2e45d2[_0x15d5('0x34')],_0x2e45d2['query']);_0x3e55a9['attributes']=_['intersection'](_0x2e45d2[_0x15d5('0x34')],qs[_0x15d5('0x37')](_0x52152e[_0x15d5('0x35')][_0x15d5('0x37')]));_0x3e55a9['attributes']=_0x3e55a9[_0x15d5('0x38')][_0x15d5('0x39')]?_0x3e55a9['attributes']:_0x2e45d2[_0x15d5('0x34')];if(!_0x52152e[_0x15d5('0x35')]['hasOwnProperty'](_0x15d5('0x3a'))){_0x3e55a9['limit']=qs[_0x15d5('0x1e')](_0x52152e[_0x15d5('0x35')][_0x15d5('0x1e')]);_0x3e55a9[_0x15d5('0x1d')]=qs['offset'](_0x52152e['query'][_0x15d5('0x1d')]);}_0x3e55a9[_0x15d5('0x3b')]=qs[_0x15d5('0x3c')](_0x52152e[_0x15d5('0x35')][_0x15d5('0x3c')]);_0x3e55a9[_0x15d5('0x3d')]=qs['filters'](_[_0x15d5('0x3e')](_0x52152e[_0x15d5('0x35')],_0x2e45d2[_0x15d5('0x3f')]),_0x492d57);if(_0x52152e['query'][_0x15d5('0x40')]){_0x3e55a9[_0x15d5('0x3d')]=_[_0x15d5('0x41')](_0x3e55a9[_0x15d5('0x3d')],{'$or':[{'key':{'$like':'%'+_0x52152e[_0x15d5('0x35')][_0x15d5('0x40')]+'%'}},{'value':{'$like':'%'+_0x52152e[_0x15d5('0x35')]['filter']+'%'}}]});}_0x3e55a9=_[_0x15d5('0x41')]({},_0x3e55a9,_0x52152e[_0x15d5('0x42')]);var _0x142716={'where':_0x3e55a9['where']};return db[_0x15d5('0x2f')][_0x15d5('0x20')](_0x142716)[_0x15d5('0x26')](function(_0x286155){_0xf26651[_0x15d5('0x20')]=_0x286155;if(_0x52152e[_0x15d5('0x35')]['includeAll']){_0x3e55a9[_0x15d5('0x43')]=[{'all':!![]}];}return db[_0x15d5('0x2f')][_0x15d5('0x44')](_0x3e55a9);})[_0x15d5('0x26')](function(_0x1cb611){_0xf26651[_0x15d5('0x45')]=_0x1cb611;return _0xf26651;})['then'](respondWithFilteredResult(_0x3225c6,_0x3e55a9))['catch'](handleError(_0x3225c6,null));};exports[_0x15d5('0x46')]=function(_0x53a933,_0x16b66c){var _0x45c492={'raw':!![],'where':{'id':_0x53a933[_0x15d5('0x47')]['id']}},_0x2578b0={};_0x2578b0[_0x15d5('0x34')]=_[_0x15d5('0x36')](db[_0x15d5('0x2f')][_0x15d5('0x30')]);_0x2578b0[_0x15d5('0x35')]=_[_0x15d5('0x36')](_0x53a933[_0x15d5('0x35')]);_0x2578b0['filters']=_['intersection'](_0x2578b0[_0x15d5('0x34')],_0x2578b0[_0x15d5('0x35')]);_0x45c492['attributes']=_[_0x15d5('0x48')](_0x2578b0[_0x15d5('0x34')],qs[_0x15d5('0x37')](_0x53a933[_0x15d5('0x35')][_0x15d5('0x37')]));_0x45c492[_0x15d5('0x38')]=_0x45c492['attributes'][_0x15d5('0x39')]?_0x45c492[_0x15d5('0x38')]:_0x2578b0['model'];if(_0x53a933['query'][_0x15d5('0x49')]){_0x45c492[_0x15d5('0x43')]=[{'all':!![]}];}_0x45c492=_[_0x15d5('0x41')]({},_0x45c492,_0x53a933[_0x15d5('0x42')]);return db[_0x15d5('0x2f')][_0x15d5('0x4a')](_0x45c492)[_0x15d5('0x26')](handleEntityNotFound(_0x16b66c,null))[_0x15d5('0x26')](respondWithResult(_0x16b66c,null))[_0x15d5('0x4b')](handleError(_0x16b66c,null));};exports['update']=function(_0x42a30b,_0x330d96){if(_0x42a30b[_0x15d5('0x4c')]['id']){delete _0x42a30b['body']['id'];}return db[_0x15d5('0x2f')][_0x15d5('0x4a')]({'where':{'id':_0x42a30b['params']['id']}})[_0x15d5('0x26')](handleEntityNotFound(_0x330d96,null))[_0x15d5('0x26')](saveUpdates(_0x42a30b[_0x15d5('0x4c')],null))[_0x15d5('0x26')](respondWithResult(_0x330d96,null))['catch'](handleError(_0x330d96,null));};exports['destroy']=function(_0x21b804,_0xfeb15f){return db['CannedAnswer'][_0x15d5('0x4a')]({'where':{'id':_0x21b804['params']['id']}})[_0x15d5('0x26')](handleEntityNotFound(_0xfeb15f,null))[_0x15d5('0x26')](removeEntity(_0xfeb15f,null))['catch'](handleError(_0xfeb15f,null));};exports[_0x15d5('0x4d')]=function(_0x52eaac,_0x35181e){var _0x1dd88e={'key':_0x52eaac[_0x15d5('0x4c')][_0x15d5('0x33')]};if(_0x52eaac[_0x15d5('0x4c')][_0x15d5('0x4e')]){_0x1dd88e[_0x15d5('0x4e')]=_0x52eaac[_0x15d5('0x4c')][_0x15d5('0x4e')];}else if(_0x52eaac[_0x15d5('0x4c')][_0x15d5('0x4f')]){_0x1dd88e[_0x15d5('0x4f')]=_0x52eaac[_0x15d5('0x4c')][_0x15d5('0x4f')];}else if(_0x52eaac['body'][_0x15d5('0x50')]){_0x1dd88e[_0x15d5('0x50')]=_0x52eaac[_0x15d5('0x4c')]['OpenchannelAccountId'];}else if(_0x52eaac[_0x15d5('0x4c')]['ChatWebsiteId']){_0x1dd88e[_0x15d5('0x51')]=_0x52eaac[_0x15d5('0x4c')][_0x15d5('0x51')];}return db['CannedAnswer']['find']({'where':_0x1dd88e})['then'](function(_0x540bb9){if(_0x540bb9){throw new db['Sequelize'][(_0x15d5('0x52'))](_0x15d5('0x53'));}return db[_0x15d5('0x2f')]['create'](_0x52eaac[_0x15d5('0x4c')]);})[_0x15d5('0x26')](function(_0x3d0094){var _0x152242=_0x52eaac[_0x15d5('0x54')][_0x15d5('0x28')]({'plain':!![]});if(!_0x152242)throw new Error(_0x15d5('0x55'));if(_0x152242[_0x15d5('0x56')]==='user'){var _0x515453=_0x3d0094[_0x15d5('0x28')]({'plain':!![]});return db['UserProfileSection'][_0x15d5('0x4a')]({'where':{'name':_0x15d5('0x57'),'userProfileId':_0x152242['userProfileId']},'raw':!![]})[_0x15d5('0x26')](function(_0x4131cc){if(_0x4131cc&&_0x4131cc[_0x15d5('0x58')]===0x0){return db[_0x15d5('0x29')][_0x15d5('0x4d')]({'name':_0x515453[_0x15d5('0x2c')],'resourceId':_0x515453['id'],'type':_0x4131cc[_0x15d5('0x2c')],'sectionId':_0x4131cc['id']},{})[_0x15d5('0x26')](function(){return _0x3d0094;});}else{return _0x3d0094;}})['catch'](function(_0x4a428c){logger[_0x15d5('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a428c);throw _0x4a428c;});}return _0x3d0094;})[_0x15d5('0x26')](respondWithResult(_0x35181e,0xc9))['catch'](handleError(_0x35181e,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 8119fac..3a79b70 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 _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 +var _0x3ccf=['define','tools_canned_answers','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','path','../../config/environment','./cannedAnswer.attributes','exports'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x3ccf,0x139));var _0xf3cc=function(_0x1f4f6e,_0x17910b){_0x1f4f6e=_0x1f4f6e-0x0;var _0x3f6000=_0x3ccf[_0x1f4f6e];return _0x3f6000;};'use strict';var _=require(_0xf3cc('0x0'));var util=require('util');var logger=require(_0xf3cc('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf3cc('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf3cc('0x3'));var rimraf=require('rimraf');var config=require(_0xf3cc('0x4'));var attributes=require(_0xf3cc('0x5'));module[_0xf3cc('0x6')]=function(_0x2af784,_0x320e4f){return _0x2af784[_0xf3cc('0x7')]('CannedAnswer',attributes,{'tableName':_0xf3cc('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf3cc('0x9')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index fd8e3b4..bacb063 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(_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 +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(_0x24ca70,_0x2046ae){var _0xaccbd7=function(_0x5293a3){while(--_0x5293a3){_0x24ca70['push'](_0x24ca70['shift']());}};_0xaccbd7(++_0x2046ae);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 f0b8306..aaa61ed 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 _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 +var _0xd7c2=['delete','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id','put'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0xd7c2,0x112));var _0x2d7c=function(_0xbd2a41,_0x2c3cd8){_0xbd2a41=_0xbd2a41-0x0;var _0x5578fe=_0xd7c2[_0xbd2a41];return _0x5578fe;};'use strict';var multer=require(_0x2d7c('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2d7c('0x1'));var router=express[_0x2d7c('0x2')]();var fs_extra=require(_0x2d7c('0x3'));var auth=require(_0x2d7c('0x4'));var interaction=require(_0x2d7c('0x5'));var config=require(_0x2d7c('0x6'));var controller=require(_0x2d7c('0x7'));router[_0x2d7c('0x8')]('/',auth[_0x2d7c('0x9')](),controller['index']);router[_0x2d7c('0x8')](_0x2d7c('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x2d7c('0xb')](_0x2d7c('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x2d7c('0xc')](_0x2d7c('0xa'),auth[_0x2d7c('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 6420cfc..4111ceb 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 _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 +var _0x9b5b=['INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x52578c,_0x51113a){var _0x4e9d7b=function(_0x2e28c0){while(--_0x2e28c0){_0x52578c['push'](_0x52578c['shift']());}};_0x4e9d7b(++_0x51113a);}(_0x9b5b,0x7f));var _0xb9b5=function(_0x3d6b61,_0x5e9be7){_0x3d6b61=_0x3d6b61-0x0;var _0x5a860d=_0x9b5b[_0x3d6b61];return _0x5a860d;};'use strict';var Sequelize=require(_0xb9b5('0x0'));module[_0xb9b5('0x1')]={'calldate':{'type':Sequelize[_0xb9b5('0x2')],'allowNull':![],'defaultValue':_0xb9b5('0x3')},'clid':{'type':Sequelize[_0xb9b5('0x4')]},'src':{'type':Sequelize[_0xb9b5('0x4')]},'dst':{'type':Sequelize[_0xb9b5('0x4')]},'dcontext':{'type':Sequelize[_0xb9b5('0x4')]},'channel':{'type':Sequelize[_0xb9b5('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0xb9b5('0x4')]},'lastdata':{'type':Sequelize[_0xb9b5('0x4')]},'duration':{'type':Sequelize[_0xb9b5('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xb9b5('0x4')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xb9b5('0x4')]},'linkedid':{'type':Sequelize[_0xb9b5('0x4')]},'sequence':{'type':Sequelize[_0xb9b5('0x4')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb9b5('0x4')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index fff470d..51dafe9 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 _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 +var _0xc03e=['../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','Cdr','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','params','find','create','body','describe','eml-format','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x361ba6,_0x4c37b5){var _0x11ee21=function(_0x1afb1e){while(--_0x1afb1e){_0x361ba6['push'](_0x361ba6['shift']());}};_0x11ee21(++_0x4c37b5);}(_0xc03e,0x15a));var _0xec03=function(_0x1a9e78,_0x180720){_0x1a9e78=_0x1a9e78-0x0;var _0x113e06=_0xc03e[_0x1a9e78];return _0x113e06;};'use strict';var emlformat=require(_0xec03('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xec03('0x1'));var rp=require('request-promise');var moment=require(_0xec03('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xec03('0x3'));var util=require(_0xec03('0x4'));var path=require(_0xec03('0x5'));var sox=require(_0xec03('0x6'));var csv=require(_0xec03('0x7'));var ejs=require(_0xec03('0x8'));var fs=require('fs');var fs_extra=require(_0xec03('0x9'));var _=require(_0xec03('0xa'));var squel=require(_0xec03('0xb'));var crypto=require('crypto');var jsforce=require(_0xec03('0xc'));var deskjs=require(_0xec03('0xd'));var toCsv=require(_0xec03('0x7'));var querystring=require(_0xec03('0xe'));var Papa=require('papaparse');var Redis=require(_0xec03('0xf'));var authService=require(_0xec03('0x10'));var qs=require(_0xec03('0x11'));var as=require(_0xec03('0x12'));var hardwareService=require(_0xec03('0x13'));var logger=require(_0xec03('0x14'))(_0xec03('0x15'));var utils=require(_0xec03('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xec03('0x17'));var db=require(_0xec03('0x18'))['db'];function respondWithStatusCode(_0x398720,_0x2f65a1){_0x2f65a1=_0x2f65a1||0xcc;return function(_0x9908ef){if(_0x9908ef){return _0x398720[_0xec03('0x19')](_0x2f65a1);}return _0x398720[_0xec03('0x1a')](_0x2f65a1)[_0xec03('0x1b')]();};}function respondWithResult(_0x4ba43a,_0x555447){_0x555447=_0x555447||0xc8;return function(_0x5ca0e2){if(_0x5ca0e2){return _0x4ba43a[_0xec03('0x1a')](_0x555447)[_0xec03('0x1c')](_0x5ca0e2);}};}function respondWithFilteredResult(_0x3501ab,_0x515680){return function(_0x28bb4f){if(_0x28bb4f){var _0xbe85e6=typeof _0x515680[_0xec03('0x1d')]===_0xec03('0x1e')&&typeof _0x515680['limit']===_0xec03('0x1e');var _0x52f6ae=_0x28bb4f[_0xec03('0x1f')];var _0x5e8ae2=_0xbe85e6?0x0:_0x515680[_0xec03('0x1d')];var _0x5b3e04=_0xbe85e6?_0x28bb4f['count']:_0x515680[_0xec03('0x1d')]+_0x515680[_0xec03('0x20')];var _0xefa268;if(_0x5b3e04>=_0x52f6ae){_0x5b3e04=_0x52f6ae;_0xefa268=0xc8;}else{_0xefa268=0xce;}_0x3501ab[_0xec03('0x1a')](_0xefa268);return _0x3501ab['set'](_0xec03('0x21'),_0x5e8ae2+'-'+_0x5b3e04+'/'+_0x52f6ae)['json'](_0x28bb4f);}return null;};}function patchUpdates(_0x16ade3){return function(_0x253910){try{jsonpatch[_0xec03('0x22')](_0x253910,_0x16ade3,!![]);}catch(_0x33a167){return BPromise[_0xec03('0x23')](_0x33a167);}return _0x253910[_0xec03('0x24')]();};}function saveUpdates(_0x3a44df,_0x3b6ddf){return function(_0x5df6cc){if(_0x5df6cc){return _0x5df6cc[_0xec03('0x25')](_0x3a44df)[_0xec03('0x26')](function(_0xa16d53){return _0xa16d53;});}return null;};}function removeEntity(_0x76b813,_0x33de1e){return function(_0x15ef87){if(_0x15ef87){return _0x15ef87['destroy']()[_0xec03('0x26')](function(){_0x76b813[_0xec03('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bfcf6,_0xa5b580){return function(_0x26875e){if(!_0x26875e){_0x2bfcf6[_0xec03('0x19')](0x194);}return _0x26875e;};}function handleError(_0x1c6870,_0x581322){_0x581322=_0x581322||0x1f4;return function(_0x73cc4f){logger[_0xec03('0x27')](_0x73cc4f[_0xec03('0x28')]);if(_0x73cc4f[_0xec03('0x29')]){delete _0x73cc4f[_0xec03('0x29')];}_0x1c6870['status'](_0x581322)[_0xec03('0x2a')](_0x73cc4f);};}exports[_0xec03('0x2b')]=function(_0x49f9ab,_0x530251){var _0x2063ba={},_0x12b5c9={},_0x35a9eb={'count':0x0,'rows':[]};var _0x872f98=_[_0xec03('0x2c')](db[_0xec03('0x2d')][_0xec03('0x2e')],function(_0x28753c){return{'name':_0x28753c['fieldName'],'type':_0x28753c[_0xec03('0x2f')][_0xec03('0x30')]};});_0x12b5c9[_0xec03('0x31')]=_[_0xec03('0x2c')](_0x872f98,_0xec03('0x29'));_0x12b5c9[_0xec03('0x32')]=_[_0xec03('0x33')](_0x49f9ab[_0xec03('0x32')]);_0x12b5c9[_0xec03('0x34')]=_['intersection'](_0x12b5c9['model'],_0x12b5c9['query']);_0x2063ba[_0xec03('0x35')]=_[_0xec03('0x36')](_0x12b5c9[_0xec03('0x31')],qs[_0xec03('0x37')](_0x49f9ab['query']['fields']));_0x2063ba['attributes']=_0x2063ba['attributes'][_0xec03('0x38')]?_0x2063ba[_0xec03('0x35')]:_0x12b5c9[_0xec03('0x31')];if(!_0x49f9ab[_0xec03('0x32')][_0xec03('0x39')](_0xec03('0x3a'))){_0x2063ba[_0xec03('0x20')]=qs[_0xec03('0x20')](_0x49f9ab[_0xec03('0x32')][_0xec03('0x20')]);_0x2063ba[_0xec03('0x1d')]=qs[_0xec03('0x1d')](_0x49f9ab['query'][_0xec03('0x1d')]);}_0x2063ba[_0xec03('0x3b')]=qs[_0xec03('0x3c')](_0x49f9ab['query'][_0xec03('0x3c')]);_0x2063ba[_0xec03('0x3d')]=qs[_0xec03('0x34')](_[_0xec03('0x3e')](_0x49f9ab[_0xec03('0x32')],_0x12b5c9[_0xec03('0x34')]),_0x872f98);if(_0x49f9ab[_0xec03('0x32')][_0xec03('0x3f')]){_0x2063ba[_0xec03('0x3d')]=_[_0xec03('0x40')](_0x2063ba[_0xec03('0x3d')],{'$or':_['map'](_0x872f98,function(_0x25286a){if(_0x25286a[_0xec03('0x2f')]!==_0xec03('0x41')){var _0x3d6d70={};_0x3d6d70[_0x25286a[_0xec03('0x29')]]={'$like':'%'+_0x49f9ab[_0xec03('0x32')][_0xec03('0x3f')]+'%'};return _0x3d6d70;}})});}_0x2063ba=_[_0xec03('0x40')]({},_0x2063ba,_0x49f9ab['options']);var _0x454e91={'where':_0x2063ba['where']};return db['Cdr'][_0xec03('0x1f')](_0x454e91)['then'](function(_0x548b81){_0x35a9eb[_0xec03('0x1f')]=_0x548b81;if(_0x49f9ab[_0xec03('0x32')]['includeAll']){_0x2063ba[_0xec03('0x42')]=[{'all':!![]}];}return db['Cdr']['findAll'](_0x2063ba);})['then'](function(_0x494fec){_0x35a9eb[_0xec03('0x43')]=_0x494fec;return _0x35a9eb;})[_0xec03('0x26')](respondWithFilteredResult(_0x530251,_0x2063ba))[_0xec03('0x44')](handleError(_0x530251,null));};exports['show']=function(_0x1b1aea,_0x3f2522){var _0xe03df3={'raw':!![],'where':{'id':_0x1b1aea[_0xec03('0x45')]['id']}},_0x14a429={};_0x14a429[_0xec03('0x31')]=_[_0xec03('0x33')](db[_0xec03('0x2d')][_0xec03('0x2e')]);_0x14a429['query']=_[_0xec03('0x33')](_0x1b1aea[_0xec03('0x32')]);_0x14a429[_0xec03('0x34')]=_[_0xec03('0x36')](_0x14a429['model'],_0x14a429[_0xec03('0x32')]);_0xe03df3[_0xec03('0x35')]=_[_0xec03('0x36')](_0x14a429[_0xec03('0x31')],qs[_0xec03('0x37')](_0x1b1aea[_0xec03('0x32')]['fields']));_0xe03df3['attributes']=_0xe03df3[_0xec03('0x35')][_0xec03('0x38')]?_0xe03df3[_0xec03('0x35')]:_0x14a429[_0xec03('0x31')];if(_0x1b1aea[_0xec03('0x32')]['includeAll']){_0xe03df3['include']=[{'all':!![]}];}_0xe03df3=_[_0xec03('0x40')]({},_0xe03df3,_0x1b1aea['options']);return db[_0xec03('0x2d')][_0xec03('0x46')](_0xe03df3)[_0xec03('0x26')](handleEntityNotFound(_0x3f2522,null))[_0xec03('0x26')](respondWithResult(_0x3f2522,null))['catch'](handleError(_0x3f2522,null));};exports[_0xec03('0x47')]=function(_0x14a61c,_0x3c7e18){return db[_0xec03('0x2d')]['create'](_0x14a61c[_0xec03('0x48')],{})['then'](respondWithResult(_0x3c7e18,0xc9))[_0xec03('0x44')](handleError(_0x3c7e18,null));};exports[_0xec03('0x25')]=function(_0xdb9a99,_0x1c6b87){if(_0xdb9a99[_0xec03('0x48')]['id']){delete _0xdb9a99[_0xec03('0x48')]['id'];}return db[_0xec03('0x2d')]['find']({'where':{'id':_0xdb9a99[_0xec03('0x45')]['id']}})[_0xec03('0x26')](handleEntityNotFound(_0x1c6b87,null))[_0xec03('0x26')](saveUpdates(_0xdb9a99[_0xec03('0x48')],null))['then'](respondWithResult(_0x1c6b87,null))[_0xec03('0x44')](handleError(_0x1c6b87,null));};exports['destroy']=function(_0xe0e874,_0x3825f9){return db[_0xec03('0x2d')][_0xec03('0x46')]({'where':{'id':_0xe0e874['params']['id']}})[_0xec03('0x26')](handleEntityNotFound(_0x3825f9,null))[_0xec03('0x26')](removeEntity(_0x3825f9,null))[_0xec03('0x44')](handleError(_0x3825f9,null));};exports[_0xec03('0x49')]=function(_0x32a5af,_0x5b1339){return db[_0xec03('0x2d')][_0xec03('0x49')]()[_0xec03('0x26')](respondWithResult(_0x5b1339,null))['catch'](handleError(_0x5b1339,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 3eed475..90d524b 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_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 +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x3709e3,_0x5ca0a1){var _0x831ec0=function(_0x2efe21){while(--_0x2efe21){_0x3709e3['push'](_0x3709e3['shift']());}};_0x831ec0(++_0x5ca0a1);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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 diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index abd4feb..c3272d2 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 _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 +var _0x7efa=['message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3266a6,_0x129966){var _0x10ee38=function(_0x516e68){while(--_0x516e68){_0x3266a6['push'](_0x3266a6['shift']());}};_0x10ee38(++_0x129966);}(_0x7efa,0x79));var _0xa7ef=function(_0x258fb0,_0x5362dc){_0x258fb0=_0x258fb0-0x0;var _0x4d1afe=_0x7efa[_0x258fb0];return _0x4d1afe;};'use strict';var _=require(_0xa7ef('0x0'));var util=require(_0xa7ef('0x1'));var moment=require(_0xa7ef('0x2'));var BPromise=require(_0xa7ef('0x3'));var rs=require(_0xa7ef('0x4'));var fs=require('fs');var Redis=require(_0xa7ef('0x5'));var db=require(_0xa7ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa7ef('0x7'));var jayson=require(_0xa7ef('0x8'));var client=jayson[_0xa7ef('0x9')][_0xa7ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe9b327,_0x70984f,_0x5632b9){return new BPromise(function(_0x58cc27,_0x4ac528){return client['request'](_0xe9b327,_0x5632b9)[_0xa7ef('0xb')](function(_0x280de6){logger[_0xa7ef('0xc')](_0xa7ef('0xd'),_0x70984f,_0xa7ef('0xe'));logger[_0xa7ef('0xf')](_0xa7ef('0x10'),_0x70984f,_0xa7ef('0xe'),JSON[_0xa7ef('0x11')](_0x280de6));if(_0x280de6['error']){if(_0x280de6[_0xa7ef('0x12')]['code']===0x1f4){logger[_0xa7ef('0x12')]('Cdr,\x20%s,\x20%s',_0x70984f,_0x280de6[_0xa7ef('0x12')][_0xa7ef('0x13')]);return _0x4ac528(_0x280de6[_0xa7ef('0x12')]['message']);}logger[_0xa7ef('0x12')](_0xa7ef('0xd'),_0x70984f,_0x280de6[_0xa7ef('0x12')][_0xa7ef('0x13')]);return _0x58cc27(_0x280de6[_0xa7ef('0x12')]['message']);}else{logger[_0xa7ef('0xc')]('Cdr,\x20%s,\x20%s',_0x70984f,'request\x20sent');_0x58cc27(_0x280de6['result'][_0xa7ef('0x13')]);}})['catch'](function(_0x24b9ff){logger['error'](_0xa7ef('0xd'),_0x70984f,_0x24b9ff);_0x4ac528(_0x24b9ff);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index b11f7f7..fbf38d3 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_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 +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(_0x12ce04,_0xe0c750){var _0x34d3a6=function(_0x336e72){while(--_0x336e72){_0x12ce04['push'](_0x12ce04['shift']());}};_0x34d3a6(++_0xe0c750);}(_0xb10b,0x12a));var _0xbb10=function(_0x11435c,_0x436ccf){_0x11435c=_0x11435c-0x0;var _0x556167=_0xb10b[_0x11435c];return _0x556167;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 84e50ad..76296c4 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 _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 +var _0x1f77=['TEXT','exports','INTEGER','STRING','noop'];(function(_0x175e32,_0x2c5bb6){var _0x3886c5=function(_0x29a9fb){while(--_0x29a9fb){_0x175e32['push'](_0x175e32['shift']());}};_0x3886c5(++_0x2c5bb6);}(_0x1f77,0x1b9));var _0x71f7=function(_0x156c21,_0x3d5cf6){_0x156c21=_0x156c21-0x0;var _0x163acf=_0x1f77[_0x156c21];return _0x163acf;};'use strict';var Sequelize=require('sequelize');module[_0x71f7('0x0')]={'priority':{'type':Sequelize[_0x71f7('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x71f7('0x2')],'allowNull':![],'defaultValue':_0x71f7('0x3')},'appdata':{'type':Sequelize[_0x71f7('0x4')]()},'description':{'type':Sequelize[_0x71f7('0x2')]},'interval':{'type':Sequelize[_0x71f7('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 37cb581..5191a78 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 _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 +var _0x33a4=['count','limit','set','json','reject','save','update','then','error','show','params','keys','ChatApplication','rawAttributes','query','filters','intersection','model','attributes','fields','length','includeAll','include','merge','find','catch','body','destroy','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined'];(function(_0x9ff1c0,_0x207afc){var _0x3e6c23=function(_0x11ad15){while(--_0x11ad15){_0x9ff1c0['push'](_0x9ff1c0['shift']());}};_0x3e6c23(++_0x207afc);}(_0x33a4,0x88));var _0x433a=function(_0xf8d1c7,_0x1f8b56){_0xf8d1c7=_0xf8d1c7-0x0;var _0x5754e9=_0x33a4[_0xf8d1c7];return _0x5754e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x433a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x433a('0x1'));var rp=require(_0x433a('0x2'));var moment=require(_0x433a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x433a('0x4'));var sox=require(_0x433a('0x5'));var csv=require(_0x433a('0x6'));var ejs=require(_0x433a('0x7'));var fs=require('fs');var fs_extra=require(_0x433a('0x8'));var _=require('lodash');var squel=require(_0x433a('0x9'));var crypto=require('crypto');var jsforce=require(_0x433a('0xa'));var deskjs=require(_0x433a('0xb'));var toCsv=require(_0x433a('0x6'));var querystring=require(_0x433a('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x433a('0xd'));var qs=require(_0x433a('0xe'));var as=require(_0x433a('0xf'));var hardwareService=require(_0x433a('0x10'));var logger=require(_0x433a('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x433a('0x12'));var licenseUtil=require(_0x433a('0x13'));var db=require(_0x433a('0x14'))['db'];function respondWithStatusCode(_0xd9260c,_0x5edeaf){_0x5edeaf=_0x5edeaf||0xcc;return function(_0x2d064c){if(_0x2d064c){return _0xd9260c[_0x433a('0x15')](_0x5edeaf);}return _0xd9260c['status'](_0x5edeaf)[_0x433a('0x16')]();};}function respondWithResult(_0x524a57,_0x36d1a6){_0x36d1a6=_0x36d1a6||0xc8;return function(_0x1f6cee){if(_0x1f6cee){return _0x524a57[_0x433a('0x17')](_0x36d1a6)['json'](_0x1f6cee);}};}function respondWithFilteredResult(_0x4ba178,_0x14e3a7){return function(_0x24311f){if(_0x24311f){var _0x35ebaf=typeof _0x14e3a7[_0x433a('0x18')]===_0x433a('0x19')&&typeof _0x14e3a7['limit']==='undefined';var _0x2f6a70=_0x24311f[_0x433a('0x1a')];var _0x4254c4=_0x35ebaf?0x0:_0x14e3a7[_0x433a('0x18')];var _0x255e47=_0x35ebaf?_0x24311f[_0x433a('0x1a')]:_0x14e3a7[_0x433a('0x18')]+_0x14e3a7[_0x433a('0x1b')];var _0x382f45;if(_0x255e47>=_0x2f6a70){_0x255e47=_0x2f6a70;_0x382f45=0xc8;}else{_0x382f45=0xce;}_0x4ba178[_0x433a('0x17')](_0x382f45);return _0x4ba178[_0x433a('0x1c')]('Content-Range',_0x4254c4+'-'+_0x255e47+'/'+_0x2f6a70)[_0x433a('0x1d')](_0x24311f);}return null;};}function patchUpdates(_0x566ae7){return function(_0x2f16a8){try{jsonpatch['apply'](_0x2f16a8,_0x566ae7,!![]);}catch(_0x4fd99){return BPromise[_0x433a('0x1e')](_0x4fd99);}return _0x2f16a8[_0x433a('0x1f')]();};}function saveUpdates(_0xa2dfe5,_0x389b90){return function(_0x1501f2){if(_0x1501f2){return _0x1501f2[_0x433a('0x20')](_0xa2dfe5)['then'](function(_0x5b2ce0){return _0x5b2ce0;});}return null;};}function removeEntity(_0x2a5a13,_0x5a50ff){return function(_0x326785){if(_0x326785){return _0x326785['destroy']()[_0x433a('0x21')](function(){_0x2a5a13[_0x433a('0x17')](0xcc)[_0x433a('0x16')]();});}};}function handleEntityNotFound(_0x3ef4ab,_0x344e26){return function(_0xaea8aa){if(!_0xaea8aa){_0x3ef4ab['sendStatus'](0x194);}return _0xaea8aa;};}function handleError(_0x41136a,_0xcd441b){_0xcd441b=_0xcd441b||0x1f4;return function(_0x4792ff){logger[_0x433a('0x22')](_0x4792ff['stack']);if(_0x4792ff['name']){delete _0x4792ff['name'];}_0x41136a[_0x433a('0x17')](_0xcd441b)['send'](_0x4792ff);};}exports[_0x433a('0x23')]=function(_0x499e8c,_0x49f03e){var _0x46e452={'raw':!![],'where':{'id':_0x499e8c[_0x433a('0x24')]['id']}},_0x1d5d78={};_0x1d5d78['model']=_[_0x433a('0x25')](db[_0x433a('0x26')][_0x433a('0x27')]);_0x1d5d78['query']=_['keys'](_0x499e8c[_0x433a('0x28')]);_0x1d5d78[_0x433a('0x29')]=_[_0x433a('0x2a')](_0x1d5d78[_0x433a('0x2b')],_0x1d5d78[_0x433a('0x28')]);_0x46e452[_0x433a('0x2c')]=_[_0x433a('0x2a')](_0x1d5d78[_0x433a('0x2b')],qs['fields'](_0x499e8c[_0x433a('0x28')][_0x433a('0x2d')]));_0x46e452[_0x433a('0x2c')]=_0x46e452[_0x433a('0x2c')][_0x433a('0x2e')]?_0x46e452[_0x433a('0x2c')]:_0x1d5d78[_0x433a('0x2b')];if(_0x499e8c[_0x433a('0x28')][_0x433a('0x2f')]){_0x46e452[_0x433a('0x30')]=[{'all':!![]}];}_0x46e452=_[_0x433a('0x31')]({},_0x46e452,_0x499e8c['options']);return db[_0x433a('0x26')][_0x433a('0x32')](_0x46e452)[_0x433a('0x21')](handleEntityNotFound(_0x49f03e,null))[_0x433a('0x21')](respondWithResult(_0x49f03e,null))[_0x433a('0x33')](handleError(_0x49f03e,null));};exports[_0x433a('0x20')]=function(_0x475c9a,_0x367875){if(_0x475c9a[_0x433a('0x34')]['id']){delete _0x475c9a[_0x433a('0x34')]['id'];}return db[_0x433a('0x26')]['find']({'where':{'id':_0x475c9a[_0x433a('0x24')]['id']}})[_0x433a('0x21')](handleEntityNotFound(_0x367875,null))['then'](saveUpdates(_0x475c9a['body'],null))[_0x433a('0x21')](respondWithResult(_0x367875,null))['catch'](handleError(_0x367875,null));};exports[_0x433a('0x35')]=function(_0x20fc31,_0x1530b0){return db['ChatApplication']['find']({'where':{'id':_0x20fc31[_0x433a('0x24')]['id']}})[_0x433a('0x21')](handleEntityNotFound(_0x1530b0,null))[_0x433a('0x21')](removeEntity(_0x1530b0,null))[_0x433a('0x33')](handleError(_0x1530b0,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 08ff3fa..cbccda9 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 _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 +var _0x94c6=['rimraf','./chatApplication.attributes','exports','define','ChatApplication','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4cf932,_0x2e81ca){var _0x438329=function(_0x1fdd67){while(--_0x1fdd67){_0x4cf932['push'](_0x4cf932['shift']());}};_0x438329(++_0x2e81ca);}(_0x94c6,0xa2));var _0x694c=function(_0x5d5513,_0x4ee176){_0x5d5513=_0x5d5513-0x0;var _0x1003a1=_0x94c6[_0x5d5513];return _0x1003a1;};'use strict';var _=require(_0x694c('0x0'));var util=require(_0x694c('0x1'));var logger=require(_0x694c('0x2'))(_0x694c('0x3'));var moment=require(_0x694c('0x4'));var BPromise=require(_0x694c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x694c('0x6'));var config=require('../../config/environment');var attributes=require(_0x694c('0x7'));module[_0x694c('0x8')]=function(_0x46ce62,_0xa8dfd2){return _0x46ce62[_0x694c('0x9')](_0x694c('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x694c('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index bcfbb2b..9d6f4fe 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 _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 +var _0xe694=['stringify','error','message','result','catch','lodash','moment','../../config/utils','rpc','jayson/promise','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3f636e,_0x4aa8d4){var _0x512431=function(_0x6435c5){while(--_0x6435c5){_0x3f636e['push'](_0x3f636e['shift']());}};_0x512431(++_0x4aa8d4);}(_0xe694,0x1d0));var _0x4e69=function(_0x3bda86,_0x3c45e5){_0x3bda86=_0x3bda86-0x0;var _0x4d7ffa=_0xe694[_0x3bda86];return _0x4d7ffa;};'use strict';var _=require(_0x4e69('0x0'));var util=require('util');var moment=require(_0x4e69('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(_0x4e69('0x2'));var logger=require('../../config/logger')(_0x4e69('0x3'));var config=require('../../config/environment');var jayson=require(_0x4e69('0x4'));var client=jayson['client'][_0x4e69('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x3f74dc,_0xb3b842,_0x27292b){return new BPromise(function(_0xdd9283,_0x131868){return client[_0x4e69('0x6')](_0x3f74dc,_0x27292b)[_0x4e69('0x7')](function(_0x585a01){logger[_0x4e69('0x8')](_0x4e69('0x9'),_0xb3b842,_0x4e69('0xa'));logger[_0x4e69('0xb')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0xb3b842,'request\x20sent',JSON[_0x4e69('0xc')](_0x585a01));if(_0x585a01['error']){if(_0x585a01[_0x4e69('0xd')]['code']===0x1f4){logger[_0x4e69('0xd')](_0x4e69('0x9'),_0xb3b842,_0x585a01[_0x4e69('0xd')][_0x4e69('0xe')]);return _0x131868(_0x585a01[_0x4e69('0xd')][_0x4e69('0xe')]);}logger[_0x4e69('0xd')](_0x4e69('0x9'),_0xb3b842,_0x585a01['error']['message']);return _0xdd9283(_0x585a01[_0x4e69('0xd')][_0x4e69('0xe')]);}else{logger[_0x4e69('0x8')]('ChatApplication,\x20%s,\x20%s',_0xb3b842,_0x4e69('0xa'));_0xdd9283(_0x585a01[_0x4e69('0xf')][_0x4e69('0xe')]);}})[_0x4e69('0x10')](function(_0x34dbc1){logger['error'](_0x4e69('0x9'),_0xb3b842,_0x34dbc1);_0x131868(_0x34dbc1);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 42f3a2e..331a7ae 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 _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 +var _0x1b64=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','util'];(function(_0x5cb3a5,_0x3fcfcb){var _0x5de246=function(_0x5d4d75){while(--_0x5d4d75){_0x5cb3a5['push'](_0x5cb3a5['shift']());}};_0x5de246(++_0x3fcfcb);}(_0x1b64,0x6a));var _0x41b6=function(_0x565c85,_0x27256e){_0x565c85=_0x565c85-0x0;var _0x10d353=_0x1b64[_0x565c85];return _0x10d353;};'use strict';var multer=require(_0x41b6('0x0'));var util=require(_0x41b6('0x1'));var path=require(_0x41b6('0x2'));var timeout=require(_0x41b6('0x3'));var express=require(_0x41b6('0x4'));var router=express[_0x41b6('0x5')]();var fs_extra=require(_0x41b6('0x6'));var auth=require(_0x41b6('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x41b6('0x8'));router[_0x41b6('0x9')](_0x41b6('0xa'),auth[_0x41b6('0xb')](),controller[_0x41b6('0xc')]);router[_0x41b6('0xd')](_0x41b6('0xa'),auth[_0x41b6('0xb')](),controller[_0x41b6('0xe')]);router[_0x41b6('0xf')](_0x41b6('0xa'),auth['isAuthenticated'](),controller[_0x41b6('0x10')]);module[_0x41b6('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 14f84cc..1c4b6f4 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 _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 +var _0x01db=['sequelize','STRING','BOOLEAN'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x01db,0x171));var _0xb01d=function(_0x521fcf,_0x33e556){_0x521fcf=_0x521fcf-0x0;var _0x4c5d72=_0x01db[_0x521fcf];return _0x4c5d72;};'use strict';var Sequelize=require(_0xb01d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb01d('0x1')]},'write':{'type':Sequelize[_0xb01d('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 f8d5369..588e13f 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 _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 +var _0x3725=['include','create','body','find','describe','getUnread','ChatInternalMessage','toInteger','omit','findOne','User','order','getMembers','hasOwnProperty','removeMembers','ids','ChatGroupId','getMessages','$gte','split','format','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','ChatGroup','findAll','catch','show','params','keys','length'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3725,0x1f0));var _0x5372=function(_0x17a932,_0x472274){_0x17a932=_0x17a932-0x0;var _0xb10aef=_0x3725[_0x17a932];return _0xb10aef;};'use strict';var emlformat=require(_0x5372('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5372('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5372('0x2'));var moment=require(_0x5372('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5372('0x4'));var util=require(_0x5372('0x5'));var path=require(_0x5372('0x6'));var sox=require(_0x5372('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5372('0x8'));var _=require(_0x5372('0x9'));var squel=require(_0x5372('0xa'));var crypto=require('crypto');var jsforce=require(_0x5372('0xb'));var deskjs=require(_0x5372('0xc'));var toCsv=require(_0x5372('0xd'));var querystring=require(_0x5372('0xe'));var Papa=require(_0x5372('0xf'));var Redis=require('ioredis');var authService=require(_0x5372('0x10'));var qs=require(_0x5372('0x11'));var as=require(_0x5372('0x12'));var hardwareService=require(_0x5372('0x13'));var logger=require('../../config/logger')(_0x5372('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5372('0x15'));var db=require(_0x5372('0x16'))['db'];config[_0x5372('0x17')]=_['defaults'](config[_0x5372('0x17')],{'host':_0x5372('0x18'),'port':0x18eb});var socket=require(_0x5372('0x19'))(new Redis(config[_0x5372('0x17')]));require('./chatGroup.socket')[_0x5372('0x1a')](socket);function respondWithStatusCode(_0x4bfa9e,_0x2fcae9){_0x2fcae9=_0x2fcae9||0xcc;return function(_0x3d7780){if(_0x3d7780){return _0x4bfa9e['sendStatus'](_0x2fcae9);}return _0x4bfa9e[_0x5372('0x1b')](_0x2fcae9)[_0x5372('0x1c')]();};}function respondWithResult(_0x2ac10f,_0x3309f0){_0x3309f0=_0x3309f0||0xc8;return function(_0x423417){if(_0x423417){return _0x2ac10f[_0x5372('0x1b')](_0x3309f0)[_0x5372('0x1d')](_0x423417);}};}function respondWithFilteredResult(_0x5f43fa,_0x3158b7){return function(_0x58254f){if(_0x58254f){var _0x101273=typeof _0x3158b7['offset']==='undefined'&&typeof _0x3158b7[_0x5372('0x1e')]===_0x5372('0x1f');var _0x183a7b=_0x58254f[_0x5372('0x20')];var _0x156b8c=_0x101273?0x0:_0x3158b7[_0x5372('0x21')];var _0x34a81d=_0x101273?_0x58254f['count']:_0x3158b7[_0x5372('0x21')]+_0x3158b7[_0x5372('0x1e')];var _0x16572c;if(_0x34a81d>=_0x183a7b){_0x34a81d=_0x183a7b;_0x16572c=0xc8;}else{_0x16572c=0xce;}_0x5f43fa['status'](_0x16572c);return _0x5f43fa[_0x5372('0x22')](_0x5372('0x23'),_0x156b8c+'-'+_0x34a81d+'/'+_0x183a7b)[_0x5372('0x1d')](_0x58254f);}return null;};}function patchUpdates(_0x3aae6f){return function(_0x594d70){try{jsonpatch[_0x5372('0x24')](_0x594d70,_0x3aae6f,!![]);}catch(_0x53d382){return BPromise[_0x5372('0x25')](_0x53d382);}return _0x594d70[_0x5372('0x26')]();};}function saveUpdates(_0x39daf4,_0x69ebe8){return function(_0x966c99){if(_0x966c99){return _0x966c99['update'](_0x39daf4)[_0x5372('0x27')](function(_0x147773){return _0x147773;});}return null;};}function removeEntity(_0x38835d,_0x520a4f){return function(_0x132949){if(_0x132949){return _0x132949[_0x5372('0x28')]()['then'](function(){_0x38835d[_0x5372('0x1b')](0xcc)[_0x5372('0x1c')]();});}};}function handleEntityNotFound(_0xe6d220,_0x37302d){return function(_0x3c9d30){if(!_0x3c9d30){_0xe6d220[_0x5372('0x29')](0x194);}return _0x3c9d30;};}function handleError(_0x5afd3b,_0x1a2c7e){_0x1a2c7e=_0x1a2c7e||0x1f4;return function(_0x4a978a){logger[_0x5372('0x2a')](_0x4a978a[_0x5372('0x2b')]);if(_0x4a978a[_0x5372('0x2c')]){delete _0x4a978a[_0x5372('0x2c')];}_0x5afd3b['status'](_0x1a2c7e)[_0x5372('0x2d')](_0x4a978a);};}exports[_0x5372('0x2e')]=function(_0x287c53,_0x635ecf){var _0x3892bd={},_0x3ab642={},_0x287eae={'count':0x0,'rows':[]};var _0x556542=_['map'](db['ChatGroup'][_0x5372('0x2f')],function(_0xab96a9){return{'name':_0xab96a9[_0x5372('0x30')],'type':_0xab96a9[_0x5372('0x31')][_0x5372('0x32')]};});_0x3ab642[_0x5372('0x33')]=_[_0x5372('0x34')](_0x556542,'name');_0x3ab642[_0x5372('0x35')]=_['keys'](_0x287c53[_0x5372('0x35')]);_0x3ab642[_0x5372('0x36')]=_['intersection'](_0x3ab642[_0x5372('0x33')],_0x3ab642[_0x5372('0x35')]);_0x3892bd[_0x5372('0x37')]=_[_0x5372('0x38')](_0x3ab642[_0x5372('0x33')],qs[_0x5372('0x39')](_0x287c53[_0x5372('0x35')][_0x5372('0x39')]));_0x3892bd[_0x5372('0x37')]=_0x3892bd[_0x5372('0x37')]['length']?_0x3892bd[_0x5372('0x37')]:_0x3ab642[_0x5372('0x33')];if(!_0x287c53['query']['hasOwnProperty'](_0x5372('0x3a'))){_0x3892bd[_0x5372('0x1e')]=qs[_0x5372('0x1e')](_0x287c53[_0x5372('0x35')][_0x5372('0x1e')]);_0x3892bd[_0x5372('0x21')]=qs['offset'](_0x287c53[_0x5372('0x35')][_0x5372('0x21')]);}_0x3892bd['order']=qs[_0x5372('0x3b')](_0x287c53['query'][_0x5372('0x3b')]);_0x3892bd[_0x5372('0x3c')]=qs[_0x5372('0x36')](_[_0x5372('0x3d')](_0x287c53[_0x5372('0x35')],_0x3ab642[_0x5372('0x36')]),_0x556542);if(_0x287c53['query'][_0x5372('0x3e')]){_0x3892bd[_0x5372('0x3c')]=_[_0x5372('0x3f')](_0x3892bd[_0x5372('0x3c')],{'$or':_[_0x5372('0x34')](_0x556542,function(_0x48bd1b){if(_0x48bd1b[_0x5372('0x31')]!==_0x5372('0x40')){var _0x5f4d15={};_0x5f4d15[_0x48bd1b['name']]={'$like':'%'+_0x287c53[_0x5372('0x35')][_0x5372('0x3e')]+'%'};return _0x5f4d15;}})});}_0x3892bd=_[_0x5372('0x3f')]({},_0x3892bd,_0x287c53[_0x5372('0x41')]);var _0x514fc9={'where':_0x3892bd['where']};return db['ChatGroup']['count'](_0x514fc9)[_0x5372('0x27')](function(_0x335a1e){_0x287eae[_0x5372('0x20')]=_0x335a1e;if(_0x287c53[_0x5372('0x35')][_0x5372('0x42')]){_0x3892bd['include']=[{'all':!![]}];}return db[_0x5372('0x43')][_0x5372('0x44')](_0x3892bd);})[_0x5372('0x27')](function(_0x1bd689){_0x287eae['rows']=_0x1bd689;return _0x287eae;})[_0x5372('0x27')](respondWithFilteredResult(_0x635ecf,_0x3892bd))[_0x5372('0x45')](handleError(_0x635ecf,null));};exports[_0x5372('0x46')]=function(_0x39a9aa,_0x3d96b7){var _0x53b085={'raw':!![],'where':{'id':_0x39a9aa[_0x5372('0x47')]['id']}},_0xfc2782={};_0xfc2782[_0x5372('0x33')]=_['keys'](db[_0x5372('0x43')]['rawAttributes']);_0xfc2782[_0x5372('0x35')]=_[_0x5372('0x48')](_0x39a9aa[_0x5372('0x35')]);_0xfc2782['filters']=_[_0x5372('0x38')](_0xfc2782[_0x5372('0x33')],_0xfc2782[_0x5372('0x35')]);_0x53b085[_0x5372('0x37')]=_['intersection'](_0xfc2782[_0x5372('0x33')],qs[_0x5372('0x39')](_0x39a9aa['query'][_0x5372('0x39')]));_0x53b085[_0x5372('0x37')]=_0x53b085[_0x5372('0x37')][_0x5372('0x49')]?_0x53b085[_0x5372('0x37')]:_0xfc2782[_0x5372('0x33')];if(_0x39a9aa[_0x5372('0x35')][_0x5372('0x42')]){_0x53b085[_0x5372('0x4a')]=[{'all':!![]}];}_0x53b085=_[_0x5372('0x3f')]({},_0x53b085,_0x39a9aa[_0x5372('0x41')]);return db[_0x5372('0x43')]['find'](_0x53b085)[_0x5372('0x27')](handleEntityNotFound(_0x3d96b7,null))[_0x5372('0x27')](respondWithResult(_0x3d96b7,null))[_0x5372('0x45')](handleError(_0x3d96b7,null));};exports[_0x5372('0x4b')]=function(_0x387ed1,_0x1562b7){return db[_0x5372('0x43')]['create'](_0x387ed1['body'],{})[_0x5372('0x27')](respondWithResult(_0x1562b7,0xc9))[_0x5372('0x45')](handleError(_0x1562b7,null));};exports['update']=function(_0x4703bf,_0x4388d6){if(_0x4703bf[_0x5372('0x4c')]['id']){delete _0x4703bf[_0x5372('0x4c')]['id'];}return db[_0x5372('0x43')][_0x5372('0x4d')]({'where':{'id':_0x4703bf['params']['id']}})['then'](handleEntityNotFound(_0x4388d6,null))[_0x5372('0x27')](saveUpdates(_0x4703bf[_0x5372('0x4c')],null))[_0x5372('0x27')](respondWithResult(_0x4388d6,null))[_0x5372('0x45')](handleError(_0x4388d6,null));};exports[_0x5372('0x28')]=function(_0x470087,_0x1e820c){return db[_0x5372('0x43')][_0x5372('0x4d')]({'where':{'id':_0x470087['params']['id']}})[_0x5372('0x27')](handleEntityNotFound(_0x1e820c,null))[_0x5372('0x27')](removeEntity(_0x1e820c,null))[_0x5372('0x45')](handleError(_0x1e820c,null));};exports[_0x5372('0x4e')]=function(_0x1b1453,_0x1b3d61){return db['ChatGroup'][_0x5372('0x4e')]()[_0x5372('0x27')](respondWithResult(_0x1b3d61,null))[_0x5372('0x45')](handleError(_0x1b3d61,null));};exports[_0x5372('0x4f')]=function(_0x5c8fdb,_0x22fd29,_0x4d88e6){return db[_0x5372('0x50')][_0x5372('0x20')]({'where':{'ChatGroupId':_0x5c8fdb[_0x5372('0x47')]['id'],'ToId':_0x5c8fdb['user']['id'],'read':![]}})[_0x5372('0x27')](function(_0x4706ad){return{'id':_[_0x5372('0x51')](_0x5c8fdb[_0x5372('0x47')]['id']),'count':_0x4706ad};})[_0x5372('0x27')](respondWithResult(_0x22fd29,null))[_0x5372('0x45')](handleError(_0x22fd29,null));};exports['addMembers']=function(_0x9fbb9b,_0x3c969f,_0x45fa1c){return db['ChatGroup'][_0x5372('0x4d')]({'where':{'id':_0x9fbb9b[_0x5372('0x47')]['id']}})['then'](handleEntityNotFound(_0x3c969f,null))[_0x5372('0x27')](function(_0x558c44){if(_0x558c44){return _0x558c44['addMembers'](_0x9fbb9b[_0x5372('0x4c')]['ids'],_[_0x5372('0x52')](_0x9fbb9b[_0x5372('0x4c')],['ids','id'])||{});}})[_0x5372('0x27')](respondWithResult(_0x3c969f,null))[_0x5372('0x45')](handleError(_0x3c969f,null));};exports['getMembers']=function(_0x5eaa05,_0x430d37,_0xaef16f){var _0x51be5d={};var _0x6ad3e1={};var _0x182e22;var _0x5332b0;return db[_0x5372('0x43')][_0x5372('0x53')]({'where':{'id':_0x5eaa05[_0x5372('0x47')]['id']}})[_0x5372('0x27')](handleEntityNotFound(_0x430d37,null))[_0x5372('0x27')](function(_0x50e088){if(_0x50e088){_0x182e22=_0x50e088;_0x6ad3e1['model']=_[_0x5372('0x48')](db[_0x5372('0x54')][_0x5372('0x2f')]);_0x6ad3e1[_0x5372('0x35')]=_[_0x5372('0x48')](_0x5eaa05[_0x5372('0x35')]);_0x6ad3e1['filters']=_[_0x5372('0x38')](_0x6ad3e1['model'],_0x6ad3e1[_0x5372('0x35')]);_0x51be5d[_0x5372('0x37')]=_['intersection'](_0x6ad3e1[_0x5372('0x33')],qs['fields'](_0x5eaa05['query'][_0x5372('0x39')]));_0x51be5d[_0x5372('0x37')]=_0x51be5d[_0x5372('0x37')][_0x5372('0x49')]?_0x51be5d[_0x5372('0x37')]:_0x6ad3e1['model'];_0x51be5d[_0x5372('0x55')]=qs['sort'](_0x5eaa05[_0x5372('0x35')][_0x5372('0x3b')]);_0x51be5d['where']=qs['filters'](_[_0x5372('0x3d')](_0x5eaa05['query'],_0x6ad3e1[_0x5372('0x36')]));if(_0x5eaa05['query'][_0x5372('0x3e')]){_0x51be5d['where']=_[_0x5372('0x3f')](_0x51be5d['where'],{'$or':_['map'](_0x51be5d['attributes'],function(_0x3733f7){var _0x312bab={};_0x312bab[_0x3733f7]={'$like':'%'+_0x5eaa05[_0x5372('0x35')][_0x5372('0x3e')]+'%'};return _0x312bab;})});}_0x51be5d=_['merge']({},_0x51be5d,_0x5eaa05[_0x5372('0x41')]);return _0x182e22[_0x5372('0x56')](_0x51be5d);}})[_0x5372('0x27')](function(_0x38aa6c){if(_0x38aa6c){_0x5332b0=_0x38aa6c[_0x5372('0x49')];if(!_0x5eaa05[_0x5372('0x35')][_0x5372('0x57')](_0x5372('0x3a'))){_0x51be5d[_0x5372('0x1e')]=qs[_0x5372('0x1e')](_0x5eaa05[_0x5372('0x35')][_0x5372('0x1e')]);_0x51be5d[_0x5372('0x21')]=qs[_0x5372('0x21')](_0x5eaa05['query'][_0x5372('0x21')]);}return _0x182e22['getMembers'](_0x51be5d);}})[_0x5372('0x27')](function(_0x10b401){if(_0x10b401){return _0x10b401?{'count':_0x5332b0,'rows':_0x10b401}:null;}})[_0x5372('0x27')](respondWithResult(_0x430d37,null))['catch'](handleError(_0x430d37,null));};exports['removeMembers']=function(_0x31c99e,_0x455759,_0x531705){return db[_0x5372('0x43')][_0x5372('0x4d')]({'where':{'id':_0x31c99e[_0x5372('0x47')]['id']}})['then'](handleEntityNotFound(_0x455759,null))['then'](function(_0xc474c1){if(_0xc474c1){return _0xc474c1[_0x5372('0x58')](_0x31c99e[_0x5372('0x35')][_0x5372('0x59')]);}})[_0x5372('0x27')](respondWithStatusCode(_0x455759,null))[_0x5372('0x45')](handleError(_0x455759,null));};exports['addMessage']=function(_0x253917,_0x17dfd1,_0x11023f){if(_0x253917[_0x5372('0x4c')]['id']){delete _0x253917['body']['id'];}return db[_0x5372('0x43')][_0x5372('0x4d')]({'where':{'id':_0x253917[_0x5372('0x47')]['id']}})[_0x5372('0x27')](handleEntityNotFound(_0x17dfd1,null))[_0x5372('0x27')](function(_0x3b3e56){if(_0x3b3e56){_0x253917['body'][_0x5372('0x5a')]=_0x3b3e56['id'];return db[_0x5372('0x50')]['create'](_0x253917[_0x5372('0x4c')]);}})[_0x5372('0x27')](respondWithResult(_0x17dfd1,null))[_0x5372('0x45')](handleError(_0x17dfd1,null));};exports[_0x5372('0x5b')]=function(_0x4e2212,_0x2b96bb,_0x598e80){var _0x2d1225={};var _0x3987ec={};var _0x6253b;var _0x512735;return db[_0x5372('0x43')][_0x5372('0x53')]({'where':{'id':_0x4e2212[_0x5372('0x47')]['id']}})[_0x5372('0x27')](handleEntityNotFound(_0x2b96bb,null))['then'](function(_0x2f4762){if(_0x2f4762){_0x6253b=_0x2f4762;_0x3987ec['model']=_[_0x5372('0x48')](db[_0x5372('0x50')][_0x5372('0x2f')]);_0x3987ec[_0x5372('0x35')]=_[_0x5372('0x48')](_0x4e2212[_0x5372('0x35')]);_0x3987ec[_0x5372('0x36')]=_[_0x5372('0x38')](_0x3987ec[_0x5372('0x33')],_0x3987ec[_0x5372('0x35')]);_0x2d1225['attributes']=_[_0x5372('0x38')](_0x3987ec['model'],qs[_0x5372('0x39')](_0x4e2212['query'][_0x5372('0x39')]));_0x2d1225[_0x5372('0x37')]=_0x2d1225['attributes'][_0x5372('0x49')]?_0x2d1225[_0x5372('0x37')]:_0x3987ec['model'];_0x2d1225[_0x5372('0x55')]=qs[_0x5372('0x3b')](_0x4e2212[_0x5372('0x35')][_0x5372('0x3b')]);_0x2d1225[_0x5372('0x3c')]=qs[_0x5372('0x36')](_[_0x5372('0x3d')](_0x4e2212['query'],_0x3987ec[_0x5372('0x36')]));if(_0x4e2212['query'][_0x5372('0x3e')]){_0x2d1225[_0x5372('0x3c')]=_[_0x5372('0x3f')](_0x2d1225['where'],{'$or':_[_0x5372('0x34')](_0x2d1225[_0x5372('0x37')],function(_0x77ec6a){var _0x3e268c={};_0x3e268c[_0x77ec6a]={'$like':'%'+_0x4e2212['query'][_0x5372('0x3e')]+'%'};return _0x3e268c;})});}if(_0x4e2212[_0x5372('0x35')][_0x5372('0x5c')]){var _0x2d3464=_0x4e2212[_0x5372('0x35')]['$gte'][_0x5372('0x5d')](',');var _0xd8d4aa={};_0xd8d4aa[_0x2d3464[0x0]]={'$gte':moment(_0x2d3464[0x1])[_0x5372('0x5e')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2d1225[_0x5372('0x3c')]=_['merge'](_0x2d1225['where'],_0xd8d4aa);}_0x2d1225=_[_0x5372('0x3f')]({},_0x2d1225,_0x4e2212[_0x5372('0x41')]);return _0x6253b[_0x5372('0x5b')](_0x2d1225);}})[_0x5372('0x27')](function(_0x181c7e){if(_0x181c7e){_0x512735=_0x181c7e[_0x5372('0x49')];if(!_0x4e2212['query'][_0x5372('0x57')](_0x5372('0x3a'))){_0x2d1225[_0x5372('0x1e')]=qs[_0x5372('0x1e')](_0x4e2212[_0x5372('0x35')][_0x5372('0x1e')]);_0x2d1225[_0x5372('0x21')]=qs[_0x5372('0x21')](_0x4e2212[_0x5372('0x35')]['offset']);}return _0x6253b[_0x5372('0x5b')](_0x2d1225);}})[_0x5372('0x27')](function(_0x2bc144){if(_0x2bc144){return _0x2bc144?{'count':_0x512735,'rows':_0x2bc144}:null;}})[_0x5372('0x27')](respondWithResult(_0x2b96bb,null))[_0x5372('0x45')](handleError(_0x2b96bb,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 0805654..598dadf 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 _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 +var _0xd237=['emit','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','update'];(function(_0x29f06c,_0x2af734){var _0x4b8359=function(_0x3eeef8){while(--_0x3eeef8){_0x29f06c['push'](_0x29f06c['shift']());}};_0x4b8359(++_0x2af734);}(_0xd237,0x12b));var _0x7d23=function(_0x4b4b1a,_0x276dd5){_0x4b4b1a=_0x4b4b1a-0x0;var _0x5056ec=_0xd237[_0x4b4b1a];return _0x5056ec;};'use strict';var EventEmitter=require(_0x7d23('0x0'));var ChatGroup=require(_0x7d23('0x1'))['db'][_0x7d23('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x7d23('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7d23('0x4'),'afterDestroy':'remove'};function emitEvent(_0x288134){return function(_0x2c0505,_0x2bc609,_0x39ec94){ChatGroupEvents[_0x7d23('0x5')](_0x288134+':'+_0x2c0505['id'],_0x2c0505);ChatGroupEvents['emit'](_0x288134,_0x2c0505);_0x39ec94(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x7d23('0x6')](e,emitEvent(event));}}module[_0x7d23('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 2cfdfd2..1d1386e 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 _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 +var _0x09e8=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util'];(function(_0x2671be,_0x5ce4fa){var _0x386b62=function(_0x5a0f5a){while(--_0x5a0f5a){_0x2671be['push'](_0x2671be['shift']());}};_0x386b62(++_0x5ce4fa);}(_0x09e8,0xf5));var _0x809e=function(_0x394be4,_0x56ca61){_0x394be4=_0x394be4-0x0;var _0x30218e=_0x09e8[_0x394be4];return _0x30218e;};'use strict';var _=require(_0x809e('0x0'));var util=require(_0x809e('0x1'));var logger=require(_0x809e('0x2'))(_0x809e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x809e('0x4'));var fs=require('fs');var path=require(_0x809e('0x5'));var rimraf=require(_0x809e('0x6'));var config=require(_0x809e('0x7'));var attributes=require(_0x809e('0x8'));module[_0x809e('0x9')]=function(_0x4d44e6,_0x3f8c1d){return _0x4d44e6[_0x809e('0xa')](_0x809e('0xb'),attributes,{'tableName':_0x809e('0xc'),'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 a36898f..58eb9c8 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 _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 +var _0xa1f6=['ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','jayson/promise','client','http','redis','defaults','localhost','./chatGroup.socket','register','request','then','info','request\x20sent','debug'];(function(_0xf6b083,_0x49a944){var _0x529170=function(_0x1dd2b9){while(--_0x1dd2b9){_0xf6b083['push'](_0xf6b083['shift']());}};_0x529170(++_0x49a944);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x104a84,_0x285970){_0x104a84=_0x104a84-0x0;var _0x4973ff=_0xa1f6[_0x104a84];return _0x4973ff;};'use strict';var _=require(_0x6a1f('0x0'));var util=require(_0x6a1f('0x1'));var moment=require(_0x6a1f('0x2'));var BPromise=require(_0x6a1f('0x3'));var rs=require(_0x6a1f('0x4'));var fs=require('fs');var Redis=require(_0x6a1f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6a1f('0x6'));var client=jayson[_0x6a1f('0x7')][_0x6a1f('0x8')]({'port':0x232a});config[_0x6a1f('0x9')]=_[_0x6a1f('0xa')](config[_0x6a1f('0x9')],{'host':_0x6a1f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6a1f('0x9')]));require(_0x6a1f('0xc'))[_0x6a1f('0xd')](socket);function respondWithRpcPromise(_0x287e54,_0x1617b7,_0x5aafd2){return new BPromise(function(_0x30fd4e,_0x17f866){return client[_0x6a1f('0xe')](_0x287e54,_0x5aafd2)[_0x6a1f('0xf')](function(_0x59fc17){logger[_0x6a1f('0x10')]('ChatGroup,\x20%s,\x20%s',_0x1617b7,_0x6a1f('0x11'));logger[_0x6a1f('0x12')](_0x6a1f('0x13'),_0x1617b7,_0x6a1f('0x11'),JSON[_0x6a1f('0x14')](_0x59fc17));if(_0x59fc17[_0x6a1f('0x15')]){if(_0x59fc17[_0x6a1f('0x15')][_0x6a1f('0x16')]===0x1f4){logger[_0x6a1f('0x15')](_0x6a1f('0x17'),_0x1617b7,_0x59fc17[_0x6a1f('0x15')][_0x6a1f('0x18')]);return _0x17f866(_0x59fc17[_0x6a1f('0x15')][_0x6a1f('0x18')]);}logger[_0x6a1f('0x15')](_0x6a1f('0x17'),_0x1617b7,_0x59fc17[_0x6a1f('0x15')][_0x6a1f('0x18')]);return _0x30fd4e(_0x59fc17[_0x6a1f('0x15')]['message']);}else{logger[_0x6a1f('0x10')](_0x6a1f('0x17'),_0x1617b7,_0x6a1f('0x11'));_0x30fd4e(_0x59fc17[_0x6a1f('0x19')][_0x6a1f('0x18')]);}})[_0x6a1f('0x1a')](function(_0x19562a){logger[_0x6a1f('0x15')]('ChatGroup,\x20%s,\x20%s',_0x1617b7,_0x19562a);_0x17f866(_0x19562a);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 56d51d7..e8c1ef3 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 _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 +var _0x3265=['register','length','chatGroup:','remove','update','emit'];(function(_0x3252f7,_0x1678e5){var _0x591cf0=function(_0x2b3e53){while(--_0x2b3e53){_0x3252f7['push'](_0x3252f7['shift']());}};_0x591cf0(++_0x1678e5);}(_0x3265,0x165));var _0x5326=function(_0x4d804e,_0x33b1ef){_0x4d804e=_0x4d804e-0x0;var _0x645a8e=_0x3265[_0x4d804e];return _0x645a8e;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=['save',_0x5326('0x0'),_0x5326('0x1')];function createListener(_0x43d80f,_0x505003){return function(_0x3dbd91){_0x505003[_0x5326('0x2')](_0x43d80f,_0x3dbd91);};}function removeListener(_0x1a81e9,_0x5d6785){return function(){ChatGroupEvents['removeListener'](_0x1a81e9,_0x5d6785);};}exports[_0x5326('0x3')]=function(_0x5b2830){for(var _0x5a1974=0x0,_0x5c130f=events[_0x5326('0x4')];_0x5a1974<_0x5c130f;_0x5a1974++){var _0x4a1241=events[_0x5a1974];var _0x357625=createListener(_0x5326('0x5')+_0x4a1241,_0x5b2830);ChatGroupEvents['on'](_0x4a1241,_0x357625);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 7c12e06..d1f6315 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 _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 +var _0x5974=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','index','describe','/:id','isAuthenticated','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','put','destroy','delete','removeMembers','exports','multer','path'];(function(_0x112595,_0x50b0c2){var _0x4b2ea7=function(_0x42253f){while(--_0x42253f){_0x112595['push'](_0x112595['shift']());}};_0x4b2ea7(++_0x50b0c2);}(_0x5974,0x11c));var _0x4597=function(_0x255c48,_0x2a4449){_0x255c48=_0x255c48-0x0;var _0xaebda3=_0x5974[_0x255c48];return _0xaebda3;};'use strict';var multer=require(_0x4597('0x0'));var util=require('util');var path=require(_0x4597('0x1'));var timeout=require(_0x4597('0x2'));var express=require(_0x4597('0x3'));var router=express['Router']();var fs_extra=require(_0x4597('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4597('0x5'));var config=require(_0x4597('0x6'));var controller=require(_0x4597('0x7'));router[_0x4597('0x8')]('/',auth['isAuthenticated'](),controller[_0x4597('0x9')]);router[_0x4597('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x4597('0xa')]);router[_0x4597('0x8')](_0x4597('0xb'),auth[_0x4597('0xc')](),controller[_0x4597('0xd')]);router[_0x4597('0x8')](_0x4597('0xe'),auth[_0x4597('0xc')](),controller[_0x4597('0xf')]);router[_0x4597('0x8')](_0x4597('0x10'),auth['isAuthenticated'](),controller[_0x4597('0x11')]);router[_0x4597('0x8')](_0x4597('0x12'),auth[_0x4597('0xc')](),controller[_0x4597('0x13')]);router[_0x4597('0x14')]('/',auth[_0x4597('0xc')](),controller['create']);router[_0x4597('0x14')](_0x4597('0x10'),auth[_0x4597('0xc')](),controller['addMembers']);router[_0x4597('0x14')]('/:id/messages',auth[_0x4597('0xc')](),controller['addMessage']);router[_0x4597('0x15')](_0x4597('0xb'),auth[_0x4597('0xc')](),controller['update']);router['delete'](_0x4597('0xb'),auth['isAuthenticated'](),controller[_0x4597('0x16')]);router[_0x4597('0x17')](_0x4597('0x10'),auth[_0x4597('0xc')](),controller[_0x4597('0x18')]);module[_0x4597('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 843d7fc..0aaa1ba 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 _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 +var _0xc776=['ENUM','out','sequelize','exports','BOOLEAN','INTEGER','thumb','star','TEXT','STRING','DATE','long'];(function(_0x211083,_0x14b2ba){var _0x16f197=function(_0x4786df){while(--_0x4786df){_0x211083['push'](_0x211083['shift']());}};_0x16f197(++_0x14b2ba);}(_0xc776,0x19a));var _0x6c77=function(_0x389ec3,_0x54d22c){_0x389ec3=_0x389ec3-0x0;var _0x16ed5a=_0xc776[_0x389ec3];return _0x16ed5a;};'use strict';var Sequelize=require(_0x6c77('0x0'));module[_0x6c77('0x1')]={'closed':{'type':Sequelize[_0x6c77('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x6c77('0x3')]},'ratingType':{'type':Sequelize['ENUM']('star',_0x6c77('0x4')),'defaultValue':_0x6c77('0x5')},'ratingMessage':{'type':Sequelize[_0x6c77('0x6')]},'pathTranscript':{'type':Sequelize[_0x6c77('0x6')]},'mailTranscript':{'type':Sequelize[_0x6c77('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x6c77('0x8')]},'disposition':{'type':Sequelize[_0x6c77('0x7')]},'secondDisposition':{'type':Sequelize[_0x6c77('0x7')]},'thirdDisposition':{'type':Sequelize[_0x6c77('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x6c77('0x7')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x6c77('0x7')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x6c77('0x7')]},'deviceType':{'type':Sequelize[_0x6c77('0x7')]},'referer':{'type':Sequelize[_0x6c77('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x6c77('0x6')](_0x6c77('0x9'))},'read1stAt':{'type':Sequelize[_0x6c77('0x8')]},'lastMsgAt':{'type':Sequelize[_0x6c77('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x6c77('0xa')]('in',_0x6c77('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x6c77('0x7')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x6c77('0x6')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index ff6d740..28ad221 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 _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 +var _0x7280=['originalname','mimetype','Attachment','Unauthorized','attachId','root','join','basename','close','mailTranscript','transcript-%s.txt','now','ChatMessage','Messages','User','format','%s%d','agentAlias','customer','Visitor','ContactId','agentIdentifier','System','[%s]\x20%s:\x20%s\x0a','direction','secret','appendFileSync','MailAccount','MailServerOut','CloudProvider','Smtp','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','filters','fields','hasOwnProperty','nolimit','order','sort','pick','where','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','include','rows','getMyMessages','includeAgent','push','alias','addTags','spread','Tag','color','removeTags','download','toString','tmp','server','files','attachments','transcript-%d-%s.zip','firstName','lastName','createdAt','read','Owner','Chat','Account','N.A.','closedAt','browserName','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','views','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','mustache','util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../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','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','stack','name','send','render','merge','body','contact','agent','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','getOptions','findAll','chat','show','params','model','query','keys','attributes','intersection','length','includeAll','create','find','describe','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','user','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file'];(function(_0x285592,_0x98b4f9){var _0x3ee37b=function(_0x4a46b){while(--_0x4a46b){_0x285592['push'](_0x285592['shift']());}};_0x3ee37b(++_0x98b4f9);}(_0x7280,0x12a));var _0x0728=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x7280[_0x50a0c2];return _0x5ebadd;};'use strict';var rimraf=require(_0x0728('0x0'));var zipdir=require(_0x0728('0x1'));var rp=require(_0x0728('0x2'));var moment=require(_0x0728('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0728('0x4'));var util=require(_0x0728('0x5'));var path=require(_0x0728('0x6'));var ejs=require(_0x0728('0x7'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x0728('0x8'));var interaction=require(_0x0728('0x9'));var qs=require(_0x0728('0xa'));var pdf=require(_0x0728('0xb'));var logger=require(_0x0728('0xc'))(_0x0728('0xd'));var config=require(_0x0728('0xe'));var db=require('../../mysqldb')['db'];config[_0x0728('0xf')]=_[_0x0728('0x10')](config[_0x0728('0xf')],{'host':_0x0728('0x11'),'port':0x18eb});var socket=require(_0x0728('0x12'))(new Redis(config[_0x0728('0xf')]));require('./chatInteraction.socket')[_0x0728('0x13')](socket);var jayson=require(_0x0728('0x14'));var client=jayson[_0x0728('0x15')][_0x0728('0x16')]({'port':0x232b});var client9004=jayson['client'][_0x0728('0x16')]({'port':0x232c});function respondWithRpcPromise(_0x1efeaa,_0x121165,_0x4e2c0e,_0x5c90fb){return new BPromise(function(_0x3d10f9,_0x916d3c){var _0x36265c=_0x5c90fb||client;return _0x36265c[_0x0728('0x17')](_0x1efeaa,_0x4e2c0e)[_0x0728('0x18')](function(_0x565ed0){logger[_0x0728('0x19')](_0x0728('0x1a'),_0x121165,_0x0728('0x1b'));logger[_0x0728('0x1c')](_0x0728('0x1d'),_0x121165,_0x0728('0x1b'),JSON[_0x0728('0x1e')](_0x565ed0));if(_0x565ed0['error']){if(_0x565ed0[_0x0728('0x1f')][_0x0728('0x20')]===0x1f4){logger[_0x0728('0x1f')](_0x0728('0x1a'),_0x121165,_0x565ed0['error'][_0x0728('0x21')]);return _0x916d3c(_0x565ed0[_0x0728('0x1f')][_0x0728('0x21')]);}logger['error'](_0x0728('0x1a'),_0x121165,_0x565ed0[_0x0728('0x1f')][_0x0728('0x21')]);return _0x3d10f9(_0x565ed0[_0x0728('0x1f')][_0x0728('0x21')]);}else{logger[_0x0728('0x19')](_0x0728('0x1a'),_0x121165,_0x0728('0x1b'));_0x3d10f9(_0x565ed0[_0x0728('0x22')][_0x0728('0x21')]);}})[_0x0728('0x23')](function(_0x509b67){logger[_0x0728('0x1f')](_0x0728('0x1a'),_0x121165,_0x509b67);_0x916d3c(_0x509b67);});});}function respondWithStatusCode(_0x390d9b,_0x40f572){_0x40f572=_0x40f572||0xcc;return function(_0x1cfcec){if(_0x1cfcec){return _0x390d9b[_0x0728('0x24')](_0x40f572);}return _0x390d9b[_0x0728('0x25')](_0x40f572)[_0x0728('0x26')]();};}function respondWithResult(_0x3dbc4a,_0x1ab55f){_0x1ab55f=_0x1ab55f||0xc8;return function(_0x27bc9e){if(_0x27bc9e){return _0x3dbc4a[_0x0728('0x25')](_0x1ab55f)[_0x0728('0x27')](_0x27bc9e);}};}function respondWithFilteredResult(_0x29091a,_0xa6121a){return function(_0xe3164){if(_0xe3164){var _0x1ccba8=typeof _0xa6121a[_0x0728('0x28')]===_0x0728('0x29')&&typeof _0xa6121a[_0x0728('0x2a')]===_0x0728('0x29');var _0x128a49=_0xe3164[_0x0728('0x2b')];var _0x5d64e6=_0x1ccba8?0x0:_0xa6121a[_0x0728('0x28')];var _0x35a219=_0x1ccba8?_0xe3164['count']:_0xa6121a[_0x0728('0x28')]+_0xa6121a[_0x0728('0x2a')];var _0x559ac3;if(_0x35a219>=_0x128a49){_0x35a219=_0x128a49;_0x559ac3=0xc8;}else{_0x559ac3=0xce;}_0x29091a['status'](_0x559ac3);return _0x29091a[_0x0728('0x2c')](_0x0728('0x2d'),_0x5d64e6+'-'+_0x35a219+'/'+_0x128a49)['json'](_0xe3164);}return null;};}function saveUpdates(_0x5272f6){return function(_0x553253){if(_0x553253){return _0x553253['update'](_0x5272f6)[_0x0728('0x18')](function(_0x1a254f){return _0x1a254f;});}return null;};}function removeEntity(_0x1aed4a){return function(_0x14e0ad){if(_0x14e0ad){return _0x14e0ad[_0x0728('0x2e')]()[_0x0728('0x18')](function(){_0x1aed4a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x45f63d){return function(_0x12117c){if(!_0x12117c){_0x45f63d[_0x0728('0x24')](0x194);}return _0x12117c;};}function handleError(_0x1f30ee,_0x219f1f){_0x219f1f=_0x219f1f||0x1f4;return function(_0x5a8cf2){logger[_0x0728('0x1f')](_0x5a8cf2[_0x0728('0x2f')]);if(_0x5a8cf2[_0x0728('0x30')]){delete _0x5a8cf2['name'];}_0x1f30ee[_0x0728('0x25')](_0x219f1f)[_0x0728('0x31')](_0x5a8cf2);};}function getMustacheRender(_0x2aded2,_0x468a16){return Mustache[_0x0728('0x32')](_0x2aded2,_[_0x0728('0x33')](_0x468a16[_0x0728('0x34')],{'contact':_0x468a16[_0x0728('0x35')],'message':_0x468a16[_0x0728('0x21')],'agent':_0x468a16[_0x0728('0x36')],'interaction':_0x468a16[_0x0728('0x37')],'account':_0x468a16[_0x0728('0x38')]}))||'';}exports[_0x0728('0x39')]=function(_0x276699,_0x45ee49){var _0x77a394={};var _0x3af80b=_[_0x0728('0x3a')](db[_0x0728('0x3b')][_0x0728('0x3c')],function(_0x314042){return{'name':_0x314042[_0x0728('0x3d')],'type':_0x314042[_0x0728('0x3e')]['key']};});_0x77a394=qs[_0x0728('0x3f')](_0x3af80b,_0x276699);return interaction[_0x0728('0x40')](_0x0728('0x41'),_0x276699['query'],_0x276699['user'],_0x77a394,_0x3af80b)[_0x0728('0x18')](respondWithFilteredResult(_0x45ee49,_0x77a394))[_0x0728('0x23')](handleError(_0x45ee49,null));};exports[_0x0728('0x42')]=function(_0x44c475,_0x267f78){var _0x101352={'raw':![],'where':{'id':_0x44c475[_0x0728('0x43')]['id']}},_0x489ae6={};_0x489ae6[_0x0728('0x44')]=_['keys'](db[_0x0728('0x3b')][_0x0728('0x3c')]);_0x489ae6[_0x0728('0x45')]=_[_0x0728('0x46')](_0x44c475[_0x0728('0x45')]);_0x489ae6['filters']=_['intersection'](_0x489ae6[_0x0728('0x44')],_0x489ae6[_0x0728('0x45')]);_0x101352[_0x0728('0x47')]=_[_0x0728('0x48')](_0x489ae6[_0x0728('0x44')],qs['fields'](_0x44c475['query']['fields']));_0x101352[_0x0728('0x47')]=_0x101352[_0x0728('0x47')][_0x0728('0x49')]?_0x101352[_0x0728('0x47')]:_0x489ae6['model'];if(_0x44c475[_0x0728('0x45')][_0x0728('0x4a')]){_0x101352['include']=[{'all':!![]}];}_0x101352=_[_0x0728('0x33')]({},_0x101352,_0x44c475['options']);return db['ChatInteraction']['find'](_0x101352)['then'](handleEntityNotFound(_0x267f78,null))[_0x0728('0x18')](respondWithResult(_0x267f78,null))[_0x0728('0x23')](handleError(_0x267f78,null));};exports['create']=function(_0x330ca0,_0x4ad37a){return db[_0x0728('0x3b')][_0x0728('0x4b')](_0x330ca0[_0x0728('0x34')],{})[_0x0728('0x18')](respondWithResult(_0x4ad37a,0xc9))[_0x0728('0x23')](handleError(_0x4ad37a,null));};exports['update']=function(_0x2f8878,_0x89aabf){if(_0x2f8878[_0x0728('0x34')]['id']){delete _0x2f8878[_0x0728('0x34')]['id'];}return db[_0x0728('0x3b')][_0x0728('0x4c')]({'where':{'id':_0x2f8878['params']['id']}})['then'](handleEntityNotFound(_0x89aabf,null))['then'](saveUpdates(_0x2f8878[_0x0728('0x34')],null))[_0x0728('0x18')](respondWithResult(_0x89aabf,null))[_0x0728('0x23')](handleError(_0x89aabf,null));};exports[_0x0728('0x2e')]=function(_0x4112d8,_0x4fd648){return db['ChatInteraction'][_0x0728('0x4c')]({'where':{'id':_0x4112d8[_0x0728('0x43')]['id']}})['then'](handleEntityNotFound(_0x4fd648,null))[_0x0728('0x18')](removeEntity(_0x4fd648,null))[_0x0728('0x23')](handleError(_0x4fd648,null));};exports[_0x0728('0x4d')]=function(_0xc3124d,_0x2fec06){return db['ChatInteraction'][_0x0728('0x4d')]()[_0x0728('0x18')](respondWithResult(_0x2fec06,null))['catch'](handleError(_0x2fec06,null));};exports['createVidaooSession']=function(_0x5d45db,_0x4c52f1){var _0x3666d5=_0x5d45db['params']['id'];var _0x6f64c2;var _0x21ce97;var _0x3c45d9;return db['ChatInteraction'][_0x0728('0x4e')]({'where':{'id':_0x3666d5}})[_0x0728('0x18')](function(_0xdc657e){_0x6f64c2=_0xdc657e;return db[_0x0728('0x4f')][_0x0728('0x4e')]({'where':{'id':_0xdc657e['ChatWebsiteId']},'attributes':['id',_0x0728('0x50'),_0x0728('0x51'),_0x0728('0x52'),_0x0728('0x53'),_0x0728('0x54')],'raw':!![]});})[_0x0728('0x18')](function(_0x546f86){if(_0x546f86&&_0x546f86[_0x0728('0x50')]&&_0x546f86[_0x0728('0x51')]){_0x21ce97=_0x546f86;var _0x416f42={'interaction':{'id':_0x3666d5},'agent':{'id':_0x5d45db[_0x0728('0x55')]['id'],'name':_0x5d45db[_0x0728('0x55')]['name'],'fullname':_0x5d45db[_0x0728('0x55')][_0x0728('0x56')],'email':_0x5d45db['user'][_0x0728('0x57')]},'contact':_0x5d45db['body'][_0x0728('0x35')],'account':_0x5d45db[_0x0728('0x34')][_0x0728('0x38')]};var _0x411620={'rejectUnauthorized':![],'method':_0x0728('0x58'),'url':_0x0728('0x59'),'headers':{'X-APIKEY':_0x546f86[_0x0728('0x50')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5d45db[_0x0728('0x55')][_0x0728('0x57')]],'buttons':null,'topic':_0x21ce97[_0x0728('0x52')],'note':_['isNull'](_0x21ce97[_0x0728('0x53')])?null:getMustacheRender(_0x21ce97[_0x0728('0x53')],_0x416f42),'metadata':null},'redirect':'follow','json':!![]};try{if(!_['isNull'](_0x21ce97[_0x0728('0x54')])){var _0x2322db=getMustacheRender(_0x21ce97['vidaooMetadata'],_0x416f42);var _0x109ad0=JSON['parse'](_0x2322db);_0x411620['body'][_0x0728('0x5a')]=_0x109ad0;}}catch(_0x953e4e){throw new db[(_0x0728('0x5b'))][(_0x0728('0x5c'))](_0x0728('0x5d'));}return rp(_0x411620);}else{throw new db['Sequelize'][(_0x0728('0x5c'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x0728('0x18')](function(_0x35e79c){_0x3c45d9=_0x35e79c;if(_0x3c45d9['id']){var _0x23798b={'body':_0x3c45d9[_0x0728('0x5e')],'ChatWebsiteId':_0x21ce97['id'],'ChatInteractionId':_0x6f64c2['id'],'direction':_0x0728('0x5f'),'UserId':_0x5d45db[_0x0728('0x55')]['id']};return db['ChatMessage']['create'](_0x23798b,{});}else{throw new db[(_0x0728('0x5b'))][(_0x0728('0x5c'))](_0x0728('0x60'));}})['then'](function(){return _0x6f64c2['updateAttributes']({'vidaooSessionId':_0x3c45d9['id']});})[_0x0728('0x18')](respondWithResult(_0x4c52f1,null))[_0x0728('0x23')](handleError(_0x4c52f1,null));};exports[_0x0728('0x61')]=function(_0xb61dac,_0x74b3ca){if(_0xb61dac[_0x0728('0x34')]['id']){delete _0xb61dac[_0x0728('0x34')]['id'];}return db[_0x0728('0x3b')][_0x0728('0x4c')]({'where':{'id':_0xb61dac[_0x0728('0x43')]['id']},'include':[{'model':db[_0x0728('0x62')],'as':_0x0728('0x63')}]})[_0x0728('0x18')](handleEntityNotFound(_0x74b3ca,null))[_0x0728('0x18')](saveUpdates(_0xb61dac[_0x0728('0x34')],null))['then'](respondWithResult(_0x74b3ca,null))[_0x0728('0x23')](handleError(_0x74b3ca,null));};exports['abandon']=function(_0x58f544,_0x5b4fea){if(_0x58f544[_0x0728('0x34')]['id']){delete _0x58f544['body']['id'];}return db[_0x0728('0x3b')][_0x0728('0x4c')]({'where':{'id':_0x58f544[_0x0728('0x43')]['id']}})[_0x0728('0x18')](function(_0x455385){if(!_0x455385){logger[_0x0728('0x1f')](_0x0728('0x64'),_0x0728('0x65'),0x194,_0x0728('0x66'));_0x5b4fea[_0x0728('0x24')](0x194);}else{if(_0x455385[_0x0728('0x67')]){throw new db[(_0x0728('0x5b'))][(_0x0728('0x5c'))](_0x0728('0x68'));}}return _0x455385;})[_0x0728('0x18')](function(_0x4909d5){if(_0x4909d5){return _0x4909d5['update']({'closed':_0x58f544[_0x0728('0x34')][_0x0728('0x69')],'disposition':_0x58f544[_0x0728('0x34')][_0x0728('0x6a')]})['then'](function(_0x4a881d){return _0x4a881d;});}})[_0x0728('0x18')](function(){return respondWithRpcPromise(_0x0728('0x6b'),_0x0728('0x65'),_0x58f544[_0x0728('0x34')],client9004);})[_0x0728('0x18')](respondWithResult(_0x5b4fea,null))[_0x0728('0x23')](handleError(_0x5b4fea,null));};exports[_0x0728('0x6c')]=function(_0x4e4342,_0xc238be){_0x4e4342[_0x0728('0x34')][_0x0728('0x30')]=_0x4e4342[_0x0728('0x6d')][_0x0728('0x6e')];_0x4e4342['body']['basename']=_0x4e4342[_0x0728('0x6d')]['filename'];_0x4e4342['body'][_0x0728('0x3e')]=_0x4e4342['file'][_0x0728('0x6f')];return db[_0x0728('0x70')]['create'](_0x4e4342[_0x0728('0x34')])[_0x0728('0x18')](respondWithResult(_0xc238be,0xc9))['catch'](handleError(_0xc238be,null));};exports['attachmentDownload']=function(_0x25ce22,_0x33c0cc){return db[_0x0728('0x3b')][_0x0728('0x4e')]({'where':{'id':_0x25ce22['params']['id']},'raw':!![]})[_0x0728('0x18')](handleEntityNotFound(_0x33c0cc,null))[_0x0728('0x18')](function(_0x40cc33){if(_0x40cc33){if(_0x40cc33[_0x0728('0x69')]){return _0x33c0cc['status'](0x193)[_0x0728('0x27')]({'status':0x193,'message':_0x0728('0x71')});}return db[_0x0728('0x70')][_0x0728('0x4e')]({'where':{'id':_0x25ce22['query'][_0x0728('0x72')]},'raw':!![]})[_0x0728('0x18')](handleEntityNotFound(_0x33c0cc,null));}})['then'](function(_0x5707b6){if(_0x5707b6){var _0x27c8b3=_0x5707b6['ChatOfflineMessageId']!==null;var _0x32e4bd=path['join'](config[_0x0728('0x73')],'server/files/attachments/');if(_0x27c8b3){_0x32e4bd=path[_0x0728('0x74')](_0x32e4bd,'offline-chat/');}var _0x3a3f66=path[_0x0728('0x74')](_0x32e4bd,_0x5707b6[_0x0728('0x75')]);return _0x33c0cc['download'](_0x3a3f66);}})['catch'](handleError(_0x33c0cc,null));};exports[_0x0728('0x76')]=function(_0x1bdacd,_0x29a546){var _0x281a67=null;var _0x83fa4c=null;var _0x1a9c5b=null;if(_0x1bdacd[_0x0728('0x34')]['id']){delete _0x1bdacd[_0x0728('0x34')]['id'];}if(_0x1bdacd[_0x0728('0x34')][_0x0728('0x77')]){_0x1a9c5b=path[_0x0728('0x74')](config[_0x0728('0x73')],'server/files/chat/upload/',util['format'](_0x0728('0x78'),Date[_0x0728('0x79')]()));_0x1bdacd[_0x0728('0x34')]['pathTranscript']=_0x1a9c5b;}return db['ChatInteraction'][_0x0728('0x4c')]({'where':{'id':_0x1bdacd['params']['id']},'include':[{'model':db[_0x0728('0x7a')],'as':_0x0728('0x7b'),'include':[{'model':db[_0x0728('0x7c')],'as':_0x0728('0x7c')}]}]})[_0x0728('0x18')](handleEntityNotFound(_0x29a546,null))[_0x0728('0x18')](saveUpdates(_0x1bdacd['body'],null))[_0x0728('0x18')](function(_0x2e2ea6){if(_0x2e2ea6){_0x281a67=_0x2e2ea6;return db['ChatWebsite'][_0x0728('0x4c')]({'where':{'id':_0x281a67['ChatWebsiteId']}});}})[_0x0728('0x18')](function(_0x1e9789){if(_0x1e9789){_0x83fa4c=_0x1e9789;return db['CmContact'][_0x0728('0x4c')]({'where':{'id':_0x281a67['ContactId']}});}})[_0x0728('0x18')](function(_0x28b9f1){if(_0x28b9f1){if(_0x1a9c5b){var _0x319cf3=null;for(var _0x5230f8=0x1;_0x5230f8<_0x281a67['Messages'][_0x0728('0x49')];++_0x5230f8){_0x319cf3=_0x281a67[_0x0728('0x7b')][_0x5230f8];var _0x4b9beb=_0x319cf3['UserId']?util[_0x0728('0x7d')](_0x0728('0x7e'),_0x83fa4c[_0x0728('0x7f')],_0x319cf3[_0x0728('0x67')]):'System';var _0x2c4d21=_0x1bdacd[_0x0728('0x34')][_0x0728('0x80')]||util[_0x0728('0x7d')](_0x0728('0x7e'),_0x0728('0x81'),_0x319cf3[_0x0728('0x82')]);switch(_0x83fa4c[_0x0728('0x83')]){case'website_alias':_0x4b9beb=_0x319cf3[_0x0728('0x67')]?util[_0x0728('0x7d')](_0x0728('0x7e'),_0x83fa4c['agentAlias'],_0x319cf3[_0x0728('0x67')]):_0x0728('0x84');break;case'agent_alias':_0x4b9beb=_0x319cf3[_0x0728('0x67')]?_0x319cf3[_0x0728('0x7c')]['alias']||_0x319cf3[_0x0728('0x7c')]['fullname']:_0x0728('0x84');break;case'agent_fullname':_0x4b9beb=_0x319cf3['UserId']?_0x319cf3[_0x0728('0x7c')][_0x0728('0x56')]:_0x0728('0x84');break;default:_0x4b9beb=_0x319cf3[_0x0728('0x67')]?util[_0x0728('0x7d')](_0x0728('0x7e'),_0x83fa4c[_0x0728('0x7f')],_0x319cf3[_0x0728('0x67')]):'System';}var _0x4506bf=util[_0x0728('0x7d')](_0x0728('0x85'),moment(_0x319cf3['createdAt'])[_0x0728('0x7d')]('MM/DD/YYYY\x20HH:mm:ss'),_0x319cf3[_0x0728('0x86')]==='in'?_0x2c4d21:_0x4b9beb,_0x319cf3['body']);if(!_0x319cf3[_0x0728('0x87')]){fs[_0x0728('0x88')](_0x1a9c5b,_0x4506bf);}}return db[_0x0728('0x89')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x0728('0x8a')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x0728('0x8b')],'as':_0x0728('0x8b'),'raw':!![]}]}]});}}})[_0x0728('0x18')](function(_0x394a82){if(!_0x394a82||!_0x394a82[_0x0728('0x8c')]||!_0x1bdacd[_0x0728('0x34')])return _0x281a67;var _0x411c91=_0x394a82['getSmtpOptions']();return respondWithRpcPromise(_0x0728('0x8d'),_0x0728('0x8e'),{'account':_0x411c91,'message':{'from':util[_0x0728('0x7d')](_0x0728('0x8f'),_0x394a82['name'],_0x394a82['email']||_0x394a82[_0x0728('0x8c')][_0x0728('0x55')]),'to':_0x1bdacd[_0x0728('0x34')][_0x0728('0x77')],'subject':_0x0728('0x90'),'text':util[_0x0728('0x7d')](_0x0728('0x91'),_0x1bdacd[_0x0728('0x34')]['mailTranscript']),'attachments':[{'path':_0x1a9c5b}]}})['then'](function(){return _0x281a67;})['catch'](function(_0x2b1bfb){logger[_0x0728('0x1f')](_0x2b1bfb);});})[_0x0728('0x18')](respondWithStatusCode(_0x29a546,0xc8))[_0x0728('0x23')](handleError(_0x29a546,null));};exports[_0x0728('0x92')]=function(_0xd6fded,_0x2a9986){return db['ChatMessage'][_0x0728('0x4c')]({'where':{'id':_0xd6fded[_0x0728('0x43')]['id']}})[_0x0728('0x18')](handleEntityNotFound(_0x2a9986,null))[_0x0728('0x18')](function(_0x1cf1fd){if(_0x1cf1fd){return _0x1cf1fd['addMessage'](_0xd6fded[_0x0728('0x34')][_0x0728('0x93')],_[_0x0728('0x94')](_0xd6fded[_0x0728('0x34')],[_0x0728('0x93'),'id'])||{});}})['then'](respondWithResult(_0x2a9986,null))[_0x0728('0x23')](handleError(_0x2a9986,null));};exports[_0x0728('0x95')]=function(_0x18b07d,_0x2120d4){var _0x197047={'raw':![],'where':{}};var _0x5be074={};var _0x18ecb7={'count':0x0,'rows':[]};return db[_0x0728('0x3b')]['findOne']({'where':{'id':_0x18b07d[_0x0728('0x43')]['id']}})['then'](handleEntityNotFound(_0x2120d4,null))[_0x0728('0x18')](function(_0x375ec4){if(_0x375ec4){_0x5be074['model']=_['keys'](db['ChatMessage']['rawAttributes']);_0x5be074['query']=_[_0x0728('0x46')](_0x18b07d[_0x0728('0x45')]);_0x5be074[_0x0728('0x96')]=_[_0x0728('0x48')](_0x5be074['model'],_0x5be074[_0x0728('0x45')]);_0x197047[_0x0728('0x47')]=_[_0x0728('0x48')](_0x5be074['model'],qs[_0x0728('0x97')](_0x18b07d[_0x0728('0x45')]['fields']));_0x197047[_0x0728('0x47')]=_0x197047[_0x0728('0x47')]['length']?_0x197047[_0x0728('0x47')]:_0x5be074[_0x0728('0x44')];if(!_0x18b07d[_0x0728('0x45')][_0x0728('0x98')](_0x0728('0x99'))){_0x197047[_0x0728('0x2a')]=qs[_0x0728('0x2a')](_0x18b07d[_0x0728('0x45')]['limit']);_0x197047[_0x0728('0x28')]=qs[_0x0728('0x28')](_0x18b07d['query'][_0x0728('0x28')]);}_0x197047[_0x0728('0x9a')]=qs[_0x0728('0x9b')](_0x18b07d[_0x0728('0x45')][_0x0728('0x9b')]);_0x197047['where']=qs[_0x0728('0x96')](_[_0x0728('0x9c')](_0x18b07d['query'],_0x5be074['filters']));_0x197047[_0x0728('0x9d')][_0x0728('0x9e')]=_0x375ec4['id'];if(_0x18b07d[_0x0728('0x45')][_0x0728('0x9f')]){_0x197047[_0x0728('0x9d')]=_[_0x0728('0x33')](_0x197047['where'],{'$or':_[_0x0728('0x3a')](_0x197047[_0x0728('0x47')],function(_0x545a46){var _0x3f1043={};_0x3f1043[_0x545a46]={'$like':'%'+_0x18b07d[_0x0728('0x45')]['filter']+'%'};return _0x3f1043;})});}if(_0x18b07d[_0x0728('0x45')][_0x0728('0xa0')]){var _0x502fad=_0x18b07d[_0x0728('0x45')][_0x0728('0xa0')][_0x0728('0xa1')](',');var _0xc447={};_0xc447[_0x502fad[0x0]]={'$gte':moment(_0x502fad[0x1])['format'](_0x0728('0xa2'))};_0x197047[_0x0728('0x9d')]=_[_0x0728('0x33')](_0x197047['where'],_0xc447);}_0x197047=_[_0x0728('0x33')]({},_0x197047,_0x18b07d[_0x0728('0xa3')]);return db['ChatMessage']['count']({'where':_0x197047['where']})[_0x0728('0x18')](function(_0x10641c){_0x18ecb7[_0x0728('0x2b')]=_0x10641c;if(_0x18b07d[_0x0728('0x45')][_0x0728('0x4a')]){_0x197047[_0x0728('0xa4')]=[{'all':!![]}];}return db[_0x0728('0x7a')][_0x0728('0x40')](_0x197047);})[_0x0728('0x18')](function(_0x5719f8){_0x18ecb7[_0x0728('0xa5')]=_0x5719f8;return _0x18ecb7;});}})['then'](respondWithFilteredResult(_0x2120d4,_0x197047))['catch'](handleError(_0x2120d4,null));};exports[_0x0728('0xa6')]=function(_0x52dcb2,_0x28b6cc){var _0x4ae123={'where':{}},_0xe85fa7={},_0x5540d8={'count':0x0,'rows':[]};return db[_0x0728('0x3b')][_0x0728('0x4e')]({'where':{'id':_0x52dcb2[_0x0728('0x43')]['id']}})[_0x0728('0x18')](handleEntityNotFound(_0x28b6cc,null))[_0x0728('0x18')](function(_0x4272b1){if(_0x4272b1){_0xe85fa7['model']=_['keys'](db[_0x0728('0x7a')]['rawAttributes']);_0xe85fa7[_0x0728('0x45')]=_[_0x0728('0x46')](_0x52dcb2[_0x0728('0x45')]);_0xe85fa7[_0x0728('0x96')]=_[_0x0728('0x48')](_0xe85fa7[_0x0728('0x44')],_0xe85fa7['query']);_0x4ae123[_0x0728('0x47')]=_['intersection'](_0xe85fa7[_0x0728('0x44')],qs['fields'](_0x52dcb2[_0x0728('0x45')][_0x0728('0x97')]));_0x4ae123['attributes']=_0x4ae123[_0x0728('0x47')][_0x0728('0x49')]?_0x4ae123[_0x0728('0x47')]:_0xe85fa7[_0x0728('0x44')];if(!_0x52dcb2['query']['hasOwnProperty']('nolimit')){_0x4ae123[_0x0728('0x2a')]=qs[_0x0728('0x2a')](_0x52dcb2['query']['limit']);_0x4ae123['offset']=qs[_0x0728('0x28')](_0x52dcb2[_0x0728('0x45')][_0x0728('0x28')]);}_0x4ae123[_0x0728('0x9a')]=qs[_0x0728('0x9b')](_0x52dcb2['query'][_0x0728('0x9b')]);_0x4ae123[_0x0728('0x9d')]=qs['filters'](_[_0x0728('0x9c')](_0x52dcb2[_0x0728('0x45')],_0xe85fa7[_0x0728('0x96')]));_0x4ae123['where']['ChatInteractionId']=_0x4272b1['id'];if(_0x52dcb2[_0x0728('0x45')][_0x0728('0x9f')]){_0x4ae123['where']=_[_0x0728('0x33')](_0x4ae123[_0x0728('0x9d')],{'$or':_['map'](_0x4ae123[_0x0728('0x47')],function(_0x5a8cfd){var _0xd37739={};_0xd37739[_0x5a8cfd]={'$like':'%'+_0x52dcb2[_0x0728('0x45')][_0x0728('0x9f')]+'%'};return _0xd37739;})});}_0x4ae123['where'][_0x0728('0x87')]=![];if(_0x52dcb2[_0x0728('0x45')]['id']){_0x4ae123[_0x0728('0x9d')]['id']={'$gt':_0x52dcb2[_0x0728('0x45')]['id']};}_0x4ae123=_['merge']({},_0x4ae123,_0x52dcb2[_0x0728('0xa3')]);return db[_0x0728('0x7a')][_0x0728('0x2b')]({'where':_0x4ae123['where']})[_0x0728('0x18')](function(_0x5b0045){_0x5540d8[_0x0728('0x2b')]=_0x5b0045;_0x4ae123['include']=[];if(_0x52dcb2[_0x0728('0x45')][_0x0728('0xa7')]){_0x4ae123[_0x0728('0xa4')][_0x0728('0xa8')]({'model':db['User'],'as':_0x0728('0x7c'),'attributes':['id',_0x0728('0x56'),_0x0728('0xa9')]});}if(_0x52dcb2[_0x0728('0x45')]['includeAll']){_0x4ae123[_0x0728('0xa4')]=[{'all':!![]}];}return db[_0x0728('0x7a')][_0x0728('0x40')](_0x4ae123);})['then'](function(_0x501fb4){_0x5540d8[_0x0728('0xa5')]=_0x501fb4;return _0x5540d8;});}})[_0x0728('0x18')](respondWithFilteredResult(_0x28b6cc,_0x4ae123))['catch'](handleError(_0x28b6cc,null));};exports[_0x0728('0xaa')]=function(_0x80e853,_0x55ab50){return db[_0x0728('0x3b')][_0x0728('0x4c')]({'where':{'id':_0x80e853[_0x0728('0x43')]['id']}})[_0x0728('0x18')](handleEntityNotFound(_0x55ab50,null))[_0x0728('0x18')](function(_0x5a94ce){if(_0x5a94ce){return _0x5a94ce['setTags'](_0x80e853[_0x0728('0x34')][_0x0728('0x93')],_['omit'](_0x80e853[_0x0728('0x34')],[_0x0728('0x93'),'id'])||{})[_0x0728('0xab')](function(){return db[_0x0728('0xac')][_0x0728('0x40')]({'attributes':['id','name',_0x0728('0xad')],'where':{'id':_0x80e853['body'][_0x0728('0x93')]}});})[_0x0728('0x18')](function(_0x56c783){socket['emit']('chatInteractionTags:save',{'id':Number(_0x80e853[_0x0728('0x43')]['id']),'tags':_0x56c783||[]});return{'id':Number(_0x80e853[_0x0728('0x43')]['id']),'tags':_0x56c783||[]};});}})[_0x0728('0x18')](respondWithResult(_0x55ab50,null))['catch'](handleError(_0x55ab50,null));};exports['removeTags']=function(_0x5e209a,_0x571f2a){return db['ChatInteraction'][_0x0728('0x4c')]({'where':{'id':_0x5e209a['params']['id']}})[_0x0728('0x18')](handleEntityNotFound(_0x571f2a,null))[_0x0728('0x18')](function(_0x2032cf){if(_0x2032cf){return _0x2032cf[_0x0728('0xae')](_0x5e209a['query'][_0x0728('0x93')]);}})['then'](respondWithStatusCode(_0x571f2a,null))[_0x0728('0x23')](handleError(_0x571f2a,null));};exports[_0x0728('0xaf')]=function(_0x29b3b2,_0x36f9f0){var _0x13f654=moment()['unix']()[_0x0728('0xb0')]();var _0x4024f6=path[_0x0728('0x74')](config['root'],'server','files',_0x0728('0xb1'));var _0x4bcc4f=path[_0x0728('0x74')](config[_0x0728('0x73')],_0x0728('0xb2'),_0x0728('0xb3'),_0x0728('0xb4'));var _0x283fc3=path[_0x0728('0x74')](_0x4024f6,_0x13f654);var _0x3fb75a=util[_0x0728('0x7d')](_0x0728('0xb5'),_0x29b3b2[_0x0728('0x43')]['id'],_0x13f654);var _0x433fa9=path[_0x0728('0x74')](_0x4024f6,_0x3fb75a);var _0x127f9c=[];_0x127f9c[_0x0728('0xa8')]({'model':db[_0x0728('0x7c')],'as':'User','attributes':['id',_0x0728('0x56')],'raw':!![]});_0x127f9c['push']({'model':db[_0x0728('0x62')],'as':_0x0728('0x63'),'attributes':['id',_0x0728('0xb6'),_0x0728('0xb7')],'raw':!![]});if(_0x29b3b2['query'][_0x0728('0xb4')]){_0x127f9c['push']({'model':db[_0x0728('0x70')],'as':_0x0728('0x70'),'raw':!![]});}var _0x5c90ab=[{'model':db[_0x0728('0x7a')],'as':_0x0728('0x7b'),'attributes':['id','body',_0x0728('0xb8'),_0x0728('0x86'),_0x0728('0x87'),_0x0728('0xb9')],'include':_0x127f9c}];_0x5c90ab[_0x0728('0xa8')]({'model':db[_0x0728('0x4f')],'as':'Account','attributes':['id','name']});_0x5c90ab[_0x0728('0xa8')]({'model':db[_0x0728('0x7c')],'as':_0x0728('0xba'),'attributes':['id',_0x0728('0x56')]});return db[_0x0728('0x3b')][_0x0728('0x4c')]({'where':{'id':_0x29b3b2[_0x0728('0x43')]['id']},'include':_0x5c90ab})[_0x0728('0x18')](handleEntityNotFound(_0x36f9f0,null))['then'](function(_0x53330a){if(_0x53330a){var _0x456cf1=_0x53330a['get']({'plain':!![]});fs['mkdirSync'](_0x283fc3);var _0x17d636={'channel':_0x0728('0xbb'),'account':_0x456cf1[_0x0728('0xbc')][_0x0728('0x30')],'agent':_0x456cf1[_0x0728('0xba')]?_0x456cf1[_0x0728('0xba')][_0x0728('0x56')]:_0x0728('0xbd'),'createdAt':moment(_0x456cf1[_0x0728('0xb8')])[_0x0728('0x7d')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x456cf1[_0x0728('0x69')]?moment(_0x456cf1[_0x0728('0xbe')])['format'](_0x0728('0xa2'))[_0x0728('0xb0')]():'','disposition':_0x456cf1[_0x0728('0x6a')],'chatInfo':{'browser':_0x456cf1[_0x0728('0xbf')],'os':_0x456cf1['osName'],'referer':_0x456cf1['referer'],'customerIp':_0x456cf1['customerIp'],'customerPort':_0x456cf1[_0x0728('0xc0')]?_0x456cf1[_0x0728('0xc0')]:_0x0728('0xbd')},'messages':_(_0x456cf1['Messages'])[_0x0728('0xc1')]()[_0x0728('0x9f')]({'secret':![]})[_0x0728('0x3a')](function(_0x40b6ef){if(_0x40b6ef[_0x0728('0x70')]){var _0x3a019c=path[_0x0728('0x74')](_0x4bcc4f,_0x40b6ef[_0x0728('0x70')][_0x0728('0x75')]);if(fs[_0x0728('0xc2')](_0x3a019c)){fs[_0x0728('0xc3')](_0x3a019c)[_0x0728('0xc4')](fs[_0x0728('0xc5')](path[_0x0728('0x74')](_0x283fc3,_0x40b6ef[_0x0728('0x70')]['basename'])));}}return{'date':moment(_0x40b6ef['createdAt'])[_0x0728('0x7d')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0728('0xb0')](),'sender':_0x40b6ef[_0x0728('0x86')]===_0x0728('0x5f')?_0x40b6ef[_0x0728('0x7c')]?_0x40b6ef[_0x0728('0x7c')][_0x0728('0x56')]:_0x0728('0x84'):_0x40b6ef[_0x0728('0x63')][_0x0728('0xb6')]+(_0x40b6ef[_0x0728('0x63')]['lastName']?'\x20'+_0x40b6ef[_0x0728('0x63')][_0x0728('0xb7')]:''),'body':_0x40b6ef[_0x0728('0x70')]?_0x40b6ef[_0x0728('0x70')][_0x0728('0x75')]:_0x40b6ef['body'],'direction':_0x40b6ef['direction']===_0x0728('0x5f')?'A':'C','secret':_0x40b6ef[_0x0728('0x87')],'read':_0x40b6ef[_0x0728('0xb9')],'attachment':_0x40b6ef['Attachment']};})['value']()};return ejs['renderFile'](path['join'](config[_0x0728('0x73')],_0x0728('0xb2'),_0x0728('0xc6'),'downloadInteraction.ejs'),{'interaction':_0x17d636})[_0x0728('0x18')](function(_0x253265){var _0x141c42=path[_0x0728('0x74')](_0x283fc3,_0x0728('0xc7')+_0x456cf1['id']+'-'+_0x13f654+_0x0728('0xc8'));var _0x302840={'path':_0x141c42,'channel':'Chat','interactionId':_0x456cf1['id']};return pdf[_0x0728('0xc9')](_0x253265,_0x302840);})[_0x0728('0x18')](function(){return new Promise(function(_0x25bb29,_0x3f50a7){zipdir(_0x283fc3,{'saveTo':_0x433fa9},function(_0x4815ee,_0x91aefc){if(_0x4815ee)return _0x3f50a7(_0x4815ee);return _0x25bb29(_0x91aefc);});})[_0x0728('0x18')](function(){return new BPromise(function(_0x45960a,_0x230df5){rimraf(_0x283fc3,function(_0xcc89d){if(_0xcc89d)_0x230df5(_0xcc89d);return _0x45960a();});});})[_0x0728('0x18')](function(){return _0x36f9f0[_0x0728('0xaf')](_0x433fa9,_0x3fb75a,function(_0x49ca46){if(_0x49ca46){logger[_0x0728('0x1f')](_0x0728('0xca'),_0x49ca46);}else{fs[_0x0728('0xcb')](_0x433fa9);}});});});}else{return _0x36f9f0[_0x0728('0x24')](0xc8);}})[_0x0728('0x23')](handleError(_0x36f9f0,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 3756919..7afc7a9 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 _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 +var _0x26e8=['length','emit','hasOwnProperty','events','../../mysqldb','ChatMessage','setMaxListeners','save','getUsers','then','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x52b507,_0x3edb80){var _0x341497=function(_0x4669c3){while(--_0x4669c3){_0x52b507['push'](_0x52b507['shift']());}};_0x341497(++_0x3edb80);}(_0x26e8,0x1e3));var _0x826e=function(_0x3cf781,_0x3e4bc9){_0x3cf781=_0x3cf781-0x0;var _0x25e4d8=_0x26e8[_0x3cf781];return _0x25e4d8;};'use strict';var EventEmitter=require(_0x826e('0x0'));var ChatInteraction=require(_0x826e('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0x826e('0x1'))['db'][_0x826e('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x826e('0x3')](0x0);var events={'afterCreate':_0x826e('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3acaab){return function(_0xabaf52,_0x210c37,_0x135381){_0xabaf52[_0x826e('0x5')]({'attributes':['id'],'raw':!![]})[_0x826e('0x6')](function(_0x4ddaec){_0xabaf52[_0x826e('0x7')](_0x826e('0x8'),_0x4ddaec[_0x826e('0x9')](function(_0x1dbc0b){return{'id':_0x1dbc0b['id']};}));return ChatMessage[_0x826e('0xa')]({'where':{'ChatInteractionId':_0xabaf52['id'],'direction':'in','read':![]},'raw':!![]});})[_0x826e('0x6')](function(_0x5db1d5){_0xabaf52[_0x826e('0x7')](_0x826e('0xb'),_0x5db1d5[_0x826e('0xc')]);ChatInteractionEvents[_0x826e('0xd')](_0x3acaab+':'+_0xabaf52['id'],_0xabaf52);ChatInteractionEvents[_0x826e('0xd')](_0x3acaab,_0xabaf52);_0x135381(null);})['catch'](_0x135381(null));};}for(var e in events){if(events[_0x826e('0xe')](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 ac63f93..04b048d 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 _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 +var _0xb07b=['changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','define','chat_interactions'];(function(_0x318b88,_0x146ed7){var _0x1fec14=function(_0x20b3e2){while(--_0x20b3e2){_0x318b88['push'](_0x318b88['shift']());}};_0x1fec14(++_0x146ed7);}(_0xb07b,0x15a));var _0xbb07=function(_0x381543,_0x1aacb5){_0x381543=_0x381543-0x0;var _0x30b94d=_0xb07b[_0x381543];return _0x30b94d;};'use strict';var _=require(_0xbb07('0x0'));var util=require(_0xbb07('0x1'));var logger=require(_0xbb07('0x2'))('api');var moment=require(_0xbb07('0x3'));var BPromise=require(_0xbb07('0x4'));var rp=require(_0xbb07('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbb07('0x6'));var config=require(_0xbb07('0x7'));var attributes=require(_0xbb07('0x8'));module['exports']=function(_0x49a008,_0x5aa15c){return _0x49a008[_0xbb07('0x9')]('ChatInteraction',attributes,{'tableName':_0xbb07('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x53ee83,_0x45e63f,_0x54a614){if(_0x53ee83[_0xbb07('0xb')]('closed')){_0x53ee83[_0xbb07('0xc')]=moment()[_0xbb07('0xd')](_0xbb07('0xe'));}_0x54a614(null,_0x53ee83);}},'charset':_0xbb07('0xf'),'collate':_0xbb07('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 0b9fcec..e6f4892 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 _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 +var _0x8c7b=['AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','options','raw','where','attributes','limit','UpdateChatInteraction','AddTagsToChatInteraction','addTags','body','ids','omit','spread'];(function(_0x27c401,_0x592dab){var _0x263b74=function(_0x55f9ce){while(--_0x55f9ce){_0x27c401['push'](_0x27c401['shift']());}};_0x263b74(++_0x592dab);}(_0x8c7b,0x79));var _0xb8c7=function(_0x76bdfe,_0x5d2824){_0x76bdfe=_0x76bdfe-0x0;var _0x5084ef=_0x8c7b[_0x76bdfe];return _0x5084ef;};'use strict';var _=require(_0xb8c7('0x0'));var util=require('util');var moment=require(_0xb8c7('0x1'));var BPromise=require(_0xb8c7('0x2'));var rs=require(_0xb8c7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb8c7('0x4'))['db'];var utils=require(_0xb8c7('0x5'));var logger=require(_0xb8c7('0x6'))('rpc');var config=require(_0xb8c7('0x7'));var jayson=require(_0xb8c7('0x8'));var client=jayson['client'][_0xb8c7('0x9')]({'port':0x232a});config[_0xb8c7('0xa')]=_[_0xb8c7('0xb')](config['redis'],{'host':_0xb8c7('0xc'),'port':0x18eb});var socket=require(_0xb8c7('0xd'))(new Redis(config[_0xb8c7('0xa')]));require(_0xb8c7('0xe'))['register'](socket);function respondWithRpcPromise(_0x5c0248,_0x52630d,_0x16bb94){return new BPromise(function(_0x3ab8b2,_0x4981c0){return client[_0xb8c7('0xf')](_0x5c0248,_0x16bb94)[_0xb8c7('0x10')](function(_0x1365be){logger[_0xb8c7('0x11')](_0xb8c7('0x12'),_0x52630d,_0xb8c7('0x13'));logger[_0xb8c7('0x14')](_0xb8c7('0x15'),_0x52630d,'request\x20sent',JSON[_0xb8c7('0x16')](_0x1365be));if(_0x1365be[_0xb8c7('0x17')]){if(_0x1365be[_0xb8c7('0x17')]['code']===0x1f4){logger[_0xb8c7('0x17')](_0xb8c7('0x12'),_0x52630d,_0x1365be[_0xb8c7('0x17')]['message']);return _0x4981c0(_0x1365be[_0xb8c7('0x17')]['message']);}logger[_0xb8c7('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x52630d,_0x1365be['error'][_0xb8c7('0x18')]);return _0x3ab8b2(_0x1365be[_0xb8c7('0x17')]['message']);}else{logger[_0xb8c7('0x11')]('ChatInteraction,\x20%s,\x20%s',_0x52630d,_0xb8c7('0x13'));_0x3ab8b2(_0x1365be[_0xb8c7('0x19')][_0xb8c7('0x18')]);}})[_0xb8c7('0x1a')](function(_0x4914a9){logger[_0xb8c7('0x17')](_0xb8c7('0x12'),_0x52630d,_0x4914a9);_0x4981c0(_0x4914a9);});});}exports['UpdateChatInteraction']=function(_0x17e925){var _0x101e3b=this;return new Promise(function(_0x4865fc,_0x1debb7){return db['ChatInteraction']['update'](_0x17e925['body'],{'raw':_0x17e925[_0xb8c7('0x1b')]?_0x17e925[_0xb8c7('0x1b')][_0xb8c7('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17e925[_0xb8c7('0x1b')]?_0x17e925[_0xb8c7('0x1b')][_0xb8c7('0x1d')]||null:null,'attributes':_0x17e925[_0xb8c7('0x1b')]?_0x17e925['options'][_0xb8c7('0x1e')]||null:null,'limit':_0x17e925['options']?_0x17e925['options'][_0xb8c7('0x1f')]||null:null})[_0xb8c7('0x10')](function(_0x1e529c){logger[_0xb8c7('0x11')](_0xb8c7('0x20'),_0x17e925);logger[_0xb8c7('0x14')](_0xb8c7('0x20'),_0x17e925,JSON[_0xb8c7('0x16')](_0x1e529c));_0x4865fc(_0x1e529c);})[_0xb8c7('0x1a')](function(_0x2e0c41){logger[_0xb8c7('0x17')](_0xb8c7('0x20'),_0x2e0c41[_0xb8c7('0x18')],_0x17e925);_0x1debb7(_0x101e3b[_0xb8c7('0x17')](0x1f4,_0x2e0c41['message']));});});};exports[_0xb8c7('0x21')]=function(_0x2cf4a4){return new Promise(function(_0x1be7fb,_0x557375){return db['ChatInteraction']['find']({'where':_0x2cf4a4[_0xb8c7('0x1b')]?_0x2cf4a4[_0xb8c7('0x1b')][_0xb8c7('0x1d')]||null:null})[_0xb8c7('0x10')](function(_0x4df8ec){if(_0x4df8ec){return _0x4df8ec[_0xb8c7('0x22')](_0x2cf4a4[_0xb8c7('0x23')][_0xb8c7('0x24')],_[_0xb8c7('0x25')](_0x2cf4a4[_0xb8c7('0x23')],[_0xb8c7('0x24'),'id'])||{});}})[_0xb8c7('0x26')](function(_0x4f6d75){logger['info'](_0xb8c7('0x27'),_0x2cf4a4);logger[_0xb8c7('0x14')](_0xb8c7('0x27'),_0x2cf4a4,JSON[_0xb8c7('0x16')](_0x4f6d75));_0x1be7fb(_0x4f6d75);})[_0xb8c7('0x1a')](function(_0x3cbe5d){logger[_0xb8c7('0x17')]('AddTags',_0x3cbe5d[_0xb8c7('0x18')],_0x2cf4a4);_0x557375(_this[_0xb8c7('0x17')](0x1f4,_0x3cbe5d[_0xb8c7('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index a10ff8d..dd7be1e 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 _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 +var _0x4403=['length','update','emit','removeListener'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x4403,0x179));var _0x3440=function(_0x3b88d1,_0x22075b){_0x3b88d1=_0x3b88d1-0x0;var _0x393ed5=_0x4403[_0x3b88d1];return _0x393ed5;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save','remove',_0x3440('0x0')];function createListener(_0x571a63,_0x173448){return function(_0x48ba88){_0x173448[_0x3440('0x1')](_0x571a63,_0x48ba88);};}function removeListener(_0x39386e,_0x4d4dc6){return function(){ChatInteractionEvents[_0x3440('0x2')](_0x39386e,_0x4d4dc6);};}exports['register']=function(_0x5904cb){for(var _0x1e5e8d=0x0,_0x3121bd=events[_0x3440('0x3')];_0x1e5e8d<_0x3121bd;_0x1e5e8d++){var _0x4abc5a=events[_0x1e5e8d];var _0x33a070=createListener('chatInteraction:'+_0x4abc5a,_0x5904cb);ChatInteractionEvents['on'](_0x4abc5a,_0x33a070);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index ad7b531..42f94c7 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 _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 +var _0xfa20=['%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/messages','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','./chatInteraction.controller','get','index','/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','isAuthenticated','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','createVidaooSession','root','server/files/attachments/','format'];(function(_0x4cf71f,_0x4354e1){var _0x14c6ab=function(_0x3a8d1c){while(--_0x3a8d1c){_0x4cf71f['push'](_0x4cf71f['shift']());}};_0x14c6ab(++_0x4354e1);}(_0xfa20,0x1b9));var _0x0fa2=function(_0x2608f6,_0x3e467){_0x2608f6=_0x2608f6-0x0;var _0x581a04=_0xfa20[_0x2608f6];return _0x581a04;};'use strict';var multer=require('multer');var util=require(_0x0fa2('0x0'));var path=require(_0x0fa2('0x1'));var timeout=require(_0x0fa2('0x2'));var express=require(_0x0fa2('0x3'));var router=express[_0x0fa2('0x4')]();var fs_extra=require(_0x0fa2('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0fa2('0x6'));router[_0x0fa2('0x7')]('/',auth['isAuthenticated'](),controller[_0x0fa2('0x8')]);router[_0x0fa2('0x7')](_0x0fa2('0x9'),auth['isAuthenticated'](),controller[_0x0fa2('0xa')]);router[_0x0fa2('0x7')](_0x0fa2('0xb'),auth[_0x0fa2('0xc')](),controller['show']);router[_0x0fa2('0x7')](_0x0fa2('0xd'),auth[_0x0fa2('0xc')](),controller[_0x0fa2('0xe')]);router[_0x0fa2('0x7')]('/:id/messages',auth[_0x0fa2('0xf')](),controller[_0x0fa2('0x10')]);router['get'](_0x0fa2('0x11'),auth[_0x0fa2('0xc')](),controller[_0x0fa2('0x12')]);router[_0x0fa2('0x7')](_0x0fa2('0x13'),auth[_0x0fa2('0xf')](),controller[_0x0fa2('0x14')]);router[_0x0fa2('0x15')]('/',auth[_0x0fa2('0xf')](),controller[_0x0fa2('0x16')]);router[_0x0fa2('0x15')]('/:id/vidaoo',auth['isAuthenticated'](),controller[_0x0fa2('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4457a4,_0xa3fd52,_0x48b1e4){_0x48b1e4(null,path['join'](config[_0x0fa2('0x18')],_0x0fa2('0x19')));},'filename':function(_0x43e73e,_0x436e42,_0x2c9fe1){_0x2c9fe1(null,util[_0x0fa2('0x1a')](_0x0fa2('0x1b'),Date[_0x0fa2('0x1c')](),_0x436e42[_0x0fa2('0x1d')][_0x0fa2('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x0fa2('0x15')](_0x0fa2('0x1f'),upload[_0x0fa2('0x20')](_0x0fa2('0x21')),controller[_0x0fa2('0x22')]);router[_0x0fa2('0x15')](_0x0fa2('0x23'),auth[_0x0fa2('0xc')](),controller['addMessage']);router[_0x0fa2('0x15')]('/:id/tags',auth[_0x0fa2('0xf')](),interaction[_0x0fa2('0x24')](_0x0fa2('0x25'),_0x0fa2('0x26')),controller[_0x0fa2('0x27')]);router[_0x0fa2('0x28')]('/:id',auth[_0x0fa2('0xf')](),interaction['tracked'](_0x0fa2('0x25'),_0x0fa2('0x29')),controller[_0x0fa2('0x2a')]);router[_0x0fa2('0x28')](_0x0fa2('0x2b'),controller['customUpdate']);router[_0x0fa2('0x28')]('/:id/abandon',auth['isChatInteractionAuthorized'](),controller[_0x0fa2('0x2c')]);router[_0x0fa2('0x28')](_0x0fa2('0x2d'),controller[_0x0fa2('0x2e')]);router[_0x0fa2('0x2f')](_0x0fa2('0xb'),auth[_0x0fa2('0xf')](),interaction[_0x0fa2('0x24')](_0x0fa2('0x25'),_0x0fa2('0x30')),controller[_0x0fa2('0x31')]);router[_0x0fa2('0x2f')]('/:id/tags',auth[_0x0fa2('0xf')](),controller[_0x0fa2('0x32')]);module[_0x0fa2('0x33')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 4c50f23..eb47cc9 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 _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 +var _0xa7b7=['INTEGER','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0xa7b7,0xd9));var _0x7a7b=function(_0x302788,_0x19fb7e){_0x302788=_0x302788-0x0;var _0x27297a=_0xa7b7[_0x302788];return _0x27297a;};'use strict';var Sequelize=require(_0x7a7b('0x0'));module[_0x7a7b('0x1')]={'body':{'type':Sequelize[_0x7a7b('0x2')](_0x7a7b('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x7a7b('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x7a7b('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 8da8eac..a903ac4 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 _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 +var _0x7b4d=['find','create','body','update','describe','get','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','user','fullname','role','internal','online','allowmessenger','showWebBar','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','autoAssociation','isEmpty','agent','push','messages','FromId','read','-createdAt','all','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','save','then','destroy','error','stack','name','ChatInternalMessage','rawAttributes','fieldName','type','map','keys','filters','intersection','query','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params'];(function(_0x10e206,_0x289f82){var _0x406fa9=function(_0x4260e8){while(--_0x4260e8){_0x10e206['push'](_0x10e206['shift']());}};_0x406fa9(++_0x289f82);}(_0x7b4d,0xed));var _0xd7b4=function(_0x4f5108,_0x46a54b){_0x4f5108=_0x4f5108-0x0;var _0x2d56ca=_0x7b4d[_0x4f5108];return _0x2d56ca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd7b4('0x0'));var zipdir=require(_0xd7b4('0x1'));var jsonpatch=require(_0xd7b4('0x2'));var rp=require(_0xd7b4('0x3'));var moment=require(_0xd7b4('0x4'));var BPromise=require(_0xd7b4('0x5'));var Mustache=require(_0xd7b4('0x6'));var util=require('util');var path=require(_0xd7b4('0x7'));var sox=require(_0xd7b4('0x8'));var csv=require('to-csv');var ejs=require(_0xd7b4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd7b4('0xa'));var squel=require(_0xd7b4('0xb'));var crypto=require(_0xd7b4('0xc'));var jsforce=require(_0xd7b4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd7b4('0xe'));var querystring=require(_0xd7b4('0xf'));var Papa=require(_0xd7b4('0x10'));var Redis=require(_0xd7b4('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd7b4('0x12'));var logger=require(_0xd7b4('0x13'))('api');var utils=require(_0xd7b4('0x14'));var config=require(_0xd7b4('0x15'));var licenseUtil=require(_0xd7b4('0x16'));var db=require(_0xd7b4('0x17'))['db'];config[_0xd7b4('0x18')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd7b4('0x19'))(new Redis(config['redis']));require(_0xd7b4('0x1a'))[_0xd7b4('0x1b')](socket);function respondWithStatusCode(_0x3f5d1a,_0x58ae54){_0x58ae54=_0x58ae54||0xcc;return function(_0x431433){if(_0x431433){return _0x3f5d1a[_0xd7b4('0x1c')](_0x58ae54);}return _0x3f5d1a[_0xd7b4('0x1d')](_0x58ae54)[_0xd7b4('0x1e')]();};}function respondWithResult(_0x24f903,_0x2a1066){_0x2a1066=_0x2a1066||0xc8;return function(_0x3d0ffa){if(_0x3d0ffa){return _0x24f903['status'](_0x2a1066)[_0xd7b4('0x1f')](_0x3d0ffa);}};}function respondWithFilteredResult(_0x140773,_0x4cb94c){return function(_0x115ae8){if(_0x115ae8){var _0x3e0394=typeof _0x4cb94c['offset']===_0xd7b4('0x20')&&typeof _0x4cb94c['limit']===_0xd7b4('0x20');var _0xe1e421=_0x115ae8[_0xd7b4('0x21')];var _0x428d39=_0x3e0394?0x0:_0x4cb94c[_0xd7b4('0x22')];var _0x724a70=_0x3e0394?_0x115ae8[_0xd7b4('0x21')]:_0x4cb94c[_0xd7b4('0x22')]+_0x4cb94c[_0xd7b4('0x23')];var _0x4601f9;if(_0x724a70>=_0xe1e421){_0x724a70=_0xe1e421;_0x4601f9=0xc8;}else{_0x4601f9=0xce;}_0x140773[_0xd7b4('0x1d')](_0x4601f9);return _0x140773['set'](_0xd7b4('0x24'),_0x428d39+'-'+_0x724a70+'/'+_0xe1e421)['json'](_0x115ae8);}return null;};}function patchUpdates(_0x57a952){return function(_0x3fd2ab){try{jsonpatch[_0xd7b4('0x25')](_0x3fd2ab,_0x57a952,!![]);}catch(_0x1ab3b4){return BPromise['reject'](_0x1ab3b4);}return _0x3fd2ab[_0xd7b4('0x26')]();};}function saveUpdates(_0x297b62,_0x21e943){return function(_0x154a9b){if(_0x154a9b){return _0x154a9b['update'](_0x297b62)[_0xd7b4('0x27')](function(_0x471e40){return _0x471e40;});}return null;};}function removeEntity(_0x3f2c80,_0x4b2246){return function(_0x504390){if(_0x504390){return _0x504390[_0xd7b4('0x28')]()['then'](function(){_0x3f2c80[_0xd7b4('0x1d')](0xcc)[_0xd7b4('0x1e')]();});}};}function handleEntityNotFound(_0x305643,_0x219229){return function(_0x1b4a40){if(!_0x1b4a40){_0x305643[_0xd7b4('0x1c')](0x194);}return _0x1b4a40;};}function handleError(_0x1cc6c2,_0x3f5cb2){_0x3f5cb2=_0x3f5cb2||0x1f4;return function(_0x567287){logger[_0xd7b4('0x29')](_0x567287[_0xd7b4('0x2a')]);if(_0x567287[_0xd7b4('0x2b')]){delete _0x567287['name'];}_0x1cc6c2[_0xd7b4('0x1d')](_0x3f5cb2)['send'](_0x567287);};}exports['index']=function(_0xafbd88,_0x6cb90d){var _0x33025d={},_0x5063eb={},_0x3af263={'count':0x0,'rows':[]};var _0x1e7f01=_['map'](db[_0xd7b4('0x2c')][_0xd7b4('0x2d')],function(_0x219c1f){return{'name':_0x219c1f[_0xd7b4('0x2e')],'type':_0x219c1f[_0xd7b4('0x2f')]['key']};});_0x5063eb['model']=_[_0xd7b4('0x30')](_0x1e7f01,_0xd7b4('0x2b'));_0x5063eb['query']=_[_0xd7b4('0x31')](_0xafbd88['query']);_0x5063eb[_0xd7b4('0x32')]=_[_0xd7b4('0x33')](_0x5063eb['model'],_0x5063eb[_0xd7b4('0x34')]);_0x33025d['attributes']=_[_0xd7b4('0x33')](_0x5063eb[_0xd7b4('0x35')],qs[_0xd7b4('0x36')](_0xafbd88[_0xd7b4('0x34')][_0xd7b4('0x36')]));_0x33025d[_0xd7b4('0x37')]=_0x33025d['attributes'][_0xd7b4('0x38')]?_0x33025d[_0xd7b4('0x37')]:_0x5063eb[_0xd7b4('0x35')];if(!_0xafbd88[_0xd7b4('0x34')][_0xd7b4('0x39')](_0xd7b4('0x3a'))){_0x33025d[_0xd7b4('0x23')]=qs[_0xd7b4('0x23')](_0xafbd88[_0xd7b4('0x34')][_0xd7b4('0x23')]);_0x33025d['offset']=qs['offset'](_0xafbd88[_0xd7b4('0x34')][_0xd7b4('0x22')]);}_0x33025d['order']=qs[_0xd7b4('0x3b')](_0xafbd88[_0xd7b4('0x34')][_0xd7b4('0x3b')]);_0x33025d[_0xd7b4('0x3c')]=qs[_0xd7b4('0x32')](_[_0xd7b4('0x3d')](_0xafbd88[_0xd7b4('0x34')],_0x5063eb[_0xd7b4('0x32')]),_0x1e7f01);if(_0xafbd88[_0xd7b4('0x34')][_0xd7b4('0x3e')]){_0x33025d[_0xd7b4('0x3c')]=_[_0xd7b4('0x3f')](_0x33025d[_0xd7b4('0x3c')],{'$or':_['map'](_0x1e7f01,function(_0x1e7ef7){if(_0x1e7ef7['type']!==_0xd7b4('0x40')){var _0x5b4b91={};_0x5b4b91[_0x1e7ef7['name']]={'$like':'%'+_0xafbd88['query']['filter']+'%'};return _0x5b4b91;}})});}_0x33025d=_['merge']({},_0x33025d,_0xafbd88[_0xd7b4('0x41')]);var _0x46af67={'where':_0x33025d[_0xd7b4('0x3c')]};return db[_0xd7b4('0x2c')]['count'](_0x46af67)['then'](function(_0x229805){_0x3af263[_0xd7b4('0x21')]=_0x229805;if(_0xafbd88['query'][_0xd7b4('0x42')]){_0x33025d[_0xd7b4('0x43')]=[{'all':!![]}];}return db[_0xd7b4('0x2c')][_0xd7b4('0x44')](_0x33025d);})[_0xd7b4('0x27')](function(_0x3535b1){_0x3af263[_0xd7b4('0x45')]=_0x3535b1;return _0x3af263;})['then'](respondWithFilteredResult(_0x6cb90d,_0x33025d))[_0xd7b4('0x46')](handleError(_0x6cb90d,null));};exports['show']=function(_0x168bac,_0x217e30){var _0x2facab={'raw':!![],'where':{'id':_0x168bac[_0xd7b4('0x47')]['id']}},_0x37c62e={};_0x37c62e['model']=_[_0xd7b4('0x31')](db[_0xd7b4('0x2c')][_0xd7b4('0x2d')]);_0x37c62e[_0xd7b4('0x34')]=_['keys'](_0x168bac[_0xd7b4('0x34')]);_0x37c62e[_0xd7b4('0x32')]=_['intersection'](_0x37c62e[_0xd7b4('0x35')],_0x37c62e[_0xd7b4('0x34')]);_0x2facab[_0xd7b4('0x37')]=_[_0xd7b4('0x33')](_0x37c62e['model'],qs['fields'](_0x168bac[_0xd7b4('0x34')][_0xd7b4('0x36')]));_0x2facab['attributes']=_0x2facab['attributes'][_0xd7b4('0x38')]?_0x2facab[_0xd7b4('0x37')]:_0x37c62e[_0xd7b4('0x35')];if(_0x168bac[_0xd7b4('0x34')]['includeAll']){_0x2facab[_0xd7b4('0x43')]=[{'all':!![]}];}_0x2facab=_['merge']({},_0x2facab,_0x168bac[_0xd7b4('0x41')]);return db['ChatInternalMessage'][_0xd7b4('0x48')](_0x2facab)['then'](handleEntityNotFound(_0x217e30,null))[_0xd7b4('0x27')](respondWithResult(_0x217e30,null))[_0xd7b4('0x46')](handleError(_0x217e30,null));};exports[_0xd7b4('0x49')]=function(_0x21c405,_0x58cb71){return db[_0xd7b4('0x2c')][_0xd7b4('0x49')](_0x21c405[_0xd7b4('0x4a')],{})['then'](respondWithResult(_0x58cb71,0xc9))['catch'](handleError(_0x58cb71,null));};exports[_0xd7b4('0x4b')]=function(_0x3252ef,_0x3c4c00){if(_0x3252ef[_0xd7b4('0x4a')]['id']){delete _0x3252ef[_0xd7b4('0x4a')]['id'];}return db[_0xd7b4('0x2c')][_0xd7b4('0x48')]({'where':{'id':_0x3252ef['params']['id']}})[_0xd7b4('0x27')](handleEntityNotFound(_0x3c4c00,null))[_0xd7b4('0x27')](saveUpdates(_0x3252ef[_0xd7b4('0x4a')],null))['then'](respondWithResult(_0x3c4c00,null))[_0xd7b4('0x46')](handleError(_0x3c4c00,null));};exports['destroy']=function(_0x1ec05c,_0x5f58e4){return db[_0xd7b4('0x2c')][_0xd7b4('0x48')]({'where':{'id':_0x1ec05c['params']['id']}})['then'](handleEntityNotFound(_0x5f58e4,null))[_0xd7b4('0x27')](removeEntity(_0x5f58e4,null))[_0xd7b4('0x46')](handleError(_0x5f58e4,null));};exports[_0xd7b4('0x4c')]=function(_0x5aa03a,_0x28269e){return db[_0xd7b4('0x2c')]['describe']()[_0xd7b4('0x27')](respondWithResult(_0x28269e,null))[_0xd7b4('0x46')](handleError(_0x28269e,null));};function wrapUser(_0x56e356){return function(_0x2ab0c6){var _0x18e692=_0x56e356[_0xd7b4('0x4d')]({'plain':!![]});_0x18e692['messages']=[];if(_0x2ab0c6){_0x18e692[_0xd7b4('0x4e')]=_0x2ab0c6[_0xd7b4('0x4f')];_0x18e692['lastMessage']=_0x2ab0c6;}else{_0x18e692[_0xd7b4('0x4e')]=moment(0x0)[_0xd7b4('0x50')](_0xd7b4('0x51'));_0x18e692['lastMessage']={};}return _0x18e692;};}exports[_0xd7b4('0x52')]=function(_0x1ce51a,_0x35d294,_0x37ffe4){var _0x3798de=[];return db['User'][_0xd7b4('0x44')]({'where':{'role':['agent','admin',_0xd7b4('0x53')]},'attributes':['id',_0xd7b4('0x54'),_0xd7b4('0x2b'),_0xd7b4('0x55'),'userpic',_0xd7b4('0x56'),_0xd7b4('0x57'),'lastLoginAt',_0xd7b4('0x58'),_0xd7b4('0x59')],'order':qs[_0xd7b4('0x3b')]('-online'),'include':[{'model':db[_0xd7b4('0x5a')],'as':'VoiceQueues','attributes':['id',_0xd7b4('0x2b'),_0xd7b4('0x2f')],'through':{'attributes':[]}}]})['then'](function(_0x56ad88){if(_0x56ad88){var _0x3ddc1b=_0x1ce51a[_0xd7b4('0x53')][_0xd7b4('0x4d')]({'plain':!![]});if(!_0x3ddc1b)throw new Error(_0xd7b4('0x5b'));if(_0x3ddc1b[_0xd7b4('0x55')]===_0xd7b4('0x53')){return db['UserProfileSection'][_0xd7b4('0x48')]({'where':{'name':_0xd7b4('0x5c'),'userProfileId':_0x3ddc1b[_0xd7b4('0x5d')]},'raw':!![]})['then'](function(_0x5612c0){if(_0x5612c0){if(_0x5612c0[_0xd7b4('0x5e')]===0x0){return db['UserProfileResource'][_0xd7b4('0x44')]({'where':{'sectionId':_0x5612c0['id']},'raw':!![]})['then'](function(_0x37a63a){var _0x222abb=[];if(_[_0xd7b4('0x5f')](_0x37a63a)){_0x222abb=_['filter'](_0x56ad88,function(_0xe60cdc){if(_0xe60cdc[_0xd7b4('0x55')]!==_0xd7b4('0x60')){return _0xe60cdc;}});return _0x222abb;}else{for(var _0x4a017d=0x0;_0x4a017d<_0x56ad88[_0xd7b4('0x38')];_0x4a017d++){var _0x2da4e6=_0x56ad88[_0x4a017d];if(_0x2da4e6[_0xd7b4('0x55')]===_0xd7b4('0x60')){var _0x1a0e77=_[_0xd7b4('0x48')](_0x37a63a,function(_0x537eeb){return _0x537eeb['resourceId']===_0x2da4e6['id'];});if(_0x1a0e77)_0x222abb[_0xd7b4('0x61')](_0x2da4e6);}else{_0x222abb[_0xd7b4('0x61')](_0x2da4e6);}}return _0x222abb;}});}else{return _0x56ad88;}}else{var _0x5549b2=_[_0xd7b4('0x3e')](_0x56ad88,function(_0x1ab0c8){if(_0x1ab0c8[_0xd7b4('0x55')]!==_0xd7b4('0x60')){return _0x1ab0c8;}});return _0x5549b2;}});}else{return _0x56ad88;}}})[_0xd7b4('0x27')](function(_0x1cfcdc){var _0x48e7cd=[];if(_0x1cfcdc){_0x3798de=_0x1cfcdc;for(var _0x28ac62=0x0;_0x28ac62<_0x1cfcdc['length'];_0x28ac62+=0x1){_0x3798de[_0x28ac62][_0xd7b4('0x62')]=[];_0x48e7cd[_0xd7b4('0x61')](db[_0xd7b4('0x2c')]['find']({'where':{'FromId':[_0x1ce51a[_0xd7b4('0x53')]['id'],_0x1cfcdc[_0x28ac62]['id']],'ToId':[_0x1ce51a[_0xd7b4('0x53')]['id'],_0x1cfcdc[_0x28ac62]['id']],'ChatGroupId':null},'attributes':['id',_0xd7b4('0x4f'),_0xd7b4('0x63'),'ToId',_0xd7b4('0x64'),_0xd7b4('0x4a')],'order':qs[_0xd7b4('0x3b')](_0xd7b4('0x65')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xd7b4('0x27')](wrapUser(_0x1cfcdc[_0x28ac62])));}return BPromise[_0xd7b4('0x66')](_0x48e7cd);}return[];})[_0xd7b4('0x27')](function(_0x5a2eba){return{'rows':_0x5a2eba,'count':_0x5a2eba[_0xd7b4('0x38')]};})[_0xd7b4('0x27')](respondWithResult(_0x35d294,null))[_0xd7b4('0x46')](handleError(_0x35d294,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 4f4faf7..be69a73 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 _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 +var _0x90ad=['events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x416468,_0x2e7a72){var _0x2ee9b7=function(_0xf354ce){while(--_0xf354ce){_0x416468['push'](_0x416468['shift']());}};_0x2ee9b7(++_0x2e7a72);}(_0x90ad,0x195));var _0xd90a=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x90ad[_0x45e98e];return _0x374dba;};'use strict';var EventEmitter=require(_0xd90a('0x0'));var ChatInternalMessage=require(_0xd90a('0x1'))['db'][_0xd90a('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xd90a('0x3')](0x0);var events={'afterCreate':_0xd90a('0x4'),'afterUpdate':'update','afterDestroy':_0xd90a('0x5')};function emitEvent(_0x844190){return function(_0x45e9f3,_0x5e9622,_0x2691eb){ChatInternalMessageEvents['emit'](_0x844190+':'+_0x45e9f3['id'],_0x45e9f3);ChatInternalMessageEvents[_0xd90a('0x6')](_0x844190,_0x45e9f3);_0x2691eb(null);};}for(var e in events){if(events[_0xd90a('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xd90a('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index f6227bd..f09d21a 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 _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 +var _0x95bf=['define','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','exports'];(function(_0x19a033,_0x232dca){var _0x4fcc51=function(_0x1a739a){while(--_0x1a739a){_0x19a033['push'](_0x19a033['shift']());}};_0x4fcc51(++_0x232dca);}(_0x95bf,0x154));var _0xf95b=function(_0x18d9ad,_0x43470d){_0x18d9ad=_0x18d9ad-0x0;var _0x3f8261=_0x95bf[_0x18d9ad];return _0x3f8261;};'use strict';var _=require(_0xf95b('0x0'));var util=require(_0xf95b('0x1'));var logger=require(_0xf95b('0x2'))(_0xf95b('0x3'));var moment=require(_0xf95b('0x4'));var BPromise=require('bluebird');var rp=require(_0xf95b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf95b('0x6'));var config=require(_0xf95b('0x7'));var attributes=require(_0xf95b('0x8'));module[_0xf95b('0x9')]=function(_0x2c9c58,_0x22782e){return _0x2c9c58[_0xf95b('0xa')](_0xf95b('0xb'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf95b('0xc'),'collate':_0xf95b('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index b8687cb..1c45417 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 _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 +var _0xa849=['register','request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket'];(function(_0x37f579,_0x394cfe){var _0xdaf138=function(_0x518fa1){while(--_0x518fa1){_0x37f579['push'](_0x37f579['shift']());}};_0xdaf138(++_0x394cfe);}(_0xa849,0x106));var _0x9a84=function(_0x4746be,_0x14d1ec){_0x4746be=_0x4746be-0x0;var _0x3fb821=_0xa849[_0x4746be];return _0x3fb821;};'use strict';var _=require(_0x9a84('0x0'));var util=require(_0x9a84('0x1'));var moment=require('moment');var BPromise=require(_0x9a84('0x2'));var rs=require(_0x9a84('0x3'));var fs=require('fs');var Redis=require(_0x9a84('0x4'));var db=require(_0x9a84('0x5'))['db'];var utils=require(_0x9a84('0x6'));var logger=require(_0x9a84('0x7'))(_0x9a84('0x8'));var config=require(_0x9a84('0x9'));var jayson=require(_0x9a84('0xa'));var client=jayson[_0x9a84('0xb')][_0x9a84('0xc')]({'port':0x232a});config[_0x9a84('0xd')]=_[_0x9a84('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9a84('0xf'))(new Redis(config[_0x9a84('0xd')]));require(_0x9a84('0x10'))[_0x9a84('0x11')](socket);function respondWithRpcPromise(_0x4fe52b,_0x694848,_0x1c0033){return new BPromise(function(_0x45e924,_0xb032b4){return client[_0x9a84('0x12')](_0x4fe52b,_0x1c0033)[_0x9a84('0x13')](function(_0x305bae){logger[_0x9a84('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x694848,_0x9a84('0x15'));logger[_0x9a84('0x16')](_0x9a84('0x17'),_0x694848,_0x9a84('0x15'),JSON[_0x9a84('0x18')](_0x305bae));if(_0x305bae['error']){if(_0x305bae[_0x9a84('0x19')][_0x9a84('0x1a')]===0x1f4){logger[_0x9a84('0x19')](_0x9a84('0x1b'),_0x694848,_0x305bae[_0x9a84('0x19')][_0x9a84('0x1c')]);return _0xb032b4(_0x305bae['error']['message']);}logger[_0x9a84('0x19')](_0x9a84('0x1b'),_0x694848,_0x305bae[_0x9a84('0x19')][_0x9a84('0x1c')]);return _0x45e924(_0x305bae[_0x9a84('0x19')][_0x9a84('0x1c')]);}else{logger[_0x9a84('0x14')](_0x9a84('0x1b'),_0x694848,_0x9a84('0x15'));_0x45e924(_0x305bae[_0x9a84('0x1d')]['message']);}})[_0x9a84('0x1e')](function(_0xff810e){logger[_0x9a84('0x19')]('ChatInternalMessage,\x20%s,\x20%s',_0x694848,_0xff810e);_0xb032b4(_0xff810e);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 01d6b59..9ef1d75 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 _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 +var _0x12a2=['./chatInternalMessage.events','update','emit','removeListener','register'];(function(_0x4873d6,_0x69d7ee){var _0x54d3e9=function(_0x230bd8){while(--_0x230bd8){_0x4873d6['push'](_0x4873d6['shift']());}};_0x54d3e9(++_0x69d7ee);}(_0x12a2,0xb9));var _0x212a=function(_0x5a32ee,_0x5604f1){_0x5a32ee=_0x5a32ee-0x0;var _0x447948=_0x12a2[_0x5a32ee];return _0x447948;};'use strict';var ChatInternalMessageEvents=require(_0x212a('0x0'));var events=['save','remove',_0x212a('0x1')];function createListener(_0x14a895,_0x59db37){return function(_0x977524){_0x59db37[_0x212a('0x2')](_0x14a895,_0x977524);};}function removeListener(_0x12ff77,_0x4769b0){return function(){ChatInternalMessageEvents[_0x212a('0x3')](_0x12ff77,_0x4769b0);};}exports[_0x212a('0x4')]=function(_0x5b082e){for(var _0x34c31e=0x0,_0x254f4b=events['length'];_0x34c31e<_0x254f4b;_0x34c31e++){var _0x371261=events[_0x34c31e];var _0x3aaa21=createListener('chatInternalMessage:'+_0x371261,_0x5b082e);ChatInternalMessageEvents['on'](_0x371261,_0x3aaa21);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index c795bd3..7575b89 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 _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 +var _0xc9af=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/users','getUsers','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xc9af,0x91));var _0xfc9a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc9af[_0x46698a];return _0x356db0;};'use strict';var multer=require(_0xfc9a('0x0'));var util=require(_0xfc9a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfc9a('0x2')]();var fs_extra=require(_0xfc9a('0x3'));var auth=require(_0xfc9a('0x4'));var interaction=require(_0xfc9a('0x5'));var config=require(_0xfc9a('0x6'));var controller=require('./chatInternalMessage.controller');router[_0xfc9a('0x7')]('/',auth[_0xfc9a('0x8')](),controller[_0xfc9a('0x9')]);router[_0xfc9a('0x7')](_0xfc9a('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xfc9a('0xb'),auth[_0xfc9a('0x8')](),controller[_0xfc9a('0xc')]);router['get'](_0xfc9a('0xd'),auth[_0xfc9a('0x8')](),controller[_0xfc9a('0xe')]);router[_0xfc9a('0xf')]('/',auth[_0xfc9a('0x8')](),controller[_0xfc9a('0x10')]);router[_0xfc9a('0x11')](_0xfc9a('0xd'),controller[_0xfc9a('0x12')]);router[_0xfc9a('0x13')](_0xfc9a('0xd'),auth[_0xfc9a('0x8')](),controller[_0xfc9a('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 299a29e..76db648 100644 --- a/server/api/chatMessage/chatMessage.attributes.js +++ b/server/api/chatMessage/chatMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c7a=['sequelize','medium','BOOLEAN','ENUM','out','STRING','TEXT'];(function(_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 +var _0xa45c=['TEXT','sequelize','exports','BOOLEAN','ENUM','out'];(function(_0x2de639,_0x3d4562){var _0x47ae92=function(_0x31912f){while(--_0x31912f){_0x2de639['push'](_0x2de639['shift']());}};_0x47ae92(++_0x3d4562);}(_0xa45c,0x6d));var _0xca45=function(_0x3d3cbc,_0x508a41){_0x3d3cbc=_0x3d3cbc-0x0;var _0x17cf61=_0xa45c[_0x3d3cbc];return _0x17cf61;};'use strict';var Sequelize=require(_0xca45('0x0'));module[_0xca45('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xca45('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xca45('0x3')]('in','out'),'defaultValue':_0xca45('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xca45('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 9f82652..e49834b 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 _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 +var _0x8573=['length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','find','create','body','describe','chat-interactions','accept','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','ChatInteraction','ChatInteractionId','isNil','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','parse','formData','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','ChatMessage','rawAttributes','fieldName','type','model','map','keys','filters','intersection','query','attributes','fields'];(function(_0x46ed5c,_0xec3675){var _0x42de09=function(_0x3e9818){while(--_0x3e9818){_0x46ed5c['push'](_0x46ed5c['shift']());}};_0x42de09(++_0xec3675);}(_0x8573,0xc1));var _0x3857=function(_0x256b18,_0x2cbe84){_0x256b18=_0x256b18-0x0;var _0x183933=_0x8573[_0x256b18];return _0x183933;};'use strict';var emlformat=require(_0x3857('0x0'));var rimraf=require(_0x3857('0x1'));var zipdir=require(_0x3857('0x2'));var jsonpatch=require(_0x3857('0x3'));var rp=require(_0x3857('0x4'));var moment=require(_0x3857('0x5'));var BPromise=require(_0x3857('0x6'));var Mustache=require(_0x3857('0x7'));var util=require('util');var path=require(_0x3857('0x8'));var sox=require(_0x3857('0x9'));var csv=require('to-csv');var ejs=require(_0x3857('0xa'));var fs=require('fs');var fs_extra=require(_0x3857('0xb'));var _=require(_0x3857('0xc'));var squel=require(_0x3857('0xd'));var crypto=require(_0x3857('0xe'));var jsforce=require(_0x3857('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3857('0x10'));var querystring=require('querystring');var Papa=require(_0x3857('0x11'));var Redis=require(_0x3857('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3857('0x13'));var as=require(_0x3857('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3857('0x15'))(_0x3857('0x16'));var utils=require(_0x3857('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3857('0x18'));var db=require(_0x3857('0x19'))['db'];config[_0x3857('0x1a')]=_[_0x3857('0x1b')](config['redis'],{'host':_0x3857('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3857('0x1a')]));require(_0x3857('0x1d'))[_0x3857('0x1e')](socket);var jayson=require(_0x3857('0x1f'));var client=jayson[_0x3857('0x20')][_0x3857('0x21')]({'port':0x232c});var client9002=jayson[_0x3857('0x20')][_0x3857('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x460824,_0x230432,_0x53eb7e,_0x1ecb51){return new BPromise(function(_0x8eccf1,_0x1ff31b){var _0x449ebd=_0x1ecb51||client;return _0x449ebd[_0x3857('0x22')](_0x460824,_0x53eb7e)[_0x3857('0x23')](function(_0x42b5cb){logger['info'](_0x3857('0x24'),_0x230432,_0x3857('0x25'));logger[_0x3857('0x26')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x230432,'request\x20sent',JSON[_0x3857('0x27')](_0x42b5cb));if(_0x42b5cb['error']){if(_0x42b5cb[_0x3857('0x28')]['code']===0x1f4){logger[_0x3857('0x28')](_0x3857('0x24'),_0x230432,_0x42b5cb[_0x3857('0x28')]['message']);return _0x1ff31b(_0x42b5cb[_0x3857('0x28')][_0x3857('0x29')]);}logger[_0x3857('0x28')](_0x3857('0x24'),_0x230432,_0x42b5cb['error']['message']);return _0x8eccf1(_0x42b5cb[_0x3857('0x28')][_0x3857('0x29')]);}else{logger[_0x3857('0x2a')](_0x3857('0x24'),_0x230432,_0x3857('0x25'));_0x8eccf1(_0x42b5cb[_0x3857('0x2b')]['message']);}})[_0x3857('0x2c')](function(_0x2fd8e7){logger['error'](_0x3857('0x24'),_0x230432,_0x2fd8e7);_0x1ff31b(_0x2fd8e7);});});}function respondWithStatusCode(_0x151fed,_0x355b97){_0x355b97=_0x355b97||0xcc;return function(_0x5055c7){if(_0x5055c7){return _0x151fed[_0x3857('0x2d')](_0x355b97);}return _0x151fed[_0x3857('0x2e')](_0x355b97)['end']();};}function respondWithResult(_0x4cd9e7,_0xa68c60){_0xa68c60=_0xa68c60||0xc8;return function(_0x6bc743){if(_0x6bc743){return _0x4cd9e7[_0x3857('0x2e')](_0xa68c60)[_0x3857('0x2f')](_0x6bc743);}};}function respondWithFilteredResult(_0x399421,_0x3aec40){return function(_0x3edadc){if(_0x3edadc){var _0x59bcbd=typeof _0x3aec40[_0x3857('0x30')]===_0x3857('0x31')&&typeof _0x3aec40['limit']===_0x3857('0x31');var _0x17c8f8=_0x3edadc[_0x3857('0x32')];var _0x535469=_0x59bcbd?0x0:_0x3aec40[_0x3857('0x30')];var _0x10d9cb=_0x59bcbd?_0x3edadc['count']:_0x3aec40['offset']+_0x3aec40['limit'];var _0x3a0a76;if(_0x10d9cb>=_0x17c8f8){_0x10d9cb=_0x17c8f8;_0x3a0a76=0xc8;}else{_0x3a0a76=0xce;}_0x399421[_0x3857('0x2e')](_0x3a0a76);return _0x399421[_0x3857('0x33')](_0x3857('0x34'),_0x535469+'-'+_0x10d9cb+'/'+_0x17c8f8)['json'](_0x3edadc);}return null;};}function patchUpdates(_0x1ada66){return function(_0x536852){try{jsonpatch[_0x3857('0x35')](_0x536852,_0x1ada66,!![]);}catch(_0x22c605){return BPromise[_0x3857('0x36')](_0x22c605);}return _0x536852[_0x3857('0x37')]();};}function saveUpdates(_0x4b456e,_0x115266){return function(_0x18f8a2){if(_0x18f8a2){return _0x18f8a2[_0x3857('0x38')](_0x4b456e)[_0x3857('0x23')](function(_0x289ad1){return _0x289ad1;});}return null;};}function removeEntity(_0x2e643b,_0x4053f5){return function(_0x3a540d){if(_0x3a540d){return _0x3a540d[_0x3857('0x39')]()['then'](function(){_0x2e643b[_0x3857('0x2e')](0xcc)[_0x3857('0x3a')]();});}};}function handleEntityNotFound(_0x3151c6,_0x573f92){return function(_0x1becba){if(!_0x1becba){_0x3151c6[_0x3857('0x2d')](0x194);}return _0x1becba;};}function handleError(_0x5e5297,_0x480ee9){_0x480ee9=_0x480ee9||0x1f4;return function(_0x56ec1b){logger[_0x3857('0x28')](_0x56ec1b[_0x3857('0x3b')]);if(_0x56ec1b[_0x3857('0x3c')]){delete _0x56ec1b['name'];}_0x5e5297['status'](_0x480ee9)[_0x3857('0x3d')](_0x56ec1b);};}exports[_0x3857('0x3e')]=function(_0x125c4e,_0x515f0a){var _0xe805a3={},_0x5930c5={},_0x2b0955={'count':0x0,'rows':[]};var _0x2c61b8=_['map'](db[_0x3857('0x3f')][_0x3857('0x40')],function(_0x148da5){return{'name':_0x148da5[_0x3857('0x41')],'type':_0x148da5[_0x3857('0x42')]['key']};});_0x5930c5[_0x3857('0x43')]=_[_0x3857('0x44')](_0x2c61b8,_0x3857('0x3c'));_0x5930c5['query']=_[_0x3857('0x45')](_0x125c4e['query']);_0x5930c5[_0x3857('0x46')]=_[_0x3857('0x47')](_0x5930c5[_0x3857('0x43')],_0x5930c5[_0x3857('0x48')]);_0xe805a3[_0x3857('0x49')]=_['intersection'](_0x5930c5['model'],qs[_0x3857('0x4a')](_0x125c4e[_0x3857('0x48')][_0x3857('0x4a')]));_0xe805a3['attributes']=_0xe805a3[_0x3857('0x49')][_0x3857('0x4b')]?_0xe805a3[_0x3857('0x49')]:_0x5930c5[_0x3857('0x43')];if(!_0x125c4e[_0x3857('0x48')][_0x3857('0x4c')](_0x3857('0x4d'))){_0xe805a3[_0x3857('0x4e')]=qs[_0x3857('0x4e')](_0x125c4e['query'][_0x3857('0x4e')]);_0xe805a3[_0x3857('0x30')]=qs[_0x3857('0x30')](_0x125c4e['query'][_0x3857('0x30')]);}_0xe805a3[_0x3857('0x4f')]=qs[_0x3857('0x50')](_0x125c4e[_0x3857('0x48')][_0x3857('0x50')]);_0xe805a3[_0x3857('0x51')]=qs[_0x3857('0x46')](_[_0x3857('0x52')](_0x125c4e[_0x3857('0x48')],_0x5930c5[_0x3857('0x46')]),_0x2c61b8);if(_0x125c4e[_0x3857('0x48')][_0x3857('0x53')]){_0xe805a3[_0x3857('0x51')]=_[_0x3857('0x54')](_0xe805a3[_0x3857('0x51')],{'$or':_[_0x3857('0x44')](_0x2c61b8,function(_0x3071c7){if(_0x3071c7[_0x3857('0x42')]!==_0x3857('0x55')){var _0x249853={};_0x249853[_0x3071c7['name']]={'$like':'%'+_0x125c4e[_0x3857('0x48')][_0x3857('0x53')]+'%'};return _0x249853;}})});}_0xe805a3=_['merge']({},_0xe805a3,_0x125c4e[_0x3857('0x56')]);var _0x57f21e={'where':_0xe805a3[_0x3857('0x51')]};return db[_0x3857('0x3f')][_0x3857('0x32')](_0x57f21e)[_0x3857('0x23')](function(_0x2108ba){_0x2b0955['count']=_0x2108ba;if(_0x125c4e[_0x3857('0x48')][_0x3857('0x57')]){_0xe805a3['include']=[{'all':!![]}];}return db[_0x3857('0x3f')][_0x3857('0x58')](_0xe805a3);})[_0x3857('0x23')](function(_0x58cf7f){_0x2b0955[_0x3857('0x59')]=_0x58cf7f;return _0x2b0955;})[_0x3857('0x23')](respondWithFilteredResult(_0x515f0a,_0xe805a3))['catch'](handleError(_0x515f0a,null));};exports[_0x3857('0x5a')]=function(_0x2dae72,_0x397a6d){var _0x5eced9={'raw':!![],'where':{'id':_0x2dae72[_0x3857('0x5b')]['id']}},_0x2aaf3e={};_0x2aaf3e['model']=_[_0x3857('0x45')](db['ChatMessage'][_0x3857('0x40')]);_0x2aaf3e[_0x3857('0x48')]=_[_0x3857('0x45')](_0x2dae72[_0x3857('0x48')]);_0x2aaf3e[_0x3857('0x46')]=_[_0x3857('0x47')](_0x2aaf3e[_0x3857('0x43')],_0x2aaf3e['query']);_0x5eced9[_0x3857('0x49')]=_['intersection'](_0x2aaf3e['model'],qs[_0x3857('0x4a')](_0x2dae72[_0x3857('0x48')][_0x3857('0x4a')]));_0x5eced9['attributes']=_0x5eced9[_0x3857('0x49')][_0x3857('0x4b')]?_0x5eced9['attributes']:_0x2aaf3e['model'];if(_0x2dae72[_0x3857('0x48')][_0x3857('0x57')]){_0x5eced9['include']=[{'all':!![]}];}_0x5eced9=_[_0x3857('0x54')]({},_0x5eced9,_0x2dae72['options']);return db[_0x3857('0x3f')][_0x3857('0x5c')](_0x5eced9)[_0x3857('0x23')](handleEntityNotFound(_0x397a6d,null))['then'](respondWithResult(_0x397a6d,null))[_0x3857('0x2c')](handleError(_0x397a6d,null));};exports['create']=function(_0x28ee96,_0x4950b9){return db[_0x3857('0x3f')][_0x3857('0x5d')](_0x28ee96['body'],{})[_0x3857('0x23')](respondWithResult(_0x4950b9,0xc9))['catch'](handleError(_0x4950b9,null));};exports[_0x3857('0x38')]=function(_0x359dbe,_0x56f196){if(_0x359dbe[_0x3857('0x5e')]['id']){delete _0x359dbe[_0x3857('0x5e')]['id'];}return db[_0x3857('0x3f')][_0x3857('0x5c')]({'where':{'id':_0x359dbe['params']['id']}})[_0x3857('0x23')](handleEntityNotFound(_0x56f196,null))[_0x3857('0x23')](saveUpdates(_0x359dbe[_0x3857('0x5e')],null))[_0x3857('0x23')](respondWithResult(_0x56f196,null))[_0x3857('0x2c')](handleError(_0x56f196,null));};exports[_0x3857('0x39')]=function(_0x411f40,_0x5abe0c){return db[_0x3857('0x3f')][_0x3857('0x5c')]({'where':{'id':_0x411f40[_0x3857('0x5b')]['id']}})[_0x3857('0x23')](handleEntityNotFound(_0x5abe0c,null))[_0x3857('0x23')](removeEntity(_0x5abe0c,null))[_0x3857('0x2c')](handleError(_0x5abe0c,null));};exports[_0x3857('0x5f')]=function(_0x5944a1,_0x32ab2a){return db['ChatMessage'][_0x3857('0x5f')]()[_0x3857('0x23')](respondWithResult(_0x32ab2a,null))[_0x3857('0x2c')](handleError(_0x32ab2a,null));};var interaction_log=require(_0x3857('0x15'))(_0x3857('0x60'));exports[_0x3857('0x61')]=function(_0x5e562d,_0x208a49,_0x3b977e){var _0x2fd1fa={'agent':{},'channel':_0x3857('0x62')};if(_0x5e562d[_0x3857('0x5e')]['id']){delete _0x5e562d[_0x3857('0x5e')]['id'];}_0x5e562d[_0x3857('0x5e')]['read']=!![];_0x5e562d[_0x3857('0x5e')][_0x3857('0x63')]=moment()[_0x3857('0x64')](_0x3857('0x65'));_0x5e562d['body'][_0x3857('0x66')]=_0x5e562d[_0x3857('0x5e')][_0x3857('0x66')]||_0x5e562d['user']['id'];_0x2fd1fa[_0x3857('0x67')]['id']=_0x5e562d[_0x3857('0x5e')][_0x3857('0x66')];return db['ChatMessage'][_0x3857('0x5c')]({'where':{'id':_0x5e562d[_0x3857('0x5b')]['id'],'UserId':null}})[_0x3857('0x23')](handleEntityNotFound(_0x208a49,null))[_0x3857('0x23')](saveUpdates(_0x5e562d['body'],null))[_0x3857('0x23')](function(_0x50fd03){if(_0x50fd03){_0x2fd1fa[_0x3857('0x29')]=_0x50fd03['get']({'plain':!![]});return db[_0x3857('0x68')][_0x3857('0x5c')]({'where':{'id':_0x50fd03[_0x3857('0x69')]}});}return null;})[_0x3857('0x23')](handleEntityNotFound(_0x208a49,null))[_0x3857('0x23')](function(_0xb69f0b){if(_0xb69f0b){return _0xb69f0b['update']({'UserId':_0x5e562d[_0x3857('0x5e')]['UserId'],'read1stAt':_[_0x3857('0x6a')](_0xb69f0b['read1stAt'])?moment()[_0x3857('0x64')](_0x3857('0x65')):undefined});}return null;})[_0x3857('0x23')](function(_0x57ecc1){if(_0x57ecc1){_0x2fd1fa['interaction']=_0x57ecc1['get']({'plain':!![]});interaction_log[_0x3857('0x2a')](_0x3857('0x6b'),_0x5e562d[_0x3857('0x6c')]['id'],_0x5e562d[_0x3857('0x6c')][_0x3857('0x3c')],_0x5e562d[_0x3857('0x6c')][_0x3857('0x6d')],_0x2fd1fa[_0x3857('0x6e')]['id'],_0x5e562d[_0x3857('0x5e')]?JSON[_0x3857('0x27')](_0x5e562d[_0x3857('0x5e')]):'null');return respondWithRpcPromise(_0x3857('0x6f'),_0x3857('0x70'),_0x2fd1fa);}return null;})[_0x3857('0x23')](function(_0x30a689){var _0x285191='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x30a689[_0x3857('0x29')][_0x3857('0x71')];return db['sequelize'][_0x3857('0x48')](_0x285191,{'type':db[_0x3857('0x72')][_0x3857('0x73')][_0x3857('0x74')],'raw':!![]})['then'](function(_0x4a7af5){return _0x4a7af5;});})[_0x3857('0x23')](function(_0x5ae12f){if(_0x5ae12f){_0x2fd1fa[_0x3857('0x29')]['contact']=_0x5ae12f[0x0];if(!_0x5e562d['body']['UserId'])return;return db[_0x3857('0x75')][_0x3857('0x5c')]({'where':{'id':_0x5e562d['body']['UserId'],'role':_0x3857('0x67')},'attributes':['id',_0x3857('0x3c'),_0x3857('0x76'),_0x3857('0x77'),_0x3857('0x78')],'raw':!![]});}return null;})[_0x3857('0x23')](function(_0x4ff2b5){if(!_0x4ff2b5)return null;_0x2fd1fa[_0x3857('0x29')][_0x3857('0x67')]=_0x4ff2b5;return _0x2fd1fa;})[_0x3857('0x23')](function(_0x3c67b1){if(_0x3c67b1){if(_0x5e562d[_0x3857('0x5e')]['manual']){_0x2fd1fa['message'][_0x3857('0x79')]=util[_0x3857('0x64')](_0x3857('0x7a'),_0x5e562d[_0x3857('0x6c')]['name']);_0x2fd1fa['message'][_0x3857('0x7b')]=_0x2fd1fa[_0x3857('0x7b')];_0x2fd1fa[_0x3857('0x29')][_0x3857('0x7c')]=_0x2fd1fa[_0x3857('0x7b')];_0x2fd1fa[_0x3857('0x29')][_0x3857('0x7d')]=_0x3857('0x61');return respondWithRpcPromise(_0x3857('0x7e'),_0x3857('0x7e'),{'event':'acceptmessage','message':_[_0x3857('0x54')](_0x2fd1fa[_0x3857('0x29')],JSON[_0x3857('0x7f')](_0x2fd1fa[_0x3857('0x6e')][_0x3857('0x80')]))},client9002)[_0x3857('0x23')](function(){return _0x2fd1fa;});}return _0x2fd1fa;}return null;})[_0x3857('0x23')](respondWithResult(_0x208a49,null))[_0x3857('0x2c')](handleError(_0x208a49,null));};var interaction_log=require(_0x3857('0x15'))(_0x3857('0x60'));exports[_0x3857('0x36')]=function(_0x337f4a,_0x26ccc3,_0x428fd3){var _0xcdfda3={'agent':{},'channel':_0x3857('0x62')};if(_0x337f4a[_0x3857('0x5e')]['id']){delete _0x337f4a['body']['id'];}_0x337f4a[_0x3857('0x5e')][_0x3857('0x66')]=_0x337f4a[_0x3857('0x5e')][_0x3857('0x66')]||_0x337f4a[_0x3857('0x6c')]['id'];_0xcdfda3[_0x3857('0x67')]['id']=_0x337f4a[_0x3857('0x5e')]['UserId'];return db['ChatMessage']['find']({'where':{'id':_0x337f4a[_0x3857('0x5b')]['id'],'UserId':null}})[_0x3857('0x23')](handleEntityNotFound(_0x26ccc3,null))['then'](function(_0x214b31){if(_0x214b31){_0xcdfda3['message']=_0x214b31['get']({'plain':!![]});return db[_0x3857('0x68')][_0x3857('0x5c')]({'where':{'id':_0x214b31['ChatInteractionId']}});}return null;})[_0x3857('0x23')](handleEntityNotFound(_0x26ccc3,null))[_0x3857('0x23')](function(_0xdb3d9a){if(_0xdb3d9a){_0xcdfda3[_0x3857('0x6e')]=_0xdb3d9a['get']({'plain':!![]});interaction_log[_0x3857('0x2a')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x337f4a[_0x3857('0x6c')]['id'],_0x337f4a[_0x3857('0x6c')][_0x3857('0x3c')],_0x337f4a['user'][_0x3857('0x6d')],_0xcdfda3[_0x3857('0x6e')]['id'],_0x337f4a[_0x3857('0x5e')]?JSON[_0x3857('0x27')](_0x337f4a['body']):_0x3857('0x81'));return respondWithRpcPromise(_0x3857('0x82'),'rejectMessage',_0xcdfda3);}return null;})[_0x3857('0x23')](function(_0x3ac459){var _0x312ffd=_0x3857('0x83')+_0x3ac459['message'][_0x3857('0x71')];return db[_0x3857('0x84')]['query'](_0x312ffd,{'type':db[_0x3857('0x72')][_0x3857('0x73')]['SELECT'],'raw':!![]})[_0x3857('0x23')](function(_0x54b28c){return _0x54b28c;});})[_0x3857('0x23')](function(_0x16279a){if(_0x16279a){_0xcdfda3[_0x3857('0x29')]['contact']=_0x16279a[0x0];if(!_0x337f4a['body'][_0x3857('0x66')])return;return db[_0x3857('0x75')][_0x3857('0x5c')]({'where':{'id':_0x337f4a[_0x3857('0x5e')][_0x3857('0x66')],'role':_0x3857('0x67')},'attributes':['id',_0x3857('0x3c'),_0x3857('0x76'),_0x3857('0x77'),'internal'],'raw':!![]});}return null;})[_0x3857('0x23')](function(_0x3abffd){if(!_0x3abffd)return null;_0xcdfda3[_0x3857('0x29')]['agent']=_0x3abffd;return _0xcdfda3;})[_0x3857('0x23')](function(_0x209f49){if(_0x209f49){_0x209f49['message'][_0x3857('0x79')]=util[_0x3857('0x64')](_0x3857('0x7a'),_0x337f4a[_0x3857('0x6c')][_0x3857('0x3c')]);_0x209f49['message'][_0x3857('0x7b')]=_0xcdfda3[_0x3857('0x7b')];_0x209f49[_0x3857('0x29')][_0x3857('0x7c')]=_0xcdfda3[_0x3857('0x7b')];_0x209f49[_0x3857('0x29')][_0x3857('0x7d')]='reject';respondWithRpcPromise(_0x3857('0x7e'),_0x3857('0x7e'),{'event':_0x3857('0x85'),'message':_[_0x3857('0x54')](_0xcdfda3['message'],JSON[_0x3857('0x7f')](_0xcdfda3[_0x3857('0x6e')][_0x3857('0x80')]))},client9002);return _0xcdfda3;}return null;})[_0x3857('0x23')](respondWithResult(_0x26ccc3,null))[_0x3857('0x2c')](handleError(_0x26ccc3,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 77f2574..9a54468 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 _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 +var _0xd9f5=['hasOwnProperty','hook','exports','events','../../mysqldb','update','emit'];(function(_0x43a995,_0x283637){var _0x3a27d4=function(_0x333f94){while(--_0x333f94){_0x43a995['push'](_0x43a995['shift']());}};_0x3a27d4(++_0x283637);}(_0xd9f5,0x1a0));var _0x5d9f=function(_0x4a7e98,_0x250137){_0x4a7e98=_0x4a7e98-0x0;var _0x27d10d=_0xd9f5[_0x4a7e98];return _0x27d10d;};'use strict';var EventEmitter=require(_0x5d9f('0x0'));var ChatMessage=require(_0x5d9f('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5d9f('0x2'),'afterDestroy':'remove'};function emitEvent(_0x204703){return function(_0x4bc6f9,_0x317fea,_0x40c4ba){ChatMessageEvents['emit'](_0x204703+':'+_0x4bc6f9['id'],_0x4bc6f9);ChatMessageEvents[_0x5d9f('0x3')](_0x204703,_0x4bc6f9);_0x40c4ba(null);};}for(var e in events){if(events[_0x5d9f('0x4')](e)){var event=events[e];ChatMessage[_0x5d9f('0x5')](e,emitEvent(event));}}module[_0x5d9f('0x6')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index bb0e4ab..273fcde 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 _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 +var _0x6131=['chat_messages','FULLTEXT','models','get','direction','toLowerCase','out','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','lodash','moment','bluebird','request-promise','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6131,0xe0));var _0x1613=function(_0x46cd04,_0x32f2da){_0x46cd04=_0x46cd04-0x0;var _0x108808=_0x6131[_0x46cd04];return _0x108808;};'use strict';var _=require(_0x1613('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x1613('0x1'));var BPromise=require(_0x1613('0x2'));var rp=require(_0x1613('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1613('0x4'));var config=require(_0x1613('0x5'));var attributes=require(_0x1613('0x6'));module[_0x1613('0x7')]=function(_0x3b7e5b,_0x18c654){return _0x3b7e5b[_0x1613('0x8')](_0x1613('0x9'),attributes,{'tableName':_0x1613('0xa'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':_0x1613('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x463eef,_0x35bf0e,_0x2da226){var _0x1abf94=_0x3b7e5b[_0x1613('0xc')];var _0x5bd037=_0x463eef[_0x1613('0xd')]({'plain':!![]});if(_0x5bd037[_0x1613('0xe')][_0x1613('0xf')]()==='in'||_0x5bd037['direction']['toLowerCase']()===_0x1613('0x10')&&!_0x5bd037['secret']&&!_['isNil'](_0x5bd037['UserId'])){_0x1abf94[_0x1613('0x11')][_0x1613('0x12')]({'where':{'id':_0x5bd037[_0x1613('0x13')]}})[_0x1613('0x14')](function(_0x8bb50e){if(_0x8bb50e){_0x8bb50e[_0x1613('0x15')]({'lastMsgAt':_0x5bd037[_0x1613('0x16')],'lastMsgDirection':_0x5bd037['direction']['toLowerCase']()});}})[_0x1613('0x17')](function(_0x85272d){console[_0x1613('0x18')](_0x85272d);});}_0x2da226();}},'charset':_0x1613('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 7f3b373..05f9993 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 _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 +var _0xb80c=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateChatMessage','create','options','raw','debug','catch','lodash','util','moment'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0xb80c,0x147));var _0xcb80=function(_0xd38ef9,_0x498d2b){_0xd38ef9=_0xd38ef9-0x0;var _0x3be30b=_0xb80c[_0xd38ef9];return _0x3be30b;};'use strict';var _=require(_0xcb80('0x0'));var util=require(_0xcb80('0x1'));var moment=require(_0xcb80('0x2'));var BPromise=require(_0xcb80('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb80('0x4'));var db=require(_0xcb80('0x5'))['db'];var utils=require(_0xcb80('0x6'));var logger=require(_0xcb80('0x7'))(_0xcb80('0x8'));var config=require(_0xcb80('0x9'));var jayson=require(_0xcb80('0xa'));var client=jayson['client'][_0xcb80('0xb')]({'port':0x232a});config[_0xcb80('0xc')]=_[_0xcb80('0xd')](config[_0xcb80('0xc')],{'host':_0xcb80('0xe'),'port':0x18eb});var socket=require(_0xcb80('0xf'))(new Redis(config[_0xcb80('0xc')]));require('./chatMessage.socket')[_0xcb80('0x10')](socket);function respondWithRpcPromise(_0x53f2d8,_0x40c8c0,_0x5ee568){return new BPromise(function(_0x52a4fb,_0x4661e5){return client['request'](_0x53f2d8,_0x5ee568)[_0xcb80('0x11')](function(_0x441a47){logger[_0xcb80('0x12')](_0xcb80('0x13'),_0x40c8c0,_0xcb80('0x14'));logger['debug'](_0xcb80('0x15'),_0x40c8c0,_0xcb80('0x14'),JSON[_0xcb80('0x16')](_0x441a47));if(_0x441a47[_0xcb80('0x17')]){if(_0x441a47[_0xcb80('0x17')][_0xcb80('0x18')]===0x1f4){logger[_0xcb80('0x17')]('ChatMessage,\x20%s,\x20%s',_0x40c8c0,_0x441a47[_0xcb80('0x17')][_0xcb80('0x19')]);return _0x4661e5(_0x441a47[_0xcb80('0x17')][_0xcb80('0x19')]);}logger[_0xcb80('0x17')](_0xcb80('0x13'),_0x40c8c0,_0x441a47[_0xcb80('0x17')][_0xcb80('0x19')]);return _0x52a4fb(_0x441a47['error'][_0xcb80('0x19')]);}else{logger[_0xcb80('0x12')](_0xcb80('0x13'),_0x40c8c0,_0xcb80('0x14'));_0x52a4fb(_0x441a47[_0xcb80('0x1a')][_0xcb80('0x19')]);}})['catch'](function(_0x136022){logger[_0xcb80('0x17')]('ChatMessage,\x20%s,\x20%s',_0x40c8c0,_0x136022);_0x4661e5(_0x136022);});});}exports[_0xcb80('0x1b')]=function(_0x6b9b22){var _0x28cf7b=this;return new Promise(function(_0x274252,_0x21b3e5){return db['ChatMessage'][_0xcb80('0x1c')](_0x6b9b22['body'],{'raw':_0x6b9b22['options']?_0x6b9b22[_0xcb80('0x1d')][_0xcb80('0x1e')]===undefined?!![]:![]:!![]})[_0xcb80('0x11')](function(_0x477fd2){logger[_0xcb80('0x12')]('CreateChatMessage',_0x6b9b22);logger[_0xcb80('0x1f')](_0xcb80('0x1b'),_0x6b9b22,JSON['stringify'](_0x477fd2));_0x274252(_0x477fd2);})[_0xcb80('0x20')](function(_0xb65236){logger[_0xcb80('0x17')]('CreateChatMessage',_0xb65236[_0xcb80('0x19')],_0x6b9b22);_0x21b3e5(_0x28cf7b[_0xcb80('0x17')](0x1f4,_0xb65236['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 9582cf7..20556b8 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 _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 +var _0xcb99=['chatMessage:','./chatMessage.events','remove','emit','removeListener','length'];(function(_0x4fec8b,_0xbf11e3){var _0x2741bb=function(_0x6d951a){while(--_0x6d951a){_0x4fec8b['push'](_0x4fec8b['shift']());}};_0x2741bb(++_0xbf11e3);}(_0xcb99,0x8b));var _0x9cb9=function(_0x356127,_0x4873ac){_0x356127=_0x356127-0x0;var _0x5d4c75=_0xcb99[_0x356127];return _0x5d4c75;};'use strict';var ChatMessageEvents=require(_0x9cb9('0x0'));var events=['save',_0x9cb9('0x1'),'update'];function createListener(_0x480364,_0x3a2f21){return function(_0x1308a8){_0x3a2f21[_0x9cb9('0x2')](_0x480364,_0x1308a8);};}function removeListener(_0x51f2ee,_0x167735){return function(){ChatMessageEvents[_0x9cb9('0x3')](_0x51f2ee,_0x167735);};}exports['register']=function(_0x214b72){for(var _0x509cfc=0x0,_0x2ed26a=events[_0x9cb9('0x4')];_0x509cfc<_0x2ed26a;_0x509cfc++){var _0x1bf9b7=events[_0x509cfc];var _0x1dd62f=createListener(_0x9cb9('0x5')+_0x1bf9b7,_0x214b72);ChatMessageEvents['on'](_0x1bf9b7,_0x1dd62f);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 1fef776..6d16ab7 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 _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 +var _0x41cb=['/:id','update','put','accept','/:id/reject','reject','multer','util','path','Router','../../components/auth/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','/describe','describe','show','chat','chatmessage:create','create'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x41cb,0xa0));var _0xb41c=function(_0x4043be,_0x33604e){_0x4043be=_0x4043be-0x0;var _0x30e2ae=_0x41cb[_0x4043be];return _0x30e2ae;};'use strict';var multer=require(_0xb41c('0x0'));var util=require(_0xb41c('0x1'));var path=require(_0xb41c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb41c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb41c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb41c('0x5'));var controller=require(_0xb41c('0x6'));router['get']('/',auth[_0xb41c('0x7')](),controller[_0xb41c('0x8')]);router[_0xb41c('0x9')](_0xb41c('0xa'),auth[_0xb41c('0x7')](),controller[_0xb41c('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xb41c('0xc')]);router['post']('/',auth[_0xb41c('0x7')](),interaction['tracked'](_0xb41c('0xd'),_0xb41c('0xe')),controller[_0xb41c('0xf')]);router['put'](_0xb41c('0x10'),controller[_0xb41c('0x11')]);router[_0xb41c('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0xb41c('0x13')]);router[_0xb41c('0x12')](_0xb41c('0x14'),auth['isAuthenticated'](),controller[_0xb41c('0x15')]);router['delete'](_0xb41c('0x10'),auth[_0xb41c('0x7')](),controller['destroy']);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 d3ef90d..f1f5ead 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 _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 +var _0x0b0e=['medium','sequelize','TEXT'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x0b0e,0x187));var _0xe0b0=function(_0x14e1cb,_0xd3465e){_0x14e1cb=_0x14e1cb-0x0;var _0x18a337=_0x0b0e[_0x14e1cb];return _0x18a337;};'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 diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index dea61a2..1faf35d 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 _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 +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(_0x4fe0eb,_0x2cfd55){var _0xf43153=function(_0x3e6502){while(--_0x3e6502){_0x4fe0eb['push'](_0x4fe0eb['shift']());}};_0xf43153(++_0x2cfd55);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 510b59b..1b1afc3 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 _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 +var _0x19d1=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x1eb3c6,_0x2cc1e4){var _0x1627e9=function(_0x10aa23){while(--_0x10aa23){_0x1eb3c6['push'](_0x1eb3c6['shift']());}};_0x1627e9(++_0x2cc1e4);}(_0x19d1,0x16c));var _0x119d=function(_0x3f9704,_0x1b2bc3){_0x3f9704=_0x3f9704-0x0;var _0x2ebc59=_0x19d1[_0x3f9704];return _0x2ebc59;};'use strict';var EventEmitter=require(_0x119d('0x0'));var ChatOfflineMessage=require(_0x119d('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x119d('0x2')](0x0);var events={'afterCreate':_0x119d('0x3'),'afterUpdate':_0x119d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2bc80e){return function(_0x4dd235,_0x4239d3,_0x336986){ChatOfflineMessageEvents[_0x119d('0x5')](_0x2bc80e+':'+_0x4dd235['id'],_0x4dd235);ChatOfflineMessageEvents[_0x119d('0x5')](_0x2bc80e,_0x4dd235);_0x336986(null);};}for(var e in events){if(events[_0x119d('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x119d('0x7')](e,emitEvent(event));}}module[_0x119d('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index de62074..36ad84e 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 _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 +var _0x4758=['ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','define'];(function(_0x596a17,_0x4ba425){var _0x41319b=function(_0x227715){while(--_0x227715){_0x596a17['push'](_0x596a17['shift']());}};_0x41319b(++_0x4ba425);}(_0x4758,0x8a));var _0x8475=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4758[_0x321bb2];return _0x9c12ed;};'use strict';var attributes=require(_0x8475('0x0'));module['exports']=function(_0x2294fa){return _0x2294fa[_0x8475('0x1')](_0x8475('0x2'),attributes,{'tableName':_0x8475('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8475('0x4')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index ce0a971..8403ef5 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 _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 +var _0xd0a2=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis'];(function(_0xbce40f,_0xd74797){var _0x57326d=function(_0x3605e2){while(--_0x3605e2){_0xbce40f['push'](_0xbce40f['shift']());}};_0x57326d(++_0xd74797);}(_0xd0a2,0x128));var _0x2d0a=function(_0x1c1172,_0x27c3c4){_0x1c1172=_0x1c1172-0x0;var _0x300943=_0xd0a2[_0x1c1172];return _0x300943;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2d0a('0x0'));var BPromise=require(_0x2d0a('0x1'));var rs=require(_0x2d0a('0x2'));var fs=require('fs');var Redis=require(_0x2d0a('0x3'));var db=require(_0x2d0a('0x4'))['db'];var utils=require(_0x2d0a('0x5'));var logger=require(_0x2d0a('0x6'))(_0x2d0a('0x7'));var config=require(_0x2d0a('0x8'));var jayson=require(_0x2d0a('0x9'));var client=jayson[_0x2d0a('0xa')][_0x2d0a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4017a3,_0x2d29d3,_0x3887bf){return new BPromise(function(_0x504776,_0xd487f2){return client[_0x2d0a('0xc')](_0x4017a3,_0x3887bf)[_0x2d0a('0xd')](function(_0x5b17a3){logger[_0x2d0a('0xe')](_0x2d0a('0xf'),_0x2d29d3,_0x2d0a('0x10'));logger[_0x2d0a('0x11')](_0x2d0a('0x12'),_0x2d29d3,_0x2d0a('0x10'),JSON[_0x2d0a('0x13')](_0x5b17a3));if(_0x5b17a3[_0x2d0a('0x14')]){if(_0x5b17a3['error'][_0x2d0a('0x15')]===0x1f4){logger[_0x2d0a('0x14')](_0x2d0a('0xf'),_0x2d29d3,_0x5b17a3[_0x2d0a('0x14')][_0x2d0a('0x16')]);return _0xd487f2(_0x5b17a3['error'][_0x2d0a('0x16')]);}logger[_0x2d0a('0x14')](_0x2d0a('0xf'),_0x2d29d3,_0x5b17a3['error'][_0x2d0a('0x16')]);return _0x504776(_0x5b17a3[_0x2d0a('0x14')][_0x2d0a('0x16')]);}else{logger['info'](_0x2d0a('0xf'),_0x2d29d3,_0x2d0a('0x10'));_0x504776(_0x5b17a3[_0x2d0a('0x17')][_0x2d0a('0x16')]);}})[_0x2d0a('0x18')](function(_0x63a465){logger[_0x2d0a('0x14')](_0x2d0a('0xf'),_0x2d29d3,_0x63a465);_0xd487f2(_0x63a465);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 0560dd0..345c30b 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 _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 +var _0x9488=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer'];(function(_0x2df016,_0x3827c7){var _0x3e9f39=function(_0x2567e9){while(--_0x2567e9){_0x2df016['push'](_0x2df016['shift']());}};_0x3e9f39(++_0x3827c7);}(_0x9488,0x68));var _0x8948=function(_0x4ec891,_0x18a97c){_0x4ec891=_0x4ec891-0x0;var _0x4c158f=_0x9488[_0x4ec891];return _0x4c158f;};'use strict';var multer=require(_0x8948('0x0'));var util=require(_0x8948('0x1'));var path=require(_0x8948('0x2'));var timeout=require(_0x8948('0x3'));var express=require(_0x8948('0x4'));var router=express[_0x8948('0x5')]();var fs_extra=require(_0x8948('0x6'));var auth=require(_0x8948('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8948('0x8'));var controller=require('./chatOfflineMessage.controller');router['get']('/',auth[_0x8948('0x9')](),controller[_0x8948('0xa')]);router['get'](_0x8948('0xb'),auth[_0x8948('0x9')](),controller[_0x8948('0xc')]);router['get'](_0x8948('0xd'),auth[_0x8948('0x9')](),controller[_0x8948('0xe')]);router[_0x8948('0xf')]('/',auth[_0x8948('0x9')](),controller[_0x8948('0x10')]);router[_0x8948('0x11')]('/:id',auth[_0x8948('0x9')](),controller[_0x8948('0x12')]);router[_0x8948('0x13')](_0x8948('0xd'),auth[_0x8948('0x9')](),controller['destroy']);module[_0x8948('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 992dec0..33e2753 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 _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 +var _0x9df5=['STRING','ENUM','mouseOver','INTEGER','exports'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0x9df5,0x11c));var _0x59df=function(_0xa2efdb,_0x788be8){_0xa2efdb=_0xa2efdb-0x0;var _0x2b11a0=_0x9df5[_0xa2efdb];return _0x2b11a0;};'use strict';var Sequelize=require('sequelize');module[_0x59df('0x0')]={'name':{'type':Sequelize[_0x59df('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x59df('0x2')](_0x59df('0x3'),'timeout'),'defaultValue':_0x59df('0x3')},'selector':{'type':Sequelize[_0x59df('0x1')]},'timeout':{'type':Sequelize[_0x59df('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index fd20403..9c2d410 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 _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 +var _0x4074=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','destroy','error','stack','name','show','params','model','query','keys','filters','intersection','attributes','fields','includeAll','include','options','find','catch','create','ChatProactiveAction','body','then'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x4074,0xf0));var _0x4407=function(_0x4fe942,_0x422dbc){_0x4fe942=_0x4fe942-0x0;var _0x5287df=_0x4074[_0x4fe942];return _0x5287df;};'use strict';var emlformat=require(_0x4407('0x0'));var rimraf=require(_0x4407('0x1'));var zipdir=require(_0x4407('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4407('0x3'));var moment=require(_0x4407('0x4'));var BPromise=require(_0x4407('0x5'));var Mustache=require(_0x4407('0x6'));var util=require(_0x4407('0x7'));var path=require(_0x4407('0x8'));var sox=require(_0x4407('0x9'));var csv=require(_0x4407('0xa'));var ejs=require(_0x4407('0xb'));var fs=require('fs');var fs_extra=require(_0x4407('0xc'));var _=require('lodash');var squel=require(_0x4407('0xd'));var crypto=require('crypto');var jsforce=require(_0x4407('0xe'));var deskjs=require(_0x4407('0xf'));var toCsv=require(_0x4407('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4407('0x10'));var qs=require(_0x4407('0x11'));var as=require(_0x4407('0x12'));var hardwareService=require(_0x4407('0x13'));var logger=require(_0x4407('0x14'))(_0x4407('0x15'));var utils=require(_0x4407('0x16'));var config=require(_0x4407('0x17'));var licenseUtil=require(_0x4407('0x18'));var db=require(_0x4407('0x19'))['db'];function respondWithStatusCode(_0x14f398,_0x5d0c41){_0x5d0c41=_0x5d0c41||0xcc;return function(_0x3f8f23){if(_0x3f8f23){return _0x14f398[_0x4407('0x1a')](_0x5d0c41);}return _0x14f398['status'](_0x5d0c41)[_0x4407('0x1b')]();};}function respondWithResult(_0x4c62b9,_0x1d2ec8){_0x1d2ec8=_0x1d2ec8||0xc8;return function(_0x27724a){if(_0x27724a){return _0x4c62b9[_0x4407('0x1c')](_0x1d2ec8)[_0x4407('0x1d')](_0x27724a);}};}function respondWithFilteredResult(_0x1840dd,_0x417e19){return function(_0x1c5a0c){if(_0x1c5a0c){var _0x2e709f=typeof _0x417e19['offset']===_0x4407('0x1e')&&typeof _0x417e19[_0x4407('0x1f')]===_0x4407('0x1e');var _0x367d55=_0x1c5a0c[_0x4407('0x20')];var _0x5b50b7=_0x2e709f?0x0:_0x417e19[_0x4407('0x21')];var _0x54caa1=_0x2e709f?_0x1c5a0c[_0x4407('0x20')]:_0x417e19[_0x4407('0x21')]+_0x417e19[_0x4407('0x1f')];var _0x2db8b2;if(_0x54caa1>=_0x367d55){_0x54caa1=_0x367d55;_0x2db8b2=0xc8;}else{_0x2db8b2=0xce;}_0x1840dd[_0x4407('0x1c')](_0x2db8b2);return _0x1840dd['set'](_0x4407('0x22'),_0x5b50b7+'-'+_0x54caa1+'/'+_0x367d55)['json'](_0x1c5a0c);}return null;};}function patchUpdates(_0x36a948){return function(_0x28bb2c){try{jsonpatch[_0x4407('0x23')](_0x28bb2c,_0x36a948,!![]);}catch(_0x445fe6){return BPromise['reject'](_0x445fe6);}return _0x28bb2c[_0x4407('0x24')]();};}function saveUpdates(_0x1fa9f1,_0x137f8e){return function(_0x2c880a){if(_0x2c880a){return _0x2c880a[_0x4407('0x25')](_0x1fa9f1)['then'](function(_0xa7265d){return _0xa7265d;});}return null;};}function removeEntity(_0x16272f,_0x5e214c){return function(_0x21b048){if(_0x21b048){return _0x21b048[_0x4407('0x26')]()['then'](function(){_0x16272f[_0x4407('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309274,_0x5386f4){return function(_0x40fb1e){if(!_0x40fb1e){_0x309274['sendStatus'](0x194);}return _0x40fb1e;};}function handleError(_0x374754,_0x4bf227){_0x4bf227=_0x4bf227||0x1f4;return function(_0x57ba27){logger[_0x4407('0x27')](_0x57ba27[_0x4407('0x28')]);if(_0x57ba27[_0x4407('0x29')]){delete _0x57ba27['name'];}_0x374754['status'](_0x4bf227)['send'](_0x57ba27);};}exports[_0x4407('0x2a')]=function(_0x2feb6b,_0x1f9828){var _0x84a8a={'raw':!![],'where':{'id':_0x2feb6b[_0x4407('0x2b')]['id']}},_0x1d6b3d={};_0x1d6b3d[_0x4407('0x2c')]=_['keys'](db['ChatProactiveAction']['rawAttributes']);_0x1d6b3d[_0x4407('0x2d')]=_[_0x4407('0x2e')](_0x2feb6b[_0x4407('0x2d')]);_0x1d6b3d[_0x4407('0x2f')]=_[_0x4407('0x30')](_0x1d6b3d[_0x4407('0x2c')],_0x1d6b3d[_0x4407('0x2d')]);_0x84a8a[_0x4407('0x31')]=_[_0x4407('0x30')](_0x1d6b3d[_0x4407('0x2c')],qs['fields'](_0x2feb6b['query'][_0x4407('0x32')]));_0x84a8a[_0x4407('0x31')]=_0x84a8a[_0x4407('0x31')]['length']?_0x84a8a[_0x4407('0x31')]:_0x1d6b3d[_0x4407('0x2c')];if(_0x2feb6b[_0x4407('0x2d')][_0x4407('0x33')]){_0x84a8a[_0x4407('0x34')]=[{'all':!![]}];}_0x84a8a=_['merge']({},_0x84a8a,_0x2feb6b[_0x4407('0x35')]);return db['ChatProactiveAction'][_0x4407('0x36')](_0x84a8a)['then'](handleEntityNotFound(_0x1f9828,null))['then'](respondWithResult(_0x1f9828,null))[_0x4407('0x37')](handleError(_0x1f9828,null));};exports[_0x4407('0x38')]=function(_0x3aa619,_0x3a9537){return db[_0x4407('0x39')][_0x4407('0x38')](_0x3aa619[_0x4407('0x3a')],{})['then'](respondWithResult(_0x3a9537,0xc9))[_0x4407('0x37')](handleError(_0x3a9537,null));};exports[_0x4407('0x25')]=function(_0x189dd0,_0x4e068f){if(_0x189dd0[_0x4407('0x3a')]['id']){delete _0x189dd0['body']['id'];}return db[_0x4407('0x39')]['find']({'where':{'id':_0x189dd0[_0x4407('0x2b')]['id']}})[_0x4407('0x3b')](handleEntityNotFound(_0x4e068f,null))[_0x4407('0x3b')](saveUpdates(_0x189dd0[_0x4407('0x3a')],null))['then'](respondWithResult(_0x4e068f,null))[_0x4407('0x37')](handleError(_0x4e068f,null));};exports[_0x4407('0x26')]=function(_0xd31d71,_0x1bf4e2){return db[_0x4407('0x39')][_0x4407('0x36')]({'where':{'id':_0xd31d71[_0x4407('0x2b')]['id']}})[_0x4407('0x3b')](handleEntityNotFound(_0x1bf4e2,null))[_0x4407('0x3b')](removeEntity(_0x1bf4e2,null))['catch'](handleError(_0x1bf4e2,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 7de8f06..1408d5a 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 _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 +var _0x27c0=['../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions','lodash','util','moment'];(function(_0x58e69d,_0x349893){var _0x2530ac=function(_0x70a89c){while(--_0x70a89c){_0x58e69d['push'](_0x58e69d['shift']());}};_0x2530ac(++_0x349893);}(_0x27c0,0xb5));var _0x027c=function(_0x22c81f,_0x3a3c86){_0x22c81f=_0x22c81f-0x0;var _0x3b897f=_0x27c0[_0x22c81f];return _0x3b897f;};'use strict';var _=require(_0x027c('0x0'));var util=require(_0x027c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x027c('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x027c('0x3'));var attributes=require(_0x027c('0x4'));module[_0x027c('0x5')]=function(_0xdccf39,_0x194383){return _0xdccf39['define'](_0x027c('0x6'),attributes,{'tableName':_0x027c('0x7'),'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 489d8cf..8e5f72d 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 _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 +var _0x6775=['stringify','error','code','message','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent'];(function(_0x312b37,_0x19f474){var _0x2e5f91=function(_0x19473d){while(--_0x19473d){_0x312b37['push'](_0x312b37['shift']());}};_0x2e5f91(++_0x19f474);}(_0x6775,0xb9));var _0x5677=function(_0x30b91e,_0x2ef4e7){_0x30b91e=_0x30b91e-0x0;var _0x4490c0=_0x6775[_0x30b91e];return _0x4490c0;};'use strict';var _=require(_0x5677('0x0'));var util=require(_0x5677('0x1'));var moment=require(_0x5677('0x2'));var BPromise=require('bluebird');var rs=require(_0x5677('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5677('0x4'));var logger=require(_0x5677('0x5'))(_0x5677('0x6'));var config=require(_0x5677('0x7'));var jayson=require(_0x5677('0x8'));var client=jayson[_0x5677('0x9')][_0x5677('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x388f53,_0x2861fd,_0x4e7394){return new BPromise(function(_0x44ef12,_0x38d1ee){return client['request'](_0x388f53,_0x4e7394)[_0x5677('0xb')](function(_0x521d65){logger[_0x5677('0xc')](_0x5677('0xd'),_0x2861fd,_0x5677('0xe'));logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x2861fd,_0x5677('0xe'),JSON[_0x5677('0xf')](_0x521d65));if(_0x521d65[_0x5677('0x10')]){if(_0x521d65[_0x5677('0x10')][_0x5677('0x11')]===0x1f4){logger[_0x5677('0x10')](_0x5677('0xd'),_0x2861fd,_0x521d65[_0x5677('0x10')][_0x5677('0x12')]);return _0x38d1ee(_0x521d65[_0x5677('0x10')]['message']);}logger[_0x5677('0x10')](_0x5677('0xd'),_0x2861fd,_0x521d65['error']['message']);return _0x44ef12(_0x521d65['error'][_0x5677('0x12')]);}else{logger[_0x5677('0xc')](_0x5677('0xd'),_0x2861fd,_0x5677('0xe'));_0x44ef12(_0x521d65['result'][_0x5677('0x12')]);}})[_0x5677('0x13')](function(_0x406e01){logger[_0x5677('0x10')](_0x5677('0xd'),_0x2861fd,_0x406e01);_0x38d1ee(_0x406e01);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 130b395..6320354 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 _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 +var _0xeec6=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id','isAuthenticated','post','create','put','update','delete','exports'];(function(_0x48ec4a,_0x88c5ff){var _0x6561b7=function(_0x14e73c){while(--_0x14e73c){_0x48ec4a['push'](_0x48ec4a['shift']());}};_0x6561b7(++_0x88c5ff);}(_0xeec6,0x1c2));var _0x6eec=function(_0x5534fe,_0x43c22e){_0x5534fe=_0x5534fe-0x0;var _0x3d1dc2=_0xeec6[_0x5534fe];return _0x3d1dc2;};'use strict';var multer=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var path=require(_0x6eec('0x2'));var timeout=require(_0x6eec('0x3'));var express=require('express');var router=express[_0x6eec('0x4')]();var fs_extra=require(_0x6eec('0x5'));var auth=require(_0x6eec('0x6'));var interaction=require(_0x6eec('0x7'));var config=require(_0x6eec('0x8'));var controller=require(_0x6eec('0x9'));router['get'](_0x6eec('0xa'),auth[_0x6eec('0xb')](),controller['show']);router[_0x6eec('0xc')]('/',auth[_0x6eec('0xb')](),controller[_0x6eec('0xd')]);router[_0x6eec('0xe')]('/:id',auth[_0x6eec('0xb')](),controller[_0x6eec('0xf')]);router[_0x6eec('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6eec('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 35d5abc..a184f1b 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 _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 +var _0x4a93=['beepall','roundrobin','STRING','name','INTEGER','rrmemory'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x4a93,0x98));var _0x34a9=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x4a93[_0x476bf4];return _0x788ffe;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x34a9('0x0')],'unique':_0x34a9('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x34a9('0x0')]},'timeout':{'type':Sequelize[_0x34a9('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x34a9('0x3'),_0x34a9('0x4'),_0x34a9('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index dffc79f..f81bbfa 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 _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 +var _0xb739=['ChatQueue','include','query','findAll','rows','params','filters','intersection','model','fields','attributes','length','includeAll','merge','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','keys','UserChatQueue','hasOwnProperty','sort','pick','ChatQueueId','User','findAndCountAll','chatPause','updatedAt','createdAt','format','%s/%s','getTeams','order','filter','nolimit','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userChatQueue:save','removeTeams','Team','select','field','tq.TeamId','join','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','union','compact','value','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','spread','isArray','getAgents','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where'];(function(_0x170bff,_0x31c89b){var _0xbe234e=function(_0x18a41d){while(--_0x18a41d){_0x170bff['push'](_0x170bff['shift']());}};_0xbe234e(++_0x31c89b);}(_0xb739,0x1c9));var _0x9b73=function(_0x5e0bfe,_0x747312){_0x5e0bfe=_0x5e0bfe-0x0;var _0x6468b8=_0xb739[_0x5e0bfe];return _0x6468b8;};'use strict';var BPromise=require('bluebird');var util=require(_0x9b73('0x0'));var _=require(_0x9b73('0x1'));var squel=require('squel');var Redis=require('ioredis');var qs=require(_0x9b73('0x2'));var logger=require(_0x9b73('0x3'))(_0x9b73('0x4'));var config=require('../../config/environment');var db=require(_0x9b73('0x5'))['db'];config[_0x9b73('0x6')]=_[_0x9b73('0x7')](config[_0x9b73('0x6')],{'host':_0x9b73('0x8'),'port':0x18eb});var socket=require(_0x9b73('0x9'))(new Redis(config[_0x9b73('0x6')]));require(_0x9b73('0xa'))[_0x9b73('0xb')](socket);function respondWithStatusCode(_0x4898c5,_0x5a4100){_0x5a4100=_0x5a4100||0xcc;return function(_0x17b966){if(_0x17b966){return _0x4898c5['sendStatus'](_0x5a4100);}return _0x4898c5['status'](_0x5a4100)[_0x9b73('0xc')]();};}function respondWithResult(_0x43daec,_0xa55abb){_0xa55abb=_0xa55abb||0xc8;return function(_0x20dc37){if(_0x20dc37){return _0x43daec[_0x9b73('0xd')](_0xa55abb)[_0x9b73('0xe')](_0x20dc37);}};}function respondWithFilteredResult(_0x27ac3a,_0x21bb8d){return function(_0x3d1a76){if(_0x3d1a76){var _0x5ab05f=typeof _0x21bb8d[_0x9b73('0xf')]===_0x9b73('0x10')&&typeof _0x21bb8d[_0x9b73('0x11')]===_0x9b73('0x10');var _0x4cd027=_0x3d1a76[_0x9b73('0x12')];var _0x400fa4=_0x5ab05f?0x0:_0x21bb8d[_0x9b73('0xf')];var _0x83199c=_0x5ab05f?_0x3d1a76[_0x9b73('0x12')]:_0x21bb8d['offset']+_0x21bb8d['limit'];var _0x35698e;if(_0x83199c>=_0x4cd027){_0x83199c=_0x4cd027;_0x35698e=0xc8;}else{_0x35698e=0xce;}_0x27ac3a[_0x9b73('0xd')](_0x35698e);return _0x27ac3a[_0x9b73('0x13')](_0x9b73('0x14'),_0x400fa4+'-'+_0x83199c+'/'+_0x4cd027)[_0x9b73('0xe')](_0x3d1a76);}return null;};}function saveUpdates(_0xccb9b0){return function(_0x2e844e){if(_0x2e844e){return _0x2e844e[_0x9b73('0x15')](_0xccb9b0)[_0x9b73('0x16')](function(_0x33c703){return _0x33c703;});}return null;};}function removeEntity(_0x5c6f92){return function(_0x4d570a){if(_0x4d570a){return _0x4d570a[_0x9b73('0x17')]()['then'](function(){var _0x35a871=_0x4d570a[_0x9b73('0x18')]({'plain':!![]});var _0x2e76ea='ChatQueues';return db[_0x9b73('0x19')]['destroy']({'where':{'type':_0x2e76ea,'resourceId':_0x35a871['id']}})[_0x9b73('0x16')](function(){return _0x4d570a;});})['then'](function(){_0x5c6f92[_0x9b73('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9518d5){return function(_0x467c91){if(!_0x467c91){_0x9518d5[_0x9b73('0x1a')](0x194);}return _0x467c91;};}function handleError(_0xab1469,_0x4b0ef0){_0x4b0ef0=_0x4b0ef0||0x1f4;return function(_0x478f7e){logger[_0x9b73('0x1b')](_0x478f7e[_0x9b73('0x1c')]);if(_0x478f7e[_0x9b73('0x1d')]){delete _0x478f7e['name'];}_0xab1469[_0x9b73('0xd')](_0x4b0ef0)[_0x9b73('0x1e')](_0x478f7e);};}exports[_0x9b73('0x1f')]=function(_0x4d0b82,_0x28c42e){var _0x1e0694={};var _0x121aa1={'count':0x0,'rows':[]};var _0x54940c=_[_0x9b73('0x20')](db['ChatQueue'][_0x9b73('0x21')],function(_0x58e67f){return{'name':_0x58e67f[_0x9b73('0x22')],'type':_0x58e67f[_0x9b73('0x23')][_0x9b73('0x24')]};});_0x1e0694=qs[_0x9b73('0x25')](_0x54940c,_0x4d0b82);var _0x5ce8b7={'where':_0x1e0694[_0x9b73('0x26')]};return db[_0x9b73('0x27')][_0x9b73('0x12')](_0x5ce8b7)[_0x9b73('0x16')](function(_0x30a40b){_0x121aa1['count']=_0x30a40b;_0x1e0694[_0x9b73('0x28')]=qs['include'](_0x4d0b82[_0x9b73('0x29')]);return db[_0x9b73('0x27')][_0x9b73('0x2a')](_0x1e0694);})[_0x9b73('0x16')](function(_0xc66f96){_0x121aa1[_0x9b73('0x2b')]=_0xc66f96;return _0x121aa1;})[_0x9b73('0x16')](respondWithFilteredResult(_0x28c42e,_0x1e0694))['catch'](handleError(_0x28c42e,null));};exports['show']=function(_0x3c1b6c,_0x1a82d8){var _0x39635f={'raw':!![],'where':{'id':_0x3c1b6c[_0x9b73('0x2c')]['id']}},_0x108686={};_0x108686['model']=_['keys'](db[_0x9b73('0x27')]['rawAttributes']);_0x108686['query']=_['keys'](_0x3c1b6c[_0x9b73('0x29')]);_0x108686[_0x9b73('0x2d')]=_[_0x9b73('0x2e')](_0x108686[_0x9b73('0x2f')],_0x108686[_0x9b73('0x29')]);_0x39635f['attributes']=_['intersection'](_0x108686[_0x9b73('0x2f')],qs[_0x9b73('0x30')](_0x3c1b6c[_0x9b73('0x29')][_0x9b73('0x30')]));_0x39635f[_0x9b73('0x31')]=_0x39635f[_0x9b73('0x31')][_0x9b73('0x32')]?_0x39635f[_0x9b73('0x31')]:_0x108686[_0x9b73('0x2f')];if(_0x3c1b6c[_0x9b73('0x29')][_0x9b73('0x33')]){_0x39635f[_0x9b73('0x28')]=[{'all':!![]}];}_0x39635f=_[_0x9b73('0x34')]({},_0x39635f,_0x3c1b6c[_0x9b73('0x35')]);return db['ChatQueue'][_0x9b73('0x36')](_0x39635f)[_0x9b73('0x16')](handleEntityNotFound(_0x1a82d8,null))[_0x9b73('0x16')](respondWithResult(_0x1a82d8,null))[_0x9b73('0x37')](handleError(_0x1a82d8,null));};exports['create']=function(_0x1574d1,_0x1da5c0){return db['ChatQueue'][_0x9b73('0x38')](_0x1574d1[_0x9b73('0x39')],{})[_0x9b73('0x16')](function(_0x3ce799){var _0x2fb54d=_0x1574d1[_0x9b73('0x3a')]['get']({'plain':!![]});if(!_0x2fb54d)throw new Error(_0x9b73('0x3b'));if(_0x2fb54d[_0x9b73('0x3c')]==='user'){var _0x424eb0=_0x3ce799[_0x9b73('0x18')]({'plain':!![]});var _0x4bef2c=_0x9b73('0x3d');return db['UserProfileSection']['find']({'where':{'name':_0x4bef2c,'userProfileId':_0x2fb54d[_0x9b73('0x3e')]},'raw':!![]})[_0x9b73('0x16')](function(_0x3d024b){if(_0x3d024b&&_0x3d024b[_0x9b73('0x3f')]===0x0){return db[_0x9b73('0x19')][_0x9b73('0x38')]({'name':_0x424eb0[_0x9b73('0x1d')],'resourceId':_0x424eb0['id'],'type':_0x3d024b[_0x9b73('0x1d')],'sectionId':_0x3d024b['id']},{})['then'](function(){return _0x3ce799;});}else{return _0x3ce799;}})['catch'](function(_0x4e9cfe){logger['error'](_0x9b73('0x40'),_0x4e9cfe);throw _0x4e9cfe;});}return _0x3ce799;})[_0x9b73('0x16')](respondWithResult(_0x1da5c0,0xc9))['catch'](handleError(_0x1da5c0,null));};exports[_0x9b73('0x15')]=function(_0x480f09,_0x1c88e9){if(_0x480f09[_0x9b73('0x39')]['id']){delete _0x480f09[_0x9b73('0x39')]['id'];}return db['ChatQueue'][_0x9b73('0x36')]({'where':{'id':_0x480f09['params']['id']}})['then'](handleEntityNotFound(_0x1c88e9,null))[_0x9b73('0x16')](saveUpdates(_0x480f09['body'],null))[_0x9b73('0x16')](respondWithResult(_0x1c88e9,null))[_0x9b73('0x37')](handleError(_0x1c88e9,null));};exports[_0x9b73('0x17')]=function(_0x283833,_0x3d0bdb){return db[_0x9b73('0x27')][_0x9b73('0x36')]({'where':{'id':_0x283833[_0x9b73('0x2c')]['id']}})[_0x9b73('0x16')](handleEntityNotFound(_0x3d0bdb,null))[_0x9b73('0x16')](removeEntity(_0x3d0bdb,null))[_0x9b73('0x37')](handleError(_0x3d0bdb,null));};exports[_0x9b73('0x41')]=function(_0x11e899,_0x29262a){return db[_0x9b73('0x27')][_0x9b73('0x41')]()['then'](respondWithResult(_0x29262a,null))[_0x9b73('0x37')](handleError(_0x29262a,null));};exports['getMembers']=function(_0x5e3dfd,_0x765a31){var _0x2443d7={'raw':!![],'where':{}},_0x3a099c={},_0xbb3f86;return db['ChatQueue'][_0x9b73('0x42')]({'where':{'id':_0x5e3dfd['params']['id']}})[_0x9b73('0x16')](handleEntityNotFound(_0x765a31,null))[_0x9b73('0x16')](function(_0xe19526){if(_0xe19526){_0xbb3f86=_0xe19526['get']({'plain':!![]});_0x3a099c[_0x9b73('0x2f')]=_[_0x9b73('0x43')](db[_0x9b73('0x44')][_0x9b73('0x21')]);_0x3a099c[_0x9b73('0x29')]=_[_0x9b73('0x43')](_0x5e3dfd[_0x9b73('0x29')]);_0x3a099c['filters']=_[_0x9b73('0x2e')](_0x3a099c[_0x9b73('0x2f')],_0x3a099c[_0x9b73('0x29')]);_0x2443d7[_0x9b73('0x31')]=_[_0x9b73('0x2e')](_0x3a099c['model'],qs[_0x9b73('0x30')](_0x5e3dfd[_0x9b73('0x29')][_0x9b73('0x30')]));_0x2443d7[_0x9b73('0x31')]=_0x2443d7[_0x9b73('0x31')][_0x9b73('0x32')]?_0x2443d7['attributes']:_0x3a099c[_0x9b73('0x2f')];if(!_0x5e3dfd[_0x9b73('0x29')][_0x9b73('0x45')]('nolimit')){_0x2443d7[_0x9b73('0x11')]=qs[_0x9b73('0x11')](_0x5e3dfd[_0x9b73('0x29')][_0x9b73('0x11')]);_0x2443d7[_0x9b73('0xf')]=qs['offset'](_0x5e3dfd[_0x9b73('0x29')]['offset']);}_0x2443d7['order']=qs['sort'](_0x5e3dfd['query'][_0x9b73('0x46')]);_0x2443d7[_0x9b73('0x26')]=qs[_0x9b73('0x2d')](_[_0x9b73('0x47')](_0x5e3dfd[_0x9b73('0x29')],_0x3a099c['filters']));_0x2443d7[_0x9b73('0x26')][_0x9b73('0x48')]=_0xe19526['id'];if(_0x5e3dfd[_0x9b73('0x29')]['filter']){_0x2443d7['where']=_[_0x9b73('0x34')](_0x2443d7[_0x9b73('0x26')],{'$or':_[_0x9b73('0x20')](_0x2443d7[_0x9b73('0x31')],function(_0x1f342a){var _0x15d7c2={};_0x15d7c2[_0x1f342a]={'$like':'%'+_0x5e3dfd['query']['filter']+'%'};return _0x15d7c2;})});}_0x2443d7=_[_0x9b73('0x34')]({},_0x2443d7,_0x5e3dfd['options']);return db[_0x9b73('0x44')][_0x9b73('0x2a')](_0x2443d7);}})['then'](function(_0xd48ed4){if(_0xd48ed4){return db[_0x9b73('0x49')][_0x9b73('0x4a')]({'where':{'id':_[_0x9b73('0x20')](_0xd48ed4,'UserId'),'role':'agent'},'attributes':['id',_0x9b73('0x1d'),_0x9b73('0x4b'),_0x9b73('0x4c'),_0x9b73('0x4d')]});}})[_0x9b73('0x16')](function(_0x4eb95a){if(_0x4eb95a){return{'count':_0x4eb95a[_0x9b73('0x12')],'rows':_[_0x9b73('0x20')](_0x4eb95a['rows'],function(_0x15e9e9){return{'membername':_0x15e9e9['name'],'UserId':_0x15e9e9['id'],'queue_name':_0xbb3f86['name'],'ChatQueueId':_0xbb3f86['id'],'interface':util[_0x9b73('0x4e')](_0x9b73('0x4f'),'SIP',_0x15e9e9['name']),'penalty':0x0,'paused':_0x15e9e9['chatPause'],'createdAt':_0x15e9e9[_0x9b73('0x4d')],'updatedAt':_0x15e9e9[_0x9b73('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x765a31,_0x2443d7))[_0x9b73('0x37')](handleError(_0x765a31,null));};exports[_0x9b73('0x50')]=function(_0x55b3a1,_0x4fdbb6){var _0x521b1b={};var _0x1adc09={};var _0x505a4f;var _0x427b3c;return db[_0x9b73('0x27')][_0x9b73('0x42')]({'where':{'id':_0x55b3a1[_0x9b73('0x2c')]['id']}})[_0x9b73('0x16')](handleEntityNotFound(_0x4fdbb6,null))[_0x9b73('0x16')](function(_0x8e0fbd){if(_0x8e0fbd){_0x505a4f=_0x8e0fbd;_0x1adc09['model']=_[_0x9b73('0x43')](db['Team']['rawAttributes']);_0x1adc09[_0x9b73('0x29')]=_[_0x9b73('0x43')](_0x55b3a1['query']);_0x1adc09[_0x9b73('0x2d')]=_[_0x9b73('0x2e')](_0x1adc09[_0x9b73('0x2f')],_0x1adc09[_0x9b73('0x29')]);_0x521b1b[_0x9b73('0x31')]=_[_0x9b73('0x2e')](_0x1adc09[_0x9b73('0x2f')],qs[_0x9b73('0x30')](_0x55b3a1[_0x9b73('0x29')][_0x9b73('0x30')]));_0x521b1b['attributes']=_0x521b1b[_0x9b73('0x31')]['length']?_0x521b1b[_0x9b73('0x31')]:_0x1adc09[_0x9b73('0x2f')];_0x521b1b[_0x9b73('0x51')]=qs['sort'](_0x55b3a1[_0x9b73('0x29')][_0x9b73('0x46')]);_0x521b1b[_0x9b73('0x26')]=qs[_0x9b73('0x2d')](_[_0x9b73('0x47')](_0x55b3a1[_0x9b73('0x29')],_0x1adc09[_0x9b73('0x2d')]));if(_0x55b3a1[_0x9b73('0x29')][_0x9b73('0x52')]){_0x521b1b[_0x9b73('0x26')]=_[_0x9b73('0x34')](_0x521b1b[_0x9b73('0x26')],{'$or':_['map'](_0x521b1b[_0x9b73('0x31')],function(_0x1b6018){var _0x23c480={};_0x23c480[_0x1b6018]={'$like':'%'+_0x55b3a1[_0x9b73('0x29')][_0x9b73('0x52')]+'%'};return _0x23c480;})});}_0x521b1b=_[_0x9b73('0x34')]({},_0x521b1b,_0x55b3a1[_0x9b73('0x35')]);return _0x505a4f[_0x9b73('0x50')](_0x521b1b);}})[_0x9b73('0x16')](function(_0x3571a9){if(_0x3571a9){_0x427b3c=_0x3571a9[_0x9b73('0x32')];if(!_0x55b3a1[_0x9b73('0x29')]['hasOwnProperty'](_0x9b73('0x53'))){_0x521b1b['limit']=qs[_0x9b73('0x11')](_0x55b3a1[_0x9b73('0x29')]['limit']);_0x521b1b[_0x9b73('0xf')]=qs['offset'](_0x55b3a1['query']['offset']);}return _0x505a4f['getTeams'](_0x521b1b);}})[_0x9b73('0x16')](function(_0x20a160){if(_0x20a160){return _0x20a160?{'count':_0x427b3c,'rows':_0x20a160}:null;}})['then'](respondWithResult(_0x4fdbb6,null))['catch'](handleError(_0x4fdbb6,null));};exports[_0x9b73('0x54')]=function(_0x1311e7,_0x3accee){var _0x424937=_0x1311e7['body'][_0x9b73('0x55')];return db['Team'][_0x9b73('0x2a')]({'where':{'id':_0x424937},'attributes':['id'],'include':[{'model':db[_0x9b73('0x49')],'as':_0x9b73('0x56'),'attributes':['id','name',_0x9b73('0x57'),_0x9b73('0x58'),_0x9b73('0x59')],'raw':!![]}]})[_0x9b73('0x16')](function(_0x10034c){if(_0x10034c){var _0x3cac4a=_[_0x9b73('0x5a')](_0x10034c,function(_0x174691){var _0x320b7e=_0x174691[_0x9b73('0x18')]({'plain':!![]});return _0x320b7e[_0x9b73('0x56')];});return db['ChatQueue'][_0x9b73('0x36')]({'where':{'id':_0x1311e7[_0x9b73('0x2c')]['id']}})[_0x9b73('0x16')](function(_0x13783c){return db[_0x9b73('0x5b')][_0x9b73('0x5c')](function(_0x2cd54f){return _0x13783c[_0x9b73('0x54')](_0x424937,{'transaction':_0x2cd54f})[_0x9b73('0x16')](function(){return BPromise[_0x9b73('0x5d')](_0x3cac4a,function(_0x43349f){return db['UserChatQueue'][_0x9b73('0x5e')]({'where':{'UserId':_0x43349f['id'],'ChatQueueId':_0x1311e7[_0x9b73('0x2c')]['id']},'transaction':_0x2cd54f});});})[_0x9b73('0x16')](function(){_0x3cac4a['forEach'](function(_0x537327){socket[_0x9b73('0x5f')](_0x9b73('0x60'),{'UserId':_0x537327['id'],'ChatQueueId':_0x13783c['id']});});});});});}})[_0x9b73('0x16')](respondWithStatusCode(_0x3accee,null))[_0x9b73('0x37')](handleError(_0x3accee,null));};exports[_0x9b73('0x61')]=function(_0x2257ee,_0x27fab0){return db[_0x9b73('0x62')][_0x9b73('0x2a')]({'where':{'id':_0x2257ee['query'][_0x9b73('0x55')]},'attributes':['id'],'include':[{'model':db[_0x9b73('0x49')],'as':_0x9b73('0x56'),'attributes':['id'],'raw':!![]}]})[_0x9b73('0x16')](handleEntityNotFound(_0x27fab0,null))['then'](function(_0x36f049){var _0x480781=_['map'](_0x36f049,'id');var _0x52de91=[];var _0x5c3691=[];var _0x175533=squel[_0x9b73('0x63')]();_0x175533[_0x9b73('0x64')](_0x9b73('0x65'))['from']('team_has_chat_queues','tq')[_0x9b73('0x66')](_0x9b73('0x67'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x9b73('0x68'),_0x2257ee[_0x9b73('0x2c')]['id']);for(var _0x4b211b=0x0;_0x4b211b<_0x36f049[_0x9b73('0x32')];_0x4b211b+=0x1){let _0x2683bb=_0x36f049[_0x4b211b];for(var _0x611874=0x0;_0x611874<_0x2683bb[_0x9b73('0x56')][_0x9b73('0x32')];_0x611874+=0x1){let _0x48e0d4=_0x2683bb[_0x9b73('0x56')][_0x611874];var _0x54749e=_0x175533[_0x9b73('0x69')]();_0x54749e[_0x9b73('0x26')](_0x9b73('0x6a'),_0x48e0d4['id']);_0x5c3691[_0x9b73('0x6b')](db[_0x9b73('0x5b')]['query'](_0x54749e[_0x9b73('0x6c')](),{'type':db[_0x9b73('0x5b')][_0x9b73('0x6d')][_0x9b73('0x6e')]})[_0x9b73('0x16')](function(_0x2f6649){if(_0x2f6649['length']===0x1){return _0x48e0d4['id'];}else{var _0x34e6a0=_[_0x9b73('0x6f')](_['map'](_0x2f6649,'TeamId'),function(_0x327cfa){return _[_0x9b73('0x70')](_0x480781,_0x327cfa);});if(_0x34e6a0){return _0x48e0d4['id'];}}}));}}return BPromise['all'](_0x5c3691)[_0x9b73('0x16')](function(_0x342315){_0x52de91=_(_0x52de91)[_0x9b73('0x71')](_0x342315)[_0x9b73('0x72')]()[_0x9b73('0x73')]();return db[_0x9b73('0x27')]['find']({'where':{'id':_0x2257ee[_0x9b73('0x2c')]['id']}})[_0x9b73('0x16')](function(_0x32d5c0){return db[_0x9b73('0x5b')][_0x9b73('0x5c')](function(_0x38589f){return _0x32d5c0[_0x9b73('0x61')](_0x2257ee[_0x9b73('0x29')][_0x9b73('0x55')],{'transaction':_0x38589f})[_0x9b73('0x16')](function(){if(!_[_0x9b73('0x74')](_0x52de91)){return _0x32d5c0[_0x9b73('0x75')](_0x52de91,{'transaction':_0x38589f});}})['then'](function(){_0x52de91[_0x9b73('0x76')](function(_0x47c77c){socket['emit'](_0x9b73('0x77'),{'UserId':_0x47c77c,'ChatQueueId':_0x32d5c0['id']});});});});});});})[_0x9b73('0x16')](respondWithStatusCode(_0x27fab0,null))['catch'](handleError(_0x27fab0,null));};exports['addAgents']=function(_0x1a9084,_0x34567f){return db[_0x9b73('0x27')][_0x9b73('0x36')]({'where':{'id':_0x1a9084['params']['id']}})[_0x9b73('0x16')](handleEntityNotFound(_0x34567f,null))[_0x9b73('0x16')](function(_0x6c204e){if(_0x6c204e){return _0x6c204e[_0x9b73('0x78')](_0x1a9084[_0x9b73('0x39')]['ids'],_['omit'](_0x1a9084[_0x9b73('0x39')],[_0x9b73('0x55'),'id'])||{})[_0x9b73('0x79')](function(_0x2e8b9b){for(var _0x4b0712=0x0;_0x4b0712<_0x1a9084[_0x9b73('0x39')][_0x9b73('0x55')][_0x9b73('0x32')];_0x4b0712+=0x1){socket[_0x9b73('0x5f')](_0x9b73('0x60'),{'UserId':Number(_0x1a9084[_0x9b73('0x39')][_0x9b73('0x55')][_0x4b0712]),'ChatQueueId':Number(_0x1a9084[_0x9b73('0x2c')]['id'])});}return _0x2e8b9b;});}})[_0x9b73('0x16')](respondWithResult(_0x34567f,null))[_0x9b73('0x37')](handleError(_0x34567f,null));};exports['removeAgents']=function(_0x5c4909,_0x399ff2){return db[_0x9b73('0x27')][_0x9b73('0x36')]({'where':{'id':_0x5c4909[_0x9b73('0x2c')]['id']}})[_0x9b73('0x16')](handleEntityNotFound(_0x399ff2,null))['then'](function(_0x59b4fe){if(_0x59b4fe){return _0x59b4fe[_0x9b73('0x75')](_0x5c4909[_0x9b73('0x29')][_0x9b73('0x55')])[_0x9b73('0x16')](function(){if(_[_0x9b73('0x7a')](_0x5c4909[_0x9b73('0x29')]['ids'])){for(var _0x94db3a=0x0;_0x94db3a<_0x5c4909[_0x9b73('0x29')][_0x9b73('0x55')][_0x9b73('0x32')];_0x94db3a+=0x1){socket[_0x9b73('0x5f')]('userChatQueue:remove',{'UserId':Number(_0x5c4909[_0x9b73('0x29')]['ids'][_0x94db3a]),'ChatQueueId':Number(_0x5c4909[_0x9b73('0x2c')]['id'])});}}else{socket[_0x9b73('0x5f')]('userChatQueue:remove',{'UserId':Number(_0x5c4909[_0x9b73('0x29')][_0x9b73('0x55')]),'ChatQueueId':Number(_0x5c4909[_0x9b73('0x2c')]['id'])});}});}})[_0x9b73('0x16')](respondWithStatusCode(_0x399ff2,null))[_0x9b73('0x37')](handleError(_0x399ff2,null));};exports[_0x9b73('0x7b')]=function(_0x38ca45,_0x2c9b19){var _0x3b709b={};var _0x2388bc={};var _0x49d4fa;var _0x36c083;return db[_0x9b73('0x27')]['findOne']({'where':{'id':_0x38ca45[_0x9b73('0x2c')]['id']}})['then'](handleEntityNotFound(_0x2c9b19,null))[_0x9b73('0x16')](function(_0x4e06e7){if(_0x4e06e7){_0x49d4fa=_0x4e06e7;_0x2388bc[_0x9b73('0x2f')]=_[_0x9b73('0x43')](db['User'][_0x9b73('0x21')]);_0x2388bc[_0x9b73('0x29')]=_['keys'](_0x38ca45[_0x9b73('0x29')]);_0x2388bc[_0x9b73('0x2d')]=_['intersection'](_0x2388bc[_0x9b73('0x2f')],_0x2388bc[_0x9b73('0x29')]);_0x3b709b[_0x9b73('0x31')]=_[_0x9b73('0x2e')](_0x2388bc[_0x9b73('0x2f')],qs[_0x9b73('0x30')](_0x38ca45[_0x9b73('0x29')]['fields']));_0x3b709b[_0x9b73('0x31')]=_0x3b709b[_0x9b73('0x31')]['length']?_0x3b709b[_0x9b73('0x31')]:_0x2388bc[_0x9b73('0x2f')];_0x3b709b[_0x9b73('0x51')]=qs[_0x9b73('0x46')](_0x38ca45['query'][_0x9b73('0x46')]);_0x3b709b['where']=qs[_0x9b73('0x2d')](_[_0x9b73('0x47')](_0x38ca45[_0x9b73('0x29')],_0x2388bc[_0x9b73('0x2d')]));if(_0x38ca45[_0x9b73('0x29')][_0x9b73('0x52')]){_0x3b709b[_0x9b73('0x26')]=_[_0x9b73('0x34')](_0x3b709b[_0x9b73('0x26')],{'$or':_[_0x9b73('0x20')](_0x3b709b['attributes'],function(_0x24bbe6){var _0x470796={};_0x470796[_0x24bbe6]={'$like':'%'+_0x38ca45['query']['filter']+'%'};return _0x470796;})});}_0x3b709b=_[_0x9b73('0x34')]({},_0x3b709b,_0x38ca45[_0x9b73('0x35')]);return _0x49d4fa['getAgents'](_0x3b709b);}})['then'](function(_0x5c46e0){if(_0x5c46e0){_0x36c083=_0x5c46e0[_0x9b73('0x32')];if(!_0x38ca45['query']['hasOwnProperty'](_0x9b73('0x53'))){_0x3b709b[_0x9b73('0x11')]=qs['limit'](_0x38ca45['query'][_0x9b73('0x11')]);_0x3b709b[_0x9b73('0xf')]=qs[_0x9b73('0xf')](_0x38ca45[_0x9b73('0x29')][_0x9b73('0xf')]);}return _0x49d4fa[_0x9b73('0x7b')](_0x3b709b);}})['then'](function(_0x49c08c){if(_0x49c08c){return _0x49c08c?{'count':_0x36c083,'rows':_0x49c08c}:null;}})[_0x9b73('0x16')](respondWithResult(_0x2c9b19,null))[_0x9b73('0x37')](handleError(_0x2c9b19,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 52d7bd3..4096b1c 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 _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 +var _0x0627=['../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x236c89,_0xd76ba9){var _0x3b2a15=function(_0x89e4f9){while(--_0x89e4f9){_0x236c89['push'](_0x236c89['shift']());}};_0x3b2a15(++_0xd76ba9);}(_0x0627,0x1d8));var _0x7062=function(_0x3a7a9c,_0x24f7d6){_0x3a7a9c=_0x3a7a9c-0x0;var _0x59156e=_0x0627[_0x3a7a9c];return _0x59156e;};'use strict';var EventEmitter=require(_0x7062('0x0'));var ChatQueue=require(_0x7062('0x1'))['db'][_0x7062('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x7062('0x3')](0x0);var events={'afterCreate':_0x7062('0x4'),'afterUpdate':_0x7062('0x5'),'afterDestroy':_0x7062('0x6')};function emitEvent(_0xf63df){return function(_0x21b92d,_0xb17aab,_0x73d82a){ChatQueueEvents['emit'](_0xf63df+':'+_0x21b92d['id'],_0x21b92d);ChatQueueEvents[_0x7062('0x7')](_0xf63df,_0x21b92d);_0x73d82a(null);};}for(var e in events){if(events[_0x7062('0x8')](e)){var event=events[e];ChatQueue[_0x7062('0x9')](e,emitEvent(event));}}module[_0x7062('0xa')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 6060f66..20a1e95 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 _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 +var _0x70ff=['moment','request-promise','path','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','util'];(function(_0xc25cc1,_0x2a9daa){var _0x544044=function(_0x347750){while(--_0x347750){_0xc25cc1['push'](_0xc25cc1['shift']());}};_0x544044(++_0x2a9daa);}(_0x70ff,0xef));var _0xf70f=function(_0x1c72b8,_0x104b7e){_0x1c72b8=_0x1c72b8-0x0;var _0x191114=_0x70ff[_0x1c72b8];return _0x191114;};'use strict';var _=require('lodash');var util=require(_0xf70f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xf70f('0x1'));var BPromise=require('bluebird');var rp=require(_0xf70f('0x2'));var fs=require('fs');var path=require(_0xf70f('0x3'));var rimraf=require('rimraf');var config=require(_0xf70f('0x4'));var attributes=require(_0xf70f('0x5'));module[_0xf70f('0x6')]=function(_0x2d256b,_0x5a010f){return _0x2d256b[_0xf70f('0x7')](_0xf70f('0x8'),attributes,{'tableName':_0xf70f('0x9'),'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 735a7b6..a4191d8 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 _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 +var _0x3f48=['defaults','localhost','socket.io-emitter','register','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetChatQueue','ChatQueue','findAll','raw','options','where','attributes','include','map','model','debug','ShowChatQueue','find','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis'];(function(_0x50bfe8,_0x4a9f3c){var _0x3991d3=function(_0x442b20){while(--_0x442b20){_0x50bfe8['push'](_0x50bfe8['shift']());}};_0x3991d3(++_0x4a9f3c);}(_0x3f48,0x17c));var _0x83f4=function(_0x164470,_0x12ae5c){_0x164470=_0x164470-0x0;var _0x1b1afc=_0x3f48[_0x164470];return _0x1b1afc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x83f4('0x0'));var BPromise=require(_0x83f4('0x1'));var rs=require(_0x83f4('0x2'));var fs=require('fs');var Redis=require(_0x83f4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x83f4('0x4'));var logger=require(_0x83f4('0x5'))('rpc');var config=require(_0x83f4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x83f4('0x7')][_0x83f4('0x8')]({'port':0x232a});config[_0x83f4('0x9')]=_[_0x83f4('0xa')](config[_0x83f4('0x9')],{'host':_0x83f4('0xb'),'port':0x18eb});var socket=require(_0x83f4('0xc'))(new Redis(config[_0x83f4('0x9')]));require('./chatQueue.socket')[_0x83f4('0xd')](socket);function respondWithRpcPromise(_0x3b0784,_0x177c28,_0x54c0c1){return new BPromise(function(_0x4cb8bb,_0x589cbe){return client[_0x83f4('0xe')](_0x3b0784,_0x54c0c1)[_0x83f4('0xf')](function(_0x74a994){logger['info'](_0x83f4('0x10'),_0x177c28,_0x83f4('0x11'));logger['debug'](_0x83f4('0x12'),_0x177c28,_0x83f4('0x11'),JSON[_0x83f4('0x13')](_0x74a994));if(_0x74a994[_0x83f4('0x14')]){if(_0x74a994[_0x83f4('0x14')][_0x83f4('0x15')]===0x1f4){logger[_0x83f4('0x14')]('ChatQueue,\x20%s,\x20%s',_0x177c28,_0x74a994[_0x83f4('0x14')][_0x83f4('0x16')]);return _0x589cbe(_0x74a994[_0x83f4('0x14')][_0x83f4('0x16')]);}logger[_0x83f4('0x14')](_0x83f4('0x10'),_0x177c28,_0x74a994['error'][_0x83f4('0x16')]);return _0x4cb8bb(_0x74a994[_0x83f4('0x14')][_0x83f4('0x16')]);}else{logger[_0x83f4('0x17')](_0x83f4('0x10'),_0x177c28,'request\x20sent');_0x4cb8bb(_0x74a994[_0x83f4('0x18')]['message']);}})[_0x83f4('0x19')](function(_0x3b08d8){logger[_0x83f4('0x14')](_0x83f4('0x10'),_0x177c28,_0x3b08d8);_0x589cbe(_0x3b08d8);});});}exports[_0x83f4('0x1a')]=function(_0x9ef4a9){var _0x52452b=this;return new Promise(function(_0x79c248,_0x14575b){return db[_0x83f4('0x1b')][_0x83f4('0x1c')]({'raw':_0x9ef4a9['options']?_0x9ef4a9['options'][_0x83f4('0x1d')]===undefined?!![]:![]:!![],'where':_0x9ef4a9[_0x83f4('0x1e')]?_0x9ef4a9[_0x83f4('0x1e')][_0x83f4('0x1f')]||null:null,'attributes':_0x9ef4a9['options']?_0x9ef4a9[_0x83f4('0x1e')][_0x83f4('0x20')]||null:null,'limit':_0x9ef4a9[_0x83f4('0x1e')]?_0x9ef4a9[_0x83f4('0x1e')]['limit']||null:null,'include':_0x9ef4a9[_0x83f4('0x1e')]?_0x9ef4a9['options'][_0x83f4('0x21')]?_[_0x83f4('0x22')](_0x9ef4a9[_0x83f4('0x1e')][_0x83f4('0x21')],function(_0x27623d){return{'model':db[_0x27623d[_0x83f4('0x23')]],'as':_0x27623d['as'],'attributes':_0x27623d[_0x83f4('0x20')],'include':_0x27623d[_0x83f4('0x21')]?_[_0x83f4('0x22')](_0x27623d[_0x83f4('0x21')],function(_0x3ab54d){return{'model':db[_0x3ab54d['model']],'as':_0x3ab54d['as'],'attributes':_0x3ab54d[_0x83f4('0x20')],'include':_0x3ab54d['include']?_['map'](_0x3ab54d[_0x83f4('0x21')],function(_0x5f17f5){return{'model':db[_0x5f17f5[_0x83f4('0x23')]],'as':_0x5f17f5['as'],'attributes':_0x5f17f5[_0x83f4('0x20')]};}):[]};}):[]};}):[]:[]})[_0x83f4('0xf')](function(_0x5429fe){logger['info']('GetChatQueue',_0x9ef4a9);logger[_0x83f4('0x24')](_0x83f4('0x1a'),_0x9ef4a9,JSON[_0x83f4('0x13')](_0x5429fe));_0x79c248(_0x5429fe);})[_0x83f4('0x19')](function(_0x57fd72){logger[_0x83f4('0x14')](_0x83f4('0x1a'),_0x57fd72[_0x83f4('0x16')],_0x9ef4a9);_0x14575b(_0x52452b[_0x83f4('0x14')](0x1f4,_0x57fd72[_0x83f4('0x16')]));});});};exports[_0x83f4('0x25')]=function(_0x37956b){var _0x162f06=this;return new Promise(function(_0x5ca9bc,_0x203d08){return db['ChatQueue'][_0x83f4('0x26')]({'raw':_0x37956b['options']?_0x37956b[_0x83f4('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x37956b[_0x83f4('0x1e')]?_0x37956b[_0x83f4('0x1e')]['where']||null:null,'attributes':_0x37956b[_0x83f4('0x1e')]?_0x37956b['options'][_0x83f4('0x20')]||null:null,'include':_0x37956b['options']?_0x37956b[_0x83f4('0x1e')]['include']?_[_0x83f4('0x22')](_0x37956b[_0x83f4('0x1e')][_0x83f4('0x21')],function(_0x1871e1){return{'model':db[_0x1871e1[_0x83f4('0x23')]],'as':_0x1871e1['as'],'attributes':_0x1871e1[_0x83f4('0x20')],'include':_0x1871e1['include']?_[_0x83f4('0x22')](_0x1871e1[_0x83f4('0x21')],function(_0x3e2d5f){return{'model':db[_0x3e2d5f[_0x83f4('0x23')]],'as':_0x3e2d5f['as'],'attributes':_0x3e2d5f[_0x83f4('0x20')],'include':_0x3e2d5f[_0x83f4('0x21')]?_[_0x83f4('0x22')](_0x3e2d5f[_0x83f4('0x21')],function(_0x239c41){return{'model':db[_0x239c41[_0x83f4('0x23')]],'as':_0x239c41['as'],'attributes':_0x239c41[_0x83f4('0x20')]};}):[]};}):[]};}):[]:[]})[_0x83f4('0xf')](function(_0x3f25e9){logger[_0x83f4('0x17')](_0x83f4('0x25'),_0x37956b);logger[_0x83f4('0x24')](_0x83f4('0x25'),_0x37956b,JSON[_0x83f4('0x13')](_0x3f25e9));_0x5ca9bc(_0x3f25e9);})[_0x83f4('0x19')](function(_0x437853){logger[_0x83f4('0x14')]('ShowChatQueue',_0x437853[_0x83f4('0x16')],_0x37956b);_0x203d08(_0x162f06['error'](0x1f4,_0x437853['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index d9925fd..59736f5 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 _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 +var _0x524a=['./chatQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x2a29d4,_0x3c7fd1){var _0x5c6f52=function(_0x25a28f){while(--_0x25a28f){_0x2a29d4['push'](_0x2a29d4['shift']());}};_0x5c6f52(++_0x3c7fd1);}(_0x524a,0xf5));var _0xa524=function(_0x3de58c,_0x339ed1){_0x3de58c=_0x3de58c-0x0;var _0x1face2=_0x524a[_0x3de58c];return _0x1face2;};'use strict';var ChatQueueEvents=require(_0xa524('0x0'));var events=[_0xa524('0x1'),_0xa524('0x2'),_0xa524('0x3')];function createListener(_0x53c48c,_0x4a29b7){return function(_0x2ef77c){_0x4a29b7[_0xa524('0x4')](_0x53c48c,_0x2ef77c);};}function removeListener(_0x56ab08,_0x50ec75){return function(){ChatQueueEvents[_0xa524('0x5')](_0x56ab08,_0x50ec75);};}exports[_0xa524('0x6')]=function(_0x16227b){for(var _0x5f472f=0x0,_0x460738=events['length'];_0x5f472f<_0x460738;_0x5f472f++){var _0x3a2dd6=events[_0x5f472f];var _0x11aa98=createListener('chatQueue:'+_0x3a2dd6,_0x16227b);ChatQueueEvents['on'](_0x3a2dd6,_0x11aa98);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index eadb40c..bc90238 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 _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 +var _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x40108a,_0x17981c){var _0x74318a=function(_0x28ff91){while(--_0x28ff91){_0x40108a['push'](_0x40108a['shift']());}};_0x74318a(++_0x17981c);}(_0x008c,0x188));var _0xc008=function(_0x7d62cb,_0x7622c){_0x7d62cb=_0x7d62cb-0x0;var _0x3a6266=_0x008c[_0x7d62cb];return _0x3a6266;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 4ac4ed3..b0bb1c3 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 _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 +var _0x208b=['DATE','moment','sequelize','exports','STRING'];(function(_0x16771d,_0x224c60){var _0x386f11=function(_0x3d7a87){while(--_0x3d7a87){_0x16771d['push'](_0x16771d['shift']());}};_0x386f11(++_0x224c60);}(_0x208b,0x114));var _0xb208=function(_0x2d169e,_0x23b613){_0x2d169e=_0x2d169e-0x0;var _0x57d75d=_0x208b[_0x2d169e];return _0x57d75d;};'use strict';var moment=require(_0xb208('0x0'));var Sequelize=require(_0xb208('0x1'));module[_0xb208('0x2')]={'uniqueid':{'type':Sequelize[_0xb208('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xb208('0x4')]},'leaveAt':{'type':Sequelize[_0xb208('0x4')]},'acceptAt':{'type':Sequelize[_0xb208('0x4')]},'exitAt':{'type':Sequelize[_0xb208('0x4')]},'reason':{'type':Sequelize[_0xb208('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 008158d..9a5d15f 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 _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 +var _0x014c=['order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','name','send','map','ChatQueueReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit'];(function(_0x30cdd7,_0x23f1ae){var _0x5c0a41=function(_0x5e368d){while(--_0x5e368d){_0x30cdd7['push'](_0x30cdd7['shift']());}};_0x5c0a41(++_0x23f1ae);}(_0x014c,0x17b));var _0xc014=function(_0x366388,_0x4595a6){_0x366388=_0x366388-0x0;var _0x41c97e=_0x014c[_0x366388];return _0x41c97e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc014('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc014('0x1'));var rp=require(_0xc014('0x2'));var moment=require(_0xc014('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc014('0x4'));var path=require(_0xc014('0x5'));var sox=require(_0xc014('0x6'));var csv=require(_0xc014('0x7'));var ejs=require(_0xc014('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc014('0x9'));var squel=require(_0xc014('0xa'));var crypto=require('crypto');var jsforce=require(_0xc014('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc014('0x7'));var querystring=require(_0xc014('0xc'));var Papa=require(_0xc014('0xd'));var Redis=require('ioredis');var authService=require(_0xc014('0xe'));var qs=require(_0xc014('0xf'));var as=require(_0xc014('0x10'));var hardwareService=require(_0xc014('0x11'));var logger=require('../../config/logger')(_0xc014('0x12'));var utils=require('../../config/utils');var config=require(_0xc014('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xc014('0x14'))['db'];function respondWithStatusCode(_0xcde2d3,_0x2f8ac9){_0x2f8ac9=_0x2f8ac9||0xcc;return function(_0x1686f1){if(_0x1686f1){return _0xcde2d3['sendStatus'](_0x2f8ac9);}return _0xcde2d3[_0xc014('0x15')](_0x2f8ac9)[_0xc014('0x16')]();};}function respondWithResult(_0xe86dd,_0x5ced7d){_0x5ced7d=_0x5ced7d||0xc8;return function(_0x36b26e){if(_0x36b26e){return _0xe86dd['status'](_0x5ced7d)[_0xc014('0x17')](_0x36b26e);}};}function respondWithFilteredResult(_0x1c4d3b,_0x25fdf6){return function(_0x26f264){if(_0x26f264){var _0x9f6a26=typeof _0x25fdf6[_0xc014('0x18')]==='undefined'&&typeof _0x25fdf6[_0xc014('0x19')]===_0xc014('0x1a');var _0x263ad0=_0x26f264[_0xc014('0x1b')];var _0x5a2be0=_0x9f6a26?0x0:_0x25fdf6['offset'];var _0x42f93d=_0x9f6a26?_0x26f264['count']:_0x25fdf6['offset']+_0x25fdf6[_0xc014('0x19')];var _0x4287fe;if(_0x42f93d>=_0x263ad0){_0x42f93d=_0x263ad0;_0x4287fe=0xc8;}else{_0x4287fe=0xce;}_0x1c4d3b['status'](_0x4287fe);return _0x1c4d3b[_0xc014('0x1c')](_0xc014('0x1d'),_0x5a2be0+'-'+_0x42f93d+'/'+_0x263ad0)[_0xc014('0x17')](_0x26f264);}return null;};}function patchUpdates(_0x2dac66){return function(_0x1078c4){try{jsonpatch['apply'](_0x1078c4,_0x2dac66,!![]);}catch(_0xc8b0fb){return BPromise[_0xc014('0x1e')](_0xc8b0fb);}return _0x1078c4[_0xc014('0x1f')]();};}function saveUpdates(_0x3c58cc,_0x450b22){return function(_0x3f28b6){if(_0x3f28b6){return _0x3f28b6[_0xc014('0x20')](_0x3c58cc)['then'](function(_0x1089c6){return _0x1089c6;});}return null;};}function removeEntity(_0x1b905d,_0x16d8f9){return function(_0x174b46){if(_0x174b46){return _0x174b46[_0xc014('0x21')]()[_0xc014('0x22')](function(){_0x1b905d[_0xc014('0x15')](0xcc)[_0xc014('0x16')]();});}};}function handleEntityNotFound(_0xe4c68,_0x2e5c30){return function(_0x4850bb){if(!_0x4850bb){_0xe4c68[_0xc014('0x23')](0x194);}return _0x4850bb;};}function handleError(_0x17b6b4,_0x36b663){_0x36b663=_0x36b663||0x1f4;return function(_0x7f47ef){logger[_0xc014('0x24')](_0x7f47ef['stack']);if(_0x7f47ef[_0xc014('0x25')]){delete _0x7f47ef[_0xc014('0x25')];}_0x17b6b4[_0xc014('0x15')](_0x36b663)[_0xc014('0x26')](_0x7f47ef);};}exports['index']=function(_0x43af57,_0x40cf7c){var _0x151705={},_0x30e97a={},_0x21cd81={'count':0x0,'rows':[]};var _0x289f92=_[_0xc014('0x27')](db[_0xc014('0x28')][_0xc014('0x29')],function(_0x330869){return{'name':_0x330869[_0xc014('0x2a')],'type':_0x330869['type'][_0xc014('0x2b')]};});_0x30e97a['model']=_['map'](_0x289f92,'name');_0x30e97a[_0xc014('0x2c')]=_[_0xc014('0x2d')](_0x43af57['query']);_0x30e97a[_0xc014('0x2e')]=_[_0xc014('0x2f')](_0x30e97a[_0xc014('0x30')],_0x30e97a[_0xc014('0x2c')]);_0x151705[_0xc014('0x31')]=_[_0xc014('0x2f')](_0x30e97a[_0xc014('0x30')],qs[_0xc014('0x32')](_0x43af57[_0xc014('0x2c')][_0xc014('0x32')]));_0x151705[_0xc014('0x31')]=_0x151705[_0xc014('0x31')]['length']?_0x151705[_0xc014('0x31')]:_0x30e97a['model'];if(!_0x43af57[_0xc014('0x2c')][_0xc014('0x33')](_0xc014('0x34'))){_0x151705[_0xc014('0x19')]=qs[_0xc014('0x19')](_0x43af57[_0xc014('0x2c')][_0xc014('0x19')]);_0x151705['offset']=qs[_0xc014('0x18')](_0x43af57['query'][_0xc014('0x18')]);}_0x151705[_0xc014('0x35')]=qs[_0xc014('0x36')](_0x43af57[_0xc014('0x2c')][_0xc014('0x36')]);_0x151705[_0xc014('0x37')]=qs[_0xc014('0x2e')](_['pick'](_0x43af57[_0xc014('0x2c')],_0x30e97a[_0xc014('0x2e')]),_0x289f92);if(_0x43af57[_0xc014('0x2c')]['filter']){_0x151705[_0xc014('0x37')]=_[_0xc014('0x38')](_0x151705[_0xc014('0x37')],{'$or':_['map'](_0x289f92,function(_0x473754){if(_0x473754['type']!==_0xc014('0x39')){var _0x19d374={};_0x19d374[_0x473754[_0xc014('0x25')]]={'$like':'%'+_0x43af57[_0xc014('0x2c')][_0xc014('0x3a')]+'%'};return _0x19d374;}})});}_0x151705=_[_0xc014('0x38')]({},_0x151705,_0x43af57[_0xc014('0x3b')]);var _0xb0149e={'where':_0x151705[_0xc014('0x37')]};return db[_0xc014('0x28')][_0xc014('0x1b')](_0xb0149e)[_0xc014('0x22')](function(_0x565433){_0x21cd81[_0xc014('0x1b')]=_0x565433;if(_0x43af57[_0xc014('0x2c')][_0xc014('0x3c')]){_0x151705[_0xc014('0x3d')]=[{'all':!![]}];}return db['ChatQueueReport'][_0xc014('0x3e')](_0x151705);})['then'](function(_0x3a7f90){_0x21cd81[_0xc014('0x3f')]=_0x3a7f90;return _0x21cd81;})[_0xc014('0x22')](respondWithFilteredResult(_0x40cf7c,_0x151705))[_0xc014('0x40')](handleError(_0x40cf7c,null));};exports[_0xc014('0x41')]=function(_0x46ea1c,_0x1f7dfb){var _0x2a0265={'raw':!![],'where':{'id':_0x46ea1c[_0xc014('0x42')]['id']}},_0x84720d={};_0x84720d[_0xc014('0x30')]=_['keys'](db[_0xc014('0x28')]['rawAttributes']);_0x84720d['query']=_[_0xc014('0x2d')](_0x46ea1c[_0xc014('0x2c')]);_0x84720d[_0xc014('0x2e')]=_[_0xc014('0x2f')](_0x84720d[_0xc014('0x30')],_0x84720d['query']);_0x2a0265[_0xc014('0x31')]=_[_0xc014('0x2f')](_0x84720d['model'],qs[_0xc014('0x32')](_0x46ea1c[_0xc014('0x2c')][_0xc014('0x32')]));_0x2a0265[_0xc014('0x31')]=_0x2a0265[_0xc014('0x31')][_0xc014('0x43')]?_0x2a0265[_0xc014('0x31')]:_0x84720d[_0xc014('0x30')];if(_0x46ea1c[_0xc014('0x2c')]['includeAll']){_0x2a0265[_0xc014('0x3d')]=[{'all':!![]}];}_0x2a0265=_[_0xc014('0x38')]({},_0x2a0265,_0x46ea1c[_0xc014('0x3b')]);return db[_0xc014('0x28')][_0xc014('0x44')](_0x2a0265)[_0xc014('0x22')](handleEntityNotFound(_0x1f7dfb,null))[_0xc014('0x22')](respondWithResult(_0x1f7dfb,null))[_0xc014('0x40')](handleError(_0x1f7dfb,null));};exports[_0xc014('0x45')]=function(_0x541ad6,_0x2ce299){return db['ChatQueueReport']['create'](_0x541ad6[_0xc014('0x46')],{})['then'](respondWithResult(_0x2ce299,0xc9))[_0xc014('0x40')](handleError(_0x2ce299,null));};exports[_0xc014('0x20')]=function(_0x56595e,_0x359c24){if(_0x56595e[_0xc014('0x46')]['id']){delete _0x56595e[_0xc014('0x46')]['id'];}return db[_0xc014('0x28')][_0xc014('0x44')]({'where':{'id':_0x56595e[_0xc014('0x42')]['id']}})['then'](handleEntityNotFound(_0x359c24,null))[_0xc014('0x22')](saveUpdates(_0x56595e[_0xc014('0x46')],null))[_0xc014('0x22')](respondWithResult(_0x359c24,null))[_0xc014('0x40')](handleError(_0x359c24,null));};exports[_0xc014('0x21')]=function(_0x464d3e,_0x255a3b){return db[_0xc014('0x28')][_0xc014('0x44')]({'where':{'id':_0x464d3e[_0xc014('0x42')]['id']}})['then'](handleEntityNotFound(_0x255a3b,null))[_0xc014('0x22')](removeEntity(_0x255a3b,null))[_0xc014('0x40')](handleError(_0x255a3b,null));};exports[_0xc014('0x47')]=function(_0x1d37be,_0x53676a){return db[_0xc014('0x28')][_0xc014('0x47')]()[_0xc014('0x22')](respondWithResult(_0x53676a,null))[_0xc014('0x40')](handleError(_0x53676a,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index d333f02..9e2a5e1 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(_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 +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x45081a,_0x3ae384){var _0x55bfe2=function(_0xdb8714){while(--_0xdb8714){_0x45081a['push'](_0x45081a['shift']());}};_0x55bfe2(++_0x3ae384);}(_0xe706,0xa3));var _0x6e70=function(_0x2b7442,_0x561591){_0x2b7442=_0x2b7442-0x0;var _0x56e035=_0xe706[_0x2b7442];return _0x56e035;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index b55cba4..af93247 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 _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 +var _0xa109=['result','catch','create','body','options','raw','CreateChatQueueReport','update','where','attributes','UpdateChatQueueReport','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x1e54c5,_0x415a84){var _0x56247c=function(_0x49ffbb){while(--_0x49ffbb){_0x1e54c5['push'](_0x1e54c5['shift']());}};_0x56247c(++_0x415a84);}(_0xa109,0xf2));var _0x9a10=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa109[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x9a10('0x0'));var util=require('util');var moment=require(_0x9a10('0x1'));var BPromise=require(_0x9a10('0x2'));var rs=require(_0x9a10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a10('0x4'))['db'];var utils=require(_0x9a10('0x5'));var logger=require(_0x9a10('0x6'))(_0x9a10('0x7'));var config=require(_0x9a10('0x8'));var jayson=require(_0x9a10('0x9'));var client=jayson[_0x9a10('0xa')][_0x9a10('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19b3f5,_0x342712,_0x51c0bd){return new BPromise(function(_0xb16a3c,_0x13224c){return client[_0x9a10('0xc')](_0x19b3f5,_0x51c0bd)[_0x9a10('0xd')](function(_0x1ce4b1){logger[_0x9a10('0xe')](_0x9a10('0xf'),_0x342712,_0x9a10('0x10'));logger[_0x9a10('0x11')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x342712,_0x9a10('0x10'),JSON[_0x9a10('0x12')](_0x1ce4b1));if(_0x1ce4b1[_0x9a10('0x13')]){if(_0x1ce4b1[_0x9a10('0x13')][_0x9a10('0x14')]===0x1f4){logger['error'](_0x9a10('0xf'),_0x342712,_0x1ce4b1[_0x9a10('0x13')]['message']);return _0x13224c(_0x1ce4b1['error']['message']);}logger[_0x9a10('0x13')](_0x9a10('0xf'),_0x342712,_0x1ce4b1[_0x9a10('0x13')][_0x9a10('0x15')]);return _0xb16a3c(_0x1ce4b1['error'][_0x9a10('0x15')]);}else{logger[_0x9a10('0xe')](_0x9a10('0xf'),_0x342712,_0x9a10('0x10'));_0xb16a3c(_0x1ce4b1[_0x9a10('0x16')][_0x9a10('0x15')]);}})[_0x9a10('0x17')](function(_0x5d0062){logger[_0x9a10('0x13')](_0x9a10('0xf'),_0x342712,_0x5d0062);_0x13224c(_0x5d0062);});});}exports['CreateChatQueueReport']=function(_0x6de1ec){var _0x5bae75=this;return new Promise(function(_0x21ce8d,_0x352a65){return db['ChatQueueReport'][_0x9a10('0x18')](_0x6de1ec[_0x9a10('0x19')],{'raw':_0x6de1ec[_0x9a10('0x1a')]?_0x6de1ec[_0x9a10('0x1a')][_0x9a10('0x1b')]===undefined?!![]:![]:!![]})[_0x9a10('0xd')](function(_0x2aaab1){logger[_0x9a10('0xe')](_0x9a10('0x1c'),_0x6de1ec);logger[_0x9a10('0x11')]('CreateChatQueueReport',_0x6de1ec,JSON[_0x9a10('0x12')](_0x2aaab1));_0x21ce8d(_0x2aaab1);})[_0x9a10('0x17')](function(_0x2ea911){logger[_0x9a10('0x13')](_0x9a10('0x1c'),_0x2ea911[_0x9a10('0x15')],_0x6de1ec);_0x352a65(_0x5bae75[_0x9a10('0x13')](0x1f4,_0x2ea911[_0x9a10('0x15')]));});});};exports['UpdateChatQueueReport']=function(_0x4dabee){var _0x3c4275=this;return new Promise(function(_0x500a7d,_0x3b883e){return db['ChatQueueReport'][_0x9a10('0x1d')](_0x4dabee[_0x9a10('0x19')],{'raw':_0x4dabee[_0x9a10('0x1a')]?_0x4dabee[_0x9a10('0x1a')][_0x9a10('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4dabee[_0x9a10('0x1a')]?_0x4dabee['options'][_0x9a10('0x1e')]||null:null,'attributes':_0x4dabee[_0x9a10('0x1a')]?_0x4dabee[_0x9a10('0x1a')][_0x9a10('0x1f')]||null:null,'limit':_0x4dabee[_0x9a10('0x1a')]?_0x4dabee['options']['limit']||null:null})[_0x9a10('0xd')](function(_0xe83765){logger[_0x9a10('0xe')](_0x9a10('0x20'),_0x4dabee);logger[_0x9a10('0x11')](_0x9a10('0x20'),_0x4dabee,JSON[_0x9a10('0x12')](_0xe83765));_0x500a7d(_0xe83765);})[_0x9a10('0x17')](function(_0x111aca){logger[_0x9a10('0x13')](_0x9a10('0x20'),_0x111aca[_0x9a10('0x15')],_0x4dabee);_0x3b883e(_0x3c4275[_0x9a10('0x13')](0x1f4,_0x111aca[_0x9a10('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 7709089..4cb502a 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 _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 +var _0xf395=['update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put'];(function(_0x6964aa,_0x53fb14){var _0x589c46=function(_0x577a9f){while(--_0x577a9f){_0x6964aa['push'](_0x6964aa['shift']());}};_0x589c46(++_0x53fb14);}(_0xf395,0x12a));var _0x5f39=function(_0x280c7a,_0x3f29b4){_0x280c7a=_0x280c7a-0x0;var _0x32ce3b=_0xf395[_0x280c7a];return _0x32ce3b;};'use strict';var multer=require(_0x5f39('0x0'));var util=require(_0x5f39('0x1'));var path=require(_0x5f39('0x2'));var timeout=require(_0x5f39('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5f39('0x4'));var auth=require(_0x5f39('0x5'));var interaction=require(_0x5f39('0x6'));var config=require(_0x5f39('0x7'));var controller=require(_0x5f39('0x8'));router[_0x5f39('0x9')]('/',auth[_0x5f39('0xa')](),controller[_0x5f39('0xb')]);router[_0x5f39('0x9')]('/describe',auth[_0x5f39('0xa')](),controller[_0x5f39('0xc')]);router[_0x5f39('0x9')](_0x5f39('0xd'),auth[_0x5f39('0xa')](),controller['show']);router[_0x5f39('0xe')]('/',auth[_0x5f39('0xa')](),controller[_0x5f39('0xf')]);router[_0x5f39('0x10')](_0x5f39('0xd'),auth[_0x5f39('0xa')](),controller[_0x5f39('0x11')]);router[_0x5f39('0x12')]('/:id',auth[_0x5f39('0xa')](),controller[_0x5f39('0x13')]);module[_0x5f39('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index cfd2c2a..0f1ff99 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 _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 +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x38e5ee,_0x3cd0cb){var _0x85812d=function(_0x3715a7){while(--_0x3715a7){_0x38e5ee['push'](_0x38e5ee['shift']());}};_0x85812d(++_0x3cd0cb);}(_0x9c44,0x178));var _0x49c4=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9c44[_0x2b7764];return _0x848dcb;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index f7a019c..03fa353 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 _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 +var _0x0822=['findAll','rows','catch','show','params','rawAttributes','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','VIRTUAL','merge','ChatTransferReport','includeAll','include'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0822,0x182));var _0x2082=function(_0x11c639,_0x49997c){_0x11c639=_0x11c639-0x0;var _0xa28500=_0x0822[_0x11c639];return _0xa28500;};'use strict';var emlformat=require(_0x2082('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2082('0x1'));var jsonpatch=require(_0x2082('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2082('0x3'));var Mustache=require(_0x2082('0x4'));var util=require(_0x2082('0x5'));var path=require('path');var sox=require(_0x2082('0x6'));var csv=require(_0x2082('0x7'));var ejs=require(_0x2082('0x8'));var fs=require('fs');var fs_extra=require(_0x2082('0x9'));var _=require(_0x2082('0xa'));var squel=require(_0x2082('0xb'));var crypto=require(_0x2082('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2082('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2082('0xe'));var Papa=require(_0x2082('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2082('0x10'));var as=require(_0x2082('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2082('0x12'))('api');var utils=require(_0x2082('0x13'));var config=require(_0x2082('0x14'));var licenseUtil=require(_0x2082('0x15'));var db=require(_0x2082('0x16'))['db'];function respondWithStatusCode(_0x547a6b,_0x18b7e7){_0x18b7e7=_0x18b7e7||0xcc;return function(_0x31d714){if(_0x31d714){return _0x547a6b['sendStatus'](_0x18b7e7);}return _0x547a6b[_0x2082('0x17')](_0x18b7e7)[_0x2082('0x18')]();};}function respondWithResult(_0x4f4b60,_0x4707e1){_0x4707e1=_0x4707e1||0xc8;return function(_0x682e68){if(_0x682e68){return _0x4f4b60[_0x2082('0x17')](_0x4707e1)['json'](_0x682e68);}};}function respondWithFilteredResult(_0x4e5cdc,_0x528059){return function(_0x1d12eb){if(_0x1d12eb){var _0x4fe301=typeof _0x528059[_0x2082('0x19')]===_0x2082('0x1a')&&typeof _0x528059[_0x2082('0x1b')]===_0x2082('0x1a');var _0x5f2d9f=_0x1d12eb[_0x2082('0x1c')];var _0x2290b9=_0x4fe301?0x0:_0x528059[_0x2082('0x19')];var _0x456967=_0x4fe301?_0x1d12eb[_0x2082('0x1c')]:_0x528059[_0x2082('0x19')]+_0x528059[_0x2082('0x1b')];var _0x58d7ac;if(_0x456967>=_0x5f2d9f){_0x456967=_0x5f2d9f;_0x58d7ac=0xc8;}else{_0x58d7ac=0xce;}_0x4e5cdc['status'](_0x58d7ac);return _0x4e5cdc[_0x2082('0x1d')](_0x2082('0x1e'),_0x2290b9+'-'+_0x456967+'/'+_0x5f2d9f)[_0x2082('0x1f')](_0x1d12eb);}return null;};}function patchUpdates(_0x5858b0){return function(_0x452263){try{jsonpatch[_0x2082('0x20')](_0x452263,_0x5858b0,!![]);}catch(_0x140af0){return BPromise[_0x2082('0x21')](_0x140af0);}return _0x452263['save']();};}function saveUpdates(_0x1e9d32,_0x5b66b4){return function(_0x548fd4){if(_0x548fd4){return _0x548fd4[_0x2082('0x22')](_0x1e9d32)[_0x2082('0x23')](function(_0xc3e897){return _0xc3e897;});}return null;};}function removeEntity(_0x3b45cc,_0x1eef0e){return function(_0x1d5b8c){if(_0x1d5b8c){return _0x1d5b8c[_0x2082('0x24')]()[_0x2082('0x23')](function(){_0x3b45cc[_0x2082('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d1f9f,_0x31531e){return function(_0x155c76){if(!_0x155c76){_0x2d1f9f['sendStatus'](0x194);}return _0x155c76;};}function handleError(_0x157e02,_0x2844bd){_0x2844bd=_0x2844bd||0x1f4;return function(_0xc910fb){logger[_0x2082('0x25')](_0xc910fb[_0x2082('0x26')]);if(_0xc910fb[_0x2082('0x27')]){delete _0xc910fb[_0x2082('0x27')];}_0x157e02[_0x2082('0x17')](_0x2844bd)[_0x2082('0x28')](_0xc910fb);};}exports[_0x2082('0x29')]=function(_0x182116,_0x20275f){var _0x1b84bd={},_0xcfba82={},_0x3ac870={'count':0x0,'rows':[]};var _0x411486=_['map'](db['ChatTransferReport']['rawAttributes'],function(_0x33a869){return{'name':_0x33a869[_0x2082('0x2a')],'type':_0x33a869[_0x2082('0x2b')][_0x2082('0x2c')]};});_0xcfba82[_0x2082('0x2d')]=_[_0x2082('0x2e')](_0x411486,_0x2082('0x27'));_0xcfba82[_0x2082('0x2f')]=_[_0x2082('0x30')](_0x182116['query']);_0xcfba82[_0x2082('0x31')]=_[_0x2082('0x32')](_0xcfba82[_0x2082('0x2d')],_0xcfba82[_0x2082('0x2f')]);_0x1b84bd['attributes']=_[_0x2082('0x32')](_0xcfba82['model'],qs[_0x2082('0x33')](_0x182116[_0x2082('0x2f')][_0x2082('0x33')]));_0x1b84bd['attributes']=_0x1b84bd[_0x2082('0x34')][_0x2082('0x35')]?_0x1b84bd[_0x2082('0x34')]:_0xcfba82[_0x2082('0x2d')];if(!_0x182116[_0x2082('0x2f')]['hasOwnProperty']('nolimit')){_0x1b84bd[_0x2082('0x1b')]=qs[_0x2082('0x1b')](_0x182116[_0x2082('0x2f')][_0x2082('0x1b')]);_0x1b84bd[_0x2082('0x19')]=qs[_0x2082('0x19')](_0x182116[_0x2082('0x2f')][_0x2082('0x19')]);}_0x1b84bd[_0x2082('0x36')]=qs['sort'](_0x182116[_0x2082('0x2f')][_0x2082('0x37')]);_0x1b84bd[_0x2082('0x38')]=qs[_0x2082('0x31')](_[_0x2082('0x39')](_0x182116['query'],_0xcfba82[_0x2082('0x31')]),_0x411486);if(_0x182116[_0x2082('0x2f')][_0x2082('0x3a')]){_0x1b84bd[_0x2082('0x38')]=_['merge'](_0x1b84bd[_0x2082('0x38')],{'$or':_[_0x2082('0x2e')](_0x411486,function(_0xab7d39){if(_0xab7d39[_0x2082('0x2b')]!==_0x2082('0x3b')){var _0x42ad2a={};_0x42ad2a[_0xab7d39[_0x2082('0x27')]]={'$like':'%'+_0x182116[_0x2082('0x2f')][_0x2082('0x3a')]+'%'};return _0x42ad2a;}})});}_0x1b84bd=_[_0x2082('0x3c')]({},_0x1b84bd,_0x182116['options']);var _0xce7663={'where':_0x1b84bd[_0x2082('0x38')]};return db[_0x2082('0x3d')][_0x2082('0x1c')](_0xce7663)[_0x2082('0x23')](function(_0xeaf228){_0x3ac870[_0x2082('0x1c')]=_0xeaf228;if(_0x182116[_0x2082('0x2f')][_0x2082('0x3e')]){_0x1b84bd[_0x2082('0x3f')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x2082('0x40')](_0x1b84bd);})[_0x2082('0x23')](function(_0x4304c6){_0x3ac870[_0x2082('0x41')]=_0x4304c6;return _0x3ac870;})[_0x2082('0x23')](respondWithFilteredResult(_0x20275f,_0x1b84bd))[_0x2082('0x42')](handleError(_0x20275f,null));};exports[_0x2082('0x43')]=function(_0x4adab6,_0x509ac5){var _0x3de299={'raw':!![],'where':{'id':_0x4adab6[_0x2082('0x44')]['id']}},_0x12844f={};_0x12844f[_0x2082('0x2d')]=_[_0x2082('0x30')](db['ChatTransferReport'][_0x2082('0x45')]);_0x12844f[_0x2082('0x2f')]=_['keys'](_0x4adab6[_0x2082('0x2f')]);_0x12844f['filters']=_[_0x2082('0x32')](_0x12844f['model'],_0x12844f['query']);_0x3de299[_0x2082('0x34')]=_['intersection'](_0x12844f[_0x2082('0x2d')],qs[_0x2082('0x33')](_0x4adab6[_0x2082('0x2f')][_0x2082('0x33')]));_0x3de299['attributes']=_0x3de299[_0x2082('0x34')]['length']?_0x3de299[_0x2082('0x34')]:_0x12844f['model'];if(_0x4adab6[_0x2082('0x2f')][_0x2082('0x3e')]){_0x3de299[_0x2082('0x3f')]=[{'all':!![]}];}_0x3de299=_['merge']({},_0x3de299,_0x4adab6[_0x2082('0x46')]);return db['ChatTransferReport'][_0x2082('0x47')](_0x3de299)['then'](handleEntityNotFound(_0x509ac5,null))[_0x2082('0x23')](respondWithResult(_0x509ac5,null))['catch'](handleError(_0x509ac5,null));};exports[_0x2082('0x48')]=function(_0x1e167b,_0x2baea7){return db[_0x2082('0x3d')]['create'](_0x1e167b[_0x2082('0x49')],{})[_0x2082('0x23')](respondWithResult(_0x2baea7,0xc9))[_0x2082('0x42')](handleError(_0x2baea7,null));};exports[_0x2082('0x22')]=function(_0x337951,_0x4c8096){if(_0x337951['body']['id']){delete _0x337951[_0x2082('0x49')]['id'];}return db[_0x2082('0x3d')][_0x2082('0x47')]({'where':{'id':_0x337951[_0x2082('0x44')]['id']}})[_0x2082('0x23')](handleEntityNotFound(_0x4c8096,null))['then'](saveUpdates(_0x337951[_0x2082('0x49')],null))[_0x2082('0x23')](respondWithResult(_0x4c8096,null))['catch'](handleError(_0x4c8096,null));};exports['destroy']=function(_0x4ca84e,_0x597d7d){return db['ChatTransferReport'][_0x2082('0x47')]({'where':{'id':_0x4ca84e[_0x2082('0x44')]['id']}})[_0x2082('0x23')](handleEntityNotFound(_0x597d7d,null))[_0x2082('0x23')](removeEntity(_0x597d7d,null))[_0x2082('0x42')](handleError(_0x597d7d,null));};exports[_0x2082('0x4a')]=function(_0x2f3fe9,_0x48b235){return db[_0x2082('0x3d')]['describe']()['then'](respondWithResult(_0x48b235,null))[_0x2082('0x42')](handleError(_0x48b235,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index ccbdb8e..444d959 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 _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 +var _0x6c94=['moment','bluebird','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','api'];(function(_0x312aa3,_0x5967ab){var _0x6375e9=function(_0x5205a7){while(--_0x5205a7){_0x312aa3['push'](_0x312aa3['shift']());}};_0x6375e9(++_0x5967ab);}(_0x6c94,0x1aa));var _0x46c9=function(_0x156d45,_0x7ede56){_0x156d45=_0x156d45-0x0;var _0x50f99d=_0x6c94[_0x156d45];return _0x50f99d;};'use strict';var _=require(_0x46c9('0x0'));var util=require(_0x46c9('0x1'));var logger=require('../../config/logger')(_0x46c9('0x2'));var moment=require(_0x46c9('0x3'));var BPromise=require(_0x46c9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x46c9('0x5'));var config=require(_0x46c9('0x6'));var attributes=require(_0x46c9('0x7'));module[_0x46c9('0x8')]=function(_0x54cd7a,_0x47427e){return _0x54cd7a[_0x46c9('0x9')](_0x46c9('0xa'),attributes,{'tableName':_0x46c9('0xb'),'paranoid':![],'indexes':[{'name':_0x46c9('0xc'),'fields':[_0x46c9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index e3f063f..406348b 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 _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 +var _0xd2df=['util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','ChatTransferReport,\x20%s,\x20%s','message','info'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xd2df,0x1b9));var _0xfd2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2df[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xfd2d('0x0'));var moment=require(_0xfd2d('0x1'));var BPromise=require('bluebird');var rs=require(_0xfd2d('0x2'));var fs=require('fs');var Redis=require(_0xfd2d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfd2d('0x4'));var logger=require(_0xfd2d('0x5'))(_0xfd2d('0x6'));var config=require(_0xfd2d('0x7'));var jayson=require(_0xfd2d('0x8'));var client=jayson[_0xfd2d('0x9')][_0xfd2d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b1fc2,_0x249367,_0x3d9011){return new BPromise(function(_0x4f8974,_0x52cd8a){return client[_0xfd2d('0xb')](_0x4b1fc2,_0x3d9011)[_0xfd2d('0xc')](function(_0x359fe){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x249367,_0xfd2d('0xd'));logger[_0xfd2d('0xe')](_0xfd2d('0xf'),_0x249367,_0xfd2d('0xd'),JSON['stringify'](_0x359fe));if(_0x359fe[_0xfd2d('0x10')]){if(_0x359fe['error'][_0xfd2d('0x11')]===0x1f4){logger['error'](_0xfd2d('0x12'),_0x249367,_0x359fe[_0xfd2d('0x10')][_0xfd2d('0x13')]);return _0x52cd8a(_0x359fe['error'][_0xfd2d('0x13')]);}logger[_0xfd2d('0x10')](_0xfd2d('0x12'),_0x249367,_0x359fe['error'][_0xfd2d('0x13')]);return _0x4f8974(_0x359fe[_0xfd2d('0x10')][_0xfd2d('0x13')]);}else{logger[_0xfd2d('0x14')]('ChatTransferReport,\x20%s,\x20%s',_0x249367,_0xfd2d('0xd'));_0x4f8974(_0x359fe['result'][_0xfd2d('0x13')]);}})['catch'](function(_0x2d1864){logger[_0xfd2d('0x10')](_0xfd2d('0x12'),_0x249367,_0x2d1864);_0x52cd8a(_0x2d1864);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index baf83e9..47a5cb7 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 _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 +var _0x4caa=['../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','exports','multer','util','express','Router','fs-extra'];(function(_0x547bd6,_0x2abe0c){var _0x5ad6d7=function(_0x209bbf){while(--_0x209bbf){_0x547bd6['push'](_0x547bd6['shift']());}};_0x5ad6d7(++_0x2abe0c);}(_0x4caa,0x1ef));var _0xa4ca=function(_0xe5cac7,_0x6c2f84){_0xe5cac7=_0xe5cac7-0x0;var _0x50df20=_0x4caa[_0xe5cac7];return _0x50df20;};'use strict';var multer=require(_0xa4ca('0x0'));var util=require(_0xa4ca('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa4ca('0x2'));var router=express[_0xa4ca('0x3')]();var fs_extra=require(_0xa4ca('0x4'));var auth=require(_0xa4ca('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa4ca('0x6'));var controller=require(_0xa4ca('0x7'));router[_0xa4ca('0x8')]('/',auth[_0xa4ca('0x9')](),controller[_0xa4ca('0xa')]);router[_0xa4ca('0x8')](_0xa4ca('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xa4ca('0x8')](_0xa4ca('0xc'),auth[_0xa4ca('0x9')](),controller[_0xa4ca('0xd')]);router[_0xa4ca('0xe')]('/',auth['isAuthenticated'](),controller[_0xa4ca('0xf')]);router[_0xa4ca('0x10')]('/:id',auth[_0xa4ca('0x9')](),controller[_0xa4ca('0x11')]);router[_0xa4ca('0x12')](_0xa4ca('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xa4ca('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 9fc7be2..344abd1 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 _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 +var _0x0273=['Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','thumb','input','text','name','getDataValue','onlineForm','setDataValue','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','parse','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','website_alias','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!'];(function(_0x3f94bd,_0x897298){var _0x2ef8e9=function(_0x409d8c){while(--_0x409d8c){_0x3f94bd['push'](_0x3f94bd['shift']());}};_0x2ef8e9(++_0x897298);}(_0x0273,0x91));var _0x3027=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0273[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3027('0x0'));var rs=require(_0x3027('0x1'));module[_0x3027('0x2')]={'name':{'type':Sequelize[_0x3027('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x3027('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x3027('0x3')]},'mapKey':{'type':Sequelize[_0x3027('0x3')],'defaultValue':_0x3027('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x3027('0x4')},'key':{'type':Sequelize[_0x3027('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x3027('0x3')],'defaultValue':_0x3027('0x5')},'customerAlias':{'type':Sequelize[_0x3027('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x3027('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3027('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x3027('0x3')],'allowNull':![],'defaultValue':_0x3027('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x3027('0x3')],'allowNull':![],'defaultValue':_0x3027('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x3027('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x3027('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x3027('0xa')](_0x3027('0xb'),_0x3027('0xc')),'defaultValue':_0x3027('0xb')},'header_online':{'type':Sequelize[_0x3027('0x3')],'defaultValue':_0x3027('0xd')},'start_chat_button':{'type':Sequelize[_0x3027('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x3027('0x3')],'defaultValue':_0x3027('0xe')},'header_offline':{'type':Sequelize[_0x3027('0x3')],'defaultValue':_0x3027('0xf')},'download_transcript':{'type':Sequelize[_0x3027('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x3027('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x3027('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x3027('0x10')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x3027('0x11')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x3027('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x3027('0x13')},'placeholderMessage':{'type':Sequelize[_0x3027('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x3027('0x3')],'defaultValue':_0x3027('0x14')},'closingMessageButton':{'type':Sequelize[_0x3027('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x3027('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x3027('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x3027('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x3027('0x3')],'defaultValue':_0x3027('0x15')},'ratingType':{'type':Sequelize['ENUM'](_0x3027('0x16'),_0x3027('0x17')),'defaultValue':_0x3027('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x3027('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x3027('0x18'),'variable':null,'config':{'placeholder':'name','type':_0x3027('0x19'),'required':!![]},'props':{'title':_0x3027('0x1a'),'helpText':''}},{'type':_0x3027('0x18'),'props':{'title':_0x3027('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x3027('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x3027('0x1b')](_0x3027('0x1c'))?JSON['parse'](this[_0x3027('0x1b')](_0x3027('0x1c'))):{};},'set':function(_0xcd766f){return this[_0x3027('0x1d')](_0x3027('0x1c'),JSON[_0x3027('0x1e')](_0xcd766f));}},'offlineForm':{'type':Sequelize[_0x3027('0x10')],'defaultValue':function(){return JSON[_0x3027('0x1e')]({'items':[{'type':'input','props':{'title':_0x3027('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x3027('0x4')},'variable':null},{'type':_0x3027('0x1f'),'config':{'placeholder':'Comments'},'props':{'title':_0x3027('0x20'),'helpText':_0x3027('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x3027('0x1b')](_0x3027('0x22'))?JSON[_0x3027('0x23')](this[_0x3027('0x1b')](_0x3027('0x22'))):{};},'set':function(_0x5ce006){return this[_0x3027('0x1d')](_0x3027('0x22'),JSON[_0x3027('0x1e')](_0x5ce006));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x3027('0x24')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x3027('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x3027('0x3')]},'forwardOffline':{'type':Sequelize[_0x3027('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x3027('0x3')]},'waitingTitle':{'type':Sequelize[_0x3027('0x3')],'defaultValue':_0x3027('0x25')},'waitingMessage':{'type':Sequelize[_0x3027('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x3027('0x3')],'defaultValue':_0x3027('0x26')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x3027('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0x3027('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x3027('0x28')},'skipUnmanaged':{'type':Sequelize[_0x3027('0x3')],'defaultValue':_0x3027('0x29')},'sendUnmanaged':{'type':Sequelize[_0x3027('0x3')],'defaultValue':_0x3027('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0x3027('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x3027('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x3027('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x3027('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x3027('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x3027('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x3027('0x3')],'defaultValue':_0x3027('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0x3027('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x3027('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x3027('0x3')],'defaultValue':_0x3027('0x2b')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x3027('0x2c')},'messagesAlignment':{'type':Sequelize[_0x3027('0x3')],'defaultValue':_0x3027('0x2d')},'defaultTitle':{'type':Sequelize[_0x3027('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x3027('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x3027('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x3027('0x3')],'allowNull':![],'defaultValue':_0x3027('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3027('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3027('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x3027('0x3')],'defaultValue':_0x3027('0x2f')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3027('0x8')],'comment':_0x3027('0x30')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x3027('0x31'),'set':function(_0x51d791){if(!_0x51d791)this[_0x3027('0x1d')]('mandatoryDispositionPauseId',null);this[_0x3027('0x1d')](_0x3027('0x32'),_0x51d791);}},'vidaooEscalation':{'type':Sequelize[_0x3027('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x3027('0x3')]},'vidaooTopic':{'type':Sequelize[_0x3027('0x3')],'allowNull':![],'defaultValue':_0x3027('0x33')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x3027('0x34');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x3027('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x3027('0x10')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 6c76916..ad374ff 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 _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 +var _0xb1b6=['updatedAt','CompanyId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','spread','account','list','applications','orderBy','priority','asc','ListId','contact','threadId','ChatInteraction','externalUrl','interaction','firstName','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','files','mapKeyOffline','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','mimetype','server','attachments','offline-chat','basename','openNewInteraction','MailServerOut','Smtp','CloudProvider','forwardOfflineAddress','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','email','MailAccountId','originalname','subjectOffline','toPairsIn','mapValues','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','User','Owner','Tag','Tags','color','tag','virtual','License','readFileSync','server/files/chat/iframe.ejs','URL','3.5.0','remote','headers','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','labelText','backgroundColor','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','stack','finally','addProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Contact','Attachment','addAgents','emit','userChatWebsite:save','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','querystring','html-to-text','ioredis','url','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../errors/api','handleError','../../mysqldb','redis','defaults','localhost','./chatWebsite.socket','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','name','send','Command','getSnippet','timezone','format','iftime\x20%s,%s','interval','iftime\x20%s','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','map','Interval','Intervals','all','some','user-agent-parser','setUA','user-agent','customerIp','cf-connecting-ip','first','x-forwarded-for','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','device','model','vendor','type','Pause','mandatoryDispositionPause','rawAttributes','fieldName','key','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','ChatWebsite','includeAll','findAll','show','params','include','merge','options','create','body','user','userProfileId','find','describe','addDisposition','Disposition','getDispositions','nolimit','ChatWebsiteId','rows','removeDispositions','findOne','CannedAnswer','removeAnswers','ids','addLogo','sitepic','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt'];(function(_0x49fd27,_0x2c0345){var _0x4517d3=function(_0x3a78b9){while(--_0x3a78b9){_0x49fd27['push'](_0x49fd27['shift']());}};_0x4517d3(++_0x2c0345);}(_0xb1b6,0x87));var _0x6b1b=function(_0xc00fcd,_0x50f6d4){_0xc00fcd=_0xc00fcd-0x0;var _0x583013=_0xb1b6[_0xc00fcd];return _0x583013;};'use strict';var Mustache=require(_0x6b1b('0x0'));var util=require(_0x6b1b('0x1'));var path=require(_0x6b1b('0x2'));var ejs=require(_0x6b1b('0x3'));var fs=require('fs');var fs_extra=require(_0x6b1b('0x4'));var _=require(_0x6b1b('0x5'));var querystring=require(_0x6b1b('0x6'));var htmlToText=require(_0x6b1b('0x7'));var Redis=require(_0x6b1b('0x8'));var jayson=require('jayson/promise');var url=require(_0x6b1b('0x9'));var qs=require(_0x6b1b('0xa'));var logger=require(_0x6b1b('0xb'))(_0x6b1b('0xc'));var config=require(_0x6b1b('0xd'));var APIOutOfIntervalError=require(_0x6b1b('0xe'))['APIOutOfIntervalError'];var APINotFoundError=require(_0x6b1b('0xe'))['APINotFoundError'];var APIHandleError=require(_0x6b1b('0xe'))[_0x6b1b('0xf')];var db=require(_0x6b1b('0x10'))['db'];config[_0x6b1b('0x11')]=_[_0x6b1b('0x12')](config['redis'],{'host':_0x6b1b('0x13'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6b1b('0x11')]));require(_0x6b1b('0x14'))[_0x6b1b('0x15')](socket);var client=jayson[_0x6b1b('0x16')][_0x6b1b('0x17')]({'port':0x232c});var client9002=jayson['client'][_0x6b1b('0x17')]({'port':0x232a});var client9003=jayson[_0x6b1b('0x16')][_0x6b1b('0x17')]({'port':0x232b});var client9001=jayson[_0x6b1b('0x16')][_0x6b1b('0x17')]({'port':0x2329});function respondWithRpcPromise(_0x4be6c1,_0x4e2097,_0x91c9ba,_0x1fa4e5){return new Promise(function(_0x4d5d50,_0x34eed0){var _0x3fa59f=_0x1fa4e5||client;return _0x3fa59f[_0x6b1b('0x18')](_0x4be6c1,_0x91c9ba)[_0x6b1b('0x19')](function(_0x10119b){logger[_0x6b1b('0x1a')](_0x6b1b('0x1b'),_0x4e2097,_0x6b1b('0x1c'));logger['debug'](_0x6b1b('0x1d'),_0x4e2097,_0x6b1b('0x1c'),JSON[_0x6b1b('0x1e')](_0x10119b));if(_0x10119b[_0x6b1b('0x1f')]){if(_0x10119b[_0x6b1b('0x1f')][_0x6b1b('0x20')]===0x1f4){logger['error'](_0x6b1b('0x1b'),_0x4e2097,_0x10119b[_0x6b1b('0x1f')][_0x6b1b('0x21')]);return _0x34eed0(_0x10119b[_0x6b1b('0x1f')][_0x6b1b('0x21')]);}logger[_0x6b1b('0x1f')](_0x6b1b('0x1b'),_0x4e2097,_0x10119b[_0x6b1b('0x1f')]['message']);return _0x4d5d50(_0x10119b[_0x6b1b('0x1f')][_0x6b1b('0x21')]);}else{logger['info'](_0x6b1b('0x1b'),_0x4e2097,_0x6b1b('0x1c'));_0x4d5d50(_0x10119b[_0x6b1b('0x22')][_0x6b1b('0x21')]);}})[_0x6b1b('0x23')](function(_0x1b1206){logger['error'](_0x6b1b('0x1b'),_0x4e2097,_0x1b1206);_0x34eed0(_0x1b1206);});});}function respondWithStatusCode(_0xcc32ff,_0x16b94b){_0x16b94b=_0x16b94b||0xcc;return function(_0x2f3bde){if(_0x2f3bde){return _0xcc32ff[_0x6b1b('0x24')](_0x16b94b);}return _0xcc32ff[_0x6b1b('0x25')](_0x16b94b)['end']();};}function respondWithResult(_0xf5b1f7,_0x1eaa50){_0x1eaa50=_0x1eaa50||0xc8;return function(_0x25e7ea){if(_0x25e7ea){return _0xf5b1f7[_0x6b1b('0x25')](_0x1eaa50)[_0x6b1b('0x26')](_0x25e7ea);}};}function respondWithFilteredResult(_0x48a758,_0x55c6f0){return function(_0x48419d){if(_0x48419d){var _0xb35e2e=typeof _0x55c6f0[_0x6b1b('0x27')]===_0x6b1b('0x28')&&typeof _0x55c6f0[_0x6b1b('0x29')]===_0x6b1b('0x28');var _0x32c3d7=_0x48419d[_0x6b1b('0x2a')];var _0x1c8fbf=_0xb35e2e?0x0:_0x55c6f0['offset'];var _0x483cb2=_0xb35e2e?_0x48419d['count']:_0x55c6f0[_0x6b1b('0x27')]+_0x55c6f0[_0x6b1b('0x29')];var _0x3390c1;if(_0x483cb2>=_0x32c3d7){_0x483cb2=_0x32c3d7;_0x3390c1=0xc8;}else{_0x3390c1=0xce;}_0x48a758['status'](_0x3390c1);return _0x48a758[_0x6b1b('0x2b')](_0x6b1b('0x2c'),_0x1c8fbf+'-'+_0x483cb2+'/'+_0x32c3d7)[_0x6b1b('0x26')](_0x48419d);}return null;};}function saveUpdates(_0x942dd4){return function(_0x308b6e){if(_0x308b6e){return _0x308b6e[_0x6b1b('0x2d')](_0x942dd4)[_0x6b1b('0x19')](function(_0x57bd12){return _0x57bd12;});}return null;};}function removeEntity(_0x4927c1){return function(_0xbc8031){if(_0xbc8031){return _0xbc8031[_0x6b1b('0x2e')]()[_0x6b1b('0x19')](function(){var _0x4de5bb=_0xbc8031[_0x6b1b('0x2f')]({'plain':!![]});var _0x224d20=_0x6b1b('0x30');return db[_0x6b1b('0x31')]['destroy']({'where':{'type':_0x224d20,'resourceId':_0x4de5bb['id']}})[_0x6b1b('0x19')](function(){return _0xbc8031;});})[_0x6b1b('0x19')](function(){_0x4927c1[_0x6b1b('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ee522){return function(_0x31cb08){if(!_0x31cb08){_0x1ee522['sendStatus'](0x194);}return _0x31cb08;};}function handleError(_0x486e8a,_0x12e6d5){_0x12e6d5=_0x12e6d5||0x1f4;return function(_0x1e34aa){logger[_0x6b1b('0x1f')](_0x1e34aa['stack']);if(_0x1e34aa[_0x6b1b('0x32')]){delete _0x1e34aa[_0x6b1b('0x32')];}_0x486e8a['status'](_0x12e6d5)[_0x6b1b('0x33')](_0x1e34aa);};}function iftimePromise(_0x2e4815,_0x5b30cf){return respondWithRpcPromise(_0x6b1b('0x34'),_0x6b1b('0x35'),{'command':_0x5b30cf[_0x6b1b('0x36')]?util[_0x6b1b('0x37')](_0x6b1b('0x38'),_0x2e4815[_0x6b1b('0x39')],_0x5b30cf['timezone']):util['format'](_0x6b1b('0x3a'),_0x2e4815[_0x6b1b('0x39')])},client9002)[_0x6b1b('0x19')](function(_0x6379a5){var _0x309273=_0x6379a5&&_0x6379a5['indexOf']('true')>=0x0?!![]:![];logger[_0x6b1b('0x1a')](_0x6b1b('0x3b'),_0x5b30cf['id'],_0x2e4815['id'],_0x2e4815[_0x6b1b('0x39')],_0x309273?_0x6b1b('0x3c'):_0x6b1b('0x3d'),_0x5b30cf[_0x6b1b('0x36')]?_0x5b30cf[_0x6b1b('0x36')]:_0x6b1b('0x3e'));return _0x309273;})['catch'](function(_0x388413){logger[_0x6b1b('0x1f')](_0x6b1b('0x3b'),_0x5b30cf['id'],_0x2e4815['id'],_0x2e4815[_0x6b1b('0x39')],util[_0x6b1b('0x3f')](_0x388413,{'showHidden':![],'depth':null}),_0x5b30cf[_0x6b1b('0x36')]?_0x5b30cf[_0x6b1b('0x36')]:'No\x20timezone');return![];});}function checkWebsiteIntervals(_0x38a964){var _0x1ca343=_[_0x6b1b('0x40')](_0x38a964[_0x6b1b('0x41')][_0x6b1b('0x42')],function(_0x3d30ca){var _0xaa0b76=_0x3d30ca[_0x6b1b('0x2f')]({'plain':!![]});return iftimePromise(_0xaa0b76,_0x38a964);});return Promise[_0x6b1b('0x43')](_0x1ca343)[_0x6b1b('0x19')](function(_0x17957f){return _[_0x6b1b('0x44')](_0x17957f);});}function createInteractionObject(_0x48447a,_0x22720b,_0x34e172,_0x5422cc){var _0x5d67dd=require(_0x6b1b('0x45'));var _0x442532=new _0x5d67dd();var _0xfdc4a5=_0x442532[_0x6b1b('0x46')](_0x34e172[_0x6b1b('0x47')])['getResult']();var _0x30902c=_0x22720b[_0x6b1b('0x48')];if(_0x34e172[_0x6b1b('0x49')]){_0x30902c=_0x34e172[_0x6b1b('0x49')];}else if(_0x34e172['x-forwarded-for']){_0x30902c=_[_0x6b1b('0x4a')](_0x34e172[_0x6b1b('0x4b')]['split'](','));}return{'ContactId':_0x5422cc['id'],'ChatWebsiteId':_0x48447a,'from':(_0x5422cc['firstName']||'')+'\x20'+(_0x5422cc[_0x6b1b('0x4c')]||''),'customerIp':_0x30902c,'customerPort':_0x34e172['x-real-port']?_0x34e172[_0x6b1b('0x4d')]:null,'referer':_0x22720b[_0x6b1b('0x4e')],'browserName':_0xfdc4a5[_0x6b1b('0x4f')]['name']&&_0xfdc4a5[_0x6b1b('0x4f')][_0x6b1b('0x50')]?util[_0x6b1b('0x37')](_0x6b1b('0x51'),_0xfdc4a5[_0x6b1b('0x4f')]['name'],_0xfdc4a5['browser'][_0x6b1b('0x50')]):_0x6b1b('0x52'),'browserVersion':_0xfdc4a5[_0x6b1b('0x4f')][_0x6b1b('0x50')]||_0x6b1b('0x52'),'osName':util[_0x6b1b('0x37')](_0x6b1b('0x51'),_0xfdc4a5['os'][_0x6b1b('0x32')],_0xfdc4a5['os'][_0x6b1b('0x50')]),'osVersion':_0xfdc4a5['os'][_0x6b1b('0x50')],'deviceModel':_0xfdc4a5[_0x6b1b('0x53')][_0x6b1b('0x54')]&&_0xfdc4a5[_0x6b1b('0x53')][_0x6b1b('0x55')]?util[_0x6b1b('0x37')]('%s\x20%s\x20%s',_0xfdc4a5[_0x6b1b('0x53')]['model'],_0xfdc4a5[_0x6b1b('0x53')]['vendor'],_0xfdc4a5[_0x6b1b('0x53')]['type']):null,'deviceVendor':_0xfdc4a5[_0x6b1b('0x53')][_0x6b1b('0x55')],'deviceType':_0xfdc4a5[_0x6b1b('0x53')][_0x6b1b('0x56')],'formData':JSON['stringify'](_0x22720b)};}exports['index']=function(_0x21b24f,_0x333ca5){var _0x7e4582={'include':[{'model':db[_0x6b1b('0x57')],'as':_0x6b1b('0x58')}]},_0x50e290={},_0x265f2f={'count':0x0,'rows':[]};var _0x497b1d=_[_0x6b1b('0x40')](db['ChatWebsite'][_0x6b1b('0x59')],function(_0x49d39d){return{'name':_0x49d39d[_0x6b1b('0x5a')],'type':_0x49d39d[_0x6b1b('0x56')][_0x6b1b('0x5b')]};});_0x50e290['model']=_['map'](_0x497b1d,'name');_0x50e290[_0x6b1b('0x5c')]=_[_0x6b1b('0x5d')](_0x21b24f[_0x6b1b('0x5c')]);_0x50e290[_0x6b1b('0x5e')]=_[_0x6b1b('0x5f')](_0x50e290[_0x6b1b('0x54')],_0x50e290[_0x6b1b('0x5c')]);_0x7e4582['attributes']=_[_0x6b1b('0x5f')](_0x50e290['model'],qs[_0x6b1b('0x60')](_0x21b24f[_0x6b1b('0x5c')][_0x6b1b('0x60')]));_0x7e4582[_0x6b1b('0x61')]=_0x7e4582[_0x6b1b('0x61')][_0x6b1b('0x62')]?_0x7e4582[_0x6b1b('0x61')]:_0x50e290[_0x6b1b('0x54')];if(!_0x21b24f[_0x6b1b('0x5c')][_0x6b1b('0x63')]('nolimit')){_0x7e4582['limit']=qs['limit'](_0x21b24f[_0x6b1b('0x5c')][_0x6b1b('0x29')]);_0x7e4582[_0x6b1b('0x27')]=qs['offset'](_0x21b24f[_0x6b1b('0x5c')][_0x6b1b('0x27')]);}_0x7e4582[_0x6b1b('0x64')]=qs[_0x6b1b('0x65')](_0x21b24f['query'][_0x6b1b('0x65')]);_0x7e4582[_0x6b1b('0x66')]=qs['filters'](_[_0x6b1b('0x67')](_0x21b24f[_0x6b1b('0x5c')],_0x50e290['filters']),_0x497b1d);if(_0x21b24f[_0x6b1b('0x5c')][_0x6b1b('0x68')]){_0x7e4582[_0x6b1b('0x66')]=_['merge'](_0x7e4582[_0x6b1b('0x66')],{'$or':_['map'](_0x497b1d,function(_0x8bdf71){if(_0x8bdf71[_0x6b1b('0x56')]!=='VIRTUAL'){var _0x580632={};_0x580632[_0x8bdf71[_0x6b1b('0x32')]]={'$like':'%'+_0x21b24f[_0x6b1b('0x5c')][_0x6b1b('0x68')]+'%'};return _0x580632;}})});}_0x7e4582=_['merge']({},_0x7e4582,_0x21b24f['options']);var _0x2cce3c={'where':_0x7e4582[_0x6b1b('0x66')]};return db[_0x6b1b('0x69')]['count'](_0x2cce3c)['then'](function(_0x104c6b){_0x265f2f['count']=_0x104c6b;if(_0x21b24f[_0x6b1b('0x5c')][_0x6b1b('0x6a')]){_0x7e4582['include']=[{'all':!![]}];}return db[_0x6b1b('0x69')][_0x6b1b('0x6b')](_0x7e4582);})[_0x6b1b('0x19')](function(_0x46448a){_0x265f2f['rows']=_0x46448a;return _0x265f2f;})['then'](respondWithFilteredResult(_0x333ca5,_0x7e4582))[_0x6b1b('0x23')](handleError(_0x333ca5,null));};exports[_0x6b1b('0x6c')]=function(_0x2a828b,_0x329f4f){var _0x44c0da={'raw':![],'where':{'id':_0x2a828b[_0x6b1b('0x6d')]['id']},'include':[{'model':db[_0x6b1b('0x57')],'as':_0x6b1b('0x58')}]},_0x289ba8={};_0x289ba8['model']=_[_0x6b1b('0x5d')](db[_0x6b1b('0x69')][_0x6b1b('0x59')]);_0x289ba8[_0x6b1b('0x5c')]=_['keys'](_0x2a828b['query']);_0x289ba8[_0x6b1b('0x5e')]=_[_0x6b1b('0x5f')](_0x289ba8[_0x6b1b('0x54')],_0x289ba8['query']);_0x44c0da[_0x6b1b('0x61')]=_[_0x6b1b('0x5f')](_0x289ba8[_0x6b1b('0x54')],qs[_0x6b1b('0x60')](_0x2a828b['query'][_0x6b1b('0x60')]));_0x44c0da[_0x6b1b('0x61')]=_0x44c0da[_0x6b1b('0x61')][_0x6b1b('0x62')]?_0x44c0da[_0x6b1b('0x61')]:_0x289ba8['model'];if(_0x2a828b[_0x6b1b('0x5c')][_0x6b1b('0x6a')]){_0x44c0da[_0x6b1b('0x6e')]=[{'all':!![]}];}_0x44c0da=_[_0x6b1b('0x6f')]({},_0x44c0da,_0x2a828b[_0x6b1b('0x70')]);return db[_0x6b1b('0x69')]['find'](_0x44c0da)[_0x6b1b('0x19')](handleEntityNotFound(_0x329f4f,null))[_0x6b1b('0x19')](respondWithResult(_0x329f4f,null))['catch'](handleError(_0x329f4f,null));};exports[_0x6b1b('0x71')]=function(_0xb385,_0x20818b){return db[_0x6b1b('0x69')][_0x6b1b('0x71')](_0xb385[_0x6b1b('0x72')],{})[_0x6b1b('0x19')](function(_0x20c990){var _0x45c9a4=_0xb385['user']['get']({'plain':!![]});if(!_0x45c9a4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45c9a4['role']===_0x6b1b('0x73')){var _0x4c63d7=_0x20c990[_0x6b1b('0x2f')]({'plain':!![]});var _0x1771cd=_0x6b1b('0x30');return db['UserProfileSection']['find']({'where':{'name':_0x1771cd,'userProfileId':_0x45c9a4[_0x6b1b('0x74')]},'raw':!![]})[_0x6b1b('0x19')](function(_0x2e9754){if(_0x2e9754&&_0x2e9754['autoAssociation']===0x0){return db[_0x6b1b('0x31')][_0x6b1b('0x71')]({'name':_0x4c63d7[_0x6b1b('0x32')],'resourceId':_0x4c63d7['id'],'type':_0x2e9754[_0x6b1b('0x32')],'sectionId':_0x2e9754['id']},{})[_0x6b1b('0x19')](function(){return _0x20c990;});}else{return _0x20c990;}})[_0x6b1b('0x23')](function(_0x36b1b3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36b1b3);throw _0x36b1b3;});}return _0x20c990;})['then'](respondWithResult(_0x20818b,0xc9))[_0x6b1b('0x23')](handleError(_0x20818b,null));};exports['update']=function(_0x1e2807,_0x5b87e3){if(_0x1e2807[_0x6b1b('0x72')]['id']){delete _0x1e2807['body']['id'];}return db[_0x6b1b('0x69')][_0x6b1b('0x75')]({'where':{'id':_0x1e2807['params']['id']},'include':[{'model':db[_0x6b1b('0x57')],'as':_0x6b1b('0x58')}]})[_0x6b1b('0x19')](handleEntityNotFound(_0x5b87e3,null))[_0x6b1b('0x19')](saveUpdates(_0x1e2807[_0x6b1b('0x72')],null))[_0x6b1b('0x19')](respondWithResult(_0x5b87e3,null))['catch'](handleError(_0x5b87e3,null));};exports[_0x6b1b('0x2e')]=function(_0x58eb59,_0x3405d4){return db['ChatWebsite'][_0x6b1b('0x75')]({'where':{'id':_0x58eb59[_0x6b1b('0x6d')]['id']}})['then'](handleEntityNotFound(_0x3405d4,null))[_0x6b1b('0x19')](removeEntity(_0x3405d4,null))[_0x6b1b('0x23')](handleError(_0x3405d4,null));};exports[_0x6b1b('0x76')]=function(_0x4e24a6,_0x3ed706){return db[_0x6b1b('0x69')]['describe']()['then'](respondWithResult(_0x3ed706,null))[_0x6b1b('0x23')](handleError(_0x3ed706,null));};exports[_0x6b1b('0x77')]=function(_0x366bc8,_0x1a7bf1){if(_0x366bc8[_0x6b1b('0x72')]['id']){delete _0x366bc8['body']['id'];}return db[_0x6b1b('0x69')][_0x6b1b('0x75')]({'where':{'id':_0x366bc8[_0x6b1b('0x6d')]['id']}})[_0x6b1b('0x19')](handleEntityNotFound(_0x1a7bf1,null))[_0x6b1b('0x19')](function(_0xda6932){if(_0xda6932){_0x366bc8[_0x6b1b('0x72')]['ChatWebsiteId']=_0xda6932['id'];return db[_0x6b1b('0x78')][_0x6b1b('0x71')](_0x366bc8[_0x6b1b('0x72')]);}})[_0x6b1b('0x19')](respondWithResult(_0x1a7bf1,null))[_0x6b1b('0x23')](handleError(_0x1a7bf1,null));};exports[_0x6b1b('0x79')]=function(_0x3a962f,_0x4e60c3){var _0x59dfe4={'raw':![],'where':{}};var _0x982261={};var _0x2bfb26={'count':0x0,'rows':[]};return db[_0x6b1b('0x69')]['findOne']({'where':{'id':_0x3a962f[_0x6b1b('0x6d')]['id']}})[_0x6b1b('0x19')](handleEntityNotFound(_0x4e60c3,null))['then'](function(_0x5ed350){if(_0x5ed350){_0x982261[_0x6b1b('0x54')]=_['keys'](db[_0x6b1b('0x78')]['rawAttributes']);_0x982261[_0x6b1b('0x5c')]=_[_0x6b1b('0x5d')](_0x3a962f[_0x6b1b('0x5c')]);_0x982261[_0x6b1b('0x5e')]=_['intersection'](_0x982261['model'],_0x982261[_0x6b1b('0x5c')]);_0x59dfe4[_0x6b1b('0x61')]=_[_0x6b1b('0x5f')](_0x982261[_0x6b1b('0x54')],qs[_0x6b1b('0x60')](_0x3a962f['query'][_0x6b1b('0x60')]));_0x59dfe4[_0x6b1b('0x61')]=_0x59dfe4[_0x6b1b('0x61')][_0x6b1b('0x62')]?_0x59dfe4[_0x6b1b('0x61')]:_0x982261['model'];if(!_0x3a962f[_0x6b1b('0x5c')][_0x6b1b('0x63')](_0x6b1b('0x7a'))){_0x59dfe4[_0x6b1b('0x29')]=qs[_0x6b1b('0x29')](_0x3a962f[_0x6b1b('0x5c')][_0x6b1b('0x29')]);_0x59dfe4[_0x6b1b('0x27')]=qs[_0x6b1b('0x27')](_0x3a962f['query'][_0x6b1b('0x27')]);}_0x59dfe4[_0x6b1b('0x64')]=qs[_0x6b1b('0x65')](_0x3a962f['query'][_0x6b1b('0x65')]);_0x59dfe4[_0x6b1b('0x66')]=qs['filters'](_[_0x6b1b('0x67')](_0x3a962f[_0x6b1b('0x5c')],_0x982261[_0x6b1b('0x5e')]));_0x59dfe4[_0x6b1b('0x66')][_0x6b1b('0x7b')]=_0x5ed350['id'];if(_0x3a962f[_0x6b1b('0x5c')][_0x6b1b('0x68')]){_0x59dfe4[_0x6b1b('0x66')]=_[_0x6b1b('0x6f')](_0x59dfe4[_0x6b1b('0x66')],{'$or':_[_0x6b1b('0x40')](_0x59dfe4['attributes'],function(_0x377429){var _0x2d906d={};_0x2d906d[_0x377429]={'$like':'%'+_0x3a962f[_0x6b1b('0x5c')][_0x6b1b('0x68')]+'%'};return _0x2d906d;})});}_0x59dfe4=_[_0x6b1b('0x6f')]({},_0x59dfe4,_0x3a962f['options']);return db['Disposition'][_0x6b1b('0x2a')]({'where':_0x59dfe4[_0x6b1b('0x66')]})['then'](function(_0xd35359){_0x2bfb26['count']=_0xd35359;if(_0x3a962f[_0x6b1b('0x5c')]['includeAll']){_0x59dfe4[_0x6b1b('0x6e')]=[{'all':!![]}];}return db[_0x6b1b('0x78')][_0x6b1b('0x6b')](_0x59dfe4);})[_0x6b1b('0x19')](function(_0x562d3e){_0x2bfb26[_0x6b1b('0x7c')]=_0x562d3e;return _0x2bfb26;});}})[_0x6b1b('0x19')](respondWithFilteredResult(_0x4e60c3,_0x59dfe4))[_0x6b1b('0x23')](handleError(_0x4e60c3,null));};exports['removeDispositions']=function(_0x2bb7ed,_0x56346e){return db['ChatWebsite']['find']({'where':{'id':_0x2bb7ed[_0x6b1b('0x6d')]['id']}})['then'](handleEntityNotFound(_0x56346e,null))[_0x6b1b('0x19')](function(_0x55ba13){if(_0x55ba13){return _0x55ba13[_0x6b1b('0x7d')](_0x2bb7ed[_0x6b1b('0x5c')]['ids']);}})[_0x6b1b('0x19')](respondWithStatusCode(_0x56346e,null))[_0x6b1b('0x23')](handleError(_0x56346e,null));};exports['addAnswer']=function(_0x1cd25f,_0x2dd03c){if(_0x1cd25f[_0x6b1b('0x72')]['id']){delete _0x1cd25f[_0x6b1b('0x72')]['id'];}return db[_0x6b1b('0x69')]['find']({'where':{'id':_0x1cd25f[_0x6b1b('0x6d')]['id']}})['then'](handleEntityNotFound(_0x2dd03c,null))[_0x6b1b('0x19')](function(_0x422d9f){if(_0x422d9f){_0x1cd25f['body'][_0x6b1b('0x7b')]=_0x422d9f['id'];return db['CannedAnswer']['create'](_0x1cd25f[_0x6b1b('0x72')]);}})['then'](respondWithResult(_0x2dd03c,null))[_0x6b1b('0x23')](handleError(_0x2dd03c,null));};exports['getAnswers']=function(_0x5f3052,_0x1414aa){var _0xb90330={'raw':![],'where':{}};var _0x41e3e5={};var _0x3b9079={'count':0x0,'rows':[]};return db[_0x6b1b('0x69')][_0x6b1b('0x7e')]({'where':{'id':_0x5f3052[_0x6b1b('0x6d')]['id']}})[_0x6b1b('0x19')](handleEntityNotFound(_0x1414aa,null))[_0x6b1b('0x19')](function(_0x1d6a9c){if(_0x1d6a9c){_0x41e3e5[_0x6b1b('0x54')]=_[_0x6b1b('0x5d')](db[_0x6b1b('0x7f')][_0x6b1b('0x59')]);_0x41e3e5[_0x6b1b('0x5c')]=_[_0x6b1b('0x5d')](_0x5f3052[_0x6b1b('0x5c')]);_0x41e3e5[_0x6b1b('0x5e')]=_[_0x6b1b('0x5f')](_0x41e3e5['model'],_0x41e3e5['query']);_0xb90330[_0x6b1b('0x61')]=_['intersection'](_0x41e3e5[_0x6b1b('0x54')],qs[_0x6b1b('0x60')](_0x5f3052['query'][_0x6b1b('0x60')]));_0xb90330[_0x6b1b('0x61')]=_0xb90330['attributes'][_0x6b1b('0x62')]?_0xb90330[_0x6b1b('0x61')]:_0x41e3e5[_0x6b1b('0x54')];if(!_0x5f3052['query'][_0x6b1b('0x63')](_0x6b1b('0x7a'))){_0xb90330[_0x6b1b('0x29')]=qs['limit'](_0x5f3052[_0x6b1b('0x5c')][_0x6b1b('0x29')]);_0xb90330[_0x6b1b('0x27')]=qs[_0x6b1b('0x27')](_0x5f3052['query'][_0x6b1b('0x27')]);}_0xb90330[_0x6b1b('0x64')]=qs[_0x6b1b('0x65')](_0x5f3052['query'][_0x6b1b('0x65')]);_0xb90330[_0x6b1b('0x66')]=qs['filters'](_[_0x6b1b('0x67')](_0x5f3052['query'],_0x41e3e5['filters']));_0xb90330['where'][_0x6b1b('0x7b')]=_0x1d6a9c['id'];if(_0x5f3052[_0x6b1b('0x5c')]['filter']){_0xb90330['where']=_[_0x6b1b('0x6f')](_0xb90330[_0x6b1b('0x66')],{'$or':_['map'](_0xb90330[_0x6b1b('0x61')],function(_0x27e4ed){var _0x1d7473={};_0x1d7473[_0x27e4ed]={'$like':'%'+_0x5f3052['query'][_0x6b1b('0x68')]+'%'};return _0x1d7473;})});}_0xb90330=_['merge']({},_0xb90330,_0x5f3052['options']);return db[_0x6b1b('0x7f')]['count']({'where':_0xb90330[_0x6b1b('0x66')]})['then'](function(_0x541833){_0x3b9079[_0x6b1b('0x2a')]=_0x541833;if(_0x5f3052['query'][_0x6b1b('0x6a')]){_0xb90330['include']=[{'all':!![]}];}return db[_0x6b1b('0x7f')][_0x6b1b('0x6b')](_0xb90330);})[_0x6b1b('0x19')](function(_0x488726){_0x3b9079[_0x6b1b('0x7c')]=_0x488726;return _0x3b9079;});}})[_0x6b1b('0x19')](respondWithFilteredResult(_0x1414aa,_0xb90330))[_0x6b1b('0x23')](handleError(_0x1414aa,null));};exports['removeAnswers']=function(_0x2a7345,_0x3a9639){return db['ChatWebsite'][_0x6b1b('0x75')]({'where':{'id':_0x2a7345[_0x6b1b('0x6d')]['id']}})[_0x6b1b('0x19')](handleEntityNotFound(_0x3a9639,null))[_0x6b1b('0x19')](function(_0x4c4a06){if(_0x4c4a06){return _0x4c4a06[_0x6b1b('0x80')](_0x2a7345['query'][_0x6b1b('0x81')]);}})[_0x6b1b('0x19')](respondWithStatusCode(_0x3a9639,null))[_0x6b1b('0x23')](handleError(_0x3a9639,null));};exports[_0x6b1b('0x82')]=function(_0x1267a,_0x314ab2){_0x1267a[_0x6b1b('0x72')][_0x6b1b('0x83')]=_0x1267a[_0x6b1b('0x84')][_0x6b1b('0x85')];return db['ChatWebsite']['find']({'where':{'id':_0x1267a[_0x6b1b('0x6d')]['id']}})[_0x6b1b('0x19')](handleEntityNotFound(_0x314ab2,null))[_0x6b1b('0x19')](saveUpdates(_0x1267a[_0x6b1b('0x72')],null))[_0x6b1b('0x19')](respondWithResult(_0x314ab2,null))[_0x6b1b('0x23')](handleError(_0x314ab2,null));};exports['addAvatar']=function(_0x4fff0a,_0x47c4cc){_0x4fff0a[_0x6b1b('0x72')][_0x6b1b('0x86')]=_0x4fff0a[_0x6b1b('0x84')]['filename'];return db[_0x6b1b('0x69')][_0x6b1b('0x75')]({'where':{'id':_0x4fff0a[_0x6b1b('0x6d')]['id']}})[_0x6b1b('0x19')](handleEntityNotFound(_0x47c4cc,null))['then'](saveUpdates(_0x4fff0a['body'],null))[_0x6b1b('0x19')](respondWithResult(_0x47c4cc,null))['catch'](handleError(_0x47c4cc,null));};exports[_0x6b1b('0x87')]=function(_0x2547ef,_0x16ea40){_0x2547ef[_0x6b1b('0x72')][_0x6b1b('0x88')]=_0x2547ef['file'][_0x6b1b('0x85')];return db[_0x6b1b('0x69')]['find']({'where':{'id':_0x2547ef['params']['id']}})[_0x6b1b('0x19')](handleEntityNotFound(_0x16ea40,null))['then'](saveUpdates(_0x2547ef[_0x6b1b('0x72')],null))['then'](respondWithResult(_0x16ea40,null))['catch'](handleError(_0x16ea40,null));};exports[_0x6b1b('0x89')]=function(_0x3e2ae5,_0x104f1e){_0x3e2ae5[_0x6b1b('0x72')][_0x6b1b('0x8a')]=_0x3e2ae5['file'][_0x6b1b('0x85')];return db[_0x6b1b('0x69')][_0x6b1b('0x75')]({'where':{'id':_0x3e2ae5[_0x6b1b('0x6d')]['id']}})[_0x6b1b('0x19')](handleEntityNotFound(_0x104f1e,null))[_0x6b1b('0x19')](saveUpdates(_0x3e2ae5[_0x6b1b('0x72')],null))[_0x6b1b('0x19')](respondWithResult(_0x104f1e,null))['catch'](handleError(_0x104f1e,null));};exports['getLogo']=function(_0x50810e,_0x43a5d1){var _0x48fb08=path[_0x6b1b('0x8b')](config[_0x6b1b('0x8c')],_0x6b1b('0x8d'));var _0x16313e={'where':{'id':_0x50810e['params']['id']},'attributes':['id',_0x6b1b('0x83')],'raw':!![]};var _0x436892=![];return require(_0x6b1b('0x8e'))[_0x6b1b('0x8f')]()[_0x6b1b('0x19')](function(_0x1f6964){if(_0x1f6964){_0x436892=_0x1f6964[_0x6b1b('0x90')];}})[_0x6b1b('0x19')](function(){return db[_0x6b1b('0x69')][_0x6b1b('0x75')](_0x16313e);})[_0x6b1b('0x19')](handleEntityNotFound(_0x43a5d1,null))[_0x6b1b('0x19')](function(_0x3886ee){if(_0x3886ee){if(!_[_0x6b1b('0x91')](_0x3886ee[_0x6b1b('0x83')])){if(fs[_0x6b1b('0x92')](path['join'](config[_0x6b1b('0x8c')],_0x6b1b('0x93'),_0x3886ee[_0x6b1b('0x83')]))&&_0x436892){_0x48fb08=path[_0x6b1b('0x8b')](config[_0x6b1b('0x8c')],_0x6b1b('0x93'),_0x3886ee[_0x6b1b('0x83')]);}}return _0x43a5d1[_0x6b1b('0x94')](_0x48fb08);}})[_0x6b1b('0x23')](handleError(_0x43a5d1,null));};exports[_0x6b1b('0x95')]=function(_0x55e30f,_0x25d34a){var _0x58e092=path[_0x6b1b('0x8b')](config[_0x6b1b('0x8c')],'server/files/images/avatars/default_avatar.png');var _0x3f9d54={'where':{'id':_0x55e30f[_0x6b1b('0x6d')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x6b1b('0x69')][_0x6b1b('0x75')](_0x3f9d54)['then'](handleEntityNotFound(_0x25d34a,null))['then'](function(_0x2d024a){if(_0x2d024a){if(!_[_0x6b1b('0x91')](_0x2d024a[_0x6b1b('0x86')])){if(fs['existsSync'](path[_0x6b1b('0x8b')](config[_0x6b1b('0x8c')],'server/files/images/avatars/',_0x2d024a['agentAvatar']))){_0x58e092=path[_0x6b1b('0x8b')](config[_0x6b1b('0x8c')],_0x6b1b('0x96'),_0x2d024a['agentAvatar']);}}return _0x25d34a['download'](_0x58e092);}})[_0x6b1b('0x23')](handleError(_0x25d34a,null));};exports[_0x6b1b('0x97')]=function(_0x23d2a9,_0x566cef){var _0x1c8291=path['join'](config[_0x6b1b('0x8c')],_0x6b1b('0x98'));var _0x4ed518={'where':{'id':_0x23d2a9[_0x6b1b('0x6d')]['id']},'attributes':['id',_0x6b1b('0x88'),'showCustomerAvatar'],'raw':!![]};return db[_0x6b1b('0x69')][_0x6b1b('0x75')](_0x4ed518)[_0x6b1b('0x19')](handleEntityNotFound(_0x566cef,null))[_0x6b1b('0x19')](function(_0x381fdc){if(_0x381fdc){if(!_[_0x6b1b('0x91')](_0x381fdc[_0x6b1b('0x88')])){if(fs[_0x6b1b('0x92')](path[_0x6b1b('0x8b')](config[_0x6b1b('0x8c')],_0x6b1b('0x96'),_0x381fdc[_0x6b1b('0x88')]))&&_0x381fdc[_0x6b1b('0x99')]){_0x1c8291=path[_0x6b1b('0x8b')](config['root'],_0x6b1b('0x96'),_0x381fdc['customerAvatar']);}}return _0x566cef[_0x6b1b('0x94')](_0x1c8291);}})[_0x6b1b('0x23')](handleError(_0x566cef,null));};exports[_0x6b1b('0x9a')]=function(_0x10b4c3,_0x3a0d4a){var _0x2bdbff=path[_0x6b1b('0x8b')](config[_0x6b1b('0x8c')],_0x6b1b('0x9b'));var _0x577d3c={'where':{'id':_0x10b4c3[_0x6b1b('0x6d')]['id']},'attributes':['id',_0x6b1b('0x8a')],'raw':!![]};return db[_0x6b1b('0x69')]['find'](_0x577d3c)[_0x6b1b('0x19')](handleEntityNotFound(_0x3a0d4a,null))[_0x6b1b('0x19')](function(_0x2fc576){if(_0x2fc576){if(!_[_0x6b1b('0x91')](_0x2fc576[_0x6b1b('0x8a')])){if(fs[_0x6b1b('0x92')](path[_0x6b1b('0x8b')](config[_0x6b1b('0x8c')],'server/files/images/avatars/',_0x2fc576[_0x6b1b('0x8a')]))){_0x2bdbff=path['join'](config[_0x6b1b('0x8c')],_0x6b1b('0x96'),_0x2fc576['systemAvatar']);}}return _0x3a0d4a['download'](_0x2bdbff);}})[_0x6b1b('0x23')](handleError(_0x3a0d4a,null));};exports[_0x6b1b('0x9c')]=function(_0x3c19fe,_0x518087){var _0x2c418b={'body':_0x3c19fe[_0x6b1b('0x72')],'channel':'chat'};var _0x170710=[];var _0x5732c8=[];var _0x3e9bf3={};var _0x33bb90=![];return db[_0x6b1b('0x9d')][_0x6b1b('0x76')]()[_0x6b1b('0x19')](function(_0xb82426){if(!_0xb82426){throw new db[(_0x6b1b('0x9e'))][(_0x6b1b('0x9f'))](_0x6b1b('0xa0'));}_0x170710=_[_0x6b1b('0xa1')](_[_0x6b1b('0x5d')](_0xb82426),[_0x6b1b('0xa2'),'updatedAt']);_0x5732c8=_[_0x6b1b('0xa1')](_[_0x6b1b('0x5d')](_0xb82426),[_0x6b1b('0xa2'),_0x6b1b('0xa3'),_0x6b1b('0xa4'),'ListId']);if(_0x3c19fe[_0x6b1b('0x72')]['id']){delete _0x3c19fe[_0x6b1b('0x72')]['id'];}if(_[_0x6b1b('0x91')](_0x3c19fe[_0x6b1b('0x72')][_0x6b1b('0xa5')])){throw new db[(_0x6b1b('0x9e'))]['ValidationError'](_0x6b1b('0xa6'));}if(_[_0x6b1b('0x91')](_0x3c19fe['body'][_0x6b1b('0x72')])||_0x3c19fe[_0x6b1b('0x72')][_0x6b1b('0x72')]===''){throw new db[(_0x6b1b('0x9e'))][(_0x6b1b('0x9f'))](_0x6b1b('0xa7'));}if(_[_0x6b1b('0x91')](_0x3c19fe[_0x6b1b('0x72')][_0x6b1b('0xa8')])){throw new db[(_0x6b1b('0x9e'))][(_0x6b1b('0x9f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5732c8);}if(!_[_0x6b1b('0xa9')](_0x5732c8,_0x3c19fe[_0x6b1b('0x72')][_0x6b1b('0xa8')])){throw new db['Sequelize'][(_0x6b1b('0x9f'))](_0x6b1b('0xaa')+_0x5732c8);}_0x3e9bf3[_0x3c19fe[_0x6b1b('0x72')][_0x6b1b('0xa8')]]=_0x3c19fe[_0x6b1b('0x72')][_0x6b1b('0xa5')];})[_0x6b1b('0x19')](function(){return db[_0x6b1b('0x69')]['find']({'where':{'id':_0x3c19fe[_0x6b1b('0x6d')]['id']},'include':[{'model':db[_0x6b1b('0xab')],'as':_0x6b1b('0xac'),'include':[{'model':db[_0x6b1b('0x9d')],'as':_0x6b1b('0xad'),'where':_0x3e9bf3,'limit':0x1,'order':[[_0x6b1b('0xa3'),_0x6b1b('0xae')]]}]},{'model':db[_0x6b1b('0xaf')],'as':_0x6b1b('0xb0')},{'model':db[_0x6b1b('0x41')],'as':'Interval','include':[{'model':db[_0x6b1b('0x41')],'as':_0x6b1b('0x42'),'attributes':['id',_0x6b1b('0x39')],'raw':!![]}]}]});})[_0x6b1b('0x19')](function(_0x4e13e5){if(!_0x4e13e5)throw new APINotFoundError(util['format'](_0x6b1b('0xb1'),_0x3c19fe[_0x6b1b('0x6d')]['id']));if(!_0x4e13e5[_0x6b1b('0x41')]||!_0x4e13e5[_0x6b1b('0x41')]['Intervals'])return[_0x4e13e5,!![]];return[_0x4e13e5,checkWebsiteIntervals(_0x4e13e5)];})[_0x6b1b('0xb2')](function(_0x562692,_0x2a2440){if(!_0x2a2440)throw new APIOutOfIntervalError();if(!_0x562692['List'])return;_0x2c418b[_0x6b1b('0xb3')]=_0x562692;_0x2c418b[_0x6b1b('0xb4')]=_0x562692[_0x6b1b('0xac')];_0x2c418b[_0x6b1b('0xb5')]=_[_0x6b1b('0xb6')](_0x562692[_0x6b1b('0xb0')],[_0x6b1b('0xb7')],[_0x6b1b('0xb8')]);if(_0x2c418b['account']['Applications']){delete _0x2c418b[_0x6b1b('0xb3')]['Applications'];}if(_0x2c418b['account'][_0x6b1b('0xac')]&&_0x2c418b['account'][_0x6b1b('0xac')][_0x6b1b('0xad')][_0x6b1b('0x62')]){return _0x2c418b[_0x6b1b('0xb3')][_0x6b1b('0xac')]['Contacts'][0x0];}var _0x571826=_[_0x6b1b('0x12')](_0x3c19fe[_0x6b1b('0x72')],{'firstName':_0x3c19fe[_0x6b1b('0x72')][_0x6b1b('0xa5')],'ListId':_0x562692[_0x6b1b('0xb9')]});_0x571826[_0x3c19fe['body'][_0x6b1b('0xa8')]]=_0x3c19fe[_0x6b1b('0x72')][_0x6b1b('0xa5')];return db['CmContact'][_0x6b1b('0x71')](_0x571826,{'fields':_0x170710,'raw':!![]});})[_0x6b1b('0x19')](function(_0x301a9e){_0x2c418b[_0x6b1b('0xba')]=_0x301a9e;var _0x4fbaf3=createInteractionObject(_0x3c19fe[_0x6b1b('0x6d')]['id'],_0x3c19fe[_0x6b1b('0x72')],_0x3c19fe['headers'],_0x301a9e);var _0x27e237={'ChatWebsiteId':_0x3c19fe[_0x6b1b('0x6d')]['id'],'closed':![]};if(_0x3c19fe['body'][_0x6b1b('0xbb')]){_0x27e237[_0x6b1b('0xbb')]=_0x3c19fe['body'][_0x6b1b('0xbb')];return db[_0x6b1b('0xbc')][_0x6b1b('0x75')]({'where':_0x27e237})[_0x6b1b('0x19')](function(_0x1a545d){if(_0x1a545d){_0x33bb90=!![];return _0x1a545d;}_0x4fbaf3[_0x6b1b('0xbb')]=_0x3c19fe['body'][_0x6b1b('0xbb')];_0x4fbaf3[_0x6b1b('0xbd')]=_0x3c19fe[_0x6b1b('0x72')][_0x6b1b('0xbd')];return db['ChatInteraction'][_0x6b1b('0x71')](_0x4fbaf3);});}_0x27e237['ContactId']=_0x301a9e['id'];if(_0x3c19fe[_0x6b1b('0x72')][_0x6b1b('0xbe')]&&_0x3c19fe['body'][_0x6b1b('0xbe')]['id']){_0x27e237['id']=_0x3c19fe['body'][_0x6b1b('0xbe')]['id'];return db[_0x6b1b('0xbc')][_0x6b1b('0x75')]({'where':_0x27e237})['then'](function(_0x28224b){if(_0x28224b){_0x33bb90=!![];return _0x28224b;}return db[_0x6b1b('0xbc')][_0x6b1b('0x71')](_0x4fbaf3);});}return db[_0x6b1b('0xbc')]['create'](_0x4fbaf3);})[_0x6b1b('0x19')](function(_0x29f472){if(!_0x33bb90)return _0x29f472;var _0x16b250={'from':(_0x2c418b[_0x6b1b('0xba')][_0x6b1b('0xbf')]||'')+'\x20'+(_0x2c418b[_0x6b1b('0xba')][_0x6b1b('0x4c')]||'')};if(_0x3c19fe['body'][_0x6b1b('0xbb')]&&_0x3c19fe['body']['messageId']&&_0x3c19fe[_0x6b1b('0x72')][_0x6b1b('0xbb')]!=_0x3c19fe[_0x6b1b('0x72')]['messageId']){_0x16b250['threadId']=_0x3c19fe['body'][_0x6b1b('0xc0')];}return _0x29f472[_0x6b1b('0x2d')](_0x16b250);})['then'](function(_0x25006e){_0x2c418b[_0x6b1b('0xbe')]=_0x25006e[_0x6b1b('0x2f')]({'plain':!![]});_0x2c418b[_0x6b1b('0xbe')][_0x6b1b('0xc1')]=!_0x33bb90;if(_0x2c418b[_0x6b1b('0xbe')][_0x6b1b('0xc1')]){if(_0x2c418b[_0x6b1b('0xb3')][_0x6b1b('0xc2')]){_0x2c418b[_0x6b1b('0xb5')][_0x6b1b('0xc3')]({'id':0x0,'priority':_0x2c418b[_0x6b1b('0xb5')]['length']+0x1,'app':_0x6b1b('0xc4'),'appdata':_0x6b1b('0xc5'),'interval':_0x6b1b('0xc6')});}}return db['ChatMessage']['create']({'body':_0x3c19fe[_0x6b1b('0x72')]['body'],'ChatWebsiteId':_0x3c19fe['params']['id'],'ChatInteractionId':_0x25006e['id'],'direction':'in','ContactId':_0x2c418b['contact']['id'],'AttachmentId':_0x3c19fe[_0x6b1b('0x72')][_0x6b1b('0xc7')]});})[_0x6b1b('0x19')](function(_0x39b546){_0x2c418b[_0x6b1b('0x21')]=_0x39b546;if(!_0x2c418b['interaction']['UserId']){return;}return db['User'][_0x6b1b('0x75')]({'attributes':['id',_0x6b1b('0x32')],'where':{'id':_0x2c418b[_0x6b1b('0xbe')][_0x6b1b('0xc8')]}});})[_0x6b1b('0x19')](function(_0x1305e1){if(_0x1305e1){_0x2c418b['applications'][_0x6b1b('0xc9')]({'id':0x0,'priority':0x0,'app':_0x6b1b('0xca'),'appdata':_0x1305e1[_0x6b1b('0x32')]+','+(_0x2c418b['account'][_0x6b1b('0xcb')]||0xa),'interval':_0x6b1b('0xc6')});_0x2c418b[_0x6b1b('0xcc')]=!![];}if(!_0x2c418b[_0x6b1b('0xbe')][_0x6b1b('0xcd')]){return;}return db[_0x6b1b('0xce')][_0x6b1b('0x75')]({'attributes':['id','name'],'where':{'id':_0x2c418b['interaction'][_0x6b1b('0xcd')]}});})[_0x6b1b('0x19')](function(_0x567ae4){if(_0x567ae4){_0x2c418b[_0x6b1b('0xb5')][_0x6b1b('0xc9')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x567ae4[_0x6b1b('0x32')]+','+(_0x2c418b[_0x6b1b('0xb3')][_0x6b1b('0xcf')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x6b1b('0xd0'),_0x6b1b('0xd1'),_0x2c418b);})[_0x6b1b('0x19')](function(_0x50988d){respondWithRpcPromise(_0x6b1b('0xd2'),_0x6b1b('0xd2'),{'event':_0x6b1b('0x9c'),'message':_0x50988d},client9002);return _0x50988d;})[_0x6b1b('0x19')](respondWithResult(_0x518087,null))[_0x6b1b('0x23')](APIHandleError(_0x518087));};exports[_0x6b1b('0xd3')]=function(_0x55a58f,_0x3e9f1b){var _0x17ab68,_0x2e09e7,_0x450434;var _0xe50eea=[];var _0xa9a8e9={};var _0x4d7c2f=_0x55a58f[_0x6b1b('0xd4')]||[];var _0x347586=[];var _0x29ba28;return db[_0x6b1b('0x9d')][_0x6b1b('0x76')]()[_0x6b1b('0x19')](function(_0x41b975){if(!_0x41b975){throw new db[(_0x6b1b('0x9e'))][(_0x6b1b('0x9f'))](_0x6b1b('0xa0'));}_0xe50eea=_[_0x6b1b('0xa1')](_['keys'](_0x41b975),[_0x6b1b('0xa2'),'updatedAt',_0x6b1b('0xa4'),_0x6b1b('0xb9')]);if(_0x55a58f[_0x6b1b('0x72')]['id']){delete _0x55a58f[_0x6b1b('0x72')]['id'];}if(_['isNil'](_0x55a58f['body'][_0x6b1b('0xa5')])){throw _0x3e9f1b[_0x6b1b('0x25')](0x1f4)['send'](new db[(_0x6b1b('0x9e'))]['ValidationError']('from\x20is\x20mandatory'));}if(_[_0x6b1b('0x91')](_0x55a58f[_0x6b1b('0x72')][_0x6b1b('0x72')])||_0x55a58f['body'][_0x6b1b('0x72')]===''){throw _0x3e9f1b[_0x6b1b('0x25')](0x1f4)['send'](new db[(_0x6b1b('0x9e'))]['ValidationError'](_0x6b1b('0xa7')));}if(_[_0x6b1b('0x91')](_0x55a58f['body'][_0x6b1b('0xd5')])){throw _0x3e9f1b[_0x6b1b('0x25')](0x1f4)['send'](new db['Sequelize']['ValidationError']('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xe50eea));}if(!_[_0x6b1b('0xa9')](_0xe50eea,_0x55a58f['body'][_0x6b1b('0xd5')])){throw _0x3e9f1b[_0x6b1b('0x25')](0x1f4)[_0x6b1b('0x33')](new db['Sequelize'][(_0x6b1b('0x9f'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xe50eea));}_0xa9a8e9[_0x55a58f[_0x6b1b('0x72')][_0x6b1b('0xd5')]]=_0x55a58f['body'][_0x6b1b('0xa5')];})['then'](function(){return db['ChatWebsite'][_0x6b1b('0x75')]({'where':{'id':_0x55a58f['params']['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db[_0x6b1b('0xd6')],'as':_0x6b1b('0xd6')}]});})['then'](handleEntityNotFound(_0x3e9f1b,null))[_0x6b1b('0x19')](function(_0x2761fe){if(_0x2761fe&&_0x2761fe[_0x6b1b('0xac')]){_0x2e09e7=_0x2761fe;var _0xa0b9a6=_['defaults'](_0x55a58f['body'],{'firstName':_0x55a58f[_0x6b1b('0x72')][_0x6b1b('0xa5')],'phone':_0x55a58f[_0x6b1b('0x72')][_0x6b1b('0xa5')],'ListId':_0x2761fe['ListId']});_0xa0b9a6[_0x55a58f[_0x6b1b('0x72')][_0x6b1b('0xd5')]]=_0x55a58f[_0x6b1b('0x72')][_0x6b1b('0xa5')];return db[_0x6b1b('0x9d')][_0x6b1b('0xd7')]({'where':_0xa9a8e9,'defaults':_0xa0b9a6});}})['spread'](function(_0x5cb777){if(_0x5cb777){_0x450434=_0x5cb777;var _0xcf4b3=fs['readFileSync'](path[_0x6b1b('0x8b')](config[_0x6b1b('0x8c')],_0x6b1b('0xd8')),_0x6b1b('0xd9'));var _0x1c62db=ejs[_0x6b1b('0xda')](_0xcf4b3,{'body':_[_0x6b1b('0xdb')](_0x55a58f['body'][_0x6b1b('0x72')]),'bodyTitle':_0x2e09e7[_0x6b1b('0xdc')]});return db[_0x6b1b('0xdd')][_0x6b1b('0x71')]({'body':_0x1c62db,'plainBody':htmlToText['fromString'](_0x1c62db),'ContactId':_0x5cb777['id'],'ChatWebsiteId':_0x2e09e7['id']});}})[_0x6b1b('0x19')](function(_0x8a51cc){_0x29ba28=_0x8a51cc;if(_0x4d7c2f['length']){var _0x51a5aa=_0x4d7c2f[_0x6b1b('0x40')](function(_0x1999cc){return{'name':_0x1999cc['originalname'],'basename':_0x1999cc['filename'],'type':_0x1999cc[_0x6b1b('0xde')],'ChatOfflineMessageId':_0x8a51cc['id']};});_0x347586=_0x51a5aa[_0x6b1b('0x40')](_0x2ac12c=>{var _0x3d0c90={'filename':_0x2ac12c['name'],'path':path[_0x6b1b('0x8b')](config['root'],_0x6b1b('0xdf'),_0x6b1b('0xd4'),_0x6b1b('0xe0'),_0x6b1b('0xe1'),_0x2ac12c[_0x6b1b('0xe2')])};return _0x3d0c90;});if(!_0x2e09e7[_0x6b1b('0xe3')]){return db['sequelize']['transaction'](function(_0x25acb2){return db['Attachment']['bulkCreate'](_0x51a5aa,{'transaction':_0x25acb2});});}}})[_0x6b1b('0x19')](function(){if(_0x29ba28){_0x17ab68=_0x29ba28;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x6b1b('0xe4')],'as':_0x6b1b('0xe5'),'raw':!![],'include':[{'model':db[_0x6b1b('0xe6')],'as':_0x6b1b('0xe6'),'raw':!![]}]}]});}})[_0x6b1b('0x19')](function(_0x27dc8d){if(_0x27dc8d&&_0x27dc8d[_0x6b1b('0xe5')]&&_0x2e09e7['forwardOffline']&&_0x2e09e7[_0x6b1b('0xe7')]){var _0x48822c=_0x27dc8d[_0x6b1b('0xe8')]();return respondWithRpcPromise('SendMail',_0x6b1b('0xe9'),{'account':_0x48822c,'message':{'from':util[_0x6b1b('0x37')](_0x6b1b('0xea'),_0x27dc8d[_0x6b1b('0x32')],_0x27dc8d[_0x6b1b('0xeb')]||_0x27dc8d[_0x6b1b('0xe5')]['user']),'to':_0x2e09e7[_0x6b1b('0xe7')],'subject':_0x2e09e7['offlineMessageSubject'],'html':_0x17ab68['body'],'attachments':_0x347586}},client9003)['then'](function(){return _0x17ab68;})['catch'](function(_0x15480a){logger[_0x6b1b('0x1f')](_0x15480a);});}})['then'](function(){if(_0x2e09e7&&_0x2e09e7[_0x6b1b('0xe3')]&&_0x2e09e7[_0x6b1b('0xec')]){var _0x3c90d1=[];if(_0x4d7c2f[_0x6b1b('0x62')]){_0x3c90d1=_0x4d7c2f['map'](function(_0x571663){return{'name':_0x571663[_0x6b1b('0xed')],'basename':_0x571663[_0x6b1b('0x85')],'type':_0x571663[_0x6b1b('0xde')],'ChatOfflineMessageId':_0x29ba28['id']};});}var _0x31769c;if(!_[_0x6b1b('0x91')](_0x2e09e7[_0x6b1b('0xee')])){var _0x3521df=_[_0x6b1b('0x40')](_0x55a58f[_0x6b1b('0x72')],function(_0x45a3fb){return _0x45a3fb;});var _0xbdda13=_[_0x6b1b('0xef')](_0x3521df)[0x0];var _0x2b80ea=_[_0x6b1b('0xf0')](_0xbdda13,function(_0x2c7641){return _0x2c7641;});_0x31769c=_0x2b80ea[0x1][_0x2e09e7['subjectOffline']];}var _0x46a19a={'from':_0x450434[_0x6b1b('0xeb')],'firstName':_0x450434[_0x6b1b('0xbf')],'lastName':_0x450434[_0x6b1b('0x4c')],'mapKey':_0x6b1b('0xeb'),'message':{'from':_0x450434[_0x6b1b('0xeb')],'to':_0x2e09e7[_0x6b1b('0xd6')][_0x6b1b('0xeb')],'cc':'','subject':_[_0x6b1b('0x91')](_0x31769c)?_0x2e09e7[_0x6b1b('0xf1')]:_0x31769c,'messageId':'','sentAt':new Date(),'attach':_0x3c90d1[_0x6b1b('0x62')],'attachments':_0x3c90d1,'originChannel':_0x6b1b('0xf2'),'ChatWebsiteId':_0x2e09e7['id'],'ChatOfflineMessageId':_0x17ab68['id'],'originTo':_0x2e09e7['MailAccount'][_0x6b1b('0xeb')]},'body':_0x17ab68[_0x6b1b('0x72')]};var _0x383c79={'account':{'id':_0x2e09e7[_0x6b1b('0xec')]},'body':_0x46a19a,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0x6b1b('0xf3'),_0x6b1b('0xf4'),_0x383c79,client9001)[_0x6b1b('0x19')](function(){return _0x17ab68;})[_0x6b1b('0x23')](function(_0x404f80){logger[_0x6b1b('0x1f')](_0x404f80);});}return;})['then'](function(){if(_0x17ab68){return _0x17ab68;}})[_0x6b1b('0x19')](respondWithResult(_0x3e9f1b,null))[_0x6b1b('0x23')](function(){for(var _0x547317 of _0x4d7c2f){var _0x50b970=path[_0x6b1b('0x8b')](config[_0x6b1b('0x8c')],_0x6b1b('0xdf'),_0x6b1b('0xd4'),_0x6b1b('0xe0'),_0x6b1b('0xe1'),_0x547317['filename']);fs_extra['remove'](_0x50b970)[_0x6b1b('0x23')](function(_0x32d319){logger[_0x6b1b('0x1f')](_0x6b1b('0xf5'),_0x50b970,_0x32d319);});}});};exports[_0x6b1b('0xf6')]=function(_0x29d6c4,_0x59bf56){return db['ChatInteraction'][_0x6b1b('0x75')]({'where':{'id':_0x29d6c4[_0x6b1b('0x6d')]['id']}})['then'](handleEntityNotFound(_0x59bf56,null))[_0x6b1b('0x19')](function(_0x1839e7){if(_0x1839e7){return _0x1839e7['addInteraction'](_0x29d6c4[_0x6b1b('0x72')][_0x6b1b('0x81')],_[_0x6b1b('0xf7')](_0x29d6c4[_0x6b1b('0x72')],['ids','id'])||{});}})[_0x6b1b('0x19')](respondWithResult(_0x59bf56,null))[_0x6b1b('0x23')](handleError(_0x59bf56,null));};exports[_0x6b1b('0xf8')]=function(_0xfa4faf,_0x51b5c6){var _0x70c0e3={'raw':![],'where':{}};var _0x49c27d={};var _0x12a399={'count':0x0,'rows':[]};return db[_0x6b1b('0x69')][_0x6b1b('0x7e')]({'where':{'id':_0xfa4faf[_0x6b1b('0x6d')]['id']}})['then'](handleEntityNotFound(_0x51b5c6,null))[_0x6b1b('0x19')](function(_0x4afd36){if(_0x4afd36){_0x49c27d[_0x6b1b('0x54')]=_[_0x6b1b('0x5d')](db[_0x6b1b('0xbc')][_0x6b1b('0x59')]);_0x49c27d[_0x6b1b('0x5c')]=_[_0x6b1b('0x5d')](_0xfa4faf[_0x6b1b('0x5c')]);_0x49c27d[_0x6b1b('0x5e')]=_[_0x6b1b('0x5f')](_0x49c27d[_0x6b1b('0x54')],_0x49c27d[_0x6b1b('0x5c')]);_0x70c0e3[_0x6b1b('0x61')]=_[_0x6b1b('0x5f')](_0x49c27d[_0x6b1b('0x54')],qs['fields'](_0xfa4faf[_0x6b1b('0x5c')][_0x6b1b('0x60')]));_0x70c0e3[_0x6b1b('0x61')]=_0x70c0e3['attributes'][_0x6b1b('0x62')]?_0x70c0e3[_0x6b1b('0x61')]:_0x49c27d[_0x6b1b('0x54')];if(!_0xfa4faf[_0x6b1b('0x5c')][_0x6b1b('0x63')](_0x6b1b('0x7a'))){_0x70c0e3['limit']=qs[_0x6b1b('0x29')](_0xfa4faf['query'][_0x6b1b('0x29')]);_0x70c0e3['offset']=qs['offset'](_0xfa4faf[_0x6b1b('0x5c')][_0x6b1b('0x27')]);}_0x70c0e3[_0x6b1b('0x64')]=qs[_0x6b1b('0x65')](_0xfa4faf[_0x6b1b('0x5c')][_0x6b1b('0x65')]);_0x70c0e3['where']=qs[_0x6b1b('0x5e')](_['pick'](_0xfa4faf[_0x6b1b('0x5c')],_0x49c27d['filters']));_0x70c0e3[_0x6b1b('0x66')]['ChatWebsiteId']=_0x4afd36['id'];if(_0xfa4faf[_0x6b1b('0x5c')][_0x6b1b('0x68')]){_0x70c0e3['where']=_['merge'](_0x70c0e3[_0x6b1b('0x66')],{'$or':_['map'](_0x70c0e3['attributes'],function(_0x12a9f5){var _0x3b1b64={};_0x3b1b64[_0x12a9f5]={'$like':'%'+_0xfa4faf[_0x6b1b('0x5c')][_0x6b1b('0x68')]+'%'};return _0x3b1b64;})});}_0x70c0e3=_['merge']({},_0x70c0e3,_0xfa4faf[_0x6b1b('0x70')]);return db[_0x6b1b('0xbc')][_0x6b1b('0x2a')]({'where':_0x70c0e3[_0x6b1b('0x66')]})[_0x6b1b('0x19')](function(_0xe2697d){_0x12a399[_0x6b1b('0x2a')]=_0xe2697d;if(_0xfa4faf['query'][_0x6b1b('0x6a')]){_0x70c0e3['include']=[{'model':db[_0x6b1b('0x9d')],'as':'Contact','required':![]},{'model':db[_0x6b1b('0xf9')],'as':_0x6b1b('0xfa'),'attributes':[_0x6b1b('0x32'),'fullname','internal'],'required':![]},{'model':db[_0x6b1b('0xfb')],'as':_0x6b1b('0xfc'),'attributes':['id',_0x6b1b('0x32'),_0x6b1b('0xfd')],'where':_0xfa4faf['query'][_0x6b1b('0xfe')]?{'id':_0xfa4faf[_0x6b1b('0x5c')][_0x6b1b('0xfe')]}:undefined,'required':_0xfa4faf[_0x6b1b('0x5c')][_0x6b1b('0xfe')]?!![]:![]}];}return db[_0x6b1b('0xbc')][_0x6b1b('0x6b')](_0x70c0e3);})[_0x6b1b('0x19')](function(_0x585555){_0x12a399[_0x6b1b('0x7c')]=_0x585555;return _0x12a399;});}})['then'](respondWithFilteredResult(_0x51b5c6,_0x70c0e3))[_0x6b1b('0x23')](handleError(_0x51b5c6,null));};exports['getSnippet']=function(_0x189fae,_0x5b2c7d){var _0x30a760=0x0;var _0x43b0ce=0x0;var _0x154a4c=![];var _0x331d0b;var _0x360db4;return db[_0x6b1b('0x69')][_0x6b1b('0x75')]({'where':{'id':_0x189fae[_0x6b1b('0x6d')]['id']},'include':[{'model':db[_0x6b1b('0x41')],'as':_0x6b1b('0x41'),'include':[{'model':db[_0x6b1b('0x41')],'as':_0x6b1b('0x42'),'attributes':['id',_0x6b1b('0x39')]}]}]})[_0x6b1b('0x19')](handleEntityNotFound(_0x5b2c7d,null))[_0x6b1b('0x19')](function(_0x26c84a){if(_0x26c84a){_0x331d0b=_0x26c84a;return _0x26c84a['getProactiveActions']({'raw':!![]});}})[_0x6b1b('0x19')](function(_0x103aa2){if(_0x331d0b){if(_0x103aa2){_0x360db4=_0x103aa2;}}return require(_0x6b1b('0x8e'))[_0x6b1b('0x8f')]();})[_0x6b1b('0x19')](function(_0x11a2d7){if(_0x11a2d7){_0x43b0ce=_0x11a2d7[_0x6b1b('0xff')];_0x154a4c=_0x11a2d7[_0x6b1b('0x90')];}})['then'](function(){return db[_0x6b1b('0xbc')]['count']({'where':{'closed':![]}});})[_0x6b1b('0x19')](function(_0x1286f6){_0x30a760=_0x1286f6;if(_0x43b0ce&&_0x1286f6>_0x43b0ce){return db[_0x6b1b('0x100')][_0x6b1b('0x7e')]({'where':{'id':0x1}})[_0x6b1b('0x19')](function(_0x53991a){if(_0x53991a){_0x53991a['increment']('chatLicenseExceeded');}});}})['then'](function(){if(!_0x331d0b[_0x6b1b('0x41')]||!_0x331d0b[_0x6b1b('0x41')][_0x6b1b('0x42')])return!![];return checkWebsiteIntervals(_0x331d0b);})[_0x6b1b('0x19')](function(_0x6e5b9a){var _0x5c0584=fs[_0x6b1b('0x101')](path[_0x6b1b('0x8b')](config[_0x6b1b('0x8c')],_0x6b1b('0x102')),_0x6b1b('0xd9'));var _0x442193=new url[(_0x6b1b('0x103'))](_0x331d0b['address'])['origin'];var _0x57dc59=_0x6b1b('0x104');var _0x5708c1=![];var _0x5946d0={'chatVersion':_0x57dc59,'chatWebsiteAddressOrigin':_0x442193,'remote':_0x331d0b[_0x6b1b('0x105')],'query':querystring['stringify'](_['merge'](_0x331d0b[_0x6b1b('0x2f')]({'plain':!![]}),{'customerIp':_0x189fae[_0x6b1b('0x106')][_0x6b1b('0x4b')]||_0x189fae[_0x6b1b('0x106')][_0x6b1b('0x107')]||_0x189fae[_0x6b1b('0x108')][_0x6b1b('0x109')]||_0x189fae['ip'],'referer':_0x189fae['headers'][_0x6b1b('0x4e')],'openedInteractions':_0x30a760,'maxInteractions':_0x43b0ce,'virtual':_0x154a4c[_0x6b1b('0xff')],'online':_0x6e5b9a,'custom':_0x154a4c}))[_0x6b1b('0x10a')](/'/g,'\x5c\x27')};_0x5b2c7d[_0x6b1b('0x33')](ejs[_0x6b1b('0xda')](Mustache[_0x6b1b('0xda')](_0x5c0584,_0x5946d0),{'proactiveActions':_0x360db4,'alignment':_0x331d0b[_0x6b1b('0x10b')],'verticalAlignment':_0x331d0b[_0x6b1b('0x10c')],'div_color':_0x331d0b[_0x6b1b('0xfd')],'labelText':_0x331d0b[_0x6b1b('0x10d')],'text_color':_0x331d0b['textColor'],'text_button_color':_0x331d0b['textButtonColor'],'button_color':_0x331d0b['color_button'],'background_color':_0x331d0b[_0x6b1b('0x10e')],'hideWhenOffline':_0x331d0b['hideWhenOffline'],'intervalId':_0x331d0b['IntervalId'],'isDevelopment':_0x5708c1,'chatVersion':_0x57dc59}));})[_0x6b1b('0x23')](handleError(_0x5b2c7d,null));};exports[_0x6b1b('0x10f')]=function(_0x141457,_0x549e50){var _0x1b0f3a=_0x141457['params']['id'];var _0xb0dbf1=_0x141457[_0x6b1b('0x72')];var _0x261aee=0xc8;var _0x50fd12=null;return db[_0x6b1b('0x110')]['transaction']({'isolationLevel':db['sequelize'][_0x6b1b('0x111')][_0x6b1b('0x112')][_0x6b1b('0x113')]},function(_0x3e8034){return db[_0x6b1b('0x69')]['findOne']({'where':{'id':_0x1b0f3a},'transaction':_0x3e8034})['then'](function(_0x1183ca){if(_0x1183ca){return db['ChatApplication'][_0x6b1b('0x2e')]({'where':{'ChatWebsiteId':_0x1b0f3a},'transaction':_0x3e8034})[_0x6b1b('0x19')](function(){var _0x51e6ef=_[_0x6b1b('0x40')](_0xb0dbf1,function(_0x6b706c){_0x6b706c[_0x6b1b('0x7b')]=_0x1b0f3a;return _0x6b706c;});return db[_0x6b1b('0xaf')][_0x6b1b('0x114')](_0x51e6ef,{'transaction':_0x3e8034});});}else{_0x261aee=0x194;_0x50fd12=[];}});})[_0x6b1b('0x19')](function(){if(_0x261aee!==0x194){return db[_0x6b1b('0xaf')][_0x6b1b('0x115')]({'where':{'ChatWebsiteId':_0x1b0f3a},'order':_0x6b1b('0xb7')})[_0x6b1b('0x19')](function(_0x3143f2){_0x50fd12=_0x3143f2;});}})[_0x6b1b('0x23')](function(_0x3ff800){_0x261aee=0x1f4;logger[_0x6b1b('0x1f')](_0x3ff800[_0x6b1b('0x116')]);if(_0x3ff800['name']){delete _0x3ff800[_0x6b1b('0x32')];}_0x50fd12=_0x3ff800;})[_0x6b1b('0x117')](function(){if(_0x50fd12===null){_0x549e50['sendStatus'](_0x261aee);}else{if(_0x261aee===0x1f4){_0x549e50[_0x6b1b('0x25')](_0x261aee)['send'](_0x50fd12);}else{_0x549e50[_0x6b1b('0x25')](_0x261aee)[_0x6b1b('0x26')](_0x50fd12);}}});};exports['getApplications']=function(_0x3b5853,_0x4d0556){var _0x376e18={};var _0x453f93={};var _0x5643e1;var _0x1d1d59;return db[_0x6b1b('0x69')][_0x6b1b('0x7e')]({'where':{'id':_0x3b5853['params']['id']}})['then'](handleEntityNotFound(_0x4d0556,null))[_0x6b1b('0x19')](function(_0x312b54){if(_0x312b54){_0x5643e1=_0x312b54;_0x453f93[_0x6b1b('0x54')]=_[_0x6b1b('0x5d')](db[_0x6b1b('0xaf')][_0x6b1b('0x59')]);_0x453f93['query']=_[_0x6b1b('0x5d')](_0x3b5853[_0x6b1b('0x5c')]);_0x453f93['filters']=_[_0x6b1b('0x5f')](_0x453f93[_0x6b1b('0x54')],_0x453f93[_0x6b1b('0x5c')]);_0x376e18['attributes']=_[_0x6b1b('0x5f')](_0x453f93[_0x6b1b('0x54')],qs[_0x6b1b('0x60')](_0x3b5853[_0x6b1b('0x5c')][_0x6b1b('0x60')]));_0x376e18[_0x6b1b('0x61')]=_0x376e18['attributes']['length']?_0x376e18[_0x6b1b('0x61')]:_0x453f93[_0x6b1b('0x54')];_0x376e18[_0x6b1b('0x64')]=qs[_0x6b1b('0x65')](_0x3b5853[_0x6b1b('0x5c')][_0x6b1b('0x65')]);_0x376e18[_0x6b1b('0x66')]=qs[_0x6b1b('0x5e')](_[_0x6b1b('0x67')](_0x3b5853['query'],_0x453f93['filters']));if(_0x3b5853[_0x6b1b('0x5c')]['filter']){_0x376e18[_0x6b1b('0x66')]=_[_0x6b1b('0x6f')](_0x376e18[_0x6b1b('0x66')],{'$or':_[_0x6b1b('0x40')](_0x376e18[_0x6b1b('0x61')],function(_0x5377b5){var _0x54e7be={};_0x54e7be[_0x5377b5]={'$like':'%'+_0x3b5853[_0x6b1b('0x5c')]['filter']+'%'};return _0x54e7be;})});}_0x376e18=_[_0x6b1b('0x6f')]({},_0x376e18,_0x3b5853[_0x6b1b('0x70')]);return _0x5643e1['getApplications'](_0x376e18);}})[_0x6b1b('0x19')](function(_0x2119b8){if(_0x2119b8){_0x1d1d59=_0x2119b8[_0x6b1b('0x62')];if(!_0x3b5853[_0x6b1b('0x5c')]['hasOwnProperty'](_0x6b1b('0x7a'))){_0x376e18[_0x6b1b('0x29')]=qs['limit'](_0x3b5853[_0x6b1b('0x5c')][_0x6b1b('0x29')]);_0x376e18[_0x6b1b('0x27')]=qs[_0x6b1b('0x27')](_0x3b5853[_0x6b1b('0x5c')][_0x6b1b('0x27')]);}return _0x5643e1['getApplications'](_0x376e18);}})[_0x6b1b('0x19')](function(_0x2185b0){if(_0x2185b0){return _0x2185b0?{'count':_0x1d1d59,'rows':_0x2185b0}:null;}})[_0x6b1b('0x19')](respondWithResult(_0x4d0556,null))['catch'](handleError(_0x4d0556,null));};exports[_0x6b1b('0x118')]=function(_0x30471b,_0x459d0a){return db['chatProactiveAction']['find']({'where':{'id':_0x30471b[_0x6b1b('0x6d')]['id']}})[_0x6b1b('0x19')](handleEntityNotFound(_0x459d0a,null))[_0x6b1b('0x19')](function(_0x549261){if(_0x549261){return _0x549261['addProactiveActions'](_0x30471b[_0x6b1b('0x72')][_0x6b1b('0x81')],_[_0x6b1b('0xf7')](_0x30471b[_0x6b1b('0x72')],[_0x6b1b('0x81'),'id'])||{});}})[_0x6b1b('0x19')](respondWithResult(_0x459d0a,null))[_0x6b1b('0x23')](handleError(_0x459d0a,null));};exports['getProactiveActions']=function(_0x57cc0a,_0xd182d8){var _0x3047e5={};var _0x3349b7={};var _0x5c9497;var _0x36e8a5;return db[_0x6b1b('0x69')][_0x6b1b('0x7e')]({'where':{'id':_0x57cc0a['params']['id']}})[_0x6b1b('0x19')](handleEntityNotFound(_0xd182d8,null))[_0x6b1b('0x19')](function(_0x4b4b72){if(_0x4b4b72){_0x5c9497=_0x4b4b72;_0x3349b7[_0x6b1b('0x54')]=_[_0x6b1b('0x5d')](db[_0x6b1b('0x119')][_0x6b1b('0x59')]);_0x3349b7[_0x6b1b('0x5c')]=_[_0x6b1b('0x5d')](_0x57cc0a[_0x6b1b('0x5c')]);_0x3349b7[_0x6b1b('0x5e')]=_['intersection'](_0x3349b7[_0x6b1b('0x54')],_0x3349b7['query']);_0x3047e5[_0x6b1b('0x61')]=_[_0x6b1b('0x5f')](_0x3349b7['model'],qs['fields'](_0x57cc0a[_0x6b1b('0x5c')][_0x6b1b('0x60')]));_0x3047e5[_0x6b1b('0x61')]=_0x3047e5['attributes']['length']?_0x3047e5[_0x6b1b('0x61')]:_0x3349b7[_0x6b1b('0x54')];_0x3047e5[_0x6b1b('0x64')]=qs[_0x6b1b('0x65')](_0x57cc0a[_0x6b1b('0x5c')][_0x6b1b('0x65')]);_0x3047e5[_0x6b1b('0x66')]=qs[_0x6b1b('0x5e')](_[_0x6b1b('0x67')](_0x57cc0a[_0x6b1b('0x5c')],_0x3349b7[_0x6b1b('0x5e')]));if(_0x57cc0a[_0x6b1b('0x5c')][_0x6b1b('0x68')]){_0x3047e5[_0x6b1b('0x66')]=_[_0x6b1b('0x6f')](_0x3047e5['where'],{'$or':_['map'](_0x3047e5[_0x6b1b('0x61')],function(_0x26d45f){var _0x27381b={};_0x27381b[_0x26d45f]={'$like':'%'+_0x57cc0a['query'][_0x6b1b('0x68')]+'%'};return _0x27381b;})});}_0x3047e5=_['merge']({},_0x3047e5,_0x57cc0a[_0x6b1b('0x70')]);return _0x5c9497['getProactiveActions'](_0x3047e5);}})[_0x6b1b('0x19')](function(_0x516894){if(_0x516894){_0x36e8a5=_0x516894[_0x6b1b('0x62')];if(!_0x57cc0a[_0x6b1b('0x5c')][_0x6b1b('0x63')]('nolimit')){_0x3047e5[_0x6b1b('0x29')]=qs['limit'](_0x57cc0a['query'][_0x6b1b('0x29')]);_0x3047e5['offset']=qs['offset'](_0x57cc0a[_0x6b1b('0x5c')][_0x6b1b('0x27')]);}return _0x5c9497['getProactiveActions'](_0x3047e5);}})[_0x6b1b('0x19')](function(_0x187b55){if(_0x187b55){return _0x187b55?{'count':_0x36e8a5,'rows':_0x187b55}:null;}})[_0x6b1b('0x19')](respondWithResult(_0xd182d8,null))['catch'](handleError(_0xd182d8,null));};exports[_0x6b1b('0x11a')]=function(_0x4adad3,_0x125a3f){var _0x2ccf04=_0x4adad3[_0x6b1b('0x5c')][_0x6b1b('0x11b')]===_0x6b1b('0x11c')?_0x6b1b('0x11d'):_0x6b1b('0x11e');return db['ChatWebsite'][_0x6b1b('0x75')]({'attributes':['id',_0x2ccf04],'where':{'id':_0x4adad3[_0x6b1b('0x6d')]['id']}})['then'](handleEntityNotFound(_0x125a3f,null))['then'](function(_0x2b65d2){if(_0x2b65d2){var _0x489839=_0x2b65d2[_0x2ccf04];var _0x1f4ead=_0x489839&&_0x489839[_0x6b1b('0x11f')]?_0x489839[_0x6b1b('0x11f')]:[];_0x125a3f['send']({'fromKey':_[_0x6b1b('0x91')](_0x489839[_0x6b1b('0x120')])?undefined:_0x489839['fromKey'],'count':_0x1f4ead[_0x6b1b('0x62')],'rows':_0x1f4ead});}})[_0x6b1b('0x23')](handleError(_0x125a3f,null));};exports[_0x6b1b('0x121')]=function(_0x2cce36,_0x13e2a9){var _0x42547c={'raw':![],'where':{}};var _0xa8e337={};var _0x3e4214={'count':0x0,'rows':[]};return db[_0x6b1b('0x69')][_0x6b1b('0x7e')]({'where':{'id':_0x2cce36['params']['id']}})[_0x6b1b('0x19')](handleEntityNotFound(_0x13e2a9,null))[_0x6b1b('0x19')](function(_0x51744a){if(_0x51744a){_0xa8e337[_0x6b1b('0x54')]=_[_0x6b1b('0x5d')](db[_0x6b1b('0xdd')][_0x6b1b('0x59')]);_0xa8e337[_0x6b1b('0x5c')]=_[_0x6b1b('0x5d')](_0x2cce36[_0x6b1b('0x5c')]);_0xa8e337['filters']=_[_0x6b1b('0x5f')](_0xa8e337[_0x6b1b('0x54')],_0xa8e337[_0x6b1b('0x5c')]);_0x42547c[_0x6b1b('0x61')]=_[_0x6b1b('0x5f')](_0xa8e337['model'],qs[_0x6b1b('0x60')](_0x2cce36[_0x6b1b('0x5c')][_0x6b1b('0x60')]));_0x42547c['attributes']=_0x42547c[_0x6b1b('0x61')][_0x6b1b('0x62')]?_0x42547c['attributes']:_0xa8e337['model'];if(!_0x2cce36[_0x6b1b('0x5c')][_0x6b1b('0x63')](_0x6b1b('0x7a'))){_0x42547c[_0x6b1b('0x29')]=qs[_0x6b1b('0x29')](_0x2cce36['query']['limit']);_0x42547c[_0x6b1b('0x27')]=qs['offset'](_0x2cce36[_0x6b1b('0x5c')]['offset']);}_0x42547c[_0x6b1b('0x64')]=qs[_0x6b1b('0x65')](_0x2cce36['query'][_0x6b1b('0x65')]);_0x42547c[_0x6b1b('0x66')]=qs[_0x6b1b('0x5e')](_[_0x6b1b('0x67')](_0x2cce36[_0x6b1b('0x5c')],_0xa8e337[_0x6b1b('0x5e')]));_0x42547c[_0x6b1b('0x66')][_0x6b1b('0x7b')]=_0x51744a['id'];if(_0x2cce36[_0x6b1b('0x5c')]['filter']){_0x42547c[_0x6b1b('0x66')]=_[_0x6b1b('0x6f')](_0x42547c[_0x6b1b('0x66')],{'$or':_[_0x6b1b('0x40')](_0x42547c[_0x6b1b('0x61')],function(_0x32de72){var _0x54429a={};_0x54429a[_0x32de72]={'$like':'%'+_0x2cce36[_0x6b1b('0x5c')][_0x6b1b('0x68')]+'%'};return _0x54429a;})});}_0x42547c=_[_0x6b1b('0x6f')]({},_0x42547c,_0x2cce36[_0x6b1b('0x70')]);return db[_0x6b1b('0xdd')][_0x6b1b('0x2a')]({'where':_0x42547c[_0x6b1b('0x66')]})['then'](function(_0xb3b02e){_0x3e4214[_0x6b1b('0x2a')]=_0xb3b02e;if(_0x2cce36[_0x6b1b('0x5c')]['includeAll']){_0x42547c[_0x6b1b('0x6e')]=[{'all':!![]}];}else{_0x42547c['include']=[{'model':db['CmContact'],'as':_0x6b1b('0x122'),'required':![]},{'model':db[_0x6b1b('0x123')],'as':'Attachments','required':![]}];}return db[_0x6b1b('0xdd')][_0x6b1b('0x6b')](_0x42547c);})['then'](function(_0x87a703){_0x3e4214[_0x6b1b('0x7c')]=_0x87a703;return _0x3e4214;});}})[_0x6b1b('0x19')](respondWithFilteredResult(_0x13e2a9,_0x42547c))[_0x6b1b('0x23')](handleError(_0x13e2a9,null));};exports['addAgents']=function(_0x543ad4,_0x22b0ae){return db[_0x6b1b('0x69')][_0x6b1b('0x75')]({'where':{'id':_0x543ad4[_0x6b1b('0x6d')]['id']}})[_0x6b1b('0x19')](handleEntityNotFound(_0x22b0ae,null))[_0x6b1b('0x19')](function(_0x38c3c0){if(_0x38c3c0){return _0x38c3c0[_0x6b1b('0x124')](_0x543ad4[_0x6b1b('0x72')][_0x6b1b('0x81')],_[_0x6b1b('0xf7')](_0x543ad4['body'],['ids','id'])||{})[_0x6b1b('0xb2')](function(_0x4ce305){for(var _0x205e08=0x0;_0x205e08<_0x543ad4[_0x6b1b('0x72')][_0x6b1b('0x81')][_0x6b1b('0x62')];_0x205e08+=0x1){socket[_0x6b1b('0x125')](_0x6b1b('0x126'),{'UserId':Number(_0x543ad4[_0x6b1b('0x72')]['ids'][_0x205e08]),'ChatWebsiteId':Number(_0x543ad4[_0x6b1b('0x6d')]['id'])});}return _0x4ce305;});}})['then'](respondWithResult(_0x22b0ae,null))['catch'](handleError(_0x22b0ae,null));};exports['removeAgents']=function(_0x555c1d,_0x16db6f){return db['ChatWebsite'][_0x6b1b('0x75')]({'where':{'id':_0x555c1d[_0x6b1b('0x6d')]['id']}})['then'](handleEntityNotFound(_0x16db6f,null))[_0x6b1b('0x19')](function(_0x3cb482){if(_0x3cb482){return _0x3cb482['removeAgents'](_0x555c1d['query']['ids'])['then'](function(){if(_[_0x6b1b('0x127')](_0x555c1d['query'][_0x6b1b('0x81')])){for(var _0x4eae43=0x0;_0x4eae43<_0x555c1d[_0x6b1b('0x5c')][_0x6b1b('0x81')][_0x6b1b('0x62')];_0x4eae43+=0x1){socket[_0x6b1b('0x125')](_0x6b1b('0x128'),{'UserId':Number(_0x555c1d['query'][_0x6b1b('0x81')][_0x4eae43]),'ChatWebsiteId':Number(_0x555c1d[_0x6b1b('0x6d')]['id'])});}}else{socket[_0x6b1b('0x125')](_0x6b1b('0x128'),{'UserId':Number(_0x555c1d[_0x6b1b('0x5c')][_0x6b1b('0x81')]),'ChatWebsiteId':Number(_0x555c1d[_0x6b1b('0x6d')]['id'])});}});}})['then'](respondWithStatusCode(_0x16db6f,null))[_0x6b1b('0x23')](handleError(_0x16db6f,null));};exports['getAgents']=function(_0x363859,_0x4a5b53){var _0x31fc30={};var _0x48bdff={};var _0x4fc237;var _0xa127c0;return db['ChatWebsite'][_0x6b1b('0x7e')]({'where':{'id':_0x363859[_0x6b1b('0x6d')]['id']}})['then'](handleEntityNotFound(_0x4a5b53,null))['then'](function(_0x16be0c){if(_0x16be0c){_0x4fc237=_0x16be0c;_0x48bdff['model']=_[_0x6b1b('0x5d')](db[_0x6b1b('0xf9')][_0x6b1b('0x59')]);_0x48bdff[_0x6b1b('0x5c')]=_[_0x6b1b('0x5d')](_0x363859[_0x6b1b('0x5c')]);_0x48bdff[_0x6b1b('0x5e')]=_['intersection'](_0x48bdff[_0x6b1b('0x54')],_0x48bdff[_0x6b1b('0x5c')]);_0x31fc30['attributes']=_[_0x6b1b('0x5f')](_0x48bdff[_0x6b1b('0x54')],qs['fields'](_0x363859[_0x6b1b('0x5c')][_0x6b1b('0x60')]));_0x31fc30[_0x6b1b('0x61')]=_0x31fc30[_0x6b1b('0x61')][_0x6b1b('0x62')]?_0x31fc30[_0x6b1b('0x61')]:_0x48bdff[_0x6b1b('0x54')];_0x31fc30[_0x6b1b('0x64')]=qs[_0x6b1b('0x65')](_0x363859[_0x6b1b('0x5c')][_0x6b1b('0x65')]);_0x31fc30[_0x6b1b('0x66')]=qs[_0x6b1b('0x5e')](_['pick'](_0x363859[_0x6b1b('0x5c')],_0x48bdff[_0x6b1b('0x5e')]));if(_0x363859[_0x6b1b('0x5c')]['filter']){_0x31fc30[_0x6b1b('0x66')]=_[_0x6b1b('0x6f')](_0x31fc30[_0x6b1b('0x66')],{'$or':_[_0x6b1b('0x40')](_0x31fc30[_0x6b1b('0x61')],function(_0x5f3a25){var _0x2b4ffc={};_0x2b4ffc[_0x5f3a25]={'$like':'%'+_0x363859['query'][_0x6b1b('0x68')]+'%'};return _0x2b4ffc;})});}_0x31fc30=_[_0x6b1b('0x6f')]({},_0x31fc30,_0x363859[_0x6b1b('0x70')]);return _0x4fc237[_0x6b1b('0x129')](_0x31fc30);}})['then'](function(_0x2de54e){if(_0x2de54e){_0xa127c0=_0x2de54e[_0x6b1b('0x62')];if(!_0x363859[_0x6b1b('0x5c')]['hasOwnProperty'](_0x6b1b('0x7a'))){_0x31fc30[_0x6b1b('0x29')]=qs[_0x6b1b('0x29')](_0x363859[_0x6b1b('0x5c')][_0x6b1b('0x29')]);_0x31fc30['offset']=qs[_0x6b1b('0x27')](_0x363859[_0x6b1b('0x5c')]['offset']);}return _0x4fc237[_0x6b1b('0x129')](_0x31fc30);}})[_0x6b1b('0x19')](function(_0x3906d8){if(_0x3906d8){return _0x3906d8?{'count':_0xa127c0,'rows':_0x3906d8}:null;}})[_0x6b1b('0x19')](respondWithResult(_0x4a5b53,null))['catch'](handleError(_0x4a5b53,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 5917c52..77e1798 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 _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 +var _0xff3c=['../../mysqldb','setMaxListeners','save','emit','exports','events'];(function(_0x4c353f,_0xd09ca6){var _0x37b0b6=function(_0x419c0f){while(--_0x419c0f){_0x4c353f['push'](_0x4c353f['shift']());}};_0x37b0b6(++_0xd09ca6);}(_0xff3c,0x179));var _0xcff3=function(_0x1eb359,_0x4cda30){_0x1eb359=_0x1eb359-0x0;var _0x3fdf23=_0xff3c[_0x1eb359];return _0x3fdf23;};'use strict';var EventEmitter=require(_0xcff3('0x0'));var ChatWebsite=require(_0xcff3('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xcff3('0x2')](0x0);var events={'afterCreate':_0xcff3('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x28f6e0){return function(_0x17ae92,_0x45c7f6,_0x312858){ChatWebsiteEvents[_0xcff3('0x4')](_0x28f6e0+':'+_0x17ae92['id'],_0x17ae92);ChatWebsiteEvents[_0xcff3('0x4')](_0x28f6e0,_0x17ae92);_0x312858(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xcff3('0x5')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 038a06a..54075f5 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 _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 +var _0x5c5f=['./chatWebsite.attributes','exports','ChatWebsite','chat_websites','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0xc3c0fd,_0x210520){var _0x36d3e0=function(_0x27bdff){while(--_0x27bdff){_0xc3c0fd['push'](_0xc3c0fd['shift']());}};_0x36d3e0(++_0x210520);}(_0x5c5f,0x1dd));var _0xf5c5=function(_0x76c02d,_0x56edfa){_0x76c02d=_0x76c02d-0x0;var _0x43acda=_0x5c5f[_0x76c02d];return _0x43acda;};'use strict';var _=require(_0xf5c5('0x0'));var util=require('util');var logger=require(_0xf5c5('0x1'))(_0xf5c5('0x2'));var moment=require(_0xf5c5('0x3'));var BPromise=require(_0xf5c5('0x4'));var rp=require(_0xf5c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf5c5('0x6'));var config=require('../../config/environment');var attributes=require(_0xf5c5('0x7'));module[_0xf5c5('0x8')]=function(_0x4fa7b1,_0x531b1f){return _0x4fa7b1['define'](_0xf5c5('0x9'),attributes,{'tableName':_0xf5c5('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 d90506e..25fddbf 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 _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 +var _0x2aa6=['result','catch','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./chatWebsite.socket','register','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x3a2d30,_0x24f0f6){var _0x49ec55=function(_0x206969){while(--_0x206969){_0x3a2d30['push'](_0x3a2d30['shift']());}};_0x49ec55(++_0x24f0f6);}(_0x2aa6,0x116));var _0x62aa=function(_0x5c38cd,_0x5a6b4e){_0x5c38cd=_0x5c38cd-0x0;var _0xc985ef=_0x2aa6[_0x5c38cd];return _0xc985ef;};'use strict';var _=require('lodash');var util=require(_0x62aa('0x0'));var moment=require('moment');var BPromise=require(_0x62aa('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x62aa('0x2'));var db=require(_0x62aa('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x62aa('0x4'));var config=require(_0x62aa('0x5'));var jayson=require(_0x62aa('0x6'));var client=jayson[_0x62aa('0x7')][_0x62aa('0x8')]({'port':0x232a});config['redis']=_[_0x62aa('0x9')](config[_0x62aa('0xa')],{'host':_0x62aa('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x62aa('0xa')]));require(_0x62aa('0xc'))[_0x62aa('0xd')](socket);function respondWithRpcPromise(_0x1a380b,_0x562073,_0x281e8a){return new BPromise(function(_0x23849c,_0x1e0dee){return client[_0x62aa('0xe')](_0x1a380b,_0x281e8a)['then'](function(_0x1ec3dd){logger[_0x62aa('0xf')](_0x62aa('0x10'),_0x562073,_0x62aa('0x11'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x562073,_0x62aa('0x11'),JSON['stringify'](_0x1ec3dd));if(_0x1ec3dd[_0x62aa('0x12')]){if(_0x1ec3dd[_0x62aa('0x12')][_0x62aa('0x13')]===0x1f4){logger[_0x62aa('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x562073,_0x1ec3dd['error'][_0x62aa('0x14')]);return _0x1e0dee(_0x1ec3dd[_0x62aa('0x12')]['message']);}logger[_0x62aa('0x12')](_0x62aa('0x10'),_0x562073,_0x1ec3dd['error'][_0x62aa('0x14')]);return _0x23849c(_0x1ec3dd[_0x62aa('0x12')][_0x62aa('0x14')]);}else{logger[_0x62aa('0xf')](_0x62aa('0x10'),_0x562073,_0x62aa('0x11'));_0x23849c(_0x1ec3dd[_0x62aa('0x15')][_0x62aa('0x14')]);}})[_0x62aa('0x16')](function(_0x1741fe){logger[_0x62aa('0x12')](_0x62aa('0x10'),_0x562073,_0x1741fe);_0x1e0dee(_0x1741fe);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 7ea1c02..d597088 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 _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 +var _0x7897=['save','remove','update','register','length','./chatWebsite.events'];(function(_0x46f0fc,_0x15bc89){var _0x20984c=function(_0x2e3393){while(--_0x2e3393){_0x46f0fc['push'](_0x46f0fc['shift']());}};_0x20984c(++_0x15bc89);}(_0x7897,0x65));var _0x7789=function(_0x5a3e03,_0x13e29b){_0x5a3e03=_0x5a3e03-0x0;var _0x5b0e87=_0x7897[_0x5a3e03];return _0x5b0e87;};'use strict';var ChatWebsiteEvents=require(_0x7789('0x0'));var events=[_0x7789('0x1'),_0x7789('0x2'),_0x7789('0x3')];function createListener(_0x3d9c27,_0x3496d9){return function(_0x57c335){_0x3496d9['emit'](_0x3d9c27,_0x57c335);};}function removeListener(_0x5f5f49,_0x598fd9){return function(){ChatWebsiteEvents['removeListener'](_0x5f5f49,_0x598fd9);};}exports[_0x7789('0x4')]=function(_0xb07ba7){for(var _0x1bd6e2=0x0,_0x26c1b5=events[_0x7789('0x5')];_0x1bd6e2<_0x26c1b5;_0x1bd6e2++){var _0x111e53=events[_0x1bd6e2];var _0x44d14f=createListener('chatWebsite:'+_0x111e53,_0xb07ba7);ChatWebsiteEvents['on'](_0x111e53,_0x44d14f);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 67fe81a..c141ad4 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 _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 +var _0xcc6c=['join','server/files/images/logos/','format','now','originalname','single','file','addLogo','diskStorage','server/files/images/avatars/','%s-%s','root','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','server/files','attachments','offline-chat','extname','/:id/offline','any','offline','/:id/interactions','addInteraction','addApplications','addProactiveActions','put','update','delete','destroy','/:id/dispositions','removeDispositions','removeAnswers','removeAgents','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','/describe','describe','/:id','getDispositions','getAnswers','/:id/logo','/:id/avatar','getCustomerAvatar','/:id/system_avatar','getInteractions','getSnippet','/:id/applications','/:id/proactive_actions','/:id/fields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','/:id/canned_answers','addAnswer'];(function(_0x570294,_0x139ae4){var _0x41b542=function(_0xea92ff){while(--_0xea92ff){_0x570294['push'](_0x570294['shift']());}};_0x41b542(++_0x139ae4);}(_0xcc6c,0x1ae));var _0xccc6=function(_0x2d274d,_0x50b97){_0x2d274d=_0x2d274d-0x0;var _0x268a48=_0xcc6c[_0x2d274d];return _0x268a48;};'use strict';var multer=require(_0xccc6('0x0'));var util=require(_0xccc6('0x1'));var path=require(_0xccc6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xccc6('0x3')]();var fs_extra=require(_0xccc6('0x4'));var auth=require(_0xccc6('0x5'));var interaction=require(_0xccc6('0x6'));var config=require(_0xccc6('0x7'));var controller=require(_0xccc6('0x8'));router[_0xccc6('0x9')]('/',auth[_0xccc6('0xa')](),controller['index']);router[_0xccc6('0x9')](_0xccc6('0xb'),auth[_0xccc6('0xa')](),controller[_0xccc6('0xc')]);router['get'](_0xccc6('0xd'),auth[_0xccc6('0xa')](),controller['show']);router['get']('/:id/dispositions',auth[_0xccc6('0xa')](),controller[_0xccc6('0xe')]);router['get']('/:id/canned_answers',auth[_0xccc6('0xa')](),controller[_0xccc6('0xf')]);router[_0xccc6('0x9')](_0xccc6('0x10'),controller['getLogo']);router[_0xccc6('0x9')](_0xccc6('0x11'),controller['getAvatar']);router[_0xccc6('0x9')]('/:id/customer_avatar',controller[_0xccc6('0x12')]);router[_0xccc6('0x9')](_0xccc6('0x13'),controller['getSystemAvatar']);router['get']('/:id/interactions',auth[_0xccc6('0xa')](),controller[_0xccc6('0x14')]);router[_0xccc6('0x9')]('/:id/snippet',controller[_0xccc6('0x15')]);router[_0xccc6('0x9')](_0xccc6('0x16'),auth[_0xccc6('0xa')](),controller['getApplications']);router[_0xccc6('0x9')](_0xccc6('0x17'),auth['isAuthenticated'](),controller['getProactiveActions']);router[_0xccc6('0x9')](_0xccc6('0x18'),controller['getFields']);router[_0xccc6('0x9')](_0xccc6('0x19'),auth[_0xccc6('0xa')](),controller[_0xccc6('0x1a')]);router[_0xccc6('0x9')](_0xccc6('0x1b'),auth['isAuthenticated'](),controller[_0xccc6('0x1c')]);router[_0xccc6('0x1d')]('/',auth[_0xccc6('0xa')](),controller['create']);router[_0xccc6('0x1d')]('/:id/dispositions',auth[_0xccc6('0xa')](),controller['addDisposition']);router[_0xccc6('0x1d')](_0xccc6('0x1e'),auth[_0xccc6('0xa')](),controller[_0xccc6('0x1f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x24970a,_0x1e2d98,_0x38c111){_0x38c111(null,path[_0xccc6('0x20')](config['root'],_0xccc6('0x21')));},'filename':function(_0x2c5157,_0xb64b43,_0x463511){_0x463511(null,util[_0xccc6('0x22')]('%s-%s',Date[_0xccc6('0x23')](),_0xb64b43[_0xccc6('0x24')]));}})});router[_0xccc6('0x1d')]('/:id/logo',upload[_0xccc6('0x25')](_0xccc6('0x26')),controller[_0xccc6('0x27')]);var upload=multer({'storage':multer[_0xccc6('0x28')]({'destination':function(_0x22f1db,_0x4563fb,_0x8ada51){_0x8ada51(null,path['join'](config['root'],_0xccc6('0x29')));},'filename':function(_0x2da4ae,_0x2bb745,_0x4cb274){_0x4cb274(null,util[_0xccc6('0x22')](_0xccc6('0x2a'),Date[_0xccc6('0x23')](),_0x2bb745[_0xccc6('0x24')]));}})});router['post']('/:id/avatar',upload[_0xccc6('0x25')](_0xccc6('0x26')),controller['addAvatar']);var upload=multer({'storage':multer[_0xccc6('0x28')]({'destination':function(_0x5db382,_0x3d3c57,_0x5ca40a){_0x5ca40a(null,path[_0xccc6('0x20')](config[_0xccc6('0x2b')],_0xccc6('0x29')));},'filename':function(_0x56c868,_0x5c2c5d,_0x2005c4){_0x2005c4(null,util[_0xccc6('0x22')](_0xccc6('0x2a'),Date[_0xccc6('0x23')](),_0x5c2c5d[_0xccc6('0x24')]));}})});router[_0xccc6('0x1d')](_0xccc6('0x2c'),upload[_0xccc6('0x25')](_0xccc6('0x26')),controller[_0xccc6('0x2d')]);var upload=multer({'storage':multer[_0xccc6('0x28')]({'destination':function(_0x45f424,_0x244fda,_0x44da83){_0x44da83(null,path[_0xccc6('0x20')](config[_0xccc6('0x2b')],_0xccc6('0x29')));},'filename':function(_0x378680,_0x384033,_0x2bad3b){_0x2bad3b(null,util[_0xccc6('0x22')](_0xccc6('0x2a'),Date[_0xccc6('0x23')](),_0x384033['originalname']));}})});router[_0xccc6('0x1d')](_0xccc6('0x13'),upload[_0xccc6('0x25')](_0xccc6('0x26')),controller[_0xccc6('0x2e')]);router[_0xccc6('0x1d')]('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xccc6('0x28')]({'destination':function(_0x54ac83,_0x1e6f04,_0x3619cc){const _0x399d98=path['join'](config[_0xccc6('0x2b')],_0xccc6('0x2f'),_0xccc6('0x30'),_0xccc6('0x31'));fs_extra['ensureDir'](_0x399d98,function(){_0x3619cc(null,_0x399d98);});},'filename':function(_0x1e1c37,_0x1c0b60,_0x403fa6){const _0x17b54e=_0x1c0b60[_0xccc6('0x24')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0xc1eb14=path[_0xccc6('0x32')](_0x17b54e);const _0x3c00be=Date[_0xccc6('0x23')]()+'-'+_0x17b54e['replace'](_0xc1eb14,'')+_0xc1eb14;_0x403fa6(null,_0x3c00be);}})});router[_0xccc6('0x1d')](_0xccc6('0x33'),offlineUploadMulter[_0xccc6('0x34')](),controller[_0xccc6('0x35')]);router[_0xccc6('0x1d')](_0xccc6('0x36'),auth[_0xccc6('0xa')](),controller[_0xccc6('0x37')]);router[_0xccc6('0x1d')](_0xccc6('0x16'),auth[_0xccc6('0xa')](),controller[_0xccc6('0x38')]);router[_0xccc6('0x1d')](_0xccc6('0x17'),auth[_0xccc6('0xa')](),controller[_0xccc6('0x39')]);router['post'](_0xccc6('0x1b'),auth[_0xccc6('0xa')](),controller['addAgents']);router[_0xccc6('0x3a')](_0xccc6('0xd'),auth[_0xccc6('0xa')](),controller[_0xccc6('0x3b')]);router[_0xccc6('0x3c')](_0xccc6('0xd'),auth[_0xccc6('0xa')](),controller[_0xccc6('0x3d')]);router[_0xccc6('0x3c')](_0xccc6('0x3e'),auth[_0xccc6('0xa')](),controller[_0xccc6('0x3f')]);router['delete'](_0xccc6('0x1e'),auth[_0xccc6('0xa')](),controller[_0xccc6('0x40')]);router[_0xccc6('0x3c')](_0xccc6('0x1b'),auth[_0xccc6('0xa')](),controller[_0xccc6('0x41')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index f773f84..6e9fb10 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 _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 +var _0x7e46=['/client-logs','use','exports','beaver-logger/server','express','../components/auth/service','../config/environment','env','app','client-side-logger','Client-Side\x20logger\x20not\x20found!'];(function(_0x20efc3,_0x1d2191){var _0x49d176=function(_0x5a886f){while(--_0x5a886f){_0x20efc3['push'](_0x20efc3['shift']());}};_0x49d176(++_0x1d2191);}(_0x7e46,0x7c));var _0x67e4=function(_0x5c16fc,_0x282348){_0x5c16fc=_0x5c16fc-0x0;var _0x3bceb4=_0x7e46[_0x5c16fc];return _0x3bceb4;};var beaverLogger=require(_0x67e4('0x0'));var express=require(_0x67e4('0x1'));var auth=require(_0x67e4('0x2'));var config=require(_0x67e4('0x3'));var router=express['Router']();var isProduction=config[_0x67e4('0x4')]==='production'||![];function clientSideLogs(_0x4a6687,_0x55afab,_0x4c9196){var _0x205cf2=_0x4a6687[_0x67e4('0x5')]['get'](_0x67e4('0x6'));if(!_0x205cf2){throw new Error(_0x67e4('0x7'));}return beaverLogger['expressEndpoint']({'uri':_0x67e4('0x8'),'logger':_0x205cf2,'enableCors':!isProduction})(_0x4a6687,_0x55afab,_0x4c9196);}router[_0x67e4('0x9')](auth['isAuthenticated'](),clientSideLogs);module[_0x67e4('0xa')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 068a9d7..1fc1b7e 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 _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 +var _0x5de5=['TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri'];(function(_0x5cbcb3,_0x3a025d){var _0x4e334c=function(_0x171866){while(--_0x171866){_0x5cbcb3['push'](_0x5cbcb3['shift']());}};_0x4e334c(++_0x3a025d);}(_0x5de5,0x153));var _0x55de=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5de5[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');module[_0x55de('0x0')]={'name':{'type':Sequelize[_0x55de('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x55de('0x2')](_0x55de('0x3'),_0x55de('0x4'),_0x55de('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x55de('0x2')]('Outlook365',_0x55de('0x6'))},'data1':{'type':Sequelize[_0x55de('0x1')],'comment':_0x55de('0x7')},'data2':{'type':Sequelize[_0x55de('0x1')],'comment':_0x55de('0x8')},'data3':{'type':Sequelize[_0x55de('0x1')],'comment':_0x55de('0x9')},'data4':{'type':Sequelize[_0x55de('0x1')],'comment':_0x55de('0xa')},'data5':{'type':Sequelize[_0x55de('0xb')],'comment':_0x55de('0xc')},'data6':{'type':Sequelize[_0x55de('0xb')],'comment':_0x55de('0xd')},'data7':{'type':Sequelize[_0x55de('0xb')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index f14dc25..013993c 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 _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 +var _0x936c=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','params','fields','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','create','find','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','get','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','isValidIdToken','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','refresh_token','data6','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','update','destroy','error','stack','name','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x936c,0x1c7));var _0xc936=function(_0x5d42f4,_0x4b7188){_0x5d42f4=_0x5d42f4-0x0;var _0x4cf05c=_0x936c[_0x5d42f4];return _0x4cf05c;};'use strict';var _=require(_0xc936('0x0'));var Redis=require(_0xc936('0x1'));var qs=require(_0xc936('0x2'));var encryptor=require(_0xc936('0x3'));var config=require(_0xc936('0x4'));var logger=require(_0xc936('0x5'))(_0xc936('0x6'));var db=require('../../mysqldb')['db'];var oauth=require(_0xc936('0x7'));config[_0xc936('0x8')]=_[_0xc936('0x9')](config['redis'],{'host':_0xc936('0xa'),'port':0x18eb});var socket=require(_0xc936('0xb'))(new Redis(config[_0xc936('0x8')]));var redis=new Redis(config[_0xc936('0x8')]);function respondWithStatusCode(_0x2de10a,_0x38c7da){_0x38c7da=_0x38c7da||0xcc;return function(_0x2ffb3c){if(_0x2ffb3c){return _0x2de10a[_0xc936('0xc')](_0x38c7da);}return _0x2de10a[_0xc936('0xd')](_0x38c7da)[_0xc936('0xe')]();};}function respondWithResult(_0x26b887,_0x3556df){_0x3556df=_0x3556df||0xc8;return function(_0x29a008){if(_0x29a008){return _0x26b887['status'](_0x3556df)[_0xc936('0xf')](_0x29a008);}};}function respondWithFilteredResult(_0x2837fd,_0x4702ed){return function(_0x5637ad){if(_0x5637ad){var _0x714c7=typeof _0x4702ed['offset']==='undefined'&&typeof _0x4702ed[_0xc936('0x10')]===_0xc936('0x11');var _0x2c79f7=_0x5637ad[_0xc936('0x12')];var _0x5643ca=_0x714c7?0x0:_0x4702ed['offset'];var _0x1a8223=_0x714c7?_0x5637ad[_0xc936('0x12')]:_0x4702ed[_0xc936('0x13')]+_0x4702ed[_0xc936('0x10')];var _0x9fce11;if(_0x1a8223>=_0x2c79f7){_0x1a8223=_0x2c79f7;_0x9fce11=0xc8;}else{_0x9fce11=0xce;}_0x2837fd['status'](_0x9fce11);return _0x2837fd[_0xc936('0x14')](_0xc936('0x15'),_0x5643ca+'-'+_0x1a8223+'/'+_0x2c79f7)[_0xc936('0xf')](_0x5637ad);}return null;};}function saveUpdates(_0x54f34d){return function(_0x14b126){if(_0x14b126){return _0x14b126[_0xc936('0x16')](_0x54f34d)['then'](function(_0x19921a){return _0x19921a;});}return null;};}function removeEntity(_0x375776){return function(_0x244bfe){if(_0x244bfe){return _0x244bfe[_0xc936('0x17')]()['then'](function(){_0x375776[_0xc936('0xd')](0xcc)[_0xc936('0xe')]();});}};}function handleEntityNotFound(_0x4ac351){return function(_0x15bb2e){if(!_0x15bb2e){_0x4ac351[_0xc936('0xc')](0x194);}return _0x15bb2e;};}function handleError(_0x43bb25,_0x37c561){_0x37c561=_0x37c561||0x1f4;return function(_0x2a4e43){logger[_0xc936('0x18')](_0x2a4e43[_0xc936('0x19')]);if(_0x2a4e43['name']){delete _0x2a4e43[_0xc936('0x1a')];}_0x43bb25['status'](_0x37c561)['send'](_0x2a4e43);};}function maskClientSecret(_0x35ed80){return _['padEnd'](_0x35ed80[_0xc936('0x1b')](0x0,0x3),0x14,'*');}exports[_0xc936('0x1c')]=function(_0x47f9fb,_0x2db42f){var _0x317514={},_0x33520c={},_0x2456a2={'count':0x0,'rows':[]};var _0x43d6b7=_[_0xc936('0x1d')](db[_0xc936('0x1e')][_0xc936('0x1f')],function(_0x5264e0){return{'name':_0x5264e0[_0xc936('0x20')],'type':_0x5264e0[_0xc936('0x21')][_0xc936('0x22')]};});_0x33520c[_0xc936('0x23')]=_[_0xc936('0x1d')](_0x43d6b7,_0xc936('0x1a'));_0x33520c[_0xc936('0x24')]=_[_0xc936('0x25')](_0x47f9fb[_0xc936('0x24')]);_0x33520c[_0xc936('0x26')]=_[_0xc936('0x27')](_0x33520c[_0xc936('0x23')],_0x33520c[_0xc936('0x24')]);_0x317514[_0xc936('0x28')]=_[_0xc936('0x27')](_0x33520c[_0xc936('0x23')],qs['fields'](_0x47f9fb[_0xc936('0x24')]['fields']));_0x317514[_0xc936('0x28')]=_0x317514[_0xc936('0x28')][_0xc936('0x29')]?_0x317514[_0xc936('0x28')]:_0x33520c[_0xc936('0x23')];if(!_0x47f9fb[_0xc936('0x24')][_0xc936('0x2a')](_0xc936('0x2b'))){_0x317514[_0xc936('0x10')]=qs['limit'](_0x47f9fb['query']['limit']);_0x317514[_0xc936('0x13')]=qs[_0xc936('0x13')](_0x47f9fb['query']['offset']);}_0x317514[_0xc936('0x2c')]=qs[_0xc936('0x2d')](_0x47f9fb[_0xc936('0x24')][_0xc936('0x2d')]);_0x317514[_0xc936('0x2e')]=qs['filters'](_[_0xc936('0x2f')](_0x47f9fb[_0xc936('0x24')],_0x33520c[_0xc936('0x26')]),_0x43d6b7);if(_0x47f9fb[_0xc936('0x24')][_0xc936('0x30')]){_0x317514[_0xc936('0x2e')]=_[_0xc936('0x31')](_0x317514[_0xc936('0x2e')],{'$or':_[_0xc936('0x1d')](_0x43d6b7,function(_0xe22cf6){if(_0xe22cf6[_0xc936('0x21')]!==_0xc936('0x32')){var _0x5ce3c1={};_0x5ce3c1[_0xe22cf6[_0xc936('0x1a')]]={'$like':'%'+_0x47f9fb[_0xc936('0x24')][_0xc936('0x30')]+'%'};return _0x5ce3c1;}})});}_0x317514=_['merge']({},_0x317514,_0x47f9fb[_0xc936('0x33')]);var _0x253c95={'where':_0x317514[_0xc936('0x2e')]};return db[_0xc936('0x1e')][_0xc936('0x12')](_0x253c95)[_0xc936('0x34')](function(_0x4f04c6){_0x2456a2[_0xc936('0x12')]=_0x4f04c6;if(_0x47f9fb[_0xc936('0x24')][_0xc936('0x35')]){_0x317514[_0xc936('0x36')]=[{'all':!![]}];}return db[_0xc936('0x1e')][_0xc936('0x37')](_0x317514);})[_0xc936('0x34')](function(_0x370b2c){_0x2456a2[_0xc936('0x38')]=_[_0xc936('0x1d')](_0x370b2c,function(_0x4e1a5d){if(_0x4e1a5d[_0xc936('0x39')]===_0xc936('0x3a')){var _0x18d38b=encryptor[_0xc936('0x3b')](_0x4e1a5d['data3']);_0x4e1a5d[_0xc936('0x3c')]=maskClientSecret(_0x18d38b);}return _0x4e1a5d;});return _0x2456a2;})[_0xc936('0x34')](respondWithFilteredResult(_0x2db42f,_0x317514))[_0xc936('0x3d')](handleError(_0x2db42f,null));};exports['show']=function(_0x315892,_0xf5e74d){var _0x5ef564={'raw':!![],'where':{'id':_0x315892[_0xc936('0x3e')]['id']}},_0x3c6e7e={};_0x3c6e7e[_0xc936('0x23')]=_[_0xc936('0x25')](db[_0xc936('0x1e')][_0xc936('0x1f')]);_0x3c6e7e[_0xc936('0x24')]=_['keys'](_0x315892['query']);_0x3c6e7e[_0xc936('0x26')]=_['intersection'](_0x3c6e7e[_0xc936('0x23')],_0x3c6e7e['query']);_0x5ef564[_0xc936('0x28')]=_['intersection'](_0x3c6e7e[_0xc936('0x23')],qs[_0xc936('0x3f')](_0x315892['query'][_0xc936('0x3f')]));_0x5ef564[_0xc936('0x28')]=_0x5ef564[_0xc936('0x28')][_0xc936('0x29')]?_0x5ef564[_0xc936('0x28')]:_0x3c6e7e[_0xc936('0x23')];if(_0x315892['query'][_0xc936('0x35')]){_0x5ef564[_0xc936('0x36')]=[{'all':!![]}];}_0x5ef564=_[_0xc936('0x31')]({},_0x5ef564,_0x315892[_0xc936('0x33')]);return db['CloudProvider']['find'](_0x5ef564)[_0xc936('0x34')](handleEntityNotFound(_0xf5e74d,null))['then'](function(_0x4cea0a){if(_0x4cea0a['service']===_0xc936('0x3a')){var _0x56321d=encryptor['decryptString'](_0x4cea0a[_0xc936('0x3c')]);_0x4cea0a['data3']=maskClientSecret(_0x56321d);}return _0x4cea0a;})[_0xc936('0x34')](respondWithResult(_0xf5e74d,null))[_0xc936('0x3d')](handleError(_0xf5e74d,null));};exports['create']=function(_0x54c993,_0x5b165f){if(!_0x54c993[_0xc936('0x40')]['name'])throw new Error(_0xc936('0x41'));if(!_0x54c993[_0xc936('0x40')][_0xc936('0x39')])throw new Error(_0xc936('0x42'));var _0x3f5157=db[_0xc936('0x1e')]['rawAttributes'][_0xc936('0x39')]['values'];if(!_0x3f5157[_0xc936('0x43')](_0x54c993['body']['service']))throw new Error(_0xc936('0x44')+_0x3f5157['join'](',\x20'));if(_0x54c993['body']['service']===_0xc936('0x3a')&&_0x54c993[_0xc936('0x40')][_0xc936('0x3c')]){_0x54c993[_0xc936('0x40')]['data3']=encryptor[_0xc936('0x45')](_0x54c993[_0xc936('0x40')][_0xc936('0x3c')]);}return db[_0xc936('0x1e')][_0xc936('0x46')](_0x54c993[_0xc936('0x40')],{})['then'](respondWithResult(_0x5b165f,0xc9))[_0xc936('0x3d')](handleError(_0x5b165f,null));};exports['update']=function(_0x26e809,_0x9674ce){if(_0x26e809['body']['id']){delete _0x26e809[_0xc936('0x40')]['id'];}return db[_0xc936('0x1e')][_0xc936('0x47')]({'where':{'id':_0x26e809['params']['id']}})[_0xc936('0x34')](handleEntityNotFound(_0x9674ce,null))[_0xc936('0x34')](function(_0x2ded5b){if(_0x2ded5b['service']===_0xc936('0x3a')&&_0x26e809['body'][_0xc936('0x3c')]){_0x26e809[_0xc936('0x40')][_0xc936('0x3c')]=encryptor['encryptString'](_0x26e809[_0xc936('0x40')][_0xc936('0x3c')]);}return _0x2ded5b;})['then'](saveUpdates(_0x26e809[_0xc936('0x40')],null))[_0xc936('0x34')](respondWithResult(_0x9674ce,null))[_0xc936('0x3d')](handleError(_0x9674ce,null));};exports[_0xc936('0x17')]=function(_0x1981bd,_0x567e71){return db[_0xc936('0x1e')][_0xc936('0x47')]({'where':{'id':_0x1981bd['params']['id']}})[_0xc936('0x34')](handleEntityNotFound(_0x567e71,null))['then'](removeEntity(_0x567e71,null))[_0xc936('0x3d')](handleError(_0x567e71,null));};exports[_0xc936('0x48')]=function(_0x25fd86,_0x35c109){return db[_0xc936('0x1e')][_0xc936('0x49')]({'where':{'id':_0x25fd86[_0xc936('0x3e')]['id']},'raw':!![]})['then'](function(_0x47043d){if(!_0x47043d)return _0x35c109[_0xc936('0xc')](0x194);return{'url':oauth[_0xc936('0x4a')](_0x47043d,_0x25fd86[_0xc936('0x4b')]['id'])};})[_0xc936('0x34')](respondWithResult(_0x35c109,null))[_0xc936('0x3d')](handleError(_0x35c109,null));};exports['oauth2MicrosoftCallback']=function(_0x561c65,_0x105756){var _0x5c54d0=_0x561c65[_0xc936('0x40')];var _0x379eab;var _0x3bb4a6;if(_0x5c54d0[_0xc936('0x18')])throw _0x5c54d0;redis[_0xc936('0x4c')](_0x5c54d0[_0xc936('0x4d')])[_0xc936('0x34')](function(_0x11e0cd){if(!_0x11e0cd)throw new Error(_0xc936('0x4e'));_0x379eab=JSON[_0xc936('0x4f')](_0x11e0cd);var _0x49fd5b=Buffer[_0xc936('0x50')](_0x5c54d0['state'],_0xc936('0x51'))[_0xc936('0x52')](_0xc936('0x53'));_0x3bb4a6=JSON[_0xc936('0x4f')](_0x49fd5b);if(!oauth[_0xc936('0x54')](_0x5c54d0['id_token'],_0x379eab['oauth2Claims']))throw new Error(_0xc936('0x55'));redis[_0xc936('0x56')](_0x5c54d0[_0xc936('0x4d')]);return oauth[_0xc936('0x57')](_0x5c54d0[_0xc936('0x58')],_0x379eab);})[_0xc936('0x34')](function(_0x26a1d2){_0x379eab[_0xc936('0x59')]=_0x26a1d2['access_token'];_0x379eab['data6']=_0x26a1d2[_0xc936('0x5a')];return db['CloudProvider']['update']({'data5':_0x379eab['data5'],'data6':_0x379eab[_0xc936('0x5b')]},{'where':{'id':_0x379eab['id']}});})['then'](function(){oauth[_0xc936('0x5c')](_0x379eab);socket[_0xc936('0x5d')](_0xc936('0x5e'),{'id':_0x3bb4a6['id']});return;})[_0xc936('0x34')](respondWithStatusCode(_0x105756,null))[_0xc936('0x3d')](function(_0x1879e3){if(_0x3bb4a6){socket[_0xc936('0x5d')](_0xc936('0x5f'),{'id':_0x3bb4a6['id']});}if(!_0x379eab){logger['error'](_0xc936('0x60'),_0x1879e3);return _0x105756[_0xc936('0xd')](0x1f4)['send'](_0x1879e3[_0xc936('0x61')]);}logger[_0xc936('0x18')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x379eab['id'],JSON[_0xc936('0x62')](_0x1879e3));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index a194245..fca3c03 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 _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 +var _0xe91b=['define','cloud_providers','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x218577,_0x1c0704){var _0x4c6b7c=function(_0x17900d){while(--_0x17900d){_0x218577['push'](_0x218577['shift']());}};_0x4c6b7c(++_0x1c0704);}(_0xe91b,0x161));var _0xbe91=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xe91b[_0x24061a];return _0x82054e;};'use strict';var _=require(_0xbe91('0x0'));var util=require('util');var logger=require(_0xbe91('0x1'))(_0xbe91('0x2'));var moment=require(_0xbe91('0x3'));var BPromise=require(_0xbe91('0x4'));var rp=require(_0xbe91('0x5'));var fs=require('fs');var path=require(_0xbe91('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x116ffb,_0x4bb44c){return _0x116ffb[_0xbe91('0x7')]('CloudProvider',attributes,{'tableName':_0xbe91('0x8'),'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 44db2f6..8e0761e 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 _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 +var _0x12e3=['https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','{TENANT_ID}','from','stringify','base64','randomBytes','hex','client_id','data1','response_type','redirect_uri','response_mode','form_post','scope','state','prompt','key','value','oauth2Claims','replace','oauth2/','payload','iss','aud','audience','nonce','isAfter','exp','resolve','data3','findOne','then','refresh_token','decryptString','POST','data5','access_token','CloudProvider','update','data6','catch','authorization_code','intervals','bind','findAll','all','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','request-promise','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','openid','profile','email','offline_access','https://outlook.office.com/POP.AccessAsUser.All'];(function(_0x3a2a33,_0x29372a){var _0x10d6d2=function(_0x2c63b7){while(--_0x2c63b7){_0x3a2a33['push'](_0x3a2a33['shift']());}};_0x10d6d2(++_0x29372a);}(_0x12e3,0x127));var _0x312e=function(_0x4cdcb8,_0x44fc53){_0x4cdcb8=_0x4cdcb8-0x0;var _0x29996d=_0x12e3[_0x4cdcb8];return _0x29996d;};'use strict';var _=require(_0x312e('0x0'));var crypto=require(_0x312e('0x1'));var jwt=require(_0x312e('0x2'));var moment=require('moment');var Redis=require('ioredis');var rp=require(_0x312e('0x3'));var util=require('util');var encryptor=require(_0x312e('0x4'));var config=require(_0x312e('0x5'));var logger=require(_0x312e('0x6'))(_0x312e('0x7'));var schedule=require(_0x312e('0x8'));var db=require(_0x312e('0x9'))['db'];config[_0x312e('0xa')]=_[_0x312e('0xb')](config[_0x312e('0xa')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x312e('0xa')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x312e('0xc'),_0x312e('0xd'),_0x312e('0xe'),_0x312e('0xf'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0x312e('0x10'),_0x312e('0x11')],'Dynamics365':[_0x312e('0xc'),_0x312e('0xf')]};var MICROSOFT_AUTH_ENDPOINT=_0x312e('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0x312e('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5d2ef5){var _0x2587a9=_[_0x312e('0x14')](AZURE_AUTH_SCOPES[_0x5d2ef5[_0x312e('0x15')]]);if(_0x5d2ef5[_0x312e('0x15')]===_0x312e('0x16'))_0x2587a9[_0x312e('0x17')](_0x5d2ef5[_0x312e('0x18')]+_0x312e('0x19'));return _0x2587a9[_0x312e('0x1a')]('\x20');}function getAccessTokenScope(_0x478998){if(_0x478998['type']===_0x312e('0x1b'))return _0x312e('0x1c');if(_0x478998[_0x312e('0x15')]===_0x312e('0x16'))return _0x478998[_0x312e('0x18')]+_0x312e('0x19');}function generateMicrosoftAuthorizationUrl(_0x3c2386,_0x437c10){var _0x26f61a=MICROSOFT_AUTH_URL['replace'](_0x312e('0x1d'),_0x3c2386['data2']);var _0x4aafb9=['code','id_token'];var _0x2dc6b0=Buffer[_0x312e('0x1e')](JSON[_0x312e('0x1f')]({'id':_0x437c10}))['toString'](_0x312e('0x20'));var _0x407ac9=crypto[_0x312e('0x21')](0x10)['toString'](_0x312e('0x22'));var _0x4966a3=getAuthorizationScopes(_0x3c2386);var _0x534a5b=[{'key':_0x312e('0x23'),'value':_0x3c2386[_0x312e('0x24')]},{'key':_0x312e('0x25'),'value':encodeURIComponent(_0x4aafb9[_0x312e('0x1a')]('\x20'))},{'key':_0x312e('0x26'),'value':_0x3c2386['data4']},{'key':_0x312e('0x27'),'value':_0x312e('0x28')},{'key':_0x312e('0x29'),'value':encodeURIComponent(_0x4966a3)},{'key':_0x312e('0x2a'),'value':_0x2dc6b0},{'key':'nonce','value':_0x407ac9},{'key':_0x312e('0x2b'),'value':'login'}];var _0x27e400=_0x26f61a+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x534a5b,function(_0x19e520){return _0x19e520[_0x312e('0x2c')]+'='+_0x19e520[_0x312e('0x2d')];})[_0x312e('0x1a')]('&');_0x3c2386[_0x312e('0x2e')]={'issuer':_0x26f61a[_0x312e('0x2f')](_0x312e('0x30'),''),'audience':_0x3c2386[_0x312e('0x24')],'state':_0x2dc6b0,'nonce':_0x407ac9};redis['set'](_0x2dc6b0,JSON[_0x312e('0x1f')](_0x3c2386));return _0x27e400;}function isValidIdToken(_0x1aebd6,_0x22e69c){try{var _0x423929=jwt['decode'](_0x1aebd6,{'complete':!![]});var _0x48da9a=_0x423929[_0x312e('0x31')];if(_0x48da9a[_0x312e('0x32')]!==_0x22e69c['issuer'])return![];if(_0x48da9a[_0x312e('0x33')]!==_0x22e69c[_0x312e('0x34')])return![];if(_0x48da9a[_0x312e('0x35')]!==_0x22e69c[_0x312e('0x35')])return![];if(moment()[_0x312e('0x36')](moment['unix'](_0x48da9a[_0x312e('0x37')])))return![];return!![];}catch(_0x34f221){throw _0x34f221;}}function refreshOauth2MicrosoftAccessToken(_0x138942){return Promise[_0x312e('0x38')]()['then'](function(){if(_0x138942[_0x312e('0x39')])return _0x138942;return db['CloudProvider'][_0x312e('0x3a')]({'where':{'id':_0x138942['id']},'raw':!![]});})[_0x312e('0x3b')](function(_0x5c88e5){var _0x597184={'grant_type':_0x312e('0x3c'),'refresh_token':_0x5c88e5['data6'],'scope':getAccessTokenScope(_0x5c88e5),'redirect_uri':_0x5c88e5['data4'],'client_id':_0x5c88e5[_0x312e('0x24')],'client_secret':encryptor[_0x312e('0x3d')](_0x5c88e5['data3'])};var _0x2a2a7e={'method':_0x312e('0x3e'),'uri':MICROSOFT_AUTH_URL[_0x312e('0x2f')](_0x312e('0x1d'),_0x5c88e5['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x597184,'json':!![]};return rp(_0x2a2a7e);})[_0x312e('0x3b')](function(_0x52d233){_0x138942[_0x312e('0x3f')]=_0x52d233[_0x312e('0x40')];_0x138942['data6']=_0x52d233[_0x312e('0x3c')];return db[_0x312e('0x41')][_0x312e('0x42')]({'data5':_0x138942['data5'],'data6':_0x138942[_0x312e('0x43')]},{'where':{'id':_0x138942['id']}});})[_0x312e('0x3b')](function(){return _0x138942;})[_0x312e('0x44')](function(_0xc3ba3f){logger['error']('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x138942['id'],_0xc3ba3f);});}function getOauth2MicrosoftAccessToken(_0x57c1e4,_0x1552fb){var _0x48db42={'grant_type':_0x312e('0x45'),'code':_0x57c1e4,'scope':getAccessTokenScope(_0x1552fb),'redirect_uri':_0x1552fb['data4'],'client_id':_0x1552fb['data1'],'client_secret':encryptor[_0x312e('0x3d')](_0x1552fb[_0x312e('0x39')])};var _0x53a3df={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x312e('0x2f')](_0x312e('0x1d'),_0x1552fb['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x48db42,'json':!![]};return rp(_0x53a3df);}function startRefreshInterval(_0x3f053e){var _0x57f3bd=schedule[_0x312e('0x46')];if(_0x57f3bd[_0x3f053e['id']])clearInterval(_0x57f3bd[_0x3f053e['id']]);_0x57f3bd[_0x3f053e['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x312e('0x47')](this,{'id':_0x3f053e['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x57f3bd;}function startAllRefreshIntervals(){return db[_0x312e('0x41')][_0x312e('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x312e('0x3b')](function(_0x254260){var _0x3e447e=_0x254260[_0x312e('0x14')](function(_0x291d3f){return refreshOauth2MicrosoftAccessToken(_0x291d3f)[_0x312e('0x3b')](function(_0x46e2fc){startRefreshInterval(_0x46e2fc);});});return Promise[_0x312e('0x49')](_0x3e447e);})['catch'](function(_0x1b441d){var _0x5d09a3=_0x1b441d?util[_0x312e('0x4a')](_0x1b441d,{'showHidden':![],'depth':null}):'';logger[_0x312e('0x4b')](_0x312e('0x4c'),_0x5d09a3);});}module[_0x312e('0x4d')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 843b2ed..52dae85 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 _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 +var _0xfd58=['info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','code','CloudProvider,\x20%s,\x20%s','message'];(function(_0x345bd6,_0x1e2919){var _0x3c22cb=function(_0x430250){while(--_0x430250){_0x345bd6['push'](_0x345bd6['shift']());}};_0x3c22cb(++_0x1e2919);}(_0xfd58,0xb3));var _0x8fd5=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfd58[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x8fd5('0x0'));var util=require(_0x8fd5('0x1'));var moment=require('moment');var BPromise=require(_0x8fd5('0x2'));var rs=require(_0x8fd5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fd5('0x4'))['db'];var utils=require(_0x8fd5('0x5'));var logger=require(_0x8fd5('0x6'))(_0x8fd5('0x7'));var config=require('../../config/environment');var jayson=require(_0x8fd5('0x8'));var client=jayson[_0x8fd5('0x9')][_0x8fd5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e10e4,_0x16ac3f,_0x32bad9){return new BPromise(function(_0x273344,_0x1042a1){return client[_0x8fd5('0xb')](_0x4e10e4,_0x32bad9)['then'](function(_0x462ac4){logger['info']('CloudProvider,\x20%s,\x20%s',_0x16ac3f,_0x8fd5('0xc'));logger[_0x8fd5('0xd')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x16ac3f,_0x8fd5('0xc'),JSON[_0x8fd5('0xe')](_0x462ac4));if(_0x462ac4['error']){if(_0x462ac4[_0x8fd5('0xf')][_0x8fd5('0x10')]===0x1f4){logger['error'](_0x8fd5('0x11'),_0x16ac3f,_0x462ac4[_0x8fd5('0xf')][_0x8fd5('0x12')]);return _0x1042a1(_0x462ac4[_0x8fd5('0xf')]['message']);}logger['error']('CloudProvider,\x20%s,\x20%s',_0x16ac3f,_0x462ac4[_0x8fd5('0xf')][_0x8fd5('0x12')]);return _0x273344(_0x462ac4[_0x8fd5('0xf')][_0x8fd5('0x12')]);}else{logger[_0x8fd5('0x13')](_0x8fd5('0x11'),_0x16ac3f,_0x8fd5('0xc'));_0x273344(_0x462ac4[_0x8fd5('0x14')][_0x8fd5('0x12')]);}})[_0x8fd5('0x15')](function(_0x53b2dd){logger[_0x8fd5('0xf')](_0x8fd5('0x11'),_0x16ac3f,_0x53b2dd);_0x1042a1(_0x53b2dd);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 1b4972f..c2183c7 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 _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 +var _0xc4aa=['put','/:id','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','show','post','create'];(function(_0x55a668,_0x495c0f){var _0x369e87=function(_0xc897e3){while(--_0xc897e3){_0x55a668['push'](_0x55a668['shift']());}};_0x369e87(++_0x495c0f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xc4aa[_0x32f7d7];return _0x133d09;};'use strict';var express=require(_0xac4a('0x0'));var router=express[_0xac4a('0x1')]();var auth=require(_0xac4a('0x2'));var controller=require(_0xac4a('0x3'));router[_0xac4a('0x4')]('/',auth[_0xac4a('0x5')](),controller['index']);router['get']('/:id',auth[_0xac4a('0x5')](),controller[_0xac4a('0x6')]);router[_0xac4a('0x7')]('/',auth[_0xac4a('0x5')](),controller[_0xac4a('0x8')]);router[_0xac4a('0x9')](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller['update']);router['delete'](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xb')]);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xd')]);router['post'](_0xac4a('0xe'),controller['oauth2MicrosoftCallback']);module[_0xac4a('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index f8f0197..b14fdb6 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 _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 +var _0xfe1b=['sequelize','exports','STRING','name'];(function(_0x45b380,_0x478cbd){var _0x4cdb76=function(_0x1b6a75){while(--_0x1b6a75){_0x45b380['push'](_0x45b380['shift']());}};_0x4cdb76(++_0x478cbd);}(_0xfe1b,0xa8));var _0xbfe1=function(_0x46a199,_0x4a169e){_0x46a199=_0x46a199-0x0;var _0xd62514=_0xfe1b[_0x46a199];return _0xd62514;};'use strict';var Sequelize=require(_0xbfe1('0x0'));module[_0xbfe1('0x1')]={'name':{'type':Sequelize[_0xbfe1('0x2')],'unique':_0xbfe1('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xbfe1('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xbfe1('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xbfe1('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xbfe1('0x2')]},'postalCode':{'type':Sequelize[_0xbfe1('0x2')]},'city':{'type':Sequelize[_0xbfe1('0x2')]},'country':{'type':Sequelize[_0xbfe1('0x2')]},'email':{'type':Sequelize[_0xbfe1('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xbfe1('0x2')]},'sStreet':{'type':Sequelize[_0xbfe1('0x2')]},'sPostalCode':{'type':Sequelize[_0xbfe1('0x2')]},'sCity':{'type':Sequelize[_0xbfe1('0x2')]},'sCountry':{'type':Sequelize[_0xbfe1('0x2')]},'description':{'type':Sequelize[_0xbfe1('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index aaf475b..434c668 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 _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 +var _0x43bf=['findOne','CmContact','getContacts','nolimit','rimraf','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','Companies','UserProfileResource','error','stack','name','send','CmCompany','describe','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','map','options','include','rows','catch','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','params','addContacts','ids','omit'];(function(_0x1c7e71,_0x3980fe){var _0x261281=function(_0x47f42b){while(--_0x47f42b){_0x1c7e71['push'](_0x1c7e71['shift']());}};_0x261281(++_0x3980fe);}(_0x43bf,0xfd));var _0xf43b=function(_0x2e28a3,_0x4678c2){_0x2e28a3=_0x2e28a3-0x0;var _0x54ec2e=_0x43bf[_0x2e28a3];return _0x54ec2e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf43b('0x0'));var zipdir=require(_0xf43b('0x1'));var jsonpatch=require(_0xf43b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf43b('0x3'));var Mustache=require(_0xf43b('0x4'));var util=require('util');var path=require('path');var sox=require(_0xf43b('0x5'));var csv=require(_0xf43b('0x6'));var ejs=require(_0xf43b('0x7'));var fs=require('fs');var fs_extra=require(_0xf43b('0x8'));var _=require(_0xf43b('0x9'));var squel=require(_0xf43b('0xa'));var crypto=require('crypto');var jsforce=require(_0xf43b('0xb'));var deskjs=require(_0xf43b('0xc'));var toCsv=require(_0xf43b('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf43b('0xd'));var authService=require(_0xf43b('0xe'));var qs=require(_0xf43b('0xf'));var as=require(_0xf43b('0x10'));var hardwareService=require(_0xf43b('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xf43b('0x12'));var config=require(_0xf43b('0x13'));var licenseUtil=require(_0xf43b('0x14'));var db=require(_0xf43b('0x15'))['db'];function respondWithStatusCode(_0x1d7cb5,_0x531459){_0x531459=_0x531459||0xcc;return function(_0x2997b){if(_0x2997b){return _0x1d7cb5[_0xf43b('0x16')](_0x531459);}return _0x1d7cb5[_0xf43b('0x17')](_0x531459)[_0xf43b('0x18')]();};}function respondWithResult(_0x2ba839,_0x8d85b9){_0x8d85b9=_0x8d85b9||0xc8;return function(_0x572109){if(_0x572109){return _0x2ba839['status'](_0x8d85b9)[_0xf43b('0x19')](_0x572109);}};}function respondWithFilteredResult(_0x5387a6,_0x54b6ea){return function(_0x1c11e6){if(_0x1c11e6){var _0x4ba2bc=typeof _0x54b6ea[_0xf43b('0x1a')]===_0xf43b('0x1b')&&typeof _0x54b6ea[_0xf43b('0x1c')]===_0xf43b('0x1b');var _0x50bc9f=_0x1c11e6[_0xf43b('0x1d')];var _0x4efaf5=_0x4ba2bc?0x0:_0x54b6ea[_0xf43b('0x1a')];var _0x43cf32=_0x4ba2bc?_0x1c11e6[_0xf43b('0x1d')]:_0x54b6ea['offset']+_0x54b6ea[_0xf43b('0x1c')];var _0x56ec33;if(_0x43cf32>=_0x50bc9f){_0x43cf32=_0x50bc9f;_0x56ec33=0xc8;}else{_0x56ec33=0xce;}_0x5387a6[_0xf43b('0x17')](_0x56ec33);return _0x5387a6[_0xf43b('0x1e')](_0xf43b('0x1f'),_0x4efaf5+'-'+_0x43cf32+'/'+_0x50bc9f)[_0xf43b('0x19')](_0x1c11e6);}return null;};}function patchUpdates(_0x5ba23f){return function(_0x566b27){try{jsonpatch[_0xf43b('0x20')](_0x566b27,_0x5ba23f,!![]);}catch(_0x434a3d){return BPromise[_0xf43b('0x21')](_0x434a3d);}return _0x566b27[_0xf43b('0x22')]();};}function saveUpdates(_0x52221d,_0x156204){return function(_0x189743){if(_0x189743){return _0x189743[_0xf43b('0x23')](_0x52221d)['then'](function(_0x42ddb7){return _0x42ddb7;});}return null;};}function removeEntity(_0x280ba4,_0x2cb4d2){return function(_0x3568c0){if(_0x3568c0){return _0x3568c0[_0xf43b('0x24')]()[_0xf43b('0x25')](function(){var _0x2c0738=_0x3568c0['get']({'plain':!![]});var _0xca3af=_0xf43b('0x26');return db[_0xf43b('0x27')][_0xf43b('0x24')]({'where':{'type':_0xca3af,'resourceId':_0x2c0738['id']}})['then'](function(){return _0x3568c0;});})[_0xf43b('0x25')](function(){_0x280ba4[_0xf43b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d68c2,_0x382f46){return function(_0x354951){if(!_0x354951){_0x3d68c2[_0xf43b('0x16')](0x194);}return _0x354951;};}function handleError(_0x551a86,_0x503693){_0x503693=_0x503693||0x1f4;return function(_0x112105){logger[_0xf43b('0x28')](_0x112105[_0xf43b('0x29')]);if(_0x112105[_0xf43b('0x2a')]){delete _0x112105[_0xf43b('0x2a')];}_0x551a86[_0xf43b('0x17')](_0x503693)[_0xf43b('0x2b')](_0x112105);};}exports['index']=function(_0x178356,_0x5546da){var _0x45d946={},_0x251ad0={},_0x21bee8={'count':0x0,'rows':[]};return db[_0xf43b('0x2c')][_0xf43b('0x2d')]()['then'](function(_0x36fee5){_0x251ad0[_0xf43b('0x2e')]=_['keys'](_0x36fee5);_0x251ad0[_0xf43b('0x2f')]=_[_0xf43b('0x30')](_0x178356['query']);_0x251ad0['filters']=_[_0xf43b('0x31')](_0x251ad0[_0xf43b('0x2e')],_0x251ad0[_0xf43b('0x2f')]);_0x45d946[_0xf43b('0x32')]=_[_0xf43b('0x31')](_0x251ad0['model'],qs[_0xf43b('0x33')](_0x178356[_0xf43b('0x2f')]['fields']));_0x45d946[_0xf43b('0x32')]=_0x45d946['attributes'][_0xf43b('0x34')]?_0x45d946[_0xf43b('0x32')]:_0x251ad0[_0xf43b('0x2e')];if(!_0x178356[_0xf43b('0x2f')][_0xf43b('0x35')]('nolimit')){_0x45d946['limit']=qs[_0xf43b('0x1c')](_0x178356[_0xf43b('0x2f')]['limit']);_0x45d946['offset']=qs[_0xf43b('0x1a')](_0x178356['query'][_0xf43b('0x1a')]);}_0x45d946['order']=qs[_0xf43b('0x36')](_0x178356['query'][_0xf43b('0x36')]);_0x45d946[_0xf43b('0x37')]=qs[_0xf43b('0x38')](_[_0xf43b('0x39')](_0x178356[_0xf43b('0x2f')],_0x251ad0[_0xf43b('0x38')]),_0x36fee5);if(_0x178356['query'][_0xf43b('0x3a')]){_0x45d946['where']=_[_0xf43b('0x3b')](_0x45d946[_0xf43b('0x37')],{'$or':_[_0xf43b('0x3c')](_0x45d946[_0xf43b('0x32')],function(_0x51f7a4){var _0x122a61={};_0x122a61[_0x51f7a4]={'$like':'%'+_0x178356[_0xf43b('0x2f')]['filter']+'%'};return _0x122a61;})});}_0x45d946=_[_0xf43b('0x3b')]({},_0x45d946,_0x178356[_0xf43b('0x3d')]);var _0x49130f={'where':_0x45d946[_0xf43b('0x37')]};return db[_0xf43b('0x2c')]['count'](_0x49130f)[_0xf43b('0x25')](function(_0x399778){_0x21bee8[_0xf43b('0x1d')]=_0x399778;if(_0x178356[_0xf43b('0x2f')]['includeAll']){_0x45d946[_0xf43b('0x3e')]=[{'all':!![]}];}return db[_0xf43b('0x2c')]['findAll'](_0x45d946);})[_0xf43b('0x25')](function(_0x1ed2a6){_0x21bee8[_0xf43b('0x3f')]=_0x1ed2a6;return _0x21bee8;})['then'](respondWithFilteredResult(_0x5546da,_0x45d946))[_0xf43b('0x40')](handleError(_0x5546da,null));})['catch'](handleError(_0x5546da,null));};exports[_0xf43b('0x41')]=function(_0x22a7e6,_0x303669){var _0x1dbcc7={'raw':![],'where':{'id':_0x22a7e6['params']['id']}},_0x31c95c={};_0x31c95c[_0xf43b('0x2e')]=_[_0xf43b('0x30')](db[_0xf43b('0x2c')]['rawAttributes']);_0x31c95c[_0xf43b('0x2f')]=_['keys'](_0x22a7e6[_0xf43b('0x2f')]);_0x31c95c['filters']=_[_0xf43b('0x31')](_0x31c95c['model'],_0x31c95c[_0xf43b('0x2f')]);_0x1dbcc7[_0xf43b('0x32')]=_[_0xf43b('0x31')](_0x31c95c['model'],qs[_0xf43b('0x33')](_0x22a7e6[_0xf43b('0x2f')]['fields']));_0x1dbcc7[_0xf43b('0x32')]=_0x1dbcc7[_0xf43b('0x32')]['length']?_0x1dbcc7['attributes']:_0x31c95c[_0xf43b('0x2e')];if(_0x22a7e6[_0xf43b('0x2f')]['includeAll']){_0x1dbcc7[_0xf43b('0x3e')]=[{'all':!![]}];}_0x1dbcc7=_[_0xf43b('0x3b')]({},_0x1dbcc7,_0x22a7e6[_0xf43b('0x3d')]);return db[_0xf43b('0x2c')][_0xf43b('0x42')](_0x1dbcc7)['then'](handleEntityNotFound(_0x303669,null))[_0xf43b('0x25')](respondWithResult(_0x303669,null))[_0xf43b('0x40')](handleError(_0x303669,null));};exports[_0xf43b('0x43')]=function(_0x52f2d5,_0x2dc21c){return db[_0xf43b('0x2c')]['create'](_0x52f2d5[_0xf43b('0x44')],{})[_0xf43b('0x25')](function(_0x1d8d93){var _0x21b2bc=_0x52f2d5[_0xf43b('0x45')][_0xf43b('0x46')]({'plain':!![]});if(!_0x21b2bc)throw new Error(_0xf43b('0x47'));if(_0x21b2bc[_0xf43b('0x48')]===_0xf43b('0x45')){var _0xc327d=_0x1d8d93[_0xf43b('0x46')]({'plain':!![]});var _0x5971df=_0xf43b('0x26');return db[_0xf43b('0x49')][_0xf43b('0x42')]({'where':{'name':_0x5971df,'userProfileId':_0x21b2bc['userProfileId']},'raw':!![]})[_0xf43b('0x25')](function(_0x36222e){if(_0x36222e&&_0x36222e[_0xf43b('0x4a')]===0x0){return db['UserProfileResource'][_0xf43b('0x43')]({'name':_0xc327d[_0xf43b('0x2a')],'resourceId':_0xc327d['id'],'type':_0x36222e[_0xf43b('0x2a')],'sectionId':_0x36222e['id']},{})[_0xf43b('0x25')](function(){return _0x1d8d93;});}else{return _0x1d8d93;}})[_0xf43b('0x40')](function(_0x25baf3){logger[_0xf43b('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x25baf3);throw _0x25baf3;});}return _0x1d8d93;})[_0xf43b('0x25')](respondWithResult(_0x2dc21c,0xc9))['catch'](handleError(_0x2dc21c,null));};exports[_0xf43b('0x23')]=function(_0x3460c4,_0x5da273){if(_0x3460c4[_0xf43b('0x44')]['id']){delete _0x3460c4[_0xf43b('0x44')]['id'];}return db[_0xf43b('0x2c')][_0xf43b('0x42')]({'where':{'id':_0x3460c4['params']['id']}})['then'](handleEntityNotFound(_0x5da273,null))[_0xf43b('0x25')](saveUpdates(_0x3460c4[_0xf43b('0x44')],null))['then'](respondWithResult(_0x5da273,null))['catch'](handleError(_0x5da273,null));};exports[_0xf43b('0x24')]=function(_0x532bc6,_0x49d1a2){return db[_0xf43b('0x2c')][_0xf43b('0x42')]({'where':{'id':_0x532bc6[_0xf43b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x49d1a2,null))[_0xf43b('0x25')](removeEntity(_0x49d1a2,null))[_0xf43b('0x40')](handleError(_0x49d1a2,null));};exports[_0xf43b('0x2d')]=function(_0x4234da,_0x1658c2){return db[_0xf43b('0x2c')][_0xf43b('0x2d')]()[_0xf43b('0x25')](respondWithResult(_0x1658c2,null))[_0xf43b('0x40')](handleError(_0x1658c2,null));};exports[_0xf43b('0x4c')]=function(_0x32a1ab,_0x1f7588,_0x40e6a8){return db['CmContact']['find']({'where':{'id':_0x32a1ab[_0xf43b('0x4b')]['id']}})[_0xf43b('0x25')](handleEntityNotFound(_0x1f7588,null))['then'](function(_0xf13ddc){if(_0xf13ddc){return _0xf13ddc['addContacts'](_0x32a1ab[_0xf43b('0x44')][_0xf43b('0x4d')],_[_0xf43b('0x4e')](_0x32a1ab['body'],[_0xf43b('0x4d'),'id'])||{});}})[_0xf43b('0x25')](respondWithResult(_0x1f7588,null))['catch'](handleError(_0x1f7588,null));};exports['getContacts']=function(_0xc27942,_0x157e62,_0x3b83bc){var _0x2ed86c={};var _0x1a27a0={};var _0x296f36;var _0x249e66;return db[_0xf43b('0x2c')][_0xf43b('0x4f')]({'where':{'id':_0xc27942[_0xf43b('0x4b')]['id']}})[_0xf43b('0x25')](handleEntityNotFound(_0x157e62,null))[_0xf43b('0x25')](function(_0x3a20b9){if(_0x3a20b9){_0x296f36=_0x3a20b9;_0x1a27a0[_0xf43b('0x2e')]=_['keys'](db[_0xf43b('0x50')]['rawAttributes']);_0x1a27a0['query']=_[_0xf43b('0x30')](_0xc27942[_0xf43b('0x2f')]);_0x1a27a0[_0xf43b('0x38')]=_[_0xf43b('0x31')](_0x1a27a0[_0xf43b('0x2e')],_0x1a27a0[_0xf43b('0x2f')]);_0x2ed86c['attributes']=_[_0xf43b('0x31')](_0x1a27a0[_0xf43b('0x2e')],qs[_0xf43b('0x33')](_0xc27942[_0xf43b('0x2f')][_0xf43b('0x33')]));_0x2ed86c[_0xf43b('0x32')]=_0x2ed86c[_0xf43b('0x32')][_0xf43b('0x34')]?_0x2ed86c['attributes']:_0x1a27a0[_0xf43b('0x2e')];_0x2ed86c['order']=qs[_0xf43b('0x36')](_0xc27942['query'][_0xf43b('0x36')]);_0x2ed86c[_0xf43b('0x37')]=qs[_0xf43b('0x38')](_[_0xf43b('0x39')](_0xc27942[_0xf43b('0x2f')],_0x1a27a0[_0xf43b('0x38')]));if(_0xc27942['query']['filter']){_0x2ed86c['where']=_[_0xf43b('0x3b')](_0x2ed86c[_0xf43b('0x37')],{'$or':_[_0xf43b('0x3c')](_0x2ed86c[_0xf43b('0x32')],function(_0x11f74e){var _0x86d5d2={};_0x86d5d2[_0x11f74e]={'$like':'%'+_0xc27942[_0xf43b('0x2f')][_0xf43b('0x3a')]+'%'};return _0x86d5d2;})});}_0x2ed86c=_['merge']({},_0x2ed86c,_0xc27942['options']);return _0x296f36[_0xf43b('0x51')](_0x2ed86c);}})[_0xf43b('0x25')](function(_0x49ba3e){if(_0x49ba3e){_0x249e66=_0x49ba3e[_0xf43b('0x34')];if(!_0xc27942['query'][_0xf43b('0x35')](_0xf43b('0x52'))){_0x2ed86c[_0xf43b('0x1c')]=qs[_0xf43b('0x1c')](_0xc27942[_0xf43b('0x2f')][_0xf43b('0x1c')]);_0x2ed86c[_0xf43b('0x1a')]=qs[_0xf43b('0x1a')](_0xc27942[_0xf43b('0x2f')][_0xf43b('0x1a')]);}return _0x296f36['getContacts'](_0x2ed86c);}})['then'](function(_0xa44b29){if(_0xa44b29){return _0xa44b29?{'count':_0x249e66,'rows':_0xa44b29}:null;}})[_0xf43b('0x25')](respondWithResult(_0x157e62,null))[_0xf43b('0x40')](handleError(_0x157e62,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 774826c..ef7ea03 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 _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 +var _0x8c18=['../../config/environment','./cmCompany.attributes','exports','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4b9ba5,_0x34b868){var _0x292a7b=function(_0x18bf6f){while(--_0x18bf6f){_0x4b9ba5['push'](_0x4b9ba5['shift']());}};_0x292a7b(++_0x34b868);}(_0x8c18,0x11d));var _0x88c1=function(_0xacae67,_0x5572c4){_0xacae67=_0xacae67-0x0;var _0x5a07f5=_0x8c18[_0xacae67];return _0x5a07f5;};'use strict';var _=require(_0x88c1('0x0'));var util=require(_0x88c1('0x1'));var logger=require(_0x88c1('0x2'))(_0x88c1('0x3'));var moment=require(_0x88c1('0x4'));var BPromise=require(_0x88c1('0x5'));var rp=require(_0x88c1('0x6'));var fs=require('fs');var path=require(_0x88c1('0x7'));var rimraf=require(_0x88c1('0x8'));var config=require(_0x88c1('0x9'));var attributes=require(_0x88c1('0xa'));module[_0x88c1('0xb')]=function(_0x393bea,_0x4d2683){return _0x393bea['define'](_0x88c1('0xc'),attributes,{'tableName':_0x88c1('0xd'),'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 2c9cce2..79d5988 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 _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 +var _0xce02=['jayson/promise','client','http','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','CmCompany,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4509db,_0x2111ce){var _0x267328=function(_0x587a97){while(--_0x587a97){_0x4509db['push'](_0x4509db['shift']());}};_0x267328(++_0x2111ce);}(_0xce02,0x146));var _0x2ce0=function(_0x836465,_0x5442ae){_0x836465=_0x836465-0x0;var _0x2150ea=_0xce02[_0x836465];return _0x2150ea;};'use strict';var _=require(_0x2ce0('0x0'));var util=require(_0x2ce0('0x1'));var moment=require(_0x2ce0('0x2'));var BPromise=require(_0x2ce0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ce0('0x4'));var db=require(_0x2ce0('0x5'))['db'];var utils=require(_0x2ce0('0x6'));var logger=require(_0x2ce0('0x7'))(_0x2ce0('0x8'));var config=require(_0x2ce0('0x9'));var jayson=require(_0x2ce0('0xa'));var client=jayson[_0x2ce0('0xb')][_0x2ce0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x418751,_0x56c29c,_0x522b3a){return new BPromise(function(_0x98f346,_0x47b98e){return client['request'](_0x418751,_0x522b3a)[_0x2ce0('0xd')](function(_0x18ed4c){logger[_0x2ce0('0xe')]('CmCompany,\x20%s,\x20%s',_0x56c29c,_0x2ce0('0xf'));logger[_0x2ce0('0x10')](_0x2ce0('0x11'),_0x56c29c,_0x2ce0('0xf'),JSON['stringify'](_0x18ed4c));if(_0x18ed4c[_0x2ce0('0x12')]){if(_0x18ed4c['error'][_0x2ce0('0x13')]===0x1f4){logger[_0x2ce0('0x12')]('CmCompany,\x20%s,\x20%s',_0x56c29c,_0x18ed4c[_0x2ce0('0x12')][_0x2ce0('0x14')]);return _0x47b98e(_0x18ed4c[_0x2ce0('0x12')][_0x2ce0('0x14')]);}logger[_0x2ce0('0x12')](_0x2ce0('0x15'),_0x56c29c,_0x18ed4c['error'][_0x2ce0('0x14')]);return _0x98f346(_0x18ed4c[_0x2ce0('0x12')][_0x2ce0('0x14')]);}else{logger[_0x2ce0('0xe')](_0x2ce0('0x15'),_0x56c29c,_0x2ce0('0xf'));_0x98f346(_0x18ed4c[_0x2ce0('0x16')][_0x2ce0('0x14')]);}})[_0x2ce0('0x17')](function(_0x366962){logger[_0x2ce0('0x12')](_0x2ce0('0x15'),_0x56c29c,_0x366962);_0x47b98e(_0x366962);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 501df8a..0689383 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 _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 +var _0xcdf2=['../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','/describe','describe','show','/:id/contacts','getContacts','post','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service'];(function(_0x40f279,_0xb9d09f){var _0x4f866e=function(_0x182f3d){while(--_0x182f3d){_0x40f279['push'](_0x40f279['shift']());}};_0x4f866e(++_0xb9d09f);}(_0xcdf2,0x9b));var _0x2cdf=function(_0x1d1219,_0x23fc71){_0x1d1219=_0x1d1219-0x0;var _0x5b5b89=_0xcdf2[_0x1d1219];return _0x5b5b89;};'use strict';var multer=require(_0x2cdf('0x0'));var util=require(_0x2cdf('0x1'));var path=require(_0x2cdf('0x2'));var timeout=require(_0x2cdf('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2cdf('0x4'));var interaction=require(_0x2cdf('0x5'));var config=require(_0x2cdf('0x6'));var controller=require(_0x2cdf('0x7'));router['get']('/',auth[_0x2cdf('0x8')](),controller['index']);router['get'](_0x2cdf('0x9'),auth[_0x2cdf('0x8')](),controller[_0x2cdf('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x2cdf('0xb')]);router['get'](_0x2cdf('0xc'),auth[_0x2cdf('0x8')](),controller[_0x2cdf('0xd')]);router[_0x2cdf('0xe')]('/',auth['isAuthenticated'](),controller[_0x2cdf('0xf')]);router['post'](_0x2cdf('0xc'),auth[_0x2cdf('0x8')](),controller['addContacts']);router[_0x2cdf('0x10')](_0x2cdf('0x11'),auth[_0x2cdf('0x8')](),controller['update']);router['delete'](_0x2cdf('0x11'),auth[_0x2cdf('0x8')](),controller[_0x2cdf('0x12')]);module[_0x2cdf('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index e49ad6a..6cdae4a 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 _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 +var _0x4d8f=['UNSIGNED','DATE','NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER'];(function(_0x2a8809,_0x121836){var _0x166dab=function(_0x2bd619){while(--_0x2bd619){_0x2a8809['push'](_0x2a8809['shift']());}};_0x166dab(++_0x121836);}(_0x4d8f,0x147));var _0xf4d8=function(_0x15dbdf,_0x2bd8ce){_0x15dbdf=_0x15dbdf-0x0;var _0x40c804=_0x4d8f[_0x15dbdf];return _0x40c804;};'use strict';var _=require(_0xf4d8('0x0'));var Sequelize=require(_0xf4d8('0x1'));module[_0xf4d8('0x2')]={'firstName':{'type':Sequelize[_0xf4d8('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xf4d8('0x3')]},'city':{'type':Sequelize[_0xf4d8('0x3')]},'country':{'type':Sequelize[_0xf4d8('0x3')]},'dateOfBirth':{'type':Sequelize[_0xf4d8('0x3')]},'description':{'type':Sequelize[_0xf4d8('0x4')]},'phone':{'type':Sequelize[_0xf4d8('0x3')]},'mobile':{'type':Sequelize[_0xf4d8('0x3')]},'fax':{'type':Sequelize[_0xf4d8('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xf4d8('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xf4d8('0x3')]},'twitter':{'type':Sequelize[_0xf4d8('0x3')]},'skype':{'type':Sequelize[_0xf4d8('0x3')]},'teams':{'type':Sequelize[_0xf4d8('0x3')]},'viber':{'type':Sequelize[_0xf4d8('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xf4d8('0x3')]},'telegram':{'type':Sequelize[_0xf4d8('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xf4d8('0x5')](0x2)[_0xf4d8('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xf4d8('0x7')],'defaultValue':Sequelize[_0xf4d8('0x8')]},'dialTimezone':{'type':Sequelize[_0xf4d8('0x3')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index b9ce6fa..0fe9c79 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 _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 +var _0x37bc=['rawAttributes','pick','ContactId','include','CmHopperHistory','includeAll','rows','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','split','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','root','server/files/tmp','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','send','upload','createReadStream','parse','file','meta','agent','binding','socket_timestamp','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','User','firstName','../../components/import/cm/csvUpdates','mail','chat','sms','fax','whatsapp','voice','-createdAt','resolve','includes','channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','source','destination','callerid','duration','note','createdAt','userSecondDisposition','UserId','fullname','alias','DESC','Website','closed','disposition','secondDisposition','thirdDisposition','Account','key','Owner','browserName','customerIp','deviceModel','osName','ratingMessage','ratingValue','referer','subject','substatus','openchannel','externalUrl','threadId','startCase','reverse','slice','moment','bluebird','util','path','lodash','squel','ioredis','api','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','status','json','offset','undefined','count','limit','set','Content-Range','destroy','then','end','sendStatus','stack','name','index','describe','getOptions','findAll','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','columnName','query','analytics','CmCustomField','length','custom','type','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','merge','body','get','mergeWith','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','from','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','CmContactHasItem','CmHopperFinal','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isArray','join','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','push','where','ListId','spread','hasOwnProperty','contact','all','show','Tag','Tags','color','tag','Phones','ContactItemType','literal','Phones.OrderBy','$and','omit','pickBy','format','cf_%d','isEmpty','cm_contacts','setFields','toParam','text','values','phone','findOne','filters','intersection','model','fields','attributes','order','sort','filter','map','options','getTags','nolimit','setTags','ids','setAdditionalPhones','items','item_types','ItemTypeId','description','OrderBy','PHONE','CmHopperAdditionalPhone','`ItemType`.OrderBy','CmHopperId','item','ItemType.OrderBy','ItemType','getAdditionalPhones','sequelize','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers'];(function(_0x45406b,_0x5d1136){var _0x4e3cdd=function(_0x253a1e){while(--_0x253a1e){_0x45406b['push'](_0x45406b['shift']());}};_0x4e3cdd(++_0x5d1136);}(_0x37bc,0x15f));var _0xc37b=function(_0x192ed5,_0x1b3974){_0x192ed5=_0x192ed5-0x0;var _0x3f178b=_0x37bc[_0x192ed5];return _0x3f178b;};'use strict';var moment=require(_0xc37b('0x0'));var BPromise=require(_0xc37b('0x1'));var util=require(_0xc37b('0x2'));var path=require(_0xc37b('0x3'));var fs=require('fs');var _=require(_0xc37b('0x4'));var squel=require(_0xc37b('0x5'));var Papa=require('papaparse');var Redis=require(_0xc37b('0x6'));var contacts=require('../../components/contacts');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xc37b('0x7'));var config=require('../../config/environment');var shared=require(_0xc37b('0x8'));var db=require(_0xc37b('0x9'))['db'];config[_0xc37b('0xa')]=_[_0xc37b('0xb')](config['redis'],{'host':_0xc37b('0xc'),'port':0x18eb});var socket=require(_0xc37b('0xd'))(new Redis(config[_0xc37b('0xa')]));require(_0xc37b('0xe'))['register'](socket);function respondWithResult(_0xea9e81,_0xc4234f){_0xc4234f=_0xc4234f||0xc8;return function(_0x60e9a5){if(_0x60e9a5){return _0xea9e81[_0xc37b('0xf')](_0xc4234f)[_0xc37b('0x10')](_0x60e9a5);}};}function respondWithFilteredResult(_0x2684de,_0x4aeeb5){return function(_0x209585){if(_0x209585){var _0x52085d=typeof _0x4aeeb5[_0xc37b('0x11')]===_0xc37b('0x12')&&typeof _0x4aeeb5['limit']===_0xc37b('0x12');var _0x204c7c=_0x209585[_0xc37b('0x13')];var _0xb09fa2=_0x52085d?0x0:_0x4aeeb5[_0xc37b('0x11')];var _0xaa4bfa=_0x52085d?_0x209585[_0xc37b('0x13')]:_0x4aeeb5[_0xc37b('0x11')]+_0x4aeeb5[_0xc37b('0x14')];var _0x2f2bd1;if(_0xaa4bfa>=_0x204c7c){_0xaa4bfa=_0x204c7c;_0x2f2bd1=0xc8;}else{_0x2f2bd1=0xce;}_0x2684de[_0xc37b('0xf')](_0x2f2bd1);return _0x2684de[_0xc37b('0x15')](_0xc37b('0x16'),_0xb09fa2+'-'+_0xaa4bfa+'/'+_0x204c7c)[_0xc37b('0x10')](_0x209585);}return null;};}function saveUpdates(_0x3ddfb8){return function(_0x89c8a8){if(_0x89c8a8){return _0x89c8a8['update'](_0x3ddfb8)['then'](function(_0x587f99){return _0x587f99;});}return null;};}function removeEntity(_0x12a776){return function(_0x471054){if(_0x471054){return _0x471054[_0xc37b('0x17')]()[_0xc37b('0x18')](function(){_0x12a776[_0xc37b('0xf')](0xcc)[_0xc37b('0x19')]();});}};}function handleEntityNotFound(_0x425a77){return function(_0x31ae38){if(!_0x31ae38){_0x425a77[_0xc37b('0x1a')](0x194);}return _0x31ae38;};}function handleError(_0xc15854,_0x2bde68){_0x2bde68=_0x2bde68||0x1f4;return function(_0x5a3188){logger['error'](_0x5a3188[_0xc37b('0x1b')]);if(_0x5a3188[_0xc37b('0x1c')]){delete _0x5a3188[_0xc37b('0x1c')];}_0xc15854[_0xc37b('0xf')](_0x2bde68)['send'](_0x5a3188);};}exports[_0xc37b('0x1d')]=function(_0x251d65,_0xe4449){var _0x29234e={};return contacts[_0xc37b('0x1e')]()[_0xc37b('0x18')](function(_0x4fc52c){_0x29234e=qs[_0xc37b('0x1f')](_0x4fc52c,_0x251d65);return contacts[_0xc37b('0x20')](_0x251d65['query'],_0x251d65[_0xc37b('0x21')],_0x29234e,_0x4fc52c);})[_0xc37b('0x18')](respondWithFilteredResult(_0xe4449,_0x29234e))[_0xc37b('0x22')](handleError(_0xe4449,null));};exports[_0xc37b('0x17')]=function(_0x3da7b8,_0x27b0ed){return db[_0xc37b('0x23')][_0xc37b('0x24')]({'where':{'id':_0x3da7b8[_0xc37b('0x25')]['id']}})[_0xc37b('0x18')](handleEntityNotFound(_0x27b0ed,null))['then'](removeEntity(_0x27b0ed,null))['catch'](handleError(_0x27b0ed,null));};exports[_0xc37b('0x1e')]=function(_0x30f0bf,_0x56acf8){return db[_0xc37b('0x23')]['describe']()[_0xc37b('0x18')](function(_0x682ae7){delete _0x682ae7[_0xc37b('0x26')];for(var _0x5e0de8=0x0;_0x5e0de80x0){return new Promise(function(_0xf53dbe){var _0x3642c0=[];for(var _0x166ac6=0x0;_0x166ac6<_0x3fdfe4['length'];_0x166ac6++){_0x3642c0[_0xc37b('0x5d')](insertAdditionalPhones(_0x3fdfe4[_0x166ac6][_0xc37b('0x62')],_0x3fdfe4[_0x166ac6]['additionalPhones']));}Promise[_0xc37b('0x63')](_0x3642c0)[_0xc37b('0x18')](function(){_0xf53dbe(0x1);});})[_0xc37b('0x18')](function(){return{'success':_0x1a8cbc,'failure':_0x25d6c2,'duplicates':_0x4e9efe};});}else{return{'success':_0x1a8cbc,'failure':_0x25d6c2,'duplicates':_0x4e9efe};}}})['then'](respondWithResult(_0x10600a,0xc9))[_0xc37b('0x22')](handleError(_0x10600a,null));};exports[_0xc37b('0x64')]=function(_0x13dd90,_0x18bbd9){var _0x198e91;return db[_0xc37b('0x23')][_0xc37b('0x1e')]()[_0xc37b('0x18')](function(_0x26b08c){return db['CmContact'][_0xc37b('0x24')]({'where':{'id':_0x13dd90[_0xc37b('0x25')]['id']},'include':[{'model':db[_0xc37b('0x65')],'as':_0xc37b('0x66'),'attributes':['id',_0xc37b('0x1c'),_0xc37b('0x67')],'required':_0x13dd90[_0xc37b('0x2b')][_0xc37b('0x68')]?!![]:![]},{'model':db[_0xc37b('0x47')],'as':_0xc37b('0x69'),'where':{'CmContactId':_0x13dd90[_0xc37b('0x25')]['id']},'required':![],'include':[{'model':db[_0xc37b('0x6a')],'as':'ItemType'}]}],'order':[db['sequelize'][_0xc37b('0x6b')](_0xc37b('0x6c'))],'attributes':_[_0xc37b('0x27')](_0x26b08c)});})[_0xc37b('0x18')](function(_0x33c091){if(!_[_0xc37b('0x55')](_0x33c091)){_0x198e91=_0x33c091[_0xc37b('0x35')]({'plain':!![]});var _0x4f2b86={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x33c091&&_0x33c091[_0xc37b('0x5f')]){if(_0x33c091[_0xc37b('0x5f')]){_0x4f2b86[_0xc37b('0x5e')][_0xc37b('0x6d')][_0xc37b('0x5d')]({'ListId':{'$ne':_0x33c091['ListId']}});}}return db['CmCustomField'][_0xc37b('0x20')](_0x4f2b86);}})['then'](function(_0x4b4f20){if(!_[_0xc37b('0x55')](_0x4b4f20)){return _[_0xc37b('0x6e')](_0x198e91,_['map'](_0x4b4f20,function(_0x434901){return util['format']('cf_%d',_0x434901['id']);}));}})[_0xc37b('0x18')](handleEntityNotFound(_0x18bbd9,null))[_0xc37b('0x18')](respondWithResult(_0x18bbd9,null))[_0xc37b('0x22')](handleError(_0x18bbd9,null));};exports[_0xc37b('0x3f')]=function(_0x379324,_0x42b1d7){var _0x237a2b;if(_0x379324['body']['id']){delete _0x379324['body']['id'];}if(!_['isNil'](_0x379324[_0xc37b('0x34')][_0xc37b('0x56')])){var _0xdd88d3=_0x379324[_0xc37b('0x34')]['dialTimezone'];if(!_[_0xc37b('0x55')](shared['timezones'][_0xdd88d3]))_0x379324[_0xc37b('0x34')][_0xc37b('0x58')]=shared['timezones'][_0xdd88d3][_0xc37b('0x58')];}return db['CmContact'][_0xc37b('0x24')]({'where':{'id':_0x379324['params']['id']}})[_0xc37b('0x18')](handleEntityNotFound(_0x42b1d7,null))[_0xc37b('0x18')](saveUpdates(_0x379324[_0xc37b('0x34')],null))[_0xc37b('0x18')](function(_0x3e8808){_0x237a2b=_0x3e8808;var _0x503daa={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3e8808&&_0x3e8808[_0xc37b('0x5f')]){if(_0x3e8808['ListId']){_0x503daa['where'][_0xc37b('0x6d')][_0xc37b('0x5d')]({'ListId':{'$ne':_0x3e8808['ListId']}});}}return db[_0xc37b('0x2d')][_0xc37b('0x20')](_0x503daa);})[_0xc37b('0x18')](function(_0x204780){if(_0x204780){return _['omit'](_[_0xc37b('0x6f')](_0x379324[_0xc37b('0x34')],function(_0x123cb4,_0x2e341c){return _[_0xc37b('0x28')](_0x2e341c,'cf_');}),_['map'](_0x204780,function(_0x2ed46e){return util[_0xc37b('0x70')](_0xc37b('0x71'),_0x2ed46e['id']);}));}})[_0xc37b('0x18')](function(_0x459516){if(_0x459516&&!_[_0xc37b('0x72')](_0x459516)){var _0x1716f7=squel[_0xc37b('0x3f')]()['table'](_0xc37b('0x73'))[_0xc37b('0x74')](_0x459516)[_0xc37b('0x5e')]('id\x20=\x20?',_0x379324['params']['id'])[_0xc37b('0x75')]();return db['sequelize'][_0xc37b('0x2b')](_0x1716f7[_0xc37b('0x76')],{'replacements':_0x1716f7[_0xc37b('0x77')]});}})[_0xc37b('0x18')](function(){if(_0x379324['body'][_0xc37b('0x78')]&&_0x237a2b){return db[_0xc37b('0x3a')][_0xc37b('0x3f')]({'phone':_0x379324[_0xc37b('0x34')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x237a2b['id']}});}})[_0xc37b('0x18')](function(){return _0x237a2b;})[_0xc37b('0x18')](respondWithResult(_0x42b1d7,null))[_0xc37b('0x22')](handleError(_0x42b1d7,null));};exports['getTags']=function(_0x38b6c7,_0x50a517){var _0x2cb6ca={};var _0x7354b7={};var _0x1d5824;var _0x122fbc;return db['CmContact'][_0xc37b('0x79')]({'where':{'id':_0x38b6c7[_0xc37b('0x25')]['id']}})[_0xc37b('0x18')](handleEntityNotFound(_0x50a517,null))[_0xc37b('0x18')](function(_0x8bfb5c){if(_0x8bfb5c){_0x1d5824=_0x8bfb5c;_0x7354b7['model']=_[_0xc37b('0x27')](db['Tag']['rawAttributes']);_0x7354b7['query']=_[_0xc37b('0x27')](_0x38b6c7['query']);_0x7354b7[_0xc37b('0x7a')]=_[_0xc37b('0x7b')](_0x7354b7[_0xc37b('0x7c')],_0x7354b7['query']);_0x2cb6ca['attributes']=_['intersection'](_0x7354b7[_0xc37b('0x7c')],qs[_0xc37b('0x7d')](_0x38b6c7[_0xc37b('0x2b')][_0xc37b('0x7d')]));_0x2cb6ca[_0xc37b('0x7e')]=_0x2cb6ca[_0xc37b('0x7e')][_0xc37b('0x2e')]?_0x2cb6ca['attributes']:_0x7354b7[_0xc37b('0x7c')];_0x2cb6ca[_0xc37b('0x7f')]=qs[_0xc37b('0x80')](_0x38b6c7[_0xc37b('0x2b')][_0xc37b('0x80')]);_0x2cb6ca['where']=qs['filters'](_['pick'](_0x38b6c7[_0xc37b('0x2b')],_0x7354b7[_0xc37b('0x7a')]));if(_0x38b6c7[_0xc37b('0x2b')][_0xc37b('0x81')]){_0x2cb6ca['where']=_[_0xc37b('0x33')](_0x2cb6ca[_0xc37b('0x5e')],{'$or':_[_0xc37b('0x82')](_0x2cb6ca[_0xc37b('0x7e')],function(_0x1ae472){var _0x27a7fe={};_0x27a7fe[_0x1ae472]={'$like':'%'+_0x38b6c7[_0xc37b('0x2b')][_0xc37b('0x81')]+'%'};return _0x27a7fe;})});}_0x2cb6ca=_[_0xc37b('0x33')]({},_0x2cb6ca,_0x38b6c7[_0xc37b('0x83')]);return _0x1d5824[_0xc37b('0x84')](_0x2cb6ca);}})[_0xc37b('0x18')](function(_0x5f473a){if(_0x5f473a){_0x122fbc=_0x5f473a[_0xc37b('0x2e')];if(!_0x38b6c7[_0xc37b('0x2b')]['hasOwnProperty'](_0xc37b('0x85'))){_0x2cb6ca[_0xc37b('0x14')]=qs[_0xc37b('0x14')](_0x38b6c7[_0xc37b('0x2b')][_0xc37b('0x14')]);_0x2cb6ca[_0xc37b('0x11')]=qs[_0xc37b('0x11')](_0x38b6c7[_0xc37b('0x2b')][_0xc37b('0x11')]);}return _0x1d5824['getTags'](_0x2cb6ca);}})['then'](function(_0x2db0f2){if(_0x2db0f2){return _0x2db0f2?{'count':_0x122fbc,'rows':_0x2db0f2}:null;}})[_0xc37b('0x18')](respondWithResult(_0x50a517,null))[_0xc37b('0x22')](handleError(_0x50a517,null));};exports[_0xc37b('0x86')]=function(_0x48ef56,_0x236f82){if(_0x48ef56[_0xc37b('0x34')]['id']){delete _0x48ef56[_0xc37b('0x34')]['id'];}return db[_0xc37b('0x23')][_0xc37b('0x79')]({'where':{'id':_0x48ef56[_0xc37b('0x25')]['id']}})[_0xc37b('0x18')](handleEntityNotFound(_0x236f82,null))['then'](function(_0x22e854){if(_0x22e854){return _0x22e854[_0xc37b('0x86')](_0x48ef56[_0xc37b('0x34')][_0xc37b('0x87')]||[]);}return null;})[_0xc37b('0x18')](respondWithResult(_0x236f82,null))[_0xc37b('0x22')](handleError(_0x236f82,null));};exports[_0xc37b('0x88')]=function(_0x224bc7,_0x1414b5){var _0x45b624=[];_0x45b624['push'](addAdditionalPhones(_0x224bc7[_0xc37b('0x34')]));Promise['all'](_0x45b624)['then'](function(){_0x45b624=[];_0x45b624['push'](deleteCmHopperPhones(_0x224bc7[_0xc37b('0x34')]['id']));_0x45b624[_0xc37b('0x5d')](addCmHopperPhones(_0x224bc7[_0xc37b('0x34')]['id']));Promise[_0xc37b('0x63')](_0x45b624)[_0xc37b('0x18')](function(){return[0x1];})[_0xc37b('0x18')](respondWithResult(_0x1414b5,null));});};function addAdditionalPhones(_0x42e82b){var _0x283b18;return new Promise(function(_0x1b3fc6){return db[_0xc37b('0x47')]['destroy']({'where':{'CmContactId':_0x42e82b['id']}})[_0xc37b('0x18')](function(){db[_0xc37b('0x6a')][_0xc37b('0x20')]({'raw':!![],'attributes':['id','OrderBy']})['then'](function(_0x451017){var _0x663457=[];for(var _0x39dcdc=0x0;_0x39dcdc<_0x42e82b[_0xc37b('0x89')]['length'];_0x39dcdc++){var _0x100068=_0x42e82b[_0xc37b('0x8a')]?_[_0xc37b('0x55')](_0x42e82b[_0xc37b('0x8a')][_0x39dcdc])?'':_0x42e82b[_0xc37b('0x8a')][_0x39dcdc]:_0x42e82b[_0xc37b('0x89')][_0x39dcdc][_0xc37b('0x8b')]?_0x42e82b['items'][_0x39dcdc][_0xc37b('0x8b')]:'';var _0x423969=_[_0xc37b('0x55')](_0x42e82b[_0xc37b('0x89')][_0x39dcdc][_0xc37b('0x8c')])?'':_0x42e82b[_0xc37b('0x89')][_0x39dcdc][_0xc37b('0x8c')];var _0x1d8936=_0x100068+':'+_0x42e82b[_0xc37b('0x89')][_0x39dcdc][_0xc37b('0x78')]+'§'+_0x423969;if(_[_0xc37b('0x55')](_0x283b18))_0x283b18=_0x1d8936;else _0x283b18+=';'+_0x1d8936;var _0x8c7c98=null;var _0x4882f9=null;if(_0x42e82b[_0xc37b('0x8a')]){if(!_[_0xc37b('0x55')](_0x42e82b['item_types'][_0x39dcdc])){_0x4882f9=_[_0xc37b('0x24')](_0x451017,function(_0x41443f){return _0x41443f['id']===_0x42e82b[_0xc37b('0x8a')][_0x39dcdc];});if(!_[_0xc37b('0x55')](_0x4882f9)){_0x8c7c98=_0x4882f9[_0xc37b('0x8d')];}}}else{if(!_['isNil'](_0x42e82b[_0xc37b('0x89')][_0x39dcdc])){_0x4882f9=_[_0xc37b('0x24')](_0x451017,function(_0x55e78a){return _0x55e78a['id']===_0x42e82b[_0xc37b('0x89')][_0x39dcdc]['ItemTypeId'];});if(!_[_0xc37b('0x55')](_0x4882f9)){_0x8c7c98=_0x39dcdc;}}}if(_[_0xc37b('0x55')](_0x8c7c98)){_0x8c7c98=0x64;}_0x663457[_0xc37b('0x5d')](addAdditionalPhone(_0x42e82b['id'],_0x42e82b[_0xc37b('0x89')][_0x39dcdc][_0xc37b('0x78')],_0x42e82b[_0xc37b('0x8a')]?_[_0xc37b('0x55')](_0x42e82b[_0xc37b('0x8a')][_0x39dcdc])?null:_0x42e82b[_0xc37b('0x8a')][_0x39dcdc]:_0x42e82b['items'][_0x39dcdc][_0xc37b('0x8b')]?_0x42e82b[_0xc37b('0x89')][_0x39dcdc][_0xc37b('0x8b')]:null,_0x8c7c98,_0x423969));}Promise[_0xc37b('0x63')](_0x663457)['then'](function(){db[_0xc37b('0x23')][_0xc37b('0x3f')]({'AdditionalPhones':_0x283b18},{'where':{'id':_0x42e82b['id']}})[_0xc37b('0x18')](function(){_0x1b3fc6(0x1);});});});});});}function addAdditionalPhone(_0x502c0b,_0x1d18df,_0x3a2255,_0x3c9069,_0x22bd7b){return db[_0xc37b('0x47')][_0xc37b('0x24')]({'where':{'CmContactId':_0x502c0b,'item':_0x1d18df}})[_0xc37b('0x18')](function(_0x455cbd){if(_0x455cbd)logger[_0xc37b('0x37')]('contact\x20phone\x20exists',_0x455cbd);else{db['CmContactHasItem']['create']({'CmContactId':_0x502c0b,'item':_0x1d18df,'ItemTypeId':_0x3a2255,'OrderBy':_0x3c9069,'ItemClass':_0xc37b('0x8e'),'description':_0x22bd7b});}});}function deleteCmHopperPhones(_0x665cf4){return new Promise(function(_0x3c052e){return db[_0xc37b('0x3a')][_0xc37b('0x20')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x665cf4}})[_0xc37b('0x18')](function(_0x23bdd8){db[_0xc37b('0x8f')][_0xc37b('0x17')]({'where':{'CmHopperId':{'$in':_['map'](_0x23bdd8,'id')}}});})[_0xc37b('0x18')](function(){_0x3c052e(0x1);});});}function addCmHopperPhones(_0x20f858){return new Promise(function(_0x1c93c2){return db['CmHopper'][_0xc37b('0x20')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x20f858}})[_0xc37b('0x18')](function(_0x2e1df5){var _0x38f227=[];_[_0xc37b('0x82')](_0x2e1df5,function(_0x32c319){_0x38f227[_0xc37b('0x5d')](createCmHopperPhone(_0x20f858,_0x32c319['id']));});Promise[_0xc37b('0x63')](_0x38f227)['then'](function(){_0x1c93c2(0x1);});});});}function createCmHopperPhone(_0x491906,_0x17b36c){return new Promise(function(_0x249fc4){db[_0xc37b('0x47')][_0xc37b('0x20')]({'raw':!![],'attributes':['item',_0xc37b('0x8d')],'where':{'CmContactId':_0x491906,'ItemClass':_0xc37b('0x8e')},'include':[{'model':db[_0xc37b('0x6a')],'attributes':['OrderBy'],'as':'ItemType'}],'order':[_0xc37b('0x8d'),db['sequelize'][_0xc37b('0x6b')](_0xc37b('0x90'))]})[_0xc37b('0x18')](function(_0x3bbb31){var _0x164e90=0x1;var _0x317817=_['map'](_0x3bbb31,function(_0x440b4c){_0x440b4c[_0xc37b('0x91')]=_0x17b36c;_0x440b4c[_0xc37b('0x78')]=_0x440b4c[_0xc37b('0x92')];_0x440b4c['OrderBy']=_0x164e90;delete _0x440b4c[_0xc37b('0x93')];_0x164e90=_0x164e90+0x1;return _0x440b4c;});return db['CmHopperAdditionalPhone'][_0xc37b('0x5a')](_0x317817,{});})[_0xc37b('0x18')](function(){_0x249fc4(0x1);});});}function insertAdditionalPhones(_0x3986f7,_0x5a3c11){return new Promise(function(_0x2603af){var _0x4de61f=[];for(var _0x742969=0x0;_0x742969<_0x5a3c11['length'];_0x742969++){var _0x393c0f=_0x5a3c11[_0x742969];_0x4de61f[_0xc37b('0x5d')](parseContactItemType(_0x393c0f));}Promise['all'](_0x4de61f)[_0xc37b('0x18')](function(){var _0x48a08b={'id':_0x3986f7['id'],'items':_0x5a3c11};return addAdditionalPhones(_0x48a08b)[_0xc37b('0x18')](function(){return addCmHopperPhones(_0x3986f7['id']);});})[_0xc37b('0x18')](function(){_0x2603af(_0x3986f7);});});}function parseContactItemType(_0x3f0e83){return new Promise(function(_0x3cb31d){if(_0x3f0e83['hasOwnProperty']('ItemTypeId')){_0x3cb31d(_0x3f0e83);}else{return db[_0xc37b('0x6a')][_0xc37b('0x24')]({'where':{'name':_0x3f0e83[_0xc37b('0x94')]}})['then'](function(_0xba54aa){if(_[_0xc37b('0x55')](_0xba54aa))_0x3f0e83[_0xc37b('0x8b')]=null;else _0x3f0e83[_0xc37b('0x8b')]=_0xba54aa['id'];_0x3cb31d(_0x3f0e83);});}});}exports[_0xc37b('0x95')]=function(_0x19b476,_0x30e664){return db[_0xc37b('0x47')][_0xc37b('0x20')]({'raw':!![],'where':{'CmContactId':_0x19b476[_0xc37b('0x25')]['id'],'ItemClass':_0xc37b('0x8e')},'include':[{'model':db[_0xc37b('0x6a')],'as':_0xc37b('0x94')}],'order':[[_0xc37b('0x8d')],[db[_0xc37b('0x96')][_0xc37b('0x6b')]('`ItemType`.OrderBy')]]})[_0xc37b('0x18')](function(_0x121302){return _0x121302;})[_0xc37b('0x18')](respondWithResult(_0x30e664,null))[_0xc37b('0x22')](handleError(_0x30e664,null));};exports['duplicateAdditionalPhones']=function(_0x43b933,_0x2e257a){return db[_0xc37b('0x47')][_0xc37b('0x20')]({'raw':!![],'where':{'CmContactId':_0x43b933[_0xc37b('0x34')][_0xc37b('0x97')]}})[_0xc37b('0x18')](function(_0x24fd76){var _0x3bfc81=_[_0xc37b('0x82')](_0x24fd76,function(_0x264a85){_0x264a85[_0xc37b('0x98')]=_0x43b933[_0xc37b('0x34')]['toContactId'];return _0x264a85;});return db[_0xc37b('0x47')]['bulkCreate'](_0x3bfc81,{});})['then'](function(){return addCmHopperPhones(_0x43b933['body'][_0xc37b('0x99')]);})[_0xc37b('0x18')](function(){return['ok'];})[_0xc37b('0x18')](respondWithResult(_0x2e257a,null))[_0xc37b('0x22')](handleError(_0x2e257a,null));};exports[_0xc37b('0x9a')]=function(_0x701ed4,_0x4e0d62){var _0x201d9e=[];_0x201d9e[_0xc37b('0x5d')](createCmHopperPhone(_0x701ed4[_0xc37b('0x34')]['id'],_0x701ed4[_0xc37b('0x34')][_0xc37b('0x9b')]));Promise[_0xc37b('0x63')](_0x201d9e)[_0xc37b('0x18')](function(){return[0x1];})[_0xc37b('0x18')](respondWithResult(_0x4e0d62,null));};exports[_0xc37b('0x9c')]=function(_0x25acec,_0xb68ecc){var _0x3a56c3={'raw':![],'where':{}};var _0x4af625={};var _0x3c08c5={'count':0x0,'rows':[]};return db[_0xc37b('0x23')][_0xc37b('0x79')]({'where':{'id':_0x25acec[_0xc37b('0x25')]['id']}})['then'](handleEntityNotFound(_0xb68ecc,null))[_0xc37b('0x18')](function(_0x2c49f4){if(_0x2c49f4){_0x4af625[_0xc37b('0x7c')]=_[_0xc37b('0x27')](db[_0xc37b('0x3a')][_0xc37b('0x9d')]);_0x4af625[_0xc37b('0x2b')]=_['keys'](_0x25acec[_0xc37b('0x2b')]);_0x4af625[_0xc37b('0x7a')]=_[_0xc37b('0x7b')](_0x4af625[_0xc37b('0x7c')],_0x4af625['query']);_0x3a56c3[_0xc37b('0x7e')]=_[_0xc37b('0x7b')](_0x4af625[_0xc37b('0x7c')],qs[_0xc37b('0x7d')](_0x25acec[_0xc37b('0x2b')][_0xc37b('0x7d')]));_0x3a56c3[_0xc37b('0x7e')]=_0x3a56c3['attributes'][_0xc37b('0x2e')]?_0x3a56c3[_0xc37b('0x7e')]:_0x4af625[_0xc37b('0x7c')];if(!_0x25acec['query'][_0xc37b('0x61')]('nolimit')){_0x3a56c3[_0xc37b('0x14')]=qs['limit'](_0x25acec[_0xc37b('0x2b')]['limit']);_0x3a56c3[_0xc37b('0x11')]=qs[_0xc37b('0x11')](_0x25acec[_0xc37b('0x2b')][_0xc37b('0x11')]);}_0x3a56c3[_0xc37b('0x7f')]=qs[_0xc37b('0x80')](_0x25acec['query'][_0xc37b('0x80')]);_0x3a56c3[_0xc37b('0x5e')]=qs[_0xc37b('0x7a')](_[_0xc37b('0x9e')](_0x25acec['query'],_0x4af625[_0xc37b('0x7a')]));_0x3a56c3[_0xc37b('0x5e')][_0xc37b('0x9f')]=_0x2c49f4['id'];if(_0x25acec[_0xc37b('0x2b')][_0xc37b('0x81')]){_0x3a56c3[_0xc37b('0x5e')]=_[_0xc37b('0x33')](_0x3a56c3[_0xc37b('0x5e')],{'$or':_[_0xc37b('0x82')](_0x3a56c3[_0xc37b('0x7e')],function(_0x34594d){var _0x388505={};_0x388505[_0x34594d]={'$like':'%'+_0x25acec[_0xc37b('0x2b')][_0xc37b('0x81')]+'%'};return _0x388505;})});}_0x3a56c3=_['merge']({},_0x3a56c3,_0x25acec['options']);return db[_0xc37b('0x3a')][_0xc37b('0x13')]({'where':_0x3a56c3[_0xc37b('0x5e')]})[_0xc37b('0x18')](function(_0x83ada){_0x3c08c5[_0xc37b('0x13')]=_0x83ada;if(_0x25acec['query']['includeAll']){_0x3a56c3[_0xc37b('0xa0')]=[{'all':!![]}];}return db['CmHopper'][_0xc37b('0x20')](_0x3a56c3);})[_0xc37b('0x18')](function(_0x4fb384){_0x3c08c5['rows']=_0x4fb384;return _0x3c08c5;});}})[_0xc37b('0x18')](respondWithFilteredResult(_0xb68ecc,_0x3a56c3))[_0xc37b('0x22')](handleError(_0xb68ecc,null));};exports['getHopperHistories']=function(_0x4c3f1b,_0x1e3099){var _0x34823e={'raw':!![],'where':{}};var _0x51e1d2={};var _0x32a805={'count':0x0,'rows':[]};return db[_0xc37b('0x23')][_0xc37b('0x79')]({'where':{'id':_0x4c3f1b[_0xc37b('0x25')]['id']}})['then'](handleEntityNotFound(_0x1e3099,null))[_0xc37b('0x18')](function(_0x2f415d){if(_0x2f415d){_0x51e1d2[_0xc37b('0x7c')]=_[_0xc37b('0x27')](db[_0xc37b('0xa1')][_0xc37b('0x9d')]);_0x51e1d2[_0xc37b('0x2b')]=_['keys'](_0x4c3f1b['query']);_0x51e1d2[_0xc37b('0x7a')]=_[_0xc37b('0x7b')](_0x51e1d2[_0xc37b('0x7c')],_0x51e1d2['query']);_0x34823e[_0xc37b('0x7e')]=_[_0xc37b('0x7b')](_0x51e1d2[_0xc37b('0x7c')],qs[_0xc37b('0x7d')](_0x4c3f1b[_0xc37b('0x2b')][_0xc37b('0x7d')]));_0x34823e[_0xc37b('0x7e')]=_0x34823e[_0xc37b('0x7e')][_0xc37b('0x2e')]?_0x34823e['attributes']:_0x51e1d2['model'];if(!_0x4c3f1b[_0xc37b('0x2b')]['hasOwnProperty'](_0xc37b('0x85'))){_0x34823e['limit']=qs['limit'](_0x4c3f1b[_0xc37b('0x2b')][_0xc37b('0x14')]);_0x34823e[_0xc37b('0x11')]=qs[_0xc37b('0x11')](_0x4c3f1b[_0xc37b('0x2b')][_0xc37b('0x11')]);}_0x34823e[_0xc37b('0x7f')]=qs[_0xc37b('0x80')](_0x4c3f1b['query']['sort']);_0x34823e[_0xc37b('0x5e')]=qs[_0xc37b('0x7a')](_[_0xc37b('0x9e')](_0x4c3f1b[_0xc37b('0x2b')],_0x51e1d2['filters']));_0x34823e[_0xc37b('0x5e')][_0xc37b('0x9f')]=_0x2f415d['id'];if(_0x4c3f1b[_0xc37b('0x2b')][_0xc37b('0x81')]){_0x34823e[_0xc37b('0x5e')]=_[_0xc37b('0x33')](_0x34823e[_0xc37b('0x5e')],{'$or':_['map'](_0x34823e[_0xc37b('0x7e')],function(_0x9daf36){var _0x42dce6={};_0x42dce6[_0x9daf36]={'$like':'%'+_0x4c3f1b[_0xc37b('0x2b')]['filter']+'%'};return _0x42dce6;})});}_0x34823e=_[_0xc37b('0x33')]({},_0x34823e,_0x4c3f1b[_0xc37b('0x83')]);return db[_0xc37b('0xa1')]['count']({'where':_0x34823e[_0xc37b('0x5e')]})['then'](function(_0x4031b0){_0x32a805[_0xc37b('0x13')]=_0x4031b0;if(_0x4c3f1b[_0xc37b('0x2b')]['includeAll']){_0x34823e['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xc37b('0x20')](_0x34823e);})[_0xc37b('0x18')](function(_0x1b764b){_0x32a805['rows']=_0x1b764b;return _0x32a805;});}})[_0xc37b('0x18')](respondWithFilteredResult(_0x1e3099,_0x34823e))[_0xc37b('0x22')](handleError(_0x1e3099,null));};exports['getHopperFinals']=function(_0x5bd4f5,_0x5c2cd1){var _0x51d57b={'raw':!![],'where':{}};var _0x2e8deb={};var _0x214c05={'count':0x0,'rows':[]};return db[_0xc37b('0x23')][_0xc37b('0x79')]({'where':{'id':_0x5bd4f5[_0xc37b('0x25')]['id']}})['then'](handleEntityNotFound(_0x5c2cd1,null))[_0xc37b('0x18')](function(_0x225b13){if(_0x225b13){_0x2e8deb['model']=_['keys'](db[_0xc37b('0x48')][_0xc37b('0x9d')]);_0x2e8deb[_0xc37b('0x2b')]=_[_0xc37b('0x27')](_0x5bd4f5['query']);_0x2e8deb[_0xc37b('0x7a')]=_['intersection'](_0x2e8deb[_0xc37b('0x7c')],_0x2e8deb[_0xc37b('0x2b')]);_0x51d57b[_0xc37b('0x7e')]=_[_0xc37b('0x7b')](_0x2e8deb[_0xc37b('0x7c')],qs[_0xc37b('0x7d')](_0x5bd4f5['query'][_0xc37b('0x7d')]));_0x51d57b[_0xc37b('0x7e')]=_0x51d57b[_0xc37b('0x7e')][_0xc37b('0x2e')]?_0x51d57b[_0xc37b('0x7e')]:_0x2e8deb[_0xc37b('0x7c')];if(!_0x5bd4f5['query'][_0xc37b('0x61')](_0xc37b('0x85'))){_0x51d57b[_0xc37b('0x14')]=qs[_0xc37b('0x14')](_0x5bd4f5['query'][_0xc37b('0x14')]);_0x51d57b['offset']=qs[_0xc37b('0x11')](_0x5bd4f5[_0xc37b('0x2b')][_0xc37b('0x11')]);}_0x51d57b[_0xc37b('0x7f')]=qs[_0xc37b('0x80')](_0x5bd4f5[_0xc37b('0x2b')][_0xc37b('0x80')]);_0x51d57b[_0xc37b('0x5e')]=qs['filters'](_[_0xc37b('0x9e')](_0x5bd4f5[_0xc37b('0x2b')],_0x2e8deb[_0xc37b('0x7a')]));_0x51d57b[_0xc37b('0x5e')][_0xc37b('0x9f')]=_0x225b13['id'];if(_0x5bd4f5[_0xc37b('0x2b')][_0xc37b('0x81')]){_0x51d57b[_0xc37b('0x5e')]=_[_0xc37b('0x33')](_0x51d57b[_0xc37b('0x5e')],{'$or':_['map'](_0x51d57b[_0xc37b('0x7e')],function(_0x2ae823){var _0x1f334f={};_0x1f334f[_0x2ae823]={'$like':'%'+_0x5bd4f5['query'][_0xc37b('0x81')]+'%'};return _0x1f334f;})});}_0x51d57b=_[_0xc37b('0x33')]({},_0x51d57b,_0x5bd4f5['options']);return db[_0xc37b('0x48')][_0xc37b('0x13')]({'where':_0x51d57b[_0xc37b('0x5e')]})['then'](function(_0x2283d8){_0x214c05['count']=_0x2283d8;if(_0x5bd4f5[_0xc37b('0x2b')][_0xc37b('0xa2')]){_0x51d57b[_0xc37b('0xa0')]=[{'all':!![]}];}return db[_0xc37b('0x48')][_0xc37b('0x20')](_0x51d57b);})[_0xc37b('0x18')](function(_0x113ca2){_0x214c05[_0xc37b('0xa3')]=_0x113ca2;return _0x214c05;});}})[_0xc37b('0x18')](respondWithFilteredResult(_0x5c2cd1,_0x51d57b))[_0xc37b('0x22')](handleError(_0x5c2cd1,null));};exports[_0xc37b('0xa4')]=function(_0xf9a0e4,_0x3aac97){var _0x177ba8={'raw':!![],'where':{}};var _0x1460e8={};var _0x43e449={'count':0x0,'rows':[]};return db[_0xc37b('0x23')][_0xc37b('0x79')]({'where':{'id':_0xf9a0e4[_0xc37b('0x25')]['id']}})[_0xc37b('0x18')](handleEntityNotFound(_0x3aac97,null))[_0xc37b('0x18')](function(_0x28d6fb){if(_0x28d6fb){_0x1460e8[_0xc37b('0x7c')]=_[_0xc37b('0x27')](db['JscriptySessionReport']['rawAttributes']);_0x1460e8[_0xc37b('0x2b')]=_[_0xc37b('0x27')](_0xf9a0e4['query']);_0x1460e8[_0xc37b('0x7a')]=_[_0xc37b('0x7b')](_0x1460e8[_0xc37b('0x7c')],_0x1460e8[_0xc37b('0x2b')]);_0x177ba8[_0xc37b('0x7e')]=_[_0xc37b('0x7b')](_0x1460e8[_0xc37b('0x7c')],qs['fields'](_0xf9a0e4[_0xc37b('0x2b')][_0xc37b('0x7d')]));_0x177ba8[_0xc37b('0x7e')]=_0x177ba8[_0xc37b('0x7e')][_0xc37b('0x2e')]?_0x177ba8['attributes']:_0x1460e8['model'];if(!_0xf9a0e4['query']['hasOwnProperty'](_0xc37b('0x85'))){_0x177ba8[_0xc37b('0x14')]=qs['limit'](_0xf9a0e4[_0xc37b('0x2b')][_0xc37b('0x14')]);_0x177ba8[_0xc37b('0x11')]=qs['offset'](_0xf9a0e4[_0xc37b('0x2b')][_0xc37b('0x11')]);}_0x177ba8[_0xc37b('0x7f')]=qs['sort'](_0xf9a0e4['query'][_0xc37b('0x80')]);_0x177ba8[_0xc37b('0x5e')]=qs[_0xc37b('0x7a')](_[_0xc37b('0x9e')](_0xf9a0e4[_0xc37b('0x2b')],_0x1460e8[_0xc37b('0x7a')]));_0x177ba8[_0xc37b('0x5e')][_0xc37b('0x9f')]=_0x28d6fb['id'];if(_0xf9a0e4[_0xc37b('0x2b')][_0xc37b('0x81')]){_0x177ba8[_0xc37b('0x5e')]=_[_0xc37b('0x33')](_0x177ba8[_0xc37b('0x5e')],{'$or':_['map'](_0x177ba8['attributes'],function(_0x24780a){var _0x3a6dee={};_0x3a6dee[_0x24780a]={'$like':'%'+_0xf9a0e4['query'][_0xc37b('0x81')]+'%'};return _0x3a6dee;})});}_0x177ba8=_['merge']({},_0x177ba8,_0xf9a0e4[_0xc37b('0x83')]);return db[_0xc37b('0x4f')][_0xc37b('0x13')]({'where':_0x177ba8[_0xc37b('0x5e')]})[_0xc37b('0x18')](function(_0x4de853){_0x43e449['count']=_0x4de853;if(_0xf9a0e4[_0xc37b('0x2b')][_0xc37b('0xa2')]){_0x177ba8[_0xc37b('0xa0')]=[{'all':!![]}];}return db[_0xc37b('0x4f')][_0xc37b('0x20')](_0x177ba8);})[_0xc37b('0x18')](function(_0x49b2a7){_0x43e449[_0xc37b('0xa3')]=_0x49b2a7;return _0x43e449;});}})['then'](respondWithFilteredResult(_0x3aac97,_0x177ba8))['catch'](handleError(_0x3aac97,null));};exports[_0xc37b('0xa5')]=function(_0x942a5f,_0x2b6651){try{if(!_0x942a5f['body'][_0xc37b('0x5f')]){throw new Error(_0xc37b('0xa6'));}if(!_0x942a5f[_0xc37b('0x34')]['binding_keys']){throw new Error(_0xc37b('0xa7'));}if(!_0x942a5f[_0xc37b('0x34')][_0xc37b('0xa8')]){throw new Error(_0xc37b('0xa9'));}if(!_0x942a5f['body']['socket_timestamp']){throw new Error(_0xc37b('0xaa'));}var _0xb97b9a=_0x942a5f[_0xc37b('0x34')][_0xc37b('0xab')][_0xc37b('0xac')](',');var _0x111626=_0x942a5f[_0xc37b('0x34')][_0xc37b('0xa8')][_0xc37b('0xac')](',');if(!_0xb97b9a[_0xc37b('0x2e')]||!_0x111626[_0xc37b('0x2e')]||_0xb97b9a['length']!==_0x111626[_0xc37b('0x2e')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x942a5f[_0xc37b('0x34')][_0xc37b('0x7d')]=_['zipObject'](_0xb97b9a,_0x111626);if(!_0x942a5f['body'][_0xc37b('0x7d')][_0xc37b('0x78')]){throw new Error(_0xc37b('0xad'));}if(!_0x942a5f[_0xc37b('0x34')]['fields']['firstName']){throw new Error(_0xc37b('0xae'));}var _0xf1a5da=path['join'](config[_0xc37b('0xaf')],_0xc37b('0xb0'),_0x942a5f['file'][_0xc37b('0xb1')]);fs[_0xc37b('0xb2')](_0xf1a5da,parseInt(_0xc37b('0xb3'),0x8));var _0x47739c=require(_0xc37b('0xb4'))[_0xc37b('0xb5')](path[_0xc37b('0x54')](__dirname,_0xc37b('0xb6')),[_0xf1a5da,_0x942a5f['body'][_0xc37b('0xab')],_0x942a5f[_0xc37b('0x34')][_0xc37b('0xa8')],_0x942a5f[_0xc37b('0x34')]['ListId'],_0x942a5f[_0xc37b('0x34')][_0xc37b('0xb7')],_0x942a5f[_0xc37b('0x34')][_0xc37b('0x5c')],_0x942a5f[_0xc37b('0x34')]['socket_timestamp']]);return _0x2b6651[_0xc37b('0xf')](0xc8)['json']({'message':_0xc37b('0xb8'),'pid':_0x47739c[_0xc37b('0xb9')]});}catch(_0x22989a){return _0x2b6651[_0xc37b('0xf')](0x1f4)[_0xc37b('0xba')](_0x22989a);}};exports[_0xc37b('0xbb')]=function(_0x18d673,_0x35ed5d){var _0x2455e2=fs[_0xc37b('0xbc')](_0x18d673['file'][_0xc37b('0x3')]);Papa[_0xc37b('0xbd')](_0x2455e2,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x55e121){return _0x35ed5d[_0xc37b('0xf')](0xc8)[_0xc37b('0x10')]({'file':_0x18d673[_0xc37b('0xbe')],'fields':_0x55e121[_0xc37b('0xbf')][_0xc37b('0x7d')]});}});};exports['import']=function(_0x299587,_0x28353a){return db['User'][_0xc37b('0x20')]({'raw':!![],'attributes':['id'],'where':{'role':_0xc37b('0xc0')}})[_0xc37b('0x18')](function(_0x5966e7){var _0x106482=![];if(!_0x299587[_0xc37b('0x34')][_0xc37b('0x5f')]){throw new Error('No\x20ListId\x20specified');}if(!_0x299587[_0xc37b('0x34')][_0xc37b('0xc1')][_0xc37b('0x78')]){throw new Error(_0xc37b('0xad'));}if(!_0x299587['body'][_0xc37b('0xc1')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x299587['body'][_0xc37b('0xc2')]){throw new Error(_0xc37b('0xaa'));}var _0x2f5c30=require(_0xc37b('0xb4'))[_0xc37b('0xb5')](path['join'](__dirname,_0xc37b('0xc3')),[_0x299587[_0xc37b('0x25')]['id'],JSON[_0xc37b('0xc4')](_0x299587[_0xc37b('0x34')]),JSON[_0xc37b('0xc4')](_0x5966e7)]);_0x2f5c30['on'](_0xc37b('0xc5'),function(){_0x106482=!![];return _0x28353a[_0xc37b('0xf')](0xc8)[_0xc37b('0x10')]({'message':_0xc37b('0xc6'),'pid':_0x2f5c30['pid']});});_0x2f5c30['on'](_0xc37b('0xc7'),function(_0xc0ff3b){if(_0xc0ff3b&&!_0x106482){return _0x28353a[_0xc37b('0xf')](0x1f4)[_0xc37b('0x10')]({'message':_0xc37b('0xc8'),'pid':_0x2f5c30[_0xc37b('0xb9')]});}});})[_0xc37b('0x22')](handleError(_0x28353a,null));};exports[_0xc37b('0xc9')]=function(_0x1c417d,_0x3dfb81){return db[_0xc37b('0xca')][_0xc37b('0x20')]({'raw':!![],'attributes':['id'],'where':{'role':_0xc37b('0xc0')}})['then'](function(_0x1808a0){var _0x1fc781=![];if(!_0x1c417d['body'][_0xc37b('0x5f')]){throw new Error(_0xc37b('0xa6'));}if(!_0x1c417d[_0xc37b('0x34')]['binding'][_0xc37b('0x78')]){throw new Error(_0xc37b('0xad'));}if(!_0x1c417d[_0xc37b('0x34')]['binding'][_0xc37b('0xcb')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x1c417d[_0xc37b('0x34')][_0xc37b('0xc2')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x3cd718=require('child_process')[_0xc37b('0xb5')](path['join'](__dirname,_0xc37b('0xcc')),[_0x1c417d['params']['id'],JSON['stringify'](_0x1c417d[_0xc37b('0x34')]),JSON['stringify'](_0x1808a0)]);_0x3cd718['on']('message',function(){_0x1fc781=!![];return _0x3dfb81[_0xc37b('0xf')](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0x3cd718['pid']});});_0x3cd718['on'](_0xc37b('0xc7'),function(_0x4bb266){if(_0x4bb266&&!_0x1fc781){return _0x3dfb81[_0xc37b('0xf')](0x1f4)[_0xc37b('0x10')]({'message':'error\x20child\x20process','pid':_0x3cd718[_0xc37b('0xb9')]});}});})[_0xc37b('0x22')](handleError(_0x3dfb81,null));};exports['getJourney']=function(_0x3185b4,_0x8e5a3e){var _0x470996=[_0xc37b('0xcd'),_0xc37b('0xce'),_0xc37b('0xcf'),'openchannel',_0xc37b('0xd0'),_0xc37b('0xd1'),_0xc37b('0xd2')];var _0x4f5e8f={'offset':0x0,'order':qs['sort'](_0xc37b('0xd3'))},_0x1d5c1f={'count':0x0,'rows':[]};Promise[_0xc37b('0xd4')]()[_0xc37b('0x18')](function(){if(_0x3185b4[_0xc37b('0x2b')]['channel']){if(!_[_0xc37b('0xd5')](_0x470996,_0x3185b4[_0xc37b('0x2b')][_0xc37b('0xd6')]['toLowerCase']())){throw new Error('Invalid\x20channel');}_0x470996=[_0x3185b4[_0xc37b('0x2b')][_0xc37b('0xd6')][_0xc37b('0xd7')]()];}if(_0x3185b4['query'][_0xc37b('0xd8')]){try{var _0x2064e=JSON['parse'](_0x3185b4[_0xc37b('0x2b')][_0xc37b('0xd8')]);if(!moment(_0x2064e[_0xc37b('0x39')])[_0xc37b('0xd9')]()){throw new Error(_0xc37b('0xda'));}if(!moment(_0x2064e['to'])['isValid']()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x929578){throw new Error(_0xc37b('0xdb'));}}if(!_0x3185b4[_0xc37b('0x2b')][_0xc37b('0x61')]('nolimit')){_0x4f5e8f['limit']=qs['limit'](_0x3185b4[_0xc37b('0x2b')][_0xc37b('0x14')]||0xa);_0x4f5e8f['offset']=qs[_0xc37b('0x11')](_0x3185b4[_0xc37b('0x2b')][_0xc37b('0x11')]);}var _0x2a810=_0x470996[_0xc37b('0x82')](function(_0x3d98e2){if(_0x3d98e2==='voice'){var _0x4ad989={'attributes':['id','uniqueid',_0xc37b('0x30'),_0xc37b('0xdc'),_0xc37b('0xdd'),_0xc37b('0xde'),'starttime','endtime',_0xc37b('0xdf'),_0xc37b('0xe0'),_0xc37b('0xe1'),'userDisposition',_0xc37b('0xe2'),'userThirdDisposition',_0xc37b('0xe3')],'where':{'ContactId':_0x3185b4['params']['id']},'include':[{'model':db[_0xc37b('0xca')],'as':_0xc37b('0xca'),'attributes':['id',_0xc37b('0x1c'),_0xc37b('0xe4'),_0xc37b('0xe5')]}],'order':[[_0xc37b('0xe1'),_0xc37b('0xe6')]]};if(_0x3185b4['query'][_0xc37b('0xd8')]){_0x4ad989['where']['createdAt']={'$gte':_0x2064e[_0xc37b('0x39')],'$lte':_0x2064e['to']};}return db['VoiceCallReport']['findAndCountAll'](_0x4ad989)[_0xc37b('0x18')](function(_0x240176){_0x1d5c1f['count']+=_0x240176['count'];return _[_0xc37b('0x82')](_0x240176[_0xc37b('0xa3')],function(_0x12439d){var _0x2b3e19=_0x12439d['get']({'plain':!![]});_0x2b3e19['channel']=_0x3d98e2;if(_0x2b3e19[_0xc37b('0xca')]){_0x2b3e19['User']={'id':_0x2b3e19[_0xc37b('0xca')]['id'],'name':_0x2b3e19[_0xc37b('0xca')]['name'],'fullname':_0x2b3e19[_0xc37b('0xca')]['fullname'],'alias':_0x2b3e19[_0xc37b('0xca')][_0xc37b('0xe5')]};}return _0x2b3e19;});});}else{var _0x52be15=_['startCase'](_0x3d98e2)+(_0x3d98e2==='chat'?_0xc37b('0xe7'):'Account');var _0x4e91d4={'attributes':['id',_0xc37b('0xe8'),'closedAt','createdAt',_0xc37b('0xe0'),_0xc37b('0xe9'),_0xc37b('0xea'),_0xc37b('0xeb'),_0xc37b('0xe3'),_0x52be15+'Id'],'where':{'ContactId':_0x3185b4[_0xc37b('0x25')]['id']},'include':[{'model':db[_0x52be15],'as':_0xc37b('0xec'),'attributes':['id',_0xc37b('0x1c'),_0xc37b('0xed')]},{'model':db[_0xc37b('0xca')],'as':_0xc37b('0xee'),'attributes':['id','name',_0xc37b('0xe4')]},{'model':db[_0xc37b('0x65')],'as':_0xc37b('0x66'),'attributes':['id',_0xc37b('0x1c'),'color'],'through':{'attributes':[]}}],'order':[[_0xc37b('0xe1'),_0xc37b('0xe6')]]};if(_0x3185b4[_0xc37b('0x2b')][_0xc37b('0xd8')]){_0x4e91d4[_0xc37b('0x5e')][_0xc37b('0xe1')]={'$gte':_0x2064e['from'],'$lte':_0x2064e['to']};}switch(_0x3d98e2){case _0xc37b('0xce'):_0x4e91d4[_0xc37b('0x7e')][_0xc37b('0x5d')](_0xc37b('0xef'),_0xc37b('0xf0'),'customerPort',_0xc37b('0xf1'),_0xc37b('0xf2'),_0xc37b('0xf3'),'ratingType',_0xc37b('0xf4'),_0xc37b('0xf5'));break;case _0xc37b('0xcd'):_0x4e91d4[_0xc37b('0x7e')]['push'](_0xc37b('0xf6'),_0xc37b('0xf7'));break;case _0xc37b('0xf8'):_0x4e91d4[_0xc37b('0x7e')]['push'](_0xc37b('0xf9'),_0xc37b('0xfa'));break;}return db[_[_0xc37b('0xfb')](_0x3d98e2)+'Interaction']['findAndCountAll'](_0x4e91d4)[_0xc37b('0x18')](function(_0x4fb5c5){_0x1d5c1f[_0xc37b('0x13')]+=_0x4fb5c5[_0xc37b('0x13')];return _[_0xc37b('0x82')](_0x4fb5c5[_0xc37b('0xa3')],function(_0x72df41){var _0xb90297=_0x72df41[_0xc37b('0x35')]({'plain':!![]});_0xb90297[_0xc37b('0xd6')]=_0x3d98e2;if(_0xb90297['Owner']){_0xb90297[_0xc37b('0xee')]={'id':_0xb90297[_0xc37b('0xee')]['id'],'name':_0xb90297[_0xc37b('0xee')][_0xc37b('0x1c')],'fullname':_0xb90297[_0xc37b('0xee')][_0xc37b('0xe4')]};}return _0xb90297;});});}});return Promise[_0xc37b('0x63')](_0x2a810);})[_0xc37b('0x18')](function(_0x1c8014){return _(_0x1c8014)['flatten']()['sortBy'](_0xc37b('0xe1'))[_0xc37b('0xfc')]()['value']();})[_0xc37b('0x18')](function(_0x4e0bdb){_0x1d5c1f[_0xc37b('0xa3')]=_0x4f5e8f[_0xc37b('0x14')]?_0x4e0bdb[_0xc37b('0xfd')](_0x4f5e8f['offset'],_0x4f5e8f[_0xc37b('0x11')]+_0x4f5e8f['limit']):_0x4e0bdb;return _0x1d5c1f;})[_0xc37b('0x18')](respondWithFilteredResult(_0x8e5a3e,_0x4f5e8f))[_0xc37b('0x22')](handleError(_0x8e5a3e,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 7cff37e..279ec91 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 _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 +var _0x8585=['hook','exports','events','../../mysqldb','CmContact','save','update','emit','hasOwnProperty'];(function(_0x2be717,_0x4acca2){var _0x29efec=function(_0x12a0f3){while(--_0x12a0f3){_0x2be717['push'](_0x2be717['shift']());}};_0x29efec(++_0x4acca2);}(_0x8585,0x9b));var _0x5858=function(_0x136753,_0x5ddc8a){_0x136753=_0x136753-0x0;var _0x1524de=_0x8585[_0x136753];return _0x1524de;};'use strict';var EventEmitter=require(_0x5858('0x0'));var CmContact=require(_0x5858('0x1'))['db'][_0x5858('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5858('0x3'),'afterUpdate':_0x5858('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1777e0){return function(_0x3ad041,_0x1b3454,_0x55237e){CmContactEvents[_0x5858('0x5')](_0x1777e0+':'+_0x3ad041['id'],_0x3ad041);CmContactEvents[_0x5858('0x5')](_0x1777e0,_0x3ad041);_0x55237e(null);};}for(var e in events){if(events[_0x5858('0x6')](e)){var event=events[e];CmContact[_0x5858('0x7')](e,emitEvent(event));}}module[_0x5858('0x8')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 8ffbc58..7c633fc 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 _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 +var _0xfb3c=['findOne','timezones','utcOffset','minutes','then','ret','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','create','ListId','priority','format','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','onlyIfOpen','BlackLists','length','CmHopperBlack','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','util','api','moment','bluebird','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','phone','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','inspect','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue'];(function(_0x5d0ee3,_0x32bb4f){var _0x2b36a5=function(_0x3da252){while(--_0x3da252){_0x5d0ee3['push'](_0x5d0ee3['shift']());}};_0x2b36a5(++_0x32bb4f);}(_0xfb3c,0x152));var _0xcfb3=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xfb3c[_0x1cc8fe];return _0x230054;};'use strict';var _=require('lodash');var util=require(_0xcfb3('0x0'));var logger=require('../../config/logger')(_0xcfb3('0x1'));var moment=require(_0xcfb3('0x2'));var BPromise=require(_0xcfb3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcfb3('0x4'));var rimraf=require(_0xcfb3('0x5'));var config=require(_0xcfb3('0x6'));var shared=require(_0xcfb3('0x7'));var attributes=require(_0xcfb3('0x8'));module[_0xcfb3('0x9')]=function(_0x381824,_0x45631c){return _0x381824[_0xcfb3('0xa')](_0xcfb3('0xb'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0xcfb3('0xc'),'fields':['phone']},{'name':'fti_cm_contacts','fields':[_0xcfb3('0xd'),_0xcfb3('0xe'),'phone',_0xcfb3('0xf'),_0xcfb3('0x10'),_0xcfb3('0x11')],'type':_0xcfb3('0x12')}],'timestamps':!![],'charset':_0xcfb3('0x13'),'collate':_0xcfb3('0x14'),'hooks':{'afterCreate':function(_0x26fcc5,_0x5e64a0,_0x33e6a6){var _0x3fc95d=_0x381824[_0xcfb3('0x15')];var _0x4fb596=_0x26fcc5[_0xcfb3('0x16')]({'plain':!![]});function _0x4fefb2(){return function(_0x9cfb8a){logger[_0xcfb3('0x17')](_0xcfb3('0x18'),_0xcfb3('0x19'),util[_0xcfb3('0x1a')](_0x9cfb8a,{'showHidden':![],'depth':null}));};}function _0x5c0485(_0x1f36e9,_0x4ddd25){var _0x53948a=_0x4ddd25[_0xcfb3('0x1b')]?_0x4ddd25[_0xcfb3('0x1b')]:moment()['format'](_0xcfb3('0x1c'));return new BPromise(function(_0x23568f,_0x2def44){if(_[_0xcfb3('0x1d')](_0x4ddd25[_0xcfb3('0x1e')])){_0x23568f({'ret':_0x53948a});}else{_0x3fc95d[_0xcfb3('0x1f')][_0xcfb3('0x20')]({'where':{'id':_0x1f36e9['id']}})['then'](function(_0x474edf){if(!_[_0xcfb3('0x1d')](_0x474edf)){var _0x25d50b=_0x474edf['dialTimezone'];if(!_['isNil'](_0x25d50b)){var _0x18f85e=shared[_0xcfb3('0x21')];var _0x33f37e=_0x18f85e[_0x25d50b];var _0xf370f3=_0x18f85e[_0x4ddd25[_0xcfb3('0x1e')]];if(!_['isNil'](_0x33f37e)&&!_[_0xcfb3('0x1d')](_0xf370f3)){var _0x30ab0c=_0x33f37e[_0xcfb3('0x22')]-_0xf370f3[_0xcfb3('0x22')];_0x53948a=_0x4ddd25[_0xcfb3('0x1b')]?_0x4ddd25[_0xcfb3('0x1b')]:moment();var _0x82d62b=moment(_0x53948a)['add'](_0x30ab0c,_0xcfb3('0x23'));_0x23568f({'ret':_0x82d62b['format']('YYYY-MM-DD\x20HH:mm:ss')});}else _0x23568f({'ret':_0x53948a});}else _0x23568f({'ret':_0x53948a});}else{_0x23568f({'ret':_0x53948a});}});}});return 0xa;}var _0x9ff2ad=function(_0xe200b0){return new BPromise(function(_0x34dd73,_0xb3ec6e){_0x5c0485(_0xe200b0,_0x4fb596)[_0xcfb3('0x24')](function(_0x10e09b){_0x4fb596[_0xcfb3('0x1b')]=_0x10e09b[_0xcfb3('0x25')];_0x3fc95d['CmHopper'][_0xcfb3('0x20')]({'where':{'phone':_0x4fb596[_0xcfb3('0xc')],'VoiceQueueId':_0xe200b0['id']}})['then'](function(_0x5d8eb5){if(!_[_0xcfb3('0x1d')](_0x5d8eb5)){throw new Error(_0xcfb3('0x26')+_0x4fb596[_0xcfb3('0xc')]+_0xcfb3('0x27')+_0xe200b0['id']);}return _0x3fc95d[_0xcfb3('0x28')][_0xcfb3('0x29')]({'phone':_0x4fb596[_0xcfb3('0xc')],'ContactId':_0x4fb596['id'],'ListId':_0x4fb596[_0xcfb3('0x2a')],'priority':_0x4fb596['priority']?_0x4fb596[_0xcfb3('0x2b')]:0x2,'scheduledat':_0x4fb596[_0xcfb3('0x1b')]?_0x4fb596[_0xcfb3('0x1b')]:moment()[_0xcfb3('0x2c')](_0xcfb3('0x1c')),'callback':_0x4fb596[_0xcfb3('0x2d')]?!![]:![],'callbackuniqueid':_0x4fb596[_0xcfb3('0x2d')]?_0x4fb596['callbackUniqueid']:undefined,'callbackat':_0x4fb596['callbackUniqueid']?moment()[_0xcfb3('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0xe200b0['id']});})[_0xcfb3('0x2e')](function(_0xb12262){_0xb3ec6e(_0xb12262);});});});};var _0x313876=function(_0x372139){return new BPromise(function(_0x2845ea,_0x29e3eb){_0x5c0485(_0x372139,_0x4fb596)['then'](function(_0x2fec0d){_0x4fb596[_0xcfb3('0x1b')]=_0x2fec0d[_0xcfb3('0x25')];_0x3fc95d[_0xcfb3('0x28')]['findOne']({'where':{'phone':_0x4fb596[_0xcfb3('0xc')],'VoiceQueueId':_0x372139['id']}})[_0xcfb3('0x24')](function(_0x18ae7e){if(!_[_0xcfb3('0x1d')](_0x18ae7e)){throw new Error(_0xcfb3('0x26')+_0x4fb596[_0xcfb3('0xc')]+_0xcfb3('0x2f')+_0x372139['id']);}return _0x3fc95d[_0xcfb3('0x30')][_0xcfb3('0x20')]({'where':{'calleridnum':_0x4fb596[_0xcfb3('0xc')],'VoiceQueueId':_0x372139['id']}});})[_0xcfb3('0x24')](function(_0x15d0b9){if(!_['isNil'](_0x15d0b9)){throw new Error(_0xcfb3('0x31')+_0x4fb596[_0xcfb3('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x372139['id']);}return _0x3fc95d['CmHopper'][_0xcfb3('0x29')]({'phone':_0x4fb596['phone'],'ContactId':_0x4fb596['id'],'ListId':_0x4fb596[_0xcfb3('0x2a')],'priority':_0x4fb596[_0xcfb3('0x2b')]?_0x4fb596[_0xcfb3('0x2b')]:0x2,'scheduledat':_0x4fb596[_0xcfb3('0x1b')]?_0x4fb596[_0xcfb3('0x1b')]:moment()['format'](_0xcfb3('0x1c')),'callback':_0x4fb596['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4fb596[_0xcfb3('0x2d')]?_0x4fb596[_0xcfb3('0x2d')]:undefined,'callbackat':_0x4fb596[_0xcfb3('0x2d')]?moment()['format'](_0xcfb3('0x1c')):undefined,'VoiceQueueId':_0x372139['id']});})[_0xcfb3('0x2e')](function(_0x489b66){_0x29e3eb(_0x489b66);});});});};function _0x25e370(){return function(_0x1e2995){logger[_0xcfb3('0x17')](_0xcfb3('0x18'),_0xcfb3('0x19'),util[_0xcfb3('0x1a')](_0x1e2995,{'showHidden':![],'depth':null}));};}function _0x456ae2(_0x4865e8,_0x1cc492){var _0x4afbef=_0x1cc492['scheduledat']?_0x1cc492[_0xcfb3('0x1b')]:moment()[_0xcfb3('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x50f76d,_0x52f9c8){if(_[_0xcfb3('0x1d')](_0x1cc492[_0xcfb3('0x1e')])){_0x50f76d({'ret':_0x4afbef});}else{_0x3fc95d[_0xcfb3('0x32')][_0xcfb3('0x20')]({'where':{'id':_0x4865e8['id']}})[_0xcfb3('0x24')](function(_0x5ee33d){if(!_[_0xcfb3('0x1d')](_0x5ee33d)){var _0x2f3068=_0x5ee33d['dialTimezone'];if(!_['isNil'](_0x2f3068)){var _0x12c5d3=shared[_0xcfb3('0x21')];var _0x3fe00c=_0x12c5d3[_0x2f3068];var _0x554ccf=_0x12c5d3[_0x1cc492['dialTimezone']];if(!_[_0xcfb3('0x1d')](_0x3fe00c)&&!_[_0xcfb3('0x1d')](_0x554ccf)){var _0x1f3333=_0x3fe00c[_0xcfb3('0x22')]-_0x554ccf['utcOffset'];_0x4afbef=_0x1cc492['scheduledat']?_0x1cc492[_0xcfb3('0x1b')]:moment();var _0x23c196=moment(_0x4afbef)['add'](_0x1f3333,_0xcfb3('0x23'));_0x50f76d({'ret':_0x23c196[_0xcfb3('0x2c')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x50f76d({'ret':_0x4afbef});}else _0x50f76d({'ret':_0x4afbef});}else{_0x50f76d({'ret':_0x4afbef});}});}});return 0xa;}var _0x3ba2f3=function(_0x3d735d){return new BPromise(function(_0x59387f,_0xb3ea54){_0x456ae2(_0x3d735d,_0x4fb596)[_0xcfb3('0x24')](function(_0x368197){_0x4fb596[_0xcfb3('0x1b')]=_0x368197[_0xcfb3('0x25')];_0x3fc95d[_0xcfb3('0x28')]['findOne']({'where':{'phone':_0x4fb596[_0xcfb3('0xc')],'CampaignId':_0x3d735d['id']}})[_0xcfb3('0x24')](function(_0x53ecc3){if(!_[_0xcfb3('0x1d')](_0x53ecc3)){throw new Error(_0xcfb3('0x26')+_0x4fb596['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x3d735d['id']);}return _0x3fc95d[_0xcfb3('0x28')][_0xcfb3('0x29')]({'phone':_0x4fb596[_0xcfb3('0xc')],'ContactId':_0x4fb596['id'],'ListId':_0x4fb596[_0xcfb3('0x2a')],'priority':_0x4fb596[_0xcfb3('0x2b')]?_0x4fb596[_0xcfb3('0x2b')]:0x2,'scheduledat':_0x4fb596[_0xcfb3('0x1b')]?_0x4fb596[_0xcfb3('0x1b')]:moment()[_0xcfb3('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x4fb596[_0xcfb3('0x2d')]?!![]:![],'callbackuniqueid':_0x4fb596['callbackUniqueid']?_0x4fb596['callbackUniqueid']:undefined,'callbackat':_0x4fb596['callbackUniqueid']?moment()[_0xcfb3('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x3d735d['id']});})['catch'](function(_0x5532bf){_0xb3ea54(_0x5532bf);});});});};var _0x5f5208=function(_0x2bae60){return new BPromise(function(_0x365bca,_0x47b8ed){_0x456ae2(_0x2bae60,_0x4fb596)[_0xcfb3('0x24')](function(_0x48cef3){_0x4fb596[_0xcfb3('0x1b')]=_0x48cef3[_0xcfb3('0x25')];_0x3fc95d[_0xcfb3('0x28')][_0xcfb3('0x20')]({'where':{'phone':_0x4fb596[_0xcfb3('0xc')],'CampaignId':_0x2bae60['id']}})[_0xcfb3('0x24')](function(_0x223d53){if(!_[_0xcfb3('0x1d')](_0x223d53)){throw new Error(_0xcfb3('0x26')+_0x4fb596['phone']+_0xcfb3('0x33')+_0x2bae60['id']);}return _0x3fc95d[_0xcfb3('0x30')][_0xcfb3('0x20')]({'where':{'calleridnum':_0x4fb596[_0xcfb3('0xc')],'CampaignId':_0x2bae60['id']}});})[_0xcfb3('0x24')](function(_0x151367){if(!_[_0xcfb3('0x1d')](_0x151367)){throw new Error(_0xcfb3('0x31')+_0x4fb596[_0xcfb3('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x2bae60['id']);}return _0x3fc95d['CmHopper'][_0xcfb3('0x29')]({'phone':_0x4fb596[_0xcfb3('0xc')],'ContactId':_0x4fb596['id'],'ListId':_0x4fb596['ListId'],'priority':_0x4fb596[_0xcfb3('0x2b')]?_0x4fb596[_0xcfb3('0x2b')]:0x2,'scheduledat':_0x4fb596[_0xcfb3('0x1b')]?_0x4fb596[_0xcfb3('0x1b')]:moment()[_0xcfb3('0x2c')](_0xcfb3('0x1c')),'callback':_0x4fb596[_0xcfb3('0x2d')]?!![]:![],'callbackuniqueid':_0x4fb596[_0xcfb3('0x2d')]?_0x4fb596[_0xcfb3('0x2d')]:undefined,'callbackat':_0x4fb596[_0xcfb3('0x2d')]?moment()['format'](_0xcfb3('0x1c')):undefined,'CampaignId':_0x2bae60['id']});})[_0xcfb3('0x2e')](function(_0xbcac90){_0x47b8ed(_0xbcac90);});});});};if(_0x4fb596[_0xcfb3('0x2a')]){_0x3fc95d[_0xcfb3('0x1f')][_0xcfb3('0x34')]({'where':{'type':_0xcfb3('0x35')},'attributes':['id',_0xcfb3('0x36'),_0xcfb3('0x1e')],'include':[{'model':_0x3fc95d[_0xcfb3('0x37')],'as':_0xcfb3('0x38'),'where':{'id':_0x4fb596[_0xcfb3('0x2a')]}}]})[_0xcfb3('0x24')](function(_0x3e52ab){if(_0x3e52ab){var _0x4ddc26=[];for(var _0x11e33c=0x0,_0x50c3c9;_0x11e33c<_0x3e52ab['length'];_0x11e33c+=0x1){_0x50c3c9=_0x3e52ab[_0x11e33c][_0xcfb3('0x16')]({'plain':!![]});switch(_0x50c3c9['dialCheckDuplicateType']){case _0xcfb3('0x39'):_0x313876(_0x50c3c9)[_0xcfb3('0x2e')](_0x4fefb2());break;case _0xcfb3('0x3a'):_0x9ff2ad(_0x50c3c9)[_0xcfb3('0x2e')](_0x4fefb2());break;default:_0x456ae2(_0x50c3c9,_0x4fb596)[_0xcfb3('0x24')](function(_0x20b458){_0x4fb596[_0xcfb3('0x1b')]=_0x20b458[_0xcfb3('0x25')];_0x3fc95d[_0xcfb3('0x28')][_0xcfb3('0x29')]({'phone':_0x4fb596[_0xcfb3('0xc')],'ContactId':_0x4fb596['id'],'ListId':_0x4fb596[_0xcfb3('0x2a')],'scheduledat':_0x4fb596[_0xcfb3('0x1b')]?_0x4fb596['scheduledat']:moment()[_0xcfb3('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x4fb596['priority']?_0x4fb596['priority']:0x2,'callback':_0x4fb596[_0xcfb3('0x2d')]?!![]:![],'callbackuniqueid':_0x4fb596[_0xcfb3('0x2d')]?_0x4fb596[_0xcfb3('0x2d')]:undefined,'callbackat':_0x4fb596[_0xcfb3('0x2d')]?moment()[_0xcfb3('0x2c')](_0xcfb3('0x1c')):undefined,'VoiceQueueId':_0x50c3c9['id']})[_0xcfb3('0x2e')](_0x4fefb2());});}}}})[_0xcfb3('0x24')](function(){return _0x3fc95d[_0xcfb3('0x1f')]['findAll']({'where':{'type':_0xcfb3('0x35')},'attributes':['id'],'include':[{'model':_0x3fc95d[_0xcfb3('0x37')],'as':_0xcfb3('0x3b'),'where':{'id':_0x4fb596[_0xcfb3('0x2a')]}}]})[_0xcfb3('0x24')](function(_0xc26853){if(_0xc26853){var _0x4f1212=[];for(var _0x4c7c42=0x0,_0x558629;_0x4c7c42<_0xc26853[_0xcfb3('0x3c')];_0x4c7c42+=0x1){_0x558629=_0xc26853[_0x4c7c42][_0xcfb3('0x16')]({'plain':!![]});_0x3fc95d[_0xcfb3('0x3d')][_0xcfb3('0x29')]({'phone':_0x4fb596[_0xcfb3('0xc')],'ContactId':_0x4fb596['id'],'ListId':_0x4fb596[_0xcfb3('0x2a')],'VoiceQueueId':_0x558629['id']})[_0xcfb3('0x2e')](function(_0x4c0cf6){logger[_0xcfb3('0x17')](_0xcfb3('0x3e'),'afterCreate',_0x4c0cf6['message']);});}}});})[_0xcfb3('0x24')](function(){return _0x3fc95d[_0xcfb3('0x32')][_0xcfb3('0x34')]({'attributes':['id',_0xcfb3('0x36'),_0xcfb3('0x1e')],'include':[{'model':_0x3fc95d[_0xcfb3('0x37')],'as':_0xcfb3('0x38'),'where':{'id':_0x4fb596[_0xcfb3('0x2a')]}}]})['then'](function(_0x457101){if(_0x457101){var _0x35d878=[];for(var _0x2ce3e4=0x0,_0x33bec4;_0x2ce3e4<_0x457101[_0xcfb3('0x3c')];_0x2ce3e4+=0x1){_0x33bec4=_0x457101[_0x2ce3e4][_0xcfb3('0x16')]({'plain':!![]});switch(_0x33bec4[_0xcfb3('0x36')]){case _0xcfb3('0x39'):_0x5f5208(_0x33bec4)[_0xcfb3('0x2e')](_0x25e370());break;case'onlyIfOpen':_0x3ba2f3(_0x33bec4)[_0xcfb3('0x2e')](_0x25e370());break;default:_0x3fc95d[_0xcfb3('0x28')][_0xcfb3('0x29')]({'phone':_0x4fb596['phone'],'ContactId':_0x4fb596['id'],'ListId':_0x4fb596['ListId'],'scheduledat':_0x4fb596[_0xcfb3('0x1b')]?_0x4fb596['scheduledat']:moment()[_0xcfb3('0x2c')](_0xcfb3('0x1c')),'priority':_0x4fb596['priority']?_0x4fb596['priority']:0x2,'callback':_0x4fb596[_0xcfb3('0x2d')]?!![]:![],'callbackuniqueid':_0x4fb596['callbackUniqueid']?_0x4fb596[_0xcfb3('0x2d')]:undefined,'callbackat':_0x4fb596['callbackUniqueid']?moment()[_0xcfb3('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x33bec4['id']})[_0xcfb3('0x2e')](_0x25e370());}}}});})[_0xcfb3('0x24')](function(){return _0x3fc95d[_0xcfb3('0x32')][_0xcfb3('0x34')]({'attributes':['id'],'include':[{'model':_0x3fc95d[_0xcfb3('0x37')],'as':_0xcfb3('0x3b'),'where':{'id':_0x4fb596[_0xcfb3('0x2a')]}}]})[_0xcfb3('0x24')](function(_0x9525bf){if(_0x9525bf){var _0x255ff8=[];for(var _0x6a4b2e=0x0,_0x2dd4eb;_0x6a4b2e<_0x9525bf[_0xcfb3('0x3c')];_0x6a4b2e+=0x1){_0x2dd4eb=_0x9525bf[_0x6a4b2e][_0xcfb3('0x16')]({'plain':!![]});_0x3fc95d[_0xcfb3('0x3d')][_0xcfb3('0x29')]({'phone':_0x4fb596[_0xcfb3('0xc')],'ContactId':_0x4fb596['id'],'ListId':_0x4fb596[_0xcfb3('0x2a')],'CampaignId':_0x2dd4eb['id']})[_0xcfb3('0x2e')](function(_0x3586e5){logger[_0xcfb3('0x17')](_0xcfb3('0x3e'),_0xcfb3('0x19'),_0x3586e5[_0xcfb3('0x3f')]);});}}});})[_0xcfb3('0x24')](function(){_0x33e6a6();})[_0xcfb3('0x2e')](function(_0x314cb2){logger['error'](_0xcfb3('0x3e'),_0xcfb3('0x19'),_0x314cb2['message']);_0x33e6a6(_0x314cb2);});}else{_0x33e6a6(new Error(_0xcfb3('0x40')));}},'afterDestroy':function(_0x56008e,_0x178cb8,_0x37514f){var _0xccbbc8=_0x381824[_0xcfb3('0x15')];var _0x1efdb7=_0x56008e[_0xcfb3('0x16')]({'plain':!![]});return _0xccbbc8[_0xcfb3('0x28')][_0xcfb3('0x34')]({'raw':!![],'where':{'ListId':_0x1efdb7[_0xcfb3('0x2a')],'ContactId':_0x1efdb7['id']}})[_0xcfb3('0x24')](function(_0x5d5903){if(!_[_0xcfb3('0x41')](_0x5d5903)){var _0x5231a8=[];for(var _0x15b5a3=0x0;_0x15b5a3<_0x5d5903['length'];_0x15b5a3+=0x1){var _0x4c91c7=_0xccbbc8[_0xcfb3('0x28')][_0xcfb3('0x42')]({'where':{'ListId':_0x5d5903[_0x15b5a3][_0xcfb3('0x2a')],'ContactId':_0x5d5903[_0x15b5a3][_0xcfb3('0x43')],'VoiceQueueId':_0x5d5903[_0x15b5a3][_0xcfb3('0x44')],'CampaignId':_0x5d5903[_0x15b5a3][_0xcfb3('0x45')]}});_0x5231a8[_0xcfb3('0x46')](_0x4c91c7);}return BPromise[_0xcfb3('0x47')](_0x5231a8);}})[_0xcfb3('0x24')](function(_0x4713a3){logger[_0xcfb3('0x48')](_0xcfb3('0x49'),util[_0xcfb3('0x1a')](_0x4713a3,{'showHidden':![],'depth':null}));_0x37514f();})[_0xcfb3('0x2e')](function(_0x23d877){logger[_0xcfb3('0x17')]('[CmContact][afterDestroy][Error]',util[_0xcfb3('0x1a')](_0x23d877,{'showHidden':![],'depth':null}));_0x37514f(_0x23d877);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 0f4de93..f4e10a4 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x73dc93,_0x2550f7){var _0x4b568f=function(_0x3426bf){while(--_0x3426bf){_0x73dc93['push'](_0x73dc93['shift']());}};_0x4b568f(++_0x2550f7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 eec81b4..3d3568b 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 _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 +var _0xcf95=['INTEGER','sequelize','exports','STRING','PHONE'];(function(_0x32331c,_0x21515b){var _0x58319f=function(_0x52d27c){while(--_0x52d27c){_0x32331c['push'](_0x32331c['shift']());}};_0x58319f(++_0x21515b);}(_0xcf95,0xa1));var _0x5cf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf95[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5cf9('0x0'));module[_0x5cf9('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x5cf9('0x2')],'defaultValue':_0x5cf9('0x3')},'OrderBy':{'type':Sequelize[_0x5cf9('0x4')],'defaultValue':null},'description':{'type':Sequelize[_0x5cf9('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 4a51f84..88a8d61 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 _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 +var _0x4fc0=['key','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','rows','catch','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type'];(function(_0x541f1e,_0x13a0d1){var _0x1b25d4=function(_0x5bc54c){while(--_0x5bc54c){_0x541f1e['push'](_0x541f1e['shift']());}};_0x1b25d4(++_0x13a0d1);}(_0x4fc0,0x118));var _0x04fc=function(_0x112590,_0x4fef60){_0x112590=_0x112590-0x0;var _0x163543=_0x4fc0[_0x112590];return _0x163543;};'use strict';var emlformat=require(_0x04fc('0x0'));var rimraf=require(_0x04fc('0x1'));var zipdir=require(_0x04fc('0x2'));var jsonpatch=require(_0x04fc('0x3'));var rp=require(_0x04fc('0x4'));var moment=require('moment');var BPromise=require(_0x04fc('0x5'));var Mustache=require(_0x04fc('0x6'));var util=require(_0x04fc('0x7'));var path=require(_0x04fc('0x8'));var sox=require(_0x04fc('0x9'));var csv=require(_0x04fc('0xa'));var ejs=require(_0x04fc('0xb'));var fs=require('fs');var fs_extra=require(_0x04fc('0xc'));var _=require(_0x04fc('0xd'));var squel=require('squel');var crypto=require(_0x04fc('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x04fc('0xf'));var toCsv=require(_0x04fc('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x04fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x04fc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x04fc('0x12'));var logger=require(_0x04fc('0x13'))(_0x04fc('0x14'));var utils=require('../../config/utils');var config=require(_0x04fc('0x15'));var licenseUtil=require(_0x04fc('0x16'));var db=require(_0x04fc('0x17'))['db'];function respondWithStatusCode(_0x2ec7d7,_0x23e5d6){_0x23e5d6=_0x23e5d6||0xcc;return function(_0x1f6a03){if(_0x1f6a03){return _0x2ec7d7[_0x04fc('0x18')](_0x23e5d6);}return _0x2ec7d7[_0x04fc('0x19')](_0x23e5d6)[_0x04fc('0x1a')]();};}function respondWithResult(_0x41eff0,_0x149add){_0x149add=_0x149add||0xc8;return function(_0x8067d8){if(_0x8067d8){return _0x41eff0[_0x04fc('0x19')](_0x149add)['json'](_0x8067d8);}};}function respondWithFilteredResult(_0x242bdd,_0x3eb3c9){return function(_0x49c9a7){if(_0x49c9a7){var _0x192dc2=typeof _0x3eb3c9[_0x04fc('0x1b')]===_0x04fc('0x1c')&&typeof _0x3eb3c9[_0x04fc('0x1d')]==='undefined';var _0x4b6ae1=_0x49c9a7[_0x04fc('0x1e')];var _0x46d53c=_0x192dc2?0x0:_0x3eb3c9[_0x04fc('0x1b')];var _0x52508a=_0x192dc2?_0x49c9a7['count']:_0x3eb3c9[_0x04fc('0x1b')]+_0x3eb3c9[_0x04fc('0x1d')];var _0x28bfd3;if(_0x52508a>=_0x4b6ae1){_0x52508a=_0x4b6ae1;_0x28bfd3=0xc8;}else{_0x28bfd3=0xce;}_0x242bdd[_0x04fc('0x19')](_0x28bfd3);return _0x242bdd[_0x04fc('0x1f')](_0x04fc('0x20'),_0x46d53c+'-'+_0x52508a+'/'+_0x4b6ae1)[_0x04fc('0x21')](_0x49c9a7);}return null;};}function patchUpdates(_0x40578f){return function(_0x965529){try{jsonpatch['apply'](_0x965529,_0x40578f,!![]);}catch(_0x459a28){return BPromise['reject'](_0x459a28);}return _0x965529['save']();};}function saveUpdates(_0x3796ef,_0x3930df){return function(_0x4a2c1d){if(_0x4a2c1d){return _0x4a2c1d[_0x04fc('0x22')](_0x3796ef)[_0x04fc('0x23')](function(_0x304bb7){return _0x304bb7;});}return null;};}function removeEntity(_0x3a68bd,_0x9aca77){return function(_0x59fbfa){if(_0x59fbfa){return _0x59fbfa[_0x04fc('0x24')]()[_0x04fc('0x23')](function(){var _0x32f01c=_0x59fbfa[_0x04fc('0x25')]({'plain':!![]});var _0x204455='CmContactHasItems';return db[_0x04fc('0x26')]['destroy']({'where':{'type':_0x204455,'resourceId':_0x32f01c['id']}})['then'](function(){return _0x59fbfa;});})['then'](function(){_0x3a68bd[_0x04fc('0x19')](0xcc)[_0x04fc('0x1a')]();});}};}function handleEntityNotFound(_0x1131b5,_0x80ff7){return function(_0x577a08){if(!_0x577a08){_0x1131b5['sendStatus'](0x194);}return _0x577a08;};}function handleError(_0x47f8a0,_0x157291){_0x157291=_0x157291||0x1f4;return function(_0x57220a){logger['error'](_0x57220a[_0x04fc('0x27')]);if(_0x57220a[_0x04fc('0x28')]){delete _0x57220a[_0x04fc('0x28')];}_0x47f8a0[_0x04fc('0x19')](_0x157291)[_0x04fc('0x29')](_0x57220a);};}exports[_0x04fc('0x2a')]=function(_0x42e516,_0x5c4250){var _0x1aab0a={},_0x13b582={},_0x270a56={'count':0x0,'rows':[]};var _0x477b8c=_[_0x04fc('0x2b')](db[_0x04fc('0x2c')][_0x04fc('0x2d')],function(_0x4dce03){return{'name':_0x4dce03[_0x04fc('0x2e')],'type':_0x4dce03[_0x04fc('0x2f')][_0x04fc('0x30')]};});_0x13b582['model']=_['map'](_0x477b8c,_0x04fc('0x28'));_0x13b582['query']=_[_0x04fc('0x31')](_0x42e516['query']);_0x13b582['filters']=_[_0x04fc('0x32')](_0x13b582[_0x04fc('0x33')],_0x13b582[_0x04fc('0x34')]);_0x1aab0a[_0x04fc('0x35')]=_[_0x04fc('0x32')](_0x13b582[_0x04fc('0x33')],qs['fields'](_0x42e516[_0x04fc('0x34')][_0x04fc('0x36')]));_0x1aab0a['attributes']=_0x1aab0a[_0x04fc('0x35')][_0x04fc('0x37')]?_0x1aab0a[_0x04fc('0x35')]:_0x13b582['model'];if(!_0x42e516[_0x04fc('0x34')][_0x04fc('0x38')](_0x04fc('0x39'))){_0x1aab0a[_0x04fc('0x1d')]=qs['limit'](_0x42e516[_0x04fc('0x34')]['limit']);_0x1aab0a[_0x04fc('0x1b')]=qs[_0x04fc('0x1b')](_0x42e516[_0x04fc('0x34')][_0x04fc('0x1b')]);}_0x1aab0a[_0x04fc('0x3a')]=qs[_0x04fc('0x3b')](_0x42e516[_0x04fc('0x34')][_0x04fc('0x3b')]);_0x1aab0a[_0x04fc('0x3c')]=qs[_0x04fc('0x3d')](_[_0x04fc('0x3e')](_0x42e516['query'],_0x13b582['filters']),_0x477b8c);if(_0x42e516[_0x04fc('0x34')][_0x04fc('0x3f')]){_0x1aab0a['where']=_['merge'](_0x1aab0a[_0x04fc('0x3c')],{'$or':_[_0x04fc('0x2b')](_0x477b8c,function(_0x360bc6){if(_0x360bc6[_0x04fc('0x2f')]!==_0x04fc('0x40')){var _0x3985c6={};_0x3985c6[_0x360bc6[_0x04fc('0x28')]]={'$like':'%'+_0x42e516['query'][_0x04fc('0x3f')]+'%'};return _0x3985c6;}})});}_0x1aab0a=_['merge']({},_0x1aab0a,_0x42e516[_0x04fc('0x41')]);var _0x56ccba={'where':_0x1aab0a[_0x04fc('0x3c')]};return db[_0x04fc('0x2c')]['count'](_0x56ccba)[_0x04fc('0x23')](function(_0x204a38){_0x270a56['count']=_0x204a38;if(_0x42e516[_0x04fc('0x34')][_0x04fc('0x42')]){_0x1aab0a['include']=[{'all':!![]}];}return db[_0x04fc('0x2c')]['findAll'](_0x1aab0a);})[_0x04fc('0x23')](function(_0x5895a4){_0x270a56[_0x04fc('0x43')]=_0x5895a4;return _0x270a56;})[_0x04fc('0x23')](respondWithFilteredResult(_0x5c4250,_0x1aab0a))[_0x04fc('0x44')](handleError(_0x5c4250,null));};exports['show']=function(_0x23fd08,_0x385296){var _0x81e040={'raw':!![],'where':{'id':_0x23fd08[_0x04fc('0x45')]['id']}},_0x9426d={};_0x9426d['model']=_['keys'](db[_0x04fc('0x2c')][_0x04fc('0x2d')]);_0x9426d['query']=_[_0x04fc('0x31')](_0x23fd08['query']);_0x9426d[_0x04fc('0x3d')]=_[_0x04fc('0x32')](_0x9426d[_0x04fc('0x33')],_0x9426d[_0x04fc('0x34')]);_0x81e040[_0x04fc('0x35')]=_[_0x04fc('0x32')](_0x9426d['model'],qs[_0x04fc('0x36')](_0x23fd08['query'][_0x04fc('0x36')]));_0x81e040['attributes']=_0x81e040[_0x04fc('0x35')][_0x04fc('0x37')]?_0x81e040['attributes']:_0x9426d[_0x04fc('0x33')];if(_0x23fd08[_0x04fc('0x34')][_0x04fc('0x42')]){_0x81e040[_0x04fc('0x46')]=[{'all':!![]}];}_0x81e040=_['merge']({},_0x81e040,_0x23fd08[_0x04fc('0x41')]);return db[_0x04fc('0x2c')][_0x04fc('0x47')](_0x81e040)[_0x04fc('0x23')](handleEntityNotFound(_0x385296,null))[_0x04fc('0x23')](respondWithResult(_0x385296,null))[_0x04fc('0x44')](handleError(_0x385296,null));};exports['create']=function(_0x19bca2,_0x599195){return db[_0x04fc('0x2c')][_0x04fc('0x48')](_0x19bca2[_0x04fc('0x49')],{})[_0x04fc('0x23')](function(_0x2dc1b4){var _0x3d745d=_0x19bca2[_0x04fc('0x4a')]['get']({'plain':!![]});if(!_0x3d745d)throw new Error(_0x04fc('0x4b'));if(_0x3d745d[_0x04fc('0x4c')]===_0x04fc('0x4a')){var _0x4583d1=_0x2dc1b4[_0x04fc('0x25')]({'plain':!![]});var _0xadd99e='CmContactHasItems';return db[_0x04fc('0x4d')]['find']({'where':{'name':_0xadd99e,'userProfileId':_0x3d745d[_0x04fc('0x4e')]},'raw':!![]})['then'](function(_0xc0537b){if(_0xc0537b&&_0xc0537b[_0x04fc('0x4f')]===0x0){return db[_0x04fc('0x26')][_0x04fc('0x48')]({'name':_0x4583d1[_0x04fc('0x28')],'resourceId':_0x4583d1['id'],'type':_0xc0537b[_0x04fc('0x28')],'sectionId':_0xc0537b['id']},{})[_0x04fc('0x23')](function(){return _0x2dc1b4;});}else{return _0x2dc1b4;}})['catch'](function(_0x5a4a25){logger[_0x04fc('0x50')](_0x04fc('0x51'),_0x5a4a25);throw _0x5a4a25;});}return _0x2dc1b4;})[_0x04fc('0x23')](respondWithResult(_0x599195,0xc9))[_0x04fc('0x44')](handleError(_0x599195,null));};exports['update']=function(_0x3b29f2,_0x5f271c){if(_0x3b29f2['body']['id']){delete _0x3b29f2['body']['id'];}return db[_0x04fc('0x2c')][_0x04fc('0x47')]({'where':{'id':_0x3b29f2['params']['id']}})[_0x04fc('0x23')](handleEntityNotFound(_0x5f271c,null))[_0x04fc('0x23')](saveUpdates(_0x3b29f2[_0x04fc('0x49')],null))[_0x04fc('0x23')](respondWithResult(_0x5f271c,null))['catch'](handleError(_0x5f271c,null));};exports['destroy']=function(_0x3fd66d,_0x20b615){return db[_0x04fc('0x2c')]['find']({'where':{'id':_0x3fd66d[_0x04fc('0x45')]['id']}})['then'](handleEntityNotFound(_0x20b615,null))['then'](removeEntity(_0x20b615,null))[_0x04fc('0x44')](handleError(_0x20b615,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index e5e0011..2bc41d9 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 _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 +var _0xfb62=['define','cm_contact_has_items','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes'];(function(_0x5f108e,_0x4bfd98){var _0x54a18c=function(_0x8be94){while(--_0x8be94){_0x5f108e['push'](_0x5f108e['shift']());}};_0x54a18c(++_0x4bfd98);}(_0xfb62,0xec));var _0x2fb6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfb62[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x2fb6('0x0'));var util=require(_0x2fb6('0x1'));var logger=require(_0x2fb6('0x2'))(_0x2fb6('0x3'));var moment=require(_0x2fb6('0x4'));var BPromise=require(_0x2fb6('0x5'));var rp=require(_0x2fb6('0x6'));var fs=require('fs');var path=require(_0x2fb6('0x7'));var rimraf=require(_0x2fb6('0x8'));var config=require(_0x2fb6('0x9'));var attributes=require(_0x2fb6('0xa'));module['exports']=function(_0xa8185e,_0x1fdf53){return _0xa8185e[_0x2fb6('0xb')]('CmContactHasItem',attributes,{'tableName':_0x2fb6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 0a1c813..5032295 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 _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 +var _0x573c=['info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x573c,0x1b4));var _0xc573=function(_0x1bcf1f,_0x4bbe6a){_0x1bcf1f=_0x1bcf1f-0x0;var _0x479e97=_0x573c[_0x1bcf1f];return _0x479e97;};'use strict';var _=require(_0xc573('0x0'));var util=require(_0xc573('0x1'));var moment=require(_0xc573('0x2'));var BPromise=require(_0xc573('0x3'));var rs=require(_0xc573('0x4'));var fs=require('fs');var Redis=require(_0xc573('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc573('0x6'));var logger=require(_0xc573('0x7'))(_0xc573('0x8'));var config=require(_0xc573('0x9'));var jayson=require(_0xc573('0xa'));var client=jayson['client'][_0xc573('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a9275,_0x29091d,_0x17a331){return new BPromise(function(_0x44e538,_0x255fe2){return client[_0xc573('0xc')](_0x2a9275,_0x17a331)[_0xc573('0xd')](function(_0x24c8f6){logger[_0xc573('0xe')](_0xc573('0xf'),_0x29091d,_0xc573('0x10'));logger[_0xc573('0x11')](_0xc573('0x12'),_0x29091d,_0xc573('0x10'),JSON[_0xc573('0x13')](_0x24c8f6));if(_0x24c8f6['error']){if(_0x24c8f6['error'][_0xc573('0x14')]===0x1f4){logger[_0xc573('0x15')]('CmContactHasItem,\x20%s,\x20%s',_0x29091d,_0x24c8f6[_0xc573('0x15')][_0xc573('0x16')]);return _0x255fe2(_0x24c8f6[_0xc573('0x15')][_0xc573('0x16')]);}logger[_0xc573('0x15')]('CmContactHasItem,\x20%s,\x20%s',_0x29091d,_0x24c8f6['error']['message']);return _0x44e538(_0x24c8f6['error'][_0xc573('0x16')]);}else{logger[_0xc573('0xe')](_0xc573('0xf'),_0x29091d,_0xc573('0x10'));_0x44e538(_0x24c8f6[_0xc573('0x17')][_0xc573('0x16')]);}})[_0xc573('0x18')](function(_0x3c4377){logger[_0xc573('0x15')](_0xc573('0xf'),_0x29091d,_0x3c4377);_0x255fe2(_0x3c4377);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 659b866..1914227 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 _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 +var _0xa9e2=['post','create','put','update','delete','util','path','fs-extra','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4ae4ab,_0x1829bf){var _0x1ae9b1=function(_0x334ea0){while(--_0x334ea0){_0x4ae4ab['push'](_0x4ae4ab['shift']());}};_0x1ae9b1(++_0x1829bf);}(_0xa9e2,0x1e5));var _0x2a9e=function(_0x130d5a,_0x28ab74){_0x130d5a=_0x130d5a-0x0;var _0x3f73a7=_0xa9e2[_0x130d5a];return _0x3f73a7;};'use strict';var multer=require('multer');var util=require(_0x2a9e('0x0'));var path=require(_0x2a9e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x2a9e('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x2a9e('0x3'));var config=require(_0x2a9e('0x4'));var controller=require(_0x2a9e('0x5'));router[_0x2a9e('0x6')]('/',auth[_0x2a9e('0x7')](),controller[_0x2a9e('0x8')]);router['get'](_0x2a9e('0x9'),auth[_0x2a9e('0x7')](),controller[_0x2a9e('0xa')]);router[_0x2a9e('0xb')]('/',auth[_0x2a9e('0x7')](),controller[_0x2a9e('0xc')]);router[_0x2a9e('0xd')](_0x2a9e('0x9'),auth[_0x2a9e('0x7')](),controller[_0x2a9e('0xe')]);router[_0x2a9e('0xf')]('/:id',auth[_0x2a9e('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 4b55e53..4ff3aa9 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 _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 +var _0xfd9a=['STRING','TEXT','type','select','parse','values','isArray','setDataValue','stringify','BOOLEAN','voice','sequelize','exports','VIRTUAL','getDataValue','alias','name'];(function(_0x5f4172,_0x3e100c){var _0x394ab7=function(_0x19f1a6){while(--_0x19f1a6){_0x5f4172['push'](_0x5f4172['shift']());}};_0x394ab7(++_0x3e100c);}(_0xfd9a,0x93));var _0xafd9=function(_0x291dd7,_0x35f002){_0x291dd7=_0x291dd7-0x0;var _0x37cefc=_0xfd9a[_0x291dd7];return _0x37cefc;};'use strict';var Sequelize=require(_0xafd9('0x0'));var _=require('lodash');module[_0xafd9('0x1')]={'name':{'type':Sequelize[_0xafd9('0x2')],'get':function(_0x3b081e){return this[_0xafd9('0x3')](_0xafd9('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x284e3b){this['setDataValue'](_0xafd9('0x4'),_0x284e3b?_0x284e3b:this['getDataValue'](_0xafd9('0x5')));}},'type':{'type':Sequelize[_0xafd9('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0xafd9('0x7')]('long'),'get':function(){if(this[_0xafd9('0x3')](_0xafd9('0x8'))===_0xafd9('0x9')){return JSON[_0xafd9('0xa')](this[_0xafd9('0x3')](_0xafd9('0xb')));}else{return this[_0xafd9('0x3')](_0xafd9('0xb'));}},'set':function(_0x18a43b){if(Array[_0xafd9('0xc')](_0x18a43b)){this[_0xafd9('0xd')](_0xafd9('0xb'),JSON[_0xafd9('0xe')](_0x18a43b));}else{this[_0xafd9('0xd')]('values',_0x18a43b);}}},'required':{'type':Sequelize[_0xafd9('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xafd9('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0xafd9('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 0485dba..0f1d8b9 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 _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 +var _0x2858=['../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','count','apply','reject','save','update','destroy','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','differenceBy','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','then','rows','show','params','model','keys','length','includeAll','options','catch','body','find','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x7cf3f,_0xe55dd5){var _0x2ccb8f=function(_0x112ba7){while(--_0x112ba7){_0x7cf3f['push'](_0x7cf3f['shift']());}};_0x2ccb8f(++_0xe55dd5);}(_0x2858,0x1ef));var _0x8285=function(_0x5ed928,_0x2dbbdc){_0x5ed928=_0x5ed928-0x0;var _0x2effcc=_0x2858[_0x5ed928];return _0x2effcc;};'use strict';var emlformat=require(_0x8285('0x0'));var rimraf=require(_0x8285('0x1'));var zipdir=require(_0x8285('0x2'));var jsonpatch=require(_0x8285('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8285('0x4'));var path=require(_0x8285('0x5'));var sox=require(_0x8285('0x6'));var csv=require('to-csv');var ejs=require(_0x8285('0x7'));var fs=require('fs');var fs_extra=require(_0x8285('0x8'));var _=require(_0x8285('0x9'));var squel=require('squel');var crypto=require(_0x8285('0xa'));var jsforce=require(_0x8285('0xb'));var deskjs=require(_0x8285('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8285('0xd'));var Redis=require(_0x8285('0xe'));var authService=require(_0x8285('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8285('0x10'));var hardwareService=require(_0x8285('0x11'));var logger=require(_0x8285('0x12'))(_0x8285('0x13'));var utils=require(_0x8285('0x14'));var config=require(_0x8285('0x15'));var licenseUtil=require(_0x8285('0x16'));var db=require(_0x8285('0x17'))['db'];function respondWithStatusCode(_0x123d05,_0x104335){_0x104335=_0x104335||0xcc;return function(_0x11fe23){if(_0x11fe23){return _0x123d05['sendStatus'](_0x104335);}return _0x123d05[_0x8285('0x18')](_0x104335)[_0x8285('0x19')]();};}function respondWithResult(_0x33aa0f,_0x37c370){_0x37c370=_0x37c370||0xc8;return function(_0x5bce91){if(_0x5bce91){return _0x33aa0f[_0x8285('0x18')](_0x37c370)[_0x8285('0x1a')](_0x5bce91);}};}function respondWithFilteredResult(_0x553e70,_0x27ff85){return function(_0x5893eb){if(_0x5893eb){var _0x223f9f=typeof _0x27ff85['offset']==='undefined'&&typeof _0x27ff85[_0x8285('0x1b')]==='undefined';var _0x580cc7=_0x5893eb[_0x8285('0x1c')];var _0x2d44ce=_0x223f9f?0x0:_0x27ff85['offset'];var _0x31da80=_0x223f9f?_0x5893eb[_0x8285('0x1c')]:_0x27ff85['offset']+_0x27ff85[_0x8285('0x1b')];var _0x585a2f;if(_0x31da80>=_0x580cc7){_0x31da80=_0x580cc7;_0x585a2f=0xc8;}else{_0x585a2f=0xce;}_0x553e70[_0x8285('0x18')](_0x585a2f);return _0x553e70['set']('Content-Range',_0x2d44ce+'-'+_0x31da80+'/'+_0x580cc7)[_0x8285('0x1a')](_0x5893eb);}return null;};}function patchUpdates(_0x372dcd){return function(_0x333c9d){try{jsonpatch[_0x8285('0x1d')](_0x333c9d,_0x372dcd,!![]);}catch(_0x10a7a2){return BPromise[_0x8285('0x1e')](_0x10a7a2);}return _0x333c9d[_0x8285('0x1f')]();};}function saveUpdates(_0x29dfaa,_0x4924cf){return function(_0x4a3379){if(_0x4a3379){return _0x4a3379[_0x8285('0x20')](_0x29dfaa)['then'](function(_0x3d9a5c){return _0x3d9a5c;});}return null;};}function removeEntity(_0x59955d,_0x45b2fb){return function(_0x5cc814){if(_0x5cc814){return _0x5cc814[_0x8285('0x21')]()['then'](function(){_0x59955d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x167c8c,_0x4ced8d){return function(_0x3ab6df){if(!_0x3ab6df){_0x167c8c['sendStatus'](0x194);}return _0x3ab6df;};}function handleError(_0x2b7dfe,_0x4d666f){_0x4d666f=_0x4d666f||0x1f4;return function(_0xdead27){logger[_0x8285('0x22')](_0xdead27[_0x8285('0x23')]);if(_0xdead27['name']){delete _0xdead27[_0x8285('0x24')];}_0x2b7dfe[_0x8285('0x18')](_0x4d666f)[_0x8285('0x25')](_0xdead27);};}exports[_0x8285('0x26')]=function(_0x3d47df,_0x2bdf86){var _0x505aae={},_0x5820aa={},_0xc1cdf2={'count':0x0,'rows':[]};var _0x5e2d32=_[_0x8285('0x27')](db[_0x8285('0x28')][_0x8285('0x29')],function(_0x53059e){return{'name':_0x53059e[_0x8285('0x2a')],'type':_0x53059e[_0x8285('0x2b')]['key']};});_0x5820aa['model']=_[_0x8285('0x2c')](_[_0x8285('0x27')](_0x5e2d32,_0x8285('0x24')),[_0x8285('0x24')]);_0x5820aa[_0x8285('0x2d')]=_['keys'](_0x3d47df[_0x8285('0x2d')]);_0x5820aa[_0x8285('0x2e')]=_[_0x8285('0x2f')](_0x5820aa['model'],_0x5820aa[_0x8285('0x2d')]);_0x505aae[_0x8285('0x30')]=_[_0x8285('0x2f')](_0x5820aa['model'],qs[_0x8285('0x31')](_0x3d47df[_0x8285('0x2d')]['fields']));_0x505aae[_0x8285('0x30')]=_0x505aae[_0x8285('0x30')]['length']?_0x505aae[_0x8285('0x30')]:_0x5820aa['model'];if(!_0x3d47df[_0x8285('0x2d')][_0x8285('0x32')](_0x8285('0x33'))){_0x505aae[_0x8285('0x1b')]=qs[_0x8285('0x1b')](_0x3d47df[_0x8285('0x2d')][_0x8285('0x1b')]);_0x505aae[_0x8285('0x34')]=qs['offset'](_0x3d47df[_0x8285('0x2d')][_0x8285('0x34')]);}_0x505aae[_0x8285('0x35')]=qs[_0x8285('0x36')](_0x3d47df[_0x8285('0x2d')]['sort']);_0x505aae[_0x8285('0x37')]=qs[_0x8285('0x2e')](_[_0x8285('0x38')](_0x3d47df[_0x8285('0x2d')],_0x5820aa[_0x8285('0x2e')]),_0x5e2d32);if(_0x3d47df['query'][_0x8285('0x39')]){_0x505aae['where']=_[_0x8285('0x3a')](_0x505aae['where'],{'$or':_[_0x8285('0x27')](_0x5e2d32,function(_0x103df2){if(_0x103df2['type']!=='VIRTUAL'){var _0x5641f0={};_0x5641f0[_0x103df2['name']]={'$like':'%'+_0x3d47df[_0x8285('0x2d')][_0x8285('0x39')]+'%'};return _0x5641f0;}})});}_0x505aae=_[_0x8285('0x3a')]({},_0x505aae,_0x3d47df['options']);var _0x466d64={'where':_0x505aae[_0x8285('0x37')]};return db['CmCustomField'][_0x8285('0x1c')](_0x466d64)[_0x8285('0x3b')](function(_0x5c0508){_0xc1cdf2[_0x8285('0x1c')]=_0x5c0508;if(_0x3d47df[_0x8285('0x2d')]['includeAll']){_0x505aae['include']=[{'all':!![]}];}return db[_0x8285('0x28')]['findAll'](_0x505aae);})[_0x8285('0x3b')](function(_0x48b501){_0xc1cdf2[_0x8285('0x3c')]=_0x48b501;return _0xc1cdf2;})[_0x8285('0x3b')](respondWithFilteredResult(_0x2bdf86,_0x505aae))['catch'](handleError(_0x2bdf86,null));};exports[_0x8285('0x3d')]=function(_0x2a4133,_0x47d61c){var _0x375b8c={'raw':!![],'where':{'id':_0x2a4133[_0x8285('0x3e')]['id']}},_0x22b3bb={};_0x22b3bb[_0x8285('0x3f')]=_[_0x8285('0x40')](db[_0x8285('0x28')]['rawAttributes']);_0x22b3bb[_0x8285('0x2d')]=_['keys'](_0x2a4133[_0x8285('0x2d')]);_0x22b3bb[_0x8285('0x2e')]=_[_0x8285('0x2f')](_0x22b3bb[_0x8285('0x3f')],_0x22b3bb['query']);_0x375b8c[_0x8285('0x30')]=_['intersection'](_0x22b3bb[_0x8285('0x3f')],qs[_0x8285('0x31')](_0x2a4133['query'][_0x8285('0x31')]));_0x375b8c[_0x8285('0x30')]=_0x375b8c[_0x8285('0x30')][_0x8285('0x41')]?_0x375b8c[_0x8285('0x30')]:_0x22b3bb[_0x8285('0x3f')];if(_0x2a4133[_0x8285('0x2d')][_0x8285('0x42')]){_0x375b8c['include']=[{'all':!![]}];}_0x375b8c=_[_0x8285('0x3a')]({},_0x375b8c,_0x2a4133[_0x8285('0x43')]);return db[_0x8285('0x28')]['find'](_0x375b8c)['then'](handleEntityNotFound(_0x47d61c,null))[_0x8285('0x3b')](respondWithResult(_0x47d61c,null))[_0x8285('0x44')](handleError(_0x47d61c,null));};exports[_0x8285('0x20')]=function(_0x331e8a,_0x9d02eb){if(_0x331e8a['body']['id']){delete _0x331e8a[_0x8285('0x45')]['id'];}return db[_0x8285('0x28')][_0x8285('0x46')]({'where':{'id':_0x331e8a[_0x8285('0x3e')]['id']}})['then'](handleEntityNotFound(_0x9d02eb,null))[_0x8285('0x3b')](saveUpdates(_0x331e8a[_0x8285('0x45')],null))['then'](respondWithResult(_0x9d02eb,null))[_0x8285('0x44')](handleError(_0x9d02eb,null));};exports[_0x8285('0x21')]=function(_0x268a54,_0x56a6eb){return db[_0x8285('0x28')][_0x8285('0x46')]({'where':{'id':_0x268a54[_0x8285('0x3e')]['id']}})[_0x8285('0x3b')](handleEntityNotFound(_0x56a6eb,null))[_0x8285('0x3b')](removeEntity(_0x56a6eb,null))['catch'](handleError(_0x56a6eb,null));};exports[_0x8285('0x47')]=function(_0x15b360,_0x10b6a9){var _0x368359;return db[_0x8285('0x48')][_0x8285('0x49')](function(_0x1addfa){return db['CmCustomField'][_0x8285('0x47')](_0x15b360[_0x8285('0x45')],{'transaction':_0x1addfa})[_0x8285('0x3b')](function(_0x5cd542){_0x368359=_0x5cd542;var _0x38c1d5={'type':db[_0x8285('0x4a')][_0x8285('0x4b')],'transaction':_0x1addfa};switch(_0x15b360[_0x8285('0x45')][_0x8285('0x2b')]){case _0x8285('0x4c'):_0x38c1d5['type']=db[_0x8285('0x4a')]['TEXT'];break;case _0x8285('0x4d'):_0x38c1d5[_0x8285('0x2b')]=db['Sequelize'][_0x8285('0x4e')];break;case _0x8285('0x4f'):_0x38c1d5['type']=db['Sequelize'][_0x8285('0x50')];_0x38c1d5[_0x8285('0x51')]=![];break;default:}return db[_0x8285('0x48')]['queryInterface'][_0x8285('0x52')](_0x8285('0x53'),util[_0x8285('0x54')](_0x8285('0x55'),_0x368359['id']),_0x38c1d5);})[_0x8285('0x3b')](function(){return _0x368359;});})[_0x8285('0x3b')](respondWithResult(_0x10b6a9,0xc9))[_0x8285('0x44')](handleError(_0x10b6a9,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index b5f2186..01946bd 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 _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 +var _0xfd68=['moment','bluebird','path','rimraf','../../config/environment','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfd68,0xed));var _0x8fd6=function(_0x1e6579,_0x595c18){_0x1e6579=_0x1e6579-0x0;var _0x2f8541=_0xfd68[_0x1e6579];return _0x2f8541;};'use strict';var _=require(_0x8fd6('0x0'));var util=require(_0x8fd6('0x1'));var logger=require(_0x8fd6('0x2'))('api');var moment=require(_0x8fd6('0x3'));var BPromise=require(_0x8fd6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8fd6('0x5'));var rimraf=require(_0x8fd6('0x6'));var config=require(_0x8fd6('0x7'));var attributes=require('./cmCustomField.attributes');module[_0x8fd6('0x8')]=function(_0x461792,_0x45b563){return _0x461792[_0x8fd6('0x9')](_0x8fd6('0xa'),attributes,{'tableName':_0x8fd6('0xb'),'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 f8d569e..3d21834 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 _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 +var _0xa92d=['lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3cf71b,_0x4c322d){var _0x13794b=function(_0x1e8ace){while(--_0x1e8ace){_0x3cf71b['push'](_0x3cf71b['shift']());}};_0x13794b(++_0x4c322d);}(_0xa92d,0xb4));var _0xda92=function(_0x141ede,_0x11da0f){_0x141ede=_0x141ede-0x0;var _0x3e9b5f=_0xa92d[_0x141ede];return _0x3e9b5f;};'use strict';var _=require(_0xda92('0x0'));var util=require(_0xda92('0x1'));var moment=require('moment');var BPromise=require(_0xda92('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda92('0x3'))['db'];var utils=require(_0xda92('0x4'));var logger=require('../../config/logger')(_0xda92('0x5'));var config=require('../../config/environment');var jayson=require(_0xda92('0x6'));var client=jayson[_0xda92('0x7')][_0xda92('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x23e73f,_0x2684ba,_0x596c62){return new BPromise(function(_0x8a468c,_0x522272){return client[_0xda92('0x9')](_0x23e73f,_0x596c62)['then'](function(_0x183464){logger[_0xda92('0xa')](_0xda92('0xb'),_0x2684ba,_0xda92('0xc'));logger[_0xda92('0xd')](_0xda92('0xe'),_0x2684ba,_0xda92('0xc'),JSON[_0xda92('0xf')](_0x183464));if(_0x183464[_0xda92('0x10')]){if(_0x183464[_0xda92('0x10')][_0xda92('0x11')]===0x1f4){logger[_0xda92('0x10')](_0xda92('0xb'),_0x2684ba,_0x183464['error'][_0xda92('0x12')]);return _0x522272(_0x183464[_0xda92('0x10')][_0xda92('0x12')]);}logger[_0xda92('0x10')](_0xda92('0xb'),_0x2684ba,_0x183464[_0xda92('0x10')][_0xda92('0x12')]);return _0x8a468c(_0x183464[_0xda92('0x10')][_0xda92('0x12')]);}else{logger[_0xda92('0xa')](_0xda92('0xb'),_0x2684ba,'request\x20sent');_0x8a468c(_0x183464[_0xda92('0x13')][_0xda92('0x12')]);}})['catch'](function(_0x3c73ca){logger[_0xda92('0x10')](_0xda92('0xb'),_0x2684ba,_0x3c73ca);_0x522272(_0x3c73ca);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index dd9f549..52392a8 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 _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 +var _0x1670=['isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x528bf0,_0x12f62f){var _0x40b086=function(_0x517bbb){while(--_0x517bbb){_0x528bf0['push'](_0x528bf0['shift']());}};_0x40b086(++_0x12f62f);}(_0x1670,0x9a));var _0x0167=function(_0x818b0f,_0xaf6fa5){_0x818b0f=_0x818b0f-0x0;var _0x4220a9=_0x1670[_0x818b0f];return _0x4220a9;};'use strict';var multer=require(_0x0167('0x0'));var util=require(_0x0167('0x1'));var path=require('path');var timeout=require(_0x0167('0x2'));var express=require('express');var router=express[_0x0167('0x3')]();var fs_extra=require(_0x0167('0x4'));var auth=require(_0x0167('0x5'));var interaction=require(_0x0167('0x6'));var config=require('../../config/environment');var controller=require('./cmCustomField.controller');router[_0x0167('0x7')]('/',auth[_0x0167('0x8')](),controller[_0x0167('0x9')]);router[_0x0167('0x7')](_0x0167('0xa'),auth[_0x0167('0x8')](),controller[_0x0167('0xb')]);router[_0x0167('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0167('0xd')](_0x0167('0xa'),auth[_0x0167('0x8')](),controller[_0x0167('0xe')]);router[_0x0167('0xf')](_0x0167('0xa'),auth[_0x0167('0x8')](),controller[_0x0167('0x10')]);module[_0x0167('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 61b0915..2a6208f 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 _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 +var _0x809a=['STRING','BOOLEAN','DATE','format','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports'];(function(_0xe3be75,_0x27bae4){var _0x1a2477=function(_0x43e917){while(--_0x43e917){_0xe3be75['push'](_0xe3be75['shift']());}};_0x1a2477(++_0x27bae4);}(_0x809a,0x1b5));var _0xa809=function(_0x439e90,_0x449bef){_0x439e90=_0x439e90-0x0;var _0x13c857=_0x809a[_0x439e90];return _0x13c857;};'use strict';var moment=require(_0xa809('0x0'));var Sequelize=require(_0xa809('0x1'));module[_0xa809('0x2')]={'phone':{'type':Sequelize[_0xa809('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xa809('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xa809('0x5')],'defaultValue':moment()[_0xa809('0x6')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xa809('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa809('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa809('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xa809('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xa809('0x7')](0x2)[_0xa809('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xa809('0x7')],'unique':_0xa809('0x9')},'ListId':{'type':Sequelize[_0xa809('0x7')],'unique':_0xa809('0x9')},'UserId':{'type':Sequelize[_0xa809('0x7')]},'VoiceQueueId':{'type':Sequelize[_0xa809('0x7')],'unique':_0xa809('0x9')},'CampaignId':{'type':Sequelize[_0xa809('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xa809('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa809('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa809('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa809('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa809('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xa809('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xa809('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0xa809('0x5')],'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 ec2e377..51d71b5 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 _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 +var _0x4b84=['campaigntype','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','value','direction','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','Contact','CmCompany','List','Queue','getPreviewRecall','sequelize','LOCK','Company','dialActive','getOpenContacts','preview','format','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','timezones','push','getTimezone','moment','lodash','api','undefined','count','offset','limit','status','set','json','then','error','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','concat','$or','$gte','$lt','$lte','$ne','$eq','$between','$in','$notIn','$notLike','$iLike','$notILike','$overlap','$contains','$any','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','CmHopper','includeAll','findAll','rows','catch','params','include','find','create','body','update','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','statedesc','deleted','campaign','membername','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone'];(function(_0x5cc655,_0x4b6145){var _0x244379=function(_0x30d2c5){while(--_0x30d2c5){_0x5cc655['push'](_0x5cc655['shift']());}};_0x244379(++_0x4b6145);}(_0x4b84,0x1cc));var _0x44b8=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x4b84[_0x12d033];return _0x3b4e80;};'use strict';var moment=require(_0x44b8('0x0'));var _=require(_0x44b8('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x44b8('0x2'));var shared=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithResult(_0x3b26c7,_0x31282a){_0x31282a=_0x31282a||0xc8;return function(_0x39ad16){if(_0x39ad16){return _0x3b26c7['status'](_0x31282a)['json'](_0x39ad16);}};}function respondWithFilteredResult(_0x55f25d,_0x996a8b){return function(_0x54274b){if(_0x54274b){var _0x327f59=typeof _0x996a8b['offset']===_0x44b8('0x3')&&typeof _0x996a8b['limit']==='undefined';var _0x41d515=_0x54274b[_0x44b8('0x4')];var _0x30ebc3=_0x327f59?0x0:_0x996a8b['offset'];var _0xc650ec=_0x327f59?_0x54274b[_0x44b8('0x4')]:_0x996a8b[_0x44b8('0x5')]+_0x996a8b[_0x44b8('0x6')];var _0x24dd10;if(_0xc650ec>=_0x41d515){_0xc650ec=_0x41d515;_0x24dd10=0xc8;}else{_0x24dd10=0xce;}_0x55f25d[_0x44b8('0x7')](_0x24dd10);return _0x55f25d[_0x44b8('0x8')]('Content-Range',_0x30ebc3+'-'+_0xc650ec+'/'+_0x41d515)[_0x44b8('0x9')](_0x54274b);}return null;};}function saveUpdates(_0x4301a6,_0x4bcc43){return function(_0x194230){if(_0x194230){return _0x194230['update'](_0x4301a6)[_0x44b8('0xa')](function(_0x18d642){return _0x18d642;});}return null;};}function handleEntityNotFound(_0x4df670,_0x63e8f6){return function(_0x4be54c){if(!_0x4be54c){_0x4df670['sendStatus'](0x194);}return _0x4be54c;};}function handleError(_0x2a3e4c,_0x2af0ad){_0x2af0ad=_0x2af0ad||0x1f4;return function(_0x1722da){logger[_0x44b8('0xb')](_0x1722da['stack']);if(_0x1722da['name']){delete _0x1722da['name'];}_0x2a3e4c[_0x44b8('0x7')](_0x2af0ad)['send'](_0x1722da);};}exports[_0x44b8('0xc')]=function(_0x31651b,_0x55e258){var _0x36743e={},_0xe3de8f={},_0x5103f5={'count':0x0,'rows':[]};var _0x89bc30=_[_0x44b8('0xd')](db['CmHopper'][_0x44b8('0xe')],function(_0x8b4301){return{'name':_0x8b4301[_0x44b8('0xf')],'type':_0x8b4301[_0x44b8('0x10')][_0x44b8('0x11')]};});_0xe3de8f[_0x44b8('0x12')]=_[_0x44b8('0xd')](_0x89bc30,_0x44b8('0x13'));_0xe3de8f[_0x44b8('0x14')]=_[_0x44b8('0x15')](_0x31651b[_0x44b8('0x14')]);_0xe3de8f[_0x44b8('0x16')]=_['intersection'](_0xe3de8f[_0x44b8('0x12')],_0xe3de8f[_0x44b8('0x14')]);_0xe3de8f[_0x44b8('0x16')]=_[_0x44b8('0x17')](_0xe3de8f[_0x44b8('0x16')],['$and',_0x44b8('0x18'),'$gt',_0x44b8('0x19'),_0x44b8('0x1a'),_0x44b8('0x1b'),_0x44b8('0x1c'),_0x44b8('0x1d'),'$not',_0x44b8('0x1e'),'$notBetween',_0x44b8('0x1f'),_0x44b8('0x20'),'$like',_0x44b8('0x21'),_0x44b8('0x22'),_0x44b8('0x23'),'$like',_0x44b8('0x24'),_0x44b8('0x25'),'$contained',_0x44b8('0x26')]);_0x36743e['attributes']=_[_0x44b8('0x27')](_0xe3de8f['model'],qs['fields'](_0x31651b['query'][_0x44b8('0x28')]));_0x36743e[_0x44b8('0x29')]=_0x36743e[_0x44b8('0x29')][_0x44b8('0x2a')]?_0x36743e[_0x44b8('0x29')]:_0xe3de8f[_0x44b8('0x12')];if(!_0x31651b[_0x44b8('0x14')][_0x44b8('0x2b')](_0x44b8('0x2c'))){_0x36743e[_0x44b8('0x6')]=qs[_0x44b8('0x6')](_0x31651b[_0x44b8('0x14')][_0x44b8('0x6')]);_0x36743e['offset']=qs[_0x44b8('0x5')](_0x31651b['query'][_0x44b8('0x5')]);}_0x36743e[_0x44b8('0x2d')]=qs[_0x44b8('0x2e')](_0x31651b[_0x44b8('0x14')][_0x44b8('0x2e')]);_0x36743e['where']=qs[_0x44b8('0x16')](_[_0x44b8('0x2f')](_0x31651b[_0x44b8('0x14')],_0xe3de8f[_0x44b8('0x16')]),_0x89bc30);if(_0x31651b[_0x44b8('0x14')]['filter']){_0x36743e[_0x44b8('0x30')]=_[_0x44b8('0x31')](_0x36743e[_0x44b8('0x30')],{'$or':_[_0x44b8('0xd')](_0x89bc30,function(_0x140a79){if(_0x140a79[_0x44b8('0x10')]!==_0x44b8('0x32')){var _0x14a9d7={};_0x14a9d7[_0x140a79[_0x44b8('0x13')]]={'$like':'%'+_0x31651b[_0x44b8('0x14')][_0x44b8('0x33')]+'%'};return _0x14a9d7;}})});}_0x36743e=_[_0x44b8('0x31')]({},_0x36743e,_0x31651b[_0x44b8('0x34')]);var _0xae15f4={'where':_0x36743e[_0x44b8('0x30')]};return db[_0x44b8('0x35')][_0x44b8('0x4')](_0xae15f4)[_0x44b8('0xa')](function(_0x28faa9){_0x5103f5[_0x44b8('0x4')]=_0x28faa9;if(_0x31651b[_0x44b8('0x14')][_0x44b8('0x36')]){_0x36743e['include']=[{'all':!![]}];}return db[_0x44b8('0x35')][_0x44b8('0x37')](_0x36743e);})['then'](function(_0x25688b){_0x5103f5[_0x44b8('0x38')]=_0x25688b;return _0x5103f5;})[_0x44b8('0xa')](respondWithFilteredResult(_0x55e258,_0x36743e))[_0x44b8('0x39')](handleError(_0x55e258,null));};exports['show']=function(_0x221543,_0x11e4e3){var _0x3611b4={'raw':!![],'where':{'id':_0x221543[_0x44b8('0x3a')]['id']}},_0x1ee3cc={};_0x1ee3cc[_0x44b8('0x12')]=_[_0x44b8('0x15')](db[_0x44b8('0x35')][_0x44b8('0xe')]);_0x1ee3cc[_0x44b8('0x14')]=_[_0x44b8('0x15')](_0x221543[_0x44b8('0x14')]);_0x1ee3cc[_0x44b8('0x16')]=_[_0x44b8('0x27')](_0x1ee3cc[_0x44b8('0x12')],_0x1ee3cc[_0x44b8('0x14')]);_0x3611b4['attributes']=_[_0x44b8('0x27')](_0x1ee3cc[_0x44b8('0x12')],qs[_0x44b8('0x28')](_0x221543['query'][_0x44b8('0x28')]));_0x3611b4[_0x44b8('0x29')]=_0x3611b4[_0x44b8('0x29')]['length']?_0x3611b4[_0x44b8('0x29')]:_0x1ee3cc[_0x44b8('0x12')];if(_0x221543[_0x44b8('0x14')][_0x44b8('0x36')]){_0x3611b4[_0x44b8('0x3b')]=[{'all':!![]}];}_0x3611b4=_['merge']({},_0x3611b4,_0x221543['options']);return db[_0x44b8('0x35')][_0x44b8('0x3c')](_0x3611b4)[_0x44b8('0xa')](handleEntityNotFound(_0x11e4e3,null))[_0x44b8('0xa')](respondWithResult(_0x11e4e3,null))[_0x44b8('0x39')](handleError(_0x11e4e3,null));};exports[_0x44b8('0x3d')]=function(_0x3fc41b,_0x457348){return db[_0x44b8('0x35')][_0x44b8('0x3d')](_0x3fc41b[_0x44b8('0x3e')],{})[_0x44b8('0xa')](respondWithResult(_0x457348,0xc9))[_0x44b8('0x39')](handleError(_0x457348,null));};exports[_0x44b8('0x3f')]=function(_0x149731,_0x60eeb2){if(_0x149731[_0x44b8('0x3e')]['id']){delete _0x149731[_0x44b8('0x3e')]['id'];}return db[_0x44b8('0x35')]['find']({'where':{'id':_0x149731['params']['id']}})[_0x44b8('0xa')](handleEntityNotFound(_0x60eeb2,null))[_0x44b8('0xa')](saveUpdates(_0x149731[_0x44b8('0x3e')],null))[_0x44b8('0xa')](respondWithResult(_0x60eeb2,null))[_0x44b8('0x39')](handleError(_0x60eeb2,null));};exports[_0x44b8('0x40')]=function(_0x411ed6,_0x4fe73f){return db[_0x44b8('0x35')]['describe']()[_0x44b8('0xa')](respondWithResult(_0x4fe73f,null))[_0x44b8('0x39')](handleError(_0x4fe73f,null));};exports[_0x44b8('0x41')]=function(_0x9207bf,_0x103d57){var _0x35ca19;var _0x491600=_0x9207bf[_0x44b8('0x3a')]['id'];return db[_0x44b8('0x35')][_0x44b8('0x3c')]({'where':{'id':_0x9207bf[_0x44b8('0x3a')]['id']}})['then'](handleEntityNotFound(_0x103d57,null))[_0x44b8('0xa')](function(_0x2f549d){if(_0x2f549d){return _0x2f549d[_0x44b8('0x41')]()[_0x44b8('0xa')](function(_0x44ec23){return _0x44ec23;});}})[_0x44b8('0xa')](function(_0x500bad){_0x35ca19=_0x500bad;if(_0x500bad){if(_0x500bad[_0x44b8('0x42')]||_0x500bad[_0x44b8('0x43')]){return db[_0x500bad[_0x44b8('0x42')]?_0x44b8('0x44'):_0x44b8('0x45')]['find']({'where':{'id':_0x500bad['VoiceQueueId']?_0x500bad[_0x44b8('0x42')]:_0x500bad['CampaignId']},'attributes':['id',_0x44b8('0x13')],'raw':!![]});}}})['then'](function(_0x40164d){var _0x434d6a={};if(_0x40164d){_[_0x44b8('0x31')](_0x434d6a,_[_0x44b8('0x46')](_0x35ca19[_0x44b8('0x47')],[_0x44b8('0x48'),_0x44b8('0x49'),'id']));_0x434d6a['state']=0x15;_0x434d6a[_0x44b8('0x4a')]=_0x44b8('0x4b');_0x434d6a[_0x44b8('0x4c')]=_0x40164d['name'];_0x434d6a[_0x44b8('0x4d')]=_0x9207bf[_0x44b8('0x4e')][_0x44b8('0x13')];_0x434d6a[_0x44b8('0x4f')]=_0x9207bf['user']['id'];_0x434d6a[_0x44b8('0x4b')]=!![];_0x434d6a[_0x44b8('0x50')]=moment()['format'](_0x44b8('0x51'));_0x434d6a[_0x44b8('0x52')]=_0x35ca19[_0x44b8('0x53')];_0x434d6a[_0x44b8('0x54')]=_0x35ca19[_0x44b8('0x42')]?'queue':'ivr';return db[_0x44b8('0x55')][_0x44b8('0x3c')]({'where':{'id':_0x434d6a[_0x44b8('0x56')]},'attributes':[_0x44b8('0x57'),_0x44b8('0x58')]})[_0x44b8('0xa')](function(_0x3c9534){if(!_[_0x44b8('0x59')](_0x103d57)&&!_[_0x44b8('0x59')](_0x3c9534[_0x44b8('0x57')])){_0x434d6a[_0x44b8('0x5a')]=_0x3c9534[_0x44b8('0x57')];if(!_['isNil'](_0x3c9534[_0x44b8('0x58')])){_0x434d6a[_0x44b8('0x5a')]+='\x20'+_0x3c9534[_0x44b8('0x58')];}}})[_0x44b8('0x5b')](function(){return db[_0x44b8('0x5c')][_0x44b8('0x3d')](_0x434d6a);});}})[_0x44b8('0xa')](function(_0x172ff3){return db[_0x44b8('0x5d')][_0x44b8('0x41')]({'where':{'CmHopperId':_0x491600}});})[_0x44b8('0xa')](function(){return _0x103d57[_0x44b8('0x7')](0xcc)[_0x44b8('0x5e')]();})[_0x44b8('0x39')](handleError(_0x103d57,null));};exports[_0x44b8('0x5f')]=function(_0x293c2e,_0x25f91c){var _0x20e563=[];return db['CmContact'][_0x44b8('0x40')]()[_0x44b8('0xa')](function(_0x10e519){_0x20e563=_[_0x44b8('0x15')](_0x10e519);return _0x293c2e[_0x44b8('0x4e')][_0x44b8('0x60')]({'where':{'type':_0x44b8('0x61'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x44b8('0x62'),_0x44b8('0x63')],'raw':!![]});})['then'](function(_0x2a95f6){if(_0x2a95f6&&_0x2a95f6[_0x44b8('0x2a')]){return db['sequelize'][_0x44b8('0x64')](function(_0x454fe6){var _0x370618={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x44b8('0x51'))},'VoiceQueueId':{'$in':_['map'](_0x2a95f6,'id')},'$or':[{'UserId':null},{'UserId':_0x293c2e[_0x44b8('0x4e')]['id']}]};var _0x5161ea={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2a95f6)[_0x44b8('0x33')]([_0x44b8('0x63'),0x0])[_0x44b8('0xd')]('id')[_0x44b8('0x65')]()},'$or':[{'UserId':null},{'UserId':_0x293c2e[_0x44b8('0x4e')]['id']}]};var _0x230b6a={'$or':[_0x370618,_0x5161ea]};var _0x4c7edd=[];if(_0x293c2e[_0x44b8('0x3e')]['direction']&&_0x293c2e[_0x44b8('0x3e')][_0x44b8('0x66')]==='prev'){if(!_[_0x44b8('0x67')](_0x293c2e[_0x44b8('0x3e')][_0x44b8('0x68')])){_0x230b6a['id']={'$in':_0x293c2e[_0x44b8('0x3e')][_0x44b8('0x68')]};}_0x4c7edd=[[_0x44b8('0x69'),_0x44b8('0x6a')],[_0x44b8('0x6b'),_0x2a95f6[0x0][_0x44b8('0x62')]===_0x44b8('0x6a')?_0x44b8('0x6c'):_0x44b8('0x6a')],db['sequelize'][_0x44b8('0x6d')](_0x44b8('0x6e')),['id',_0x44b8('0x6c')]];}else{if(!_['isEmpty'](_0x293c2e[_0x44b8('0x3e')][_0x44b8('0x68')])){_0x230b6a['id']={'$notIn':_0x293c2e['body'][_0x44b8('0x68')]};}_0x4c7edd=[[_0x44b8('0x69'),_0x44b8('0x6c')],[_0x44b8('0x6b'),_0x2a95f6[0x0][_0x44b8('0x62')]],db['sequelize'][_0x44b8('0x6d')](_0x44b8('0x6f')),['id',_0x44b8('0x6a')]];}return db[_0x44b8('0x35')][_0x44b8('0x70')]({'attributes':['id',_0x44b8('0x71'),_0x44b8('0x53'),_0x44b8('0x72')],'where':_0x230b6a,'order':_0x4c7edd,'transaction':_0x454fe6,'lock':_0x454fe6['LOCK'][_0x44b8('0x73')],'include':[{'model':db[_0x44b8('0x55')],'as':_0x44b8('0x74'),'attributes':_0x20e563,'include':[{'model':db[_0x44b8('0x75')],'as':'Company','attributes':['id','name']}]},{'model':db['CmList'],'as':_0x44b8('0x76'),'attributes':['id',_0x44b8('0x13')]},{'model':db[_0x44b8('0x44')],'as':_0x44b8('0x77'),'attributes':['id',_0x44b8('0x13'),'dialActive']}]})[_0x44b8('0xa')](function(_0x58180f){if(_0x58180f){return _0x58180f[_0x44b8('0x3f')]({'UserId':_0x293c2e[_0x44b8('0x4e')]['id']},{'transaction':_0x454fe6});}});});}})[_0x44b8('0xa')](handleEntityNotFound(_0x25f91c,null))['then'](respondWithResult(_0x25f91c,null))['catch'](handleError(_0x25f91c,null));};exports[_0x44b8('0x78')]=function(_0x1964b2,_0x248e6c,_0x536734){var _0x1f5277=[];var _0x36f217=_0x1964b2[_0x44b8('0x3a')]['id'];var _0x15b209=_0x1964b2[_0x44b8('0x4e')]['id'];return db['CmContact'][_0x44b8('0x40')]()[_0x44b8('0xa')](function(_0xbbdab9){_0x1f5277=_[_0x44b8('0x15')](_0xbbdab9);return db[_0x44b8('0x79')]['transaction'](function(_0x40571c){const _0x4c7cdf={'id':_0x36f217};return db[_0x44b8('0x35')][_0x44b8('0x70')]({'attributes':['id',_0x44b8('0x71'),_0x44b8('0x72')],'where':_0x4c7cdf,'transaction':_0x40571c,'lock':_0x40571c[_0x44b8('0x7a')]['UPDATE'],'include':[{'model':db[_0x44b8('0x55')],'as':_0x44b8('0x74'),'attributes':_0x1f5277,'include':[{'model':db['CmCompany'],'as':_0x44b8('0x7b'),'attributes':['id',_0x44b8('0x13')]}]},{'model':db['CmList'],'as':_0x44b8('0x76'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0x44b8('0x77'),'attributes':['id',_0x44b8('0x13'),_0x44b8('0x7c')]}]})['then'](function(_0x510760){if(_0x510760){return _0x510760['update']({'UserId':_0x15b209},{'transaction':_0x40571c});}});});})[_0x44b8('0xa')](handleEntityNotFound(_0x248e6c,null))[_0x44b8('0xa')](respondWithResult(_0x248e6c,null))[_0x44b8('0x39')](handleError(_0x248e6c,null));};exports[_0x44b8('0x7d')]=function(_0x1a5621,_0x221e65){return _0x1a5621[_0x44b8('0x4e')][_0x44b8('0x60')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x44b8('0x7e')},'attributes':['id'],'raw':!![]})['then'](function(_0x59e7b4){if(_0x59e7b4&&_0x59e7b4['length']){return db[_0x44b8('0x35')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x44b8('0x7f')](_0x44b8('0x51'))},'VoiceQueueId':{'$in':_[_0x44b8('0xd')](_0x59e7b4,'id')},'$or':[{'UserId':null},{'UserId':_0x1a5621[_0x44b8('0x4e')]['id']}]}});}return 0x0;})[_0x44b8('0xa')](function(_0x245ba3){if(!_[_0x44b8('0x59')](_0x245ba3)&&_[_0x44b8('0x80')](_0x245ba3)){return _0x221e65['status'](0xc8)[_0x44b8('0x9')]({'contacts':_0x245ba3});}else{logger[_0x44b8('0xb')](_0x44b8('0x81'),_0x44b8('0x7d'),0x194,_0x44b8('0x82'));_0x221e65[_0x44b8('0x83')](0x194);}})[_0x44b8('0x39')](handleError(_0x221e65,null));};exports[_0x44b8('0x84')]=function(_0x40fec3,_0x5f4734){var _0x4b45a7=shared[_0x44b8('0x85')];var _0x553aa9=[];_[_0x44b8('0xd')](_0x4b45a7,function(_0x444419){_0x553aa9[_0x44b8('0x86')]({'id':_0x444419['name'],'name':_0x444419['name'],'utcOffset':_0x444419['utcOffset']});});return _0x5f4734[_0x44b8('0x7')](0xc8)['json']({'tz':_0x553aa9});};exports[_0x44b8('0x87')]=function(_0x2812da,_0xf18cb2){var _0x322a49=shared[_0x44b8('0x85')];var _0xf643d3={};if(!_[_0x44b8('0x59')](_0x322a49[_0x2812da[_0x44b8('0x3e')]['id']]))_0xf643d3=_0x322a49[_0x2812da[_0x44b8('0x3e')]['id']];return _0xf18cb2[_0x44b8('0x7')](0xc8)[_0x44b8('0x9')](_0xf643d3);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index a3c0501..6389d06 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 _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 +var _0xe3da=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','priority','lodash','util','../../config/logger'];(function(_0x138b2b,_0x211633){var _0x9c6e22=function(_0x969c){while(--_0x969c){_0x138b2b['push'](_0x138b2b['shift']());}};_0x9c6e22(++_0x211633);}(_0xe3da,0x1cd));var _0xae3d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe3da[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var logger=require(_0xae3d('0x2'))(_0xae3d('0x3'));var moment=require(_0xae3d('0x4'));var BPromise=require(_0xae3d('0x5'));var rp=require(_0xae3d('0x6'));var fs=require('fs');var path=require(_0xae3d('0x7'));var rimraf=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var attributes=require(_0xae3d('0xa'));module[_0xae3d('0xb')]=function(_0xa9a1a,_0xa54808){return _0xa9a1a[_0xae3d('0xc')](_0xae3d('0xd'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xae3d('0xe'),'fields':[_0xae3d('0xe')]},{'name':'phone','fields':['phone']},{'name':_0xae3d('0xf'),'fields':[_0xae3d('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 eceb0da..fe373f6 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 _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 +var _0x505d=['dataValues','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','dialTimezone','DESC','getContactByPhone','transaction','ResetActiveCalls','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','CmHopperHandlePreviewRecallNotifications','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','map','include','model','then','info','debug','stringify','catch','error','message','find','ShowCmHopper','CreateCmHopper','create','body','update','UpdateCmHopper','active','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','order','LOCK','UPDATE','CmContact','Contact','keys','User','Agent','name','voicePause','UserId','push','includes','all','length'];(function(_0x3a3343,_0x14acc5){var _0x318e34=function(_0x556045){while(--_0x556045){_0x3a3343['push'](_0x3a3343['shift']());}};_0x318e34(++_0x14acc5);}(_0x505d,0xb9));var _0xd505=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x505d[_0x24237f];return _0x48298e;};'use strict';var _=require(_0xd505('0x0'));var util=require(_0xd505('0x1'));var moment=require('moment');var BPromise=require(_0xd505('0x2'));var db=require(_0xd505('0x3'))['db'];var logger=require(_0xd505('0x4'))(_0xd505('0x5'));exports[_0xd505('0x6')]=function(_0x20880b){var _0x299d3e=this;return new Promise(function(_0x2ce572,_0x3f94e9){return db[_0xd505('0x7')][_0xd505('0x8')]({'raw':_0x20880b[_0xd505('0x9')]?_0x20880b[_0xd505('0x9')][_0xd505('0xa')]===undefined?!![]:![]:!![],'where':_0x20880b[_0xd505('0x9')]?_0x20880b['options'][_0xd505('0xb')]||null:null,'attributes':_0x20880b[_0xd505('0x9')]?_0x20880b[_0xd505('0x9')][_0xd505('0xc')]||null:null,'limit':_0x20880b['options']?_0x20880b[_0xd505('0x9')][_0xd505('0xd')]||null:null,'include':_0x20880b[_0xd505('0x9')]?_0x20880b[_0xd505('0x9')]['include']?_[_0xd505('0xe')](_0x20880b['options'][_0xd505('0xf')],function(_0x1c6751){return{'model':db[_0x1c6751[_0xd505('0x10')]],'as':_0x1c6751['as'],'attributes':_0x1c6751['attributes'],'include':_0x1c6751[_0xd505('0xf')]?_['map'](_0x1c6751[_0xd505('0xf')],function(_0x1dd011){return{'model':db[_0x1dd011[_0xd505('0x10')]],'as':_0x1dd011['as'],'attributes':_0x1dd011[_0xd505('0xc')],'include':_0x1dd011['include']?_[_0xd505('0xe')](_0x1dd011['include'],function(_0x32c6f7){return{'model':db[_0x32c6f7[_0xd505('0x10')]],'as':_0x32c6f7['as'],'attributes':_0x32c6f7[_0xd505('0xc')]};}):[]};}):[]};}):[]:[]})[_0xd505('0x11')](function(_0x5d3aa2){logger[_0xd505('0x12')](_0xd505('0x6'),_0x20880b);logger[_0xd505('0x13')]('GetCmHopper',_0x20880b,JSON[_0xd505('0x14')](_0x5d3aa2));_0x2ce572(_0x5d3aa2);})[_0xd505('0x15')](function(_0x1b558a){logger[_0xd505('0x16')](_0xd505('0x6'),_0x1b558a['message'],_0x20880b);_0x3f94e9(_0x299d3e[_0xd505('0x16')](0x1f4,_0x1b558a[_0xd505('0x17')]));});});};exports['ShowCmHopper']=function(_0x31b03f){var _0x3f6da0=this;return new Promise(function(_0x5285ac,_0x214c44){return db[_0xd505('0x7')][_0xd505('0x18')]({'raw':_0x31b03f[_0xd505('0x9')]?_0x31b03f['options'][_0xd505('0xa')]===undefined?!![]:![]:!![],'where':_0x31b03f[_0xd505('0x9')]?_0x31b03f[_0xd505('0x9')][_0xd505('0xb')]||null:null,'attributes':_0x31b03f['options']?_0x31b03f[_0xd505('0x9')][_0xd505('0xc')]||null:null,'include':_0x31b03f[_0xd505('0x9')]?_0x31b03f[_0xd505('0x9')][_0xd505('0xf')]?_['map'](_0x31b03f['options'][_0xd505('0xf')],function(_0x485166){return{'model':db[_0x485166[_0xd505('0x10')]],'as':_0x485166['as'],'attributes':_0x485166[_0xd505('0xc')],'include':_0x485166[_0xd505('0xf')]?_[_0xd505('0xe')](_0x485166[_0xd505('0xf')],function(_0x983885){return{'model':db[_0x983885['model']],'as':_0x983885['as'],'attributes':_0x983885[_0xd505('0xc')],'include':_0x983885[_0xd505('0xf')]?_[_0xd505('0xe')](_0x983885[_0xd505('0xf')],function(_0x57038a){return{'model':db[_0x57038a['model']],'as':_0x57038a['as'],'attributes':_0x57038a[_0xd505('0xc')]};}):[]};}):[]};}):[]:[]})[_0xd505('0x11')](function(_0x55ad93){logger['info'](_0xd505('0x19'),_0x31b03f);logger[_0xd505('0x13')](_0xd505('0x19'),_0x31b03f,JSON['stringify'](_0x55ad93));_0x5285ac(_0x55ad93);})[_0xd505('0x15')](function(_0x2809d7){logger['error']('ShowCmHopper',_0x2809d7[_0xd505('0x17')],_0x31b03f);_0x214c44(_0x3f6da0[_0xd505('0x16')](0x1f4,_0x2809d7[_0xd505('0x17')]));});});};exports[_0xd505('0x1a')]=function(_0x487625){var _0x49a677=this;return new Promise(function(_0x5ec4a1,_0x1682ec){return db[_0xd505('0x7')][_0xd505('0x1b')](_0x487625[_0xd505('0x1c')],{'raw':_0x487625[_0xd505('0x9')]?_0x487625[_0xd505('0x9')][_0xd505('0xa')]===undefined?!![]:![]:!![]})[_0xd505('0x11')](function(_0x1a93c7){logger['info']('CreateCmHopper',_0x487625);logger[_0xd505('0x13')](_0xd505('0x1a'),_0x487625,JSON['stringify'](_0x1a93c7));_0x5ec4a1(_0x1a93c7);})[_0xd505('0x15')](function(_0x5e341a){logger[_0xd505('0x16')]('CreateCmHopper',_0x5e341a[_0xd505('0x17')],_0x487625);_0x1682ec(_0x49a677[_0xd505('0x16')](0x1f4,_0x5e341a['message']));});});};exports['UpdateCmHopper']=function(_0x223246){var _0x21d4c9=this;return new Promise(function(_0xb0127e,_0x3cc8db){return db[_0xd505('0x7')][_0xd505('0x1d')](_0x223246[_0xd505('0x1c')],{'raw':_0x223246['options']?_0x223246[_0xd505('0x9')][_0xd505('0xa')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x223246[_0xd505('0x9')]?_0x223246[_0xd505('0x9')]['where']||null:null,'attributes':_0x223246['options']?_0x223246[_0xd505('0x9')][_0xd505('0xc')]||null:null,'limit':_0x223246[_0xd505('0x9')]?_0x223246[_0xd505('0x9')][_0xd505('0xd')]||null:null})[_0xd505('0x11')](function(_0x2c509d){logger[_0xd505('0x12')](_0xd505('0x1e'),_0x223246);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xd505('0x14')](_0x223246['options'][_0xd505('0xb')]),_0x223246[_0xd505('0x1c')][_0xd505('0x1f')]);logger['debug']('UpdateCmHopper',_0x223246,JSON[_0xd505('0x14')](_0x2c509d));_0xb0127e(_0x2c509d);})[_0xd505('0x15')](function(_0x389b39){logger[_0xd505('0x16')](_0xd505('0x1e'),_0x389b39[_0xd505('0x17')],_0x223246);_0x3cc8db(_0x21d4c9[_0xd505('0x16')](0x1f4,_0x389b39['message']));});});};exports[_0xd505('0x20')]=function(_0x4a2b84){var _0x2f2206=this;return new Promise(function(_0x5ebe3b,_0x205444){return db[_0xd505('0x7')][_0xd505('0x21')]({'where':_0x4a2b84[_0xd505('0x9')]?_0x4a2b84[_0xd505('0x9')][_0xd505('0xb')]||null:null})['then'](function(_0x354cba){logger[_0xd505('0x12')](_0xd505('0x20'),_0x4a2b84);logger[_0xd505('0x13')](_0xd505('0x20'),_0x4a2b84,JSON[_0xd505('0x14')](_0x354cba));_0x5ebe3b(_0x354cba);})[_0xd505('0x15')](function(_0x59936d){logger[_0xd505('0x16')](_0xd505('0x20'),_0x59936d[_0xd505('0x17')],_0x4a2b84);_0x205444(_0x2f2206['error'](0x1f4,_0x59936d[_0xd505('0x17')]));});});};exports[_0xd505('0x22')]=function(_0x531359){var _0x6ee653=this;return new Promise(function(_0x28cfec,_0x5ebd36){return db['CmContact'][_0xd505('0x23')]()[_0xd505('0x11')](function(_0x4710e6){return db[_0xd505('0x24')]['transaction'](function(_0x281e2e){return db[_0xd505('0x7')]['findAll']({'where':_0x531359['options']?_0x531359['options'][_0xd505('0xb')]||null:null,'attributes':_0x531359[_0xd505('0x9')]?_0x531359[_0xd505('0x9')]['attributes']||null:null,'limit':_0x531359[_0xd505('0x9')]?_0x531359[_0xd505('0x9')][_0xd505('0xd')]||null:null,'order':_0x531359['options']?_0x531359['options'][_0xd505('0x25')]||null:null,'transaction':_0x281e2e,'lock':_0x281e2e[_0xd505('0x26')][_0xd505('0x27')],'include':[{'model':db[_0xd505('0x28')],'as':_0xd505('0x29'),'attributes':_[_0xd505('0x2a')](_0x4710e6)},{'model':db[_0xd505('0x2b')],'as':_0xd505('0x2c'),'attributes':['id',_0xd505('0x2d'),_0xd505('0x2e')]}]})[_0xd505('0x11')](function(_0x34a3c6){var _0x31b885=[];var _0x4540e2=[];for(var _0x3f110a=0x0;_0x3f110a<_0x34a3c6['length'];_0x3f110a+=0x1){var _0x3281df=_0x34a3c6[_0x3f110a][_0xd505('0x2f')];if(_0x3281df===null){_0x31b885[_0xd505('0x30')](_0x34a3c6[_0x3f110a][_0xd505('0x1d')](_0x531359[_0xd505('0x1c')],{'transaction':_0x281e2e}));}else if(!_0x4540e2[_0xd505('0x31')](_0x3281df)){_0x4540e2['push'](_0x3281df);_0x31b885['push'](_0x34a3c6[_0x3f110a][_0xd505('0x1d')](_0x531359[_0xd505('0x1c')],{'transaction':_0x281e2e}));}}return BPromise[_0xd505('0x32')](_0x31b885);});})[_0xd505('0x11')](function(_0x227212){logger[_0xd505('0x12')]('GetContactDialer',_0x531359);if(_0x227212[_0xd505('0x33')]>0x0){logger['info']('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x227212[0x0][_0xd505('0x34')]['id'],_0x227212[0x0][_0xd505('0x34')]['ContactId'],_0x227212[0x0][_0xd505('0x34')][_0xd505('0x1f')]);}logger[_0xd505('0x13')](_0xd505('0x22'),_0x531359,JSON[_0xd505('0x14')](_0x227212));_0x28cfec(_0x227212);})[_0xd505('0x15')](function(_0x1ebcf4){logger[_0xd505('0x16')](_0xd505('0x22'),_0x1ebcf4['message'],_0x531359);_0x5ebd36(_0x6ee653[_0xd505('0x16')](0x1f4,_0x1ebcf4[_0xd505('0x17')]));});});});};exports[_0xd505('0x35')]=function(_0x1cf21c){var _0x3b0cd7=this;return new Promise(function(_0x27a668,_0x29e381){return db['sequelize']['transaction'](function(_0x5874a3){return db[_0xd505('0x36')][_0xd505('0x1b')](_0x1cf21c[_0xd505('0x1c')],{'raw':_0x1cf21c[_0xd505('0x9')]?_0x1cf21c['options'][_0xd505('0xa')]===undefined?!![]:![]:!![],'transaction':_0x5874a3})[_0xd505('0x11')](function(){logger[_0xd505('0x12')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x1cf21c[_0xd505('0x9')]['where']),_0x1cf21c[_0xd505('0x9')]['where']['active']);return db[_0xd505('0x7')][_0xd505('0x21')]({'where':_0x1cf21c[_0xd505('0x9')]?_0x1cf21c['options'][_0xd505('0xb')]||null:null,'transaction':_0x5874a3});});})[_0xd505('0x11')](function(_0x1819fe){logger[_0xd505('0x12')](_0xd505('0x35'),_0x1cf21c);logger['debug']('MoveContactManagedDialer',_0x1cf21c,JSON[_0xd505('0x14')](_0x1819fe));_0x27a668(_0x1819fe);})[_0xd505('0x15')](function(_0x95fbc1){logger[_0xd505('0x16')](_0xd505('0x35'),_0x95fbc1['message'],_0x1cf21c);_0x29e381(_0x3b0cd7[_0xd505('0x16')](0x1f4,_0x95fbc1['message']));});});};exports[_0xd505('0x37')]=function(_0x406c1c){var _0x354771=this;return new Promise(function(_0x2e02c0,_0x2275a3){return db[_0xd505('0x7')][_0xd505('0x8')]({'raw':_0x406c1c[_0xd505('0x9')]?_0x406c1c[_0xd505('0x9')][_0xd505('0xa')]===undefined?!![]:![]:!![],'where':_0x406c1c['options']?_0x406c1c[_0xd505('0x9')][_0xd505('0xb')]||null:null,'attributes':[[db[_0xd505('0x24')]['fn'](_0xd505('0x38'),db[_0xd505('0x24')]['fn']('IF',db[_0xd505('0x24')][_0xd505('0x39')](_0xd505('0x3a')+util[_0xd505('0x3b')](_0xd505('0x3c'),moment()[_0xd505('0x3b')](_0xd505('0x3d')))+_0xd505('0x3e')))),_0xd505('0x3f')]]})[_0xd505('0x11')](function(_0x16efc8){logger['info'](_0xd505('0x37'),_0x406c1c);logger[_0xd505('0x13')](_0xd505('0x37'),_0x406c1c,JSON[_0xd505('0x14')](_0x16efc8));_0x2e02c0(_0x16efc8);})[_0xd505('0x15')](function(_0x190175){logger['error'](_0xd505('0x37'),_0x190175[_0xd505('0x17')],_0x406c1c);_0x2275a3(_0x354771[_0xd505('0x16')](0x1f4,_0x190175['message']));});});};exports['GetContactRecallMe']=function(_0xe1a363){var _0x5eacf9=this;return new Promise(function(_0x510a4a,_0x99cef3){return db[_0xd505('0x28')][_0xd505('0x23')]()[_0xd505('0x11')](function(){return db[_0xd505('0x24')]['transaction'](function(_0x598bfc){return db[_0xd505('0x7')]['findAll']({'where':_0xe1a363['options']?_0xe1a363['options']['where']||null:null,'attributes':_0xe1a363[_0xd505('0x9')]?_0xe1a363[_0xd505('0x9')][_0xd505('0xc')]||null:null,'limit':0x1,'order':_0xe1a363[_0xd505('0x9')]?_0xe1a363[_0xd505('0x9')][_0xd505('0x25')]||null:null,'group':db[_0xd505('0x7')][_0xd505('0x2f')],'transaction':_0x598bfc,'lock':_0x598bfc[_0xd505('0x26')][_0xd505('0x27')],'include':_0xe1a363[_0xd505('0x9')]?_0xe1a363[_0xd505('0x9')]['include']?_[_0xd505('0xe')](_0xe1a363[_0xd505('0x9')][_0xd505('0xf')],function(_0x1477f5){return{'model':db[_0x1477f5[_0xd505('0x10')]],'as':_0x1477f5['as'],'attributes':_0x1477f5[_0xd505('0xc')],'include':_0x1477f5[_0xd505('0xf')]?_[_0xd505('0xe')](_0x1477f5[_0xd505('0xf')],function(_0x346bce){return{'model':db[_0x346bce[_0xd505('0x10')]],'as':_0x346bce['as'],'attributes':_0x346bce['attributes'],'include':_0x346bce[_0xd505('0xf')]?_[_0xd505('0xe')](_0x346bce['include'],function(_0x342311){return{'model':db[_0x342311['model']],'as':_0x342311['as'],'attributes':_0x342311['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x35e63e){var _0x545e06=[];for(var _0x9b90e3=0x0;_0x9b90e3<_0x35e63e[_0xd505('0x33')];_0x9b90e3+=0x1){_0x545e06['push'](_0x35e63e[_0x9b90e3]['update'](_0xe1a363['body'],{'transaction':_0x598bfc}));}return BPromise[_0xd505('0x32')](_0x545e06);});})[_0xd505('0x11')](function(_0x1e4a1d){logger['info']('GetContactRecallMe',_0xe1a363);logger[_0xd505('0x13')]('GetContactRecallMe',_0xe1a363,JSON[_0xd505('0x14')](_0x1e4a1d));_0x510a4a(_0x1e4a1d);})['catch'](function(_0x31d1c2){logger[_0xd505('0x16')](_0xd505('0x40'),_0x31d1c2[_0xd505('0x17')],_0xe1a363);_0x99cef3(_0x5eacf9[_0xd505('0x16')](0x1f4,_0x31d1c2[_0xd505('0x17')]));});});});};exports[_0xd505('0x41')]=function(_0x5129c1){var _0x345e41=this;return new Promise(function(_0x3142ff,_0x495ca1){db['CmContact']['describe']()[_0xd505('0x11')](function(_0x30475b){return db[_0xd505('0x7')]['findAll']({'raw':_0x5129c1['options']?_0x5129c1[_0xd505('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x5129c1[_0xd505('0x9')]?_0x5129c1[_0xd505('0x9')][_0xd505('0xb')]||null:null,'attributes':_0x5129c1['options']?_0x5129c1['options']['attributes']||null:null,'limit':_0x5129c1[_0xd505('0x9')]?_0x5129c1[_0xd505('0x9')][_0xd505('0xd')]||null:null,'include':_0x5129c1['options']?_0x5129c1[_0xd505('0x9')]['include']?_[_0xd505('0xe')](_0x5129c1['options']['include'],function(_0x580b31){return{'model':db[_0x580b31['model']],'as':_0x580b31['as'],'attributes':_0x580b31['as']===_0xd505('0x29')?_[_0xd505('0x2a')](_0x30475b):_0x580b31[_0xd505('0xc')],'include':_0x580b31[_0xd505('0xf')]?_['map'](_0x580b31[_0xd505('0xf')],function(_0x4c4f4c){return{'model':db[_0x4c4f4c[_0xd505('0x10')]],'as':_0x4c4f4c['as'],'attributes':_0x4c4f4c[_0xd505('0xc')],'include':_0x4c4f4c['include']?_[_0xd505('0xe')](_0x4c4f4c[_0xd505('0xf')],function(_0x2e8641){return{'model':db[_0x2e8641[_0xd505('0x10')]],'as':_0x2e8641['as'],'attributes':_0x2e8641[_0xd505('0xc')]};}):[]};}):[]};}):[]:[]})[_0xd505('0x11')](function(_0x2d6997){logger[_0xd505('0x12')](_0xd505('0x6'),_0x5129c1);logger[_0xd505('0x13')](_0xd505('0x6'),_0x5129c1,JSON[_0xd505('0x14')](_0x2d6997));_0x3142ff(_0x2d6997);})[_0xd505('0x15')](function(_0x494092){logger[_0xd505('0x16')]('GetCmHopper',_0x494092['message'],_0x5129c1);_0x495ca1(_0x345e41[_0xd505('0x16')](0x1f4,_0x494092[_0xd505('0x17')]));});});});};exports[_0xd505('0x42')]=function(_0x57610d){var _0x54e260=this;return new Promise(function(_0x4e7100,_0x419d72){return db[_0xd505('0x28')]['findOne']({'raw':!![],'where':{'phone':_0x57610d[_0xd505('0x9')][_0xd505('0xb')]['phone']},'attributes':['id',_0xd505('0x43')],'order':[['id',_0xd505('0x44')]]})[_0xd505('0x11')](function(_0x1e4d4a){logger[_0xd505('0x12')](_0xd505('0x45'),_0x57610d);logger[_0xd505('0x13')]('getContactByPhone',_0x57610d,JSON[_0xd505('0x14')](_0x1e4d4a));_0x4e7100(_0x1e4d4a);})['catch'](function(_0x4fc79f){logger['error'](_0xd505('0x45'),_0x4fc79f[_0xd505('0x17')],_0x57610d);_0x419d72(_0x54e260[_0xd505('0x16')](0x1f4,_0x4fc79f[_0xd505('0x17')]));});});};exports['ResetActiveCalls']=function(_0x34fac9){var _0x5c9175=this;return new Promise(function(_0x38ddc8,_0x20dabf){return db[_0xd505('0x24')][_0xd505('0x46')](function(_0x32ccf3){var _0x848404=_0x34fac9[_0xd505('0x9')]&&_0x34fac9['options'][_0xd505('0xb')]?_0x34fac9[_0xd505('0x9')]['where']:{};return db['CmHopper'][_0xd505('0x1d')](_0x34fac9[_0xd505('0x1c')],{'where':_0x848404,'transaction':_0x32ccf3})['then'](function(_0x5f157a){logger['info'](_0xd505('0x47'),_0x34fac9);logger['debug'](_0xd505('0x47'),_0x34fac9,JSON[_0xd505('0x14')](_0x5f157a));_0x38ddc8(_0x5f157a);})[_0xd505('0x15')](function(_0x360bda){logger[_0xd505('0x16')]('ResetActiveCalls',_0x360bda['message'],_0x34fac9);_0x20dabf(_0x5c9175[_0xd505('0x16')](0x1f4,_0x360bda['message']));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x22c0f4){var _0x29f040=this;var _0x389084=_0x22c0f4[_0xd505('0x1c')][_0xd505('0xb')]['voiceQueueIds'];var _0x3469b1=_0x22c0f4['body'][_0xd505('0xb')][_0xd505('0x48')];var _0x2cd4d7=_0x22c0f4[_0xd505('0x1c')][_0xd505('0xb')][_0xd505('0x49')];return new Promise(function(_0x5b37b4,_0x38410d){return db[_0xd505('0x7')][_0xd505('0x8')]({'where':{'voiceQueueId':{'$in':_0x389084},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xd505('0x24')][_0xd505('0x39')](_0xd505('0x4a')+_0x3469b1+_0xd505('0x4b')),'$gt':db['sequelize'][_0xd505('0x39')](_0xd505('0x4c'))}},'UserId':{'$in':_0x2cd4d7}},'include':[{'model':db[_0xd505('0x28')],'as':_0xd505('0x29')},{'model':db[_0xd505('0x2b')],'as':_0xd505('0x2c'),'attributes':['id','name',_0xd505('0x2e')]},{'model':db[_0xd505('0x4d')],'as':'List'}]})[_0xd505('0x11')](function(_0x3697cd){if(_0x3697cd[_0xd505('0x33')]>0x0){return db[_0xd505('0x24')][_0xd505('0x46')](function(_0x2566e4){return db['CmHopper'][_0xd505('0x1d')]({'recallmeNotifiedDate':db[_0xd505('0x24')]['literal']('NOW()')},{'where':{'id':{'$in':_[_0xd505('0xe')](_0x3697cd,'id')}},'transaction':_0x2566e4})[_0xd505('0x11')](function(){_0x5b37b4(_0x3697cd);})[_0xd505('0x15')](function(_0x22cc7e){logger[_0xd505('0x16')](_0xd505('0x4e'),_0x22cc7e['message'],_0x22c0f4);_0x38410d(_0x29f040[_0xd505('0x16')](0x1f4,_0x22cc7e[_0xd505('0x17')]));});})[_0xd505('0x15')](function(_0x3eb873){logger[_0xd505('0x16')](_0xd505('0x4e'),_0x3eb873['message'],_0x22c0f4);_0x38410d(_0x29f040[_0xd505('0x16')](0x1f4,_0x3eb873[_0xd505('0x17')]));});}else{_0x5b37b4(_0x3697cd);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index f01ac84..f78bb33 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 _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 +var _0x4924=['get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show','getPreviewRecall','post','create','/preview','getPreview','/timezone','getTimezone','update','delete','destroy','exports','Router','../../components/auth/service','./cmHopper.controller'];(function(_0x414916,_0x492063){var _0x328139=function(_0x69bd8c){while(--_0x69bd8c){_0x414916['push'](_0x414916['shift']());}};_0x328139(++_0x492063);}(_0x4924,0x1f1));var _0x4492=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x4924[_0x29b609];return _0x54c952;};'use strict';var express=require('express');var router=express[_0x4492('0x0')]();var auth=require(_0x4492('0x1'));var controller=require(_0x4492('0x2'));router[_0x4492('0x3')]('/',auth[_0x4492('0x4')](),controller[_0x4492('0x5')]);router[_0x4492('0x3')](_0x4492('0x6'),auth['isAuthenticated'](),controller[_0x4492('0x7')]);router['get'](_0x4492('0x8'),auth[_0x4492('0x4')](),controller[_0x4492('0x9')]);router[_0x4492('0x3')](_0x4492('0xa'),auth[_0x4492('0x4')](),controller[_0x4492('0xb')]);router['get'](_0x4492('0xc'),auth[_0x4492('0x4')](),controller[_0x4492('0xd')]);router['get']('/:id/previewrecall',auth[_0x4492('0x4')](),controller[_0x4492('0xe')]);router[_0x4492('0xf')]('/',auth[_0x4492('0x4')](),controller[_0x4492('0x10')]);router[_0x4492('0xf')](_0x4492('0x11'),auth[_0x4492('0x4')](),controller[_0x4492('0x12')]);router[_0x4492('0xf')](_0x4492('0x13'),auth[_0x4492('0x4')](),controller[_0x4492('0x14')]);router['put'](_0x4492('0xc'),auth['isAuthenticated'](),controller[_0x4492('0x15')]);router[_0x4492('0x16')](_0x4492('0xc'),auth[_0x4492('0x4')](),controller[_0x4492('0x17')]);module[_0x4492('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index f42c92d..334ae13 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 _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 +var _0x4efd=['STRING','format','YYYY-MM-DD\x20HH:mm:ss','moment','INTEGER'];(function(_0xd97b73,_0xce94b1){var _0xefe357=function(_0x48bc4b){while(--_0x48bc4b){_0xd97b73['push'](_0xd97b73['shift']());}};_0xefe357(++_0xce94b1);}(_0x4efd,0x1ca));var _0xd4ef=function(_0x2bddf9,_0x22c873){_0x2bddf9=_0x2bddf9-0x0;var _0x3f3ae9=_0x4efd[_0x2bddf9];return _0x3f3ae9;};'use strict';var moment=require(_0xd4ef('0x0'));var Sequelize=require('sequelize');module['exports']={'CmHopperId':{'type':Sequelize[_0xd4ef('0x1')]},'phone':{'type':Sequelize[_0xd4ef('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xd4ef('0x1')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xd4ef('0x3')](_0xd4ef('0x4'))},'countbusyretry':{'type':Sequelize[_0xd4ef('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xd4ef('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd4ef('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd4ef('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd4ef('0x1')],'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 d03eaed..8f51b26 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 _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 +var _0xb888=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','save','update','then','destroy','CmHopperAdditionalPhones','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','CmHopperAdditionalPhone','findAll','rows','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x2c9f33,_0x5a90df){var _0x20bf15=function(_0x12ecb2){while(--_0x12ecb2){_0x2c9f33['push'](_0x2c9f33['shift']());}};_0x20bf15(++_0x5a90df);}(_0xb888,0xe7));var _0x8b88=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb888[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x8b88('0x0'));var rimraf=require(_0x8b88('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8b88('0x2'));var rp=require(_0x8b88('0x3'));var moment=require(_0x8b88('0x4'));var BPromise=require(_0x8b88('0x5'));var Mustache=require(_0x8b88('0x6'));var util=require(_0x8b88('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x8b88('0x8'));var ejs=require(_0x8b88('0x9'));var fs=require('fs');var fs_extra=require(_0x8b88('0xa'));var _=require(_0x8b88('0xb'));var squel=require('squel');var crypto=require(_0x8b88('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8b88('0xd'));var toCsv=require(_0x8b88('0x8'));var querystring=require(_0x8b88('0xe'));var Papa=require(_0x8b88('0xf'));var Redis=require(_0x8b88('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8b88('0x11'));var hardwareService=require(_0x8b88('0x12'));var logger=require(_0x8b88('0x13'))(_0x8b88('0x14'));var utils=require(_0x8b88('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8b88('0x16'));var db=require(_0x8b88('0x17'))['db'];function respondWithStatusCode(_0x3858eb,_0x2119d6){_0x2119d6=_0x2119d6||0xcc;return function(_0x543aea){if(_0x543aea){return _0x3858eb[_0x8b88('0x18')](_0x2119d6);}return _0x3858eb[_0x8b88('0x19')](_0x2119d6)[_0x8b88('0x1a')]();};}function respondWithResult(_0x1f25d6,_0x427934){_0x427934=_0x427934||0xc8;return function(_0x235080){if(_0x235080){return _0x1f25d6[_0x8b88('0x19')](_0x427934)[_0x8b88('0x1b')](_0x235080);}};}function respondWithFilteredResult(_0x1ada87,_0x3743eb){return function(_0xe4d4a5){if(_0xe4d4a5){var _0x1ca958=typeof _0x3743eb[_0x8b88('0x1c')]==='undefined'&&typeof _0x3743eb['limit']==='undefined';var _0x39ba0a=_0xe4d4a5[_0x8b88('0x1d')];var _0x385b00=_0x1ca958?0x0:_0x3743eb['offset'];var _0xdac038=_0x1ca958?_0xe4d4a5[_0x8b88('0x1d')]:_0x3743eb['offset']+_0x3743eb[_0x8b88('0x1e')];var _0x15e72b;if(_0xdac038>=_0x39ba0a){_0xdac038=_0x39ba0a;_0x15e72b=0xc8;}else{_0x15e72b=0xce;}_0x1ada87[_0x8b88('0x19')](_0x15e72b);return _0x1ada87[_0x8b88('0x1f')](_0x8b88('0x20'),_0x385b00+'-'+_0xdac038+'/'+_0x39ba0a)[_0x8b88('0x1b')](_0xe4d4a5);}return null;};}function patchUpdates(_0x561dfc){return function(_0x34025f){try{jsonpatch[_0x8b88('0x21')](_0x34025f,_0x561dfc,!![]);}catch(_0x19f2e9){return BPromise['reject'](_0x19f2e9);}return _0x34025f[_0x8b88('0x22')]();};}function saveUpdates(_0x38dcec,_0x5f0070){return function(_0x8c1d0f){if(_0x8c1d0f){return _0x8c1d0f[_0x8b88('0x23')](_0x38dcec)[_0x8b88('0x24')](function(_0x5ce118){return _0x5ce118;});}return null;};}function removeEntity(_0x163b5c,_0x1ca889){return function(_0xe08adb){if(_0xe08adb){return _0xe08adb[_0x8b88('0x25')]()['then'](function(){var _0x512078=_0xe08adb['get']({'plain':!![]});var _0x188410=_0x8b88('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x188410,'resourceId':_0x512078['id']}})[_0x8b88('0x24')](function(){return _0xe08adb;});})[_0x8b88('0x24')](function(){_0x163b5c[_0x8b88('0x19')](0xcc)[_0x8b88('0x1a')]();});}};}function handleEntityNotFound(_0x50f30b,_0x47ead0){return function(_0x2f9f86){if(!_0x2f9f86){_0x50f30b[_0x8b88('0x18')](0x194);}return _0x2f9f86;};}function handleError(_0x18c05a,_0x4a2a1a){_0x4a2a1a=_0x4a2a1a||0x1f4;return function(_0x1386ab){logger[_0x8b88('0x27')](_0x1386ab[_0x8b88('0x28')]);if(_0x1386ab[_0x8b88('0x29')]){delete _0x1386ab['name'];}_0x18c05a[_0x8b88('0x19')](_0x4a2a1a)[_0x8b88('0x2a')](_0x1386ab);};}exports[_0x8b88('0x2b')]=function(_0x3ffab3,_0x15d807){var _0x30ea17={},_0x54e3ab={},_0xe55701={'count':0x0,'rows':[]};var _0x40de61=_[_0x8b88('0x2c')](db['CmHopperAdditionalPhone'][_0x8b88('0x2d')],function(_0xd1c3db){return{'name':_0xd1c3db[_0x8b88('0x2e')],'type':_0xd1c3db['type'][_0x8b88('0x2f')]};});_0x54e3ab[_0x8b88('0x30')]=_[_0x8b88('0x2c')](_0x40de61,_0x8b88('0x29'));_0x54e3ab[_0x8b88('0x31')]=_[_0x8b88('0x32')](_0x3ffab3[_0x8b88('0x31')]);_0x54e3ab[_0x8b88('0x33')]=_['intersection'](_0x54e3ab[_0x8b88('0x30')],_0x54e3ab[_0x8b88('0x31')]);_0x30ea17[_0x8b88('0x34')]=_[_0x8b88('0x35')](_0x54e3ab[_0x8b88('0x30')],qs[_0x8b88('0x36')](_0x3ffab3[_0x8b88('0x31')][_0x8b88('0x36')]));_0x30ea17['attributes']=_0x30ea17[_0x8b88('0x34')][_0x8b88('0x37')]?_0x30ea17['attributes']:_0x54e3ab[_0x8b88('0x30')];if(!_0x3ffab3[_0x8b88('0x31')][_0x8b88('0x38')]('nolimit')){_0x30ea17[_0x8b88('0x1e')]=qs[_0x8b88('0x1e')](_0x3ffab3['query']['limit']);_0x30ea17[_0x8b88('0x1c')]=qs[_0x8b88('0x1c')](_0x3ffab3['query'][_0x8b88('0x1c')]);}_0x30ea17[_0x8b88('0x39')]=qs[_0x8b88('0x3a')](_0x3ffab3[_0x8b88('0x31')]['sort']);_0x30ea17[_0x8b88('0x3b')]=qs[_0x8b88('0x33')](_[_0x8b88('0x3c')](_0x3ffab3[_0x8b88('0x31')],_0x54e3ab[_0x8b88('0x33')]),_0x40de61);if(_0x3ffab3[_0x8b88('0x31')][_0x8b88('0x3d')]){_0x30ea17[_0x8b88('0x3b')]=_[_0x8b88('0x3e')](_0x30ea17[_0x8b88('0x3b')],{'$or':_[_0x8b88('0x2c')](_0x40de61,function(_0x21b029){if(_0x21b029['type']!==_0x8b88('0x3f')){var _0x3a858f={};_0x3a858f[_0x21b029['name']]={'$like':'%'+_0x3ffab3[_0x8b88('0x31')]['filter']+'%'};return _0x3a858f;}})});}_0x30ea17=_['merge']({},_0x30ea17,_0x3ffab3[_0x8b88('0x40')]);var _0x4b2ff9={'where':_0x30ea17['where']};return db['CmHopperAdditionalPhone'][_0x8b88('0x1d')](_0x4b2ff9)[_0x8b88('0x24')](function(_0x52c845){_0xe55701['count']=_0x52c845;if(_0x3ffab3[_0x8b88('0x31')][_0x8b88('0x41')]){_0x30ea17[_0x8b88('0x42')]=[{'all':!![]}];}return db[_0x8b88('0x43')][_0x8b88('0x44')](_0x30ea17);})[_0x8b88('0x24')](function(_0x338929){_0xe55701[_0x8b88('0x45')]=_0x338929;return _0xe55701;})['then'](respondWithFilteredResult(_0x15d807,_0x30ea17))['catch'](handleError(_0x15d807,null));};exports[_0x8b88('0x46')]=function(_0x26d839,_0x5e5145){var _0x3e4a5a={'raw':!![],'where':{'id':_0x26d839[_0x8b88('0x47')]['id']}},_0x330c51={};_0x330c51['model']=_[_0x8b88('0x32')](db[_0x8b88('0x43')][_0x8b88('0x2d')]);_0x330c51[_0x8b88('0x31')]=_['keys'](_0x26d839[_0x8b88('0x31')]);_0x330c51[_0x8b88('0x33')]=_[_0x8b88('0x35')](_0x330c51[_0x8b88('0x30')],_0x330c51[_0x8b88('0x31')]);_0x3e4a5a[_0x8b88('0x34')]=_[_0x8b88('0x35')](_0x330c51[_0x8b88('0x30')],qs[_0x8b88('0x36')](_0x26d839[_0x8b88('0x31')][_0x8b88('0x36')]));_0x3e4a5a[_0x8b88('0x34')]=_0x3e4a5a[_0x8b88('0x34')][_0x8b88('0x37')]?_0x3e4a5a[_0x8b88('0x34')]:_0x330c51['model'];if(_0x26d839[_0x8b88('0x31')][_0x8b88('0x41')]){_0x3e4a5a['include']=[{'all':!![]}];}_0x3e4a5a=_[_0x8b88('0x3e')]({},_0x3e4a5a,_0x26d839[_0x8b88('0x40')]);return db[_0x8b88('0x43')][_0x8b88('0x48')](_0x3e4a5a)[_0x8b88('0x24')](handleEntityNotFound(_0x5e5145,null))['then'](respondWithResult(_0x5e5145,null))['catch'](handleError(_0x5e5145,null));};exports[_0x8b88('0x49')]=function(_0x502e2c,_0x4dc80d){return db['CmHopperAdditionalPhone']['create'](_0x502e2c[_0x8b88('0x4a')],{})[_0x8b88('0x24')](function(_0x1e1dce){var _0x4df4b0=_0x502e2c[_0x8b88('0x4b')][_0x8b88('0x4c')]({'plain':!![]});if(!_0x4df4b0)throw new Error(_0x8b88('0x4d'));if(_0x4df4b0[_0x8b88('0x4e')]==='user'){var _0x2fd5eb=_0x1e1dce[_0x8b88('0x4c')]({'plain':!![]});var _0x378171=_0x8b88('0x26');return db['UserProfileSection'][_0x8b88('0x48')]({'where':{'name':_0x378171,'userProfileId':_0x4df4b0[_0x8b88('0x4f')]},'raw':!![]})['then'](function(_0x17581f){if(_0x17581f&&_0x17581f[_0x8b88('0x50')]===0x0){return db[_0x8b88('0x51')][_0x8b88('0x49')]({'name':_0x2fd5eb['name'],'resourceId':_0x2fd5eb['id'],'type':_0x17581f['name'],'sectionId':_0x17581f['id']},{})[_0x8b88('0x24')](function(){return _0x1e1dce;});}else{return _0x1e1dce;}})['catch'](function(_0x3445f4){logger[_0x8b88('0x27')](_0x8b88('0x52'),_0x3445f4);throw _0x3445f4;});}return _0x1e1dce;})[_0x8b88('0x24')](respondWithResult(_0x4dc80d,0xc9))['catch'](handleError(_0x4dc80d,null));};exports[_0x8b88('0x23')]=function(_0x5957a5,_0x729a59){if(_0x5957a5[_0x8b88('0x4a')]['id']){delete _0x5957a5[_0x8b88('0x4a')]['id'];}return db[_0x8b88('0x43')][_0x8b88('0x48')]({'where':{'id':_0x5957a5['params']['id']}})[_0x8b88('0x24')](handleEntityNotFound(_0x729a59,null))[_0x8b88('0x24')](saveUpdates(_0x5957a5['body'],null))['then'](respondWithResult(_0x729a59,null))[_0x8b88('0x53')](handleError(_0x729a59,null));};exports[_0x8b88('0x25')]=function(_0x326abc,_0x5efdd5){return db[_0x8b88('0x43')][_0x8b88('0x48')]({'where':{'id':_0x326abc[_0x8b88('0x47')]['id']}})[_0x8b88('0x24')](handleEntityNotFound(_0x5efdd5,null))[_0x8b88('0x24')](removeEntity(_0x5efdd5,null))[_0x8b88('0x53')](handleError(_0x5efdd5,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 953b3b4..7982749 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 _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 +var _0x7e1b=['cm_hopper_additional_phones','util','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports'];(function(_0x14033f,_0x4402f2){var _0x136994=function(_0x3d3c1c){while(--_0x3d3c1c){_0x14033f['push'](_0x14033f['shift']());}};_0x136994(++_0x4402f2);}(_0x7e1b,0x79));var _0xb7e1=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x7e1b[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require('lodash');var util=require(_0xb7e1('0x0'));var logger=require('../../config/logger')(_0xb7e1('0x1'));var moment=require(_0xb7e1('0x2'));var BPromise=require(_0xb7e1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb7e1('0x4'));var rimraf=require(_0xb7e1('0x5'));var config=require(_0xb7e1('0x6'));var attributes=require(_0xb7e1('0x7'));module[_0xb7e1('0x8')]=function(_0x5df795,_0x23963d){return _0x5df795['define']('CmHopperAdditionalPhone',attributes,{'tableName':_0xb7e1('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 fd210be..9440e28 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 _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 +var _0x2f1e=['activateAdditionalPhone','IncrementPreviewCounters','field','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','VerifyAdditionalPhones','CmHopper','body','ListId','VoiceQueueId','CampaignId','findOne','OrderBy','ASC','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countcongestionretry','SwapAdditionalPhones','CmHopperAdditionalPhone','waitTime','duration','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','sequelize','transaction','update'];(function(_0x30381e,_0x2a1f30){var _0x9fb2f3=function(_0x467138){while(--_0x467138){_0x30381e['push'](_0x30381e['shift']());}};_0x9fb2f3(++_0x2a1f30);}(_0x2f1e,0x1d3));var _0xe2f1=function(_0x21a534,_0x1f8347){_0x21a534=_0x21a534-0x0;var _0x3b9e98=_0x2f1e[_0x21a534];return _0x3b9e98;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe2f1('0x0'));var BPromise=require('bluebird');var rs=require(_0xe2f1('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe2f1('0x2'))['db'];var utils=require(_0xe2f1('0x3'));var logger=require(_0xe2f1('0x4'))(_0xe2f1('0x5'));var config=require(_0xe2f1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe2f1('0x7')][_0xe2f1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4fd40f,_0x51e0ab,_0x5f5ba4){return new BPromise(function(_0x5e50c0,_0x3ae64a){return client[_0xe2f1('0x9')](_0x4fd40f,_0x5f5ba4)[_0xe2f1('0xa')](function(_0x9b766e){logger['info'](_0xe2f1('0xb'),_0x51e0ab,_0xe2f1('0xc'));logger[_0xe2f1('0xd')](_0xe2f1('0xe'),_0x51e0ab,'request\x20sent',JSON[_0xe2f1('0xf')](_0x9b766e));if(_0x9b766e[_0xe2f1('0x10')]){if(_0x9b766e[_0xe2f1('0x10')][_0xe2f1('0x11')]===0x1f4){logger[_0xe2f1('0x10')](_0xe2f1('0xb'),_0x51e0ab,_0x9b766e[_0xe2f1('0x10')]['message']);return _0x3ae64a(_0x9b766e[_0xe2f1('0x10')]['message']);}logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x51e0ab,_0x9b766e['error'][_0xe2f1('0x12')]);return _0x5e50c0(_0x9b766e[_0xe2f1('0x10')][_0xe2f1('0x12')]);}else{logger[_0xe2f1('0x13')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x51e0ab,_0xe2f1('0xc'));_0x5e50c0(_0x9b766e[_0xe2f1('0x14')][_0xe2f1('0x12')]);}})[_0xe2f1('0x15')](function(_0x2e0e98){logger['error'](_0xe2f1('0xb'),_0x51e0ab,_0x2e0e98);_0x3ae64a(_0x2e0e98);});});}exports[_0xe2f1('0x16')]=function(_0x5c1b60){var _0x4a890d=this;return new Promise(function(_0x382061,_0x2e7625){return db[_0xe2f1('0x17')]['findOne']({'raw':!![],'where':{'ContactId':_0x5c1b60[_0xe2f1('0x18')]['ContactId'],'ListId':_0x5c1b60[_0xe2f1('0x18')][_0xe2f1('0x19')],'VoiceQueueId':_0x5c1b60[_0xe2f1('0x18')][_0xe2f1('0x1a')]===undefined?null:_0x5c1b60[_0xe2f1('0x18')][_0xe2f1('0x1a')],'CampaignId':_0x5c1b60[_0xe2f1('0x18')][_0xe2f1('0x1b')]===undefined?null:_0x5c1b60['body']['CampaignId']}})[_0xe2f1('0xa')](function(_0x15c95b){if(_0x15c95b!=null){return db['CmHopperAdditionalPhone'][_0xe2f1('0x1c')]({'raw':!![],'where':{'CmHopperId':_0x15c95b['id'],'OrderBy':{'$gt':_0x15c95b[_0xe2f1('0x1d')]}},'order':[[_0xe2f1('0x1d'),_0xe2f1('0x1e')]]})[_0xe2f1('0xa')](function(_0x576389){var _0x4e3172=0x0;if(_0x576389){if(_0x576389[_0xe2f1('0x1f')]+_0x576389['countcongestionretry']+_0x576389[_0xe2f1('0x20')]+_0x576389[_0xe2f1('0x21')]+_0x576389[_0xe2f1('0x22')]+_0x576389[_0xe2f1('0x23')]+_0x576389[_0xe2f1('0x24')]+_0x576389[_0xe2f1('0x25')]<_0x5c1b60[_0xe2f1('0x26')][_0xe2f1('0x27')])_0x4e3172=0x1;_0x382061({'additional':_0x4e3172});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x15c95b['id']},'order':[[_0xe2f1('0x1d'),_0xe2f1('0x1e')]]})[_0xe2f1('0xa')](function(_0x2b3dfc){var _0x6952aa=0x0;if(_0x2b3dfc){if(_0x2b3dfc[_0xe2f1('0x1f')]+_0x2b3dfc[_0xe2f1('0x28')]+_0x2b3dfc[_0xe2f1('0x20')]+_0x2b3dfc[_0xe2f1('0x21')]+_0x2b3dfc[_0xe2f1('0x22')]+_0x2b3dfc[_0xe2f1('0x23')]+_0x2b3dfc[_0xe2f1('0x24')]+_0x2b3dfc[_0xe2f1('0x25')]<_0x5c1b60['entity'][_0xe2f1('0x27')])_0x6952aa=0x1;_0x382061({'additional':_0x6952aa});}else{_0x382061({'additional':0x0});}})['catch'](function(_0x4234cc){logger['error'](_0xe2f1('0x16'),_0x4234cc[_0xe2f1('0x12')]);_0x2e7625(_0x4a890d[_0xe2f1('0x10')](0x1f4,_0x4234cc['message']));});}})['catch'](function(_0xa848d){logger['error'](_0xe2f1('0x16'),_0xa848d[_0xe2f1('0x12')]);_0x2e7625(_0x4a890d[_0xe2f1('0x10')](0x1f4,_0xa848d[_0xe2f1('0x12')]));});}else _0x382061({'additional':0x0});});});};exports[_0xe2f1('0x29')]=function(_0x3562fd){var _0x33c99e=this;return new Promise(function(_0x3d8c2a,_0x2613dd){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x3562fd['body']['ContactId'],'ListId':_0x3562fd[_0xe2f1('0x18')][_0xe2f1('0x19')],'VoiceQueueId':_0x3562fd['body'][_0xe2f1('0x1a')]===undefined?null:_0x3562fd[_0xe2f1('0x18')][_0xe2f1('0x1a')],'CampaignId':_0x3562fd[_0xe2f1('0x18')][_0xe2f1('0x1b')]===undefined?null:_0x3562fd[_0xe2f1('0x18')][_0xe2f1('0x1b')]}})[_0xe2f1('0xa')](function(_0x1d696c){if(_0x1d696c!=null){return db[_0xe2f1('0x2a')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x1d696c['id'],'OrderBy':{'$gte':_0x1d696c[_0xe2f1('0x1d')]}},'order':[['OrderBy',_0xe2f1('0x1e')]]})[_0xe2f1('0xa')](function(_0x28787a){if(_0x28787a)return activateAdditionalPhone(_0x1d696c,_0x3562fd['body'],_0x28787a,_0x3562fd['duration'],_0x3562fd[_0xe2f1('0x2b')])[_0xe2f1('0xa')](function(_0x57f1fe){_0x3d8c2a(_0x57f1fe);});else{return db['CmHopperAdditionalPhone'][_0xe2f1('0x1c')]({'raw':!![],'where':{'CmHopperId':_0x1d696c['id']},'order':[[_0xe2f1('0x1d'),_0xe2f1('0x1e')]]})[_0xe2f1('0xa')](function(_0x266683){if(_0x266683)return activateAdditionalPhone(_0x1d696c,_0x3562fd[_0xe2f1('0x18')],_0x266683,_0x3562fd[_0xe2f1('0x2c')],_0x3562fd[_0xe2f1('0x2b')])['then'](function(_0x11c173){_0x3d8c2a(_0x11c173);});else{_0x3d8c2a({'id':_0x1d696c['id'],'phone':''});}})[_0xe2f1('0x15')](function(_0x330bb2){logger[_0xe2f1('0x10')](_0xe2f1('0x16'),_0x330bb2['message']);_0x2613dd(_0x33c99e['error'](0x1f4,_0x330bb2['message']));});}})['catch'](function(_0x344dbb){logger['error']('VerifyAdditionalPhones',_0x344dbb[_0xe2f1('0x12')]);_0x2613dd(_0x33c99e[_0xe2f1('0x10')](0x1f4,_0x344dbb[_0xe2f1('0x12')]));});}else _0x3d8c2a(0x1);});});};function activateAdditionalPhone(_0x33c3d2,_0x8037f3,_0x4b759b,_0x3fa9ad,_0x5ad2d7){return new Promise(function(_0x1a92ca,_0x3f720f){var _0x23efa1;if(_[_0xe2f1('0x2d')](_0x4b759b[_0xe2f1('0x2e')])){_0x4b759b[_0xe2f1('0x2e')]=moment();}if(moment()>moment(_0x4b759b[_0xe2f1('0x2e')])){_0x23efa1=moment()[_0xe2f1('0x2f')](_0x5ad2d7||0x3,_0xe2f1('0x30'));}else{if(_0x4b759b['OrderBy']==0x0){_0x23efa1=moment(_0x4b759b['scheduledat']);}else{_0x23efa1=moment()[_0xe2f1('0x2f')](_0x5ad2d7||0x3,_0xe2f1('0x30'));}}if(_[_0xe2f1('0x2d')](_0x23efa1)){_0x23efa1=moment()[_0xe2f1('0x2f')](_0x5ad2d7||0x3,_0xe2f1('0x30'));}var _0x435636={'phone':_0x33c3d2[_0xe2f1('0x31')],'active':0x0,'OrderBy':_['isNil'](_0x33c3d2[_0xe2f1('0x1d')])?0x0:_0x33c3d2['OrderBy'],'scheduledat':moment()[_0xe2f1('0x2f')](_0x3fa9ad||0x1,_0xe2f1('0x30')),'countbusyretry':_0x8037f3[_0xe2f1('0x1f')],'countcongestionretry':_0x8037f3[_0xe2f1('0x28')],'countnoanswerretry':_0x8037f3['countnoanswerretry'],'countnosuchnumberretry':_0x8037f3[_0xe2f1('0x21')],'countdropretry':_0x8037f3[_0xe2f1('0x22')],'countabandonedretry':_0x8037f3[_0xe2f1('0x23')],'countmachineretry':_0x8037f3[_0xe2f1('0x24')],'countagentrejectretry':_0x8037f3['countagentrejectretry'],'createdAt':_0x8037f3[_0xe2f1('0x32')],'updatedAt':_0x8037f3['updatedAt']};var _0x4769c5={'CmHopperId':_0x33c3d2['id'],'phone':_0x4b759b[_0xe2f1('0x31')],'active':0x0,'OrderBy':_[_0xe2f1('0x2d')](_0x4b759b[_0xe2f1('0x1d')])?0x0:_0x4b759b[_0xe2f1('0x1d')],'scheduledat':_0x23efa1,'countbusyretry':_0x4b759b[_0xe2f1('0x1f')],'countcongestionretry':_0x4b759b[_0xe2f1('0x28')],'countnoanswerretry':_0x4b759b[_0xe2f1('0x20')],'countnosuchnumberretry':_0x4b759b[_0xe2f1('0x21')],'countdropretry':_0x4b759b['countdropretry'],'countabandonedretry':_0x4b759b[_0xe2f1('0x23')],'countmachineretry':_0x4b759b['countmachineretry'],'countagentrejectretry':_0x4b759b[_0xe2f1('0x25')],'createdAt':_0x4b759b['createdAt'],'updatedAt':_0x4b759b[_0xe2f1('0x33')]};return db[_0xe2f1('0x34')][_0xe2f1('0x35')](function(_0x355e1c){return db[_0xe2f1('0x2a')][_0xe2f1('0x36')](_0x435636,{'where':{'id':_0x4b759b['id']}},{'transaction':_0x355e1c})[_0xe2f1('0xa')](function(){return db[_0xe2f1('0x17')][_0xe2f1('0x36')](_0x4769c5,{'where':{'id':_0x33c3d2['id']}},{'transaction':_0x355e1c});});})['then'](function(_0x3ce985){_0x1a92ca({'id':_0x33c3d2['id'],'phone':_0x4b759b['phone']});})['catch'](function(_0x4063b3){logger[_0xe2f1('0x10')](_0xe2f1('0x37'),_0x4063b3['message']);_0x3f720f({'error':_0x4063b3['message']});});});}exports[_0xe2f1('0x38')]=function(_0x504040){var _0x106327=this;return new Promise(function(_0x2ce8f5,_0x2c8c80){return db[_0xe2f1('0x17')][_0xe2f1('0x36')](_0x504040[_0xe2f1('0x18')][_0xe2f1('0x39')],{'where':{'id':_0x504040[_0xe2f1('0x18')]['id']}})[_0xe2f1('0xa')](function(_0xaeefd2){_0x2ce8f5(_0xaeefd2);})[_0xe2f1('0x15')](function(_0x3a2ebb){logger[_0xe2f1('0x10')](_0xe2f1('0x38'),_0x3a2ebb[_0xe2f1('0x12')]);_0x2c8c80(_0x106327[_0xe2f1('0x10')](0x1f4,_0x3a2ebb['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 71450e2..1943f4d 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 _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 +var _0x644e=['show','post','create','put','update','delete','exports','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x644e,0x97));var _0xe644=function(_0x4ff2a3,_0x164f75){_0x4ff2a3=_0x4ff2a3-0x0;var _0x51a8c0=_0x644e[_0x4ff2a3];return _0x51a8c0;};'use strict';var multer=require('multer');var util=require(_0xe644('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe644('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe644('0x2'));var interaction=require(_0xe644('0x3'));var config=require(_0xe644('0x4'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0xe644('0x5')]('/',auth[_0xe644('0x6')](),controller[_0xe644('0x7')]);router[_0xe644('0x5')](_0xe644('0x8'),auth[_0xe644('0x6')](),controller[_0xe644('0x9')]);router[_0xe644('0xa')]('/',auth['isAuthenticated'](),controller[_0xe644('0xb')]);router[_0xe644('0xc')]('/:id',auth[_0xe644('0x6')](),controller[_0xe644('0xd')]);router[_0xe644('0xe')](_0xe644('0x8'),auth[_0xe644('0x6')](),controller['destroy']);module[_0xe644('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 9058418..3336a12 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 _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 +var _0x35e2=['STRING','INTEGER','contactListQueue','moment','exports'];(function(_0x30593d,_0x333ab7){var _0x35c405=function(_0x524d46){while(--_0x524d46){_0x30593d['push'](_0x30593d['shift']());}};_0x35c405(++_0x333ab7);}(_0x35e2,0x1ed));var _0x235e=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x35e2[_0x422905];return _0x33dc6c;};'use strict';var moment=require(_0x235e('0x0'));var Sequelize=require('sequelize');module[_0x235e('0x1')]={'phone':{'type':Sequelize[_0x235e('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x235e('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x235e('0x3')],'unique':_0x235e('0x4')},'VoiceQueueId':{'type':Sequelize[_0x235e('0x3')],'unique':_0x235e('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index e5ee60d..971252f 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 _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 +var _0x6c6f=['apply','reject','save','update','then','sendStatus','name','send','index','map','CmHopperBlack','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','body','destroy','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','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','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x53ddab,_0x4ada9d){var _0x5819ac=function(_0x4d5fc8){while(--_0x4d5fc8){_0x53ddab['push'](_0x53ddab['shift']());}};_0x5819ac(++_0x4ada9d);}(_0x6c6f,0x10b));var _0xf6c6=function(_0x418134,_0x32bc8b){_0x418134=_0x418134-0x0;var _0x4fb44a=_0x6c6f[_0x418134];return _0x4fb44a;};'use strict';var emlformat=require(_0xf6c6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf6c6('0x1'));var rp=require(_0xf6c6('0x2'));var moment=require(_0xf6c6('0x3'));var BPromise=require(_0xf6c6('0x4'));var Mustache=require(_0xf6c6('0x5'));var util=require('util');var path=require(_0xf6c6('0x6'));var sox=require(_0xf6c6('0x7'));var csv=require(_0xf6c6('0x8'));var ejs=require(_0xf6c6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf6c6('0xa'));var squel=require(_0xf6c6('0xb'));var crypto=require(_0xf6c6('0xc'));var jsforce=require(_0xf6c6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf6c6('0x8'));var querystring=require(_0xf6c6('0xe'));var Papa=require(_0xf6c6('0xf'));var Redis=require(_0xf6c6('0x10'));var authService=require(_0xf6c6('0x11'));var qs=require(_0xf6c6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf6c6('0x13'));var logger=require(_0xf6c6('0x14'))('api');var utils=require(_0xf6c6('0x15'));var config=require(_0xf6c6('0x16'));var licenseUtil=require(_0xf6c6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bc477,_0x59d81){_0x59d81=_0x59d81||0xcc;return function(_0x4ddc25){if(_0x4ddc25){return _0x4bc477['sendStatus'](_0x59d81);}return _0x4bc477[_0xf6c6('0x18')](_0x59d81)[_0xf6c6('0x19')]();};}function respondWithResult(_0x590d6d,_0x26fc30){_0x26fc30=_0x26fc30||0xc8;return function(_0x36694e){if(_0x36694e){return _0x590d6d[_0xf6c6('0x18')](_0x26fc30)[_0xf6c6('0x1a')](_0x36694e);}};}function respondWithFilteredResult(_0x869fea,_0x271df3){return function(_0x2482f9){if(_0x2482f9){var _0x4b8258=typeof _0x271df3[_0xf6c6('0x1b')]===_0xf6c6('0x1c')&&typeof _0x271df3[_0xf6c6('0x1d')]===_0xf6c6('0x1c');var _0x55429f=_0x2482f9['count'];var _0x2473da=_0x4b8258?0x0:_0x271df3[_0xf6c6('0x1b')];var _0x4a2d3a=_0x4b8258?_0x2482f9[_0xf6c6('0x1e')]:_0x271df3['offset']+_0x271df3[_0xf6c6('0x1d')];var _0x45eefa;if(_0x4a2d3a>=_0x55429f){_0x4a2d3a=_0x55429f;_0x45eefa=0xc8;}else{_0x45eefa=0xce;}_0x869fea[_0xf6c6('0x18')](_0x45eefa);return _0x869fea[_0xf6c6('0x1f')](_0xf6c6('0x20'),_0x2473da+'-'+_0x4a2d3a+'/'+_0x55429f)['json'](_0x2482f9);}return null;};}function patchUpdates(_0x5e36a1){return function(_0x1cd0b8){try{jsonpatch[_0xf6c6('0x21')](_0x1cd0b8,_0x5e36a1,!![]);}catch(_0x2ddf50){return BPromise[_0xf6c6('0x22')](_0x2ddf50);}return _0x1cd0b8[_0xf6c6('0x23')]();};}function saveUpdates(_0x2ecf7c,_0x30fd57){return function(_0x17d84e){if(_0x17d84e){return _0x17d84e[_0xf6c6('0x24')](_0x2ecf7c)[_0xf6c6('0x25')](function(_0x4e0414){return _0x4e0414;});}return null;};}function removeEntity(_0x26c0de,_0x44ba79){return function(_0x3c82a1){if(_0x3c82a1){return _0x3c82a1['destroy']()[_0xf6c6('0x25')](function(){_0x26c0de[_0xf6c6('0x18')](0xcc)[_0xf6c6('0x19')]();});}};}function handleEntityNotFound(_0x2a6d83,_0x522ee8){return function(_0x2b512b){if(!_0x2b512b){_0x2a6d83[_0xf6c6('0x26')](0x194);}return _0x2b512b;};}function handleError(_0x1cd78f,_0x2d94a9){_0x2d94a9=_0x2d94a9||0x1f4;return function(_0x19c980){logger['error'](_0x19c980['stack']);if(_0x19c980[_0xf6c6('0x27')]){delete _0x19c980[_0xf6c6('0x27')];}_0x1cd78f[_0xf6c6('0x18')](_0x2d94a9)[_0xf6c6('0x28')](_0x19c980);};}exports[_0xf6c6('0x29')]=function(_0x27e5fd,_0x458b29){var _0x4df77f={},_0x5cfe69={},_0x822662={'count':0x0,'rows':[]};var _0x5494c0=_[_0xf6c6('0x2a')](db[_0xf6c6('0x2b')]['rawAttributes'],function(_0x2fba3c){return{'name':_0x2fba3c[_0xf6c6('0x2c')],'type':_0x2fba3c[_0xf6c6('0x2d')][_0xf6c6('0x2e')]};});_0x5cfe69[_0xf6c6('0x2f')]=_[_0xf6c6('0x2a')](_0x5494c0,_0xf6c6('0x27'));_0x5cfe69[_0xf6c6('0x30')]=_[_0xf6c6('0x31')](_0x27e5fd[_0xf6c6('0x30')]);_0x5cfe69[_0xf6c6('0x32')]=_[_0xf6c6('0x33')](_0x5cfe69[_0xf6c6('0x2f')],_0x5cfe69[_0xf6c6('0x30')]);_0x4df77f[_0xf6c6('0x34')]=_[_0xf6c6('0x33')](_0x5cfe69['model'],qs[_0xf6c6('0x35')](_0x27e5fd['query'][_0xf6c6('0x35')]));_0x4df77f[_0xf6c6('0x34')]=_0x4df77f[_0xf6c6('0x34')][_0xf6c6('0x36')]?_0x4df77f[_0xf6c6('0x34')]:_0x5cfe69[_0xf6c6('0x2f')];if(!_0x27e5fd[_0xf6c6('0x30')][_0xf6c6('0x37')]('nolimit')){_0x4df77f[_0xf6c6('0x1d')]=qs[_0xf6c6('0x1d')](_0x27e5fd[_0xf6c6('0x30')]['limit']);_0x4df77f[_0xf6c6('0x1b')]=qs['offset'](_0x27e5fd['query'][_0xf6c6('0x1b')]);}_0x4df77f[_0xf6c6('0x38')]=qs['sort'](_0x27e5fd['query'][_0xf6c6('0x39')]);_0x4df77f[_0xf6c6('0x3a')]=qs['filters'](_[_0xf6c6('0x3b')](_0x27e5fd[_0xf6c6('0x30')],_0x5cfe69[_0xf6c6('0x32')]),_0x5494c0);if(_0x27e5fd[_0xf6c6('0x30')][_0xf6c6('0x3c')]){_0x4df77f['where']=_[_0xf6c6('0x3d')](_0x4df77f['where'],{'$or':_[_0xf6c6('0x2a')](_0x5494c0,function(_0x4366cd){if(_0x4366cd[_0xf6c6('0x2d')]!==_0xf6c6('0x3e')){var _0x19a092={};_0x19a092[_0x4366cd[_0xf6c6('0x27')]]={'$like':'%'+_0x27e5fd['query'][_0xf6c6('0x3c')]+'%'};return _0x19a092;}})});}_0x4df77f=_['merge']({},_0x4df77f,_0x27e5fd['options']);var _0x249d8b={'where':_0x4df77f[_0xf6c6('0x3a')]};return db[_0xf6c6('0x2b')]['count'](_0x249d8b)[_0xf6c6('0x25')](function(_0x3783ba){_0x822662['count']=_0x3783ba;if(_0x27e5fd[_0xf6c6('0x30')][_0xf6c6('0x3f')]){_0x4df77f[_0xf6c6('0x40')]=[{'all':!![]}];}return db[_0xf6c6('0x2b')][_0xf6c6('0x41')](_0x4df77f);})[_0xf6c6('0x25')](function(_0x34e283){_0x822662[_0xf6c6('0x42')]=_0x34e283;return _0x822662;})[_0xf6c6('0x25')](respondWithFilteredResult(_0x458b29,_0x4df77f))[_0xf6c6('0x43')](handleError(_0x458b29,null));};exports[_0xf6c6('0x44')]=function(_0x157915,_0x2f61a0){var _0x41d602={'raw':!![],'where':{'id':_0x157915[_0xf6c6('0x45')]['id']}},_0x1c0b6f={};_0x1c0b6f[_0xf6c6('0x2f')]=_[_0xf6c6('0x31')](db['CmHopperBlack']['rawAttributes']);_0x1c0b6f[_0xf6c6('0x30')]=_[_0xf6c6('0x31')](_0x157915[_0xf6c6('0x30')]);_0x1c0b6f[_0xf6c6('0x32')]=_[_0xf6c6('0x33')](_0x1c0b6f[_0xf6c6('0x2f')],_0x1c0b6f[_0xf6c6('0x30')]);_0x41d602[_0xf6c6('0x34')]=_[_0xf6c6('0x33')](_0x1c0b6f[_0xf6c6('0x2f')],qs[_0xf6c6('0x35')](_0x157915[_0xf6c6('0x30')]['fields']));_0x41d602[_0xf6c6('0x34')]=_0x41d602[_0xf6c6('0x34')]['length']?_0x41d602[_0xf6c6('0x34')]:_0x1c0b6f[_0xf6c6('0x2f')];if(_0x157915[_0xf6c6('0x30')][_0xf6c6('0x3f')]){_0x41d602[_0xf6c6('0x40')]=[{'all':!![]}];}_0x41d602=_[_0xf6c6('0x3d')]({},_0x41d602,_0x157915[_0xf6c6('0x46')]);return db['CmHopperBlack'][_0xf6c6('0x47')](_0x41d602)[_0xf6c6('0x25')](handleEntityNotFound(_0x2f61a0,null))[_0xf6c6('0x25')](respondWithResult(_0x2f61a0,null))[_0xf6c6('0x43')](handleError(_0x2f61a0,null));};exports[_0xf6c6('0x24')]=function(_0x5e2e3a,_0x59806a){if(_0x5e2e3a[_0xf6c6('0x48')]['id']){delete _0x5e2e3a[_0xf6c6('0x48')]['id'];}return db[_0xf6c6('0x2b')][_0xf6c6('0x47')]({'where':{'id':_0x5e2e3a['params']['id']}})[_0xf6c6('0x25')](handleEntityNotFound(_0x59806a,null))[_0xf6c6('0x25')](saveUpdates(_0x5e2e3a[_0xf6c6('0x48')],null))[_0xf6c6('0x25')](respondWithResult(_0x59806a,null))[_0xf6c6('0x43')](handleError(_0x59806a,null));};exports[_0xf6c6('0x49')]=function(_0x3415d5,_0x55994e){return db['CmHopperBlack']['find']({'where':{'id':_0x3415d5['params']['id']}})[_0xf6c6('0x25')](handleEntityNotFound(_0x55994e,null))[_0xf6c6('0x25')](removeEntity(_0x55994e,null))[_0xf6c6('0x43')](handleError(_0x55994e,null));};exports[_0xf6c6('0x4a')]=function(_0x3798bf,_0x160ed1){return db['CmHopperBlack'][_0xf6c6('0x4a')]()[_0xf6c6('0x25')](respondWithResult(_0x160ed1,null))[_0xf6c6('0x43')](handleError(_0x160ed1,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 9c72485..434651a 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 _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 +var _0x515e=['../../config/environment','exports','define','cm_hopper_black','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x26241d,_0x31709d){var _0x48df2e=function(_0x2cf229){while(--_0x2cf229){_0x26241d['push'](_0x26241d['shift']());}};_0x48df2e(++_0x31709d);}(_0x515e,0x10c));var _0xe515=function(_0x1ebe2f,_0x523227){_0x1ebe2f=_0x1ebe2f-0x0;var _0xdeb06f=_0x515e[_0x1ebe2f];return _0xdeb06f;};'use strict';var _=require(_0xe515('0x0'));var util=require(_0xe515('0x1'));var logger=require(_0xe515('0x2'))(_0xe515('0x3'));var moment=require(_0xe515('0x4'));var BPromise=require('bluebird');var rp=require(_0xe515('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe515('0x6'));var config=require(_0xe515('0x7'));var attributes=require('./cmHopperBlack.attributes');module[_0xe515('0x8')]=function(_0xcf40aa,_0x5529e8){return _0xcf40aa[_0xe515('0x9')]('CmHopperBlack',attributes,{'tableName':_0xe515('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 597155f..5397633 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 _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 +var _0xa1f8=['include','model','map','then','UpdateCmHopperBlack','CmHopperBlack','update','body','destroy','DestroyCmHopperBlack','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetCmHopperBlack','options','raw','where','attributes','limit'];(function(_0x22d33b,_0x15491a){var _0x80b3ab=function(_0x4425de){while(--_0x4425de){_0x22d33b['push'](_0x22d33b['shift']());}};_0x80b3ab(++_0x15491a);}(_0xa1f8,0x1eb));var _0x8a1f=function(_0x4acfb0,_0x1c142d){_0x4acfb0=_0x4acfb0-0x0;var _0x3bf37b=_0xa1f8[_0x4acfb0];return _0x3bf37b;};'use strict';var _=require(_0x8a1f('0x0'));var util=require(_0x8a1f('0x1'));var moment=require(_0x8a1f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a1f('0x3'));var db=require(_0x8a1f('0x4'))['db'];var utils=require(_0x8a1f('0x5'));var logger=require(_0x8a1f('0x6'))('rpc');var config=require(_0x8a1f('0x7'));var jayson=require(_0x8a1f('0x8'));var client=jayson[_0x8a1f('0x9')][_0x8a1f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x552750,_0x388acf,_0x337e5d){return new BPromise(function(_0x511532,_0x83f792){return client['request'](_0x552750,_0x337e5d)['then'](function(_0x188c8d){logger[_0x8a1f('0xb')](_0x8a1f('0xc'),_0x388acf,_0x8a1f('0xd'));logger[_0x8a1f('0xe')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x388acf,_0x8a1f('0xd'),JSON[_0x8a1f('0xf')](_0x188c8d));if(_0x188c8d[_0x8a1f('0x10')]){if(_0x188c8d['error'][_0x8a1f('0x11')]===0x1f4){logger[_0x8a1f('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x388acf,_0x188c8d[_0x8a1f('0x10')]['message']);return _0x83f792(_0x188c8d[_0x8a1f('0x10')][_0x8a1f('0x12')]);}logger[_0x8a1f('0x10')](_0x8a1f('0xc'),_0x388acf,_0x188c8d[_0x8a1f('0x10')][_0x8a1f('0x12')]);return _0x511532(_0x188c8d['error'][_0x8a1f('0x12')]);}else{logger['info'](_0x8a1f('0xc'),_0x388acf,'request\x20sent');_0x511532(_0x188c8d[_0x8a1f('0x13')][_0x8a1f('0x12')]);}})[_0x8a1f('0x14')](function(_0x519c17){logger[_0x8a1f('0x10')](_0x8a1f('0xc'),_0x388acf,_0x519c17);_0x83f792(_0x519c17);});});}exports[_0x8a1f('0x15')]=function(_0x3cc4bb){var _0x4208bb=this;return new Promise(function(_0x3ba2d6,_0x1ff8a2){return db['CmHopperBlack']['findAll']({'raw':_0x3cc4bb[_0x8a1f('0x16')]?_0x3cc4bb[_0x8a1f('0x16')][_0x8a1f('0x17')]===undefined?!![]:![]:!![],'where':_0x3cc4bb[_0x8a1f('0x16')]?_0x3cc4bb['options'][_0x8a1f('0x18')]||null:null,'attributes':_0x3cc4bb[_0x8a1f('0x16')]?_0x3cc4bb[_0x8a1f('0x16')][_0x8a1f('0x19')]||null:null,'limit':_0x3cc4bb[_0x8a1f('0x16')]?_0x3cc4bb['options'][_0x8a1f('0x1a')]||null:null,'include':_0x3cc4bb[_0x8a1f('0x16')]?_0x3cc4bb[_0x8a1f('0x16')][_0x8a1f('0x1b')]?_['map'](_0x3cc4bb[_0x8a1f('0x16')][_0x8a1f('0x1b')],function(_0x36231b){return{'model':db[_0x36231b[_0x8a1f('0x1c')]],'as':_0x36231b['as'],'attributes':_0x36231b['attributes'],'include':_0x36231b['include']?_[_0x8a1f('0x1d')](_0x36231b['include'],function(_0x4bc3b1){return{'model':db[_0x4bc3b1[_0x8a1f('0x1c')]],'as':_0x4bc3b1['as'],'attributes':_0x4bc3b1[_0x8a1f('0x19')],'include':_0x4bc3b1['include']?_[_0x8a1f('0x1d')](_0x4bc3b1[_0x8a1f('0x1b')],function(_0x195e49){return{'model':db[_0x195e49['model']],'as':_0x195e49['as'],'attributes':_0x195e49[_0x8a1f('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8a1f('0x1e')](function(_0x4d97e0){logger[_0x8a1f('0xb')]('GetCmHopperBlack',_0x3cc4bb);logger[_0x8a1f('0xe')](_0x8a1f('0x15'),_0x3cc4bb,JSON['stringify'](_0x4d97e0));_0x3ba2d6(_0x4d97e0);})[_0x8a1f('0x14')](function(_0x11817a){logger[_0x8a1f('0x10')](_0x8a1f('0x15'),_0x11817a[_0x8a1f('0x12')],_0x3cc4bb);_0x1ff8a2(_0x4208bb['error'](0x1f4,_0x11817a[_0x8a1f('0x12')]));});});};exports[_0x8a1f('0x1f')]=function(_0x4acbf4){var _0x3558f1=this;return new Promise(function(_0x57a7f6,_0xaec1a5){return db[_0x8a1f('0x20')][_0x8a1f('0x21')](_0x4acbf4[_0x8a1f('0x22')],{'raw':_0x4acbf4[_0x8a1f('0x16')]?_0x4acbf4['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4acbf4[_0x8a1f('0x16')]?_0x4acbf4[_0x8a1f('0x16')][_0x8a1f('0x18')]||null:null,'attributes':_0x4acbf4['options']?_0x4acbf4[_0x8a1f('0x16')]['attributes']||null:null,'limit':_0x4acbf4['options']?_0x4acbf4[_0x8a1f('0x16')]['limit']||null:null})[_0x8a1f('0x1e')](function(_0x104102){logger['info']('UpdateCmHopperBlack',_0x4acbf4);logger[_0x8a1f('0xe')](_0x8a1f('0x1f'),_0x4acbf4,JSON[_0x8a1f('0xf')](_0x104102));_0x57a7f6(_0x104102);})[_0x8a1f('0x14')](function(_0x30d8f6){logger[_0x8a1f('0x10')]('UpdateCmHopperBlack',_0x30d8f6[_0x8a1f('0x12')],_0x4acbf4);_0xaec1a5(_0x3558f1[_0x8a1f('0x10')](0x1f4,_0x30d8f6[_0x8a1f('0x12')]));});});};exports['DestroyCmHopperBlack']=function(_0x86dd94){var _0x55b642=this;return new Promise(function(_0x37f02b,_0x4eafae){return db[_0x8a1f('0x20')][_0x8a1f('0x23')]({'where':_0x86dd94[_0x8a1f('0x16')]?_0x86dd94['options'][_0x8a1f('0x18')]||null:null})[_0x8a1f('0x1e')](function(_0x17760b){logger[_0x8a1f('0xb')](_0x8a1f('0x24'),_0x86dd94);logger[_0x8a1f('0xe')]('DestroyCmHopperBlack',_0x86dd94,JSON[_0x8a1f('0xf')](_0x17760b));_0x37f02b(_0x17760b);})[_0x8a1f('0x14')](function(_0x2872e7){logger[_0x8a1f('0x10')](_0x8a1f('0x24'),_0x2872e7[_0x8a1f('0x12')],_0x86dd94);_0x4eafae(_0x55b642[_0x8a1f('0x10')](0x1f4,_0x2872e7[_0x8a1f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 7212452..07225f7 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 _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 +var _0x5162=['/:id','show','update','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','/describe','isAuthenticated','describe'];(function(_0x2326f2,_0x310b27){var _0xb699c4=function(_0x26bb04){while(--_0x26bb04){_0x2326f2['push'](_0x2326f2['shift']());}};_0xb699c4(++_0x310b27);}(_0x5162,0x103));var _0x2516=function(_0x6b1c9e,_0x322a1){_0x6b1c9e=_0x6b1c9e-0x0;var _0x4fb0d5=_0x5162[_0x6b1c9e];return _0x4fb0d5;};'use strict';var multer=require(_0x2516('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2516('0x1')]();var fs_extra=require(_0x2516('0x2'));var auth=require(_0x2516('0x3'));var interaction=require(_0x2516('0x4'));var config=require(_0x2516('0x5'));var controller=require(_0x2516('0x6'));router[_0x2516('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2516('0x8'),auth[_0x2516('0x9')](),controller[_0x2516('0xa')]);router[_0x2516('0x7')](_0x2516('0xb'),auth[_0x2516('0x9')](),controller[_0x2516('0xc')]);router['put'](_0x2516('0xb'),auth[_0x2516('0x9')](),controller[_0x2516('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2516('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 9c9a120..55e2580 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 _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 +var _0x2c78=['INTEGER','STRING','DATE','followuptime','diff','BOOLEAN','moment','exports'];(function(_0x52096b,_0x20bab4){var _0x2b1cc7=function(_0x3f7021){while(--_0x3f7021){_0x52096b['push'](_0x52096b['shift']());}};_0x2b1cc7(++_0x20bab4);}(_0x2c78,0x19e));var _0x82c7=function(_0x1c0e91,_0xd8625e){_0x1c0e91=_0x1c0e91-0x0;var _0x34322c=_0x2c78[_0x1c0e91];return _0x34322c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x82c7('0x0'));module[_0x82c7('0x1')]={'state':{'type':Sequelize[_0x82c7('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x82c7('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x82c7('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x82c7('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x82c7('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x82c7('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x82c7('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x82c7('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x82c7('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x82c7('0x4')]},'endtime':{'type':Sequelize[_0x82c7('0x4')]},'ringtime':{'type':Sequelize[_0x82c7('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x82c7('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x82c7('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x82c7('0x3')]},'campaign':{'type':Sequelize[_0x82c7('0x3')]},'campaigntype':{'type':Sequelize[_0x82c7('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x82c7('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x82c7('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x5950f3){var _0x8ca7d4=this['getDataValue']('endtime');if(_0x8ca7d4&&_0x5950f3){this['setDataValue'](_0x82c7('0x5'),moment(_0x5950f3)[_0x82c7('0x6')](moment(_0x8ca7d4),'seconds'));}}},'amd':{'type':Sequelize[_0x82c7('0x7')],'defaultValue':![]},'fax':{'type':Sequelize[_0x82c7('0x7')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x82c7('0x7')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x82c7('0x7')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x82c7('0x4')]},'callback':{'type':Sequelize[_0x82c7('0x7')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x82c7('0x4')]},'deleted':{'type':Sequelize[_0x82c7('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x82c7('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x82c7('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x82c7('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x82c7('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x82c7('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x82c7('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index e709fc0..cb66e53 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.controller.js +++ b/server/api/cmHopperFinal/cmHopperFinal.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57ca=['state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','cm_hopper','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','toString','group','moveContactsIvrCampaignHopperFinal','scheduledAt','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','from','state\x20=\x204','checkContactHopper','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','CmHopperFinal','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','params','find','catch','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noAnswerContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','phone','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?'];(function(_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 +var _0xbd51=['ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','updatedAt','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','from','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','then','includeAll','include','rows','show','params','keys','length','catch','describe','body','uniqueid','find','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`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','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','findAll','`state`\x20=\x208,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','VoiceQueueId','createdAt','select','field','ANY_VALUE(calleridnum)','NOW()','scheduledAt'];(function(_0x130b39,_0x4602be){var _0x140593=function(_0x5dd117){while(--_0x5dd117){_0x130b39['push'](_0x130b39['shift']());}};_0x140593(++_0x4602be);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x323a7e,_0x45b58a){_0x323a7e=_0x323a7e-0x0;var _0x46cd2c=_0xbd51[_0x323a7e];return _0x46cd2c;};'use strict';var emlformat=require(_0x1bd5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1bd5('0x1'));var jsonpatch=require(_0x1bd5('0x2'));var rp=require(_0x1bd5('0x3'));var moment=require(_0x1bd5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1bd5('0x5'));var csv=require(_0x1bd5('0x6'));var ejs=require(_0x1bd5('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1bd5('0x8'));var squel=require(_0x1bd5('0x9'));var crypto=require(_0x1bd5('0xa'));var jsforce=require(_0x1bd5('0xb'));var deskjs=require(_0x1bd5('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1bd5('0xd'));var Papa=require('papaparse');var Redis=require(_0x1bd5('0xe'));var authService=require(_0x1bd5('0xf'));var qs=require(_0x1bd5('0x10'));var as=require(_0x1bd5('0x11'));var hardwareService=require(_0x1bd5('0x12'));var logger=require(_0x1bd5('0x13'))('api');var utils=require(_0x1bd5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1bd5('0x15'));var db=require(_0x1bd5('0x16'))['db'];function respondWithStatusCode(_0x37e8e1,_0x14606b){_0x14606b=_0x14606b||0xcc;return function(_0x177be0){if(_0x177be0){return _0x37e8e1[_0x1bd5('0x17')](_0x14606b);}return _0x37e8e1[_0x1bd5('0x18')](_0x14606b)['end']();};}function respondWithResult(_0x5650b5,_0x8b2390){_0x8b2390=_0x8b2390||0xc8;return function(_0x6d2c40){if(_0x6d2c40){return _0x5650b5[_0x1bd5('0x18')](_0x8b2390)[_0x1bd5('0x19')](_0x6d2c40);}};}function respondWithFilteredResult(_0x48d048,_0x5072c2){return function(_0xa63190){if(_0xa63190){var _0xc7277e=typeof _0x5072c2[_0x1bd5('0x1a')]===_0x1bd5('0x1b')&&typeof _0x5072c2[_0x1bd5('0x1c')]===_0x1bd5('0x1b');var _0x13cf34=_0xa63190[_0x1bd5('0x1d')];var _0x4670b5=_0xc7277e?0x0:_0x5072c2['offset'];var _0x53ad5e=_0xc7277e?_0xa63190[_0x1bd5('0x1d')]:_0x5072c2[_0x1bd5('0x1a')]+_0x5072c2[_0x1bd5('0x1c')];var _0xb95d4e;if(_0x53ad5e>=_0x13cf34){_0x53ad5e=_0x13cf34;_0xb95d4e=0xc8;}else{_0xb95d4e=0xce;}_0x48d048[_0x1bd5('0x18')](_0xb95d4e);return _0x48d048[_0x1bd5('0x1e')](_0x1bd5('0x1f'),_0x4670b5+'-'+_0x53ad5e+'/'+_0x13cf34)[_0x1bd5('0x19')](_0xa63190);}return null;};}function patchUpdates(_0x456051){return function(_0xb1ac1e){try{jsonpatch[_0x1bd5('0x20')](_0xb1ac1e,_0x456051,!![]);}catch(_0x2447c4){return BPromise[_0x1bd5('0x21')](_0x2447c4);}return _0xb1ac1e[_0x1bd5('0x22')]();};}function saveUpdates(_0x253d79,_0x46c580){return function(_0x1f13e7){if(_0x1f13e7){return _0x1f13e7[_0x1bd5('0x23')](_0x253d79)['then'](function(_0x42c43d){return _0x42c43d;});}return null;};}function removeEntity(_0x50c663,_0x18fd18){return function(_0x1e534e){if(_0x1e534e){return _0x1e534e[_0x1bd5('0x24')]()['then'](function(){_0x50c663[_0x1bd5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ed551,_0x30676d){return function(_0x3dba4f){if(!_0x3dba4f){_0x2ed551[_0x1bd5('0x17')](0x194);}return _0x3dba4f;};}function handleError(_0x47c84b,_0x202ed3){_0x202ed3=_0x202ed3||0x1f4;return function(_0x69bb17){logger[_0x1bd5('0x25')](_0x69bb17[_0x1bd5('0x26')]);if(_0x69bb17['name']){delete _0x69bb17[_0x1bd5('0x27')];}_0x47c84b[_0x1bd5('0x18')](_0x202ed3)[_0x1bd5('0x28')](_0x69bb17);};}exports[_0x1bd5('0x29')]=function(_0xe54b9f,_0xc73670){var _0x4e72b2={},_0x289097={},_0x472b22={'count':0x0,'rows':[]};var _0x8d53ba=_['map'](db[_0x1bd5('0x2a')][_0x1bd5('0x2b')],function(_0x345181){return{'name':_0x345181[_0x1bd5('0x2c')],'type':_0x345181[_0x1bd5('0x2d')][_0x1bd5('0x2e')]};});_0x289097['model']=_['map'](_0x8d53ba,_0x1bd5('0x27'));_0x289097[_0x1bd5('0x2f')]=_['keys'](_0xe54b9f[_0x1bd5('0x2f')]);_0x289097[_0x1bd5('0x30')]=_[_0x1bd5('0x31')](_0x289097[_0x1bd5('0x32')],_0x289097['query']);_0x4e72b2[_0x1bd5('0x33')]=_[_0x1bd5('0x31')](_0x289097[_0x1bd5('0x32')],qs[_0x1bd5('0x34')](_0xe54b9f[_0x1bd5('0x2f')][_0x1bd5('0x34')]));_0x4e72b2[_0x1bd5('0x33')]=_0x4e72b2[_0x1bd5('0x33')]['length']?_0x4e72b2[_0x1bd5('0x33')]:_0x289097[_0x1bd5('0x32')];if(!_0xe54b9f[_0x1bd5('0x2f')][_0x1bd5('0x35')](_0x1bd5('0x36'))){_0x4e72b2[_0x1bd5('0x1c')]=qs[_0x1bd5('0x1c')](_0xe54b9f['query'][_0x1bd5('0x1c')]);_0x4e72b2[_0x1bd5('0x1a')]=qs[_0x1bd5('0x1a')](_0xe54b9f[_0x1bd5('0x2f')][_0x1bd5('0x1a')]);}_0x4e72b2[_0x1bd5('0x37')]=qs[_0x1bd5('0x38')](_0xe54b9f['query']['sort']);_0x4e72b2[_0x1bd5('0x39')]=qs[_0x1bd5('0x30')](_[_0x1bd5('0x3a')](_0xe54b9f['query'],_0x289097[_0x1bd5('0x30')]),_0x8d53ba);if(_0xe54b9f['query'][_0x1bd5('0x3b')]){_0x4e72b2[_0x1bd5('0x39')]=_[_0x1bd5('0x3c')](_0x4e72b2[_0x1bd5('0x39')],{'$or':_[_0x1bd5('0x3d')](_0x8d53ba,function(_0x2470ec){if(_0x2470ec[_0x1bd5('0x2d')]!==_0x1bd5('0x3e')){var _0x4bbefc={};_0x4bbefc[_0x2470ec[_0x1bd5('0x27')]]={'$like':'%'+_0xe54b9f[_0x1bd5('0x2f')]['filter']+'%'};return _0x4bbefc;}})});}_0x4e72b2=_[_0x1bd5('0x3c')]({},_0x4e72b2,_0xe54b9f[_0x1bd5('0x3f')]);var _0x20b25c={'where':_0x4e72b2['where']};return db[_0x1bd5('0x2a')][_0x1bd5('0x1d')](_0x20b25c)[_0x1bd5('0x40')](function(_0x4074f1){_0x472b22['count']=_0x4074f1;if(_0xe54b9f[_0x1bd5('0x2f')][_0x1bd5('0x41')]){_0x4e72b2[_0x1bd5('0x42')]=[{'all':!![]}];}return db[_0x1bd5('0x2a')]['findAll'](_0x4e72b2);})['then'](function(_0x40eeff){_0x472b22[_0x1bd5('0x43')]=_0x40eeff;return _0x472b22;})[_0x1bd5('0x40')](respondWithFilteredResult(_0xc73670,_0x4e72b2))['catch'](handleError(_0xc73670,null));};exports[_0x1bd5('0x44')]=function(_0x3b1092,_0x574d95){var _0x1eacac={'raw':!![],'where':{'id':_0x3b1092[_0x1bd5('0x45')]['id']}},_0x5761b8={};_0x5761b8[_0x1bd5('0x32')]=_['keys'](db[_0x1bd5('0x2a')][_0x1bd5('0x2b')]);_0x5761b8[_0x1bd5('0x2f')]=_[_0x1bd5('0x46')](_0x3b1092[_0x1bd5('0x2f')]);_0x5761b8[_0x1bd5('0x30')]=_[_0x1bd5('0x31')](_0x5761b8[_0x1bd5('0x32')],_0x5761b8[_0x1bd5('0x2f')]);_0x1eacac[_0x1bd5('0x33')]=_[_0x1bd5('0x31')](_0x5761b8[_0x1bd5('0x32')],qs['fields'](_0x3b1092[_0x1bd5('0x2f')][_0x1bd5('0x34')]));_0x1eacac[_0x1bd5('0x33')]=_0x1eacac['attributes'][_0x1bd5('0x47')]?_0x1eacac[_0x1bd5('0x33')]:_0x5761b8['model'];if(_0x3b1092[_0x1bd5('0x2f')]['includeAll']){_0x1eacac[_0x1bd5('0x42')]=[{'all':!![]}];}_0x1eacac=_['merge']({},_0x1eacac,_0x3b1092[_0x1bd5('0x3f')]);return db[_0x1bd5('0x2a')]['find'](_0x1eacac)[_0x1bd5('0x40')](handleEntityNotFound(_0x574d95,null))['then'](respondWithResult(_0x574d95,null))[_0x1bd5('0x48')](handleError(_0x574d95,null));};exports[_0x1bd5('0x49')]=function(_0x1a29f3,_0xe71454){return db[_0x1bd5('0x2a')][_0x1bd5('0x49')]()[_0x1bd5('0x40')](respondWithResult(_0xe71454,null))[_0x1bd5('0x48')](handleError(_0xe71454,null));};exports['update']=function(_0x13985e,_0x227a68){if(_0x13985e[_0x1bd5('0x4a')][_0x1bd5('0x4b')]){delete _0x13985e[_0x1bd5('0x4a')][_0x1bd5('0x4b')];}return db['CmHopperFinal'][_0x1bd5('0x4c')]({'where':{'uniqueid':_0x13985e[_0x1bd5('0x45')]['id']}})[_0x1bd5('0x40')](handleEntityNotFound(_0x227a68,null))[_0x1bd5('0x40')](saveUpdates(_0x13985e[_0x1bd5('0x4a')],null))[_0x1bd5('0x40')](respondWithResult(_0x227a68,null))[_0x1bd5('0x48')](handleError(_0x227a68,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x587c46,_0x126221,_0x2d713b){return db[_0x1bd5('0x2a')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x587c46[_0x1bd5('0x45')]['id']},'attributes':[[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x50')))),'noSuchContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')]['literal'](_0x1bd5('0x51')))),'noAnswerContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x52')))),_0x1bd5('0x53')],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db['sequelize'][_0x1bd5('0x4f')]('`state`\x20=\x208,\x201,\x20null'))),_0x1bd5('0x54')],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db['sequelize'][_0x1bd5('0x4f')](_0x1bd5('0x55')))),_0x1bd5('0x56')],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x57')))),_0x1bd5('0x58')],[db['sequelize']['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x59')))),'reCallContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db['sequelize'][_0x1bd5('0x4f')](_0x1bd5('0x5a')))),_0x1bd5('0x5b')]]})[_0x1bd5('0x40')](handleEntityNotFound(_0x126221,null))['then'](respondWithResult(_0x126221,null))['catch'](handleError(_0x126221,null));};exports[_0x1bd5('0x5c')]=function(_0xec9fac,_0x1790af,_0x54a8c4){return db['CmHopperFinal'][_0x1bd5('0x5d')]({'raw':![],'where':{'CampaignId':_0xec9fac['params']['id']},'attributes':[[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')]['literal'](_0x1bd5('0x50')))),'noSuchContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')]('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db['sequelize'][_0x1bd5('0x4f')](_0x1bd5('0x5e')))),'congestionContacts'],[db['sequelize']['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x55')))),'dropContacts'],[db[_0x1bd5('0x4d')]['fn']('COUNT',db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x57')))),'abandonedContacts'],[db['sequelize']['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x59')))),_0x1bd5('0x5f')],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x5a')))),_0x1bd5('0x5b')]]})[_0x1bd5('0x40')](handleEntityNotFound(_0x1790af,null))[_0x1bd5('0x40')](respondWithResult(_0x1790af,null))[_0x1bd5('0x48')](handleError(_0x1790af,null));};exports[_0x1bd5('0x60')]=function(_0x195176,_0x393a8f,_0x1ffbab){return db[_0x1bd5('0x61')][_0x1bd5('0x4c')]({'where':{'id':_0x195176[_0x1bd5('0x45')]['id']}})[_0x1bd5('0x40')](handleEntityNotFound(_0x393a8f,null))['then'](function(_0x3bd058){var _0x1d6223;if(_0x3bd058){_0x1d6223=squel[_0x1bd5('0x62')]()[_0x1bd5('0x63')](_0x1bd5('0x64'))[_0x1bd5('0x65')]([_0x1bd5('0x66'),'scheduledAt',_0x1bd5('0x67'),_0x1bd5('0x68'),_0x1bd5('0x69'),_0x1bd5('0x6a'),'updatedAt'],squel[_0x1bd5('0x6b')]()[_0x1bd5('0x6c')](_0x1bd5('0x6d'),_0x1bd5('0x66'))[_0x1bd5('0x6c')](_0x1bd5('0x6e'),_0x1bd5('0x6f'))['field'](_0x1bd5('0x70'),'ContactId')['field'](_0x1bd5('0x71'),'ListId')[_0x1bd5('0x6c')](_0x1bd5('0x72'),'VoiceQueueId')[_0x1bd5('0x6c')](_0x1bd5('0x6e'),_0x1bd5('0x6a'))[_0x1bd5('0x6c')](_0x1bd5('0x6e'),_0x1bd5('0x73'))['from'](_0x1bd5('0x74'))[_0x1bd5('0x39')](_0x1bd5('0x75'),_0x195176[_0x1bd5('0x45')]['id']['toString']())['where'](_0x1bd5('0x76'),_0x195176[_0x1bd5('0x4a')][_0x1bd5('0x77')][_0x1bd5('0x78')]())['where'](_0x1bd5('0x79'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x1bd5('0x6b')]()['field'](_0x1bd5('0x66'))[_0x1bd5('0x7a')](_0x1bd5('0x64'))[_0x1bd5('0x39')](_0x1bd5('0x75'),_0x195176[_0x1bd5('0x45')]['id'][_0x1bd5('0x78')]()))[_0x1bd5('0x39')](_0x1bd5('0x7b'),squel['select']()[_0x1bd5('0x6c')]('calleridnum')['from']('cm_hopper_final')[_0x1bd5('0x39')]('VoiceQueueId\x20=\x20?',_0x195176[_0x1bd5('0x45')]['id'][_0x1bd5('0x78')]())[_0x1bd5('0x39')](_0x1bd5('0x7c')))[_0x1bd5('0x7d')](_0x1bd5('0x67')))[_0x1bd5('0x78')]();return db['sequelize'][_0x1bd5('0x2f')](_0x1d6223);}return[];})['then'](respondWithResult(_0x393a8f,null))[_0x1bd5('0x48')](handleError(_0x393a8f,null));};exports[_0x1bd5('0x7e')]=function(_0x7d097,_0x50f2ac,_0x5db61c){return db[_0x1bd5('0x7f')]['find']({'where':{'id':_0x7d097[_0x1bd5('0x45')]['id']}})['then'](handleEntityNotFound(_0x50f2ac,null))[_0x1bd5('0x40')](function(_0x16f996){var _0x248d66;if(_0x16f996){_0x248d66=squel[_0x1bd5('0x62')]()[_0x1bd5('0x63')](_0x1bd5('0x64'))[_0x1bd5('0x65')]([_0x1bd5('0x66'),_0x1bd5('0x6f'),_0x1bd5('0x67'),_0x1bd5('0x68'),_0x1bd5('0x80'),_0x1bd5('0x6a'),_0x1bd5('0x73')],squel['select']()[_0x1bd5('0x6c')](_0x1bd5('0x6d'),_0x1bd5('0x66'))['field'](_0x1bd5('0x6e'),_0x1bd5('0x6f'))['field'](_0x1bd5('0x70'),_0x1bd5('0x67'))[_0x1bd5('0x6c')]('ANY_VALUE(ListId)',_0x1bd5('0x68'))[_0x1bd5('0x6c')](_0x1bd5('0x81'),_0x1bd5('0x80'))['field'](_0x1bd5('0x6e'),_0x1bd5('0x6a'))[_0x1bd5('0x6c')]('NOW()',_0x1bd5('0x73'))[_0x1bd5('0x7a')]('cm_hopper_final')['where'](_0x1bd5('0x82'),_0x7d097[_0x1bd5('0x45')]['id']['toString']())['where'](_0x1bd5('0x76'),_0x7d097['body']['state'][_0x1bd5('0x78')]())['where'](_0x1bd5('0x79'))[_0x1bd5('0x39')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x1bd5('0x6b')]()[_0x1bd5('0x6c')](_0x1bd5('0x66'))['from'](_0x1bd5('0x64'))['where'](_0x1bd5('0x82'),_0x7d097[_0x1bd5('0x45')]['id'][_0x1bd5('0x78')]()))[_0x1bd5('0x39')](_0x1bd5('0x7b'),squel['select']()[_0x1bd5('0x6c')]('calleridnum')[_0x1bd5('0x7a')]('cm_hopper_final')['where'](_0x1bd5('0x82'),_0x7d097[_0x1bd5('0x45')]['id'][_0x1bd5('0x78')]())[_0x1bd5('0x39')]('state\x20=\x204'))[_0x1bd5('0x7d')](_0x1bd5('0x67')))[_0x1bd5('0x78')]();return db[_0x1bd5('0x4d')][_0x1bd5('0x2f')](_0x248d66);}return[];})[_0x1bd5('0x40')](respondWithResult(_0x50f2ac,null))[_0x1bd5('0x48')](handleError(_0x50f2ac,null));};exports[_0x1bd5('0x83')]=function(_0x22e1f4,_0x347d06,_0x3cf023){return db[_0x1bd5('0x84')][_0x1bd5('0x85')]({'where':{'VoiceQueueId':_0x22e1f4[_0x1bd5('0x4a')]['VoiceQueueId'],'CampaignId':_0x22e1f4[_0x1bd5('0x4a')][_0x1bd5('0x80')],'ContactId':_0x22e1f4[_0x1bd5('0x4a')][_0x1bd5('0x67')]}})[_0x1bd5('0x40')](handleEntityNotFound(_0x347d06,null))[_0x1bd5('0x40')](function(_0x28f567){if(_0x28f567){return _0x28f567;}return null;})[_0x1bd5('0x40')](respondWithResult(_0x347d06,null))[_0x1bd5('0x48')](handleError(_0x347d06,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 2312836..cee627a 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 _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 +var _0x02db=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid'];(function(_0x3f74e6,_0x5d0b06){var _0x5d2fd2=function(_0x10bb97){while(--_0x10bb97){_0x3f74e6['push'](_0x3f74e6['shift']());}};_0x5d2fd2(++_0x5d0b06);}(_0x02db,0x1dc));var _0xb02d=function(_0x568ae4,_0xa2e52a){_0x568ae4=_0x568ae4-0x0;var _0x20c5ca=_0x02db[_0x568ae4];return _0x20c5ca;};'use strict';var _=require(_0xb02d('0x0'));var util=require(_0xb02d('0x1'));var logger=require(_0xb02d('0x2'))('api');var moment=require(_0xb02d('0x3'));var BPromise=require('bluebird');var rp=require(_0xb02d('0x4'));var fs=require('fs');var path=require(_0xb02d('0x5'));var rimraf=require(_0xb02d('0x6'));var config=require(_0xb02d('0x7'));var attributes=require(_0xb02d('0x8'));module[_0xb02d('0x9')]=function(_0x3f4df1,_0x472e2c){return _0x3f4df1[_0xb02d('0xa')]('CmHopperFinal',attributes,{'tableName':_0xb02d('0xb'),'paranoid':![],'indexes':[{'name':_0xb02d('0xc'),'fields':[_0xb02d('0xc')]},{'name':_0xb02d('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index aa7543f..a77973f 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(_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 +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(_0x308036,_0x50b87a){var _0xe62cfb=function(_0xd04046){while(--_0xd04046){_0x308036['push'](_0x308036['shift']());}};_0xe62cfb(++_0x50b87a);}(_0xb10b,0x12a));var _0xbb10=function(_0x32d1a9,_0x1b470c){_0x32d1a9=_0x32d1a9-0x0;var _0x50eaf1=_0xb10b[_0x32d1a9];return _0x50eaf1;};'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 e1bac1d..75825b5 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 _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 +var _0x36ff=['countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','/:id','/voice/queue/countAttributes/:id'];(function(_0x334888,_0xae285){var _0x1e60ba=function(_0xb4ad88){while(--_0xb4ad88){_0x334888['push'](_0x334888['shift']());}};_0x1e60ba(++_0xae285);}(_0x36ff,0xb8));var _0xf36f=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x36ff[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0xf36f('0x0'));var util=require(_0xf36f('0x1'));var path=require(_0xf36f('0x2'));var timeout=require(_0xf36f('0x3'));var express=require(_0xf36f('0x4'));var router=express[_0xf36f('0x5')]();var fs_extra=require(_0xf36f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf36f('0x7'));var config=require(_0xf36f('0x8'));var controller=require(_0xf36f('0x9'));router[_0xf36f('0xa')]('/',auth[_0xf36f('0xb')](),controller[_0xf36f('0xc')]);router[_0xf36f('0xa')](_0xf36f('0xd'),auth[_0xf36f('0xb')](),controller['describe']);router[_0xf36f('0xa')](_0xf36f('0xe'),auth[_0xf36f('0xb')](),controller['show']);router[_0xf36f('0xa')](_0xf36f('0xf'),auth[_0xf36f('0xb')](),controller['countContactsQueueCampaignHopperFinal']);router[_0xf36f('0xa')]('/campaign/countAttributes/:id',auth['isAuthenticated'](),controller[_0xf36f('0x10')]);router['post'](_0xf36f('0x11'),auth['isAuthenticated'](),controller[_0xf36f('0x12')]);router[_0xf36f('0x13')](_0xf36f('0x14'),auth[_0xf36f('0xb')](),controller[_0xf36f('0x15')]);router[_0xf36f('0x13')](_0xf36f('0x16'),auth[_0xf36f('0xb')](),controller[_0xf36f('0x17')]);router['put'](_0xf36f('0xe'),auth[_0xf36f('0xb')](),controller[_0xf36f('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 946f452..3314f8f 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 _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 +var _0xe321=['INTEGER','STRING','DATE','BOOLEAN','exports'];(function(_0x191890,_0xe7979f){var _0x3d8b48=function(_0x294c37){while(--_0x294c37){_0x191890['push'](_0x191890['shift']());}};_0x3d8b48(++_0xe7979f);}(_0xe321,0x194));var _0x1e32=function(_0x4a9bdd,_0x5098f5){_0x4a9bdd=_0x4a9bdd-0x0;var _0x1ba3a4=_0xe321[_0x4a9bdd];return _0x1ba3a4;};'use strict';var Sequelize=require('sequelize');module[_0x1e32('0x0')]={'state':{'type':Sequelize[_0x1e32('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x1e32('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1e32('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x1e32('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x1e32('0x2')]},'originatecalleridname':{'type':Sequelize[_0x1e32('0x2')]},'calleridnum':{'type':Sequelize[_0x1e32('0x2')]},'calleridname':{'type':Sequelize[_0x1e32('0x2')]},'starttime':{'type':Sequelize[_0x1e32('0x3')]},'responsetime':{'type':Sequelize[_0x1e32('0x3')]},'answertime':{'type':Sequelize[_0x1e32('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x1e32('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1e32('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1e32('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x1e32('0x2')]},'campaigntype':{'type':Sequelize[_0x1e32('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x1e32('0x2')]},'amd':{'type':Sequelize[_0x1e32('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x1e32('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x1e32('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1e32('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x1e32('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x1e32('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1e32('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1e32('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1e32('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x1e32('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index ee6dc51..0893087 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 _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 +var _0x5594=['limit','count','apply','reject','update','then','destroy','end','error','stack','name','send','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','params','find','create','body','catch','describe','uniqueid','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x5594,0xb8));var _0x4559=function(_0x2b4c7f,_0xd3a731){_0x2b4c7f=_0x2b4c7f-0x0;var _0xaa17cd=_0x5594[_0x2b4c7f];return _0xaa17cd;};'use strict';var emlformat=require(_0x4559('0x0'));var rimraf=require(_0x4559('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4559('0x2'));var rp=require('request-promise');var moment=require(_0x4559('0x3'));var BPromise=require(_0x4559('0x4'));var Mustache=require(_0x4559('0x5'));var util=require(_0x4559('0x6'));var path=require(_0x4559('0x7'));var sox=require('sox');var csv=require(_0x4559('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4559('0x9'));var _=require('lodash');var squel=require(_0x4559('0xa'));var crypto=require(_0x4559('0xb'));var jsforce=require(_0x4559('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4559('0x8'));var querystring=require(_0x4559('0xd'));var Papa=require(_0x4559('0xe'));var Redis=require(_0x4559('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4559('0x10'));var as=require(_0x4559('0x11'));var hardwareService=require(_0x4559('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x4559('0x13'));var config=require(_0x4559('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4559('0x15'))['db'];function respondWithStatusCode(_0x398fc1,_0x2ba371){_0x2ba371=_0x2ba371||0xcc;return function(_0xbf99a4){if(_0xbf99a4){return _0x398fc1[_0x4559('0x16')](_0x2ba371);}return _0x398fc1[_0x4559('0x17')](_0x2ba371)['end']();};}function respondWithResult(_0x18ba3b,_0x208e4b){_0x208e4b=_0x208e4b||0xc8;return function(_0x592212){if(_0x592212){return _0x18ba3b[_0x4559('0x17')](_0x208e4b)[_0x4559('0x18')](_0x592212);}};}function respondWithFilteredResult(_0x490876,_0x5a90e3){return function(_0x37deed){if(_0x37deed){var _0x4228b2=typeof _0x5a90e3[_0x4559('0x19')]==='undefined'&&typeof _0x5a90e3[_0x4559('0x1a')]==='undefined';var _0xe8018f=_0x37deed[_0x4559('0x1b')];var _0x21b1b2=_0x4228b2?0x0:_0x5a90e3['offset'];var _0x41080a=_0x4228b2?_0x37deed['count']:_0x5a90e3[_0x4559('0x19')]+_0x5a90e3['limit'];var _0x50d47d;if(_0x41080a>=_0xe8018f){_0x41080a=_0xe8018f;_0x50d47d=0xc8;}else{_0x50d47d=0xce;}_0x490876[_0x4559('0x17')](_0x50d47d);return _0x490876['set']('Content-Range',_0x21b1b2+'-'+_0x41080a+'/'+_0xe8018f)['json'](_0x37deed);}return null;};}function patchUpdates(_0xf91d18){return function(_0x7bae1){try{jsonpatch[_0x4559('0x1c')](_0x7bae1,_0xf91d18,!![]);}catch(_0x37b84e){return BPromise[_0x4559('0x1d')](_0x37b84e);}return _0x7bae1['save']();};}function saveUpdates(_0x518690,_0x2e702e){return function(_0x41061b){if(_0x41061b){return _0x41061b[_0x4559('0x1e')](_0x518690)[_0x4559('0x1f')](function(_0x404e13){return _0x404e13;});}return null;};}function removeEntity(_0x2da31d,_0x56304b){return function(_0x3998ab){if(_0x3998ab){return _0x3998ab[_0x4559('0x20')]()[_0x4559('0x1f')](function(){_0x2da31d[_0x4559('0x17')](0xcc)[_0x4559('0x21')]();});}};}function handleEntityNotFound(_0x12f763,_0x109a2e){return function(_0x1aa585){if(!_0x1aa585){_0x12f763['sendStatus'](0x194);}return _0x1aa585;};}function handleError(_0x5299e7,_0x8306c4){_0x8306c4=_0x8306c4||0x1f4;return function(_0x141fc2){logger[_0x4559('0x22')](_0x141fc2[_0x4559('0x23')]);if(_0x141fc2[_0x4559('0x24')]){delete _0x141fc2[_0x4559('0x24')];}_0x5299e7[_0x4559('0x17')](_0x8306c4)[_0x4559('0x25')](_0x141fc2);};}exports['index']=function(_0x4d7ae8,_0x1324f3){var _0x2e31c3={},_0x316d26={},_0x54c30a={'count':0x0,'rows':[]};var _0xf60d5b=_[_0x4559('0x26')](db[_0x4559('0x27')][_0x4559('0x28')],function(_0x17e94d){return{'name':_0x17e94d[_0x4559('0x29')],'type':_0x17e94d[_0x4559('0x2a')][_0x4559('0x2b')]};});_0x316d26[_0x4559('0x2c')]=_[_0x4559('0x26')](_0xf60d5b,_0x4559('0x24'));_0x316d26[_0x4559('0x2d')]=_[_0x4559('0x2e')](_0x4d7ae8['query']);_0x316d26[_0x4559('0x2f')]=_[_0x4559('0x30')](_0x316d26[_0x4559('0x2c')],_0x316d26[_0x4559('0x2d')]);_0x2e31c3[_0x4559('0x31')]=_[_0x4559('0x30')](_0x316d26[_0x4559('0x2c')],qs[_0x4559('0x32')](_0x4d7ae8[_0x4559('0x2d')][_0x4559('0x32')]));_0x2e31c3[_0x4559('0x31')]=_0x2e31c3[_0x4559('0x31')][_0x4559('0x33')]?_0x2e31c3[_0x4559('0x31')]:_0x316d26[_0x4559('0x2c')];if(!_0x4d7ae8[_0x4559('0x2d')]['hasOwnProperty'](_0x4559('0x34'))){_0x2e31c3['limit']=qs['limit'](_0x4d7ae8[_0x4559('0x2d')]['limit']);_0x2e31c3['offset']=qs[_0x4559('0x19')](_0x4d7ae8[_0x4559('0x2d')][_0x4559('0x19')]);}_0x2e31c3[_0x4559('0x35')]=qs[_0x4559('0x36')](_0x4d7ae8[_0x4559('0x2d')][_0x4559('0x36')]);_0x2e31c3[_0x4559('0x37')]=qs[_0x4559('0x2f')](_[_0x4559('0x38')](_0x4d7ae8[_0x4559('0x2d')],_0x316d26[_0x4559('0x2f')]),_0xf60d5b);if(_0x4d7ae8['query']['filter']){_0x2e31c3[_0x4559('0x37')]=_[_0x4559('0x39')](_0x2e31c3[_0x4559('0x37')],{'$or':_['map'](_0xf60d5b,function(_0x49723d){if(_0x49723d[_0x4559('0x2a')]!==_0x4559('0x3a')){var _0x3691a4={};_0x3691a4[_0x49723d[_0x4559('0x24')]]={'$like':'%'+_0x4d7ae8[_0x4559('0x2d')]['filter']+'%'};return _0x3691a4;}})});}_0x2e31c3=_['merge']({},_0x2e31c3,_0x4d7ae8[_0x4559('0x3b')]);var _0x334c93={'where':_0x2e31c3[_0x4559('0x37')]};return db[_0x4559('0x27')]['count'](_0x334c93)[_0x4559('0x1f')](function(_0x25ff34){_0x54c30a[_0x4559('0x1b')]=_0x25ff34;if(_0x4d7ae8[_0x4559('0x2d')][_0x4559('0x3c')]){_0x2e31c3[_0x4559('0x3d')]=[{'all':!![]}];}return db[_0x4559('0x27')][_0x4559('0x3e')](_0x2e31c3);})[_0x4559('0x1f')](function(_0x2dfa0a){_0x54c30a['rows']=_0x2dfa0a;return _0x54c30a;})[_0x4559('0x1f')](respondWithFilteredResult(_0x1324f3,_0x2e31c3))['catch'](handleError(_0x1324f3,null));};exports['show']=function(_0x1eaac6,_0x228f56){var _0x59790a={'raw':!![],'where':{'id':_0x1eaac6[_0x4559('0x3f')]['id']}},_0x5e6c05={};_0x5e6c05[_0x4559('0x2c')]=_['keys'](db[_0x4559('0x27')]['rawAttributes']);_0x5e6c05[_0x4559('0x2d')]=_[_0x4559('0x2e')](_0x1eaac6[_0x4559('0x2d')]);_0x5e6c05[_0x4559('0x2f')]=_['intersection'](_0x5e6c05[_0x4559('0x2c')],_0x5e6c05[_0x4559('0x2d')]);_0x59790a[_0x4559('0x31')]=_['intersection'](_0x5e6c05[_0x4559('0x2c')],qs[_0x4559('0x32')](_0x1eaac6['query']['fields']));_0x59790a[_0x4559('0x31')]=_0x59790a[_0x4559('0x31')]['length']?_0x59790a[_0x4559('0x31')]:_0x5e6c05[_0x4559('0x2c')];if(_0x1eaac6[_0x4559('0x2d')]['includeAll']){_0x59790a[_0x4559('0x3d')]=[{'all':!![]}];}_0x59790a=_[_0x4559('0x39')]({},_0x59790a,_0x1eaac6[_0x4559('0x3b')]);return db['CmHopperHistory'][_0x4559('0x40')](_0x59790a)['then'](handleEntityNotFound(_0x228f56,null))[_0x4559('0x1f')](respondWithResult(_0x228f56,null))['catch'](handleError(_0x228f56,null));};exports['create']=function(_0x58746a,_0x5e8837){return db['CmHopperHistory'][_0x4559('0x41')](_0x58746a[_0x4559('0x42')],{})[_0x4559('0x1f')](respondWithResult(_0x5e8837,0xc9))[_0x4559('0x43')](handleError(_0x5e8837,null));};exports[_0x4559('0x44')]=function(_0x11cc24,_0x3a9700){return db['CmHopperHistory'][_0x4559('0x44')]()[_0x4559('0x1f')](respondWithResult(_0x3a9700,null))[_0x4559('0x43')](handleError(_0x3a9700,null));};exports['update']=function(_0x1ffd9d,_0x21588b){if(_0x1ffd9d[_0x4559('0x42')][_0x4559('0x45')]){delete _0x1ffd9d[_0x4559('0x42')][_0x4559('0x45')];}return db[_0x4559('0x27')][_0x4559('0x40')]({'where':{'uniqueid':_0x1ffd9d[_0x4559('0x3f')]['id']}})[_0x4559('0x1f')](handleEntityNotFound(_0x21588b,null))[_0x4559('0x1f')](saveUpdates(_0x1ffd9d['body'],null))[_0x4559('0x1f')](respondWithResult(_0x21588b,null))[_0x4559('0x43')](handleError(_0x21588b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index fea7310..dd71ef5 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 _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 +var _0xc113=['path','rimraf','./cmHopperHistory.attributes','exports','define','CmHopperHistory','endtime','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0xc113,0x1ab));var _0x3c11=function(_0xc6c10,_0x4d5df5){_0xc6c10=_0xc6c10-0x0;var _0x4ed900=_0xc113[_0xc6c10];return _0x4ed900;};'use strict';var _=require(_0x3c11('0x0'));var util=require(_0x3c11('0x1'));var logger=require(_0x3c11('0x2'))(_0x3c11('0x3'));var moment=require(_0x3c11('0x4'));var BPromise=require(_0x3c11('0x5'));var rp=require(_0x3c11('0x6'));var fs=require('fs');var path=require(_0x3c11('0x7'));var rimraf=require(_0x3c11('0x8'));var config=require('../../config/environment');var attributes=require(_0x3c11('0x9'));module[_0x3c11('0xa')]=function(_0x595e66,_0x3dd753){return _0x595e66[_0x3c11('0xb')](_0x3c11('0xc'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x3c11('0xd'),'fields':['endtime']},{'name':'uniqueid','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 25b9159..9b0010d 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 _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 +var _0x7aad=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','stringify','AvgHandleTime','findAll','COUNT','sequelize','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','then','GetVoiceQueueHopperHistory','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','moment','bluebird'];(function(_0x111517,_0x5e9886){var _0x48236f=function(_0x23a151){while(--_0x23a151){_0x111517['push'](_0x111517['shift']());}};_0x48236f(++_0x5e9886);}(_0x7aad,0x160));var _0xd7aa=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x7aad[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0xd7aa('0x0'));var util=require('util');var moment=require(_0xd7aa('0x1'));var BPromise=require(_0xd7aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd7aa('0x3'));var db=require(_0xd7aa('0x4'))['db'];var utils=require(_0xd7aa('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xd7aa('0x6'));var jayson=require(_0xd7aa('0x7'));var client=jayson[_0xd7aa('0x8')][_0xd7aa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4df120,_0x59023c,_0x2613dd){return new BPromise(function(_0x4bc884,_0x1e4dea){return client[_0xd7aa('0xa')](_0x4df120,_0x2613dd)['then'](function(_0x31d416){logger[_0xd7aa('0xb')](_0xd7aa('0xc'),_0x59023c,_0xd7aa('0xd'));logger[_0xd7aa('0xe')](_0xd7aa('0xf'),_0x59023c,'request\x20sent',JSON['stringify'](_0x31d416));if(_0x31d416[_0xd7aa('0x10')]){if(_0x31d416[_0xd7aa('0x10')][_0xd7aa('0x11')]===0x1f4){logger[_0xd7aa('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x59023c,_0x31d416[_0xd7aa('0x10')][_0xd7aa('0x12')]);return _0x1e4dea(_0x31d416[_0xd7aa('0x10')][_0xd7aa('0x12')]);}logger[_0xd7aa('0x10')](_0xd7aa('0xc'),_0x59023c,_0x31d416['error'][_0xd7aa('0x12')]);return _0x4bc884(_0x31d416[_0xd7aa('0x10')][_0xd7aa('0x12')]);}else{logger[_0xd7aa('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x59023c,_0xd7aa('0xd'));_0x4bc884(_0x31d416[_0xd7aa('0x13')][_0xd7aa('0x12')]);}})[_0xd7aa('0x14')](function(_0x3b23b7){logger[_0xd7aa('0x10')](_0xd7aa('0xc'),_0x59023c,_0x3b23b7);_0x1e4dea(_0x3b23b7);});});}exports[_0xd7aa('0x15')]=function(_0xf43135){var _0x34a232=this;return new Promise(function(_0x4d842,_0x5300b5){return db[_0xd7aa('0x16')][_0xd7aa('0x17')](_0xf43135[_0xd7aa('0x18')],{'raw':_0xf43135[_0xd7aa('0x19')]?_0xf43135[_0xd7aa('0x19')][_0xd7aa('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5825a6){logger[_0xd7aa('0xb')]('CreateCmHopperHistory',_0xf43135);logger[_0xd7aa('0xe')](_0xd7aa('0x15'),_0xf43135,JSON[_0xd7aa('0x1b')](_0x5825a6));_0x4d842(_0x5825a6);})[_0xd7aa('0x14')](function(_0x3ff6e5){logger[_0xd7aa('0x10')]('CreateCmHopperHistory',_0x3ff6e5[_0xd7aa('0x12')],_0xf43135);_0x5300b5(_0x34a232[_0xd7aa('0x10')](0x1f4,_0x3ff6e5[_0xd7aa('0x12')]));});});};exports[_0xd7aa('0x1c')]=function(_0x5afc21){var _0x25f575=this;return new Promise(function(_0x11d594,_0x350fa6){return db[_0xd7aa('0x16')][_0xd7aa('0x1d')]({'raw':_0x5afc21[_0xd7aa('0x19')]?_0x5afc21[_0xd7aa('0x19')][_0xd7aa('0x1a')]===undefined?!![]:![]:!![],'where':_0x5afc21[_0xd7aa('0x19')]?_0x5afc21[_0xd7aa('0x19')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xd7aa('0x1e'),db[_0xd7aa('0x1f')][_0xd7aa('0x20')]('id')),'predictiveIntervalTotalCalls'],[db[_0xd7aa('0x1f')]['fn'](_0xd7aa('0x1e'),db[_0xd7aa('0x1f')]['fn']('IF',db[_0xd7aa('0x1f')][_0xd7aa('0x21')](_0xd7aa('0x22')))),_0xd7aa('0x23')],[db[_0xd7aa('0x1f')]['fn'](_0xd7aa('0x1e'),db[_0xd7aa('0x1f')]['fn']('IF',db[_0xd7aa('0x1f')][_0xd7aa('0x21')](_0xd7aa('0x24')))),_0xd7aa('0x25')],[db[_0xd7aa('0x1f')]['fn'](_0xd7aa('0x1e'),db[_0xd7aa('0x1f')]['fn']('IF',db[_0xd7aa('0x1f')]['literal']('`state`\x20=\x2011,\x201,\x20null'))),_0xd7aa('0x26')],[db[_0xd7aa('0x1f')]['fn']('AVG',db[_0xd7aa('0x1f')]['fn']('IF',db[_0xd7aa('0x1f')][_0xd7aa('0x21')](_0xd7aa('0x27')))),_0xd7aa('0x28')],[db[_0xd7aa('0x1f')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0xd7aa('0x1f')][_0xd7aa('0x21')](_0xd7aa('0x29')))),_0xd7aa('0x2a')]]})[_0xd7aa('0x2b')](function(_0x1e0dc6){logger[_0xd7aa('0xb')](_0xd7aa('0x1c'),_0x5afc21);logger['debug']('AvgHandleTime',_0x5afc21,JSON[_0xd7aa('0x1b')](_0x1e0dc6));_0x11d594(_0x1e0dc6);})[_0xd7aa('0x14')](function(_0x3d30c1){logger[_0xd7aa('0x10')](_0xd7aa('0x1c'),_0x3d30c1[_0xd7aa('0x12')],_0x5afc21);_0x350fa6(_0x25f575[_0xd7aa('0x10')](0x1f4,_0x3d30c1['message']));});});};exports[_0xd7aa('0x2c')]=function(_0x2a44a5){var _0x47135e=this;return new Promise(function(_0x3941c6,_0x58bdfa){return db[_0xd7aa('0x16')][_0xd7aa('0x1d')]({'raw':_0x2a44a5[_0xd7aa('0x19')]?_0x2a44a5['options'][_0xd7aa('0x1a')]===undefined?!![]:![]:!![],'where':_0x2a44a5[_0xd7aa('0x19')]?_0x2a44a5['options'][_0xd7aa('0x2d')]||null:null,'attributes':[[_0xd7aa('0x2e'),_0xd7aa('0x2f')],[db['sequelize']['fn'](_0xd7aa('0x1e'),db[_0xd7aa('0x1f')]['fn']('IF',db[_0xd7aa('0x1f')][_0xd7aa('0x21')](_0xd7aa('0x30')))),'outboundNoSuchCallsDay'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xd7aa('0x1f')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0xd7aa('0x31')],[db[_0xd7aa('0x1f')]['fn']('COUNT',db[_0xd7aa('0x1f')]['fn']('IF',db[_0xd7aa('0x1f')][_0xd7aa('0x21')](_0xd7aa('0x22')))),_0xd7aa('0x32')],[db[_0xd7aa('0x1f')]['fn']('COUNT',db[_0xd7aa('0x1f')]['fn']('IF',db[_0xd7aa('0x1f')][_0xd7aa('0x21')](_0xd7aa('0x33')))),'outboundBusyCallsDay'],[db['sequelize']['fn']('COUNT',db[_0xd7aa('0x1f')]['fn']('IF',db['sequelize'][_0xd7aa('0x21')](_0xd7aa('0x34')))),_0xd7aa('0x35')],[db['sequelize']['fn'](_0xd7aa('0x1e'),db[_0xd7aa('0x1f')]['fn']('IF',db[_0xd7aa('0x1f')]['literal'](_0xd7aa('0x36')))),_0xd7aa('0x37')],[db[_0xd7aa('0x1f')]['fn'](_0xd7aa('0x1e'),db[_0xd7aa('0x1f')]['fn']('IF',db[_0xd7aa('0x1f')][_0xd7aa('0x21')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'outboundDropCallsDayCallersExit'],[db[_0xd7aa('0x1f')]['fn']('COUNT',db[_0xd7aa('0x1f')]['fn']('IF',db[_0xd7aa('0x1f')][_0xd7aa('0x21')](_0xd7aa('0x38')))),_0xd7aa('0x39')],[db['sequelize']['fn']('COUNT',db[_0xd7aa('0x1f')]['fn']('IF',db['sequelize'][_0xd7aa('0x21')](_0xd7aa('0x3a')))),'outboundBlacklistCallsDay'],[db[_0xd7aa('0x1f')]['fn']('COUNT',db[_0xd7aa('0x1f')]['fn']('IF',db[_0xd7aa('0x1f')][_0xd7aa('0x21')](_0xd7aa('0x3b')))),_0xd7aa('0x3c')],[db[_0xd7aa('0x1f')]['fn'](_0xd7aa('0x1e'),db[_0xd7aa('0x1f')]['fn']('IF',db[_0xd7aa('0x1f')][_0xd7aa('0x21')](_0xd7aa('0x3d')))),_0xd7aa('0x3e')],[db[_0xd7aa('0x1f')]['fn'](_0xd7aa('0x1e'),db['sequelize']['fn']('IF',db[_0xd7aa('0x1f')][_0xd7aa('0x21')](_0xd7aa('0x3f')))),_0xd7aa('0x40')],[db[_0xd7aa('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xd7aa('0x1f')]['literal'](_0xd7aa('0x41')))),_0xd7aa('0x3e')],[db['sequelize']['fn'](_0xd7aa('0x1e'),db['sequelize']['fn']('IF',db[_0xd7aa('0x1f')]['literal'](_0xd7aa('0x42')))),_0xd7aa('0x43')]],'group':['campaign']})['then'](function(_0x5f01e7){logger['info']('GetVoiceQueueHopperHistory',_0x2a44a5);logger['debug'](_0xd7aa('0x2c'),_0x2a44a5,JSON[_0xd7aa('0x1b')](_0x5f01e7));_0x3941c6(_0x5f01e7);})[_0xd7aa('0x14')](function(_0x3e61cf){logger[_0xd7aa('0x10')]('GetVoiceQueueHopperHistory',_0x3e61cf[_0xd7aa('0x12')],_0x2a44a5);_0x58bdfa(_0x47135e['error'](0x1f4,_0x3e61cf[_0xd7aa('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0x1f186c){var _0x3e9465=this;return new Promise(function(_0x4bec5e,_0x56037a){return db[_0xd7aa('0x16')]['findAll']({'raw':_0x1f186c['options']?_0x1f186c[_0xd7aa('0x19')][_0xd7aa('0x1a')]===undefined?!![]:![]:!![],'where':_0x1f186c['options']?_0x1f186c[_0xd7aa('0x19')][_0xd7aa('0x2d')]||null:null,'attributes':[[_0xd7aa('0x2e'),_0xd7aa('0x2f')],[db[_0xd7aa('0x1f')]['fn'](_0xd7aa('0x1e'),db[_0xd7aa('0x1f')][_0xd7aa('0x20')]('id')),_0xd7aa('0x44')],[db['sequelize']['fn']('COUNT',db[_0xd7aa('0x1f')]['fn']('IF',db['sequelize']['literal'](_0xd7aa('0x22')))),_0xd7aa('0x45')]],'group':[_0xd7aa('0x2e')]})['then'](function(_0x284ce9){logger['info']('GetCampaignHopperHistory',_0x1f186c);logger[_0xd7aa('0xe')](_0xd7aa('0x46'),_0x1f186c,JSON[_0xd7aa('0x1b')](_0x284ce9));_0x4bec5e(_0x284ce9);})['catch'](function(_0x47dbb6){logger[_0xd7aa('0x10')](_0xd7aa('0x46'),_0x47dbb6[_0xd7aa('0x12')],_0x1f186c);_0x56037a(_0x3e9465[_0xd7aa('0x10')](0x1f4,_0x47dbb6[_0xd7aa('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 9fef957..39bead3 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 _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 +var _0x8b19=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','show','post','isAuthenticated','create','put','update','exports','multer'];(function(_0x18c9d8,_0x1e1a31){var _0x49a2ec=function(_0x46f889){while(--_0x46f889){_0x18c9d8['push'](_0x18c9d8['shift']());}};_0x49a2ec(++_0x1e1a31);}(_0x8b19,0x155));var _0x98b1=function(_0xceb1ce,_0x542e89){_0xceb1ce=_0xceb1ce-0x0;var _0x2a7d2a=_0x8b19[_0xceb1ce];return _0x2a7d2a;};'use strict';var multer=require(_0x98b1('0x0'));var util=require('util');var path=require(_0x98b1('0x1'));var timeout=require(_0x98b1('0x2'));var express=require(_0x98b1('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x98b1('0x4'));var interaction=require(_0x98b1('0x5'));var config=require(_0x98b1('0x6'));var controller=require('./cmHopperHistory.controller');router[_0x98b1('0x7')]('/',auth['isAuthenticated'](),controller[_0x98b1('0x8')]);router['get'](_0x98b1('0x9'),auth['isAuthenticated'](),controller[_0x98b1('0xa')]);router[_0x98b1('0x7')](_0x98b1('0xb'),auth['isAuthenticated'](),controller[_0x98b1('0xc')]);router[_0x98b1('0xd')]('/',auth[_0x98b1('0xe')](),controller[_0x98b1('0xf')]);router[_0x98b1('0x10')](_0x98b1('0xb'),auth[_0x98b1('0xe')](),controller[_0x98b1('0x11')]);module[_0x98b1('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 bebed53..b70dbdf 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 _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 +var _0xec46=['sequelize','exports','STRING','name'];(function(_0x42f94b,_0x383b68){var _0x39ff1f=function(_0x330755){while(--_0x330755){_0x42f94b['push'](_0x42f94b['shift']());}};_0x39ff1f(++_0x383b68);}(_0xec46,0x19c));var _0x6ec4=function(_0x3ed26c,_0xab6b81){_0x3ed26c=_0x3ed26c-0x0;var _0x20074a=_0xec46[_0x3ed26c];return _0x20074a;};'use strict';var Sequelize=require(_0x6ec4('0x0'));module[_0x6ec4('0x1')]={'name':{'type':Sequelize[_0x6ec4('0x2')],'unique':_0x6ec4('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 47e8ce3..1629b7e 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 _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 +var _0x068a=['item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','toString','isEmpty','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','transaction','addCustomFields','type','Sequelize','number','switch','defaultValue','queryInterface','cf_%s','getCustomFields','findOne','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','userCmList:remove','User','getAgents','info','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','name','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','CmList','includeAll','include','rows','catch','params','find','create','body','role','error','describe','ListId','pick','Disposition','findAll','removeDispositions','ids','tags','isArray','join','push','each','CmContact','omit','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','from','cm_contacts','c.deletedAt\x20is\x20null','distinct','field','c.cf_','alias','select'];(function(_0x474489,_0x460f1f){var _0x37f52f=function(_0x83f753){while(--_0x83f753){_0x474489['push'](_0x474489['shift']());}};_0x37f52f(++_0x460f1f);}(_0x068a,0x15c));var _0xa068=function(_0x1a8f3f,_0x1f452e){_0x1a8f3f=_0x1a8f3f-0x0;var _0x5f41eb=_0x068a[_0x1a8f3f];return _0x5f41eb;};'use strict';var emlformat=require(_0xa068('0x0'));var rimraf=require(_0xa068('0x1'));var zipdir=require(_0xa068('0x2'));var jsonpatch=require(_0xa068('0x3'));var rp=require(_0xa068('0x4'));var moment=require('moment');var BPromise=require(_0xa068('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa068('0x6'));var fs=require('fs');var fs_extra=require(_0xa068('0x7'));var _=require(_0xa068('0x8'));var squel=require(_0xa068('0x9'));var crypto=require('crypto');var jsforce=require(_0xa068('0xa'));var deskjs=require(_0xa068('0xb'));var toCsv=require(_0xa068('0xc'));var querystring=require(_0xa068('0xd'));var Papa=require('papaparse');var Redis=require(_0xa068('0xe'));var authService=require(_0xa068('0xf'));var qs=require(_0xa068('0x10'));var as=require(_0xa068('0x11'));var hardwareService=require(_0xa068('0x12'));var logger=require(_0xa068('0x13'))(_0xa068('0x14'));var utils=require(_0xa068('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa068('0x16'));var db=require('../../mysqldb')['db'];var csv_results;config[_0xa068('0x17')]=_[_0xa068('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa068('0x19'))(new Redis(config[_0xa068('0x17')]));require('./cmList.socket')['register'](socket);function respondWithStatusCode(_0x398e14,_0x17e9ab){_0x17e9ab=_0x17e9ab||0xcc;return function(_0x3ef799){if(_0x3ef799){return _0x398e14[_0xa068('0x1a')](_0x17e9ab);}return _0x398e14[_0xa068('0x1b')](_0x17e9ab)[_0xa068('0x1c')]();};}function respondWithResult(_0x39dc86,_0x144062){_0x144062=_0x144062||0xc8;return function(_0x3aceb9){if(_0x3aceb9){return _0x39dc86[_0xa068('0x1b')](_0x144062)[_0xa068('0x1d')](_0x3aceb9);}};}function respondWithFilteredResult(_0x201e55,_0xd19a5e){return function(_0x172de5){if(_0x172de5){var _0xffd32=typeof _0xd19a5e['offset']===_0xa068('0x1e')&&typeof _0xd19a5e['limit']===_0xa068('0x1e');var _0x1d7eb7=_0x172de5[_0xa068('0x1f')];var _0x87ffe5=_0xffd32?0x0:_0xd19a5e[_0xa068('0x20')];var _0x2a7441=_0xffd32?_0x172de5['count']:_0xd19a5e[_0xa068('0x20')]+_0xd19a5e[_0xa068('0x21')];var _0x170a32;if(_0x2a7441>=_0x1d7eb7){_0x2a7441=_0x1d7eb7;_0x170a32=0xc8;}else{_0x170a32=0xce;}_0x201e55[_0xa068('0x1b')](_0x170a32);return _0x201e55[_0xa068('0x22')](_0xa068('0x23'),_0x87ffe5+'-'+_0x2a7441+'/'+_0x1d7eb7)[_0xa068('0x1d')](_0x172de5);}return null;};}function patchUpdates(_0x222dda){return function(_0x249014){try{jsonpatch[_0xa068('0x24')](_0x249014,_0x222dda,!![]);}catch(_0x4c8c46){return BPromise[_0xa068('0x25')](_0x4c8c46);}return _0x249014[_0xa068('0x26')]();};}function saveUpdates(_0x47bab1,_0x583649){return function(_0x3f536c){if(_0x3f536c){return _0x3f536c[_0xa068('0x27')](_0x47bab1)[_0xa068('0x28')](function(_0x1459b6){return _0x1459b6;});}return null;};}function removeEntity(_0x10e16c,_0x513172){return function(_0x41b52c){if(_0x41b52c){return _0x41b52c[_0xa068('0x29')]()[_0xa068('0x28')](function(){var _0x4dacff=_0x41b52c[_0xa068('0x2a')]({'plain':!![]});var _0x152a32='Lists';return db[_0xa068('0x2b')][_0xa068('0x29')]({'where':{'type':_0x152a32,'resourceId':_0x4dacff['id']}})[_0xa068('0x28')](function(){return _0x41b52c;});})[_0xa068('0x28')](function(){_0x10e16c[_0xa068('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38aef1,_0x1c1da5){return function(_0x27a2fd){if(!_0x27a2fd){_0x38aef1[_0xa068('0x1a')](0x194);}return _0x27a2fd;};}function handleError(_0x1041a9,_0x593a0e){_0x593a0e=_0x593a0e||0x1f4;return function(_0x10ea14){logger['error'](_0x10ea14['stack']);if(_0x10ea14[_0xa068('0x2c')]){delete _0x10ea14[_0xa068('0x2c')];}_0x1041a9[_0xa068('0x1b')](_0x593a0e)['send'](_0x10ea14);};}exports[_0xa068('0x2d')]=function(_0x715d42,_0x48b49c){var _0xe6a519={},_0x887b37={},_0x2e4aa7={'count':0x0,'rows':[]};var _0x4b5de6=_['map'](db['CmList'][_0xa068('0x2e')],function(_0x269831){return{'name':_0x269831[_0xa068('0x2f')],'type':_0x269831['type'][_0xa068('0x30')]};});_0x887b37[_0xa068('0x31')]=_[_0xa068('0x32')](_0x4b5de6,'name');_0x887b37[_0xa068('0x33')]=_[_0xa068('0x34')](_0x715d42[_0xa068('0x33')]);_0x887b37[_0xa068('0x35')]=_[_0xa068('0x36')](_0x887b37[_0xa068('0x31')],_0x887b37[_0xa068('0x33')]);_0xe6a519[_0xa068('0x37')]=_[_0xa068('0x36')](_0x887b37['model'],qs['fields'](_0x715d42[_0xa068('0x33')][_0xa068('0x38')]));_0xe6a519['attributes']=_0xe6a519[_0xa068('0x37')][_0xa068('0x39')]?_0xe6a519['attributes']:_0x887b37[_0xa068('0x31')];if(!_0x715d42[_0xa068('0x33')][_0xa068('0x3a')](_0xa068('0x3b'))){_0xe6a519[_0xa068('0x21')]=qs[_0xa068('0x21')](_0x715d42['query']['limit']);_0xe6a519[_0xa068('0x20')]=qs['offset'](_0x715d42[_0xa068('0x33')]['offset']);}_0xe6a519[_0xa068('0x3c')]=qs[_0xa068('0x3d')](_0x715d42['query'][_0xa068('0x3d')]);_0xe6a519[_0xa068('0x3e')]=qs[_0xa068('0x35')](_['pick'](_0x715d42['query'],_0x887b37['filters']),_0x4b5de6);if(_0x715d42[_0xa068('0x33')][_0xa068('0x3f')]){_0xe6a519[_0xa068('0x3e')]=_[_0xa068('0x40')](_0xe6a519[_0xa068('0x3e')],{'$or':_[_0xa068('0x32')](_0x4b5de6,function(_0x4358f0){if(_0x4358f0['type']!==_0xa068('0x41')){var _0x2fed2b={};_0x2fed2b[_0x4358f0[_0xa068('0x2c')]]={'$like':'%'+_0x715d42[_0xa068('0x33')][_0xa068('0x3f')]+'%'};return _0x2fed2b;}})});}_0xe6a519=_['merge']({},_0xe6a519,_0x715d42[_0xa068('0x42')]);var _0x355674={'where':_0xe6a519[_0xa068('0x3e')]};return db[_0xa068('0x43')]['count'](_0x355674)[_0xa068('0x28')](function(_0x4e248d){_0x2e4aa7[_0xa068('0x1f')]=_0x4e248d;if(_0x715d42[_0xa068('0x33')][_0xa068('0x44')]){_0xe6a519[_0xa068('0x45')]=[{'all':!![]}];}return db[_0xa068('0x43')]['findAll'](_0xe6a519);})[_0xa068('0x28')](function(_0x656b8e){_0x2e4aa7[_0xa068('0x46')]=_0x656b8e;return _0x2e4aa7;})[_0xa068('0x28')](respondWithFilteredResult(_0x48b49c,_0xe6a519))[_0xa068('0x47')](handleError(_0x48b49c,null));};exports['show']=function(_0x4f0b81,_0x5adcab){var _0x2a1d41={'raw':![],'where':{'id':_0x4f0b81[_0xa068('0x48')]['id']}},_0x5817c5={};_0x5817c5[_0xa068('0x31')]=_[_0xa068('0x34')](db[_0xa068('0x43')][_0xa068('0x2e')]);_0x5817c5[_0xa068('0x33')]=_[_0xa068('0x34')](_0x4f0b81[_0xa068('0x33')]);_0x5817c5['filters']=_['intersection'](_0x5817c5[_0xa068('0x31')],_0x5817c5['query']);_0x2a1d41[_0xa068('0x37')]=_[_0xa068('0x36')](_0x5817c5[_0xa068('0x31')],qs[_0xa068('0x38')](_0x4f0b81[_0xa068('0x33')]['fields']));_0x2a1d41[_0xa068('0x37')]=_0x2a1d41[_0xa068('0x37')][_0xa068('0x39')]?_0x2a1d41[_0xa068('0x37')]:_0x5817c5['model'];if(_0x4f0b81[_0xa068('0x33')][_0xa068('0x44')]){_0x2a1d41[_0xa068('0x45')]=[{'all':!![]}];}_0x2a1d41=_[_0xa068('0x40')]({},_0x2a1d41,_0x4f0b81[_0xa068('0x42')]);return db[_0xa068('0x43')][_0xa068('0x49')](_0x2a1d41)['then'](handleEntityNotFound(_0x5adcab,null))[_0xa068('0x28')](respondWithResult(_0x5adcab,null))[_0xa068('0x47')](handleError(_0x5adcab,null));};exports['create']=function(_0x13d818,_0x3aff7e){return db['CmList'][_0xa068('0x4a')](_0x13d818[_0xa068('0x4b')],{})[_0xa068('0x28')](function(_0x2e8606){var _0xf422ee=_0x13d818['user'][_0xa068('0x2a')]({'plain':!![]});if(!_0xf422ee)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf422ee[_0xa068('0x4c')]==='user'){var _0x96b5be=_0x2e8606[_0xa068('0x2a')]({'plain':!![]});var _0x44ed26='Lists';return db['UserProfileSection'][_0xa068('0x49')]({'where':{'name':_0x44ed26,'userProfileId':_0xf422ee['userProfileId']},'raw':!![]})['then'](function(_0x558f2a){if(_0x558f2a&&_0x558f2a['autoAssociation']===0x0){return db[_0xa068('0x2b')]['create']({'name':_0x96b5be[_0xa068('0x2c')],'resourceId':_0x96b5be['id'],'type':_0x558f2a['name'],'sectionId':_0x558f2a['id']},{})[_0xa068('0x28')](function(){return _0x2e8606;});}else{return _0x2e8606;}})[_0xa068('0x47')](function(_0x2c77d8){logger[_0xa068('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c77d8);throw _0x2c77d8;});}return _0x2e8606;})[_0xa068('0x28')](respondWithResult(_0x3aff7e,0xc9))[_0xa068('0x47')](handleError(_0x3aff7e,null));};exports['update']=function(_0x3f3d25,_0x425794){if(_0x3f3d25[_0xa068('0x4b')]['id']){delete _0x3f3d25[_0xa068('0x4b')]['id'];}return db[_0xa068('0x43')][_0xa068('0x49')]({'where':{'id':_0x3f3d25['params']['id']}})['then'](handleEntityNotFound(_0x425794,null))[_0xa068('0x28')](saveUpdates(_0x3f3d25[_0xa068('0x4b')],null))[_0xa068('0x28')](respondWithResult(_0x425794,null))[_0xa068('0x47')](handleError(_0x425794,null));};exports[_0xa068('0x29')]=function(_0x53477f,_0x41d4f8){return db[_0xa068('0x43')][_0xa068('0x49')]({'where':{'id':_0x53477f[_0xa068('0x48')]['id']}})[_0xa068('0x28')](handleEntityNotFound(_0x41d4f8,null))[_0xa068('0x28')](removeEntity(_0x41d4f8,null))['catch'](handleError(_0x41d4f8,null));};exports[_0xa068('0x4e')]=function(_0x277641,_0x2f6902){return db[_0xa068('0x43')][_0xa068('0x4e')]()[_0xa068('0x28')](respondWithResult(_0x2f6902,null))[_0xa068('0x47')](handleError(_0x2f6902,null));};exports['addDisposition']=function(_0x3890b6,_0x5257ff,_0x155d3e){if(_0x3890b6[_0xa068('0x4b')]['id']){delete _0x3890b6['body']['id'];}return db['CmList'][_0xa068('0x49')]({'where':{'id':_0x3890b6['params']['id']}})[_0xa068('0x28')](handleEntityNotFound(_0x5257ff,null))[_0xa068('0x28')](function(_0x3955fb){if(_0x3955fb){_0x3890b6[_0xa068('0x4b')][_0xa068('0x4f')]=_0x3955fb['id'];return db['Disposition'][_0xa068('0x4a')](_0x3890b6[_0xa068('0x4b')]);}})[_0xa068('0x28')](respondWithResult(_0x5257ff,null))[_0xa068('0x47')](handleError(_0x5257ff,null));};exports['getDispositions']=function(_0x1eb6ad,_0x54a9dd,_0x488d72){var _0x595fc2={'raw':![],'where':{}};var _0x54bc6d={};var _0x559c56={'count':0x0,'rows':[]};return db[_0xa068('0x43')]['findOne']({'where':{'id':_0x1eb6ad['params']['id']}})[_0xa068('0x28')](handleEntityNotFound(_0x54a9dd,null))[_0xa068('0x28')](function(_0x46d601){if(_0x46d601){_0x54bc6d[_0xa068('0x31')]=_[_0xa068('0x34')](db['Disposition']['rawAttributes']);_0x54bc6d[_0xa068('0x33')]=_[_0xa068('0x34')](_0x1eb6ad[_0xa068('0x33')]);_0x54bc6d[_0xa068('0x35')]=_[_0xa068('0x36')](_0x54bc6d[_0xa068('0x31')],_0x54bc6d['query']);_0x595fc2[_0xa068('0x37')]=_[_0xa068('0x36')](_0x54bc6d[_0xa068('0x31')],qs[_0xa068('0x38')](_0x1eb6ad[_0xa068('0x33')]['fields']));_0x595fc2[_0xa068('0x37')]=_0x595fc2[_0xa068('0x37')]['length']?_0x595fc2[_0xa068('0x37')]:_0x54bc6d['model'];if(!_0x1eb6ad[_0xa068('0x33')][_0xa068('0x3a')](_0xa068('0x3b'))){_0x595fc2['limit']=qs[_0xa068('0x21')](_0x1eb6ad[_0xa068('0x33')][_0xa068('0x21')]);_0x595fc2[_0xa068('0x20')]=qs[_0xa068('0x20')](_0x1eb6ad[_0xa068('0x33')][_0xa068('0x20')]);}_0x595fc2[_0xa068('0x3c')]=qs[_0xa068('0x3d')](_0x1eb6ad['query'][_0xa068('0x3d')]);_0x595fc2[_0xa068('0x3e')]=qs['filters'](_[_0xa068('0x50')](_0x1eb6ad[_0xa068('0x33')],_0x54bc6d[_0xa068('0x35')]));_0x595fc2[_0xa068('0x3e')][_0xa068('0x4f')]=_0x46d601['id'];if(_0x1eb6ad[_0xa068('0x33')]['filter']){_0x595fc2[_0xa068('0x3e')]=_[_0xa068('0x40')](_0x595fc2['where'],{'$or':_[_0xa068('0x32')](_0x595fc2[_0xa068('0x37')],function(_0x225271){var _0x185de8={};_0x185de8[_0x225271]={'$like':'%'+_0x1eb6ad[_0xa068('0x33')][_0xa068('0x3f')]+'%'};return _0x185de8;})});}_0x595fc2=_[_0xa068('0x40')]({},_0x595fc2,_0x1eb6ad[_0xa068('0x42')]);return db[_0xa068('0x51')]['count']({'where':_0x595fc2['where']})[_0xa068('0x28')](function(_0x23372f){_0x559c56[_0xa068('0x1f')]=_0x23372f;if(_0x1eb6ad['query'][_0xa068('0x44')]){_0x595fc2[_0xa068('0x45')]=[{'all':!![]}];}return db[_0xa068('0x51')][_0xa068('0x52')](_0x595fc2);})['then'](function(_0xfa9531){_0x559c56[_0xa068('0x46')]=_0xfa9531;return _0x559c56;});}})[_0xa068('0x28')](respondWithFilteredResult(_0x54a9dd,_0x595fc2))[_0xa068('0x47')](handleError(_0x54a9dd,null));};exports[_0xa068('0x53')]=function(_0x6b7946,_0x49571d,_0x1845ad){return db[_0xa068('0x43')][_0xa068('0x49')]({'where':{'id':_0x6b7946[_0xa068('0x48')]['id']}})['then'](handleEntityNotFound(_0x49571d,null))[_0xa068('0x28')](function(_0x12ee9b){if(_0x12ee9b){return _0x12ee9b[_0xa068('0x53')](_0x6b7946[_0xa068('0x33')][_0xa068('0x54')]);}})[_0xa068('0x28')](respondWithStatusCode(_0x49571d,null))[_0xa068('0x47')](handleError(_0x49571d,null));};exports['addContacts']=function(_0x4d3670,_0x2de2ed,_0x2df2ee){return db['CmList'][_0xa068('0x49')]({'where':{'id':_0x4d3670[_0xa068('0x48')]['id']}})[_0xa068('0x28')](handleEntityNotFound(_0x2de2ed,null))['then'](function(_0x3be9a2){if(_0x3be9a2){var _0x5a506f=[];var _0x4a3b94={'success':[],'errors':[]};return db['CmContact'][_0xa068('0x4e')]()[_0xa068('0x28')](function(_0x664aa3){if(_0x4d3670['body'][_0xa068('0x55')]&&_[_0xa068('0x56')](_0x4d3670[_0xa068('0x4b')][_0xa068('0x55')])){if(_0x4d3670[_0xa068('0x4b')][_0xa068('0x55')][_0xa068('0x39')]){_0x4d3670['body'][_0xa068('0x55')]=_0x4d3670[_0xa068('0x4b')]['tags'][_0xa068('0x57')](';')+';';}else{_0x4d3670[_0xa068('0x4b')][_0xa068('0x55')]=null;}}else{_0x4d3670[_0xa068('0x4b')][_0xa068('0x55')]=null;}if(_0x4d3670['body']&&_[_0xa068('0x56')](_0x4d3670[_0xa068('0x4b')])){for(var _0xee760b=0x0;_0xee760b<_0x4d3670[_0xa068('0x4b')][_0xa068('0x39')];_0xee760b+=0x1){_0x4d3670['body'][_0xee760b][_0xa068('0x4f')]=_0x4d3670[_0xa068('0x48')]['id'];_0x5a506f[_0xa068('0x58')](_0x4d3670[_0xa068('0x4b')][_0xee760b]);}return BPromise[_0xa068('0x59')](_0x5a506f,function(_0x23d84b){return db[_0xa068('0x5a')][_0xa068('0x4a')](_[_0xa068('0x5b')](_0x23d84b,['ids','id'])||{},{'fields':_[_0xa068('0x34')](_0x664aa3),'raw':!![]})[_0xa068('0x28')](function(_0x4c9555){_0x4a3b94['success'][_0xa068('0x58')](_0x4c9555[_0xa068('0x5c')]);})[_0xa068('0x47')](function(_0x4a78dd){_0x4a3b94[_0xa068('0x5d')][_0xa068('0x58')]({'data':_0x23d84b,'error':_0x4a78dd[_0xa068('0x5e')]});});})[_0xa068('0x28')](function(_0x3603fd){return _0x4a3b94;})[_0xa068('0x47')](function(_0x3ac7b7){return _0x3ac7b7;});}else{_0x2de2ed['status'](0x190)[_0xa068('0x1d')]({'message':_0xa068('0x5f')});}});}})[_0xa068('0x28')](respondWithResult(_0x2de2ed,null))[_0xa068('0x47')](handleError(_0x2de2ed,null));};exports[_0xa068('0x60')]=function(_0x4d0e20,_0x171edc,_0x3d60f7){var _0x1c3561;return db[_0xa068('0x43')][_0xa068('0x49')]({'where':{'id':_0x4d0e20['params']['id']},'include':[{'model':db[_0xa068('0x61')],'as':'CustomFields'}]})[_0xa068('0x28')](handleEntityNotFound(_0x171edc,null))['then'](function(_0x81729c){if(_0x81729c){_0x1c3561=_0x81729c;return db['CmContact'][_0xa068('0x2e')];}})[_0xa068('0x28')](function(_0x46c46f){if(_0x46c46f){var _0x5bdda2={};var _0x438ba1={};_0x438ba1['model']=_[_0xa068('0x62')](_[_0xa068('0x34')](_0x46c46f),_['map'](_0x1c3561[_0xa068('0x63')],function(_0x4bdbc2){return util[_0xa068('0x64')](_0xa068('0x65'),_0x4bdbc2['id']);}));_0x438ba1[_0xa068('0x33')]=_[_0xa068('0x34')](_0x4d0e20[_0xa068('0x33')]);_0x438ba1[_0xa068('0x35')]=_[_0xa068('0x36')](_0x438ba1['model'],_0x438ba1[_0xa068('0x33')]);_0x5bdda2[_0xa068('0x37')]=_[_0xa068('0x36')](_0x438ba1['model'],qs[_0xa068('0x38')](_0x4d0e20['query']['fields']));_0x5bdda2[_0xa068('0x37')]=_0x5bdda2[_0xa068('0x37')][_0xa068('0x39')]?_0x5bdda2['attributes']:_0x438ba1[_0xa068('0x31')];if(!_0x4d0e20[_0xa068('0x33')][_0xa068('0x3a')](_0xa068('0x3b'))){_0x5bdda2['limit']=qs[_0xa068('0x21')](_0x4d0e20[_0xa068('0x33')][_0xa068('0x21')]);_0x5bdda2['offset']=qs['offset'](_0x4d0e20[_0xa068('0x33')][_0xa068('0x20')]);}_0x5bdda2[_0xa068('0x3c')]=qs[_0xa068('0x3d')](_0x4d0e20['query']['sort']);_0x5bdda2['where']=qs[_0xa068('0x35')](_['pick'](_0x4d0e20[_0xa068('0x33')],_0x438ba1[_0xa068('0x35')]));_0x5bdda2[_0xa068('0x66')]=!![];if(_0x4d0e20['query'][_0xa068('0x3f')]){_0x5bdda2[_0xa068('0x3e')]=_[_0xa068('0x40')](_0x5bdda2[_0xa068('0x3e')],{'$or':_[_0xa068('0x32')](_0x5bdda2[_0xa068('0x37')],function(_0x43eaaf){var _0x354207={};_0x354207[_0x43eaaf]={'$like':'%'+_0x4d0e20[_0xa068('0x33')][_0xa068('0x3f')]+'%'};return _0x354207;})});}_0x5bdda2=_[_0xa068('0x40')]({},_0x5bdda2,_0x4d0e20[_0xa068('0x42')]);return _0x1c3561[_0xa068('0x60')](_0x5bdda2);}})[_0xa068('0x28')](respondWithResult(_0x171edc,null))['catch'](handleError(_0x171edc,null));};exports[_0xa068('0x67')]=function(_0x10108b,_0xfc19cc,_0x16156a){var _0x216920;var _0x15a8d8;var _0x4ba2ad;var _0x485e8b=_0x10108b[_0xa068('0x48')]['id'];csv_results=[];return db[_0xa068('0x68')][_0xa068('0x52')]({'attributes':['id',_0xa068('0x2c')],'raw':!![],'order':[_0xa068('0x69')]})[_0xa068('0x28')](function(_0x4934cc){_0x216920=_0x4934cc;var _0x2ee78a=_[_0xa068('0x34')](db[_0xa068('0x5a')]['rawAttributes']);return db['CmCustomField'][_0xa068('0x52')]({'raw':!![],'attributes':['id','alias']})[_0xa068('0x28')](function(_0x2fcfc2){_0x15a8d8=_0x2fcfc2;var _0xb259bd=squel['select']()['fields'](_0x2ee78a)[_0xa068('0x6a')](_0xa068('0x6b'),'c')[_0xa068('0x3e')]('c.ListId\x20=\x20?',_0x485e8b)[_0xa068('0x3e')](_0xa068('0x6c'))[_0xa068('0x6d')]();for(var _0x1ae4a0=0x0;_0x1ae4a0<_0x15a8d8[_0xa068('0x39')];_0x1ae4a0++){_0xb259bd[_0xa068('0x6e')](_0xa068('0x6f')+_0x15a8d8[_0x1ae4a0]['id'],'customField_'+_0x15a8d8[_0x1ae4a0][_0xa068('0x70')]);}for(var _0x1ae4a0=0x0;_0x1ae4a0<_0x216920[_0xa068('0x39')];_0x1ae4a0++){_0xb259bd['field'](squel[_0xa068('0x71')]()['field'](_0xa068('0x72'))[_0xa068('0x6a')](_0xa068('0x73'))[_0xa068('0x3e')](_0xa068('0x74'),_0x216920[_0x1ae4a0]['id'])[_0xa068('0x3e')](_0xa068('0x75')),_0xa068('0x76')+_0x216920[_0x1ae4a0]['name']);_0xb259bd[_0xa068('0x6e')](squel['select']()[_0xa068('0x6e')](_0xa068('0x77'))[_0xa068('0x6a')]('cm_contact_has_items')[_0xa068('0x3e')](_0xa068('0x74'),_0x216920[_0x1ae4a0]['id'])[_0xa068('0x3e')](_0xa068('0x75')),'description_additionalPhone_'+_0x216920[_0x1ae4a0][_0xa068('0x2c')]);}var _0x4897ba=[];_0x4897ba[_0xa068('0x58')](_0xb259bd['toString']());BPromise[_0xa068('0x59')](_0x4897ba,handleQuery)[_0xa068('0x28')](function(_0x1344b3){handleQuery(_0xb259bd[_0xa068('0x78')]());var _0x4d4555=csv_results[0x0];if(!_[_0xa068('0x79')](_0x4d4555)){var _0x20213f=toCsv(_0x4d4555);var _0x2dcded=Date['now']();fs[_0xa068('0x7a')](util[_0xa068('0x64')]('/tmp/list_%d_%s.csv',_0x485e8b,_0x2dcded),_0x20213f);_0xfc19cc[_0xa068('0x7b')](_0xa068('0x7c'),_0xa068('0x7d')+util[_0xa068('0x64')](_0xa068('0x7e'),_0x485e8b,_0x2dcded));_0xfc19cc['setHeader'](_0xa068('0x7f'),_0xa068('0x80'));return _0xfc19cc[_0xa068('0x81')](util[_0xa068('0x64')](_0xa068('0x82'),_0x485e8b,_0x2dcded));}else{return _0xfc19cc[_0xa068('0x1a')](0xcc);}});});});};exports[_0xa068('0x83')]=function(_0x19be94,_0x33390e,_0x3134cf){var _0x29acc6;delete _0x19be94['body']['id'];return db[_0xa068('0x43')]['findOne']({'where':{'id':_0x19be94['params']['id']}})[_0xa068('0x28')](handleEntityNotFound(_0x33390e,null))[_0xa068('0x28')](function(_0x23049b){if(_0x23049b){return db[_0xa068('0x84')][_0xa068('0x85')](function(_0x5adc3e){return db['CmCustomField'][_0xa068('0x4a')](_0x19be94['body'],{'transaction':_0x5adc3e})[_0xa068('0x28')](function(_0x25211b){_0x29acc6=_0x25211b;return _0x23049b[_0xa068('0x86')](_0x25211b,{'transaction':_0x5adc3e});})[_0xa068('0x28')](function(){var _0x5a2053={'type':db['Sequelize']['TEXT'],'transaction':_0x5adc3e};switch(_0x19be94[_0xa068('0x4b')]['type']){case'text':_0x5a2053[_0xa068('0x87')]=db[_0xa068('0x88')]['TEXT'];break;case _0xa068('0x89'):_0x5a2053[_0xa068('0x87')]=db[_0xa068('0x88')]['INTEGER'];break;case _0xa068('0x8a'):_0x5a2053[_0xa068('0x87')]=db[_0xa068('0x88')]['BOOLEAN'];_0x5a2053[_0xa068('0x8b')]=![];break;default:}return db['sequelize'][_0xa068('0x8c')]['addColumn'](_0xa068('0x6b'),util[_0xa068('0x64')](_0xa068('0x8d'),_0x29acc6['id']),_0x5a2053);})[_0xa068('0x28')](function(){return _0x29acc6;});});}})['then'](respondWithResult(_0x33390e,null))[_0xa068('0x47')](handleError(_0x33390e,null));};exports[_0xa068('0x8e')]=function(_0x4ef31a,_0x3f720d,_0x5ce406){var _0x4d5c22={};var _0x123bbb={};var _0x26a83d;var _0x38b220;return db[_0xa068('0x43')][_0xa068('0x8f')]({'where':{'id':_0x4ef31a[_0xa068('0x48')]['id']}})['then'](handleEntityNotFound(_0x3f720d,null))[_0xa068('0x28')](function(_0x26466f){if(_0x26466f){_0x26a83d=_0x26466f;_0x123bbb['model']=_['keys'](db[_0xa068('0x61')][_0xa068('0x2e')]);_0x123bbb[_0xa068('0x33')]=_[_0xa068('0x34')](_0x4ef31a[_0xa068('0x33')]);_0x123bbb[_0xa068('0x35')]=_[_0xa068('0x36')](_0x123bbb[_0xa068('0x31')],_0x123bbb['query']);_0x4d5c22[_0xa068('0x37')]=_[_0xa068('0x36')](_0x123bbb[_0xa068('0x31')],qs[_0xa068('0x38')](_0x4ef31a[_0xa068('0x33')][_0xa068('0x38')]));_0x4d5c22[_0xa068('0x37')]=_0x4d5c22[_0xa068('0x37')][_0xa068('0x39')]?_0x4d5c22[_0xa068('0x37')]:_0x123bbb[_0xa068('0x31')];_0x4d5c22[_0xa068('0x3c')]=qs['sort'](_0x4ef31a['query']['sort']);_0x4d5c22[_0xa068('0x3e')]=qs[_0xa068('0x35')](_[_0xa068('0x50')](_0x4ef31a['query'],_0x123bbb[_0xa068('0x35')]));_0x4d5c22['where']=_[_0xa068('0x40')](_0x4d5c22[_0xa068('0x3e')],{'$or':[{'ListId':_0x26466f['id']},{'ListId':null}]});if(_0x4ef31a[_0xa068('0x33')][_0xa068('0x3f')]){_0x4d5c22[_0xa068('0x3e')]=_[_0xa068('0x40')](_0x4d5c22[_0xa068('0x3e')],{'$or':_[_0xa068('0x32')](_0x4d5c22[_0xa068('0x37')],function(_0x37c22e){var _0x12e35a={};_0x12e35a[_0x37c22e]={'$like':'%'+_0x4ef31a[_0xa068('0x33')][_0xa068('0x3f')]+'%'};return _0x12e35a;})});}_0x4d5c22=_['merge']({},_0x4d5c22,_0x4ef31a[_0xa068('0x42')]);return db[_0xa068('0x61')][_0xa068('0x90')](_0x4d5c22);}})['then'](respondWithResult(_0x3f720d,null))['catch'](handleError(_0x3f720d,null));};exports[_0xa068('0x91')]=function(_0xaf9f6a,_0x449ef9){return db[_0xa068('0x61')]['findAndCountAll']({'where':{'ListId':null}})[_0xa068('0x28')](handleEntityNotFound(_0x449ef9,null))[_0xa068('0x28')](function(_0x56cdb4){return _0x56cdb4;})[_0xa068('0x28')](respondWithResult(_0x449ef9,null))['catch'](handleError(_0x449ef9,null));};exports[_0xa068('0x92')]=function(_0x5834f5,_0x2a88e5,_0xafa3c9){return db[_0xa068('0x43')][_0xa068('0x49')]({'where':{'id':_0x5834f5['params']['id']}})['then'](handleEntityNotFound(_0x2a88e5,null))[_0xa068('0x28')](function(_0xa3485f){if(_0xa3485f){return _0xa3485f[_0xa068('0x92')](_0x5834f5[_0xa068('0x4b')][_0xa068('0x54')],_[_0xa068('0x5b')](_0x5834f5[_0xa068('0x4b')],[_0xa068('0x54'),'id'])||{})[_0xa068('0x93')](function(_0x37ea85){for(var _0x4e9fc2=0x0;_0x4e9fc2<_0x5834f5['body']['ids'][_0xa068('0x39')];_0x4e9fc2+=0x1){socket[_0xa068('0x94')](_0xa068('0x95'),{'UserId':Number(_0x5834f5[_0xa068('0x4b')][_0xa068('0x54')][_0x4e9fc2]),'CmListId':Number(_0x5834f5[_0xa068('0x48')]['id'])});}return _0x37ea85;});}})[_0xa068('0x28')](respondWithResult(_0x2a88e5,null))[_0xa068('0x47')](handleError(_0x2a88e5,null));};exports['removeAgents']=function(_0x34dd87,_0x5d84c0,_0x15f1c0){return db[_0xa068('0x43')][_0xa068('0x49')]({'where':{'id':_0x34dd87['params']['id']}})['then'](handleEntityNotFound(_0x5d84c0,null))[_0xa068('0x28')](function(_0x4341a6){if(_0x4341a6){return _0x4341a6['removeAgents'](_0x34dd87[_0xa068('0x33')]['ids'])[_0xa068('0x28')](function(){if(_[_0xa068('0x56')](_0x34dd87[_0xa068('0x33')][_0xa068('0x54')])){for(var _0x5d0c28=0x0;_0x5d0c28<_0x34dd87[_0xa068('0x33')]['ids']['length'];_0x5d0c28+=0x1){socket[_0xa068('0x94')]('userCmList:remove',{'UserId':Number(_0x34dd87[_0xa068('0x33')][_0xa068('0x54')][_0x5d0c28]),'CmListId':Number(_0x34dd87[_0xa068('0x48')]['id'])});}}else{socket[_0xa068('0x94')](_0xa068('0x96'),{'UserId':Number(_0x34dd87[_0xa068('0x33')][_0xa068('0x54')]),'CmListId':Number(_0x34dd87['params']['id'])});}});}})['then'](respondWithStatusCode(_0x5d84c0,null))[_0xa068('0x47')](handleError(_0x5d84c0,null));};exports['getAgents']=function(_0x2e3476,_0x9b51f4,_0x35ed5f){var _0x1a30ab={};var _0x3ff76d={};var _0x11c183;var _0x18d107;return db[_0xa068('0x43')][_0xa068('0x8f')]({'where':{'id':_0x2e3476['params']['id']}})[_0xa068('0x28')](handleEntityNotFound(_0x9b51f4,null))['then'](function(_0x45f0f0){if(_0x45f0f0){_0x11c183=_0x45f0f0;_0x3ff76d[_0xa068('0x31')]=_['keys'](db[_0xa068('0x97')]['rawAttributes']);_0x3ff76d[_0xa068('0x33')]=_[_0xa068('0x34')](_0x2e3476[_0xa068('0x33')]);_0x3ff76d[_0xa068('0x35')]=_[_0xa068('0x36')](_0x3ff76d[_0xa068('0x31')],_0x3ff76d[_0xa068('0x33')]);_0x1a30ab['attributes']=_['intersection'](_0x3ff76d[_0xa068('0x31')],qs['fields'](_0x2e3476[_0xa068('0x33')][_0xa068('0x38')]));_0x1a30ab['attributes']=_0x1a30ab[_0xa068('0x37')][_0xa068('0x39')]?_0x1a30ab[_0xa068('0x37')]:_0x3ff76d[_0xa068('0x31')];_0x1a30ab[_0xa068('0x3c')]=qs['sort'](_0x2e3476[_0xa068('0x33')][_0xa068('0x3d')]);_0x1a30ab[_0xa068('0x3e')]=qs[_0xa068('0x35')](_['pick'](_0x2e3476[_0xa068('0x33')],_0x3ff76d[_0xa068('0x35')]));if(_0x2e3476[_0xa068('0x33')][_0xa068('0x3f')]){_0x1a30ab['where']=_[_0xa068('0x40')](_0x1a30ab[_0xa068('0x3e')],{'$or':_['map'](_0x1a30ab[_0xa068('0x37')],function(_0x1029e7){var _0x43062e={};_0x43062e[_0x1029e7]={'$like':'%'+_0x2e3476[_0xa068('0x33')][_0xa068('0x3f')]+'%'};return _0x43062e;})});}_0x1a30ab=_['merge']({},_0x1a30ab,_0x2e3476['options']);return _0x11c183[_0xa068('0x98')](_0x1a30ab);}})[_0xa068('0x28')](function(_0x145a4d){if(_0x145a4d){_0x18d107=_0x145a4d[_0xa068('0x39')];if(!_0x2e3476[_0xa068('0x33')][_0xa068('0x3a')]('nolimit')){_0x1a30ab[_0xa068('0x21')]=qs[_0xa068('0x21')](_0x2e3476[_0xa068('0x33')][_0xa068('0x21')]);_0x1a30ab[_0xa068('0x20')]=qs[_0xa068('0x20')](_0x2e3476[_0xa068('0x33')][_0xa068('0x20')]);}return _0x11c183[_0xa068('0x98')](_0x1a30ab);}})[_0xa068('0x28')](function(_0x5c35ba){if(_0x5c35ba){return _0x5c35ba?{'count':_0x18d107,'rows':_0x5c35ba}:null;}})[_0xa068('0x28')](respondWithResult(_0x9b51f4,null))[_0xa068('0x47')](handleError(_0x9b51f4,null));};function handleQuery(_0x23b913){logger[_0xa068('0x99')](_0x23b913);return db[_0xa068('0x84')][_0xa068('0x33')](_0x23b913)[_0xa068('0x93')](function(_0x22e141){csv_results[_0xa068('0x58')](_0x22e141);})[_0xa068('0x47')](function(_0x3d8ad6){logger[_0xa068('0x4d')](_0x3d8ad6[_0xa068('0x5e')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 943ad19..d5c3b6c 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 _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 +var _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x15ebfd,_0xbc1af8){var _0x268375=function(_0x32992b){while(--_0x32992b){_0x15ebfd['push'](_0x15ebfd['shift']());}};_0x268375(++_0xbc1af8);}(_0x7217,0x19e));var _0x7721=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x7217[_0x4fc9e6];return _0x551d28;};'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 diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 2d67935..cdc1c7c 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 _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 +var _0x22fb=['define','CmList','../../config/logger','moment','bluebird','request-promise','path','rimraf','./cmList.attributes','exports'];(function(_0x3c13d0,_0x3647d9){var _0x204375=function(_0x25cde7){while(--_0x25cde7){_0x3c13d0['push'](_0x3c13d0['shift']());}};_0x204375(++_0x3647d9);}(_0x22fb,0x192));var _0xb22f=function(_0x2c3c66,_0x24c17e){_0x2c3c66=_0x2c3c66-0x0;var _0x1eee04=_0x22fb[_0x2c3c66];return _0x1eee04;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb22f('0x0'))('api');var moment=require(_0xb22f('0x1'));var BPromise=require(_0xb22f('0x2'));var rp=require(_0xb22f('0x3'));var fs=require('fs');var path=require(_0xb22f('0x4'));var rimraf=require(_0xb22f('0x5'));var config=require('../../config/environment');var attributes=require(_0xb22f('0x6'));module[_0xb22f('0x7')]=function(_0x2d1fb3,_0xc3ffcc){return _0x2d1fb3[_0xb22f('0x8')](_0xb22f('0x9'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 72ed925..c44d459 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 _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 +var _0xd4e4=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./cmList.socket','register','request','then','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','CmList,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x22db62,_0x38bcea){var _0x9d8595=function(_0xa5a852){while(--_0xa5a852){_0x22db62['push'](_0x22db62['shift']());}};_0x9d8595(++_0x38bcea);}(_0xd4e4,0xa5));var _0x4d4e=function(_0x3de0a4,_0x298a6f){_0x3de0a4=_0x3de0a4-0x0;var _0x10b1a0=_0xd4e4[_0x3de0a4];return _0x10b1a0;};'use strict';var _=require(_0x4d4e('0x0'));var util=require(_0x4d4e('0x1'));var moment=require(_0x4d4e('0x2'));var BPromise=require(_0x4d4e('0x3'));var rs=require(_0x4d4e('0x4'));var fs=require('fs');var Redis=require(_0x4d4e('0x5'));var db=require(_0x4d4e('0x6'))['db'];var utils=require(_0x4d4e('0x7'));var logger=require(_0x4d4e('0x8'))(_0x4d4e('0x9'));var config=require(_0x4d4e('0xa'));var jayson=require(_0x4d4e('0xb'));var client=jayson[_0x4d4e('0xc')][_0x4d4e('0xd')]({'port':0x232a});config[_0x4d4e('0xe')]=_[_0x4d4e('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4d4e('0xe')]));require(_0x4d4e('0x10'))[_0x4d4e('0x11')](socket);function respondWithRpcPromise(_0x39733d,_0x5e508a,_0x9446c6){return new BPromise(function(_0x6bbeaf,_0xe085df){return client[_0x4d4e('0x12')](_0x39733d,_0x9446c6)[_0x4d4e('0x13')](function(_0xc40761){logger[_0x4d4e('0x14')]('CmList,\x20%s,\x20%s',_0x5e508a,_0x4d4e('0x15'));logger[_0x4d4e('0x16')](_0x4d4e('0x17'),_0x5e508a,_0x4d4e('0x15'),JSON[_0x4d4e('0x18')](_0xc40761));if(_0xc40761[_0x4d4e('0x19')]){if(_0xc40761[_0x4d4e('0x19')]['code']===0x1f4){logger[_0x4d4e('0x19')]('CmList,\x20%s,\x20%s',_0x5e508a,_0xc40761['error'][_0x4d4e('0x1a')]);return _0xe085df(_0xc40761[_0x4d4e('0x19')][_0x4d4e('0x1a')]);}logger[_0x4d4e('0x19')](_0x4d4e('0x1b'),_0x5e508a,_0xc40761[_0x4d4e('0x19')][_0x4d4e('0x1a')]);return _0x6bbeaf(_0xc40761['error'][_0x4d4e('0x1a')]);}else{logger[_0x4d4e('0x14')](_0x4d4e('0x1b'),_0x5e508a,_0x4d4e('0x15'));_0x6bbeaf(_0xc40761[_0x4d4e('0x1c')][_0x4d4e('0x1a')]);}})['catch'](function(_0x4e0151){logger[_0x4d4e('0x19')](_0x4d4e('0x1b'),_0x5e508a,_0x4e0151);_0xe085df(_0x4e0151);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 41fc8d2..f517e53 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 _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 +var _0xc932=['register','length','./cmList.events','remove','update','emit','removeListener'];(function(_0x1b2255,_0x3de34f){var _0x33e57d=function(_0x2f9cce){while(--_0x2f9cce){_0x1b2255['push'](_0x1b2255['shift']());}};_0x33e57d(++_0x3de34f);}(_0xc932,0x95));var _0x2c93=function(_0xe1269d,_0x57b7c3){_0xe1269d=_0xe1269d-0x0;var _0x261ca1=_0xc932[_0xe1269d];return _0x261ca1;};'use strict';var CmListEvents=require(_0x2c93('0x0'));var events=['save',_0x2c93('0x1'),_0x2c93('0x2')];function createListener(_0x48b538,_0x6ec755){return function(_0x254b29){_0x6ec755[_0x2c93('0x3')](_0x48b538,_0x254b29);};}function removeListener(_0x36c9ea,_0x2cf17c){return function(){CmListEvents[_0x2c93('0x4')](_0x36c9ea,_0x2cf17c);};}exports[_0x2c93('0x5')]=function(_0x1bc3d5){for(var _0x167550=0x0,_0xcd146a=events[_0x2c93('0x6')];_0x167550<_0xcd146a;_0x167550++){var _0x297801=events[_0x167550];var _0x22a8a9=createListener('cmList:'+_0x297801,_0x1bc3d5);CmListEvents['on'](_0x297801,_0x22a8a9);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index e4b801c..8244942 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 _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 +var _0xe6c4=['getCustomFields','/:id/users','getAgents','post','create','/:id/dispositions','addContacts','addAgents','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmList.controller','/describe','get','isAuthenticated','getGlobalCustomFields','/:id','show','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields'];(function(_0x24b897,_0x38df26){var _0x522698=function(_0x1757a3){while(--_0x1757a3){_0x24b897['push'](_0x24b897['shift']());}};_0x522698(++_0x38df26);}(_0xe6c4,0x1dc));var _0x4e6c=function(_0x5e6f4d,_0x545ebc){_0x5e6f4d=_0x5e6f4d-0x0;var _0x15fcfd=_0xe6c4[_0x5e6f4d];return _0x15fcfd;};'use strict';var multer=require(_0x4e6c('0x0'));var util=require(_0x4e6c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4e6c('0x2'));var router=express[_0x4e6c('0x3')]();var fs_extra=require(_0x4e6c('0x4'));var auth=require(_0x4e6c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4e6c('0x6'));var controller=require(_0x4e6c('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4e6c('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x4e6c('0x9')]('/global_fields',auth[_0x4e6c('0xa')](),controller[_0x4e6c('0xb')]);router[_0x4e6c('0x9')](_0x4e6c('0xc'),auth['isAuthenticated'](),controller[_0x4e6c('0xd')]);router[_0x4e6c('0x9')]('/:id/dispositions',auth[_0x4e6c('0xa')](),controller['getDispositions']);router[_0x4e6c('0x9')](_0x4e6c('0xe'),auth[_0x4e6c('0xa')](),controller[_0x4e6c('0xf')]);router[_0x4e6c('0x9')](_0x4e6c('0x10'),auth['isAuthenticated'](),controller[_0x4e6c('0x11')]);router[_0x4e6c('0x9')](_0x4e6c('0x12'),auth[_0x4e6c('0xa')](),controller[_0x4e6c('0x13')]);router[_0x4e6c('0x9')](_0x4e6c('0x14'),auth['isAuthenticated'](),controller[_0x4e6c('0x15')]);router[_0x4e6c('0x16')]('/',auth['isAuthenticated'](),controller[_0x4e6c('0x17')]);router[_0x4e6c('0x16')](_0x4e6c('0x18'),auth[_0x4e6c('0xa')](),controller['addDisposition']);router[_0x4e6c('0x16')](_0x4e6c('0xe'),auth[_0x4e6c('0xa')](),controller[_0x4e6c('0x19')]);router['post'](_0x4e6c('0x12'),auth[_0x4e6c('0xa')](),controller['addCustomField']);router[_0x4e6c('0x16')](_0x4e6c('0x14'),auth[_0x4e6c('0xa')](),controller[_0x4e6c('0x1a')]);router['put'](_0x4e6c('0xc'),auth[_0x4e6c('0xa')](),controller[_0x4e6c('0x1b')]);router[_0x4e6c('0x1c')]('/:id',auth[_0x4e6c('0xa')](),controller[_0x4e6c('0x1d')]);router[_0x4e6c('0x1c')](_0x4e6c('0x18'),auth[_0x4e6c('0xa')](),controller[_0x4e6c('0x1e')]);router[_0x4e6c('0x1c')](_0x4e6c('0x14'),auth[_0x4e6c('0xa')](),controller[_0x4e6c('0x1f')]);module[_0x4e6c('0x20')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index a190071..49a4ac2 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 _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 +var _0x9718=['exports','VIRTUAL','field','STRING','sequelize'];(function(_0x30ead1,_0x320313){var _0x1a4986=function(_0x22c5c0){while(--_0x22c5c0){_0x30ead1['push'](_0x30ead1['shift']());}};_0x1a4986(++_0x320313);}(_0x9718,0xe5));var _0x8971=function(_0x25835c,_0x222e79){_0x25835c=_0x25835c-0x0;var _0x4ba62b=_0x9718[_0x25835c];return _0x4ba62b;};'use strict';var Sequelize=require(_0x8971('0x0'));module[_0x8971('0x1')]={'name':{'type':Sequelize[_0x8971('0x2')],'get':function(_0x22a19f){return this['getDataValue'](_0x8971('0x3'));}},'field':{'type':Sequelize[_0x8971('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x8971('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x8971('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 07973f8..29902c5 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_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 +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(_0x590232,_0x481605){var _0x55ee1c=function(_0x12d76e){while(--_0x12d76e){_0x590232['push'](_0x590232['shift']());}};_0x55ee1c(++_0x481605);}(_0x7a54,0x106));var _0x47a5=function(_0x1ab96b,_0x31c69f){_0x1ab96b=_0x1ab96b-0x0;var _0x134de7=_0x7a54[_0x1ab96b];return _0x134de7;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 28e0fc4..a23e679 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 _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 +var _0x9d43=['moment','bluebird','request-promise','rimraf','./condition.attributes','define','Condition','lodash','util'];(function(_0x4cb834,_0x5d48ee){var _0xaf9993=function(_0x16f815){while(--_0x16f815){_0x4cb834['push'](_0x4cb834['shift']());}};_0xaf9993(++_0x5d48ee);}(_0x9d43,0x139));var _0x39d4=function(_0x1b7b4c,_0x32cfdb){_0x1b7b4c=_0x1b7b4c-0x0;var _0x5e1a0e=_0x9d43[_0x1b7b4c];return _0x5e1a0e;};'use strict';var _=require(_0x39d4('0x0'));var util=require(_0x39d4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x39d4('0x2'));var BPromise=require(_0x39d4('0x3'));var rp=require(_0x39d4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x39d4('0x5'));var config=require('../../config/environment');var attributes=require(_0x39d4('0x6'));module['exports']=function(_0x5bdcf4,_0x41af0c){return _0x5bdcf4[_0x39d4('0x7')](_0x39d4('0x8'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 23c1759..c25b0b6 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 _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 +var _0x3d39=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Condition,\x20%s,\x20%s'];(function(_0x41da6a,_0x2b22c7){var _0x5d37c6=function(_0x16f113){while(--_0x16f113){_0x41da6a['push'](_0x41da6a['shift']());}};_0x5d37c6(++_0x2b22c7);}(_0x3d39,0x80));var _0x93d3=function(_0x51041f,_0x159fcd){_0x51041f=_0x51041f-0x0;var _0x42581c=_0x3d39[_0x51041f];return _0x42581c;};'use strict';var _=require(_0x93d3('0x0'));var util=require(_0x93d3('0x1'));var moment=require('moment');var BPromise=require(_0x93d3('0x2'));var rs=require(_0x93d3('0x3'));var fs=require('fs');var Redis=require(_0x93d3('0x4'));var db=require(_0x93d3('0x5'))['db'];var utils=require(_0x93d3('0x6'));var logger=require(_0x93d3('0x7'))(_0x93d3('0x8'));var config=require(_0x93d3('0x9'));var jayson=require(_0x93d3('0xa'));var client=jayson[_0x93d3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e5187,_0x1f927a,_0x42461a){return new BPromise(function(_0x13b5a0,_0x8aad03){return client[_0x93d3('0xc')](_0x1e5187,_0x42461a)[_0x93d3('0xd')](function(_0x56d8f1){logger[_0x93d3('0xe')]('Condition,\x20%s,\x20%s',_0x1f927a,'request\x20sent');logger[_0x93d3('0xf')](_0x93d3('0x10'),_0x1f927a,_0x93d3('0x11'),JSON[_0x93d3('0x12')](_0x56d8f1));if(_0x56d8f1[_0x93d3('0x13')]){if(_0x56d8f1[_0x93d3('0x13')][_0x93d3('0x14')]===0x1f4){logger[_0x93d3('0x13')]('Condition,\x20%s,\x20%s',_0x1f927a,_0x56d8f1[_0x93d3('0x13')]['message']);return _0x8aad03(_0x56d8f1[_0x93d3('0x13')]['message']);}logger[_0x93d3('0x13')](_0x93d3('0x15'),_0x1f927a,_0x56d8f1[_0x93d3('0x13')]['message']);return _0x13b5a0(_0x56d8f1[_0x93d3('0x13')][_0x93d3('0x16')]);}else{logger[_0x93d3('0xe')](_0x93d3('0x15'),_0x1f927a,'request\x20sent');_0x13b5a0(_0x56d8f1[_0x93d3('0x17')][_0x93d3('0x16')]);}})[_0x93d3('0x18')](function(_0x5061b8){logger[_0x93d3('0x13')]('Condition,\x20%s,\x20%s',_0x1f927a,_0x5061b8);_0x8aad03(_0x5061b8);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index a73943d..572b0a2 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 _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 +var _0x2212=['exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./condition.controller','put','isAuthenticated','delete','destroy'];(function(_0x1be43f,_0x400360){var _0x345586=function(_0x5e2a6f){while(--_0x5e2a6f){_0x1be43f['push'](_0x1be43f['shift']());}};_0x345586(++_0x400360);}(_0x2212,0x1e2));var _0x2221=function(_0x3cb658,_0x5289fc){_0x3cb658=_0x3cb658-0x0;var _0x529770=_0x2212[_0x3cb658];return _0x529770;};'use strict';var multer=require('multer');var util=require(_0x2221('0x0'));var path=require(_0x2221('0x1'));var timeout=require(_0x2221('0x2'));var express=require('express');var router=express[_0x2221('0x3')]();var fs_extra=require(_0x2221('0x4'));var auth=require(_0x2221('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2221('0x6'));var controller=require(_0x2221('0x7'));router[_0x2221('0x8')]('/:id',auth[_0x2221('0x9')](),controller['update']);router[_0x2221('0xa')]('/:id',auth[_0x2221('0x9')](),controller[_0x2221('0xb')]);module[_0x2221('0xc')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index a14f379..4af0fb0 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 _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 +var _0x4b6c=['sequelize','name','STRING'];(function(_0x38b1ff,_0xc7a100){var _0x51f5e2=function(_0x254551){while(--_0x254551){_0x38b1ff['push'](_0x38b1ff['shift']());}};_0x51f5e2(++_0xc7a100);}(_0x4b6c,0x123));var _0xc4b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b6c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc4b6('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc4b6('0x1')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xc4b6('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 570db9e..a293fd5 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 _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 +var _0xe5af=['rimraf','zip-dir','request-promise','moment','bluebird','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','get','ContactItemTypes','UserProfileResource','stack','name','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','catch','error','CmContactHasItem'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xe5af,0x9c));var _0xfe5a=function(_0x2322bf,_0x213d13){_0x2322bf=_0x2322bf-0x0;var _0x125f0f=_0xe5af[_0x2322bf];return _0x125f0f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfe5a('0x0'));var zipdir=require(_0xfe5a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfe5a('0x2'));var moment=require(_0xfe5a('0x3'));var BPromise=require(_0xfe5a('0x4'));var Mustache=require('mustache');var util=require(_0xfe5a('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xfe5a('0x6'));var ejs=require(_0xfe5a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfe5a('0x8'));var crypto=require(_0xfe5a('0x9'));var jsforce=require(_0xfe5a('0xa'));var deskjs=require(_0xfe5a('0xb'));var toCsv=require('to-csv');var querystring=require(_0xfe5a('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfe5a('0xd'));var qs=require(_0xfe5a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe5a('0xf'));var logger=require(_0xfe5a('0x10'))(_0xfe5a('0x11'));var utils=require(_0xfe5a('0x12'));var config=require(_0xfe5a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xfe5a('0x14'))['db'];function respondWithStatusCode(_0x9d1f4f,_0x20b206){_0x20b206=_0x20b206||0xcc;return function(_0x374ded){if(_0x374ded){return _0x9d1f4f[_0xfe5a('0x15')](_0x20b206);}return _0x9d1f4f['status'](_0x20b206)[_0xfe5a('0x16')]();};}function respondWithResult(_0x17bbbe,_0x42969b){_0x42969b=_0x42969b||0xc8;return function(_0x362115){if(_0x362115){return _0x17bbbe[_0xfe5a('0x17')](_0x42969b)[_0xfe5a('0x18')](_0x362115);}};}function respondWithFilteredResult(_0x375380,_0xeb454){return function(_0x111d4d){if(_0x111d4d){var _0x18c57b=typeof _0xeb454[_0xfe5a('0x19')]===_0xfe5a('0x1a')&&typeof _0xeb454[_0xfe5a('0x1b')]===_0xfe5a('0x1a');var _0x3edcab=_0x111d4d[_0xfe5a('0x1c')];var _0x5bf597=_0x18c57b?0x0:_0xeb454[_0xfe5a('0x19')];var _0x456707=_0x18c57b?_0x111d4d['count']:_0xeb454[_0xfe5a('0x19')]+_0xeb454[_0xfe5a('0x1b')];var _0x39d905;if(_0x456707>=_0x3edcab){_0x456707=_0x3edcab;_0x39d905=0xc8;}else{_0x39d905=0xce;}_0x375380['status'](_0x39d905);return _0x375380['set'](_0xfe5a('0x1d'),_0x5bf597+'-'+_0x456707+'/'+_0x3edcab)[_0xfe5a('0x18')](_0x111d4d);}return null;};}function patchUpdates(_0xded538){return function(_0x3b3022){try{jsonpatch[_0xfe5a('0x1e')](_0x3b3022,_0xded538,!![]);}catch(_0x355869){return BPromise['reject'](_0x355869);}return _0x3b3022[_0xfe5a('0x1f')]();};}function saveUpdates(_0x592521,_0x3dfa57){return function(_0x39d825){if(_0x39d825){return _0x39d825[_0xfe5a('0x20')](_0x592521)['then'](function(_0x4bbef1){return _0x4bbef1;});}return null;};}function removeEntity(_0x247be4,_0x3e55fd){return function(_0x494df3){if(_0x494df3){return _0x494df3[_0xfe5a('0x21')]()[_0xfe5a('0x22')](function(){var _0x578d3e=_0x494df3[_0xfe5a('0x23')]({'plain':!![]});var _0x3a4f3c=_0xfe5a('0x24');return db[_0xfe5a('0x25')]['destroy']({'where':{'type':_0x3a4f3c,'resourceId':_0x578d3e['id']}})[_0xfe5a('0x22')](function(){return _0x494df3;});})[_0xfe5a('0x22')](function(){_0x247be4[_0xfe5a('0x17')](0xcc)[_0xfe5a('0x16')]();});}};}function handleEntityNotFound(_0x36bf20,_0x222490){return function(_0xdbf1e0){if(!_0xdbf1e0){_0x36bf20[_0xfe5a('0x15')](0x194);}return _0xdbf1e0;};}function handleError(_0x55d89e,_0x4df546){_0x4df546=_0x4df546||0x1f4;return function(_0x712b44){logger['error'](_0x712b44[_0xfe5a('0x26')]);if(_0x712b44[_0xfe5a('0x27')]){delete _0x712b44[_0xfe5a('0x27')];}_0x55d89e['status'](_0x4df546)['send'](_0x712b44);};}exports['index']=function(_0x32d31e,_0x582f2d){var _0x51d1f4={},_0x498b64={},_0x3b6e4d={'count':0x0,'rows':[]};var _0x14c66d=_[_0xfe5a('0x28')](db[_0xfe5a('0x29')][_0xfe5a('0x2a')],function(_0x286f27){return{'name':_0x286f27[_0xfe5a('0x2b')],'type':_0x286f27[_0xfe5a('0x2c')][_0xfe5a('0x2d')]};});_0x498b64[_0xfe5a('0x2e')]=_[_0xfe5a('0x28')](_0x14c66d,'name');_0x498b64[_0xfe5a('0x2f')]=_[_0xfe5a('0x30')](_0x32d31e['query']);_0x498b64[_0xfe5a('0x31')]=_[_0xfe5a('0x32')](_0x498b64[_0xfe5a('0x2e')],_0x498b64[_0xfe5a('0x2f')]);_0x51d1f4[_0xfe5a('0x33')]=_['intersection'](_0x498b64['model'],qs[_0xfe5a('0x34')](_0x32d31e['query'][_0xfe5a('0x34')]));_0x51d1f4[_0xfe5a('0x33')]=_0x51d1f4[_0xfe5a('0x33')][_0xfe5a('0x35')]?_0x51d1f4['attributes']:_0x498b64[_0xfe5a('0x2e')];if(!_0x32d31e[_0xfe5a('0x2f')][_0xfe5a('0x36')]('nolimit')){_0x51d1f4[_0xfe5a('0x1b')]=qs[_0xfe5a('0x1b')](_0x32d31e[_0xfe5a('0x2f')][_0xfe5a('0x1b')]);_0x51d1f4['offset']=qs[_0xfe5a('0x19')](_0x32d31e['query'][_0xfe5a('0x19')]);}_0x51d1f4[_0xfe5a('0x37')]=qs['sort'](_0x32d31e[_0xfe5a('0x2f')][_0xfe5a('0x38')]);_0x51d1f4[_0xfe5a('0x39')]=qs[_0xfe5a('0x31')](_['pick'](_0x32d31e[_0xfe5a('0x2f')],_0x498b64[_0xfe5a('0x31')]),_0x14c66d);if(_0x32d31e[_0xfe5a('0x2f')]['filter']){_0x51d1f4[_0xfe5a('0x39')]=_[_0xfe5a('0x3a')](_0x51d1f4[_0xfe5a('0x39')],{'$or':_[_0xfe5a('0x28')](_0x14c66d,function(_0xec56ad){if(_0xec56ad[_0xfe5a('0x2c')]!==_0xfe5a('0x3b')){var _0x243271={};_0x243271[_0xec56ad[_0xfe5a('0x27')]]={'$like':'%'+_0x32d31e[_0xfe5a('0x2f')][_0xfe5a('0x3c')]+'%'};return _0x243271;}})});}_0x51d1f4=_['merge']({},_0x51d1f4,_0x32d31e[_0xfe5a('0x3d')]);var _0x315396={'where':_0x51d1f4[_0xfe5a('0x39')]};return db[_0xfe5a('0x29')][_0xfe5a('0x1c')](_0x315396)[_0xfe5a('0x22')](function(_0x3475fb){_0x3b6e4d['count']=_0x3475fb;if(_0x32d31e[_0xfe5a('0x2f')][_0xfe5a('0x3e')]){_0x51d1f4['include']=[{'all':!![]}];}return db['ContactItemType'][_0xfe5a('0x3f')](_0x51d1f4);})['then'](function(_0x54096d){_0x3b6e4d[_0xfe5a('0x40')]=_0x54096d;return _0x3b6e4d;})[_0xfe5a('0x22')](respondWithFilteredResult(_0x582f2d,_0x51d1f4))['catch'](handleError(_0x582f2d,null));};exports[_0xfe5a('0x41')]=function(_0x5a9c92,_0x5112a9){var _0x1dbb2c={'raw':!![],'where':{'id':_0x5a9c92[_0xfe5a('0x42')]['id']}},_0x1a92ef={};_0x1a92ef[_0xfe5a('0x2e')]=_[_0xfe5a('0x30')](db['ContactItemType'][_0xfe5a('0x2a')]);_0x1a92ef[_0xfe5a('0x2f')]=_[_0xfe5a('0x30')](_0x5a9c92[_0xfe5a('0x2f')]);_0x1a92ef[_0xfe5a('0x31')]=_[_0xfe5a('0x32')](_0x1a92ef[_0xfe5a('0x2e')],_0x1a92ef[_0xfe5a('0x2f')]);_0x1dbb2c[_0xfe5a('0x33')]=_[_0xfe5a('0x32')](_0x1a92ef[_0xfe5a('0x2e')],qs[_0xfe5a('0x34')](_0x5a9c92[_0xfe5a('0x2f')][_0xfe5a('0x34')]));_0x1dbb2c['attributes']=_0x1dbb2c[_0xfe5a('0x33')][_0xfe5a('0x35')]?_0x1dbb2c['attributes']:_0x1a92ef['model'];if(_0x5a9c92[_0xfe5a('0x2f')][_0xfe5a('0x3e')]){_0x1dbb2c[_0xfe5a('0x43')]=[{'all':!![]}];}_0x1dbb2c=_[_0xfe5a('0x3a')]({},_0x1dbb2c,_0x5a9c92[_0xfe5a('0x3d')]);return db[_0xfe5a('0x29')][_0xfe5a('0x44')](_0x1dbb2c)['then'](handleEntityNotFound(_0x5112a9,null))[_0xfe5a('0x22')](respondWithResult(_0x5112a9,null))['catch'](handleError(_0x5112a9,null));};exports[_0xfe5a('0x45')]=function(_0x5a807e,_0x433562){return db[_0xfe5a('0x29')][_0xfe5a('0x45')](_0x5a807e[_0xfe5a('0x46')],{})['then'](function(_0x394073){var _0x3f8447=_0x5a807e['user'][_0xfe5a('0x23')]({'plain':!![]});if(!_0x3f8447)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f8447['role']===_0xfe5a('0x47')){var _0x4e02c9=_0x394073[_0xfe5a('0x23')]({'plain':!![]});var _0x4536ba=_0xfe5a('0x24');return db[_0xfe5a('0x48')]['find']({'where':{'name':_0x4536ba,'userProfileId':_0x3f8447[_0xfe5a('0x49')]},'raw':!![]})['then'](function(_0x34247f){if(_0x34247f&&_0x34247f[_0xfe5a('0x4a')]===0x0){return db[_0xfe5a('0x25')]['create']({'name':_0x4e02c9[_0xfe5a('0x27')],'resourceId':_0x4e02c9['id'],'type':_0x34247f[_0xfe5a('0x27')],'sectionId':_0x34247f['id']},{})['then'](function(){return _0x394073;});}else{return _0x394073;}})[_0xfe5a('0x4b')](function(_0x42f2e2){logger[_0xfe5a('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x42f2e2);throw _0x42f2e2;});}return _0x394073;})[_0xfe5a('0x22')](respondWithResult(_0x433562,0xc9))[_0xfe5a('0x4b')](handleError(_0x433562,null));};exports[_0xfe5a('0x20')]=function(_0x4d3bd8,_0x36395a){if(_0x4d3bd8[_0xfe5a('0x46')]['id']){delete _0x4d3bd8['body']['id'];}return db[_0xfe5a('0x29')]['find']({'where':{'id':_0x4d3bd8[_0xfe5a('0x42')]['id']}})[_0xfe5a('0x22')](handleEntityNotFound(_0x36395a,null))[_0xfe5a('0x22')](saveUpdates(_0x4d3bd8[_0xfe5a('0x46')],null))[_0xfe5a('0x22')](respondWithResult(_0x36395a,null))[_0xfe5a('0x4b')](handleError(_0x36395a,null));};exports[_0xfe5a('0x21')]=function(_0x3432d1,_0x127a9f){return db[_0xfe5a('0x29')][_0xfe5a('0x44')]({'where':{'id':_0x3432d1[_0xfe5a('0x42')]['id']}})[_0xfe5a('0x22')](handleEntityNotFound(_0x127a9f,null))[_0xfe5a('0x22')](db[_0xfe5a('0x4d')][_0xfe5a('0x20')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x3432d1['params']['id']}}))[_0xfe5a('0x22')](removeEntity(_0x127a9f,null))[_0xfe5a('0x4b')](handleError(_0x127a9f,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 0ad2751..1b84184 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 _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 +var _0x77c9=['moment','bluebird','request-promise','path','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x77c9,0x15a));var _0x977c=function(_0x11df66,_0x9eabf){_0x11df66=_0x11df66-0x0;var _0xc2dca1=_0x77c9[_0x11df66];return _0xc2dca1;};'use strict';var _=require(_0x977c('0x0'));var util=require(_0x977c('0x1'));var logger=require(_0x977c('0x2'))(_0x977c('0x3'));var moment=require(_0x977c('0x4'));var BPromise=require(_0x977c('0x5'));var rp=require(_0x977c('0x6'));var fs=require('fs');var path=require(_0x977c('0x7'));var rimraf=require('rimraf');var config=require(_0x977c('0x8'));var attributes=require(_0x977c('0x9'));module[_0x977c('0xa')]=function(_0x4c0d59,_0xc315f2){return _0x4c0d59[_0x977c('0xb')](_0x977c('0xc'),attributes,{'tableName':_0x977c('0xd'),'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 950d890..896db23 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 _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 +var _0x7312=['lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0xd8c401,_0x5e99e4){var _0x4c481c=function(_0x2723bb){while(--_0x2723bb){_0xd8c401['push'](_0xd8c401['shift']());}};_0x4c481c(++_0x5e99e4);}(_0x7312,0xd2));var _0x2731=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x7312[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0x2731('0x0'));var util=require(_0x2731('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2731('0x2'));var fs=require('fs');var Redis=require(_0x2731('0x3'));var db=require(_0x2731('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2731('0x5'));var config=require(_0x2731('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2731('0x7')][_0x2731('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c53e0,_0xdfc86e,_0x37958b){return new BPromise(function(_0x2eaacb,_0x1f6ad0){return client[_0x2731('0x9')](_0x1c53e0,_0x37958b)['then'](function(_0x202491){logger[_0x2731('0xa')](_0x2731('0xb'),_0xdfc86e,_0x2731('0xc'));logger[_0x2731('0xd')](_0x2731('0xe'),_0xdfc86e,_0x2731('0xc'),JSON[_0x2731('0xf')](_0x202491));if(_0x202491['error']){if(_0x202491[_0x2731('0x10')][_0x2731('0x11')]===0x1f4){logger[_0x2731('0x10')]('ContactItemType,\x20%s,\x20%s',_0xdfc86e,_0x202491[_0x2731('0x10')][_0x2731('0x12')]);return _0x1f6ad0(_0x202491[_0x2731('0x10')][_0x2731('0x12')]);}logger[_0x2731('0x10')](_0x2731('0xb'),_0xdfc86e,_0x202491['error'][_0x2731('0x12')]);return _0x2eaacb(_0x202491[_0x2731('0x10')][_0x2731('0x12')]);}else{logger[_0x2731('0xa')](_0x2731('0xb'),_0xdfc86e,'request\x20sent');_0x2eaacb(_0x202491[_0x2731('0x13')][_0x2731('0x12')]);}})[_0x2731('0x14')](function(_0x432b2e){logger[_0x2731('0x10')](_0x2731('0xb'),_0xdfc86e,_0x432b2e);_0x1f6ad0(_0x432b2e);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index ee84910..47e88e0 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 _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 +var _0x1ba4=['Router','fs-extra','../../components/auth/service','./contactItemType.controller','isAuthenticated','index','get','/:id','show','post','create','put','delete','destroy','util','connect-timeout'];(function(_0x21b6f0,_0x3c948){var _0x1ec11a=function(_0x5d6656){while(--_0x5d6656){_0x21b6f0['push'](_0x21b6f0['shift']());}};_0x1ec11a(++_0x3c948);}(_0x1ba4,0x17e));var _0x41ba=function(_0x2b88f2,_0x408c2f){_0x2b88f2=_0x2b88f2-0x0;var _0xbf82a2=_0x1ba4[_0x2b88f2];return _0xbf82a2;};'use strict';var multer=require('multer');var util=require(_0x41ba('0x0'));var path=require('path');var timeout=require(_0x41ba('0x1'));var express=require('express');var router=express[_0x41ba('0x2')]();var fs_extra=require(_0x41ba('0x3'));var auth=require(_0x41ba('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x41ba('0x5'));router['get']('/',auth[_0x41ba('0x6')](),controller[_0x41ba('0x7')]);router[_0x41ba('0x8')](_0x41ba('0x9'),auth[_0x41ba('0x6')](),controller[_0x41ba('0xa')]);router[_0x41ba('0xb')]('/',auth[_0x41ba('0x6')](),controller[_0x41ba('0xc')]);router[_0x41ba('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x41ba('0xe')]('/:id',auth[_0x41ba('0x6')](),controller[_0x41ba('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 857a400..dee3e40 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 _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 +var _0x2032=['name','exports','STRING'];(function(_0x6be126,_0x26d157){var _0x107b3b=function(_0x2506a8){while(--_0x2506a8){_0x6be126['push'](_0x6be126['shift']());}};_0x107b3b(++_0x26d157);}(_0x2032,0xd9));var _0x2203=function(_0x9a1389,_0x3cc13a){_0x9a1389=_0x9a1389-0x0;var _0x2f0e7e=_0x2032[_0x9a1389];return _0x2f0e7e;};'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 c2d71a1..342cf1c 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 _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 +var _0x31fe=['rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','name','send','index','map','Dashboard','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','user','autoAssociation','create','attrUrl','attrs','value','custom','attrPath','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','findOne','rawAttributes','eml-format'];(function(_0x1e1037,_0xd863ef){var _0x156a1a=function(_0x523269){while(--_0x523269){_0x1e1037['push'](_0x1e1037['shift']());}};_0x156a1a(++_0xd863ef);}(_0x31fe,0x173));var _0xe31f=function(_0x1a485b,_0x239fc5){_0x1a485b=_0x1a485b-0x0;var _0x5e17d4=_0x31fe[_0x1a485b];return _0x5e17d4;};'use strict';var emlformat=require(_0xe31f('0x0'));var rimraf=require(_0xe31f('0x1'));var zipdir=require(_0xe31f('0x2'));var jsonpatch=require(_0xe31f('0x3'));var rp=require('request-promise');var moment=require(_0xe31f('0x4'));var BPromise=require(_0xe31f('0x5'));var Mustache=require(_0xe31f('0x6'));var util=require(_0xe31f('0x7'));var path=require(_0xe31f('0x8'));var sox=require(_0xe31f('0x9'));var csv=require('to-csv');var ejs=require(_0xe31f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe31f('0xb'));var squel=require(_0xe31f('0xc'));var crypto=require(_0xe31f('0xd'));var jsforce=require(_0xe31f('0xe'));var deskjs=require(_0xe31f('0xf'));var toCsv=require(_0xe31f('0x10'));var querystring=require('querystring');var Papa=require(_0xe31f('0x11'));var Redis=require(_0xe31f('0x12'));var authService=require(_0xe31f('0x13'));var qs=require(_0xe31f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe31f('0x15'));var licenseUtil=require(_0xe31f('0x16'));var db=require('../../mysqldb')['db'];config[_0xe31f('0x17')]=_['defaults'](config[_0xe31f('0x17')],{'host':_0xe31f('0x18'),'port':0x18eb});var socket=require(_0xe31f('0x19'))(new Redis(config[_0xe31f('0x17')]));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x28b6a2,_0x118528){_0x118528=_0x118528||0xcc;return function(_0x481317){if(_0x481317){return _0x28b6a2[_0xe31f('0x1a')](_0x118528);}return _0x28b6a2[_0xe31f('0x1b')](_0x118528)[_0xe31f('0x1c')]();};}function respondWithResult(_0x440374,_0x2fe3c9){_0x2fe3c9=_0x2fe3c9||0xc8;return function(_0x5b8b4a){if(_0x5b8b4a){return _0x440374[_0xe31f('0x1b')](_0x2fe3c9)[_0xe31f('0x1d')](_0x5b8b4a);}};}function respondWithFilteredResult(_0x5b730f,_0x5ce481){return function(_0x2739b9){if(_0x2739b9){var _0x2eec8e=typeof _0x5ce481[_0xe31f('0x1e')]===_0xe31f('0x1f')&&typeof _0x5ce481[_0xe31f('0x20')]===_0xe31f('0x1f');var _0x45df0a=_0x2739b9[_0xe31f('0x21')];var _0x2cf02c=_0x2eec8e?0x0:_0x5ce481[_0xe31f('0x1e')];var _0x2d8fa7=_0x2eec8e?_0x2739b9['count']:_0x5ce481['offset']+_0x5ce481['limit'];var _0x26fed7;if(_0x2d8fa7>=_0x45df0a){_0x2d8fa7=_0x45df0a;_0x26fed7=0xc8;}else{_0x26fed7=0xce;}_0x5b730f[_0xe31f('0x1b')](_0x26fed7);return _0x5b730f[_0xe31f('0x22')](_0xe31f('0x23'),_0x2cf02c+'-'+_0x2d8fa7+'/'+_0x45df0a)[_0xe31f('0x1d')](_0x2739b9);}return null;};}function patchUpdates(_0x3aecf2){return function(_0x143595){try{jsonpatch[_0xe31f('0x24')](_0x143595,_0x3aecf2,!![]);}catch(_0xd18f03){return BPromise['reject'](_0xd18f03);}return _0x143595[_0xe31f('0x25')]();};}function saveUpdates(_0x52c269,_0x1bda16){return function(_0x15f78f){if(_0x15f78f){return _0x15f78f[_0xe31f('0x26')](_0x52c269)[_0xe31f('0x27')](function(_0x4248a4){return _0x4248a4;});}return null;};}function removeEntity(_0x4b0ac4,_0x117230){return function(_0x33d0db){if(_0x33d0db){return _0x33d0db[_0xe31f('0x28')]()['then'](function(){var _0x5d620f=_0x33d0db[_0xe31f('0x29')]({'plain':!![]});var _0xa1ffe=_0xe31f('0x2a');return db[_0xe31f('0x2b')]['destroy']({'where':{'type':_0xa1ffe,'resourceId':_0x5d620f['id']}})['then'](function(){return _0x33d0db;});})[_0xe31f('0x27')](function(){_0x4b0ac4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bcf11,_0x1fce1d){return function(_0xcb080a){if(!_0xcb080a){_0x4bcf11[_0xe31f('0x1a')](0x194);}return _0xcb080a;};}function handleError(_0x451094,_0x1ba397){_0x1ba397=_0x1ba397||0x1f4;return function(_0x4c6b03){logger[_0xe31f('0x2c')](_0x4c6b03['stack']);if(_0x4c6b03[_0xe31f('0x2d')]){delete _0x4c6b03[_0xe31f('0x2d')];}_0x451094['status'](_0x1ba397)[_0xe31f('0x2e')](_0x4c6b03);};}exports[_0xe31f('0x2f')]=function(_0x317cc0,_0x3b5ea7){var _0x2871f7={},_0x417d9c={},_0x484857={'count':0x0,'rows':[]};var _0x250075=_[_0xe31f('0x30')](db[_0xe31f('0x31')]['rawAttributes'],function(_0x4c8358){return{'name':_0x4c8358[_0xe31f('0x32')],'type':_0x4c8358[_0xe31f('0x33')][_0xe31f('0x34')]};});_0x417d9c[_0xe31f('0x35')]=_[_0xe31f('0x30')](_0x250075,'name');_0x417d9c[_0xe31f('0x36')]=_[_0xe31f('0x37')](_0x317cc0[_0xe31f('0x36')]);_0x417d9c[_0xe31f('0x38')]=_[_0xe31f('0x39')](_0x417d9c['model'],_0x417d9c[_0xe31f('0x36')]);_0x2871f7['attributes']=_[_0xe31f('0x39')](_0x417d9c[_0xe31f('0x35')],qs[_0xe31f('0x3a')](_0x317cc0[_0xe31f('0x36')]['fields']));_0x2871f7[_0xe31f('0x3b')]=_0x2871f7[_0xe31f('0x3b')][_0xe31f('0x3c')]?_0x2871f7[_0xe31f('0x3b')]:_0x417d9c[_0xe31f('0x35')];if(!_0x317cc0['query'][_0xe31f('0x3d')]('nolimit')){_0x2871f7['limit']=qs[_0xe31f('0x20')](_0x317cc0[_0xe31f('0x36')]['limit']);_0x2871f7[_0xe31f('0x1e')]=qs[_0xe31f('0x1e')](_0x317cc0[_0xe31f('0x36')][_0xe31f('0x1e')]);}_0x2871f7[_0xe31f('0x3e')]=qs[_0xe31f('0x3f')](_0x317cc0[_0xe31f('0x36')]['sort']);_0x2871f7[_0xe31f('0x40')]=qs['filters'](_['pick'](_0x317cc0['query'],_0x417d9c['filters']),_0x250075);if(_0x317cc0[_0xe31f('0x36')][_0xe31f('0x41')]){_0x2871f7[_0xe31f('0x40')]=_[_0xe31f('0x42')](_0x2871f7[_0xe31f('0x40')],{'$or':_['map'](_0x250075,function(_0x49905f){if(_0x49905f[_0xe31f('0x33')]!=='VIRTUAL'){var _0x9ed25b={};_0x9ed25b[_0x49905f[_0xe31f('0x2d')]]={'$like':'%'+_0x317cc0['query'][_0xe31f('0x41')]+'%'};return _0x9ed25b;}})});}_0x2871f7=_[_0xe31f('0x42')]({},_0x2871f7,_0x317cc0[_0xe31f('0x43')]);var _0x1109e5={'where':_0x2871f7[_0xe31f('0x40')]};return db[_0xe31f('0x31')]['count'](_0x1109e5)['then'](function(_0x23e44e){_0x484857['count']=_0x23e44e;if(_0x317cc0['query'][_0xe31f('0x44')]){_0x2871f7[_0xe31f('0x45')]=[{'all':!![]}];}return db[_0xe31f('0x31')][_0xe31f('0x46')](_0x2871f7);})['then'](function(_0x5676a2){_0x484857[_0xe31f('0x47')]=_0x5676a2;return _0x484857;})[_0xe31f('0x27')](respondWithFilteredResult(_0x3b5ea7,_0x2871f7))[_0xe31f('0x48')](handleError(_0x3b5ea7,null));};exports[_0xe31f('0x49')]=function(_0x5743ab,_0x305030){var _0x1a24d5={'raw':![],'where':{'id':_0x5743ab[_0xe31f('0x4a')]['id']}},_0x426ddd={};_0x426ddd[_0xe31f('0x35')]=_['keys'](db['Dashboard']['rawAttributes']);_0x426ddd[_0xe31f('0x36')]=_[_0xe31f('0x37')](_0x5743ab[_0xe31f('0x36')]);_0x426ddd[_0xe31f('0x38')]=_['intersection'](_0x426ddd['model'],_0x426ddd[_0xe31f('0x36')]);_0x1a24d5[_0xe31f('0x3b')]=_[_0xe31f('0x39')](_0x426ddd[_0xe31f('0x35')],qs[_0xe31f('0x3a')](_0x5743ab[_0xe31f('0x36')]['fields']));_0x1a24d5[_0xe31f('0x3b')]=_0x1a24d5[_0xe31f('0x3b')][_0xe31f('0x3c')]?_0x1a24d5[_0xe31f('0x3b')]:_0x426ddd[_0xe31f('0x35')];if(_0x5743ab[_0xe31f('0x36')][_0xe31f('0x44')]){_0x1a24d5[_0xe31f('0x45')]=[{'all':!![]}];}_0x1a24d5=_['merge']({},_0x1a24d5,_0x5743ab[_0xe31f('0x43')]);return db[_0xe31f('0x31')][_0xe31f('0x4b')](_0x1a24d5)[_0xe31f('0x27')](handleEntityNotFound(_0x305030,null))['then'](respondWithResult(_0x305030,null))[_0xe31f('0x48')](handleError(_0x305030,null));};exports['create']=function(_0x1d8af7,_0x286cc6){return db[_0xe31f('0x31')]['create'](_0x1d8af7[_0xe31f('0x4c')],{})['then'](function(_0x30abf3){var _0x28248e=_0x1d8af7['user']['get']({'plain':!![]});if(!_0x28248e)throw new Error(_0xe31f('0x4d'));if(_0x28248e[_0xe31f('0x4e')]==='user'){var _0x5c5e56=_0x30abf3[_0xe31f('0x29')]({'plain':!![]});var _0x3fa614=_0xe31f('0x2a');return db[_0xe31f('0x4f')]['find']({'where':{'name':_0x3fa614,'userProfileId':_0x28248e[_0xe31f('0x50')]},'raw':!![]})[_0xe31f('0x27')](function(_0x5e6b85){if(_0x5e6b85&&_0x5e6b85['autoAssociation']===0x0){return db[_0xe31f('0x2b')]['create']({'name':_0x5c5e56[_0xe31f('0x2d')],'resourceId':_0x5c5e56['id'],'type':_0x5e6b85[_0xe31f('0x2d')],'sectionId':_0x5e6b85['id']},{})[_0xe31f('0x27')](function(){return _0x30abf3;});}else{return _0x30abf3;}})['catch'](function(_0x3abcdd){logger[_0xe31f('0x2c')](_0xe31f('0x51'),_0x3abcdd);throw _0x3abcdd;});}return _0x30abf3;})[_0xe31f('0x27')](respondWithResult(_0x286cc6,0xc9))[_0xe31f('0x48')](handleError(_0x286cc6,null));};exports[_0xe31f('0x52')]=function(_0x3c3e61,_0x2fe9a8){var _0x44d142={'where':{'id':_0x3c3e61['params']['id']}},_0x4402eb={};_0x4402eb['model']=_[_0xe31f('0x37')](db[_0xe31f('0x31')]['rawAttributes']);_0x44d142['attributes']=_[_0xe31f('0x39')](_0x4402eb['model'],qs[_0xe31f('0x3a')](_0x3c3e61[_0xe31f('0x36')][_0xe31f('0x3a')]));_0x44d142[_0xe31f('0x3b')]=_0x44d142[_0xe31f('0x3b')]['length']?_0x44d142[_0xe31f('0x3b')]:_0x4402eb['model'];if(_0x3c3e61[_0xe31f('0x36')]['includeAll']){_0x44d142[_0xe31f('0x45')]=[{'all':!![]}];}_0x44d142=_[_0xe31f('0x42')]({},_0x44d142,_0x3c3e61[_0xe31f('0x43')]);return db[_0xe31f('0x31')][_0xe31f('0x4b')](_0x44d142)[_0xe31f('0x27')](handleEntityNotFound(_0x2fe9a8,null))[_0xe31f('0x27')](function(_0x52e0e5){if(_0x52e0e5){var _0x1cf5f2=_0x52e0e5[_0xe31f('0x29')]({'plain':!![]});_0x1cf5f2=qs['omit'](_0x1cf5f2,['id',_0xe31f('0x53'),_0xe31f('0x54')]);_0x3c3e61[_0xe31f('0x4c')]=_['omit'](_0x3c3e61[_0xe31f('0x4c')],['id',_0xe31f('0x53'),_0xe31f('0x54')]);return db['Dashboard']['create'](_[_0xe31f('0x42')](_0x1cf5f2,_0x3c3e61[_0xe31f('0x4c')]),{'include':_0x3c3e61['query'][_0xe31f('0x44')]?[{'all':!![]}]:undefined})['then'](function(_0xbccf96){var _0x5679fc=_0x3c3e61[_0xe31f('0x55')][_0xe31f('0x29')]({'plain':!![]});if(!_0x5679fc)throw new Error(_0xe31f('0x4d'));if(_0x5679fc[_0xe31f('0x4e')]===_0xe31f('0x55')){var _0x12e72d=_0xbccf96['get']({'plain':!![]});var _0x3e1e2d=_0xe31f('0x2a');return db[_0xe31f('0x4f')]['find']({'where':{'name':_0x3e1e2d,'userProfileId':_0x5679fc['userProfileId']},'raw':!![]})[_0xe31f('0x27')](function(_0x295f3c){if(_0x295f3c&&_0x295f3c[_0xe31f('0x56')]===0x0){return db['UserProfileResource'][_0xe31f('0x57')]({'name':_0x12e72d['name'],'resourceId':_0x12e72d['id'],'type':_0x295f3c[_0xe31f('0x2d')],'sectionId':_0x295f3c['id']},{})['then'](function(){return _0xbccf96;});}else{return _0xbccf96;}})[_0xe31f('0x48')](function(_0x508099){logger[_0xe31f('0x2c')](_0xe31f('0x51'),_0x508099);throw _0x508099;});}return _0xbccf96;});}})['then'](respondWithResult(_0x2fe9a8,0xc9))[_0xe31f('0x48')](handleError(_0x2fe9a8,null));};exports[_0xe31f('0x26')]=function(_0x54402e,_0x22d9e7){if(_0x54402e[_0xe31f('0x4c')]['id']){delete _0x54402e['body']['id'];}return db[_0xe31f('0x31')][_0xe31f('0x4b')]({'where':{'id':_0x54402e[_0xe31f('0x4a')]['id']}})[_0xe31f('0x27')](handleEntityNotFound(_0x22d9e7,null))['then'](saveUpdates(_0x54402e[_0xe31f('0x4c')],null))[_0xe31f('0x27')](respondWithResult(_0x22d9e7,null))['catch'](handleError(_0x22d9e7,null));};exports[_0xe31f('0x28')]=function(_0x50894f,_0x17a6ca){return db['Dashboard'][_0xe31f('0x4b')]({'where':{'id':_0x50894f[_0xe31f('0x4a')]['id']}})[_0xe31f('0x27')](handleEntityNotFound(_0x17a6ca,null))['then'](removeEntity(_0x17a6ca,null))[_0xe31f('0x48')](handleError(_0x17a6ca,null));};function widgetAttributes(_0x53d774){try{switch(_0x53d774['type']){case'iframe':return[{'name':_0xe31f('0x58'),'value':_0x53d774[_0xe31f('0x58')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774[_0xe31f('0x59')][0x0]?_0x53d774[_0xe31f('0x59')][0x0][_0xe31f('0x5a')]:undefined)||'https://'}];case _0xe31f('0x5b'):return[{'name':_0xe31f('0x5c'),'value':_0x53d774[_0xe31f('0x5c')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774['attrs'][0x0]?_0x53d774['attrs'][0x0][_0xe31f('0x5a')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x53d774[_0xe31f('0x5d')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774[_0xe31f('0x59')][0x0]?_0x53d774[_0xe31f('0x59')][0x0][_0xe31f('0x5a')]:undefined)||'HH:mm:ss'},{'name':_0xe31f('0x5e'),'value':_0x53d774[_0xe31f('0x5e')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774[_0xe31f('0x59')][0x1]?_0x53d774[_0xe31f('0x59')][0x1][_0xe31f('0x5a')]:undefined)||_0xe31f('0x5f')},{'name':'attrFontSize','value':_0x53d774[_0xe31f('0x60')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774[_0xe31f('0x59')][0x2]?_0x53d774[_0xe31f('0x59')][0x2][_0xe31f('0x5a')]:undefined)||0xc}];case'counter':return[{'name':_0xe31f('0x61'),'value':_0x53d774[_0xe31f('0x61')]||(_0x53d774['attrs']&&_0x53d774[_0xe31f('0x59')][0x0]?_0x53d774[_0xe31f('0x59')][0x0][_0xe31f('0x5a')]:undefined)||_0xe31f('0x62')},{'name':'attrVoiceQueues','value':_0x53d774[_0xe31f('0x63')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774['attrs'][0x1]?_0x53d774['attrs'][0x1][_0xe31f('0x5a')]:undefined)||[]},{'name':_0xe31f('0x60'),'value':_0x53d774['attrFontSize']||(_0x53d774[_0xe31f('0x59')]&&_0x53d774[_0xe31f('0x59')][0x2]?_0x53d774['attrs'][0x2][_0xe31f('0x5a')]:undefined)||0x14},{'name':_0xe31f('0x64'),'value':_0x53d774[_0xe31f('0x64')]||(_0x53d774['attrs']&&_0x53d774['attrs'][0x3]?_0x53d774['attrs'][0x3]['value']:undefined)||'voice'},{'name':_0xe31f('0x65'),'value':_0x53d774[_0xe31f('0x65')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774['attrs'][0x4]?_0x53d774[_0xe31f('0x59')][0x4][_0xe31f('0x5a')]:undefined)||''},{'name':_0xe31f('0x66'),'value':_0x53d774[_0xe31f('0x66')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774['attrs'][0x5]?_0x53d774[_0xe31f('0x59')][0x5]['value']:undefined)||''},{'name':_0xe31f('0x67'),'value':_0x53d774['attrSmsAccounts']||(_0x53d774[_0xe31f('0x59')]&&_0x53d774[_0xe31f('0x59')][0x6]?_0x53d774['attrs'][0x6][_0xe31f('0x5a')]:undefined)||''},{'name':_0xe31f('0x68'),'value':_0x53d774[_0xe31f('0x68')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774[_0xe31f('0x59')][0x7]?_0x53d774[_0xe31f('0x59')][0x7][_0xe31f('0x5a')]:undefined)||''},{'name':_0xe31f('0x69'),'value':_0x53d774[_0xe31f('0x69')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774[_0xe31f('0x59')][0x8]?_0x53d774[_0xe31f('0x59')][0x8][_0xe31f('0x5a')]:undefined)||''},{'name':'attrChatWebsites','value':_0x53d774[_0xe31f('0x6a')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774[_0xe31f('0x59')][0x9]?_0x53d774[_0xe31f('0x59')][0x9][_0xe31f('0x5a')]:undefined)||''}];case _0xe31f('0x6b'):case _0xe31f('0x6c'):return[{'name':_0xe31f('0x6d'),'value':_0x53d774['attrSerie1']||(_0x53d774[_0xe31f('0x59')]&&_0x53d774[_0xe31f('0x59')][0x0]?_0x53d774[_0xe31f('0x59')][0x0][_0xe31f('0x5a')]:undefined)||_0xe31f('0x62')},{'name':_0xe31f('0x6e'),'value':_0x53d774[_0xe31f('0x6e')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774['attrs'][0x1]?_0x53d774[_0xe31f('0x59')][0x1][_0xe31f('0x5a')]:undefined)||null},{'name':_0xe31f('0x6f'),'value':_0x53d774[_0xe31f('0x6f')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774[_0xe31f('0x59')][0x2]?_0x53d774[_0xe31f('0x59')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x53d774[_0xe31f('0x63')]||(_0x53d774['attrs']&&_0x53d774[_0xe31f('0x59')][0x3]?_0x53d774['attrs'][0x3][_0xe31f('0x5a')]:undefined)||[]},{'name':_0xe31f('0x64'),'value':_0x53d774[_0xe31f('0x64')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774[_0xe31f('0x59')][0x4]?_0x53d774['attrs'][0x4][_0xe31f('0x5a')]:undefined)||_0xe31f('0x70')},{'name':'attrEmailAccounts','value':_0x53d774[_0xe31f('0x65')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774[_0xe31f('0x59')][0x5]?_0x53d774[_0xe31f('0x59')][0x5][_0xe31f('0x5a')]:undefined)||''},{'name':_0xe31f('0x66'),'value':_0x53d774[_0xe31f('0x66')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774[_0xe31f('0x59')][0x6]?_0x53d774[_0xe31f('0x59')][0x6][_0xe31f('0x5a')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x53d774[_0xe31f('0x67')]||(_0x53d774['attrs']&&_0x53d774[_0xe31f('0x59')][0x7]?_0x53d774[_0xe31f('0x59')][0x7][_0xe31f('0x5a')]:undefined)||''},{'name':_0xe31f('0x68'),'value':_0x53d774[_0xe31f('0x68')]||(_0x53d774['attrs']&&_0x53d774['attrs'][0x8]?_0x53d774[_0xe31f('0x59')][0x8][_0xe31f('0x5a')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x53d774['attrWhatsappAccounts']||(_0x53d774['attrs']&&_0x53d774[_0xe31f('0x59')][0x9]?_0x53d774[_0xe31f('0x59')][0x9]['value']:undefined)||''},{'name':_0xe31f('0x6a'),'value':_0x53d774[_0xe31f('0x6a')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774['attrs'][0xa]?_0x53d774[_0xe31f('0x59')][0xa][_0xe31f('0x5a')]:undefined)||''}];case _0xe31f('0x71'):return[{'name':'attrReport','type':_0x53d774[_0xe31f('0x72')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774[_0xe31f('0x59')][0x0]?_0x53d774[_0xe31f('0x59')][0x0][_0xe31f('0x33')]:undefined)||null,'value':_0x53d774[_0xe31f('0x73')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774['attrs'][0x0]?_0x53d774[_0xe31f('0x59')][0x0]['value']:undefined)||null},{'name':_0xe31f('0x74'),'value':_0x53d774[_0xe31f('0x74')]||(_0x53d774[_0xe31f('0x59')]&&_0x53d774[_0xe31f('0x59')][0x1]?_0x53d774[_0xe31f('0x59')][0x1][_0xe31f('0x5a')]:undefined)||0x0}];default:return[];}}catch(_0x5f0db2){logger[_0xe31f('0x2c')](_0xe31f('0x75'),JSON[_0xe31f('0x76')](_0x5f0db2));return[];}}exports[_0xe31f('0x77')]=function(_0x2fd048,_0x7993ee,_0x1301fc){if(_0x2fd048[_0xe31f('0x4c')]['id']){delete _0x2fd048[_0xe31f('0x4c')]['id'];}return db[_0xe31f('0x31')]['find']({'where':{'id':_0x2fd048['params']['id']}})['then'](handleEntityNotFound(_0x7993ee,null))['then'](function(_0x32844b){if(_0x32844b){_0x2fd048['body']['DashboardId']=_0x32844b['id'];_0x2fd048[_0xe31f('0x4c')][_0xe31f('0x59')]=widgetAttributes(_0x2fd048[_0xe31f('0x4c')]);return db[_0xe31f('0x78')][_0xe31f('0x57')](_0x2fd048['body']);}})[_0xe31f('0x27')](respondWithResult(_0x7993ee,null))[_0xe31f('0x48')](handleError(_0x7993ee,null));};exports[_0xe31f('0x79')]=function(_0xb3d13f,_0x3f05f7,_0x2878e1){var _0x36db0f={};var _0x481891={};var _0x41f098;var _0xa1ecc4;return db[_0xe31f('0x31')][_0xe31f('0x7a')]({'where':{'id':_0xb3d13f[_0xe31f('0x4a')]['id']}})[_0xe31f('0x27')](handleEntityNotFound(_0x3f05f7,null))['then'](function(_0x6cb8d5){if(_0x6cb8d5){_0x41f098=_0x6cb8d5;_0x481891[_0xe31f('0x35')]=_[_0xe31f('0x37')](db[_0xe31f('0x78')][_0xe31f('0x7b')]);_0x481891['query']=_[_0xe31f('0x37')](_0xb3d13f[_0xe31f('0x36')]);_0x481891['filters']=_[_0xe31f('0x39')](_0x481891['model'],_0x481891[_0xe31f('0x36')]);_0x36db0f['attributes']=_[_0xe31f('0x39')](_0x481891[_0xe31f('0x35')],qs[_0xe31f('0x3a')](_0xb3d13f[_0xe31f('0x36')]['fields']));_0x36db0f[_0xe31f('0x3b')]=_0x36db0f[_0xe31f('0x3b')][_0xe31f('0x3c')]?_0x36db0f['attributes']:_0x481891['model'];_0x36db0f[_0xe31f('0x3e')]=qs[_0xe31f('0x3f')](_0xb3d13f[_0xe31f('0x36')]['sort']);_0x36db0f[_0xe31f('0x40')]=qs[_0xe31f('0x38')](_['pick'](_0xb3d13f[_0xe31f('0x36')],_0x481891[_0xe31f('0x38')]));if(_0xb3d13f['query'][_0xe31f('0x41')]){_0x36db0f[_0xe31f('0x40')]=_[_0xe31f('0x42')](_0x36db0f[_0xe31f('0x40')],{'$or':_[_0xe31f('0x30')](_0x36db0f[_0xe31f('0x3b')],function(_0x2d195c){var _0x452a7d={};_0x452a7d[_0x2d195c]={'$like':'%'+_0xb3d13f['query']['filter']+'%'};return _0x452a7d;})});}_0x36db0f=_[_0xe31f('0x42')]({},_0x36db0f,_0xb3d13f['options']);return _0x41f098[_0xe31f('0x79')](_0x36db0f);}})[_0xe31f('0x27')](function(_0x474224){if(_0x474224){_0xa1ecc4=_0x474224['length'];if(!_0xb3d13f[_0xe31f('0x36')]['hasOwnProperty']('nolimit')){_0x36db0f[_0xe31f('0x20')]=qs['limit'](_0xb3d13f[_0xe31f('0x36')][_0xe31f('0x20')]);_0x36db0f[_0xe31f('0x1e')]=qs['offset'](_0xb3d13f['query'][_0xe31f('0x1e')]);}return _0x41f098['getItems'](_0x36db0f);}})['then'](function(_0x2eff98){if(_0x2eff98){return _0x2eff98?{'count':_0xa1ecc4,'rows':_0x2eff98}:null;}})[_0xe31f('0x27')](respondWithResult(_0x3f05f7,null))[_0xe31f('0x48')](handleError(_0x3f05f7,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 2b07670..24f74d0 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 _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 +var _0x3784=['../../mysqldb','Dashboard','setMaxListeners','save','remove','hasOwnProperty','exports','events'];(function(_0x5d4eff,_0x5ae22c){var _0xc4a902=function(_0x490247){while(--_0x490247){_0x5d4eff['push'](_0x5d4eff['shift']());}};_0xc4a902(++_0x5ae22c);}(_0x3784,0x16f));var _0x4378=function(_0x15039,_0x30581f){_0x15039=_0x15039-0x0;var _0x33f410=_0x3784[_0x15039];return _0x33f410;};'use strict';var EventEmitter=require(_0x4378('0x0'));var Dashboard=require(_0x4378('0x1'))['db'][_0x4378('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x4378('0x3')](0x0);var events={'afterCreate':_0x4378('0x4'),'afterUpdate':'update','afterDestroy':_0x4378('0x5')};function emitEvent(_0x2e4a13){return function(_0x13c237,_0x9f63f4,_0x5e7920){DashboardEvents['emit'](_0x2e4a13+':'+_0x13c237['id'],_0x13c237);DashboardEvents['emit'](_0x2e4a13,_0x13c237);_0x5e7920(null);};}for(var e in events){if(events[_0x4378('0x6')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x4378('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index cb7fb1c..0567488 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 _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 +var _0x5e28=['define','Dashboard','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./dashboard.attributes','exports'];(function(_0x3f8a6b,_0x1412b0){var _0x467399=function(_0x3959c7){while(--_0x3959c7){_0x3f8a6b['push'](_0x3f8a6b['shift']());}};_0x467399(++_0x1412b0);}(_0x5e28,0x157));var _0x85e2=function(_0x31b5b2,_0x5ab927){_0x31b5b2=_0x31b5b2-0x0;var _0x364f13=_0x5e28[_0x31b5b2];return _0x364f13;};'use strict';var _=require('lodash');var util=require(_0x85e2('0x0'));var logger=require(_0x85e2('0x1'))(_0x85e2('0x2'));var moment=require('moment');var BPromise=require(_0x85e2('0x3'));var rp=require(_0x85e2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x85e2('0x5'));var config=require(_0x85e2('0x6'));var attributes=require(_0x85e2('0x7'));module[_0x85e2('0x8')]=function(_0x1ce7ac,_0x4f06bd){return _0x1ce7ac[_0x85e2('0x9')](_0x85e2('0xa'),attributes,{'tableName':'dashboards','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 4a2dd3f..20ff827 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 _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 +var _0xe5b9=['../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x111e94,_0x31c837){var _0x3de107=function(_0x65bd1e){while(--_0x65bd1e){_0x111e94['push'](_0x111e94['shift']());}};_0x3de107(++_0x31c837);}(_0xe5b9,0x7b));var _0x9e5b=function(_0x5de383,_0xec2e74){_0x5de383=_0x5de383-0x0;var _0x2024fb=_0xe5b9[_0x5de383];return _0x2024fb;};'use strict';var _=require(_0x9e5b('0x0'));var util=require(_0x9e5b('0x1'));var moment=require('moment');var BPromise=require(_0x9e5b('0x2'));var rs=require(_0x9e5b('0x3'));var fs=require('fs');var Redis=require(_0x9e5b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9e5b('0x5'));var logger=require('../../config/logger')(_0x9e5b('0x6'));var config=require(_0x9e5b('0x7'));var jayson=require(_0x9e5b('0x8'));var client=jayson[_0x9e5b('0x9')][_0x9e5b('0xa')]({'port':0x232a});config[_0x9e5b('0xb')]=_[_0x9e5b('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9e5b('0xd'))(new Redis(config['redis']));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x4500c9,_0x6ea3c9,_0x412253){return new BPromise(function(_0x2ea5fd,_0x2de380){return client[_0x9e5b('0xe')](_0x4500c9,_0x412253)[_0x9e5b('0xf')](function(_0x3358ba){logger[_0x9e5b('0x10')](_0x9e5b('0x11'),_0x6ea3c9,_0x9e5b('0x12'));logger[_0x9e5b('0x13')](_0x9e5b('0x14'),_0x6ea3c9,'request\x20sent',JSON[_0x9e5b('0x15')](_0x3358ba));if(_0x3358ba[_0x9e5b('0x16')]){if(_0x3358ba[_0x9e5b('0x16')][_0x9e5b('0x17')]===0x1f4){logger['error'](_0x9e5b('0x11'),_0x6ea3c9,_0x3358ba[_0x9e5b('0x16')][_0x9e5b('0x18')]);return _0x2de380(_0x3358ba[_0x9e5b('0x16')][_0x9e5b('0x18')]);}logger['error'](_0x9e5b('0x11'),_0x6ea3c9,_0x3358ba[_0x9e5b('0x16')][_0x9e5b('0x18')]);return _0x2ea5fd(_0x3358ba[_0x9e5b('0x16')][_0x9e5b('0x18')]);}else{logger[_0x9e5b('0x10')](_0x9e5b('0x11'),_0x6ea3c9,_0x9e5b('0x12'));_0x2ea5fd(_0x3358ba[_0x9e5b('0x19')][_0x9e5b('0x18')]);}})['catch'](function(_0x4e0185){logger[_0x9e5b('0x16')](_0x9e5b('0x11'),_0x6ea3c9,_0x4e0185);_0x2de380(_0x4e0185);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 6920ce4..de787ec 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 _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 +var _0x81ee=['emit','length','dashboard:','./dashboard.events','save','remove','update'];(function(_0x1f507f,_0x4b3542){var _0x58d038=function(_0x688d71){while(--_0x688d71){_0x1f507f['push'](_0x1f507f['shift']());}};_0x58d038(++_0x4b3542);}(_0x81ee,0x161));var _0xe81e=function(_0x4f8e3e,_0xbea39){_0x4f8e3e=_0x4f8e3e-0x0;var _0x40b0eb=_0x81ee[_0x4f8e3e];return _0x40b0eb;};'use strict';var DashboardEvents=require(_0xe81e('0x0'));var events=[_0xe81e('0x1'),_0xe81e('0x2'),_0xe81e('0x3')];function createListener(_0x1f30a5,_0x2a4f95){return function(_0x29db74){_0x2a4f95[_0xe81e('0x4')](_0x1f30a5,_0x29db74);};}function removeListener(_0x4975a0,_0x76a77d){return function(){DashboardEvents['removeListener'](_0x4975a0,_0x76a77d);};}exports['register']=function(_0x5e2c94){for(var _0xa09feb=0x0,_0x22a878=events[_0xe81e('0x5')];_0xa09feb<_0x22a878;_0xa09feb++){var _0x4f5152=events[_0xa09feb];var _0xc9eb1e=createListener(_0xe81e('0x6')+_0x4f5152,_0x5e2c94);DashboardEvents['on'](_0x4f5152,_0xc9eb1e);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index b512792..f51990d 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 _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 +var _0x5fbb=['isAuthenticated','show','getItems','create','post','/:id/clone','clone','/:id/items','addItem','put','delete','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','index','get','/:id'];(function(_0x53afa6,_0x59e786){var _0x51f86a=function(_0x368385){while(--_0x368385){_0x53afa6['push'](_0x53afa6['shift']());}};_0x51f86a(++_0x59e786);}(_0x5fbb,0xd2));var _0xb5fb=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5fbb[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0xb5fb('0x0'));var util=require('util');var path=require(_0xb5fb('0x1'));var timeout=require(_0xb5fb('0x2'));var express=require(_0xb5fb('0x3'));var router=express[_0xb5fb('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb5fb('0x5'));var config=require(_0xb5fb('0x6'));var controller=require('./dashboard.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb5fb('0x7')]);router[_0xb5fb('0x8')](_0xb5fb('0x9'),auth[_0xb5fb('0xa')](),controller[_0xb5fb('0xb')]);router['get']('/:id/items',auth[_0xb5fb('0xa')](),controller[_0xb5fb('0xc')]);router['post']('/',auth[_0xb5fb('0xa')](),controller[_0xb5fb('0xd')]);router[_0xb5fb('0xe')](_0xb5fb('0xf'),auth[_0xb5fb('0xa')](),controller[_0xb5fb('0x10')]);router[_0xb5fb('0xe')](_0xb5fb('0x11'),auth[_0xb5fb('0xa')](),controller[_0xb5fb('0x12')]);router[_0xb5fb('0x13')](_0xb5fb('0x9'),auth[_0xb5fb('0xa')](),controller['update']);router[_0xb5fb('0x14')](_0xb5fb('0x9'),auth[_0xb5fb('0xa')](),controller['destroy']);module[_0xb5fb('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index f3539c0..87f7436 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 _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 +var _0x6d38=['INTEGER','STRING','#2196f3','squel','lodash','exports','TEXT','parse','getDataValue','attrs','setDataValue','stringify'];(function(_0x53fa52,_0x265b56){var _0x58e010=function(_0x576649){while(--_0x576649){_0x53fa52['push'](_0x53fa52['shift']());}};_0x58e010(++_0x265b56);}(_0x6d38,0x1ef));var _0x86d3=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x6d38[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x86d3('0x0'));var _=require(_0x86d3('0x1'));module[_0x86d3('0x2')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x86d3('0x3')]('long'),'get':function(){try{return JSON[_0x86d3('0x4')](this[_0x86d3('0x5')](_0x86d3('0x6')));}catch(_0x4ef557){return[];}},'set':function(_0x2d8272){try{this[_0x86d3('0x7')](_0x86d3('0x6'),JSON[_0x86d3('0x8')](_0x2d8272));}catch(_0x47e654){this['setDataValue'](_0x86d3('0x6'),JSON[_0x86d3('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x86d3('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x86d3('0x9')]},'background':{'type':Sequelize[_0x86d3('0xa')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x86d3('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x86d3('0xa')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index df9fa6f..945a198 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 _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 +var _0xab3f=['attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','update','then','error','stack','name','send','params','keys','rawAttributes','query','filters','intersection','model','fields','attributes','length','includeAll','include','options','DashboardItem','find','destroy','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','total','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts'];(function(_0x1d4f5c,_0x293cdc){var _0x1e7e7c=function(_0x30f7fd){while(--_0x30f7fd){_0x1d4f5c['push'](_0x1d4f5c['shift']());}};_0x1e7e7c(++_0x293cdc);}(_0xab3f,0x72));var _0xfab3=function(_0x1d87a7,_0x5b6526){_0x1d87a7=_0x1d87a7-0x0;var _0xd46ae0=_0xab3f[_0x1d87a7];return _0xd46ae0;};'use strict';var emlformat=require(_0xfab3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfab3('0x1'));var jsonpatch=require(_0xfab3('0x2'));var rp=require(_0xfab3('0x3'));var moment=require(_0xfab3('0x4'));var BPromise=require(_0xfab3('0x5'));var Mustache=require(_0xfab3('0x6'));var util=require(_0xfab3('0x7'));var path=require(_0xfab3('0x8'));var sox=require(_0xfab3('0x9'));var csv=require(_0xfab3('0xa'));var ejs=require(_0xfab3('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfab3('0xc'));var squel=require(_0xfab3('0xd'));var crypto=require(_0xfab3('0xe'));var jsforce=require(_0xfab3('0xf'));var deskjs=require(_0xfab3('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfab3('0x11'));var Redis=require('ioredis');var authService=require(_0xfab3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfab3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfab3('0x14'))(_0xfab3('0x15'));var utils=require(_0xfab3('0x16'));var config=require(_0xfab3('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xfab3('0x18')](config[_0xfab3('0x19')],{'host':_0xfab3('0x1a'),'port':0x18eb});var socket=require(_0xfab3('0x1b'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0xfab3('0x1c')](socket);function respondWithStatusCode(_0x21b629,_0x5912b6){_0x5912b6=_0x5912b6||0xcc;return function(_0x237685){if(_0x237685){return _0x21b629[_0xfab3('0x1d')](_0x5912b6);}return _0x21b629[_0xfab3('0x1e')](_0x5912b6)[_0xfab3('0x1f')]();};}function respondWithResult(_0xd76ff9,_0x5d9ea1){_0x5d9ea1=_0x5d9ea1||0xc8;return function(_0x584115){if(_0x584115){return _0xd76ff9[_0xfab3('0x1e')](_0x5d9ea1)[_0xfab3('0x20')](_0x584115);}};}function respondWithFilteredResult(_0x3d3d77,_0xaac714){return function(_0x3d08b1){if(_0x3d08b1){var _0x23cd33=typeof _0xaac714[_0xfab3('0x21')]===_0xfab3('0x22')&&typeof _0xaac714[_0xfab3('0x23')]==='undefined';var _0x516fcc=_0x3d08b1[_0xfab3('0x24')];var _0x129e58=_0x23cd33?0x0:_0xaac714[_0xfab3('0x21')];var _0x4944c5=_0x23cd33?_0x3d08b1[_0xfab3('0x24')]:_0xaac714[_0xfab3('0x21')]+_0xaac714[_0xfab3('0x23')];var _0x1200f7;if(_0x4944c5>=_0x516fcc){_0x4944c5=_0x516fcc;_0x1200f7=0xc8;}else{_0x1200f7=0xce;}_0x3d3d77[_0xfab3('0x1e')](_0x1200f7);return _0x3d3d77['set']('Content-Range',_0x129e58+'-'+_0x4944c5+'/'+_0x516fcc)['json'](_0x3d08b1);}return null;};}function patchUpdates(_0x41f624){return function(_0x1d6de4){try{jsonpatch[_0xfab3('0x25')](_0x1d6de4,_0x41f624,!![]);}catch(_0x2e6fd3){return BPromise['reject'](_0x2e6fd3);}return _0x1d6de4[_0xfab3('0x26')]();};}function saveUpdates(_0x3f1688,_0x37265e){return function(_0x10699f){if(_0x10699f){return _0x10699f[_0xfab3('0x27')](_0x3f1688)['then'](function(_0x56516e){return _0x56516e;});}return null;};}function removeEntity(_0x4765fb,_0x1d6394){return function(_0x53de31){if(_0x53de31){return _0x53de31['destroy']()[_0xfab3('0x28')](function(){_0x4765fb[_0xfab3('0x1e')](0xcc)[_0xfab3('0x1f')]();});}};}function handleEntityNotFound(_0x55689d,_0x133d2b){return function(_0x2383bb){if(!_0x2383bb){_0x55689d[_0xfab3('0x1d')](0x194);}return _0x2383bb;};}function handleError(_0x2a189a,_0x504444){_0x504444=_0x504444||0x1f4;return function(_0x215105){logger[_0xfab3('0x29')](_0x215105[_0xfab3('0x2a')]);if(_0x215105[_0xfab3('0x2b')]){delete _0x215105[_0xfab3('0x2b')];}_0x2a189a[_0xfab3('0x1e')](_0x504444)[_0xfab3('0x2c')](_0x215105);};}exports['show']=function(_0xb6b6ce,_0xdb1d59){var _0x1ae467={'raw':![],'where':{'id':_0xb6b6ce[_0xfab3('0x2d')]['id']}},_0x43fdab={};_0x43fdab['model']=_[_0xfab3('0x2e')](db['DashboardItem'][_0xfab3('0x2f')]);_0x43fdab[_0xfab3('0x30')]=_['keys'](_0xb6b6ce[_0xfab3('0x30')]);_0x43fdab[_0xfab3('0x31')]=_[_0xfab3('0x32')](_0x43fdab[_0xfab3('0x33')],_0x43fdab[_0xfab3('0x30')]);_0x1ae467['attributes']=_[_0xfab3('0x32')](_0x43fdab[_0xfab3('0x33')],qs[_0xfab3('0x34')](_0xb6b6ce[_0xfab3('0x30')][_0xfab3('0x34')]));_0x1ae467[_0xfab3('0x35')]=_0x1ae467[_0xfab3('0x35')][_0xfab3('0x36')]?_0x1ae467[_0xfab3('0x35')]:_0x43fdab['model'];if(_0xb6b6ce['query'][_0xfab3('0x37')]){_0x1ae467[_0xfab3('0x38')]=[{'all':!![]}];}_0x1ae467=_['merge']({},_0x1ae467,_0xb6b6ce[_0xfab3('0x39')]);return db[_0xfab3('0x3a')][_0xfab3('0x3b')](_0x1ae467)[_0xfab3('0x28')](handleEntityNotFound(_0xdb1d59,null))[_0xfab3('0x28')](respondWithResult(_0xdb1d59,null))['catch'](handleError(_0xdb1d59,null));};exports[_0xfab3('0x3c')]=function(_0xcc2b6c,_0x6d9ba3){return db['DashboardItem']['find']({'where':{'id':_0xcc2b6c['params']['id']}})['then'](handleEntityNotFound(_0x6d9ba3,null))[_0xfab3('0x28')](removeEntity(_0x6d9ba3,null))[_0xfab3('0x3d')](handleError(_0x6d9ba3,null));};function widgetAttributes(_0x2438a0){try{switch(_0x2438a0[_0xfab3('0x3e')]){case _0xfab3('0x3f'):return[{'name':_0xfab3('0x40'),'value':_0x2438a0[_0xfab3('0x40')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x0]?_0x2438a0[_0xfab3('0x41')][0x0][_0xfab3('0x42')]:undefined)||_0xfab3('0x43')}];case _0xfab3('0x44'):return[{'name':_0xfab3('0x45'),'value':_0x2438a0['attrPath']||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x0]?_0x2438a0[_0xfab3('0x41')][0x0][_0xfab3('0x42')]:undefined)||''}];case _0xfab3('0x46'):return[{'name':_0xfab3('0x47'),'value':_0x2438a0[_0xfab3('0x47')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x0]?_0x2438a0[_0xfab3('0x41')][0x0][_0xfab3('0x42')]:undefined)||'HH:mm:ss'},{'name':_0xfab3('0x48'),'value':_0x2438a0[_0xfab3('0x48')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x1]?_0x2438a0[_0xfab3('0x41')][0x1][_0xfab3('0x42')]:undefined)||'0.00'},{'name':_0xfab3('0x49'),'value':_0x2438a0[_0xfab3('0x49')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x2]?_0x2438a0['attrs'][0x2][_0xfab3('0x42')]:undefined)||0xc}];case _0xfab3('0x4a'):return[{'name':_0xfab3('0x4b'),'value':_0x2438a0['attrMetric']||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x0]?_0x2438a0['attrs'][0x0][_0xfab3('0x42')]:undefined)||_0xfab3('0x4c')},{'name':'attrVoiceQueues','value':_0x2438a0['attrVoiceQueues']||(_0x2438a0['attrs']&&_0x2438a0['attrs'][0x1]?_0x2438a0[_0xfab3('0x41')][0x1][_0xfab3('0x42')]:undefined)||[]},{'name':'attrFontSize','value':_0x2438a0[_0xfab3('0x49')]||(_0x2438a0['attrs']&&_0x2438a0['attrs'][0x2]?_0x2438a0[_0xfab3('0x41')][0x2][_0xfab3('0x42')]:undefined)||0x14},{'name':_0xfab3('0x4d'),'value':_0x2438a0['attrChannel']||(_0x2438a0['attrs']&&_0x2438a0[_0xfab3('0x41')][0x3]?_0x2438a0[_0xfab3('0x41')][0x3][_0xfab3('0x42')]:undefined)||_0xfab3('0x4e')},{'name':_0xfab3('0x4f'),'value':_0x2438a0[_0xfab3('0x4f')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x4]?_0x2438a0[_0xfab3('0x41')][0x4][_0xfab3('0x42')]:undefined)||''},{'name':_0xfab3('0x50'),'value':_0x2438a0[_0xfab3('0x50')]||(_0x2438a0['attrs']&&_0x2438a0[_0xfab3('0x41')][0x5]?_0x2438a0['attrs'][0x5][_0xfab3('0x42')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x2438a0[_0xfab3('0x51')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0['attrs'][0x6]?_0x2438a0[_0xfab3('0x41')][0x6][_0xfab3('0x42')]:undefined)||''},{'name':_0xfab3('0x52'),'value':_0x2438a0[_0xfab3('0x52')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0['attrs'][0x7]?_0x2438a0['attrs'][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2438a0[_0xfab3('0x53')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x8]?_0x2438a0[_0xfab3('0x41')][0x8][_0xfab3('0x42')]:undefined)||''},{'name':_0xfab3('0x54'),'value':_0x2438a0['attrChatWebsites']||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x9]?_0x2438a0[_0xfab3('0x41')][0x9]['value']:undefined)||''}];case _0xfab3('0x55'):case'pie-chart':return[{'name':_0xfab3('0x56'),'value':_0x2438a0['attrSerie1']||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x0]?_0x2438a0[_0xfab3('0x41')][0x0][_0xfab3('0x42')]:undefined)||_0xfab3('0x4c')},{'name':_0xfab3('0x57'),'value':_0x2438a0['attrSerie2']||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x1]?_0x2438a0[_0xfab3('0x41')][0x1][_0xfab3('0x42')]:undefined)||null},{'name':_0xfab3('0x58'),'value':_0x2438a0['attrSerie3']||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0['attrs'][0x2]?_0x2438a0[_0xfab3('0x41')][0x2][_0xfab3('0x42')]:undefined)||null},{'name':_0xfab3('0x59'),'value':_0x2438a0[_0xfab3('0x59')]||(_0x2438a0['attrs']&&_0x2438a0[_0xfab3('0x41')][0x3]?_0x2438a0['attrs'][0x3]['value']:undefined)||[]},{'name':_0xfab3('0x4d'),'value':_0x2438a0[_0xfab3('0x4d')]||(_0x2438a0['attrs']&&_0x2438a0[_0xfab3('0x41')][0x4]?_0x2438a0[_0xfab3('0x41')][0x4]['value']:undefined)||_0xfab3('0x4e')},{'name':_0xfab3('0x4f'),'value':_0x2438a0[_0xfab3('0x4f')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x5]?_0x2438a0[_0xfab3('0x41')][0x5][_0xfab3('0x42')]:undefined)||''},{'name':_0xfab3('0x50'),'value':_0x2438a0[_0xfab3('0x50')]||(_0x2438a0['attrs']&&_0x2438a0[_0xfab3('0x41')][0x6]?_0x2438a0[_0xfab3('0x41')][0x6][_0xfab3('0x42')]:undefined)||''},{'name':_0xfab3('0x51'),'value':_0x2438a0[_0xfab3('0x51')]||(_0x2438a0['attrs']&&_0x2438a0['attrs'][0x7]?_0x2438a0[_0xfab3('0x41')][0x7][_0xfab3('0x42')]:undefined)||''},{'name':_0xfab3('0x52'),'value':_0x2438a0['attrOpenchannelAccounts']||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0['attrs'][0x8]?_0x2438a0[_0xfab3('0x41')][0x8][_0xfab3('0x42')]:undefined)||''},{'name':_0xfab3('0x53'),'value':_0x2438a0[_0xfab3('0x53')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x9]?_0x2438a0[_0xfab3('0x41')][0x9][_0xfab3('0x42')]:undefined)||''},{'name':_0xfab3('0x54'),'value':_0x2438a0[_0xfab3('0x54')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0xa]?_0x2438a0['attrs'][0xa][_0xfab3('0x42')]:undefined)||''}];case _0xfab3('0x5a'):return[{'name':_0xfab3('0x5b'),'type':_0x2438a0[_0xfab3('0x5c')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x0]?_0x2438a0['attrs'][0x0][_0xfab3('0x3e')]:undefined)||null,'value':_0x2438a0[_0xfab3('0x5b')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x0]?_0x2438a0[_0xfab3('0x41')][0x0]['value']:undefined)||null},{'name':_0xfab3('0x5d'),'value':_0x2438a0[_0xfab3('0x5d')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x1]?_0x2438a0[_0xfab3('0x41')][0x1][_0xfab3('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x231489){logger['error'](_0xfab3('0x5e'),JSON[_0xfab3('0x5f')](_0x231489));return[];}}exports[_0xfab3('0x60')]=function(_0x1bccc0,_0x12141b){if(_0x1bccc0['body']){_0x1bccc0[_0xfab3('0x61')][_0xfab3('0x41')]=widgetAttributes(_0x1bccc0[_0xfab3('0x61')]);}return db['DashboardItem'][_0xfab3('0x60')](_0x1bccc0[_0xfab3('0x61')],{})[_0xfab3('0x28')](respondWithResult(_0x12141b,0xc9))['catch'](handleError(_0x12141b,null));};exports[_0xfab3('0x27')]=function(_0x3fdc2b,_0x36f011){if(_0x3fdc2b[_0xfab3('0x61')]['id']){delete _0x3fdc2b['body']['id'];}_0x3fdc2b['body'][_0xfab3('0x41')]=widgetAttributes(_0x3fdc2b[_0xfab3('0x61')]);return db[_0xfab3('0x3a')][_0xfab3('0x3b')]({'where':{'id':_0x3fdc2b['params']['id']}})[_0xfab3('0x28')](handleEntityNotFound(_0x36f011,null))[_0xfab3('0x28')](saveUpdates(_0x3fdc2b[_0xfab3('0x61')],null))['then'](respondWithResult(_0x36f011,null))[_0xfab3('0x3d')](handleError(_0x36f011,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 6bae2b5..e46627d 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 _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 +var _0x4972=['../../mysqldb','DashboardItem','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x27b7d2,_0x56c091){var _0x3ef6be=function(_0x6e8a35){while(--_0x6e8a35){_0x27b7d2['push'](_0x27b7d2['shift']());}};_0x3ef6be(++_0x56c091);}(_0x4972,0x130));var _0x2497=function(_0x2b6229,_0xdaf11c){_0x2b6229=_0x2b6229-0x0;var _0x11321b=_0x4972[_0x2b6229];return _0x11321b;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x2497('0x0'))['db'][_0x2497('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2497('0x2'),'afterUpdate':_0x2497('0x3'),'afterDestroy':_0x2497('0x4')};function emitEvent(_0x41ee40){return function(_0x2ecf2e,_0x1b4216,_0x3b1662){DashboardItemEvents['emit'](_0x41ee40+':'+_0x2ecf2e['id'],_0x2ecf2e);DashboardItemEvents[_0x2497('0x5')](_0x41ee40,_0x2ecf2e);_0x3b1662(null);};}for(var e in events){if(events[_0x2497('0x6')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x2497('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 4be76ac..6a3fada 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 _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 +var _0x3d6f=['request-promise','path','../../config/environment','exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x21ea6f,_0x4416ad){var _0x30b29b=function(_0x24fc45){while(--_0x24fc45){_0x21ea6f['push'](_0x21ea6f['shift']());}};_0x30b29b(++_0x4416ad);}(_0x3d6f,0x13f));var _0xf3d6=function(_0x2bc1fe,_0x45da98){_0x2bc1fe=_0x2bc1fe-0x0;var _0x1a47a5=_0x3d6f[_0x2bc1fe];return _0x1a47a5;};'use strict';var _=require(_0xf3d6('0x0'));var util=require(_0xf3d6('0x1'));var logger=require(_0xf3d6('0x2'))(_0xf3d6('0x3'));var moment=require(_0xf3d6('0x4'));var BPromise=require(_0xf3d6('0x5'));var rp=require(_0xf3d6('0x6'));var fs=require('fs');var path=require(_0xf3d6('0x7'));var rimraf=require('rimraf');var config=require(_0xf3d6('0x8'));var attributes=require('./dashboardItem.attributes');module[_0xf3d6('0x9')]=function(_0x397de7,_0x45cd0d){return _0x397de7[_0xf3d6('0xa')](_0xf3d6('0xb'),attributes,{'tableName':_0xf3d6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index cbe367d..ee255d7 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 _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 +var _0x459f=['../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DashboardItem,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0xde3de2,_0x61f4f){var _0x5591ad=function(_0x341d22){while(--_0x341d22){_0xde3de2['push'](_0xde3de2['shift']());}};_0x5591ad(++_0x61f4f);}(_0x459f,0xda));var _0xf459=function(_0x36310e,_0xd836f){_0x36310e=_0x36310e-0x0;var _0x4ee38d=_0x459f[_0x36310e];return _0x4ee38d;};'use strict';var _=require(_0xf459('0x0'));var util=require(_0xf459('0x1'));var moment=require(_0xf459('0x2'));var BPromise=require(_0xf459('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf459('0x4'));var db=require(_0xf459('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf459('0x6'))(_0xf459('0x7'));var config=require(_0xf459('0x8'));var jayson=require(_0xf459('0x9'));var client=jayson[_0xf459('0xa')]['http']({'port':0x232a});config['redis']=_[_0xf459('0xb')](config[_0xf459('0xc')],{'host':_0xf459('0xd'),'port':0x18eb});var socket=require(_0xf459('0xe'))(new Redis(config[_0xf459('0xc')]));require(_0xf459('0xf'))[_0xf459('0x10')](socket);function respondWithRpcPromise(_0x3b394a,_0x5b07e0,_0x6753be){return new BPromise(function(_0x6e515a,_0x3b56ef){return client['request'](_0x3b394a,_0x6753be)['then'](function(_0x45c0f2){logger[_0xf459('0x11')]('DashboardItem,\x20%s,\x20%s',_0x5b07e0,_0xf459('0x12'));logger[_0xf459('0x13')](_0xf459('0x14'),_0x5b07e0,'request\x20sent',JSON[_0xf459('0x15')](_0x45c0f2));if(_0x45c0f2[_0xf459('0x16')]){if(_0x45c0f2[_0xf459('0x16')][_0xf459('0x17')]===0x1f4){logger[_0xf459('0x16')]('DashboardItem,\x20%s,\x20%s',_0x5b07e0,_0x45c0f2[_0xf459('0x16')][_0xf459('0x18')]);return _0x3b56ef(_0x45c0f2[_0xf459('0x16')][_0xf459('0x18')]);}logger['error'](_0xf459('0x19'),_0x5b07e0,_0x45c0f2['error'][_0xf459('0x18')]);return _0x6e515a(_0x45c0f2[_0xf459('0x16')][_0xf459('0x18')]);}else{logger[_0xf459('0x11')]('DashboardItem,\x20%s,\x20%s',_0x5b07e0,_0xf459('0x12'));_0x6e515a(_0x45c0f2[_0xf459('0x1a')][_0xf459('0x18')]);}})[_0xf459('0x1b')](function(_0x8a6bfd){logger[_0xf459('0x16')](_0xf459('0x19'),_0x5b07e0,_0x8a6bfd);_0x3b56ef(_0x8a6bfd);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 55a8bf8..66f9fff 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 _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 +var _0xeae2=['emit','removeListener','length','dashboardItem:','./dashboardItem.events','save','update'];(function(_0x55a4f4,_0x24d74d){var _0x1a8078=function(_0x469e64){while(--_0x469e64){_0x55a4f4['push'](_0x55a4f4['shift']());}};_0x1a8078(++_0x24d74d);}(_0xeae2,0x162));var _0x2eae=function(_0x3c84eb,_0x1e0acb){_0x3c84eb=_0x3c84eb-0x0;var _0x22c628=_0xeae2[_0x3c84eb];return _0x22c628;};'use strict';var DashboardItemEvents=require(_0x2eae('0x0'));var events=[_0x2eae('0x1'),'remove',_0x2eae('0x2')];function createListener(_0x1444cb,_0x1a6afd){return function(_0x8b6dc9){_0x1a6afd[_0x2eae('0x3')](_0x1444cb,_0x8b6dc9);};}function removeListener(_0x1c4630,_0x283f76){return function(){DashboardItemEvents[_0x2eae('0x4')](_0x1c4630,_0x283f76);};}exports['register']=function(_0x44d89b){for(var _0x369d9c=0x0,_0x1c0d89=events[_0x2eae('0x5')];_0x369d9c<_0x1c0d89;_0x369d9c++){var _0x326024=events[_0x369d9c];var _0x585a2c=createListener(_0x2eae('0x6')+_0x326024,_0x44d89b);DashboardItemEvents['on'](_0x326024,_0x585a2c);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 7e54aef..2f891e8 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 _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 +var _0x5fa4=['delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','put'];(function(_0x460e71,_0x5cf74f){var _0x1d48f0=function(_0x4adfcf){while(--_0x4adfcf){_0x460e71['push'](_0x460e71['shift']());}};_0x1d48f0(++_0x5cf74f);}(_0x5fa4,0x153));var _0x45fa=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x5fa4[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x45fa('0x0'));var util=require('util');var path=require(_0x45fa('0x1'));var timeout=require(_0x45fa('0x2'));var express=require(_0x45fa('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x45fa('0x4'));var interaction=require(_0x45fa('0x5'));var config=require(_0x45fa('0x6'));var controller=require('./dashboardItem.controller');router[_0x45fa('0x7')](_0x45fa('0x8'),auth[_0x45fa('0x9')](),controller[_0x45fa('0xa')]);router[_0x45fa('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x45fa('0xc')]('/:id',auth[_0x45fa('0x9')](),controller['update']);router[_0x45fa('0xd')](_0x45fa('0x8'),auth[_0x45fa('0x9')](),controller[_0x45fa('0xe')]);module[_0x45fa('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index e56461c..56a4635 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 _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 +var _0xe4e5=['first','second','third','sequelize','exports','STRING','ENUM'];(function(_0x1e1463,_0x237529){var _0x3b842b=function(_0xb540d0){while(--_0xb540d0){_0x1e1463['push'](_0x1e1463['shift']());}};_0x3b842b(++_0x237529);}(_0xe4e5,0x122));var _0x5e4e=function(_0x5108cd,_0x5d9634){_0x5108cd=_0x5108cd-0x0;var _0x5e4186=_0xe4e5[_0x5108cd];return _0x5e4186;};'use strict';var Sequelize=require(_0x5e4e('0x0'));module[_0x5e4e('0x1')]={'name':{'type':Sequelize[_0x5e4e('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x5e4e('0x3')](_0x5e4e('0x4'),_0x5e4e('0x5'),_0x5e4e('0x6')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x5e4e('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 1278575..f630c48 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 _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 +var _0x75d2=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','type','findAll','rows','catch','show','params','includeAll','include','options','find','create','body','user','role','Dispositions','UserProfileSection','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','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x75d2,0x152));var _0x275d=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x75d2[_0xae7c2f];return _0x5d7001;};'use strict';var emlformat=require(_0x275d('0x0'));var rimraf=require(_0x275d('0x1'));var zipdir=require(_0x275d('0x2'));var jsonpatch=require(_0x275d('0x3'));var rp=require(_0x275d('0x4'));var moment=require(_0x275d('0x5'));var BPromise=require(_0x275d('0x6'));var Mustache=require('mustache');var util=require(_0x275d('0x7'));var path=require('path');var sox=require(_0x275d('0x8'));var csv=require(_0x275d('0x9'));var ejs=require(_0x275d('0xa'));var fs=require('fs');var fs_extra=require(_0x275d('0xb'));var _=require(_0x275d('0xc'));var squel=require(_0x275d('0xd'));var crypto=require('crypto');var jsforce=require(_0x275d('0xe'));var deskjs=require(_0x275d('0xf'));var toCsv=require(_0x275d('0x9'));var querystring=require(_0x275d('0x10'));var Papa=require('papaparse');var Redis=require(_0x275d('0x11'));var authService=require(_0x275d('0x12'));var qs=require(_0x275d('0x13'));var as=require(_0x275d('0x14'));var hardwareService=require(_0x275d('0x15'));var logger=require(_0x275d('0x16'))(_0x275d('0x17'));var utils=require(_0x275d('0x18'));var config=require(_0x275d('0x19'));var licenseUtil=require(_0x275d('0x1a'));var db=require(_0x275d('0x1b'))['db'];function respondWithStatusCode(_0xab607c,_0x2c8bad){_0x2c8bad=_0x2c8bad||0xcc;return function(_0x3d9658){if(_0x3d9658){return _0xab607c[_0x275d('0x1c')](_0x2c8bad);}return _0xab607c['status'](_0x2c8bad)[_0x275d('0x1d')]();};}function respondWithResult(_0x586ba9,_0xa0633a){_0xa0633a=_0xa0633a||0xc8;return function(_0x2ac584){if(_0x2ac584){return _0x586ba9[_0x275d('0x1e')](_0xa0633a)[_0x275d('0x1f')](_0x2ac584);}};}function respondWithFilteredResult(_0x214b3d,_0x3a44d6){return function(_0x31aeee){if(_0x31aeee){var _0x3f5ff9=typeof _0x3a44d6[_0x275d('0x20')]==='undefined'&&typeof _0x3a44d6['limit']===_0x275d('0x21');var _0x375c57=_0x31aeee[_0x275d('0x22')];var _0x498c6a=_0x3f5ff9?0x0:_0x3a44d6['offset'];var _0x48e1bf=_0x3f5ff9?_0x31aeee[_0x275d('0x22')]:_0x3a44d6['offset']+_0x3a44d6['limit'];var _0x34e4b9;if(_0x48e1bf>=_0x375c57){_0x48e1bf=_0x375c57;_0x34e4b9=0xc8;}else{_0x34e4b9=0xce;}_0x214b3d['status'](_0x34e4b9);return _0x214b3d[_0x275d('0x23')](_0x275d('0x24'),_0x498c6a+'-'+_0x48e1bf+'/'+_0x375c57)['json'](_0x31aeee);}return null;};}function patchUpdates(_0xaf5453){return function(_0x3ba469){try{jsonpatch[_0x275d('0x25')](_0x3ba469,_0xaf5453,!![]);}catch(_0x13fd44){return BPromise[_0x275d('0x26')](_0x13fd44);}return _0x3ba469[_0x275d('0x27')]();};}function saveUpdates(_0x1339a4,_0x2c4aa9){return function(_0x745f88){if(_0x745f88){return _0x745f88[_0x275d('0x28')](_0x1339a4)[_0x275d('0x29')](function(_0x26c528){return _0x26c528;});}return null;};}function removeEntity(_0x24c11e,_0x18a45e){return function(_0x54d6e9){if(_0x54d6e9){return _0x54d6e9[_0x275d('0x2a')]()[_0x275d('0x29')](function(){var _0x35d06f=_0x54d6e9[_0x275d('0x2b')]({'plain':!![]});var _0x54a257='Dispositions';return db[_0x275d('0x2c')]['destroy']({'where':{'type':_0x54a257,'resourceId':_0x35d06f['id']}})[_0x275d('0x29')](function(){return _0x54d6e9;});})[_0x275d('0x29')](function(){_0x24c11e[_0x275d('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c861a,_0x4122b0){return function(_0x138087){if(!_0x138087){_0x2c861a['sendStatus'](0x194);}return _0x138087;};}function handleError(_0x52baa2,_0x579c9b){_0x579c9b=_0x579c9b||0x1f4;return function(_0x2fb9b9){logger[_0x275d('0x2d')](_0x2fb9b9[_0x275d('0x2e')]);if(_0x2fb9b9[_0x275d('0x2f')]){delete _0x2fb9b9[_0x275d('0x2f')];}_0x52baa2[_0x275d('0x1e')](_0x579c9b)[_0x275d('0x30')](_0x2fb9b9);};}exports[_0x275d('0x31')]=function(_0x355186,_0x24f781){var _0x14cf8c={},_0x591c2c={},_0xee2671={'count':0x0,'rows':[]};var _0x5a7cb3=_[_0x275d('0x32')](db[_0x275d('0x33')][_0x275d('0x34')],function(_0x386380){return{'name':_0x386380[_0x275d('0x35')],'type':_0x386380['type'][_0x275d('0x36')]};});_0x591c2c[_0x275d('0x37')]=_[_0x275d('0x32')](_0x5a7cb3,_0x275d('0x2f'));_0x591c2c[_0x275d('0x38')]=_[_0x275d('0x39')](_0x355186['query']);_0x591c2c[_0x275d('0x3a')]=_['intersection'](_0x591c2c[_0x275d('0x37')],_0x591c2c['query']);_0x14cf8c[_0x275d('0x3b')]=_[_0x275d('0x3c')](_0x591c2c[_0x275d('0x37')],qs[_0x275d('0x3d')](_0x355186['query']['fields']));_0x14cf8c[_0x275d('0x3b')]=_0x14cf8c[_0x275d('0x3b')][_0x275d('0x3e')]?_0x14cf8c[_0x275d('0x3b')]:_0x591c2c['model'];if(!_0x355186[_0x275d('0x38')]['hasOwnProperty'](_0x275d('0x3f'))){_0x14cf8c[_0x275d('0x40')]=qs[_0x275d('0x40')](_0x355186[_0x275d('0x38')]['limit']);_0x14cf8c[_0x275d('0x20')]=qs[_0x275d('0x20')](_0x355186[_0x275d('0x38')][_0x275d('0x20')]);}_0x14cf8c[_0x275d('0x41')]=qs['sort'](_0x355186[_0x275d('0x38')][_0x275d('0x42')]);_0x14cf8c[_0x275d('0x43')]=qs[_0x275d('0x3a')](_[_0x275d('0x44')](_0x355186['query'],_0x591c2c[_0x275d('0x3a')]),_0x5a7cb3);if(_0x355186['query'][_0x275d('0x45')]){_0x14cf8c[_0x275d('0x43')]=_[_0x275d('0x46')](_0x14cf8c['where'],{'$or':_[_0x275d('0x32')](_0x5a7cb3,function(_0x1a3e43){if(_0x1a3e43[_0x275d('0x47')]!=='VIRTUAL'){var _0x2c16bd={};_0x2c16bd[_0x1a3e43[_0x275d('0x2f')]]={'$like':'%'+_0x355186[_0x275d('0x38')][_0x275d('0x45')]+'%'};return _0x2c16bd;}})});}_0x14cf8c=_[_0x275d('0x46')]({},_0x14cf8c,_0x355186['options']);var _0x1cc3f9={'where':_0x14cf8c[_0x275d('0x43')]};return db[_0x275d('0x33')]['count'](_0x1cc3f9)[_0x275d('0x29')](function(_0x173ab4){_0xee2671[_0x275d('0x22')]=_0x173ab4;if(_0x355186[_0x275d('0x38')]['includeAll']){_0x14cf8c['include']=[{'all':!![]}];}return db[_0x275d('0x33')][_0x275d('0x48')](_0x14cf8c);})[_0x275d('0x29')](function(_0x3de7ba){_0xee2671[_0x275d('0x49')]=_0x3de7ba;return _0xee2671;})['then'](respondWithFilteredResult(_0x24f781,_0x14cf8c))[_0x275d('0x4a')](handleError(_0x24f781,null));};exports[_0x275d('0x4b')]=function(_0x2454b5,_0x50a5e6){var _0x2f9e3d={'raw':!![],'where':{'id':_0x2454b5[_0x275d('0x4c')]['id']}},_0x495881={};_0x495881[_0x275d('0x37')]=_[_0x275d('0x39')](db[_0x275d('0x33')]['rawAttributes']);_0x495881['query']=_['keys'](_0x2454b5['query']);_0x495881[_0x275d('0x3a')]=_[_0x275d('0x3c')](_0x495881['model'],_0x495881[_0x275d('0x38')]);_0x2f9e3d['attributes']=_[_0x275d('0x3c')](_0x495881['model'],qs[_0x275d('0x3d')](_0x2454b5[_0x275d('0x38')][_0x275d('0x3d')]));_0x2f9e3d[_0x275d('0x3b')]=_0x2f9e3d[_0x275d('0x3b')][_0x275d('0x3e')]?_0x2f9e3d[_0x275d('0x3b')]:_0x495881[_0x275d('0x37')];if(_0x2454b5[_0x275d('0x38')][_0x275d('0x4d')]){_0x2f9e3d[_0x275d('0x4e')]=[{'all':!![]}];}_0x2f9e3d=_[_0x275d('0x46')]({},_0x2f9e3d,_0x2454b5[_0x275d('0x4f')]);return db[_0x275d('0x33')][_0x275d('0x50')](_0x2f9e3d)[_0x275d('0x29')](handleEntityNotFound(_0x50a5e6,null))['then'](respondWithResult(_0x50a5e6,null))[_0x275d('0x4a')](handleError(_0x50a5e6,null));};exports[_0x275d('0x51')]=function(_0x4c2133,_0xb6616b){return db[_0x275d('0x33')][_0x275d('0x51')](_0x4c2133[_0x275d('0x52')],{})[_0x275d('0x29')](function(_0x527d19){var _0x483991=_0x4c2133[_0x275d('0x53')][_0x275d('0x2b')]({'plain':!![]});if(!_0x483991)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x483991[_0x275d('0x54')]===_0x275d('0x53')){var _0x3f9784=_0x527d19[_0x275d('0x2b')]({'plain':!![]});var _0x4c3519=_0x275d('0x55');return db[_0x275d('0x56')][_0x275d('0x50')]({'where':{'name':_0x4c3519,'userProfileId':_0x483991['userProfileId']},'raw':!![]})[_0x275d('0x29')](function(_0xc611ef){if(_0xc611ef&&_0xc611ef[_0x275d('0x57')]===0x0){return db[_0x275d('0x2c')][_0x275d('0x51')]({'name':_0x3f9784[_0x275d('0x2f')],'resourceId':_0x3f9784['id'],'type':_0xc611ef[_0x275d('0x2f')],'sectionId':_0xc611ef['id']},{})['then'](function(){return _0x527d19;});}else{return _0x527d19;}})[_0x275d('0x4a')](function(_0x27ba3e){logger[_0x275d('0x2d')](_0x275d('0x58'),_0x27ba3e);throw _0x27ba3e;});}return _0x527d19;})[_0x275d('0x29')](respondWithResult(_0xb6616b,0xc9))[_0x275d('0x4a')](handleError(_0xb6616b,null));};exports['update']=function(_0xbf0b64,_0x1ed49e){if(_0xbf0b64[_0x275d('0x52')]['id']){delete _0xbf0b64[_0x275d('0x52')]['id'];}return db[_0x275d('0x33')][_0x275d('0x50')]({'where':{'id':_0xbf0b64['params']['id']}})[_0x275d('0x29')](handleEntityNotFound(_0x1ed49e,null))[_0x275d('0x29')](saveUpdates(_0xbf0b64['body'],null))[_0x275d('0x29')](respondWithResult(_0x1ed49e,null))[_0x275d('0x4a')](handleError(_0x1ed49e,null));};exports[_0x275d('0x2a')]=function(_0x287ab2,_0x555d39){return db[_0x275d('0x33')][_0x275d('0x50')]({'where':{'id':_0x287ab2[_0x275d('0x4c')]['id']}})[_0x275d('0x29')](handleEntityNotFound(_0x555d39,null))[_0x275d('0x29')](removeEntity(_0x555d39,null))['catch'](handleError(_0x555d39,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index f753083..2ce1755 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 _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 +var _0x9476=['name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId'];(function(_0x440335,_0xf76c4a){var _0x1e8aa1=function(_0x1ed00a){while(--_0x1ed00a){_0x440335['push'](_0x440335['shift']());}};_0x1e8aa1(++_0xf76c4a);}(_0x9476,0x1ec));var _0x6947=function(_0x259422,_0x2b59e0){_0x259422=_0x259422-0x0;var _0x2b0ae3=_0x9476[_0x259422];return _0x2b0ae3;};'use strict';var _=require(_0x6947('0x0'));var util=require(_0x6947('0x1'));var logger=require(_0x6947('0x2'))('api');var moment=require(_0x6947('0x3'));var BPromise=require(_0x6947('0x4'));var rp=require(_0x6947('0x5'));var fs=require('fs');var path=require(_0x6947('0x6'));var rimraf=require(_0x6947('0x7'));var config=require(_0x6947('0x8'));var attributes=require(_0x6947('0x9'));module[_0x6947('0xa')]=function(_0x265b0c,_0x467de1){return _0x265b0c['define'](_0x6947('0xb'),attributes,{'tableName':_0x6947('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x6947('0xd'),'fields':[_0x6947('0xe'),_0x6947('0xf')]},{'unique':!![],'name':_0x6947('0x10'),'fields':[_0x6947('0xe'),_0x6947('0x11')]},{'unique':!![],'name':_0x6947('0x12'),'fields':['name',_0x6947('0x13')]},{'unique':!![],'name':'name_sms','fields':[_0x6947('0xe'),_0x6947('0x14')]},{'unique':!![],'name':_0x6947('0x15'),'fields':['name',_0x6947('0x16')]},{'unique':!![],'name':_0x6947('0x17'),'fields':[_0x6947('0xe'),_0x6947('0x18')]},{'unique':!![],'name':_0x6947('0x19'),'fields':[_0x6947('0xe'),_0x6947('0x1a')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index b6c80f6..90bf36e 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(_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 +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(_0xa9b1ef,_0x2a5454){var _0x2330a2=function(_0x1152ba){while(--_0x1152ba){_0xa9b1ef['push'](_0xa9b1ef['shift']());}};_0x2330a2(++_0x2a5454);}(_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 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 fbcddd5..a575306 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 _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 +var _0xde58=['update','delete','destroy','exports','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','create','put'];(function(_0x2d3ccf,_0x1dd3a0){var _0x3c8333=function(_0x4febd8){while(--_0x4febd8){_0x2d3ccf['push'](_0x2d3ccf['shift']());}};_0x3c8333(++_0x1dd3a0);}(_0xde58,0x17a));var _0x8de5=function(_0x367710,_0x2ea312){_0x367710=_0x367710-0x0;var _0x16178d=_0xde58[_0x367710];return _0x16178d;};'use strict';var multer=require('multer');var util=require(_0x8de5('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8de5('0x1')]();var fs_extra=require(_0x8de5('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x8de5('0x3'));var config=require(_0x8de5('0x4'));var controller=require(_0x8de5('0x5'));router[_0x8de5('0x6')]('/',auth[_0x8de5('0x7')](),controller[_0x8de5('0x8')]);router[_0x8de5('0x6')](_0x8de5('0x9'),auth[_0x8de5('0x7')](),controller[_0x8de5('0xa')]);router['post']('/',auth[_0x8de5('0x7')](),controller[_0x8de5('0xb')]);router[_0x8de5('0xc')](_0x8de5('0x9'),auth[_0x8de5('0x7')](),controller[_0x8de5('0xd')]);router[_0x8de5('0xe')](_0x8de5('0x9'),auth['isAuthenticated'](),controller[_0x8de5('0xf')]);module[_0x8de5('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 634811b..f4ba8ac 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 _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 +var _0x6363=['7200','9600','14400','12000','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800'];(function(_0x22a877,_0x4b42a1){var _0x1eee1e=function(_0x2bde98){while(--_0x2bde98){_0x22a877['push'](_0x22a877['shift']());}};_0x1eee1e(++_0x4b42a1);}(_0x6363,0x13a));var _0x3636=function(_0x4f4557,_0x3b9231){_0x4f4557=_0x4f4557-0x0;var _0x44297c=_0x6363[_0x4f4557];return _0x44297c;};'use strict';var Sequelize=require(_0x3636('0x0'));module['exports']={'name':{'type':Sequelize[_0x3636('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3636('0x1')]},'ecm':{'type':Sequelize[_0x3636('0x2')](_0x3636('0x3'),'no'),'defaultValue':_0x3636('0x3')},'headerinfo':{'type':Sequelize[_0x3636('0x1')],'defaultValue':_0x3636('0x4')},'localstationid':{'type':Sequelize[_0x3636('0x1')],'unique':_0x3636('0x5')},'minrate':{'type':Sequelize[_0x3636('0x2')](_0x3636('0x6'),_0x3636('0x7'),_0x3636('0x8'),_0x3636('0x9'),'12000',_0x3636('0xa')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x3636('0x2')](_0x3636('0x6'),_0x3636('0x7'),_0x3636('0x8'),_0x3636('0x9'),_0x3636('0xb'),_0x3636('0xa')),'defaultValue':_0x3636('0xa')},'modem':{'type':Sequelize[_0x3636('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x3636('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x3636('0x2')](_0x3636('0xc'),_0x3636('0xd'),_0x3636('0xe'),_0x3636('0xf')),'defaultValue':_0x3636('0xc')},'key':{'type':Sequelize[_0x3636('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x3636('0x10')],'defaultValue':function(){return _0x3636('0x11');}},'notificationSound':{'type':Sequelize[_0x3636('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3636('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3636('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x3636('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3636('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3636('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3636('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3636('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x3636('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x3636('0x12')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xe3be56){if(!_0xe3be56)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x3636('0x15')](_0x3636('0x16'),_0xe3be56);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 2ade9a5..e6347f0 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 _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 +var _0xa5b2=['out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','destroy','then','get','FaxAccounts','UserProfileResource','name','send','index','Pause','map','FaxAccount','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','mandatoryDispositionPause','keys','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','include','Contact','Owner','fullname','internal','Tag','Tags','tag','addApplications','sequelize','Transaction','FaxApplication','findAndCountAll','priority','stack','finally','getApplications','context','from-voip-provider','system','description','Fax\x20Extension','appdata','push','Answer','Set','ecm','gateway','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','transaction','bulkCreate','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','CmContact','Contacts','DESC','attachments','join','root','server/files/attachments','basename','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed'];(function(_0xfd196b,_0x45130c){var _0x141fad=function(_0x54c16b){while(--_0x54c16b){_0xfd196b['push'](_0xfd196b['shift']());}};_0x141fad(++_0x45130c);}(_0xa5b2,0x1a3));var _0x2a5b=function(_0x4af3b7,_0x30c116){_0x4af3b7=_0x4af3b7-0x0;var _0x24727c=_0xa5b2[_0x4af3b7];return _0x24727c;};'use strict';var emlformat=require(_0x2a5b('0x0'));var rimraf=require(_0x2a5b('0x1'));var zipdir=require(_0x2a5b('0x2'));var jsonpatch=require(_0x2a5b('0x3'));var rp=require('request-promise');var moment=require(_0x2a5b('0x4'));var BPromise=require(_0x2a5b('0x5'));var Mustache=require('mustache');var util=require(_0x2a5b('0x6'));var path=require(_0x2a5b('0x7'));var sox=require(_0x2a5b('0x8'));var csv=require(_0x2a5b('0x9'));var ejs=require(_0x2a5b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2a5b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2a5b('0xc'));var deskjs=require(_0x2a5b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2a5b('0xe'));var Papa=require(_0x2a5b('0xf'));var Redis=require(_0x2a5b('0x10'));var authService=require(_0x2a5b('0x11'));var qs=require(_0x2a5b('0x12'));var as=require(_0x2a5b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2a5b('0x14'))(_0x2a5b('0x15'));var utils=require(_0x2a5b('0x16'));var config=require(_0x2a5b('0x17'));var licenseUtil=require(_0x2a5b('0x18'));var db=require(_0x2a5b('0x19'))['db'];config[_0x2a5b('0x1a')]=_[_0x2a5b('0x1b')](config[_0x2a5b('0x1a')],{'host':_0x2a5b('0x1c'),'port':0x18eb});var socket=require(_0x2a5b('0x1d'))(new Redis(config[_0x2a5b('0x1a')]));require(_0x2a5b('0x1e'))[_0x2a5b('0x1f')](socket);var jayson=require(_0x2a5b('0x20'));var client=jayson[_0x2a5b('0x21')]['http']({'port':0x232c});var client9002=jayson['client'][_0x2a5b('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x247fc4,_0x185287,_0x863240,_0x2a0cf3){return new BPromise(function(_0x3e3209,_0x3a94b3){var _0x415f64=_0x2a0cf3||client;return _0x415f64[_0x2a5b('0x23')](_0x247fc4,_0x863240)['then'](function(_0x19d8e4){logger[_0x2a5b('0x24')](_0x2a5b('0x25'),_0x185287,_0x2a5b('0x26'));logger['debug'](_0x2a5b('0x27'),_0x185287,_0x2a5b('0x26'),JSON['stringify'](_0x19d8e4));if(_0x19d8e4[_0x2a5b('0x28')]){if(_0x19d8e4['error'][_0x2a5b('0x29')]===0x1f4){logger[_0x2a5b('0x28')](_0x2a5b('0x25'),_0x185287,_0x19d8e4[_0x2a5b('0x28')]['message']);return _0x3a94b3(_0x19d8e4[_0x2a5b('0x28')]['message']);}logger[_0x2a5b('0x28')](_0x2a5b('0x25'),_0x185287,_0x19d8e4[_0x2a5b('0x28')][_0x2a5b('0x2a')]);return _0x3e3209(_0x19d8e4[_0x2a5b('0x28')]['message']);}else{logger[_0x2a5b('0x24')](_0x2a5b('0x25'),_0x185287,_0x2a5b('0x26'));_0x3e3209(_0x19d8e4[_0x2a5b('0x2b')]['message']);}})[_0x2a5b('0x2c')](function(_0x354ee6){logger['error'](_0x2a5b('0x25'),_0x185287,_0x354ee6);_0x3a94b3(_0x354ee6);});});}function respondWithStatusCode(_0x13996c,_0x92de90){_0x92de90=_0x92de90||0xcc;return function(_0x1919cd){if(_0x1919cd){return _0x13996c[_0x2a5b('0x2d')](_0x92de90);}return _0x13996c[_0x2a5b('0x2e')](_0x92de90)[_0x2a5b('0x2f')]();};}function respondWithResult(_0x5e50cb,_0xe71735){_0xe71735=_0xe71735||0xc8;return function(_0x3a875a){if(_0x3a875a){return _0x5e50cb[_0x2a5b('0x2e')](_0xe71735)[_0x2a5b('0x30')](_0x3a875a);}};}function respondWithFilteredResult(_0x71b13a,_0x1b3669){return function(_0x5c2f30){if(_0x5c2f30){var _0x4c00ec=typeof _0x1b3669['offset']==='undefined'&&typeof _0x1b3669[_0x2a5b('0x31')]===_0x2a5b('0x32');var _0xcc7a5=_0x5c2f30[_0x2a5b('0x33')];var _0x48bea4=_0x4c00ec?0x0:_0x1b3669[_0x2a5b('0x34')];var _0x399709=_0x4c00ec?_0x5c2f30[_0x2a5b('0x33')]:_0x1b3669['offset']+_0x1b3669[_0x2a5b('0x31')];var _0x1b3792;if(_0x399709>=_0xcc7a5){_0x399709=_0xcc7a5;_0x1b3792=0xc8;}else{_0x1b3792=0xce;}_0x71b13a[_0x2a5b('0x2e')](_0x1b3792);return _0x71b13a[_0x2a5b('0x35')]('Content-Range',_0x48bea4+'-'+_0x399709+'/'+_0xcc7a5)['json'](_0x5c2f30);}return null;};}function patchUpdates(_0x16cd01){return function(_0x152645){try{jsonpatch[_0x2a5b('0x36')](_0x152645,_0x16cd01,!![]);}catch(_0x498a4f){return BPromise[_0x2a5b('0x37')](_0x498a4f);}return _0x152645[_0x2a5b('0x38')]();};}function saveUpdates(_0x1bad10,_0xe4d404){return function(_0x39841f){if(_0x39841f){return _0x39841f[_0x2a5b('0x39')](_0x1bad10)['then'](function(_0x4c4645){return _0x4c4645;});}return null;};}function removeEntity(_0x2c7431,_0x157c56){return function(_0x40e934){if(_0x40e934){return _0x40e934[_0x2a5b('0x3a')]()[_0x2a5b('0x3b')](function(){var _0x12cdbd=_0x40e934[_0x2a5b('0x3c')]({'plain':!![]});var _0x2d70a3=_0x2a5b('0x3d');return db[_0x2a5b('0x3e')][_0x2a5b('0x3a')]({'where':{'type':_0x2d70a3,'resourceId':_0x12cdbd['id']}})[_0x2a5b('0x3b')](function(){return _0x40e934;});})['then'](function(){_0x2c7431[_0x2a5b('0x2e')](0xcc)[_0x2a5b('0x2f')]();});}};}function handleEntityNotFound(_0x52af67,_0x33be9b){return function(_0x3bd7d6){if(!_0x3bd7d6){_0x52af67[_0x2a5b('0x2d')](0x194);}return _0x3bd7d6;};}function handleError(_0x465efb,_0xec41df){_0xec41df=_0xec41df||0x1f4;return function(_0x26c5f5){logger['error'](_0x26c5f5['stack']);if(_0x26c5f5[_0x2a5b('0x3f')]){delete _0x26c5f5[_0x2a5b('0x3f')];}_0x465efb[_0x2a5b('0x2e')](_0xec41df)[_0x2a5b('0x40')](_0x26c5f5);};}exports[_0x2a5b('0x41')]=function(_0x221824,_0x46e45b){var _0x5960b0={'include':[{'model':db[_0x2a5b('0x42')],'as':'mandatoryDispositionPause'}]},_0x2c1108={},_0x363174={'count':0x0,'rows':[]};var _0x3fbe61=_[_0x2a5b('0x43')](db[_0x2a5b('0x44')][_0x2a5b('0x45')],function(_0xfae067){return{'name':_0xfae067['fieldName'],'type':_0xfae067[_0x2a5b('0x46')]['key']};});_0x2c1108[_0x2a5b('0x47')]=_[_0x2a5b('0x43')](_0x3fbe61,_0x2a5b('0x3f'));_0x2c1108['query']=_['keys'](_0x221824[_0x2a5b('0x48')]);_0x2c1108[_0x2a5b('0x49')]=_[_0x2a5b('0x4a')](_0x2c1108[_0x2a5b('0x47')],_0x2c1108['query']);_0x5960b0[_0x2a5b('0x4b')]=_[_0x2a5b('0x4a')](_0x2c1108[_0x2a5b('0x47')],qs[_0x2a5b('0x4c')](_0x221824[_0x2a5b('0x48')][_0x2a5b('0x4c')]));_0x5960b0[_0x2a5b('0x4b')]=_0x5960b0[_0x2a5b('0x4b')][_0x2a5b('0x4d')]?_0x5960b0[_0x2a5b('0x4b')]:_0x2c1108[_0x2a5b('0x47')];if(!_0x221824[_0x2a5b('0x48')][_0x2a5b('0x4e')](_0x2a5b('0x4f'))){_0x5960b0[_0x2a5b('0x31')]=qs['limit'](_0x221824['query'][_0x2a5b('0x31')]);_0x5960b0['offset']=qs[_0x2a5b('0x34')](_0x221824[_0x2a5b('0x48')][_0x2a5b('0x34')]);}_0x5960b0[_0x2a5b('0x50')]=qs[_0x2a5b('0x51')](_0x221824[_0x2a5b('0x48')][_0x2a5b('0x51')]);_0x5960b0['where']=qs[_0x2a5b('0x49')](_[_0x2a5b('0x52')](_0x221824['query'],_0x2c1108[_0x2a5b('0x49')]),_0x3fbe61);if(_0x221824[_0x2a5b('0x48')][_0x2a5b('0x53')]){_0x5960b0[_0x2a5b('0x54')]=_[_0x2a5b('0x55')](_0x5960b0[_0x2a5b('0x54')],{'$or':_[_0x2a5b('0x43')](_0x3fbe61,function(_0x36b821){if(_0x36b821[_0x2a5b('0x46')]!==_0x2a5b('0x56')){var _0x50fdba={};_0x50fdba[_0x36b821[_0x2a5b('0x3f')]]={'$like':'%'+_0x221824[_0x2a5b('0x48')][_0x2a5b('0x53')]+'%'};return _0x50fdba;}})});}_0x5960b0=_[_0x2a5b('0x55')]({},_0x5960b0,_0x221824[_0x2a5b('0x57')]);var _0xd1dd85={'where':_0x5960b0[_0x2a5b('0x54')]};return db[_0x2a5b('0x44')][_0x2a5b('0x33')](_0xd1dd85)[_0x2a5b('0x3b')](function(_0x2de1f0){_0x363174[_0x2a5b('0x33')]=_0x2de1f0;if(_0x221824[_0x2a5b('0x48')][_0x2a5b('0x58')]){_0x5960b0['include']=[{'all':!![]}];}return db[_0x2a5b('0x44')][_0x2a5b('0x59')](_0x5960b0);})[_0x2a5b('0x3b')](function(_0x49516d){_0x363174[_0x2a5b('0x5a')]=_0x49516d;return _0x363174;})[_0x2a5b('0x3b')](respondWithFilteredResult(_0x46e45b,_0x5960b0))[_0x2a5b('0x2c')](handleError(_0x46e45b,null));};exports[_0x2a5b('0x5b')]=function(_0x425468,_0x4e8463){var _0x5bd786={'raw':![],'where':{'id':_0x425468[_0x2a5b('0x5c')]['id']},'include':[{'model':db[_0x2a5b('0x42')],'as':_0x2a5b('0x5d')}]},_0x31c63a={};_0x31c63a[_0x2a5b('0x47')]=_['keys'](db['FaxAccount'][_0x2a5b('0x45')]);_0x31c63a[_0x2a5b('0x48')]=_[_0x2a5b('0x5e')](_0x425468[_0x2a5b('0x48')]);_0x31c63a[_0x2a5b('0x49')]=_[_0x2a5b('0x4a')](_0x31c63a['model'],_0x31c63a[_0x2a5b('0x48')]);_0x5bd786[_0x2a5b('0x4b')]=_[_0x2a5b('0x4a')](_0x31c63a[_0x2a5b('0x47')],qs['fields'](_0x425468['query'][_0x2a5b('0x4c')]));_0x5bd786[_0x2a5b('0x4b')]=_0x5bd786[_0x2a5b('0x4b')]['length']?_0x5bd786['attributes']:_0x31c63a[_0x2a5b('0x47')];if(_0x425468[_0x2a5b('0x48')][_0x2a5b('0x58')]){_0x5bd786['include']=[{'all':!![]}];}_0x5bd786=_[_0x2a5b('0x55')]({},_0x5bd786,_0x425468[_0x2a5b('0x57')]);return db[_0x2a5b('0x44')][_0x2a5b('0x5f')](_0x5bd786)[_0x2a5b('0x3b')](handleEntityNotFound(_0x4e8463,null))['then'](respondWithResult(_0x4e8463,null))['catch'](handleError(_0x4e8463,null));};exports[_0x2a5b('0x60')]=function(_0xc632,_0x3f5f09){return db[_0x2a5b('0x44')][_0x2a5b('0x60')](_0xc632[_0x2a5b('0x61')],{})[_0x2a5b('0x3b')](function(_0x260c03){var _0x301f03=_0xc632[_0x2a5b('0x62')]['get']({'plain':!![]});if(!_0x301f03)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x301f03[_0x2a5b('0x63')]==='user'){var _0x1734c0=_0x260c03[_0x2a5b('0x3c')]({'plain':!![]});var _0x4aaad4=_0x2a5b('0x3d');return db[_0x2a5b('0x64')][_0x2a5b('0x5f')]({'where':{'name':_0x4aaad4,'userProfileId':_0x301f03['userProfileId']},'raw':!![]})['then'](function(_0x502fbe){if(_0x502fbe&&_0x502fbe[_0x2a5b('0x65')]===0x0){return db[_0x2a5b('0x3e')][_0x2a5b('0x60')]({'name':_0x1734c0['name'],'resourceId':_0x1734c0['id'],'type':_0x502fbe[_0x2a5b('0x3f')],'sectionId':_0x502fbe['id']},{})[_0x2a5b('0x3b')](function(){return _0x260c03;});}else{return _0x260c03;}})['catch'](function(_0x2df47b){logger[_0x2a5b('0x28')](_0x2a5b('0x66'),_0x2df47b);throw _0x2df47b;});}return _0x260c03;})[_0x2a5b('0x3b')](respondWithResult(_0x3f5f09,0xc9))[_0x2a5b('0x2c')](handleError(_0x3f5f09,null));};exports[_0x2a5b('0x39')]=function(_0x53b685,_0x379c48){if(_0x53b685['body']['id']){delete _0x53b685['body']['id'];}return db[_0x2a5b('0x44')][_0x2a5b('0x5f')]({'where':{'id':_0x53b685[_0x2a5b('0x5c')]['id']},'include':[{'model':db[_0x2a5b('0x42')],'as':_0x2a5b('0x5d')}]})[_0x2a5b('0x3b')](handleEntityNotFound(_0x379c48,null))[_0x2a5b('0x3b')](saveUpdates(_0x53b685[_0x2a5b('0x61')],null))['then'](respondWithResult(_0x379c48,null))[_0x2a5b('0x2c')](handleError(_0x379c48,null));};exports['destroy']=function(_0xf0957e,_0x4a3ac1){return db['FaxAccount']['find']({'where':{'id':_0xf0957e[_0x2a5b('0x5c')]['id']}})[_0x2a5b('0x3b')](handleEntityNotFound(_0x4a3ac1,null))[_0x2a5b('0x3b')](removeEntity(_0x4a3ac1,null))[_0x2a5b('0x2c')](handleError(_0x4a3ac1,null));};exports[_0x2a5b('0x67')]=function(_0x596be8,_0x45f5de){return db[_0x2a5b('0x44')][_0x2a5b('0x67')]()['then'](respondWithResult(_0x45f5de,null))[_0x2a5b('0x2c')](handleError(_0x45f5de,null));};exports[_0x2a5b('0x68')]=function(_0x1c4fc1,_0x3e011c,_0x25d6ea){if(_0x1c4fc1[_0x2a5b('0x61')]['id']){delete _0x1c4fc1['body']['id'];}return db[_0x2a5b('0x44')]['find']({'where':{'id':_0x1c4fc1[_0x2a5b('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3e011c,null))[_0x2a5b('0x3b')](function(_0x2da326){if(_0x2da326){_0x1c4fc1[_0x2a5b('0x61')][_0x2a5b('0x69')]=_0x2da326['id'];return db[_0x2a5b('0x6a')]['create'](_0x1c4fc1['body']);}})[_0x2a5b('0x3b')](respondWithResult(_0x3e011c,null))[_0x2a5b('0x2c')](handleError(_0x3e011c,null));};exports[_0x2a5b('0x6b')]=function(_0x5edd2d,_0x178233,_0x2af9a4){var _0x32b03c={'raw':![],'where':{}};var _0x58922e={};var _0x23dccf={'count':0x0,'rows':[]};return db['FaxAccount'][_0x2a5b('0x6c')]({'where':{'id':_0x5edd2d[_0x2a5b('0x5c')]['id']}})['then'](handleEntityNotFound(_0x178233,null))[_0x2a5b('0x3b')](function(_0x432312){if(_0x432312){_0x58922e[_0x2a5b('0x47')]=_[_0x2a5b('0x5e')](db[_0x2a5b('0x6a')]['rawAttributes']);_0x58922e[_0x2a5b('0x48')]=_['keys'](_0x5edd2d[_0x2a5b('0x48')]);_0x58922e[_0x2a5b('0x49')]=_[_0x2a5b('0x4a')](_0x58922e[_0x2a5b('0x47')],_0x58922e[_0x2a5b('0x48')]);_0x32b03c[_0x2a5b('0x4b')]=_[_0x2a5b('0x4a')](_0x58922e['model'],qs[_0x2a5b('0x4c')](_0x5edd2d[_0x2a5b('0x48')][_0x2a5b('0x4c')]));_0x32b03c[_0x2a5b('0x4b')]=_0x32b03c['attributes'][_0x2a5b('0x4d')]?_0x32b03c[_0x2a5b('0x4b')]:_0x58922e[_0x2a5b('0x47')];if(!_0x5edd2d[_0x2a5b('0x48')]['hasOwnProperty']('nolimit')){_0x32b03c[_0x2a5b('0x31')]=qs[_0x2a5b('0x31')](_0x5edd2d[_0x2a5b('0x48')][_0x2a5b('0x31')]);_0x32b03c[_0x2a5b('0x34')]=qs[_0x2a5b('0x34')](_0x5edd2d[_0x2a5b('0x48')]['offset']);}_0x32b03c['order']=qs[_0x2a5b('0x51')](_0x5edd2d[_0x2a5b('0x48')][_0x2a5b('0x51')]);_0x32b03c[_0x2a5b('0x54')]=qs[_0x2a5b('0x49')](_['pick'](_0x5edd2d['query'],_0x58922e['filters']));_0x32b03c[_0x2a5b('0x54')][_0x2a5b('0x69')]=_0x432312['id'];if(_0x5edd2d['query']['filter']){_0x32b03c[_0x2a5b('0x54')]=_[_0x2a5b('0x55')](_0x32b03c[_0x2a5b('0x54')],{'$or':_[_0x2a5b('0x43')](_0x32b03c[_0x2a5b('0x4b')],function(_0x4da7a3){var _0x1fc3d4={};_0x1fc3d4[_0x4da7a3]={'$like':'%'+_0x5edd2d[_0x2a5b('0x48')][_0x2a5b('0x53')]+'%'};return _0x1fc3d4;})});}_0x32b03c=_[_0x2a5b('0x55')]({},_0x32b03c,_0x5edd2d[_0x2a5b('0x57')]);return db['Disposition'][_0x2a5b('0x33')]({'where':_0x32b03c['where']})[_0x2a5b('0x3b')](function(_0x2d43b5){_0x23dccf[_0x2a5b('0x33')]=_0x2d43b5;if(_0x5edd2d[_0x2a5b('0x48')][_0x2a5b('0x58')]){_0x32b03c['include']=[{'all':!![]}];}return db[_0x2a5b('0x6a')][_0x2a5b('0x59')](_0x32b03c);})[_0x2a5b('0x3b')](function(_0x4d5c28){_0x23dccf[_0x2a5b('0x5a')]=_0x4d5c28;return _0x23dccf;});}})[_0x2a5b('0x3b')](respondWithFilteredResult(_0x178233,_0x32b03c))['catch'](handleError(_0x178233,null));};exports[_0x2a5b('0x6d')]=function(_0x17fde3,_0x9c9563,_0x449a4f){return db[_0x2a5b('0x44')][_0x2a5b('0x5f')]({'where':{'id':_0x17fde3[_0x2a5b('0x5c')]['id']}})['then'](handleEntityNotFound(_0x9c9563,null))[_0x2a5b('0x3b')](function(_0x55fa2e){if(_0x55fa2e){return _0x55fa2e[_0x2a5b('0x6d')](_0x17fde3[_0x2a5b('0x48')][_0x2a5b('0x6e')]);}})['then'](respondWithStatusCode(_0x9c9563,null))[_0x2a5b('0x2c')](handleError(_0x9c9563,null));};exports[_0x2a5b('0x6f')]=function(_0x487c35,_0x374f95,_0x4f8761){if(_0x487c35[_0x2a5b('0x61')]['id']){delete _0x487c35[_0x2a5b('0x61')]['id'];}return db[_0x2a5b('0x44')]['find']({'where':{'id':_0x487c35[_0x2a5b('0x5c')]['id']}})['then'](handleEntityNotFound(_0x374f95,null))[_0x2a5b('0x3b')](function(_0x486653){if(_0x486653){_0x487c35[_0x2a5b('0x61')]['FaxAccountId']=_0x486653['id'];return db[_0x2a5b('0x70')][_0x2a5b('0x60')](_0x487c35[_0x2a5b('0x61')]);}})[_0x2a5b('0x3b')](respondWithResult(_0x374f95,null))[_0x2a5b('0x2c')](handleError(_0x374f95,null));};exports[_0x2a5b('0x71')]=function(_0x5d6887,_0x472b9f,_0x322f4b){var _0x443f84={'raw':![],'where':{}};var _0x5eb9f8={};var _0xa5e2b5={'count':0x0,'rows':[]};return db[_0x2a5b('0x44')][_0x2a5b('0x6c')]({'where':{'id':_0x5d6887['params']['id']}})['then'](handleEntityNotFound(_0x472b9f,null))[_0x2a5b('0x3b')](function(_0x44f7f3){if(_0x44f7f3){_0x5eb9f8[_0x2a5b('0x47')]=_['keys'](db[_0x2a5b('0x70')][_0x2a5b('0x45')]);_0x5eb9f8['query']=_['keys'](_0x5d6887[_0x2a5b('0x48')]);_0x5eb9f8[_0x2a5b('0x49')]=_[_0x2a5b('0x4a')](_0x5eb9f8['model'],_0x5eb9f8[_0x2a5b('0x48')]);_0x443f84['attributes']=_[_0x2a5b('0x4a')](_0x5eb9f8[_0x2a5b('0x47')],qs['fields'](_0x5d6887[_0x2a5b('0x48')][_0x2a5b('0x4c')]));_0x443f84[_0x2a5b('0x4b')]=_0x443f84[_0x2a5b('0x4b')][_0x2a5b('0x4d')]?_0x443f84[_0x2a5b('0x4b')]:_0x5eb9f8['model'];if(!_0x5d6887[_0x2a5b('0x48')][_0x2a5b('0x4e')](_0x2a5b('0x4f'))){_0x443f84[_0x2a5b('0x31')]=qs[_0x2a5b('0x31')](_0x5d6887[_0x2a5b('0x48')][_0x2a5b('0x31')]);_0x443f84[_0x2a5b('0x34')]=qs[_0x2a5b('0x34')](_0x5d6887[_0x2a5b('0x48')][_0x2a5b('0x34')]);}_0x443f84[_0x2a5b('0x50')]=qs[_0x2a5b('0x51')](_0x5d6887[_0x2a5b('0x48')]['sort']);_0x443f84[_0x2a5b('0x54')]=qs[_0x2a5b('0x49')](_[_0x2a5b('0x52')](_0x5d6887[_0x2a5b('0x48')],_0x5eb9f8[_0x2a5b('0x49')]));_0x443f84['where'][_0x2a5b('0x69')]=_0x44f7f3['id'];if(_0x5d6887[_0x2a5b('0x48')][_0x2a5b('0x53')]){_0x443f84[_0x2a5b('0x54')]=_['merge'](_0x443f84[_0x2a5b('0x54')],{'$or':_[_0x2a5b('0x43')](_0x443f84[_0x2a5b('0x4b')],function(_0x1bb84c){var _0x3086ad={};_0x3086ad[_0x1bb84c]={'$like':'%'+_0x5d6887['query'][_0x2a5b('0x53')]+'%'};return _0x3086ad;})});}_0x443f84=_[_0x2a5b('0x55')]({},_0x443f84,_0x5d6887[_0x2a5b('0x57')]);return db[_0x2a5b('0x70')]['count']({'where':_0x443f84[_0x2a5b('0x54')]})['then'](function(_0x38362f){_0xa5e2b5['count']=_0x38362f;if(_0x5d6887[_0x2a5b('0x48')][_0x2a5b('0x58')]){_0x443f84['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x2a5b('0x59')](_0x443f84);})[_0x2a5b('0x3b')](function(_0x13d30b){_0xa5e2b5[_0x2a5b('0x5a')]=_0x13d30b;return _0xa5e2b5;});}})['then'](respondWithFilteredResult(_0x472b9f,_0x443f84))['catch'](handleError(_0x472b9f,null));};exports[_0x2a5b('0x72')]=function(_0x401b,_0x11ec96,_0xe3c57c){return db['FaxAccount'][_0x2a5b('0x5f')]({'where':{'id':_0x401b['params']['id']}})[_0x2a5b('0x3b')](handleEntityNotFound(_0x11ec96,null))[_0x2a5b('0x3b')](function(_0x2d85f3){if(_0x2d85f3){return _0x2d85f3[_0x2a5b('0x72')](_0x401b['query']['ids']);}})['then'](respondWithStatusCode(_0x11ec96,null))[_0x2a5b('0x2c')](handleError(_0x11ec96,null));};exports[_0x2a5b('0x73')]=function(_0x13e98d,_0x58582c,_0xfad453){return db[_0x2a5b('0x74')][_0x2a5b('0x5f')]({'where':{'id':_0x13e98d[_0x2a5b('0x5c')]['id']}})['then'](handleEntityNotFound(_0x58582c,null))[_0x2a5b('0x3b')](function(_0x5326d2){if(_0x5326d2){return _0x5326d2[_0x2a5b('0x73')](_0x13e98d[_0x2a5b('0x61')][_0x2a5b('0x6e')],_[_0x2a5b('0x75')](_0x13e98d['body'],[_0x2a5b('0x6e'),'id'])||{});}})[_0x2a5b('0x3b')](respondWithResult(_0x58582c,null))[_0x2a5b('0x2c')](handleError(_0x58582c,null));};exports[_0x2a5b('0x76')]=function(_0x682df4,_0x2b2653,_0x25e832){var _0x2f94cc={'raw':![],'where':{}};var _0x92bd6f={};var _0x34c04b={'count':0x0,'rows':[]};return db[_0x2a5b('0x44')][_0x2a5b('0x6c')]({'where':{'id':_0x682df4[_0x2a5b('0x5c')]['id']}})[_0x2a5b('0x3b')](handleEntityNotFound(_0x2b2653,null))[_0x2a5b('0x3b')](function(_0x524f2a){if(_0x524f2a){_0x92bd6f[_0x2a5b('0x47')]=_[_0x2a5b('0x5e')](db[_0x2a5b('0x74')][_0x2a5b('0x45')]);_0x92bd6f['query']=_[_0x2a5b('0x5e')](_0x682df4[_0x2a5b('0x48')]);_0x92bd6f[_0x2a5b('0x49')]=_[_0x2a5b('0x4a')](_0x92bd6f[_0x2a5b('0x47')],_0x92bd6f[_0x2a5b('0x48')]);_0x2f94cc[_0x2a5b('0x4b')]=_[_0x2a5b('0x4a')](_0x92bd6f[_0x2a5b('0x47')],qs[_0x2a5b('0x4c')](_0x682df4['query'][_0x2a5b('0x4c')]));_0x2f94cc[_0x2a5b('0x4b')]=_0x2f94cc[_0x2a5b('0x4b')]['length']?_0x2f94cc['attributes']:_0x92bd6f[_0x2a5b('0x47')];if(!_0x682df4[_0x2a5b('0x48')][_0x2a5b('0x4e')](_0x2a5b('0x4f'))){_0x2f94cc['limit']=qs[_0x2a5b('0x31')](_0x682df4['query'][_0x2a5b('0x31')]);_0x2f94cc[_0x2a5b('0x34')]=qs[_0x2a5b('0x34')](_0x682df4[_0x2a5b('0x48')][_0x2a5b('0x34')]);}_0x2f94cc[_0x2a5b('0x50')]=qs['sort'](_0x682df4[_0x2a5b('0x48')][_0x2a5b('0x51')]);_0x2f94cc[_0x2a5b('0x54')]=qs[_0x2a5b('0x49')](_['pick'](_0x682df4[_0x2a5b('0x48')],_0x92bd6f['filters']));_0x2f94cc[_0x2a5b('0x54')][_0x2a5b('0x69')]=_0x524f2a['id'];if(_0x682df4[_0x2a5b('0x48')][_0x2a5b('0x53')]){_0x2f94cc[_0x2a5b('0x54')]=_[_0x2a5b('0x55')](_0x2f94cc[_0x2a5b('0x54')],{'$or':_[_0x2a5b('0x43')](_0x2f94cc['attributes'],function(_0x1655c6){var _0x168191={};_0x168191[_0x1655c6]={'$like':'%'+_0x682df4[_0x2a5b('0x48')][_0x2a5b('0x53')]+'%'};return _0x168191;})});}_0x2f94cc=_[_0x2a5b('0x55')]({},_0x2f94cc,_0x682df4[_0x2a5b('0x57')]);return db['FaxInteraction'][_0x2a5b('0x33')]({'where':_0x2f94cc[_0x2a5b('0x54')]})[_0x2a5b('0x3b')](function(_0x16c160){_0x34c04b[_0x2a5b('0x33')]=_0x16c160;if(_0x682df4[_0x2a5b('0x48')][_0x2a5b('0x58')]){_0x2f94cc[_0x2a5b('0x77')]=[{'model':db['CmContact'],'as':_0x2a5b('0x78'),'required':![]},{'model':db['User'],'as':_0x2a5b('0x79'),'attributes':['name',_0x2a5b('0x7a'),_0x2a5b('0x7b')],'required':![]},{'model':db[_0x2a5b('0x7c')],'as':_0x2a5b('0x7d'),'attributes':['id',_0x2a5b('0x3f'),'color'],'where':_0x682df4['query']['tag']?{'id':_0x682df4[_0x2a5b('0x48')]['tag']}:undefined,'required':_0x682df4[_0x2a5b('0x48')][_0x2a5b('0x7e')]?!![]:![]}];}return db[_0x2a5b('0x74')][_0x2a5b('0x59')](_0x2f94cc);})[_0x2a5b('0x3b')](function(_0x173901){_0x34c04b['rows']=_0x173901;return _0x34c04b;});}})[_0x2a5b('0x3b')](respondWithFilteredResult(_0x2b2653,_0x2f94cc))[_0x2a5b('0x2c')](handleError(_0x2b2653,null));};exports[_0x2a5b('0x7f')]=function(_0x24f1fa,_0x386477){var _0x354326=_0x24f1fa['params']['id'];var _0x10f789=_0x24f1fa[_0x2a5b('0x61')];var _0x51de2b=0xc8;var _0x450ed0=null;return db[_0x2a5b('0x80')]['transaction']({'isolationLevel':db[_0x2a5b('0x80')][_0x2a5b('0x81')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x1bd2a7){return db[_0x2a5b('0x44')][_0x2a5b('0x6c')]({'where':{'id':_0x354326},'transaction':_0x1bd2a7})[_0x2a5b('0x3b')](function(_0x4141f5){if(_0x4141f5){return db[_0x2a5b('0x82')][_0x2a5b('0x3a')]({'where':{'FaxAccountId':_0x354326},'transaction':_0x1bd2a7})[_0x2a5b('0x3b')](function(){var _0x430146=_[_0x2a5b('0x43')](_0x10f789,function(_0x112e72){_0x112e72[_0x2a5b('0x69')]=_0x354326;return _0x112e72;});return db[_0x2a5b('0x82')]['bulkCreate'](_0x430146,{'transaction':_0x1bd2a7});});}else{_0x51de2b=0x194;_0x450ed0=[];}});})[_0x2a5b('0x3b')](function(){if(_0x51de2b!==0x194){return db[_0x2a5b('0x82')][_0x2a5b('0x83')]({'where':{'FaxAccountId':_0x354326},'order':_0x2a5b('0x84')})[_0x2a5b('0x3b')](function(_0x29d690){_0x450ed0=_0x29d690;});}})['catch'](function(_0x17d677){_0x51de2b=0x1f4;logger[_0x2a5b('0x28')](_0x17d677[_0x2a5b('0x85')]);if(_0x17d677[_0x2a5b('0x3f')]){delete _0x17d677[_0x2a5b('0x3f')];}_0x450ed0=_0x17d677;})[_0x2a5b('0x86')](function(){if(_0x450ed0===null){_0x386477[_0x2a5b('0x2d')](_0x51de2b);}else{if(_0x51de2b===0x1f4){_0x386477['status'](_0x51de2b)[_0x2a5b('0x40')](_0x450ed0);}else{_0x386477[_0x2a5b('0x2e')](_0x51de2b)[_0x2a5b('0x30')](_0x450ed0);}}});};exports[_0x2a5b('0x87')]=function(_0x4e0755,_0x34f492,_0x47b296){var _0x22f59b={};var _0x34f7f1={};var _0x1cd667;var _0x8e17dd;return db[_0x2a5b('0x44')]['findOne']({'where':{'id':_0x4e0755[_0x2a5b('0x5c')]['id']}})[_0x2a5b('0x3b')](handleEntityNotFound(_0x34f492,null))[_0x2a5b('0x3b')](function(_0x20493c){if(_0x20493c){_0x1cd667=_0x20493c;_0x34f7f1[_0x2a5b('0x47')]=_[_0x2a5b('0x5e')](db[_0x2a5b('0x82')][_0x2a5b('0x45')]);_0x34f7f1[_0x2a5b('0x48')]=_[_0x2a5b('0x5e')](_0x4e0755[_0x2a5b('0x48')]);_0x34f7f1[_0x2a5b('0x49')]=_[_0x2a5b('0x4a')](_0x34f7f1[_0x2a5b('0x47')],_0x34f7f1[_0x2a5b('0x48')]);_0x22f59b[_0x2a5b('0x4b')]=_[_0x2a5b('0x4a')](_0x34f7f1['model'],qs[_0x2a5b('0x4c')](_0x4e0755[_0x2a5b('0x48')]['fields']));_0x22f59b[_0x2a5b('0x4b')]=_0x22f59b[_0x2a5b('0x4b')][_0x2a5b('0x4d')]?_0x22f59b['attributes']:_0x34f7f1['model'];_0x22f59b['order']=qs['sort'](_0x4e0755[_0x2a5b('0x48')][_0x2a5b('0x51')]);_0x22f59b[_0x2a5b('0x54')]=qs[_0x2a5b('0x49')](_[_0x2a5b('0x52')](_0x4e0755['query'],_0x34f7f1['filters']));if(_0x4e0755[_0x2a5b('0x48')][_0x2a5b('0x53')]){_0x22f59b[_0x2a5b('0x54')]=_[_0x2a5b('0x55')](_0x22f59b[_0x2a5b('0x54')],{'$or':_[_0x2a5b('0x43')](_0x22f59b[_0x2a5b('0x4b')],function(_0x313995){var _0x378dfc={};_0x378dfc[_0x313995]={'$like':'%'+_0x4e0755['query']['filter']+'%'};return _0x378dfc;})});}_0x22f59b=_[_0x2a5b('0x55')]({},_0x22f59b,_0x4e0755[_0x2a5b('0x57')]);return _0x1cd667[_0x2a5b('0x87')](_0x22f59b);}})[_0x2a5b('0x3b')](function(_0x53c019){if(_0x53c019){_0x8e17dd=_0x53c019[_0x2a5b('0x4d')];if(!_0x4e0755[_0x2a5b('0x48')]['hasOwnProperty']('nolimit')){_0x22f59b[_0x2a5b('0x31')]=qs[_0x2a5b('0x31')](_0x4e0755[_0x2a5b('0x48')]['limit']);_0x22f59b['offset']=qs[_0x2a5b('0x34')](_0x4e0755[_0x2a5b('0x48')][_0x2a5b('0x34')]);}return _0x1cd667['getApplications'](_0x22f59b);}})['then'](function(_0x38b1c2){if(_0x38b1c2){return _0x38b1c2?{'count':_0x8e17dd,'rows':_0x38b1c2}:null;}})[_0x2a5b('0x3b')](respondWithResult(_0x34f492,null))[_0x2a5b('0x2c')](handleError(_0x34f492,null));};function Extension(_0x2a4323,_0x2bc971,_0x20bfc3,_0x4746c9){this[_0x2a5b('0x88')]=_0x2a5b('0x89');this['exten']=_0x2a4323['localstationid'];this['app']=_0x4746c9;this['type']=_0x2a5b('0x8a');this[_0x2a5b('0x8b')]=_0x2a5b('0x8c');this['FaxAccountId']=_0x2a4323['id'];this['priority']=_0x2bc971;this[_0x2a5b('0x8d')]=_0x20bfc3;}function createExtensionsReciveFax(_0x33dc9e){var _0x535e16=0x1;var _0x4106cf=[];_0x4106cf[_0x2a5b('0x8e')](new Extension(_0x33dc9e,_0x535e16,'',_0x2a5b('0x8f')));_0x535e16+=0x1;_0x4106cf[_0x2a5b('0x8e')](new Extension(_0x33dc9e,_0x535e16,'CDR(type)=inbound-fax',_0x2a5b('0x90')));_0x535e16+=0x1;for(var _0x233557 in _0x33dc9e){if(_0x33dc9e['hasOwnProperty'](_0x233557)&&(_0x233557===_0x2a5b('0x91')||_0x233557==='localstationid'||_0x233557===_0x2a5b('0x92')||_0x233557==='faxdetect'||_0x233557===_0x2a5b('0x93')||_0x233557===_0x2a5b('0x94')||_0x233557===_0x2a5b('0x95')||_0x233557===_0x2a5b('0x96')||_0x233557===_0x2a5b('0x97'))){_0x4106cf[_0x2a5b('0x8e')](new Extension(_0x33dc9e,_0x535e16,_0x2a5b('0x98')+_0x233557+')='+_0x33dc9e[_0x233557],'Set'));_0x535e16+=0x1;}}_0x4106cf['push'](new Extension(_0x33dc9e,_0x535e16,'6','Wait'));_0x535e16+=0x1;_0x4106cf[_0x2a5b('0x8e')](new Extension(_0x33dc9e,_0x535e16,_0x2a5b('0x99'),'ReceiveFax'));_0x535e16=0x0;return _0x4106cf;}exports[_0x2a5b('0x9a')]=function(_0x3e7944,_0x48a506,_0x51ed56){var _0x57af6a;return db[_0x2a5b('0x80')][_0x2a5b('0x9b')](function(_0xe4d903){return db['FaxAccount'][_0x2a5b('0x60')](_0x3e7944[_0x2a5b('0x61')],{'transaction':_0xe4d903})[_0x2a5b('0x3b')](function(_0x45eaa9){_0x57af6a=_0x45eaa9[_0x2a5b('0x3c')]({'plain':!![]});return db['VoiceExtension'][_0x2a5b('0x9c')](createExtensionsReciveFax(_0x57af6a),{'transaction':_0xe4d903});});})[_0x2a5b('0x3b')](function(){return _0x57af6a;})[_0x2a5b('0x3b')](respondWithResult(_0x48a506,null))[_0x2a5b('0x2c')](handleError(_0x48a506,null));};exports['updateAccountApplications']=function(_0x1956cf,_0x1b2b88,_0x1b2674){var _0x4792f7;return db['sequelize'][_0x2a5b('0x9b')](function(_0x2495e1){return db[_0x2a5b('0x44')][_0x2a5b('0x39')](_0x1956cf[_0x2a5b('0x61')],{'where':{'id':_0x1956cf[_0x2a5b('0x61')]['id']},'transaction':_0x2495e1})['then'](function(_0xed44b7){return db[_0x2a5b('0x9d')][_0x2a5b('0x3a')]({'where':{'FaxAccountId':_0x1956cf[_0x2a5b('0x61')]['id']},'transaction':_0x2495e1})[_0x2a5b('0x3b')](function(_0x2f8e36){return db[_0x2a5b('0x9d')]['bulkCreate'](createExtensionsReciveFax(_['omit'](_0x1956cf[_0x2a5b('0x61')],[_0x2a5b('0x9e'),'key',_0x2a5b('0x9f'),_0x2a5b('0xa0'),_0x2a5b('0xa1'),_0x2a5b('0xa2')])),{'transaction':_0x2495e1});});});})['then'](function(){return db[_0x2a5b('0x44')][_0x2a5b('0xa3')](_0x1956cf[_0x2a5b('0x61')]['id']);})['then'](respondWithResult(_0x1b2b88,null))[_0x2a5b('0x2c')](handleError(_0x1b2b88,null));};exports['getMessages']=function(_0x2d469d,_0x55eb9f,_0x11ce60){var _0x2aee4a={'raw':!![],'where':{}};var _0x25977d={};var _0x435efc={'count':0x0,'rows':[]};return db[_0x2a5b('0x44')][_0x2a5b('0x6c')]({'where':{'id':_0x2d469d['params']['id']}})[_0x2a5b('0x3b')](handleEntityNotFound(_0x55eb9f,null))['then'](function(_0x5230f6){if(_0x5230f6){_0x25977d[_0x2a5b('0x47')]=_[_0x2a5b('0x5e')](db[_0x2a5b('0xa4')][_0x2a5b('0x45')]);_0x25977d[_0x2a5b('0x48')]=_[_0x2a5b('0x5e')](_0x2d469d[_0x2a5b('0x48')]);_0x25977d[_0x2a5b('0x49')]=_[_0x2a5b('0x4a')](_0x25977d[_0x2a5b('0x47')],_0x25977d[_0x2a5b('0x48')]);_0x2aee4a[_0x2a5b('0x4b')]=_[_0x2a5b('0x4a')](_0x25977d[_0x2a5b('0x47')],qs[_0x2a5b('0x4c')](_0x2d469d['query']['fields']));_0x2aee4a[_0x2a5b('0x4b')]=_0x2aee4a[_0x2a5b('0x4b')][_0x2a5b('0x4d')]?_0x2aee4a['attributes']:_0x25977d['model'];if(!_0x2d469d[_0x2a5b('0x48')][_0x2a5b('0x4e')](_0x2a5b('0x4f'))){_0x2aee4a[_0x2a5b('0x31')]=qs[_0x2a5b('0x31')](_0x2d469d['query'][_0x2a5b('0x31')]);_0x2aee4a['offset']=qs[_0x2a5b('0x34')](_0x2d469d[_0x2a5b('0x48')][_0x2a5b('0x34')]);}_0x2aee4a['order']=qs[_0x2a5b('0x51')](_0x2d469d[_0x2a5b('0x48')][_0x2a5b('0x51')]);_0x2aee4a['where']=qs[_0x2a5b('0x49')](_[_0x2a5b('0x52')](_0x2d469d[_0x2a5b('0x48')],_0x25977d[_0x2a5b('0x49')]));_0x2aee4a['where']['FaxAccountId']=_0x5230f6['id'];if(_0x2d469d[_0x2a5b('0x48')][_0x2a5b('0x53')]){_0x2aee4a[_0x2a5b('0x54')]=_[_0x2a5b('0x55')](_0x2aee4a['where'],{'$or':_[_0x2a5b('0x43')](_0x2aee4a[_0x2a5b('0x4b')],function(_0x12b803){var _0x4c3821={};_0x4c3821[_0x12b803]={'$like':'%'+_0x2d469d['query']['filter']+'%'};return _0x4c3821;})});}if(_0x2d469d[_0x2a5b('0x48')][_0x2a5b('0xa5')]){var _0x262a6e=_0x2d469d[_0x2a5b('0x48')][_0x2a5b('0xa5')]['split'](',');var _0x4e392c={};_0x4e392c[_0x262a6e[0x0]]={'$gte':moment(_0x262a6e[0x1])[_0x2a5b('0xa6')](_0x2a5b('0xa7'))};_0x2aee4a['where']=_[_0x2a5b('0x55')](_0x2aee4a[_0x2a5b('0x54')],_0x4e392c);}_0x2aee4a=_['merge']({},_0x2aee4a,_0x2d469d[_0x2a5b('0x57')]);return db[_0x2a5b('0xa4')][_0x2a5b('0x33')]({'where':_0x2aee4a['where']})[_0x2a5b('0x3b')](function(_0x511ed1){_0x435efc['count']=_0x511ed1;if(_0x2d469d[_0x2a5b('0x48')]['includeAll']){_0x2aee4a[_0x2a5b('0x77')]=[{'all':!![]}];}return db['FaxMessage'][_0x2a5b('0x59')](_0x2aee4a);})[_0x2a5b('0x3b')](function(_0x1afa77){_0x435efc[_0x2a5b('0x5a')]=_0x1afa77;return _0x435efc;});}})[_0x2a5b('0x3b')](respondWithFilteredResult(_0x55eb9f,_0x2aee4a))[_0x2a5b('0x2c')](handleError(_0x55eb9f,null));};exports[_0x2a5b('0x40')]=function(_0x23ce95,_0x39d155,_0x2e0ee4){var _0x29d4a8,_0x1c9b00={},_0x3439f4;if(_0x23ce95[_0x2a5b('0x61')]['to']){_0x3439f4=_0x23ce95[_0x2a5b('0x61')]['to'][0x0];}return db[_0x2a5b('0x44')][_0x2a5b('0x5f')]({'where':{'id':_0x23ce95[_0x2a5b('0x5c')]['id']},'include':[{'model':db[_0x2a5b('0xa8')],'as':_0x2a5b('0xa9'),'include':[{'model':db[_0x2a5b('0xaa')],'as':_0x2a5b('0xab'),'where':{'fax':_0x3439f4},'limit':0x1,'order':[[_0x2a5b('0xa0'),_0x2a5b('0xac')]]}]}]})[_0x2a5b('0x3b')](handleEntityNotFound(_0x39d155,null))[_0x2a5b('0x3b')](function(_0x4bfc36){_0x29d4a8=_0x4bfc36;if(_0x23ce95[_0x2a5b('0x61')][_0x2a5b('0xad')]&&_0x23ce95[_0x2a5b('0x61')]['attachments'][_0x2a5b('0x4d')]){for(var _0x55eb83=0x0;_0x55eb83<_0x23ce95[_0x2a5b('0x61')][_0x2a5b('0xad')][_0x2a5b('0x4d')];_0x55eb83+=0x1){_0x23ce95[_0x2a5b('0x61')][_0x2a5b('0xad')][_0x55eb83]={'filename':_0x23ce95[_0x2a5b('0x61')][_0x2a5b('0xad')][_0x55eb83][_0x2a5b('0x3f')],'id':_0x23ce95['body']['attachments'][_0x55eb83]['id'],'path':path[_0x2a5b('0xae')](config[_0x2a5b('0xaf')],_0x2a5b('0xb0'),_0x23ce95[_0x2a5b('0x61')][_0x2a5b('0xad')][_0x55eb83][_0x2a5b('0xb1')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_[_0x2a5b('0xb2')](_0x23ce95[_0x2a5b('0x5c')]['id'])?undefined:_0x23ce95[_0x2a5b('0x5c')]['id'],'path':_['isNil'](_0x23ce95['body'][_0x2a5b('0xad')][0x0][_0x2a5b('0x7')])?undefined:_0x23ce95[_0x2a5b('0x61')][_0x2a5b('0xad')][0x0][_0x2a5b('0x7')],'fax':_['isNil'](_0x23ce95[_0x2a5b('0x61')]['to'][0x0])?undefined:_0x23ce95[_0x2a5b('0x61')]['to'][0x0]},client9002);})['then'](function(){if(_0x29d4a8){if(_[_0x2a5b('0xb2')](_0x23ce95[_0x2a5b('0x61')]['from'])){_0x23ce95[_0x2a5b('0x61')][_0x2a5b('0xb3')]=util[_0x2a5b('0xa6')](_0x2a5b('0xb4'),_0x29d4a8['name'],_0x29d4a8[_0x2a5b('0xb5')]);}if(_0x29d4a8[_0x2a5b('0xa9')]){if(_0x29d4a8[_0x2a5b('0xa9')][_0x2a5b('0xab')][_0x2a5b('0x4d')]){return _0x29d4a8[_0x2a5b('0xa9')][_0x2a5b('0xab')][0x0];}else{return db['CmContact'][_0x2a5b('0x60')](_[_0x2a5b('0x1b')](_0x23ce95['body'],{'firstName':_0x23ce95[_0x2a5b('0x61')]['to'][0x0],'phone':_0x23ce95[_0x2a5b('0x61')]['to'][0x0],'fax':_0x23ce95['body']['to'][0x0],'ListId':_0x29d4a8[_0x2a5b('0xa2')]}));}}else{throw new Error(_0x2a5b('0xb6'));}}else{throw new Error(_0x2a5b('0xb7'));}})['then'](function(_0x8ae01b){if(_0x8ae01b){return db[_0x2a5b('0x74')][_0x2a5b('0x5f')]({'where':{'ContactId':_0x8ae01b['id'],'closed':![],'FaxAccountId':_0x29d4a8['id']}})['then'](function(_0x45acd4){if(_0x45acd4){return[_0x45acd4,![]];}return db[_0x2a5b('0x74')][_0x2a5b('0x60')]({'UserId':_0x23ce95[_0x2a5b('0x62')]['id'],'ContactId':_0x8ae01b['id'],'FaxAccountId':_0x29d4a8['id'],'fax':_0x23ce95[_0x2a5b('0x61')]['to'][0x0],'firstMsgDirection':_0x2a5b('0xb8'),'Messages':[_[_0x2a5b('0x55')](_0x23ce95[_0x2a5b('0x61')],{'read':![],'body':_0x23ce95[_0x2a5b('0x61')][_0x2a5b('0xad')][0x0][_0x2a5b('0xb9')],'FaxAccountId':_0x29d4a8['id'],'UserId':_0x23ce95[_0x2a5b('0x62')]['id'],'ContactId':_0x8ae01b['id'],'AttachmentId':_0x23ce95['body'][_0x2a5b('0xad')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x2a5b('0xba')}]})[_0x2a5b('0x3b')](function(_0x11e1a7){return[_0x11e1a7,!![]];});});}else{throw new Error(_0x2a5b('0xbb'));}})[_0x2a5b('0xbc')](function(_0x5d3faa,_0x4e4375){if(_0x4e4375){return _0x5d3faa;}return db[_0x2a5b('0xa4')][_0x2a5b('0x60')]({'direction':_0x2a5b('0xb8'),'read':![],'body':_0x23ce95[_0x2a5b('0x61')][_0x2a5b('0xad')][0x0][_0x2a5b('0xb9')],'FaxAccountId':_0x29d4a8['id'],'FaxInteractionId':_0x5d3faa['id'],'UserId':_0x23ce95[_0x2a5b('0x62')]['id'],'ContactId':_0x5d3faa[_0x2a5b('0xbd')],'AttachmentId':_0x23ce95[_0x2a5b('0x61')]['attachments'][0x0]['id']})[_0x2a5b('0x3b')](function(_0x56b74f){_0x5d3faa['dataValues']['Messages']=[];_0x5d3faa[_0x2a5b('0xbe')][_0x2a5b('0xba')][_0x2a5b('0x8e')](_0x56b74f[_0x2a5b('0xbe')]);return _0x5d3faa;});})[_0x2a5b('0x3b')](function(_0x369178){respondWithRpcPromise(_0x2a5b('0xbf'),'SendFax',{'FaxAccountId':_[_0x2a5b('0xb2')](_0x23ce95[_0x2a5b('0x5c')]['id'])?undefined:_0x23ce95[_0x2a5b('0x5c')]['id'],'path':_[_0x2a5b('0xb2')](_0x23ce95[_0x2a5b('0x61')][_0x2a5b('0xad')][0x0][_0x2a5b('0x7')])?undefined:_0x23ce95[_0x2a5b('0x61')][_0x2a5b('0xad')][0x0][_0x2a5b('0x7')],'fax':_[_0x2a5b('0xb2')](_0x23ce95[_0x2a5b('0x61')]['to'][0x0])?undefined:_0x23ce95['body']['to'][0x0],'AttachmentId':_0x23ce95[_0x2a5b('0x61')]['attachments'][0x0]['id']},client9002)['then'](function(_0x326fd8){logger[_0x2a5b('0x24')](_0x2a5b('0xc0'),_0x326fd8);})[_0x2a5b('0x2c')](function(_0x5b995c){logger[_0x2a5b('0x24')]('SendFaxRpc,\x20%s',_0x5b995c);});return _0x369178;})['then'](respondWithResult(_0x39d155,null))[_0x2a5b('0x2c')](handleError(_0x39d155,null));};exports[_0x2a5b('0xc1')]=function(_0x4fbd00,_0x1f535e,_0x5847c3){return db['FaxAccount'][_0x2a5b('0x5f')]({'where':{'id':_0x4fbd00[_0x2a5b('0x5c')]['id']}})[_0x2a5b('0x3b')](handleEntityNotFound(_0x1f535e,null))[_0x2a5b('0x3b')](function(_0x252441){if(_0x252441){return _0x252441[_0x2a5b('0xc1')](_0x4fbd00[_0x2a5b('0x61')]['ids'],_[_0x2a5b('0x75')](_0x4fbd00[_0x2a5b('0x61')],[_0x2a5b('0x6e'),'id'])||{})['spread'](function(_0x56a362){for(var _0x2c724a=0x0;_0x2c724a<_0x4fbd00[_0x2a5b('0x61')][_0x2a5b('0x6e')][_0x2a5b('0x4d')];_0x2c724a+=0x1){socket[_0x2a5b('0xc2')](_0x2a5b('0xc3'),{'UserId':Number(_0x4fbd00[_0x2a5b('0x61')][_0x2a5b('0x6e')][_0x2c724a]),'FaxAccountId':Number(_0x4fbd00[_0x2a5b('0x5c')]['id'])});}return _0x56a362;});}})[_0x2a5b('0x3b')](respondWithResult(_0x1f535e,null))[_0x2a5b('0x2c')](handleError(_0x1f535e,null));};exports[_0x2a5b('0xc4')]=function(_0x8eff3b,_0x18c7e6,_0x5ec896){return db[_0x2a5b('0x44')][_0x2a5b('0x5f')]({'where':{'id':_0x8eff3b[_0x2a5b('0x5c')]['id']}})[_0x2a5b('0x3b')](handleEntityNotFound(_0x18c7e6,null))[_0x2a5b('0x3b')](function(_0x2449d1){if(_0x2449d1){return _0x2449d1[_0x2a5b('0xc4')](_0x8eff3b[_0x2a5b('0x48')][_0x2a5b('0x6e')])[_0x2a5b('0x3b')](function(){if(_[_0x2a5b('0xc5')](_0x8eff3b[_0x2a5b('0x48')][_0x2a5b('0x6e')])){for(var _0x1fc5ef=0x0;_0x1fc5ef<_0x8eff3b[_0x2a5b('0x48')][_0x2a5b('0x6e')][_0x2a5b('0x4d')];_0x1fc5ef+=0x1){socket[_0x2a5b('0xc2')]('userFaxAccount:remove',{'UserId':Number(_0x8eff3b[_0x2a5b('0x48')]['ids'][_0x1fc5ef]),'FaxAccountId':Number(_0x8eff3b[_0x2a5b('0x5c')]['id'])});}}else{socket['emit'](_0x2a5b('0xc6'),{'UserId':Number(_0x8eff3b[_0x2a5b('0x48')][_0x2a5b('0x6e')]),'FaxAccountId':Number(_0x8eff3b[_0x2a5b('0x5c')]['id'])});}});}})[_0x2a5b('0x3b')](respondWithStatusCode(_0x18c7e6,null))['catch'](handleError(_0x18c7e6,null));};exports[_0x2a5b('0xc7')]=function(_0x3f8250,_0xf91fb2,_0x266a56){var _0x15011f={};var _0x5e3c92={};var _0x398c02;var _0x4208a8;return db['FaxAccount'][_0x2a5b('0x6c')]({'where':{'id':_0x3f8250[_0x2a5b('0x5c')]['id']}})[_0x2a5b('0x3b')](handleEntityNotFound(_0xf91fb2,null))[_0x2a5b('0x3b')](function(_0x47d8f7){if(_0x47d8f7){_0x398c02=_0x47d8f7;_0x5e3c92[_0x2a5b('0x47')]=_[_0x2a5b('0x5e')](db[_0x2a5b('0xc8')][_0x2a5b('0x45')]);_0x5e3c92[_0x2a5b('0x48')]=_[_0x2a5b('0x5e')](_0x3f8250['query']);_0x5e3c92[_0x2a5b('0x49')]=_[_0x2a5b('0x4a')](_0x5e3c92[_0x2a5b('0x47')],_0x5e3c92['query']);_0x15011f[_0x2a5b('0x4b')]=_['intersection'](_0x5e3c92[_0x2a5b('0x47')],qs['fields'](_0x3f8250[_0x2a5b('0x48')][_0x2a5b('0x4c')]));_0x15011f[_0x2a5b('0x4b')]=_0x15011f[_0x2a5b('0x4b')]['length']?_0x15011f[_0x2a5b('0x4b')]:_0x5e3c92[_0x2a5b('0x47')];_0x15011f['order']=qs[_0x2a5b('0x51')](_0x3f8250['query']['sort']);_0x15011f['where']=qs[_0x2a5b('0x49')](_[_0x2a5b('0x52')](_0x3f8250[_0x2a5b('0x48')],_0x5e3c92[_0x2a5b('0x49')]));if(_0x3f8250[_0x2a5b('0x48')]['filter']){_0x15011f[_0x2a5b('0x54')]=_[_0x2a5b('0x55')](_0x15011f['where'],{'$or':_['map'](_0x15011f[_0x2a5b('0x4b')],function(_0xe14b14){var _0x21be0f={};_0x21be0f[_0xe14b14]={'$like':'%'+_0x3f8250[_0x2a5b('0x48')][_0x2a5b('0x53')]+'%'};return _0x21be0f;})});}_0x15011f=_['merge']({},_0x15011f,_0x3f8250[_0x2a5b('0x57')]);return _0x398c02['getAgents'](_0x15011f);}})['then'](function(_0x36e148){if(_0x36e148){_0x4208a8=_0x36e148[_0x2a5b('0x4d')];if(!_0x3f8250['query'][_0x2a5b('0x4e')](_0x2a5b('0x4f'))){_0x15011f['limit']=qs['limit'](_0x3f8250[_0x2a5b('0x48')]['limit']);_0x15011f[_0x2a5b('0x34')]=qs[_0x2a5b('0x34')](_0x3f8250[_0x2a5b('0x48')][_0x2a5b('0x34')]);}return _0x398c02[_0x2a5b('0xc7')](_0x15011f);}})[_0x2a5b('0x3b')](function(_0x3fabc1){if(_0x3fabc1){return _0x3fabc1?{'count':_0x4208a8,'rows':_0x3fabc1}:null;}})[_0x2a5b('0x3b')](respondWithResult(_0xf91fb2,null))[_0x2a5b('0x2c')](handleError(_0xf91fb2,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 3299f16..45f240d 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 _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 +var _0x8555=['exports','events','FaxAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x27eb4d,_0x1b486f){var _0x5babe5=function(_0x321fbd){while(--_0x321fbd){_0x27eb4d['push'](_0x27eb4d['shift']());}};_0x5babe5(++_0x1b486f);}(_0x8555,0x13c));var _0x5855=function(_0x35efbd,_0x421380){_0x35efbd=_0x35efbd-0x0;var _0x12579f=_0x8555[_0x35efbd];return _0x12579f;};'use strict';var EventEmitter=require(_0x5855('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x5855('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x5855('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5855('0x3'),'afterDestroy':_0x5855('0x4')};function emitEvent(_0x578012){return function(_0x5950ae,_0x2ce221,_0x35ea5e){FaxAccountEvents[_0x5855('0x5')](_0x578012+':'+_0x5950ae['id'],_0x5950ae);FaxAccountEvents[_0x5855('0x5')](_0x578012,_0x5950ae);_0x35ea5e(null);};}for(var e in events){if(events[_0x5855('0x6')](e)){var event=events[e];FaxAccount[_0x5855('0x7')](e,emitEvent(event));}}module[_0x5855('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index f70a777..43b23ba 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 _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 +var _0x4125=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./faxAccount.attributes','FaxAccount'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x4125,0x1c2));var _0x5412=function(_0x48d430,_0x3e6f1c){_0x48d430=_0x48d430-0x0;var _0x1fdbd8=_0x4125[_0x48d430];return _0x1fdbd8;};'use strict';var _=require(_0x5412('0x0'));var util=require(_0x5412('0x1'));var logger=require(_0x5412('0x2'))('api');var moment=require(_0x5412('0x3'));var BPromise=require(_0x5412('0x4'));var rp=require(_0x5412('0x5'));var fs=require('fs');var path=require(_0x5412('0x6'));var rimraf=require(_0x5412('0x7'));var config=require('../../config/environment');var attributes=require(_0x5412('0x8'));module['exports']=function(_0x42f532,_0xe21785){return _0x42f532['define'](_0x5412('0x9'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 694cf55..6845f01 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 _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 +var _0xcbc6=['asc','length','ListId','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','created','interaction','FaxMessage','create','ContactId','AttachmentId','name','UserId','agent','waitForTheAssignedAgent','*,*,*,*','queueId','unshift','queue','waitForTheAssignedQueue','startRouting','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetFaxAccount','FaxAccount','findAll','raw','options','where','include','map','model','attributes','debug','catch','NotifyFaxAccount','body','fax','CmContact','describe','ValidationError','no\x20available\x20attributes','keys','createdAt','difference','updatedAt','isNil','from','Sequelize','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','find','account','CmList','List','Contacts','Applications','get','applications','list','priority'];(function(_0x55e54c,_0x3697bf){var _0x33ec5f=function(_0xc47d5f){while(--_0xc47d5f){_0x55e54c['push'](_0x55e54c['shift']());}};_0x33ec5f(++_0x3697bf);}(_0xcbc6,0x12f));var _0x6cbc=function(_0x29f6f8,_0x3bd3e4){_0x29f6f8=_0x29f6f8-0x0;var _0x6c4589=_0xcbc6[_0x29f6f8];return _0x6c4589;};'use strict';var _=require(_0x6cbc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6cbc('0x1'));var rs=require(_0x6cbc('0x2'));var fs=require('fs');var Redis=require(_0x6cbc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6cbc('0x4'));var logger=require(_0x6cbc('0x5'))(_0x6cbc('0x6'));var config=require('../../config/environment');var jayson=require(_0x6cbc('0x7'));var client=jayson['client'][_0x6cbc('0x8')]({'port':0x232c});config[_0x6cbc('0x9')]=_['defaults'](config[_0x6cbc('0x9')],{'host':_0x6cbc('0xa'),'port':0x18eb});var socket=require(_0x6cbc('0xb'))(new Redis(config[_0x6cbc('0x9')]));require(_0x6cbc('0xc'))[_0x6cbc('0xd')](socket);function respondWithRpcPromise(_0x195311,_0x221804,_0x13bfe2){return new BPromise(function(_0x2b69eb,_0x1f0c45){return client[_0x6cbc('0xe')](_0x195311,_0x13bfe2)[_0x6cbc('0xf')](function(_0x2fa8b1){logger[_0x6cbc('0x10')](_0x6cbc('0x11'),_0x221804,'request\x20sent');logger['debug'](_0x6cbc('0x12'),_0x221804,_0x6cbc('0x13'),JSON[_0x6cbc('0x14')](_0x2fa8b1));if(_0x2fa8b1[_0x6cbc('0x15')]){if(_0x2fa8b1[_0x6cbc('0x15')][_0x6cbc('0x16')]===0x1f4){logger[_0x6cbc('0x15')](_0x6cbc('0x11'),_0x221804,_0x2fa8b1['error'][_0x6cbc('0x17')]);return _0x1f0c45(_0x2fa8b1['error'][_0x6cbc('0x17')]);}logger[_0x6cbc('0x15')](_0x6cbc('0x11'),_0x221804,_0x2fa8b1['error'][_0x6cbc('0x17')]);return _0x2b69eb(_0x2fa8b1[_0x6cbc('0x15')][_0x6cbc('0x17')]);}else{logger[_0x6cbc('0x10')](_0x6cbc('0x11'),_0x221804,_0x6cbc('0x13'));_0x2b69eb(_0x2fa8b1[_0x6cbc('0x18')]['message']);}})['catch'](function(_0xa9c9fe){logger['error'](_0x6cbc('0x11'),_0x221804,_0xa9c9fe);_0x1f0c45(_0xa9c9fe);});});}exports[_0x6cbc('0x19')]=function(_0x57c596){var _0x5f4186=this;return new Promise(function(_0x697197,_0x40894a){return db[_0x6cbc('0x1a')][_0x6cbc('0x1b')]({'raw':_0x57c596['options']?_0x57c596['options'][_0x6cbc('0x1c')]===undefined?!![]:![]:!![],'where':_0x57c596['options']?_0x57c596[_0x6cbc('0x1d')][_0x6cbc('0x1e')]||null:null,'attributes':_0x57c596[_0x6cbc('0x1d')]?_0x57c596[_0x6cbc('0x1d')]['attributes']||null:null,'limit':_0x57c596[_0x6cbc('0x1d')]?_0x57c596[_0x6cbc('0x1d')]['limit']||null:null,'include':_0x57c596[_0x6cbc('0x1d')]?_0x57c596[_0x6cbc('0x1d')][_0x6cbc('0x1f')]?_[_0x6cbc('0x20')](_0x57c596[_0x6cbc('0x1d')][_0x6cbc('0x1f')],function(_0x2dff63){return{'model':db[_0x2dff63[_0x6cbc('0x21')]],'as':_0x2dff63['as'],'attributes':_0x2dff63[_0x6cbc('0x22')],'include':_0x2dff63[_0x6cbc('0x1f')]?_[_0x6cbc('0x20')](_0x2dff63[_0x6cbc('0x1f')],function(_0x488b52){return{'model':db[_0x488b52[_0x6cbc('0x21')]],'as':_0x488b52['as'],'attributes':_0x488b52[_0x6cbc('0x22')],'include':_0x488b52['include']?_[_0x6cbc('0x20')](_0x488b52[_0x6cbc('0x1f')],function(_0x7d7a41){return{'model':db[_0x7d7a41[_0x6cbc('0x21')]],'as':_0x7d7a41['as'],'attributes':_0x7d7a41[_0x6cbc('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d6063){logger[_0x6cbc('0x10')]('GetFaxAccount',_0x57c596);logger[_0x6cbc('0x23')](_0x6cbc('0x19'),_0x57c596,JSON[_0x6cbc('0x14')](_0x3d6063));_0x697197(_0x3d6063);})[_0x6cbc('0x24')](function(_0x1fb561){logger[_0x6cbc('0x15')]('GetFaxAccount',_0x1fb561['message'],_0x57c596);_0x40894a(_0x5f4186[_0x6cbc('0x15')](0x1f4,_0x1fb561[_0x6cbc('0x17')]));});});};exports[_0x6cbc('0x25')]=function(_0x55fd1a,_0x35e223,_0x4ff68e){var _0x615d88=this;return new Promise(function(_0x47d638,_0x523c07){var _0x4e985a={'body':_0x55fd1a[_0x6cbc('0x26')],'channel':_0x6cbc('0x27')};var _0x2301fa=[];var _0x49fa1a=[];var _0x3edcae={};return db[_0x6cbc('0x28')][_0x6cbc('0x29')]()['then'](function(_0x30c71d){if(!_0x30c71d){throw new db['Sequelize'][(_0x6cbc('0x2a'))](_0x6cbc('0x2b'));}_0x2301fa=_['difference'](_[_0x6cbc('0x2c')](_0x30c71d),[_0x6cbc('0x2d'),'updatedAt']);_0x49fa1a=_[_0x6cbc('0x2e')](_[_0x6cbc('0x2c')](_0x30c71d),[_0x6cbc('0x2d'),_0x6cbc('0x2f'),'CompanyId','ListId']);if(_0x55fd1a['body']['id']){delete _0x55fd1a[_0x6cbc('0x26')]['id'];}if(_[_0x6cbc('0x30')](_0x55fd1a[_0x6cbc('0x26')][_0x6cbc('0x31')])){throw new db[(_0x6cbc('0x32'))]['ValidationError'](_0x6cbc('0x33'));}if(_[_0x6cbc('0x30')](_0x55fd1a[_0x6cbc('0x26')][_0x6cbc('0x26')])||_0x55fd1a['body']['body']===''){throw new db[(_0x6cbc('0x32'))][(_0x6cbc('0x2a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x6cbc('0x30')](_0x55fd1a[_0x6cbc('0x26')][_0x6cbc('0x34')])){throw new db[(_0x6cbc('0x32'))][(_0x6cbc('0x2a'))](_0x6cbc('0x35')+_0x49fa1a);}if(!_[_0x6cbc('0x36')](_0x49fa1a,_0x55fd1a['body'][_0x6cbc('0x34')])){throw new db[(_0x6cbc('0x32'))][(_0x6cbc('0x2a'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x49fa1a);}_0x3edcae[_0x55fd1a[_0x6cbc('0x26')][_0x6cbc('0x34')]]=_0x55fd1a[_0x6cbc('0x26')][_0x6cbc('0x31')];})[_0x6cbc('0xf')](function(){return db[_0x6cbc('0x1a')][_0x6cbc('0x37')]({'where':{'id':_0x55fd1a[_0x6cbc('0x38')]['id']},'include':[{'model':db[_0x6cbc('0x39')],'as':_0x6cbc('0x3a'),'include':[{'model':db[_0x6cbc('0x28')],'as':_0x6cbc('0x3b'),'where':_0x3edcae,'limit':0x1,'order':[[_0x6cbc('0x2f'),'DESC']]}]},{'model':db['FaxApplication'],'as':_0x6cbc('0x3c')}]});})[_0x6cbc('0xf')](function(_0x49f4a8){if(_0x49f4a8&&_0x49f4a8[_0x6cbc('0x3a')]){var _0x38eac1=_0x49f4a8[_0x6cbc('0x3d')]({'plain':!![]});_0x4e985a['account']=_0x38eac1;_0x4e985a[_0x6cbc('0x3e')]=_0x38eac1[_0x6cbc('0x3c')];_0x4e985a[_0x6cbc('0x3f')]=_0x38eac1[_0x6cbc('0x3a')];_0x4e985a['applications']=_['orderBy'](_0x4e985a[_0x6cbc('0x3e')],[_0x6cbc('0x40')],[_0x6cbc('0x41')]);if(_0x4e985a[_0x6cbc('0x38')][_0x6cbc('0x3c')]){delete _0x4e985a[_0x6cbc('0x38')][_0x6cbc('0x3c')];}if(_0x4e985a[_0x6cbc('0x38')][_0x6cbc('0x3a')]&&_0x4e985a[_0x6cbc('0x38')][_0x6cbc('0x3a')][_0x6cbc('0x3b')][_0x6cbc('0x42')]){return _0x4e985a[_0x6cbc('0x38')][_0x6cbc('0x3a')]['Contacts'][0x0];}var _0x49c097=_['defaults'](_0x55fd1a[_0x6cbc('0x26')],{'firstName':_0x55fd1a[_0x6cbc('0x26')][_0x6cbc('0x31')],'ListId':_0x38eac1[_0x6cbc('0x43')]});_0x49c097[_0x55fd1a['body'][_0x6cbc('0x34')]]=_0x55fd1a[_0x6cbc('0x26')][_0x6cbc('0x31')];return db['CmContact']['create'](_0x49c097,{'fields':_0x2301fa,'raw':!![]});}})[_0x6cbc('0xf')](function(_0x249f81){_0x4e985a[_0x6cbc('0x44')]=_0x249f81;if(_0x249f81){var _0x2eb263={'ContactId':_0x249f81['id'],'FaxAccountId':_0x55fd1a[_0x6cbc('0x38')]['id'],'fax':_0x249f81[_0x6cbc('0x27')]};return db[_0x6cbc('0x45')][_0x6cbc('0x37')]({'where':{'ContactId':_0x249f81['id'],'closed':![],'FaxAccountId':_0x55fd1a[_0x6cbc('0x38')]['id']}})['then'](function(_0x1b0abd){if(_0x1b0abd){return[_0x1b0abd,![]];}return db['FaxInteraction']['create'](_0x2eb263)[_0x6cbc('0xf')](function(_0x7a9e){return[_0x7a9e,!![]];});});}else{throw new Error(_0x6cbc('0x46'));}})[_0x6cbc('0x47')](function(_0x2b1cae,_0x4ac795){var _0x23d6b1=_0x2b1cae[_0x6cbc('0x3d')]({'plain':!![]});if(_0x4ac795){if(_0x4e985a['account'][_0x6cbc('0x48')]){_0x4e985a[_0x6cbc('0x3e')][_0x6cbc('0x49')]({'id':0x0,'priority':_0x4e985a[_0x6cbc('0x3e')][_0x6cbc('0x42')]+0x1,'app':_0x6cbc('0x4a'),'appdata':_0x6cbc('0x4b'),'interval':'*,*,*,*'});}_0x23d6b1[_0x6cbc('0x4c')]=!![];}else{_0x23d6b1[_0x6cbc('0x4c')]=![];}_0x4e985a[_0x6cbc('0x4d')]=_0x23d6b1;return db[_0x6cbc('0x4e')][_0x6cbc('0x4f')]({'body':_0x55fd1a[_0x6cbc('0x26')][_0x6cbc('0x26')],'FaxAccountId':_0x55fd1a[_0x6cbc('0x38')]['id'],'FaxInteractionId':_0x2b1cae['id'],'direction':'in','ContactId':_0x2b1cae[_0x6cbc('0x50')],'AttachmentId':_0x55fd1a['body'][_0x6cbc('0x51')]});})[_0x6cbc('0xf')](function(_0x266ab0){_0x4e985a['message']=_0x266ab0;if(!_0x4e985a[_0x6cbc('0x4d')]['UserId'])return;return db['User']['find']({'attributes':['id',_0x6cbc('0x52')],'where':{'id':_0x4e985a[_0x6cbc('0x4d')][_0x6cbc('0x53')]}});})['then'](function(_0x185958){if(_0x185958){_0x4e985a[_0x6cbc('0x3e')]['unshift']({'id':0x0,'priority':0x0,'app':_0x6cbc('0x54'),'appdata':_0x185958['name']+','+(_0x4e985a['account'][_0x6cbc('0x55')]||0xa),'interval':_0x6cbc('0x56')});}if(!_0x4e985a[_0x6cbc('0x4d')][_0x6cbc('0x57')])return;return db['FaxQueue'][_0x6cbc('0x37')]({'attributes':['id',_0x6cbc('0x52')],'where':{'id':_0x4e985a[_0x6cbc('0x4d')][_0x6cbc('0x57')]}});})[_0x6cbc('0xf')](function(_0xe39039){if(_0xe39039){_0x4e985a['applications'][_0x6cbc('0x58')]({'id':0x0,'priority':0x1,'app':_0x6cbc('0x59'),'appdata':_0xe39039[_0x6cbc('0x52')]+','+(_0x4e985a[_0x6cbc('0x38')][_0x6cbc('0x5a')]||0x12c),'interval':_0x6cbc('0x56')});}return respondWithRpcPromise('Start',_0x6cbc('0x5b'),_0x4e985a);})[_0x6cbc('0xf')](function(_0x19404d){_0x47d638(_0x19404d);})[_0x6cbc('0x24')](function(_0x19a5a5){_0x523c07(_0x615d88[_0x6cbc('0x15')](0x1f4,_0x19a5a5[_0x6cbc('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index bef1fc0..cb7319a 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 _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 +var _0xc67a=['register','length','faxAccount:','./faxAccount.events','remove','update','emit'];(function(_0x53e19d,_0x604957){var _0x5ba332=function(_0x34f66e){while(--_0x34f66e){_0x53e19d['push'](_0x53e19d['shift']());}};_0x5ba332(++_0x604957);}(_0xc67a,0x1ed));var _0xac67=function(_0x220c6d,_0xbda2d1){_0x220c6d=_0x220c6d-0x0;var _0x173b5e=_0xc67a[_0x220c6d];return _0x173b5e;};'use strict';var FaxAccountEvents=require(_0xac67('0x0'));var events=['save',_0xac67('0x1'),_0xac67('0x2')];function createListener(_0x6833b3,_0x59adb4){return function(_0x3acfb1){_0x59adb4[_0xac67('0x3')](_0x6833b3,_0x3acfb1);};}function removeListener(_0x5531cb,_0x18e732){return function(){FaxAccountEvents['removeListener'](_0x5531cb,_0x18e732);};}exports[_0xac67('0x4')]=function(_0x2e8b54){for(var _0x1b414f=0x0,_0x193eb5=events[_0xac67('0x5')];_0x1b414f<_0x193eb5;_0x1b414f++){var _0x2e5157=events[_0x1b414f];var _0x10b765=createListener(_0xac67('0x6')+_0x2e5157,_0x2e8b54);FaxAccountEvents['on'](_0x2e5157,_0x10b765);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index a6ea1ec..5933fb4 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 _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 +var _0x52cb=['express','Router','../../components/auth/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','addInteraction','addAccountApplications','updateAccountApplications','send','addAgents','put','destroy','delete','removeDispositions','removeAgents','exports','path','connect-timeout'];(function(_0x666eb9,_0x5a9e90){var _0x3fc80b=function(_0x4ec6ff){while(--_0x4ec6ff){_0x666eb9['push'](_0x666eb9['shift']());}};_0x3fc80b(++_0x5a9e90);}(_0x52cb,0x1d2));var _0xb52c=function(_0x23bd05,_0x409ba8){_0x23bd05=_0x23bd05-0x0;var _0x2ea842=_0x52cb[_0x23bd05];return _0x2ea842;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb52c('0x0'));var timeout=require(_0xb52c('0x1'));var express=require(_0xb52c('0x2'));var router=express[_0xb52c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb52c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb52c('0x5'));var controller=require(_0xb52c('0x6'));router[_0xb52c('0x7')]('/',auth[_0xb52c('0x8')](),controller[_0xb52c('0x9')]);router[_0xb52c('0x7')](_0xb52c('0xa'),auth[_0xb52c('0x8')](),controller[_0xb52c('0xb')]);router[_0xb52c('0x7')](_0xb52c('0xc'),auth[_0xb52c('0x8')](),controller[_0xb52c('0xd')]);router[_0xb52c('0x7')](_0xb52c('0xe'),auth['isAuthenticated'](),controller[_0xb52c('0xf')]);router[_0xb52c('0x7')](_0xb52c('0x10'),auth[_0xb52c('0x8')](),controller[_0xb52c('0x11')]);router['get'](_0xb52c('0x12'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xb52c('0x7')](_0xb52c('0x13'),auth[_0xb52c('0x8')](),controller[_0xb52c('0x14')]);router[_0xb52c('0x7')](_0xb52c('0x15'),auth[_0xb52c('0x8')](),controller[_0xb52c('0x16')]);router[_0xb52c('0x7')](_0xb52c('0x17'),auth[_0xb52c('0x8')](),controller[_0xb52c('0x18')]);router[_0xb52c('0x19')]('/',auth['isAuthenticated'](),controller[_0xb52c('0x1a')]);router[_0xb52c('0x19')](_0xb52c('0xe'),auth['isAuthenticated'](),controller[_0xb52c('0x1b')]);router[_0xb52c('0x19')]('/:id/canned_answers',auth[_0xb52c('0x8')](),controller['addAnswer']);router['post'](_0xb52c('0x12'),auth[_0xb52c('0x8')](),controller[_0xb52c('0x1c')]);router[_0xb52c('0x19')](_0xb52c('0x13'),auth[_0xb52c('0x8')](),controller['addApplications']);router[_0xb52c('0x19')]('/addaccountapplications',auth[_0xb52c('0x8')](),controller[_0xb52c('0x1d')]);router[_0xb52c('0x19')]('/updateaccountapplications',auth[_0xb52c('0x8')](),controller[_0xb52c('0x1e')]);router[_0xb52c('0x19')]('/:id/send',auth[_0xb52c('0x8')](),controller[_0xb52c('0x1f')]);router[_0xb52c('0x19')]('/:id/users',auth[_0xb52c('0x8')](),controller[_0xb52c('0x20')]);router[_0xb52c('0x21')](_0xb52c('0xc'),auth[_0xb52c('0x8')](),controller['update']);router['delete'](_0xb52c('0xc'),auth[_0xb52c('0x8')](),controller[_0xb52c('0x22')]);router[_0xb52c('0x23')]('/:id/dispositions',auth[_0xb52c('0x8')](),controller[_0xb52c('0x24')]);router['delete'](_0xb52c('0x10'),auth[_0xb52c('0x8')](),controller['removeAnswers']);router['delete'](_0xb52c('0x17'),auth[_0xb52c('0x8')](),controller[_0xb52c('0x25')]);module[_0xb52c('0x26')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index c97d658..7345654 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 _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 +var _0xb253=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x54f859,_0x59d463){var _0x17a08b=function(_0x3f8e49){while(--_0x3f8e49){_0x54f859['push'](_0x54f859['shift']());}};_0x17a08b(++_0x59d463);}(_0xb253,0x191));var _0x3b25=function(_0x507527,_0x3d1f6e){_0x507527=_0x507527-0x0;var _0x2dec80=_0xb253[_0x507527];return _0x2dec80;};'use strict';var Sequelize=require(_0x3b25('0x0'));module['exports']={'priority':{'type':Sequelize[_0x3b25('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x3b25('0x2')],'allowNull':![],'defaultValue':_0x3b25('0x3')},'appdata':{'type':Sequelize[_0x3b25('0x4')]()},'description':{'type':Sequelize[_0x3b25('0x2')]},'interval':{'type':Sequelize[_0x3b25('0x2')],'defaultValue':_0x3b25('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 33710ff..d8c43a1 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 _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 +var _0x3678=['options','includeAll','include','rows','catch','show','params','find','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','FaxApplication','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','merge','type','VIRTUAL','filter'];(function(_0xceecee,_0x4955f4){var _0x105021=function(_0x1f1e9a){while(--_0x1f1e9a){_0xceecee['push'](_0xceecee['shift']());}};_0x105021(++_0x4955f4);}(_0x3678,0xa2));var _0x8367=function(_0x3871d7,_0x3cfcc5){_0x3871d7=_0x3871d7-0x0;var _0x28ec09=_0x3678[_0x3871d7];return _0x28ec09;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8367('0x0'));var jsonpatch=require(_0x8367('0x1'));var rp=require(_0x8367('0x2'));var moment=require(_0x8367('0x3'));var BPromise=require(_0x8367('0x4'));var Mustache=require(_0x8367('0x5'));var util=require(_0x8367('0x6'));var path=require(_0x8367('0x7'));var sox=require(_0x8367('0x8'));var csv=require(_0x8367('0x9'));var ejs=require(_0x8367('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8367('0xb'));var squel=require(_0x8367('0xc'));var crypto=require(_0x8367('0xd'));var jsforce=require(_0x8367('0xe'));var deskjs=require(_0x8367('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8367('0x10'));var Redis=require('ioredis');var authService=require(_0x8367('0x11'));var qs=require(_0x8367('0x12'));var as=require(_0x8367('0x13'));var hardwareService=require(_0x8367('0x14'));var logger=require(_0x8367('0x15'))(_0x8367('0x16'));var utils=require(_0x8367('0x17'));var config=require(_0x8367('0x18'));var licenseUtil=require(_0x8367('0x19'));var db=require(_0x8367('0x1a'))['db'];function respondWithStatusCode(_0x55d782,_0x1e0412){_0x1e0412=_0x1e0412||0xcc;return function(_0x336ab2){if(_0x336ab2){return _0x55d782[_0x8367('0x1b')](_0x1e0412);}return _0x55d782['status'](_0x1e0412)[_0x8367('0x1c')]();};}function respondWithResult(_0x3f11aa,_0x380910){_0x380910=_0x380910||0xc8;return function(_0x4b800f){if(_0x4b800f){return _0x3f11aa[_0x8367('0x1d')](_0x380910)[_0x8367('0x1e')](_0x4b800f);}};}function respondWithFilteredResult(_0xcbc1c4,_0x3b3bf3){return function(_0x28400e){if(_0x28400e){var _0x9919bd=typeof _0x3b3bf3[_0x8367('0x1f')]===_0x8367('0x20')&&typeof _0x3b3bf3[_0x8367('0x21')]===_0x8367('0x20');var _0x5493bb=_0x28400e['count'];var _0x56d541=_0x9919bd?0x0:_0x3b3bf3[_0x8367('0x1f')];var _0x380422=_0x9919bd?_0x28400e[_0x8367('0x22')]:_0x3b3bf3[_0x8367('0x1f')]+_0x3b3bf3[_0x8367('0x21')];var _0x10da89;if(_0x380422>=_0x5493bb){_0x380422=_0x5493bb;_0x10da89=0xc8;}else{_0x10da89=0xce;}_0xcbc1c4['status'](_0x10da89);return _0xcbc1c4['set'](_0x8367('0x23'),_0x56d541+'-'+_0x380422+'/'+_0x5493bb)[_0x8367('0x1e')](_0x28400e);}return null;};}function patchUpdates(_0x2d9d88){return function(_0x4f04c8){try{jsonpatch['apply'](_0x4f04c8,_0x2d9d88,!![]);}catch(_0x565eb7){return BPromise[_0x8367('0x24')](_0x565eb7);}return _0x4f04c8[_0x8367('0x25')]();};}function saveUpdates(_0xa943bb,_0x335196){return function(_0x41bde4){if(_0x41bde4){return _0x41bde4[_0x8367('0x26')](_0xa943bb)[_0x8367('0x27')](function(_0xbef9c5){return _0xbef9c5;});}return null;};}function removeEntity(_0x5b609d,_0x3df626){return function(_0x1b0238){if(_0x1b0238){return _0x1b0238[_0x8367('0x28')]()['then'](function(){_0x5b609d[_0x8367('0x1d')](0xcc)[_0x8367('0x1c')]();});}};}function handleEntityNotFound(_0x454682,_0x16f050){return function(_0x50df09){if(!_0x50df09){_0x454682['sendStatus'](0x194);}return _0x50df09;};}function handleError(_0x42ce57,_0x4d92dc){_0x4d92dc=_0x4d92dc||0x1f4;return function(_0x5b781f){logger[_0x8367('0x29')](_0x5b781f[_0x8367('0x2a')]);if(_0x5b781f[_0x8367('0x2b')]){delete _0x5b781f[_0x8367('0x2b')];}_0x42ce57[_0x8367('0x1d')](_0x4d92dc)[_0x8367('0x2c')](_0x5b781f);};}exports['index']=function(_0x4bd06c,_0x4dcde3){var _0x21d8e8={},_0x5739b9={},_0x1bdffc={'count':0x0,'rows':[]};var _0x389f35=_[_0x8367('0x2d')](db[_0x8367('0x2e')][_0x8367('0x2f')],function(_0x2a1123){return{'name':_0x2a1123[_0x8367('0x30')],'type':_0x2a1123['type'][_0x8367('0x31')]};});_0x5739b9[_0x8367('0x32')]=_['map'](_0x389f35,'name');_0x5739b9['query']=_[_0x8367('0x33')](_0x4bd06c[_0x8367('0x34')]);_0x5739b9[_0x8367('0x35')]=_['intersection'](_0x5739b9[_0x8367('0x32')],_0x5739b9[_0x8367('0x34')]);_0x21d8e8[_0x8367('0x36')]=_[_0x8367('0x37')](_0x5739b9[_0x8367('0x32')],qs['fields'](_0x4bd06c[_0x8367('0x34')][_0x8367('0x38')]));_0x21d8e8['attributes']=_0x21d8e8['attributes'][_0x8367('0x39')]?_0x21d8e8[_0x8367('0x36')]:_0x5739b9['model'];if(!_0x4bd06c[_0x8367('0x34')]['hasOwnProperty'](_0x8367('0x3a'))){_0x21d8e8[_0x8367('0x21')]=qs['limit'](_0x4bd06c[_0x8367('0x34')][_0x8367('0x21')]);_0x21d8e8['offset']=qs[_0x8367('0x1f')](_0x4bd06c[_0x8367('0x34')][_0x8367('0x1f')]);}_0x21d8e8['order']=qs[_0x8367('0x3b')](_0x4bd06c[_0x8367('0x34')][_0x8367('0x3b')]);_0x21d8e8[_0x8367('0x3c')]=qs[_0x8367('0x35')](_[_0x8367('0x3d')](_0x4bd06c[_0x8367('0x34')],_0x5739b9[_0x8367('0x35')]),_0x389f35);if(_0x4bd06c['query']['filter']){_0x21d8e8[_0x8367('0x3c')]=_[_0x8367('0x3e')](_0x21d8e8[_0x8367('0x3c')],{'$or':_[_0x8367('0x2d')](_0x389f35,function(_0x2a04f5){if(_0x2a04f5[_0x8367('0x3f')]!==_0x8367('0x40')){var _0x72f849={};_0x72f849[_0x2a04f5[_0x8367('0x2b')]]={'$like':'%'+_0x4bd06c[_0x8367('0x34')][_0x8367('0x41')]+'%'};return _0x72f849;}})});}_0x21d8e8=_[_0x8367('0x3e')]({},_0x21d8e8,_0x4bd06c[_0x8367('0x42')]);var _0x4b00de={'where':_0x21d8e8[_0x8367('0x3c')]};return db['FaxApplication']['count'](_0x4b00de)[_0x8367('0x27')](function(_0x4e7e10){_0x1bdffc[_0x8367('0x22')]=_0x4e7e10;if(_0x4bd06c[_0x8367('0x34')][_0x8367('0x43')]){_0x21d8e8[_0x8367('0x44')]=[{'all':!![]}];}return db[_0x8367('0x2e')]['findAll'](_0x21d8e8);})[_0x8367('0x27')](function(_0x49a5f9){_0x1bdffc[_0x8367('0x45')]=_0x49a5f9;return _0x1bdffc;})['then'](respondWithFilteredResult(_0x4dcde3,_0x21d8e8))[_0x8367('0x46')](handleError(_0x4dcde3,null));};exports[_0x8367('0x47')]=function(_0x268e11,_0x5bd170){var _0xfecb4f={'raw':!![],'where':{'id':_0x268e11[_0x8367('0x48')]['id']}},_0xfc03f3={};_0xfc03f3[_0x8367('0x32')]=_['keys'](db[_0x8367('0x2e')][_0x8367('0x2f')]);_0xfc03f3[_0x8367('0x34')]=_[_0x8367('0x33')](_0x268e11[_0x8367('0x34')]);_0xfc03f3[_0x8367('0x35')]=_[_0x8367('0x37')](_0xfc03f3[_0x8367('0x32')],_0xfc03f3[_0x8367('0x34')]);_0xfecb4f[_0x8367('0x36')]=_[_0x8367('0x37')](_0xfc03f3[_0x8367('0x32')],qs[_0x8367('0x38')](_0x268e11['query']['fields']));_0xfecb4f[_0x8367('0x36')]=_0xfecb4f[_0x8367('0x36')][_0x8367('0x39')]?_0xfecb4f['attributes']:_0xfc03f3[_0x8367('0x32')];if(_0x268e11[_0x8367('0x34')][_0x8367('0x43')]){_0xfecb4f[_0x8367('0x44')]=[{'all':!![]}];}_0xfecb4f=_[_0x8367('0x3e')]({},_0xfecb4f,_0x268e11[_0x8367('0x42')]);return db[_0x8367('0x2e')][_0x8367('0x49')](_0xfecb4f)[_0x8367('0x27')](handleEntityNotFound(_0x5bd170,null))[_0x8367('0x27')](respondWithResult(_0x5bd170,null))[_0x8367('0x46')](handleError(_0x5bd170,null));};exports[_0x8367('0x4a')]=function(_0x1b471a,_0x1ff877){return db[_0x8367('0x2e')][_0x8367('0x4a')](_0x1b471a[_0x8367('0x4b')],{})[_0x8367('0x27')](respondWithResult(_0x1ff877,0xc9))['catch'](handleError(_0x1ff877,null));};exports[_0x8367('0x26')]=function(_0x4d7ef0,_0x5d35aa){if(_0x4d7ef0['body']['id']){delete _0x4d7ef0['body']['id'];}return db[_0x8367('0x2e')]['find']({'where':{'id':_0x4d7ef0[_0x8367('0x48')]['id']}})[_0x8367('0x27')](handleEntityNotFound(_0x5d35aa,null))[_0x8367('0x27')](saveUpdates(_0x4d7ef0[_0x8367('0x4b')],null))['then'](respondWithResult(_0x5d35aa,null))[_0x8367('0x46')](handleError(_0x5d35aa,null));};exports[_0x8367('0x28')]=function(_0x3f87a9,_0x15e986){return db[_0x8367('0x2e')][_0x8367('0x49')]({'where':{'id':_0x3f87a9[_0x8367('0x48')]['id']}})[_0x8367('0x27')](handleEntityNotFound(_0x15e986,null))[_0x8367('0x27')](removeEntity(_0x15e986,null))[_0x8367('0x46')](handleError(_0x15e986,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index b7c006a..16392e9 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 _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 +var _0x81e8=['bluebird','request-promise','path','../../config/environment','./faxApplication.attributes','define','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x6e48ec,_0xa0031b){var _0x2f69a0=function(_0x223786){while(--_0x223786){_0x6e48ec['push'](_0x6e48ec['shift']());}};_0x2f69a0(++_0xa0031b);}(_0x81e8,0x1d5));var _0x881e=function(_0x86d59e,_0x122714){_0x86d59e=_0x86d59e-0x0;var _0x4ec5fa=_0x81e8[_0x86d59e];return _0x4ec5fa;};'use strict';var _=require(_0x881e('0x0'));var util=require(_0x881e('0x1'));var logger=require(_0x881e('0x2'))(_0x881e('0x3'));var moment=require('moment');var BPromise=require(_0x881e('0x4'));var rp=require(_0x881e('0x5'));var fs=require('fs');var path=require(_0x881e('0x6'));var rimraf=require('rimraf');var config=require(_0x881e('0x7'));var attributes=require(_0x881e('0x8'));module['exports']=function(_0x2bc482,_0x46ee7d){return _0x2bc482[_0x881e('0x9')]('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x881e('0xa')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 8ac65c7..f6c68d2 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 _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 +var _0x72d2=['http','request','then','info','debug','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','request\x20sent','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x59ad89,_0x41cdbd){var _0x463e97=function(_0x4bc593){while(--_0x4bc593){_0x59ad89['push'](_0x59ad89['shift']());}};_0x463e97(++_0x41cdbd);}(_0x72d2,0xb9));var _0x272d=function(_0x4e96a4,_0x207e09){_0x4e96a4=_0x4e96a4-0x0;var _0x1beafa=_0x72d2[_0x4e96a4];return _0x1beafa;};'use strict';var _=require(_0x272d('0x0'));var util=require(_0x272d('0x1'));var moment=require(_0x272d('0x2'));var BPromise=require(_0x272d('0x3'));var rs=require(_0x272d('0x4'));var fs=require('fs');var Redis=require(_0x272d('0x5'));var db=require(_0x272d('0x6'))['db'];var utils=require(_0x272d('0x7'));var logger=require(_0x272d('0x8'))(_0x272d('0x9'));var config=require(_0x272d('0xa'));var jayson=require(_0x272d('0xb'));var client=jayson[_0x272d('0xc')][_0x272d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x405da5,_0x2bce44,_0x31c825){return new BPromise(function(_0x1dd6ce,_0x36fb25){return client[_0x272d('0xe')](_0x405da5,_0x31c825)[_0x272d('0xf')](function(_0x50e181){logger[_0x272d('0x10')]('FaxApplication,\x20%s,\x20%s',_0x2bce44,'request\x20sent');logger[_0x272d('0x11')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x2bce44,'request\x20sent',JSON[_0x272d('0x12')](_0x50e181));if(_0x50e181[_0x272d('0x13')]){if(_0x50e181['error'][_0x272d('0x14')]===0x1f4){logger[_0x272d('0x13')](_0x272d('0x15'),_0x2bce44,_0x50e181[_0x272d('0x13')][_0x272d('0x16')]);return _0x36fb25(_0x50e181[_0x272d('0x13')]['message']);}logger['error'](_0x272d('0x15'),_0x2bce44,_0x50e181[_0x272d('0x13')][_0x272d('0x16')]);return _0x1dd6ce(_0x50e181[_0x272d('0x13')][_0x272d('0x16')]);}else{logger[_0x272d('0x10')](_0x272d('0x15'),_0x2bce44,_0x272d('0x17'));_0x1dd6ce(_0x50e181['result'][_0x272d('0x16')]);}})[_0x272d('0x18')](function(_0x35f01f){logger[_0x272d('0x13')](_0x272d('0x15'),_0x2bce44,_0x35f01f);_0x36fb25(_0x35f01f);});});}exports[_0x272d('0x19')]=function(_0x36b8aa){var _0x5c54d3=this;return new Promise(function(_0x53a004,_0xa3c5e5){return db[_0x272d('0x1a')][_0x272d('0x1b')](_0x36b8aa[_0x272d('0x1c')],{'raw':_0x36b8aa[_0x272d('0x1d')]?_0x36b8aa[_0x272d('0x1d')][_0x272d('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36b8aa['options']?_0x36b8aa[_0x272d('0x1d')][_0x272d('0x1f')]||null:null,'attributes':_0x36b8aa[_0x272d('0x1d')]?_0x36b8aa[_0x272d('0x1d')][_0x272d('0x20')]||null:null,'limit':_0x36b8aa['options']?_0x36b8aa[_0x272d('0x1d')]['limit']||null:null})[_0x272d('0xf')](function(_0x55be56){logger['info']('UpdateFaxApplication',_0x36b8aa);logger[_0x272d('0x11')](_0x272d('0x19'),_0x36b8aa,JSON[_0x272d('0x12')](_0x55be56));_0x53a004(_0x55be56);})[_0x272d('0x18')](function(_0x4cf7d1){logger[_0x272d('0x13')](_0x272d('0x19'),_0x4cf7d1['message'],_0x36b8aa);_0xa3c5e5(_0x5c54d3[_0x272d('0x13')](0x1f4,_0x4cf7d1['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index a2f77a8..33ee78b 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 _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 +var _0xe5b5=['../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4bfd67,_0x584e60){var _0xec4d84=function(_0xf54268){while(--_0xf54268){_0x4bfd67['push'](_0x4bfd67['shift']());}};_0xec4d84(++_0x584e60);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x28fbbf,_0x11f896){_0x28fbbf=_0x28fbbf-0x0;var _0x543af6=_0xe5b5[_0x28fbbf];return _0x543af6;};'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('0x10')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x11')]);router[_0x5e5b('0x12')](_0x5e5b('0xe'),auth['isAuthenticated'](),controller[_0x5e5b('0x13')]);router['delete'](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x14')]);module[_0x5e5b('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 4fbc4fe..be782dd 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 _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 +var _0x8aad=['ENUM','out','sequelize','exports','DATE','STRING'];(function(_0xb5de7a,_0x175e7f){var _0x1bc995=function(_0x4f9356){while(--_0x4f9356){_0xb5de7a['push'](_0xb5de7a['shift']());}};_0x1bc995(++_0x175e7f);}(_0x8aad,0x146));var _0xd8aa=function(_0x14e67a,_0xd2cc18){_0x14e67a=_0x14e67a-0x0;var _0x4a2be3=_0x8aad[_0x14e67a];return _0x4a2be3;};'use strict';var Sequelize=require(_0xd8aa('0x0'));module[_0xd8aa('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd8aa('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xd8aa('0x3')]},'thirdDisposition':{'type':Sequelize[_0xd8aa('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xd8aa('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd8aa('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xd8aa('0x4')]('in',_0xd8aa('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 045022e..f3d42ad 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 _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 +var _0xb0b2=['unlinkSync','rimraf','moment','bluebird','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','query','user','catch','show','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','FaxMessage','omit','getMessages','findOne','params','hasOwnProperty','nolimit','order','sort','FaxInteractionId','filter','where','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','ids','Tag','color','emit','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','push','Attachment','Messages','get','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','log'];(function(_0xa0f797,_0x9b2fa7){var _0x14acd7=function(_0x3f814a){while(--_0x3f814a){_0xa0f797['push'](_0xa0f797['shift']());}};_0x14acd7(++_0x9b2fa7);}(_0xb0b2,0x139));var _0x2b0b=function(_0x26793d,_0x45eac2){_0x26793d=_0x26793d-0x0;var _0x1203b8=_0xb0b2[_0x26793d];return _0x1203b8;};'use strict';var rimraf=require(_0x2b0b('0x0'));var zipdir=require('zip-dir');var moment=require(_0x2b0b('0x1'));var BPromise=require(_0x2b0b('0x2'));var util=require('util');var path=require('path');var fs=require('fs');var _=require('lodash');var Redis=require(_0x2b0b('0x3'));var interaction=require(_0x2b0b('0x4'));var qs=require(_0x2b0b('0x5'));var logger=require(_0x2b0b('0x6'))(_0x2b0b('0x7'));var config=require(_0x2b0b('0x8'));var db=require('../../mysqldb')['db'];config[_0x2b0b('0x9')]=_[_0x2b0b('0xa')](config[_0x2b0b('0x9')],{'host':_0x2b0b('0xb'),'port':0x18eb});var socket=require(_0x2b0b('0xc'))(new Redis(config[_0x2b0b('0x9')]));require(_0x2b0b('0xd'))[_0x2b0b('0xe')](socket);function respondWithStatusCode(_0x1a2c12,_0x87a94f){_0x87a94f=_0x87a94f||0xcc;return function(_0x5d4a35){if(_0x5d4a35){return _0x1a2c12[_0x2b0b('0xf')](_0x87a94f);}return _0x1a2c12[_0x2b0b('0x10')](_0x87a94f)[_0x2b0b('0x11')]();};}function respondWithResult(_0x340b7f,_0x5b3e58){_0x5b3e58=_0x5b3e58||0xc8;return function(_0x238708){if(_0x238708){return _0x340b7f[_0x2b0b('0x10')](_0x5b3e58)['json'](_0x238708);}};}function respondWithFilteredResult(_0x25688a,_0x54ccec){return function(_0x3ea046){if(_0x3ea046){var _0x447d34=typeof _0x54ccec[_0x2b0b('0x12')]===_0x2b0b('0x13')&&typeof _0x54ccec[_0x2b0b('0x14')]===_0x2b0b('0x13');var _0x1a17c1=_0x3ea046[_0x2b0b('0x15')];var _0xfbd7f6=_0x447d34?0x0:_0x54ccec['offset'];var _0x4956dd=_0x447d34?_0x3ea046['count']:_0x54ccec[_0x2b0b('0x12')]+_0x54ccec[_0x2b0b('0x14')];var _0x2ca2a9;if(_0x4956dd>=_0x1a17c1){_0x4956dd=_0x1a17c1;_0x2ca2a9=0xc8;}else{_0x2ca2a9=0xce;}_0x25688a['status'](_0x2ca2a9);return _0x25688a[_0x2b0b('0x16')](_0x2b0b('0x17'),_0xfbd7f6+'-'+_0x4956dd+'/'+_0x1a17c1)['json'](_0x3ea046);}return null;};}function saveUpdates(_0x2f7f18){return function(_0x1c844f){if(_0x1c844f){return _0x1c844f[_0x2b0b('0x18')](_0x2f7f18)[_0x2b0b('0x19')](function(_0x1b8b6d){return _0x1b8b6d;});}return null;};}function removeEntity(_0x36b67a){return function(_0x458021){if(_0x458021){return _0x458021[_0x2b0b('0x1a')]()[_0x2b0b('0x19')](function(){_0x36b67a['status'](0xcc)[_0x2b0b('0x11')]();});}};}function handleEntityNotFound(_0x134ade){return function(_0x246eec){if(!_0x246eec){_0x134ade[_0x2b0b('0xf')](0x194);}return _0x246eec;};}function handleError(_0x5c669a,_0x4b9301){_0x4b9301=_0x4b9301||0x1f4;return function(_0x1f6d63){logger[_0x2b0b('0x1b')](_0x1f6d63[_0x2b0b('0x1c')]);if(_0x1f6d63[_0x2b0b('0x1d')]){delete _0x1f6d63[_0x2b0b('0x1d')];}_0x5c669a[_0x2b0b('0x10')](_0x4b9301)[_0x2b0b('0x1e')](_0x1f6d63);};}exports[_0x2b0b('0x1f')]=function(_0x5009c1,_0x13fd22){var _0x2c8258={};var _0xb57d8c=_[_0x2b0b('0x20')](db[_0x2b0b('0x21')][_0x2b0b('0x22')],function(_0x1c46f2){return{'name':_0x1c46f2[_0x2b0b('0x23')],'type':_0x1c46f2[_0x2b0b('0x24')][_0x2b0b('0x25')]};});_0x2c8258=qs[_0x2b0b('0x26')](_0xb57d8c,_0x5009c1);return interaction[_0x2b0b('0x27')]('fax',_0x5009c1[_0x2b0b('0x28')],_0x5009c1[_0x2b0b('0x29')],_0x2c8258,_0xb57d8c)[_0x2b0b('0x19')](respondWithFilteredResult(_0x13fd22,_0x2c8258))[_0x2b0b('0x2a')](handleError(_0x13fd22,null));};exports[_0x2b0b('0x2b')]=function(_0x56bfc7,_0x41d2fa){var _0x55eeae={'raw':![],'where':{'id':_0x56bfc7['params']['id']}},_0x31472c={};_0x31472c[_0x2b0b('0x2c')]=_[_0x2b0b('0x2d')](db[_0x2b0b('0x21')]['rawAttributes']);_0x31472c[_0x2b0b('0x28')]=_[_0x2b0b('0x2d')](_0x56bfc7[_0x2b0b('0x28')]);_0x31472c[_0x2b0b('0x2e')]=_[_0x2b0b('0x2f')](_0x31472c[_0x2b0b('0x2c')],_0x31472c['query']);_0x55eeae[_0x2b0b('0x30')]=_[_0x2b0b('0x2f')](_0x31472c['model'],qs[_0x2b0b('0x31')](_0x56bfc7[_0x2b0b('0x28')][_0x2b0b('0x31')]));_0x55eeae[_0x2b0b('0x30')]=_0x55eeae[_0x2b0b('0x30')][_0x2b0b('0x32')]?_0x55eeae[_0x2b0b('0x30')]:_0x31472c[_0x2b0b('0x2c')];if(_0x56bfc7[_0x2b0b('0x28')][_0x2b0b('0x33')]){_0x55eeae[_0x2b0b('0x34')]=[{'all':!![]}];}_0x55eeae=_[_0x2b0b('0x35')]({},_0x55eeae,_0x56bfc7[_0x2b0b('0x36')]);return db[_0x2b0b('0x21')][_0x2b0b('0x37')](_0x55eeae)[_0x2b0b('0x19')](handleEntityNotFound(_0x41d2fa,null))[_0x2b0b('0x19')](respondWithResult(_0x41d2fa,null))[_0x2b0b('0x2a')](handleError(_0x41d2fa,null));};exports[_0x2b0b('0x38')]=function(_0x48378e,_0x46dc8b){return db['FaxInteraction'][_0x2b0b('0x38')](_0x48378e[_0x2b0b('0x39')],{})['then'](respondWithResult(_0x46dc8b,0xc9))['catch'](handleError(_0x46dc8b,null));};exports[_0x2b0b('0x18')]=function(_0xf878f9,_0xf57ead){if(_0xf878f9[_0x2b0b('0x39')]['id']){delete _0xf878f9['body']['id'];}return db[_0x2b0b('0x21')][_0x2b0b('0x37')]({'where':{'id':_0xf878f9['params']['id']}})['then'](handleEntityNotFound(_0xf57ead,null))[_0x2b0b('0x19')](saveUpdates(_0xf878f9['body'],null))[_0x2b0b('0x19')](respondWithResult(_0xf57ead,null))['catch'](handleError(_0xf57ead,null));};exports[_0x2b0b('0x1a')]=function(_0x592c78,_0x90860e){return db['FaxInteraction'][_0x2b0b('0x37')]({'where':{'id':_0x592c78['params']['id']}})['then'](handleEntityNotFound(_0x90860e,null))[_0x2b0b('0x19')](removeEntity(_0x90860e,null))[_0x2b0b('0x2a')](handleError(_0x90860e,null));};exports[_0x2b0b('0x3a')]=function(_0x52034d,_0x5717f5){return db[_0x2b0b('0x21')][_0x2b0b('0x3a')]()[_0x2b0b('0x19')](respondWithResult(_0x5717f5,null))[_0x2b0b('0x2a')](handleError(_0x5717f5,null));};exports[_0x2b0b('0x3b')]=function(_0x42d82b,_0x9d1398){return db[_0x2b0b('0x3c')][_0x2b0b('0x37')]({'where':{'id':_0x42d82b['params']['id']}})[_0x2b0b('0x19')](handleEntityNotFound(_0x9d1398,null))[_0x2b0b('0x19')](function(_0x59f508){if(_0x59f508){return _0x59f508[_0x2b0b('0x3b')](_0x42d82b[_0x2b0b('0x39')]['ids'],_[_0x2b0b('0x3d')](_0x42d82b[_0x2b0b('0x39')],['ids','id'])||{});}})['then'](respondWithResult(_0x9d1398,null))[_0x2b0b('0x2a')](handleError(_0x9d1398,null));};exports[_0x2b0b('0x3e')]=function(_0xd1b515,_0x4e0304){var _0x2415dc={'raw':![],'where':{}};var _0x92eef3={};var _0xbc4399={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x2b0b('0x3f')]({'where':{'id':_0xd1b515[_0x2b0b('0x40')]['id']}})[_0x2b0b('0x19')](handleEntityNotFound(_0x4e0304,null))['then'](function(_0x4c08a9){if(_0x4c08a9){_0x92eef3[_0x2b0b('0x2c')]=_[_0x2b0b('0x2d')](db[_0x2b0b('0x3c')][_0x2b0b('0x22')]);_0x92eef3[_0x2b0b('0x28')]=_[_0x2b0b('0x2d')](_0xd1b515[_0x2b0b('0x28')]);_0x92eef3[_0x2b0b('0x2e')]=_[_0x2b0b('0x2f')](_0x92eef3[_0x2b0b('0x2c')],_0x92eef3[_0x2b0b('0x28')]);_0x2415dc[_0x2b0b('0x30')]=_[_0x2b0b('0x2f')](_0x92eef3[_0x2b0b('0x2c')],qs[_0x2b0b('0x31')](_0xd1b515[_0x2b0b('0x28')][_0x2b0b('0x31')]));_0x2415dc['attributes']=_0x2415dc[_0x2b0b('0x30')][_0x2b0b('0x32')]?_0x2415dc[_0x2b0b('0x30')]:_0x92eef3[_0x2b0b('0x2c')];if(!_0xd1b515[_0x2b0b('0x28')][_0x2b0b('0x41')](_0x2b0b('0x42'))){_0x2415dc['limit']=qs[_0x2b0b('0x14')](_0xd1b515['query'][_0x2b0b('0x14')]);_0x2415dc[_0x2b0b('0x12')]=qs[_0x2b0b('0x12')](_0xd1b515[_0x2b0b('0x28')]['offset']);}_0x2415dc[_0x2b0b('0x43')]=qs[_0x2b0b('0x44')](_0xd1b515[_0x2b0b('0x28')][_0x2b0b('0x44')]);_0x2415dc['where']=qs[_0x2b0b('0x2e')](_['pick'](_0xd1b515[_0x2b0b('0x28')],_0x92eef3[_0x2b0b('0x2e')]));_0x2415dc['where'][_0x2b0b('0x45')]=_0x4c08a9['id'];if(_0xd1b515[_0x2b0b('0x28')][_0x2b0b('0x46')]){_0x2415dc['where']=_[_0x2b0b('0x35')](_0x2415dc[_0x2b0b('0x47')],{'$or':_[_0x2b0b('0x20')](_0x2415dc[_0x2b0b('0x30')],function(_0x737cc3){var _0x19675c={};_0x19675c[_0x737cc3]={'$like':'%'+_0xd1b515[_0x2b0b('0x28')][_0x2b0b('0x46')]+'%'};return _0x19675c;})});}if(_0xd1b515[_0x2b0b('0x28')][_0x2b0b('0x48')]){var _0x463152=_0xd1b515[_0x2b0b('0x28')][_0x2b0b('0x48')][_0x2b0b('0x49')](',');var _0x233b22={};_0x233b22[_0x463152[0x0]]={'$gte':moment(_0x463152[0x1])['format'](_0x2b0b('0x4a'))};_0x2415dc[_0x2b0b('0x47')]=_[_0x2b0b('0x35')](_0x2415dc['where'],_0x233b22);}_0x2415dc=_[_0x2b0b('0x35')]({},_0x2415dc,_0xd1b515[_0x2b0b('0x36')]);return db[_0x2b0b('0x3c')][_0x2b0b('0x15')]({'where':_0x2415dc['where']})[_0x2b0b('0x19')](function(_0x126fad){_0xbc4399[_0x2b0b('0x15')]=_0x126fad;if(_0xd1b515['query'][_0x2b0b('0x33')]){_0x2415dc[_0x2b0b('0x34')]=[{'all':!![]}];}return db['FaxMessage'][_0x2b0b('0x27')](_0x2415dc);})[_0x2b0b('0x19')](function(_0x428a84){_0xbc4399[_0x2b0b('0x4b')]=_0x428a84;return _0xbc4399;});}})['then'](respondWithFilteredResult(_0x4e0304,_0x2415dc))[_0x2b0b('0x2a')](handleError(_0x4e0304,null));};exports['addTags']=function(_0x80d3d7,_0x488b63){return db[_0x2b0b('0x21')]['find']({'where':{'id':_0x80d3d7['params']['id']}})['then'](handleEntityNotFound(_0x488b63,null))[_0x2b0b('0x19')](function(_0x4f0f54){if(_0x4f0f54){return _0x4f0f54['setTags'](_0x80d3d7['body']['ids'],_[_0x2b0b('0x3d')](_0x80d3d7[_0x2b0b('0x39')],[_0x2b0b('0x4c'),'id'])||{})['spread'](function(){return db[_0x2b0b('0x4d')][_0x2b0b('0x27')]({'attributes':['id',_0x2b0b('0x1d'),_0x2b0b('0x4e')],'where':{'id':_0x80d3d7[_0x2b0b('0x39')][_0x2b0b('0x4c')]}});})['then'](function(_0xc352a1){socket[_0x2b0b('0x4f')]('faxInteractionTags:save',{'id':Number(_0x80d3d7[_0x2b0b('0x40')]['id']),'tags':_0xc352a1||[]});return{'id':Number(_0x80d3d7[_0x2b0b('0x40')]['id']),'tags':_0xc352a1||[]};});}})['then'](respondWithResult(_0x488b63,null))[_0x2b0b('0x2a')](handleError(_0x488b63,null));};exports[_0x2b0b('0x50')]=function(_0x58d8e6,_0x37c1e8){return db[_0x2b0b('0x21')][_0x2b0b('0x37')]({'where':{'id':_0x58d8e6[_0x2b0b('0x40')]['id']}})[_0x2b0b('0x19')](handleEntityNotFound(_0x37c1e8,null))[_0x2b0b('0x19')](function(_0x2461ee){if(_0x2461ee){return _0x2461ee[_0x2b0b('0x50')](_0x58d8e6[_0x2b0b('0x28')][_0x2b0b('0x4c')]);}})[_0x2b0b('0x19')](respondWithStatusCode(_0x37c1e8,null))['catch'](handleError(_0x37c1e8,null));};exports[_0x2b0b('0x51')]=function(_0x5841c5,_0x45f249){var _0x2b524f=moment()[_0x2b0b('0x52')]()[_0x2b0b('0x53')]();var _0x521bfe=path[_0x2b0b('0x54')](config[_0x2b0b('0x55')],_0x2b0b('0x56'),_0x2b0b('0x57'),_0x2b0b('0x58'));var _0x58c9c1=path['join'](config[_0x2b0b('0x55')],_0x2b0b('0x56'),_0x2b0b('0x57'),_0x2b0b('0x59'));var _0x5ff137=path[_0x2b0b('0x54')](_0x521bfe,_0x2b524f);var _0xfa9978=util[_0x2b0b('0x5a')](_0x2b0b('0x5b'),_0x5841c5['params']['id'],_0x2b524f);var _0x4aff60=path['join'](_0x521bfe,_0xfa9978);var _0xdf984c=[];_0xdf984c[_0x2b0b('0x5c')]({'model':db[_0x2b0b('0x5d')],'as':_0x2b0b('0x5d'),'raw':!![]});var _0x3c4d97=[{'model':db[_0x2b0b('0x3c')],'as':_0x2b0b('0x5e'),'attributes':['id',_0x2b0b('0x39'),'createdAt'],'include':_0xdf984c}];return db[_0x2b0b('0x21')][_0x2b0b('0x37')]({'where':{'id':_0x5841c5[_0x2b0b('0x40')]['id']},'include':_0x3c4d97})[_0x2b0b('0x19')](handleEntityNotFound(_0x45f249,null))[_0x2b0b('0x19')](function(_0x697b9d){if(_0x697b9d&&_0x697b9d[_0x2b0b('0x5e')]){var _0x357e1f=_0x697b9d[_0x2b0b('0x5f')]({'plain':!![]});fs['mkdirSync'](_0x5ff137);for(var _0xe115ba=0x0;_0xe115ba<_0x357e1f[_0x2b0b('0x5e')][_0x2b0b('0x32')];_0xe115ba++){var _0x5ed980=_0x357e1f[_0x2b0b('0x5e')][_0xe115ba][_0x2b0b('0x5d')];if(_0x5ed980){var _0x3d7d8d=path[_0x2b0b('0x54')](_0x58c9c1,_0x5ed980[_0x2b0b('0x60')]);if(fs[_0x2b0b('0x61')](_0x3d7d8d)){fs[_0x2b0b('0x62')](_0x3d7d8d)[_0x2b0b('0x63')](fs[_0x2b0b('0x64')](path[_0x2b0b('0x54')](_0x5ff137,_0x5ed980[_0x2b0b('0x60')])));}}}return BPromise[_0x2b0b('0x65')]()[_0x2b0b('0x19')](function(){return new BPromise(function(_0x340745,_0x1f6514){zipdir(_0x5ff137,{'saveTo':_0x4aff60},function(_0xdfb28,_0x3e376c){if(_0xdfb28)return _0x1f6514(_0xdfb28);return _0x340745(_0x3e376c);});})[_0x2b0b('0x19')](function(){return new BPromise(function(_0x3bd9ff,_0x49f4d1){rimraf(_0x5ff137,function(_0x4cb61d){if(_0x4cb61d)_0x49f4d1(_0x4cb61d);return _0x3bd9ff();});});})[_0x2b0b('0x19')](function(){return _0x45f249['download'](_0x4aff60,_0xfa9978,function(_0x45861b){if(_0x45861b){console[_0x2b0b('0x66')]('err',_0x45861b);}else{fs[_0x2b0b('0x67')](_0x4aff60);}});});});}else{return _0x45f249['sendStatus'](0xc8);}})[_0x2b0b('0x2a')](handleError(_0x45f249,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 4e03fbf..2a150cd 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 _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 +var _0x63c7=['catch','hasOwnProperty','hook','exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','map','findAll','then','setDataValue','unreadMessages','length','emit'];(function(_0x51f1ee,_0x241374){var _0x251e83=function(_0x35802d){while(--_0x35802d){_0x51f1ee['push'](_0x51f1ee['shift']());}};_0x251e83(++_0x241374);}(_0x63c7,0x74));var _0x763c=function(_0x3288a2,_0x4ac4be){_0x3288a2=_0x3288a2-0x0;var _0x319f4a=_0x63c7[_0x3288a2];return _0x319f4a;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x763c('0x0'))['db'][_0x763c('0x1')];var FaxMessage=require(_0x763c('0x0'))['db'][_0x763c('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x763c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x763c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x13137b){return function(_0x5b2f3f,_0x5edd01,_0xd7cf96){_0x5b2f3f['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x5b1ac2){_0x5b2f3f['setDataValue']('Users',_0x5b1ac2[_0x763c('0x5')](function(_0x2300f7){return{'id':_0x2300f7['id']};}));return FaxMessage[_0x763c('0x6')]({'where':{'FaxInteractionId':_0x5b2f3f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x763c('0x7')](function(_0x43f7e0){_0x5b2f3f[_0x763c('0x8')](_0x763c('0x9'),_0x43f7e0[_0x763c('0xa')]);FaxInteractionEvents[_0x763c('0xb')](_0x13137b+':'+_0x5b2f3f['id'],_0x5b2f3f);FaxInteractionEvents['emit'](_0x13137b,_0x5b2f3f);_0xd7cf96(null);})[_0x763c('0xc')](_0xd7cf96(null));};}for(var e in events){if(events[_0x763c('0xd')](e)){var event=events[e];FaxInteraction[_0x763c('0xe')](e,emitEvent(event));}}module[_0x763c('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 4836d1e..b8a61ad 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 _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 +var _0x3b13=['changed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./faxInteraction.attributes','exports','define','fax_interactions'];(function(_0x3c26d6,_0x2f8190){var _0x48e3b2=function(_0x57d283){while(--_0x57d283){_0x3c26d6['push'](_0x3c26d6['shift']());}};_0x48e3b2(++_0x2f8190);}(_0x3b13,0x189));var _0x33b1=function(_0x8a0140,_0x4a1b16){_0x8a0140=_0x8a0140-0x0;var _0x1be8a8=_0x3b13[_0x8a0140];return _0x1be8a8;};'use strict';var _=require(_0x33b1('0x0'));var util=require(_0x33b1('0x1'));var logger=require(_0x33b1('0x2'))(_0x33b1('0x3'));var moment=require(_0x33b1('0x4'));var BPromise=require('bluebird');var rp=require(_0x33b1('0x5'));var fs=require('fs');var path=require(_0x33b1('0x6'));var rimraf=require(_0x33b1('0x7'));var config=require('../../config/environment');var attributes=require(_0x33b1('0x8'));module[_0x33b1('0x9')]=function(_0x5d837c,_0x3a8972){return _0x5d837c[_0x33b1('0xa')]('FaxInteraction',attributes,{'tableName':_0x33b1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x33e010,_0x1fb561,_0x5d8781){if(_0x33e010[_0x33b1('0xc')]('closed')){_0x33e010['closedAt']=moment()[_0x33b1('0xd')](_0x33b1('0xe'));}_0x5d8781(null,_0x33e010);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 9537a27..dbf0a48 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 _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 +var _0xdb2a=['../../config/logger','jayson/promise','client','http','redis','defaults','localhost','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','UpdateFaxInteraction','update','body','options','where','attributes','limit','catch','AddTagsToFaxInteraction','FaxInteraction','find','addTags','omit','ids','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x15f897,_0x12eaf0){var _0x25489b=function(_0x32d52e){while(--_0x32d52e){_0x15f897['push'](_0x15f897['shift']());}};_0x25489b(++_0x12eaf0);}(_0xdb2a,0x17f));var _0xadb2=function(_0x3e5cf3,_0x310e7c){_0x3e5cf3=_0x3e5cf3-0x0;var _0x40fac7=_0xdb2a[_0x3e5cf3];return _0x40fac7;};'use strict';var _=require('lodash');var util=require(_0xadb2('0x0'));var moment=require(_0xadb2('0x1'));var BPromise=require(_0xadb2('0x2'));var rs=require(_0xadb2('0x3'));var fs=require('fs');var Redis=require(_0xadb2('0x4'));var db=require(_0xadb2('0x5'))['db'];var utils=require(_0xadb2('0x6'));var logger=require(_0xadb2('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xadb2('0x8'));var client=jayson[_0xadb2('0x9')][_0xadb2('0xa')]({'port':0x232a});config[_0xadb2('0xb')]=_[_0xadb2('0xc')](config['redis'],{'host':_0xadb2('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xadb2('0xb')]));require('./faxInteraction.socket')[_0xadb2('0xe')](socket);function respondWithRpcPromise(_0x55ea84,_0x18e062,_0x11649f){return new BPromise(function(_0xcefc4,_0x3d201e){return client['request'](_0x55ea84,_0x11649f)[_0xadb2('0xf')](function(_0x212a99){logger[_0xadb2('0x10')](_0xadb2('0x11'),_0x18e062,_0xadb2('0x12'));logger[_0xadb2('0x13')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x18e062,'request\x20sent',JSON[_0xadb2('0x14')](_0x212a99));if(_0x212a99['error']){if(_0x212a99[_0xadb2('0x15')]['code']===0x1f4){logger['error'](_0xadb2('0x11'),_0x18e062,_0x212a99['error'][_0xadb2('0x16')]);return _0x3d201e(_0x212a99[_0xadb2('0x15')][_0xadb2('0x16')]);}logger[_0xadb2('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x18e062,_0x212a99['error'][_0xadb2('0x16')]);return _0xcefc4(_0x212a99[_0xadb2('0x15')][_0xadb2('0x16')]);}else{logger[_0xadb2('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x18e062,_0xadb2('0x12'));_0xcefc4(_0x212a99['result'][_0xadb2('0x16')]);}})['catch'](function(_0x5c282e){logger['error'](_0xadb2('0x11'),_0x18e062,_0x5c282e);_0x3d201e(_0x5c282e);});});}exports[_0xadb2('0x17')]=function(_0x4e2fed){var _0x166f6a=this;return new Promise(function(_0x5b950f,_0x5487b1){return db['FaxInteraction'][_0xadb2('0x18')](_0x4e2fed[_0xadb2('0x19')],{'raw':_0x4e2fed[_0xadb2('0x1a')]?_0x4e2fed[_0xadb2('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e2fed[_0xadb2('0x1a')]?_0x4e2fed[_0xadb2('0x1a')][_0xadb2('0x1b')]||null:null,'attributes':_0x4e2fed[_0xadb2('0x1a')]?_0x4e2fed['options'][_0xadb2('0x1c')]||null:null,'limit':_0x4e2fed[_0xadb2('0x1a')]?_0x4e2fed[_0xadb2('0x1a')][_0xadb2('0x1d')]||null:null})['then'](function(_0x5d89b2){logger[_0xadb2('0x10')](_0xadb2('0x17'),_0x4e2fed);logger[_0xadb2('0x13')](_0xadb2('0x17'),_0x4e2fed,JSON[_0xadb2('0x14')](_0x5d89b2));_0x5b950f(_0x5d89b2);})[_0xadb2('0x1e')](function(_0xac2f28){logger[_0xadb2('0x15')]('UpdateFaxInteraction',_0xac2f28[_0xadb2('0x16')],_0x4e2fed);_0x5487b1(_0x166f6a['error'](0x1f4,_0xac2f28[_0xadb2('0x16')]));});});};exports[_0xadb2('0x1f')]=function(_0x347935){return new Promise(function(_0x39fbf5,_0x4aede5){return db[_0xadb2('0x20')][_0xadb2('0x21')]({'where':_0x347935[_0xadb2('0x1a')]?_0x347935[_0xadb2('0x1a')][_0xadb2('0x1b')]||null:null})[_0xadb2('0xf')](function(_0x4b7b8a){if(_0x4b7b8a){return _0x4b7b8a[_0xadb2('0x22')](_0x347935[_0xadb2('0x19')]['ids'],_[_0xadb2('0x23')](_0x347935['body'],[_0xadb2('0x24'),'id'])||{});}})[_0xadb2('0x25')](function(_0xc8c6f1){logger[_0xadb2('0x10')](_0xadb2('0x26'),_0x347935);logger[_0xadb2('0x13')]('AddTags',_0x347935,JSON[_0xadb2('0x14')](_0xc8c6f1));_0x39fbf5(_0xc8c6f1);})['catch'](function(_0x817ad9){logger[_0xadb2('0x15')](_0xadb2('0x26'),_0x817ad9[_0xadb2('0x16')],_0x347935);_0x4aede5(_this[_0xadb2('0x15')](0x1f4,_0x817ad9[_0xadb2('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index c5575b6..d74b4ec 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 _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 +var _0x1e54=['faxInteraction:','./faxInteraction.events','update','emit','removeListener','register','length'];(function(_0x64389c,_0x3dbc8e){var _0x2add7f=function(_0x5e3a97){while(--_0x5e3a97){_0x64389c['push'](_0x64389c['shift']());}};_0x2add7f(++_0x3dbc8e);}(_0x1e54,0x1c8));var _0x41e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e54[_0x3dd15e];return _0x231fd0;};'use strict';var FaxInteractionEvents=require(_0x41e5('0x0'));var events=['save','remove',_0x41e5('0x1')];function createListener(_0x9ed386,_0x4f2832){return function(_0x450206){_0x4f2832[_0x41e5('0x2')](_0x9ed386,_0x450206);};}function removeListener(_0x59e875,_0xe47560){return function(){FaxInteractionEvents[_0x41e5('0x3')](_0x59e875,_0xe47560);};}exports[_0x41e5('0x4')]=function(_0x5089f2){for(var _0x467e7b=0x0,_0x50b50e=events[_0x41e5('0x5')];_0x467e7b<_0x50b50e;_0x467e7b++){var _0x144fb0=events[_0x467e7b];var _0x45ede7=createListener(_0x41e5('0x6')+_0x144fb0,_0x5089f2);FaxInteractionEvents['on'](_0x144fb0,_0x45ede7);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 7ff8917..1ea206b 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 _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 +var _0xf186=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','create','/:id/tags','tracked','fax','addTags','faxinteraction:update','update','delete','faxinteraction:destroy','removeTags','multer','util','path','connect-timeout','express','Router'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xf186,0xea));var _0x6f18=function(_0x1b995e,_0x206b36){_0x1b995e=_0x1b995e-0x0;var _0x382407=_0xf186[_0x1b995e];return _0x382407;};'use strict';var multer=require(_0x6f18('0x0'));var util=require(_0x6f18('0x1'));var path=require(_0x6f18('0x2'));var timeout=require(_0x6f18('0x3'));var express=require(_0x6f18('0x4'));var router=express[_0x6f18('0x5')]();var fs_extra=require(_0x6f18('0x6'));var auth=require(_0x6f18('0x7'));var interaction=require(_0x6f18('0x8'));var config=require(_0x6f18('0x9'));var controller=require('./faxInteraction.controller');router[_0x6f18('0xa')]('/',auth[_0x6f18('0xb')](),controller[_0x6f18('0xc')]);router[_0x6f18('0xa')](_0x6f18('0xd'),auth['isAuthenticated'](),controller[_0x6f18('0xe')]);router['get'](_0x6f18('0xf'),auth['isAuthenticated'](),controller[_0x6f18('0x10')]);router[_0x6f18('0xa')]('/:id/messages',auth[_0x6f18('0xb')](),controller['getMessages']);router[_0x6f18('0xa')](_0x6f18('0x11'),auth[_0x6f18('0xb')](),controller[_0x6f18('0x12')]);router[_0x6f18('0x13')]('/',auth[_0x6f18('0xb')](),controller[_0x6f18('0x14')]);router['post']('/:id/messages',auth[_0x6f18('0xb')](),controller['addMessage']);router['post'](_0x6f18('0x15'),auth[_0x6f18('0xb')](),interaction[_0x6f18('0x16')](_0x6f18('0x17'),'faxinteraction:addtags'),controller[_0x6f18('0x18')]);router['put'](_0x6f18('0xf'),auth['isAuthenticated'](),interaction['tracked']('fax',_0x6f18('0x19')),controller[_0x6f18('0x1a')]);router[_0x6f18('0x1b')](_0x6f18('0xf'),auth['isAuthenticated'](),interaction[_0x6f18('0x16')](_0x6f18('0x17'),_0x6f18('0x1c')),controller['destroy']);router[_0x6f18('0x1b')](_0x6f18('0x15'),auth['isAuthenticated'](),controller[_0x6f18('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index a0c591f..1b5bc76 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 _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 +var _0x34e5=['BOOLEAN','ENUM','out','DATE','exports','medium'];(function(_0xac21df,_0x4f3ba2){var _0x1faa60=function(_0x591aa7){while(--_0x591aa7){_0xac21df['push'](_0xac21df['shift']());}};_0x1faa60(++_0x4f3ba2);}(_0x34e5,0x172));var _0x534e=function(_0x16c2a8,_0x12cebd){_0x16c2a8=_0x16c2a8-0x0;var _0x4f45f4=_0x34e5[_0x16c2a8];return _0x4f45f4;};'use strict';var Sequelize=require('sequelize');module[_0x534e('0x0')]={'body':{'type':Sequelize['TEXT'](_0x534e('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x534e('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x534e('0x3')]('in',_0x534e('0x4')),'defaultValue':_0x534e('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x534e('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 97cd16c..84029d6 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 _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 +var _0x1758=['AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','root','server','eml-format','rimraf','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','redis','localhost','./faxMessage.socket','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','FaxMessage','options','find','body','describe','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','internal','agent','manual','interface','SIP/%s','channel','EventManager','acceptmessage','fax-interactions','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','email','motionChannel','event','rejectmessage','create','CmContact','findOne','fax','Attachment'];(function(_0x23a7e7,_0x2f8f30){var _0x30a210=function(_0x48594c){while(--_0x48594c){_0x23a7e7['push'](_0x23a7e7['shift']());}};_0x30a210(++_0x2f8f30);}(_0x1758,0x1a2));var _0x8175=function(_0x29baf8,_0x3af357){_0x29baf8=_0x29baf8-0x0;var _0x37a6fa=_0x1758[_0x29baf8];return _0x37a6fa;};'use strict';var emlformat=require(_0x8175('0x0'));var rimraf=require(_0x8175('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8175('0x2'));var rp=require(_0x8175('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x8175('0x4'));var sox=require(_0x8175('0x5'));var csv=require(_0x8175('0x6'));var ejs=require(_0x8175('0x7'));var fs=require('fs');var fs_extra=require(_0x8175('0x8'));var _=require(_0x8175('0x9'));var squel=require('squel');var crypto=require(_0x8175('0xa'));var jsforce=require(_0x8175('0xb'));var deskjs=require(_0x8175('0xc'));var toCsv=require(_0x8175('0x6'));var querystring=require(_0x8175('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8175('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8175('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8175('0x10'))(_0x8175('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8175('0x12'))['db'];config['redis']=_['defaults'](config[_0x8175('0x13')],{'host':_0x8175('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8175('0x13')]));require(_0x8175('0x15'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x8175('0x16')][_0x8175('0x17')]({'port':0x232c});var client9002=jayson[_0x8175('0x16')][_0x8175('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x1aec9c,_0x143ea7,_0x2240e4,_0x24d0ae){return new BPromise(function(_0x149a7c,_0x1707b6){var _0x1a3a7f=_0x24d0ae||client;return _0x1a3a7f[_0x8175('0x18')](_0x1aec9c,_0x2240e4)[_0x8175('0x19')](function(_0x28bfea){logger[_0x8175('0x1a')](_0x8175('0x1b'),_0x143ea7,_0x8175('0x1c'));logger['debug'](_0x8175('0x1d'),_0x143ea7,_0x8175('0x1c'),JSON[_0x8175('0x1e')](_0x28bfea));if(_0x28bfea['error']){if(_0x28bfea[_0x8175('0x1f')][_0x8175('0x20')]===0x1f4){logger[_0x8175('0x1f')]('FaxMessage,\x20%s,\x20%s',_0x143ea7,_0x28bfea[_0x8175('0x1f')][_0x8175('0x21')]);return _0x1707b6(_0x28bfea[_0x8175('0x1f')][_0x8175('0x21')]);}logger['error'](_0x8175('0x1b'),_0x143ea7,_0x28bfea[_0x8175('0x1f')]['message']);return _0x149a7c(_0x28bfea['error'][_0x8175('0x21')]);}else{logger[_0x8175('0x1a')](_0x8175('0x1b'),_0x143ea7,_0x8175('0x1c'));_0x149a7c(_0x28bfea[_0x8175('0x22')][_0x8175('0x21')]);}})[_0x8175('0x23')](function(_0x2bbc61){logger[_0x8175('0x1f')](_0x8175('0x1b'),_0x143ea7,_0x2bbc61);_0x1707b6(_0x2bbc61);});});}function respondWithStatusCode(_0x45c5cd,_0x23a6f1){_0x23a6f1=_0x23a6f1||0xcc;return function(_0x3bd9bc){if(_0x3bd9bc){return _0x45c5cd[_0x8175('0x24')](_0x23a6f1);}return _0x45c5cd[_0x8175('0x25')](_0x23a6f1)[_0x8175('0x26')]();};}function respondWithResult(_0x6170f5,_0x50e380){_0x50e380=_0x50e380||0xc8;return function(_0x42c893){if(_0x42c893){return _0x6170f5[_0x8175('0x25')](_0x50e380)[_0x8175('0x27')](_0x42c893);}};}function respondWithFilteredResult(_0xc7f1fc,_0x5ca046){return function(_0x59da54){if(_0x59da54){var _0x8b2c79=typeof _0x5ca046[_0x8175('0x28')]===_0x8175('0x29')&&typeof _0x5ca046[_0x8175('0x2a')]===_0x8175('0x29');var _0x9918c0=_0x59da54[_0x8175('0x2b')];var _0x1fe94a=_0x8b2c79?0x0:_0x5ca046['offset'];var _0x22ad29=_0x8b2c79?_0x59da54[_0x8175('0x2b')]:_0x5ca046[_0x8175('0x28')]+_0x5ca046[_0x8175('0x2a')];var _0x22caf0;if(_0x22ad29>=_0x9918c0){_0x22ad29=_0x9918c0;_0x22caf0=0xc8;}else{_0x22caf0=0xce;}_0xc7f1fc[_0x8175('0x25')](_0x22caf0);return _0xc7f1fc[_0x8175('0x2c')](_0x8175('0x2d'),_0x1fe94a+'-'+_0x22ad29+'/'+_0x9918c0)[_0x8175('0x27')](_0x59da54);}return null;};}function patchUpdates(_0x1c75ae){return function(_0x3c08e2){try{jsonpatch[_0x8175('0x2e')](_0x3c08e2,_0x1c75ae,!![]);}catch(_0x296a59){return BPromise[_0x8175('0x2f')](_0x296a59);}return _0x3c08e2[_0x8175('0x30')]();};}function saveUpdates(_0x27a5de,_0x591f1d){return function(_0x1b3371){if(_0x1b3371){return _0x1b3371[_0x8175('0x31')](_0x27a5de)[_0x8175('0x19')](function(_0x5e6a7d){return _0x5e6a7d;});}return null;};}function removeEntity(_0x162d9d,_0x1b541b){return function(_0x349d83){if(_0x349d83){return _0x349d83[_0x8175('0x32')]()[_0x8175('0x19')](function(){_0x162d9d[_0x8175('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x537e94,_0x34db6e){return function(_0x49bb7f){if(!_0x49bb7f){_0x537e94['sendStatus'](0x194);}return _0x49bb7f;};}function handleError(_0x41c01e,_0x34e8d3){_0x34e8d3=_0x34e8d3||0x1f4;return function(_0x5d63e7){logger[_0x8175('0x1f')](_0x5d63e7[_0x8175('0x33')]);if(_0x5d63e7[_0x8175('0x34')]){delete _0x5d63e7[_0x8175('0x34')];}_0x41c01e['status'](_0x34e8d3)[_0x8175('0x35')](_0x5d63e7);};}exports[_0x8175('0x36')]=function(_0x2b7197,_0x2e05df){var _0x292efe={},_0x323bad={},_0xc089c2={'count':0x0,'rows':[]};var _0x38ea43=_['map'](db['FaxMessage'][_0x8175('0x37')],function(_0x2dec02){return{'name':_0x2dec02['fieldName'],'type':_0x2dec02[_0x8175('0x38')][_0x8175('0x39')]};});_0x323bad[_0x8175('0x3a')]=_[_0x8175('0x3b')](_0x38ea43,_0x8175('0x34'));_0x323bad['query']=_[_0x8175('0x3c')](_0x2b7197[_0x8175('0x3d')]);_0x323bad[_0x8175('0x3e')]=_[_0x8175('0x3f')](_0x323bad[_0x8175('0x3a')],_0x323bad[_0x8175('0x3d')]);_0x292efe[_0x8175('0x40')]=_[_0x8175('0x3f')](_0x323bad['model'],qs[_0x8175('0x41')](_0x2b7197['query'][_0x8175('0x41')]));_0x292efe[_0x8175('0x40')]=_0x292efe[_0x8175('0x40')][_0x8175('0x42')]?_0x292efe[_0x8175('0x40')]:_0x323bad[_0x8175('0x3a')];if(!_0x2b7197[_0x8175('0x3d')][_0x8175('0x43')](_0x8175('0x44'))){_0x292efe['limit']=qs[_0x8175('0x2a')](_0x2b7197[_0x8175('0x3d')][_0x8175('0x2a')]);_0x292efe[_0x8175('0x28')]=qs['offset'](_0x2b7197['query'][_0x8175('0x28')]);}_0x292efe['order']=qs[_0x8175('0x45')](_0x2b7197[_0x8175('0x3d')][_0x8175('0x45')]);_0x292efe[_0x8175('0x46')]=qs[_0x8175('0x3e')](_[_0x8175('0x47')](_0x2b7197[_0x8175('0x3d')],_0x323bad[_0x8175('0x3e')]),_0x38ea43);if(_0x2b7197['query'][_0x8175('0x48')]){_0x292efe[_0x8175('0x46')]=_[_0x8175('0x49')](_0x292efe[_0x8175('0x46')],{'$or':_[_0x8175('0x3b')](_0x38ea43,function(_0x3c0630){if(_0x3c0630[_0x8175('0x38')]!==_0x8175('0x4a')){var _0x2fbd16={};_0x2fbd16[_0x3c0630[_0x8175('0x34')]]={'$like':'%'+_0x2b7197['query'][_0x8175('0x48')]+'%'};return _0x2fbd16;}})});}_0x292efe=_[_0x8175('0x49')]({},_0x292efe,_0x2b7197['options']);var _0x52790f={'where':_0x292efe[_0x8175('0x46')]};return db['FaxMessage']['count'](_0x52790f)[_0x8175('0x19')](function(_0x3cac9c){_0xc089c2[_0x8175('0x2b')]=_0x3cac9c;if(_0x2b7197['query'][_0x8175('0x4b')]){_0x292efe['include']=[{'all':!![]}];}return db['FaxMessage'][_0x8175('0x4c')](_0x292efe);})[_0x8175('0x19')](function(_0x7715b8){_0xc089c2[_0x8175('0x4d')]=_0x7715b8;return _0xc089c2;})[_0x8175('0x19')](respondWithFilteredResult(_0x2e05df,_0x292efe))['catch'](handleError(_0x2e05df,null));};exports[_0x8175('0x4e')]=function(_0x43510b,_0x8f8fb9){var _0x55f903={'raw':!![],'where':{'id':_0x43510b[_0x8175('0x4f')]['id']}},_0x5cc6a2={};_0x5cc6a2['model']=_[_0x8175('0x3c')](db[_0x8175('0x50')][_0x8175('0x37')]);_0x5cc6a2[_0x8175('0x3d')]=_[_0x8175('0x3c')](_0x43510b[_0x8175('0x3d')]);_0x5cc6a2[_0x8175('0x3e')]=_[_0x8175('0x3f')](_0x5cc6a2['model'],_0x5cc6a2[_0x8175('0x3d')]);_0x55f903[_0x8175('0x40')]=_[_0x8175('0x3f')](_0x5cc6a2[_0x8175('0x3a')],qs[_0x8175('0x41')](_0x43510b[_0x8175('0x3d')]['fields']));_0x55f903[_0x8175('0x40')]=_0x55f903['attributes'][_0x8175('0x42')]?_0x55f903[_0x8175('0x40')]:_0x5cc6a2['model'];if(_0x43510b[_0x8175('0x3d')][_0x8175('0x4b')]){_0x55f903['include']=[{'all':!![]}];}_0x55f903=_['merge']({},_0x55f903,_0x43510b[_0x8175('0x51')]);return db[_0x8175('0x50')][_0x8175('0x52')](_0x55f903)[_0x8175('0x19')](handleEntityNotFound(_0x8f8fb9,null))[_0x8175('0x19')](respondWithResult(_0x8f8fb9,null))[_0x8175('0x23')](handleError(_0x8f8fb9,null));};exports[_0x8175('0x31')]=function(_0x1b96e3,_0x273573){if(_0x1b96e3[_0x8175('0x53')]['id']){delete _0x1b96e3['body']['id'];}return db[_0x8175('0x50')]['find']({'where':{'id':_0x1b96e3[_0x8175('0x4f')]['id']}})[_0x8175('0x19')](handleEntityNotFound(_0x273573,null))['then'](saveUpdates(_0x1b96e3['body'],null))['then'](respondWithResult(_0x273573,null))[_0x8175('0x23')](handleError(_0x273573,null));};exports['destroy']=function(_0x1b76a6,_0x42644d){return db[_0x8175('0x50')][_0x8175('0x52')]({'where':{'id':_0x1b76a6[_0x8175('0x4f')]['id']}})[_0x8175('0x19')](handleEntityNotFound(_0x42644d,null))['then'](removeEntity(_0x42644d,null))[_0x8175('0x23')](handleError(_0x42644d,null));};exports[_0x8175('0x54')]=function(_0x15f9a8,_0x3ac8d3){return db['FaxMessage'][_0x8175('0x54')]()[_0x8175('0x19')](respondWithResult(_0x3ac8d3,null))[_0x8175('0x23')](handleError(_0x3ac8d3,null));};var interaction_log=require(_0x8175('0x10'))('fax-interactions');exports[_0x8175('0x55')]=function(_0x373eb0,_0x455c6,_0x223390){var _0x40e7d3={'agent':{},'channel':'fax'};if(_0x373eb0[_0x8175('0x53')]['id']){delete _0x373eb0[_0x8175('0x53')]['id'];}_0x373eb0[_0x8175('0x53')][_0x8175('0x56')]=!![];_0x373eb0['body'][_0x8175('0x57')]=moment()[_0x8175('0x58')](_0x8175('0x59'));_0x373eb0[_0x8175('0x53')][_0x8175('0x5a')]=_0x373eb0['body'][_0x8175('0x5a')]||_0x373eb0[_0x8175('0x5b')]['id'];_0x40e7d3['agent']['id']=_0x373eb0[_0x8175('0x53')][_0x8175('0x5a')];return db[_0x8175('0x50')][_0x8175('0x52')]({'where':{'id':_0x373eb0[_0x8175('0x4f')]['id'],'UserId':null}})[_0x8175('0x19')](handleEntityNotFound(_0x455c6,null))[_0x8175('0x19')](saveUpdates(_0x373eb0[_0x8175('0x53')],null))[_0x8175('0x19')](function(_0x5d0a31){if(_0x5d0a31){_0x40e7d3[_0x8175('0x21')]=_0x5d0a31[_0x8175('0x5c')]({'plain':!![]});return db[_0x8175('0x5d')][_0x8175('0x52')]({'where':{'id':_0x5d0a31[_0x8175('0x5e')]}});}return null;})[_0x8175('0x19')](handleEntityNotFound(_0x455c6,null))[_0x8175('0x19')](function(_0x376036){if(_0x376036){return _0x376036[_0x8175('0x31')]({'UserId':_0x373eb0[_0x8175('0x53')]['UserId'],'read1stAt':_[_0x8175('0x5f')](_0x376036[_0x8175('0x60')])?moment()[_0x8175('0x58')](_0x8175('0x59')):undefined});}return null;})['then'](function(_0x3a4078){if(_0x3a4078){_0x40e7d3[_0x8175('0x61')]=_0x3a4078['get']({'plain':!![]});interaction_log[_0x8175('0x1a')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x373eb0[_0x8175('0x5b')]['id'],_0x373eb0[_0x8175('0x5b')][_0x8175('0x34')],_0x373eb0[_0x8175('0x5b')][_0x8175('0x62')],_0x40e7d3[_0x8175('0x61')]['id'],_0x373eb0[_0x8175('0x53')]?JSON[_0x8175('0x1e')](_0x373eb0[_0x8175('0x53')]):_0x8175('0x63'));return respondWithRpcPromise(_0x8175('0x64'),_0x8175('0x65'),_0x40e7d3);}return null;})[_0x8175('0x19')](function(_0x4e4bf4){var _0x337ce3='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e4bf4[_0x8175('0x21')][_0x8175('0x66')];return db[_0x8175('0x67')][_0x8175('0x3d')](_0x337ce3,{'type':db[_0x8175('0x68')]['QueryTypes'][_0x8175('0x69')],'raw':!![]})['then'](function(_0x47a249){return _0x47a249;});})[_0x8175('0x19')](function(_0x328c97){if(_0x328c97){_0x40e7d3['message'][_0x8175('0x6a')]=_0x328c97[0x0];if(!_0x373eb0['body'][_0x8175('0x5a')])return;return db[_0x8175('0x6b')][_0x8175('0x52')]({'where':{'id':_0x373eb0['body'][_0x8175('0x5a')],'role':'agent'},'attributes':['id',_0x8175('0x34'),_0x8175('0x6c'),'email',_0x8175('0x6d')],'raw':!![]});}return null;})[_0x8175('0x19')](function(_0x4a6a6d){if(!_0x4a6a6d)return null;_0x40e7d3[_0x8175('0x21')][_0x8175('0x6e')]=_0x4a6a6d;return _0x40e7d3;})[_0x8175('0x19')](function(_0x4165fd){if(_0x4165fd){if(_0x373eb0[_0x8175('0x53')][_0x8175('0x6f')]){_0x40e7d3[_0x8175('0x21')][_0x8175('0x70')]=util[_0x8175('0x58')](_0x8175('0x71'),_0x373eb0[_0x8175('0x5b')][_0x8175('0x34')]);_0x40e7d3[_0x8175('0x21')][_0x8175('0x72')]=_0x40e7d3[_0x8175('0x72')];_0x40e7d3[_0x8175('0x21')]['motionChannel']=_0x40e7d3[_0x8175('0x72')];_0x40e7d3[_0x8175('0x21')]['event']=_0x8175('0x55');return respondWithRpcPromise(_0x8175('0x73'),_0x8175('0x73'),{'event':_0x8175('0x74'),'message':_0x40e7d3[_0x8175('0x21')]},client9002)[_0x8175('0x19')](function(){return _0x40e7d3;});}return _0x40e7d3;}return null;})['then'](respondWithResult(_0x455c6,null))[_0x8175('0x23')](handleError(_0x455c6,null));};var interaction_log=require('../../config/logger')(_0x8175('0x75'));exports[_0x8175('0x2f')]=function(_0x1c67ea,_0x2d877e,_0x180c0a){var _0x143f79={'agent':{},'channel':'fax'};if(_0x1c67ea[_0x8175('0x53')]['id']){delete _0x1c67ea[_0x8175('0x53')]['id'];}_0x1c67ea[_0x8175('0x53')][_0x8175('0x5a')]=_0x1c67ea[_0x8175('0x53')][_0x8175('0x5a')]||_0x1c67ea[_0x8175('0x5b')]['id'];_0x143f79[_0x8175('0x6e')]['id']=_0x1c67ea['body'][_0x8175('0x5a')];return db[_0x8175('0x50')][_0x8175('0x52')]({'where':{'id':_0x1c67ea['params']['id'],'UserId':null}})[_0x8175('0x19')](handleEntityNotFound(_0x2d877e,null))[_0x8175('0x19')](function(_0x42756c){if(_0x42756c){_0x143f79['message']=_0x42756c['get']({'plain':!![]});return db[_0x8175('0x5d')]['find']({'where':{'id':_0x42756c[_0x8175('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x2d877e,null))[_0x8175('0x19')](function(_0x1333f0){if(_0x1333f0){_0x143f79[_0x8175('0x61')]=_0x1333f0[_0x8175('0x5c')]({'plain':!![]});interaction_log['info'](_0x8175('0x76'),_0x1c67ea[_0x8175('0x5b')]['id'],_0x1c67ea['user'][_0x8175('0x34')],_0x1c67ea[_0x8175('0x5b')][_0x8175('0x62')],_0x143f79[_0x8175('0x61')]['id'],_0x1c67ea[_0x8175('0x53')]?JSON[_0x8175('0x1e')](_0x1c67ea[_0x8175('0x53')]):_0x8175('0x63'));return respondWithRpcPromise('RejectMessage',_0x8175('0x77'),_0x143f79);}return null;})[_0x8175('0x19')](function(_0xf28630){var _0x1753db=_0x8175('0x78')+_0xf28630[_0x8175('0x21')]['ContactId'];return db[_0x8175('0x67')]['query'](_0x1753db,{'type':db[_0x8175('0x68')]['QueryTypes'][_0x8175('0x69')],'raw':!![]})[_0x8175('0x19')](function(_0x175e46){return _0x175e46;});})['then'](function(_0x4cf1bc){if(_0x4cf1bc){_0x143f79['message'][_0x8175('0x6a')]=_0x4cf1bc[0x0];if(!_0x1c67ea[_0x8175('0x53')]['UserId'])return;return db[_0x8175('0x6b')]['find']({'where':{'id':_0x1c67ea['body'][_0x8175('0x5a')],'role':_0x8175('0x6e')},'attributes':['id',_0x8175('0x34'),_0x8175('0x6c'),_0x8175('0x79'),_0x8175('0x6d')],'raw':!![]});}return null;})['then'](function(_0x4d9c07){if(!_0x4d9c07)return null;_0x143f79[_0x8175('0x21')][_0x8175('0x6e')]=_0x4d9c07;return _0x143f79;})[_0x8175('0x19')](function(_0x24c69d){if(_0x24c69d){_0x24c69d['message'][_0x8175('0x70')]=util['format'](_0x8175('0x71'),_0x1c67ea['user'][_0x8175('0x34')]);_0x24c69d[_0x8175('0x21')]['channel']=_0x143f79[_0x8175('0x72')];_0x24c69d[_0x8175('0x21')][_0x8175('0x7a')]=_0x143f79['channel'];_0x24c69d['message'][_0x8175('0x7b')]=_0x8175('0x2f');respondWithRpcPromise('EventManager',_0x8175('0x73'),{'event':_0x8175('0x7c'),'message':_0x24c69d[_0x8175('0x21')]},client9002);return _0x143f79;}return null;})[_0x8175('0x19')](respondWithResult(_0x2d877e,null))[_0x8175('0x23')](handleError(_0x2d877e,null));};exports[_0x8175('0x7d')]=function(_0x354d0c,_0x4d55a5){var _0x5a6247;return db[_0x8175('0x50')][_0x8175('0x7d')](_0x354d0c[_0x8175('0x53')],{})['then'](function(_0x28f12b){_0x5a6247=_0x28f12b;return db[_0x8175('0x7e')][_0x8175('0x7f')]({'where':{'id':_0x5a6247[_0x8175('0x66')]}});})['then'](function(_0x5f5032){if(_[_0x8175('0x5f')](_0x5f5032)){return;}else{_0x5a6247[_0x8175('0x80')]=_0x5f5032[_0x8175('0x80')];return db[_0x8175('0x81')][_0x8175('0x7f')]({'where':{'id':_0x5a6247[_0x8175('0x82')]}});}})[_0x8175('0x19')](function(_0x4bd858){return respondWithRpcPromise('SendFax',_0x8175('0x83'),{'FaxAccountId':_['isNil'](_0x354d0c[_0x8175('0x53')])?undefined:_0x354d0c[_0x8175('0x53')][_0x8175('0x84')],'path':_[_0x8175('0x5f')](_0x4bd858)?undefined:util[_0x8175('0x58')](_0x8175('0x85'),_0x4bd858[_0x8175('0x86')]),'fax':_[_0x8175('0x5f')](_0x5a6247[_0x8175('0x80')])?undefined:_0x5a6247['fax'],'AttachmentId':_0x5a6247[_0x8175('0x82')]},client9002);})[_0x8175('0x19')](respondWithResult(_0x4d55a5,0xc9))[_0x8175('0x23')](handleError(_0x4d55a5,null));};exports['download']=function(_0x3fd6eb,_0x4c5afb){var _0x354ec7=path['join'](config[_0x8175('0x87')],_0x8175('0x88'),'files','attachments');return db[_0x8175('0x50')][_0x8175('0x52')]({'where':{'id':_0x3fd6eb[_0x8175('0x4f')]['id']},'include':[{'model':db[_0x8175('0x81')],'as':_0x8175('0x81')}]})['then'](handleEntityNotFound(_0x4c5afb,null))[_0x8175('0x19')](function(_0x4460b9){if(_0x4460b9){return _0x4c5afb['download'](path['join'](_0x354ec7,_0x4460b9[_0x8175('0x81')][_0x8175('0x86')]));}})[_0x8175('0x23')](handleError(_0x4c5afb,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index e89eb96..1f09221 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 _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 +var _0xae35=['events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x17005a,_0x28cba0){var _0x620aeb=function(_0x5dfb5b){while(--_0x5dfb5b){_0x17005a['push'](_0x17005a['shift']());}};_0x620aeb(++_0x28cba0);}(_0xae35,0x172));var _0x5ae3=function(_0x26c790,_0x1962bb){_0x26c790=_0x26c790-0x0;var _0x369b9a=_0xae35[_0x26c790];return _0x369b9a;};'use strict';var EventEmitter=require(_0x5ae3('0x0'));var FaxMessage=require(_0x5ae3('0x1'))['db'][_0x5ae3('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x5ae3('0x3')](0x0);var events={'afterCreate':_0x5ae3('0x4'),'afterUpdate':_0x5ae3('0x5'),'afterDestroy':_0x5ae3('0x6')};function emitEvent(_0x39d9b7){return function(_0x54c0f2,_0x6dffe3,_0x4d1536){FaxMessageEvents[_0x5ae3('0x7')](_0x39d9b7+':'+_0x54c0f2['id'],_0x54c0f2);FaxMessageEvents[_0x5ae3('0x7')](_0x39d9b7,_0x54c0f2);_0x4d1536(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x5ae3('0x8')](e,emitEvent(event));}}module[_0x5ae3('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 0d29e2d..0ae9a5b 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 _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 +var _0xfab0=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./faxMessage.attributes','exports','define','fax_messages','fti_fax_messages','FULLTEXT','models','direction','toLowerCase','isNil','UserId','findOne','FaxInteractionId','then','update','createdAt','catch','utf8mb4'];(function(_0x412c8f,_0x11ec94){var _0x27c005=function(_0x127059){while(--_0x127059){_0x412c8f['push'](_0x412c8f['shift']());}};_0x27c005(++_0x11ec94);}(_0xfab0,0x1e7));var _0x0fab=function(_0x456032,_0x1a799d){_0x456032=_0x456032-0x0;var _0x1a53cd=_0xfab0[_0x456032];return _0x1a53cd;};'use strict';var _=require(_0x0fab('0x0'));var util=require(_0x0fab('0x1'));var logger=require(_0x0fab('0x2'))(_0x0fab('0x3'));var moment=require(_0x0fab('0x4'));var BPromise=require(_0x0fab('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0fab('0x6'));var rimraf=require('rimraf');var config=require(_0x0fab('0x7'));var attributes=require(_0x0fab('0x8'));module[_0x0fab('0x9')]=function(_0x53a4db,_0x3a6b3c){return _0x53a4db[_0x0fab('0xa')]('FaxMessage',attributes,{'tableName':_0x0fab('0xb'),'paranoid':![],'indexes':[{'name':_0x0fab('0xc'),'fields':['body'],'type':_0x0fab('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x277bb5,_0x49d6f4,_0x220968){var _0x464f19=_0x53a4db[_0x0fab('0xe')];var _0xae5537=_0x277bb5['get']({'plain':!![]});if(_0xae5537[_0x0fab('0xf')][_0x0fab('0x10')]()==='in'||_0xae5537['direction'][_0x0fab('0x10')]()==='out'&&!_0xae5537['secret']&&!_[_0x0fab('0x11')](_0xae5537[_0x0fab('0x12')])){_0x464f19['FaxInteraction'][_0x0fab('0x13')]({'where':{'id':_0xae5537[_0x0fab('0x14')]}})[_0x0fab('0x15')](function(_0x23410e){if(_0x23410e){_0x23410e[_0x0fab('0x16')]({'lastMsgAt':_0xae5537[_0x0fab('0x17')],'lastMsgDirection':_0xae5537['direction'][_0x0fab('0x10')]()});}})[_0x0fab('0x18')](function(_0x135de2){console['error'](_0x135de2);});}_0x220968();}},'charset':_0x0fab('0x19'),'collate':_0x0fab('0x1a')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index c31d1a8..5571a06 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 _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 +var _0x9f62=['util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','request','info','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','CreateFaxMessage','FaxMessage','body','raw','then','debug','catch','UpdateFaxMessage','update','options','where','attributes','limit'];(function(_0x1a8183,_0x370a2c){var _0x43fe66=function(_0x4c9666){while(--_0x4c9666){_0x1a8183['push'](_0x1a8183['shift']());}};_0x43fe66(++_0x370a2c);}(_0x9f62,0x154));var _0x29f6=function(_0x51383f,_0x115bfc){_0x51383f=_0x51383f-0x0;var _0x1f54d2=_0x9f62[_0x51383f];return _0x1f54d2;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var moment=require('moment');var BPromise=require(_0x29f6('0x1'));var rs=require(_0x29f6('0x2'));var fs=require('fs');var Redis=require(_0x29f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x29f6('0x4'))(_0x29f6('0x5'));var config=require(_0x29f6('0x6'));var jayson=require(_0x29f6('0x7'));var client=jayson['client'][_0x29f6('0x8')]({'port':0x232a});config[_0x29f6('0x9')]=_[_0x29f6('0xa')](config[_0x29f6('0x9')],{'host':_0x29f6('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0xe25841,_0x44db16,_0x4fb455){return new BPromise(function(_0x5a0724,_0x29b3f5){return client[_0x29f6('0xc')](_0xe25841,_0x4fb455)['then'](function(_0x17b69c){logger[_0x29f6('0xd')]('FaxMessage,\x20%s,\x20%s',_0x44db16,'request\x20sent');logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x44db16,_0x29f6('0xe'),JSON[_0x29f6('0xf')](_0x17b69c));if(_0x17b69c[_0x29f6('0x10')]){if(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x11')]===0x1f4){logger[_0x29f6('0x10')](_0x29f6('0x12'),_0x44db16,_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);return _0x29b3f5(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);}logger[_0x29f6('0x10')](_0x29f6('0x12'),_0x44db16,_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);return _0x5a0724(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x44db16,_0x29f6('0xe'));_0x5a0724(_0x17b69c[_0x29f6('0x14')][_0x29f6('0x13')]);}})['catch'](function(_0xcb90){logger[_0x29f6('0x10')]('FaxMessage,\x20%s,\x20%s',_0x44db16,_0xcb90);_0x29b3f5(_0xcb90);});});}exports[_0x29f6('0x15')]=function(_0x3e81af){var _0x42a8fa=this;return new Promise(function(_0x41b9f0,_0xb6e7a9){return db[_0x29f6('0x16')]['create'](_0x3e81af[_0x29f6('0x17')],{'raw':_0x3e81af['options']?_0x3e81af['options'][_0x29f6('0x18')]===undefined?!![]:![]:!![]})[_0x29f6('0x19')](function(_0x39c6b3){logger[_0x29f6('0xd')]('CreateFaxMessage',_0x3e81af);logger[_0x29f6('0x1a')]('CreateFaxMessage',_0x3e81af,JSON[_0x29f6('0xf')](_0x39c6b3));_0x41b9f0(_0x39c6b3);})[_0x29f6('0x1b')](function(_0x4200cc){logger[_0x29f6('0x10')]('CreateFaxMessage',_0x4200cc[_0x29f6('0x13')],_0x3e81af);_0xb6e7a9(_0x42a8fa[_0x29f6('0x10')](0x1f4,_0x4200cc['message']));});});};exports[_0x29f6('0x1c')]=function(_0x45f792){var _0x2519ac=this;return new Promise(function(_0x342038,_0x84ccb7){return db[_0x29f6('0x16')][_0x29f6('0x1d')](_0x45f792['body'],{'raw':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x1f')]||null:null,'attributes':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x20')]||null:null,'limit':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x21')]||null:null})[_0x29f6('0x19')](function(_0x304c28){logger[_0x29f6('0xd')](_0x29f6('0x1c'),_0x45f792);logger[_0x29f6('0x1a')]('UpdateFaxMessage',_0x45f792,JSON['stringify'](_0x304c28));_0x342038(_0x304c28);})[_0x29f6('0x1b')](function(_0x489897){logger[_0x29f6('0x10')](_0x29f6('0x1c'),_0x489897[_0x29f6('0x13')],_0x45f792);_0x84ccb7(_0x2519ac[_0x29f6('0x10')](0x1f4,_0x489897['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 8681ce4..dc84f61 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 _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 +var _0x6071=['faxMessage:','./faxMessage.events','removeListener','register','length'];(function(_0x334444,_0x20403c){var _0x303741=function(_0x2c7753){while(--_0x2c7753){_0x334444['push'](_0x334444['shift']());}};_0x303741(++_0x20403c);}(_0x6071,0x1eb));var _0x1607=function(_0x13e4b0,_0xf4825a){_0x13e4b0=_0x13e4b0-0x0;var _0x240b14=_0x6071[_0x13e4b0];return _0x240b14;};'use strict';var FaxMessageEvents=require(_0x1607('0x0'));var events=['save','remove','update'];function createListener(_0x409d2c,_0x156d3b){return function(_0x397c7c){_0x156d3b['emit'](_0x409d2c,_0x397c7c);};}function removeListener(_0x49cd17,_0x2f34f1){return function(){FaxMessageEvents[_0x1607('0x1')](_0x49cd17,_0x2f34f1);};}exports[_0x1607('0x2')]=function(_0x464c4d){for(var _0x4e4f09=0x0,_0x659a6b=events[_0x1607('0x3')];_0x4e4f09<_0x659a6b;_0x4e4f09++){var _0x16215e=events[_0x4e4f09];var _0x2ba854=createListener(_0x1607('0x4')+_0x16215e,_0x464c4d);FaxMessageEvents['on'](_0x16215e,_0x2ba854);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index f6d34fa..a02dd8a 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 _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 +var _0x96cc=['/:id/download','post','tracked','faxmessage:create','create','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x4485c9,_0x89680f){var _0x241963=function(_0xfe6dfc){while(--_0xfe6dfc){_0x4485c9['push'](_0x4485c9['shift']());}};_0x241963(++_0x89680f);}(_0x96cc,0x16c));var _0xc96c=function(_0x231be4,_0x2954a5){_0x231be4=_0x231be4-0x0;var _0x50ca1f=_0x96cc[_0x231be4];return _0x50ca1f;};'use strict';var multer=require(_0xc96c('0x0'));var util=require('util');var path=require(_0xc96c('0x1'));var timeout=require('connect-timeout');var express=require(_0xc96c('0x2'));var router=express[_0xc96c('0x3')]();var fs_extra=require(_0xc96c('0x4'));var auth=require(_0xc96c('0x5'));var interaction=require(_0xc96c('0x6'));var config=require(_0xc96c('0x7'));var controller=require(_0xc96c('0x8'));router[_0xc96c('0x9')]('/',auth[_0xc96c('0xa')](),controller['index']);router[_0xc96c('0x9')](_0xc96c('0xb'),auth[_0xc96c('0xa')](),controller[_0xc96c('0xc')]);router[_0xc96c('0x9')](_0xc96c('0xd'),auth[_0xc96c('0xa')](),controller['show']);router[_0xc96c('0x9')](_0xc96c('0xe'),auth[_0xc96c('0xa')](),controller['download']);router[_0xc96c('0xf')]('/',auth['isAuthenticated'](),interaction[_0xc96c('0x10')]('fax',_0xc96c('0x11')),controller[_0xc96c('0x12')]);router[_0xc96c('0x13')](_0xc96c('0xd'),auth['isAuthenticated'](),controller[_0xc96c('0x14')]);router[_0xc96c('0x13')](_0xc96c('0x15'),auth[_0xc96c('0xa')](),controller['accept']);router[_0xc96c('0x13')](_0xc96c('0x16'),auth[_0xc96c('0xa')](),controller[_0xc96c('0x17')]);router[_0xc96c('0x18')](_0xc96c('0xd'),auth[_0xc96c('0xa')](),controller[_0xc96c('0x19')]);module[_0xc96c('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 46e4850..3c35ad1 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 _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 +var _0x3249=['roundrobin','sequelize','exports','STRING','ENUM','beepall'];(function(_0x556bca,_0x573fb9){var _0x16c8fd=function(_0x469625){while(--_0x469625){_0x556bca['push'](_0x556bca['shift']());}};_0x16c8fd(++_0x573fb9);}(_0x3249,0xdf));var _0x9324=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x3249[_0x3511d3];return _0x5d6321;};'use strict';var Sequelize=require(_0x9324('0x0'));module[_0x9324('0x1')]={'name':{'type':Sequelize[_0x9324('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9324('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9324('0x3')]('rrmemory',_0x9324('0x4'),_0x9324('0x5')),'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 bfb70f7..616f58d 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 _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 +var _0x7bd0=['select','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','forEach','emit','userFaxQueue:remove','addAgents','omit','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','update','destroy','then','get','FaxQueues','UserProfileResource','stack','send','index','map','FaxQueue','rawAttributes','fieldName','where','include','query','findAll','rows','catch','show','params','model','filters','intersection','fields','attributes','length','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','name','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','keys','UserFaxQueue','hasOwnProperty','nolimit','sort','pick','FaxQueueId','filter','options','User','findAndCountAll','UserId','faxPause','updatedAt','format','SIP','createdAt','getTeams','order','addTeams','Team','Agents','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','userFaxQueue:save','removeTeams','ids'];(function(_0x3ac3b6,_0x400dee){var _0x32b400=function(_0x5dae6a){while(--_0x5dae6a){_0x3ac3b6['push'](_0x3ac3b6['shift']());}};_0x32b400(++_0x400dee);}(_0x7bd0,0x111));var _0x07bd=function(_0x516ffb,_0x5b5b42){_0x516ffb=_0x516ffb-0x0;var _0x319667=_0x7bd0[_0x516ffb];return _0x319667;};'use strict';var BPromise=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var _=require(_0x07bd('0x2'));var squel=require(_0x07bd('0x3'));var Redis=require(_0x07bd('0x4'));var qs=require(_0x07bd('0x5'));var logger=require(_0x07bd('0x6'))(_0x07bd('0x7'));var config=require('../../config/environment');var db=require(_0x07bd('0x8'))['db'];config[_0x07bd('0x9')]=_[_0x07bd('0xa')](config[_0x07bd('0x9')],{'host':_0x07bd('0xb'),'port':0x18eb});var socket=require(_0x07bd('0xc'))(new Redis(config[_0x07bd('0x9')]));require('./faxQueue.socket')[_0x07bd('0xd')](socket);function respondWithStatusCode(_0x5cd446,_0x8032dc){_0x8032dc=_0x8032dc||0xcc;return function(_0xb10241){if(_0xb10241){return _0x5cd446[_0x07bd('0xe')](_0x8032dc);}return _0x5cd446['status'](_0x8032dc)[_0x07bd('0xf')]();};}function respondWithResult(_0x141e8b,_0x324a46){_0x324a46=_0x324a46||0xc8;return function(_0x169b07){if(_0x169b07){return _0x141e8b['status'](_0x324a46)[_0x07bd('0x10')](_0x169b07);}};}function respondWithFilteredResult(_0x313ca5,_0x1b067a){return function(_0x222efa){if(_0x222efa){var _0x456ecd=typeof _0x1b067a[_0x07bd('0x11')]===_0x07bd('0x12')&&typeof _0x1b067a[_0x07bd('0x13')]==='undefined';var _0x51eb2a=_0x222efa[_0x07bd('0x14')];var _0x3fe523=_0x456ecd?0x0:_0x1b067a[_0x07bd('0x11')];var _0x247f3f=_0x456ecd?_0x222efa[_0x07bd('0x14')]:_0x1b067a[_0x07bd('0x11')]+_0x1b067a[_0x07bd('0x13')];var _0x49d962;if(_0x247f3f>=_0x51eb2a){_0x247f3f=_0x51eb2a;_0x49d962=0xc8;}else{_0x49d962=0xce;}_0x313ca5[_0x07bd('0x15')](_0x49d962);return _0x313ca5['set'](_0x07bd('0x16'),_0x3fe523+'-'+_0x247f3f+'/'+_0x51eb2a)[_0x07bd('0x10')](_0x222efa);}return null;};}function saveUpdates(_0x31655a){return function(_0x1713ca){if(_0x1713ca){return _0x1713ca[_0x07bd('0x17')](_0x31655a)['then'](function(_0x3f9f0b){return _0x3f9f0b;});}return null;};}function removeEntity(_0xc4cf4c){return function(_0x4948f4){if(_0x4948f4){return _0x4948f4[_0x07bd('0x18')]()[_0x07bd('0x19')](function(){var _0x758fd5=_0x4948f4[_0x07bd('0x1a')]({'plain':!![]});var _0x36ccec=_0x07bd('0x1b');return db[_0x07bd('0x1c')][_0x07bd('0x18')]({'where':{'type':_0x36ccec,'resourceId':_0x758fd5['id']}})[_0x07bd('0x19')](function(){return _0x4948f4;});})['then'](function(){_0xc4cf4c[_0x07bd('0x15')](0xcc)[_0x07bd('0xf')]();});}};}function handleEntityNotFound(_0xcb8b23){return function(_0x11684d){if(!_0x11684d){_0xcb8b23[_0x07bd('0xe')](0x194);}return _0x11684d;};}function handleError(_0x47bd50,_0x4c673a){_0x4c673a=_0x4c673a||0x1f4;return function(_0xbb7117){logger['error'](_0xbb7117[_0x07bd('0x1d')]);if(_0xbb7117['name']){delete _0xbb7117['name'];}_0x47bd50[_0x07bd('0x15')](_0x4c673a)[_0x07bd('0x1e')](_0xbb7117);};}exports[_0x07bd('0x1f')]=function(_0xdb47ba,_0x28bd91){var _0x43cbc8={};var _0x557042={'count':0x0,'rows':[]};var _0x180b43=_[_0x07bd('0x20')](db[_0x07bd('0x21')][_0x07bd('0x22')],function(_0x12ce26){return{'name':_0x12ce26[_0x07bd('0x23')],'type':_0x12ce26['type']['key']};});_0x43cbc8=qs['getOptions'](_0x180b43,_0xdb47ba);var _0x335d61={'where':_0x43cbc8[_0x07bd('0x24')]};return db[_0x07bd('0x21')]['count'](_0x335d61)[_0x07bd('0x19')](function(_0x400cc0){_0x557042[_0x07bd('0x14')]=_0x400cc0;_0x43cbc8[_0x07bd('0x25')]=qs[_0x07bd('0x25')](_0xdb47ba[_0x07bd('0x26')]);return db['FaxQueue'][_0x07bd('0x27')](_0x43cbc8);})[_0x07bd('0x19')](function(_0x4182b9){_0x557042[_0x07bd('0x28')]=_0x4182b9;return _0x557042;})[_0x07bd('0x19')](respondWithFilteredResult(_0x28bd91,_0x43cbc8))[_0x07bd('0x29')](handleError(_0x28bd91,null));};exports[_0x07bd('0x2a')]=function(_0x456004,_0x4ff162){var _0x594967={'raw':!![],'where':{'id':_0x456004[_0x07bd('0x2b')]['id']}},_0x3fe506={};_0x3fe506[_0x07bd('0x2c')]=_['keys'](db[_0x07bd('0x21')][_0x07bd('0x22')]);_0x3fe506[_0x07bd('0x26')]=_['keys'](_0x456004['query']);_0x3fe506[_0x07bd('0x2d')]=_[_0x07bd('0x2e')](_0x3fe506[_0x07bd('0x2c')],_0x3fe506[_0x07bd('0x26')]);_0x594967['attributes']=_[_0x07bd('0x2e')](_0x3fe506[_0x07bd('0x2c')],qs[_0x07bd('0x2f')](_0x456004['query'][_0x07bd('0x2f')]));_0x594967[_0x07bd('0x30')]=_0x594967['attributes'][_0x07bd('0x31')]?_0x594967[_0x07bd('0x30')]:_0x3fe506[_0x07bd('0x2c')];if(_0x456004[_0x07bd('0x26')]['includeAll']){_0x594967['include']=[{'all':!![]}];}_0x594967=_[_0x07bd('0x32')]({},_0x594967,_0x456004['options']);return db[_0x07bd('0x21')][_0x07bd('0x33')](_0x594967)[_0x07bd('0x19')](handleEntityNotFound(_0x4ff162,null))[_0x07bd('0x19')](respondWithResult(_0x4ff162,null))[_0x07bd('0x29')](handleError(_0x4ff162,null));};exports[_0x07bd('0x34')]=function(_0x3e63b3,_0x333ac2){return db[_0x07bd('0x21')][_0x07bd('0x34')](_0x3e63b3[_0x07bd('0x35')],{})[_0x07bd('0x19')](function(_0x33067c){var _0x51e8e2=_0x3e63b3[_0x07bd('0x36')][_0x07bd('0x1a')]({'plain':!![]});if(!_0x51e8e2)throw new Error(_0x07bd('0x37'));if(_0x51e8e2[_0x07bd('0x38')]==='user'){var _0x2d2b71=_0x33067c[_0x07bd('0x1a')]({'plain':!![]});var _0x456948=_0x07bd('0x1b');return db[_0x07bd('0x39')]['find']({'where':{'name':_0x456948,'userProfileId':_0x51e8e2['userProfileId']},'raw':!![]})[_0x07bd('0x19')](function(_0x88e174){if(_0x88e174&&_0x88e174[_0x07bd('0x3a')]===0x0){return db[_0x07bd('0x1c')]['create']({'name':_0x2d2b71[_0x07bd('0x3b')],'resourceId':_0x2d2b71['id'],'type':_0x88e174[_0x07bd('0x3b')],'sectionId':_0x88e174['id']},{})[_0x07bd('0x19')](function(){return _0x33067c;});}else{return _0x33067c;}})[_0x07bd('0x29')](function(_0x318b7c){logger[_0x07bd('0x3c')](_0x07bd('0x3d'),_0x318b7c);throw _0x318b7c;});}return _0x33067c;})['then'](respondWithResult(_0x333ac2,0xc9))[_0x07bd('0x29')](handleError(_0x333ac2,null));};exports[_0x07bd('0x17')]=function(_0x33389b,_0x3a5827){if(_0x33389b[_0x07bd('0x35')]['id']){delete _0x33389b['body']['id'];}return db[_0x07bd('0x21')][_0x07bd('0x33')]({'where':{'id':_0x33389b[_0x07bd('0x2b')]['id']}})[_0x07bd('0x19')](handleEntityNotFound(_0x3a5827,null))[_0x07bd('0x19')](saveUpdates(_0x33389b['body'],null))[_0x07bd('0x19')](respondWithResult(_0x3a5827,null))[_0x07bd('0x29')](handleError(_0x3a5827,null));};exports[_0x07bd('0x18')]=function(_0x3954a7,_0x5acb1d){return db['FaxQueue'][_0x07bd('0x33')]({'where':{'id':_0x3954a7[_0x07bd('0x2b')]['id']}})[_0x07bd('0x19')](handleEntityNotFound(_0x5acb1d,null))[_0x07bd('0x19')](removeEntity(_0x5acb1d,null))[_0x07bd('0x29')](handleError(_0x5acb1d,null));};exports[_0x07bd('0x3e')]=function(_0x2d929b,_0x3cc593){return db[_0x07bd('0x21')]['describe']()['then'](respondWithResult(_0x3cc593,null))[_0x07bd('0x29')](handleError(_0x3cc593,null));};exports[_0x07bd('0x3f')]=function(_0x171db8,_0xaa85c5){var _0x44274b={'raw':!![],'where':{}},_0xe534c0={},_0x4f5183;return db[_0x07bd('0x21')][_0x07bd('0x40')]({'where':{'id':_0x171db8[_0x07bd('0x2b')]['id']}})[_0x07bd('0x19')](handleEntityNotFound(_0xaa85c5,null))[_0x07bd('0x19')](function(_0x4155df){if(_0x4155df){_0x4f5183=_0x4155df['get']({'plain':!![]});_0xe534c0[_0x07bd('0x2c')]=_[_0x07bd('0x41')](db[_0x07bd('0x42')][_0x07bd('0x22')]);_0xe534c0[_0x07bd('0x26')]=_[_0x07bd('0x41')](_0x171db8[_0x07bd('0x26')]);_0xe534c0[_0x07bd('0x2d')]=_[_0x07bd('0x2e')](_0xe534c0[_0x07bd('0x2c')],_0xe534c0[_0x07bd('0x26')]);_0x44274b[_0x07bd('0x30')]=_['intersection'](_0xe534c0[_0x07bd('0x2c')],qs[_0x07bd('0x2f')](_0x171db8[_0x07bd('0x26')]['fields']));_0x44274b['attributes']=_0x44274b[_0x07bd('0x30')]['length']?_0x44274b[_0x07bd('0x30')]:_0xe534c0[_0x07bd('0x2c')];if(!_0x171db8[_0x07bd('0x26')][_0x07bd('0x43')](_0x07bd('0x44'))){_0x44274b[_0x07bd('0x13')]=qs[_0x07bd('0x13')](_0x171db8[_0x07bd('0x26')]['limit']);_0x44274b[_0x07bd('0x11')]=qs[_0x07bd('0x11')](_0x171db8[_0x07bd('0x26')]['offset']);}_0x44274b['order']=qs['sort'](_0x171db8[_0x07bd('0x26')][_0x07bd('0x45')]);_0x44274b[_0x07bd('0x24')]=qs['filters'](_[_0x07bd('0x46')](_0x171db8[_0x07bd('0x26')],_0xe534c0[_0x07bd('0x2d')]));_0x44274b[_0x07bd('0x24')][_0x07bd('0x47')]=_0x4155df['id'];if(_0x171db8[_0x07bd('0x26')]['filter']){_0x44274b['where']=_[_0x07bd('0x32')](_0x44274b['where'],{'$or':_['map'](_0x44274b[_0x07bd('0x30')],function(_0x2d6eae){var _0xf12249={};_0xf12249[_0x2d6eae]={'$like':'%'+_0x171db8['query'][_0x07bd('0x48')]+'%'};return _0xf12249;})});}_0x44274b=_[_0x07bd('0x32')]({},_0x44274b,_0x171db8[_0x07bd('0x49')]);return db[_0x07bd('0x42')][_0x07bd('0x27')](_0x44274b);}})[_0x07bd('0x19')](function(_0x1982be){if(_0x1982be){return db[_0x07bd('0x4a')][_0x07bd('0x4b')]({'where':{'id':_['map'](_0x1982be,_0x07bd('0x4c')),'role':'agent'},'attributes':['id',_0x07bd('0x3b'),_0x07bd('0x4d'),_0x07bd('0x4e'),'createdAt']});}})[_0x07bd('0x19')](function(_0x5cb398){if(_0x5cb398){return{'count':_0x5cb398[_0x07bd('0x14')],'rows':_[_0x07bd('0x20')](_0x5cb398[_0x07bd('0x28')],function(_0xdde48d){return{'membername':_0xdde48d['name'],'UserId':_0xdde48d['id'],'queue_name':_0x4f5183['name'],'FaxQueueId':_0x4f5183['id'],'interface':util[_0x07bd('0x4f')]('%s/%s',_0x07bd('0x50'),_0xdde48d[_0x07bd('0x3b')]),'penalty':0x0,'paused':_0xdde48d[_0x07bd('0x4d')],'createdAt':_0xdde48d[_0x07bd('0x51')],'updatedAt':_0xdde48d[_0x07bd('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x07bd('0x19')](respondWithFilteredResult(_0xaa85c5,_0x44274b))['catch'](handleError(_0xaa85c5,null));};exports[_0x07bd('0x52')]=function(_0x23103c,_0x3d154d){var _0x15573d={};var _0xe086={};var _0x493175;var _0x2837ab;return db[_0x07bd('0x21')][_0x07bd('0x40')]({'where':{'id':_0x23103c['params']['id']}})[_0x07bd('0x19')](handleEntityNotFound(_0x3d154d,null))['then'](function(_0x230053){if(_0x230053){_0x493175=_0x230053;_0xe086[_0x07bd('0x2c')]=_['keys'](db['Team'][_0x07bd('0x22')]);_0xe086[_0x07bd('0x26')]=_[_0x07bd('0x41')](_0x23103c[_0x07bd('0x26')]);_0xe086[_0x07bd('0x2d')]=_['intersection'](_0xe086[_0x07bd('0x2c')],_0xe086['query']);_0x15573d[_0x07bd('0x30')]=_['intersection'](_0xe086[_0x07bd('0x2c')],qs['fields'](_0x23103c['query'][_0x07bd('0x2f')]));_0x15573d[_0x07bd('0x30')]=_0x15573d[_0x07bd('0x30')][_0x07bd('0x31')]?_0x15573d[_0x07bd('0x30')]:_0xe086[_0x07bd('0x2c')];_0x15573d[_0x07bd('0x53')]=qs[_0x07bd('0x45')](_0x23103c[_0x07bd('0x26')][_0x07bd('0x45')]);_0x15573d['where']=qs[_0x07bd('0x2d')](_['pick'](_0x23103c[_0x07bd('0x26')],_0xe086[_0x07bd('0x2d')]));if(_0x23103c[_0x07bd('0x26')]['filter']){_0x15573d[_0x07bd('0x24')]=_[_0x07bd('0x32')](_0x15573d[_0x07bd('0x24')],{'$or':_[_0x07bd('0x20')](_0x15573d[_0x07bd('0x30')],function(_0x28ec9e){var _0x307cf7={};_0x307cf7[_0x28ec9e]={'$like':'%'+_0x23103c['query'][_0x07bd('0x48')]+'%'};return _0x307cf7;})});}_0x15573d=_[_0x07bd('0x32')]({},_0x15573d,_0x23103c[_0x07bd('0x49')]);return _0x493175['getTeams'](_0x15573d);}})[_0x07bd('0x19')](function(_0xa83eb9){if(_0xa83eb9){_0x2837ab=_0xa83eb9[_0x07bd('0x31')];if(!_0x23103c[_0x07bd('0x26')]['hasOwnProperty'](_0x07bd('0x44'))){_0x15573d[_0x07bd('0x13')]=qs[_0x07bd('0x13')](_0x23103c[_0x07bd('0x26')]['limit']);_0x15573d[_0x07bd('0x11')]=qs['offset'](_0x23103c[_0x07bd('0x26')][_0x07bd('0x11')]);}return _0x493175[_0x07bd('0x52')](_0x15573d);}})[_0x07bd('0x19')](function(_0x5be4ef){if(_0x5be4ef){return _0x5be4ef?{'count':_0x2837ab,'rows':_0x5be4ef}:null;}})[_0x07bd('0x19')](respondWithResult(_0x3d154d,null))[_0x07bd('0x29')](handleError(_0x3d154d,null));};exports[_0x07bd('0x54')]=function(_0xb83fd2,_0x388962){var _0x40a6b9=_0xb83fd2[_0x07bd('0x35')]['ids'];return db[_0x07bd('0x55')][_0x07bd('0x27')]({'where':{'id':_0x40a6b9},'attributes':['id'],'include':[{'model':db[_0x07bd('0x4a')],'as':_0x07bd('0x56'),'attributes':['id',_0x07bd('0x3b'),'online',_0x07bd('0x57'),_0x07bd('0x58')],'raw':!![]}]})[_0x07bd('0x19')](function(_0x50aad3){if(_0x50aad3){var _0xadb15b=_[_0x07bd('0x59')](_0x50aad3,function(_0x6a958e){var _0x2deb53=_0x6a958e[_0x07bd('0x1a')]({'plain':!![]});return _0x2deb53['Agents'];});return db['FaxQueue'][_0x07bd('0x33')]({'where':{'id':_0xb83fd2[_0x07bd('0x2b')]['id']}})[_0x07bd('0x19')](function(_0x2582ec){return db[_0x07bd('0x5a')][_0x07bd('0x5b')](function(_0x2e79a8){return _0x2582ec[_0x07bd('0x54')](_0x40a6b9,{'transaction':_0x2e79a8})[_0x07bd('0x19')](function(){return BPromise['each'](_0xadb15b,function(_0x16f902){return db[_0x07bd('0x42')][_0x07bd('0x5c')]({'where':{'UserId':_0x16f902['id'],'FaxQueueId':_0xb83fd2[_0x07bd('0x2b')]['id']},'transaction':_0x2e79a8});});})[_0x07bd('0x19')](function(){_0xadb15b['forEach'](function(_0x38f316){socket['emit'](_0x07bd('0x5d'),{'UserId':_0x38f316['id'],'FaxQueueId':_0x2582ec['id']});});});});});}})[_0x07bd('0x19')](respondWithStatusCode(_0x388962,null))['catch'](handleError(_0x388962,null));};exports[_0x07bd('0x5e')]=function(_0x51c697,_0x4a79c6){return db[_0x07bd('0x55')][_0x07bd('0x27')]({'where':{'id':_0x51c697[_0x07bd('0x26')][_0x07bd('0x5f')]},'attributes':['id'],'include':[{'model':db[_0x07bd('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x07bd('0x19')](handleEntityNotFound(_0x4a79c6,null))[_0x07bd('0x19')](function(_0x193c87){var _0x591fc3=_[_0x07bd('0x20')](_0x193c87,'id');var _0x3d9964=[];var _0x5a9ef5=[];var _0x1f892d=squel[_0x07bd('0x60')]();_0x1f892d['field'](_0x07bd('0x61'))[_0x07bd('0x62')](_0x07bd('0x63'),'tq')[_0x07bd('0x64')](_0x07bd('0x65'),'ut',_0x07bd('0x66'))[_0x07bd('0x24')](_0x07bd('0x67'),_0x51c697['params']['id']);for(var _0x780517=0x0;_0x780517<_0x193c87[_0x07bd('0x31')];_0x780517+=0x1){let _0x4e331d=_0x193c87[_0x780517];for(var _0x31a9ac=0x0;_0x31a9ac<_0x4e331d[_0x07bd('0x56')][_0x07bd('0x31')];_0x31a9ac+=0x1){let _0x7d85c2=_0x4e331d['Agents'][_0x31a9ac];var _0x3307dc=_0x1f892d[_0x07bd('0x68')]();_0x3307dc[_0x07bd('0x24')](_0x07bd('0x69'),_0x7d85c2['id']);_0x5a9ef5['push'](db[_0x07bd('0x5a')][_0x07bd('0x26')](_0x3307dc[_0x07bd('0x6a')](),{'type':db[_0x07bd('0x5a')][_0x07bd('0x6b')][_0x07bd('0x6c')]})[_0x07bd('0x19')](function(_0x27fa8b){if(_0x27fa8b[_0x07bd('0x31')]===0x1){return _0x7d85c2['id'];}else{var _0x179e1d=_[_0x07bd('0x6d')](_[_0x07bd('0x20')](_0x27fa8b,_0x07bd('0x6e')),function(_0x3cd40c){return _[_0x07bd('0x6f')](_0x591fc3,_0x3cd40c);});if(_0x179e1d){return _0x7d85c2['id'];}}}));}}return BPromise[_0x07bd('0x70')](_0x5a9ef5)[_0x07bd('0x19')](function(_0xd02a4e){_0x3d9964=_(_0x3d9964)['union'](_0xd02a4e)[_0x07bd('0x71')]()[_0x07bd('0x72')]();return db[_0x07bd('0x21')][_0x07bd('0x33')]({'where':{'id':_0x51c697[_0x07bd('0x2b')]['id']}})[_0x07bd('0x19')](function(_0x13c81f){return db[_0x07bd('0x5a')][_0x07bd('0x5b')](function(_0xdc66d1){return _0x13c81f['removeTeams'](_0x51c697[_0x07bd('0x26')][_0x07bd('0x5f')],{'transaction':_0xdc66d1})[_0x07bd('0x19')](function(){if(!_[_0x07bd('0x73')](_0x3d9964)){return _0x13c81f[_0x07bd('0x74')](_0x3d9964,{'transaction':_0xdc66d1});}})[_0x07bd('0x19')](function(){_0x3d9964[_0x07bd('0x75')](function(_0x3a39df){socket[_0x07bd('0x76')](_0x07bd('0x77'),{'UserId':_0x3a39df,'FaxQueueId':_0x13c81f['id']});});});});});});})[_0x07bd('0x19')](respondWithStatusCode(_0x4a79c6,null))[_0x07bd('0x29')](handleError(_0x4a79c6,null));};exports[_0x07bd('0x78')]=function(_0x2af323,_0x3d1c9b){return db[_0x07bd('0x21')][_0x07bd('0x33')]({'where':{'id':_0x2af323[_0x07bd('0x2b')]['id']}})[_0x07bd('0x19')](handleEntityNotFound(_0x3d1c9b,null))[_0x07bd('0x19')](function(_0x4546da){if(_0x4546da){return _0x4546da[_0x07bd('0x78')](_0x2af323['body'][_0x07bd('0x5f')],_[_0x07bd('0x79')](_0x2af323['body'],[_0x07bd('0x5f'),'id'])||{})['spread'](function(_0x335398){for(var _0x5adf01=0x0;_0x5adf01<_0x2af323[_0x07bd('0x35')][_0x07bd('0x5f')]['length'];_0x5adf01+=0x1){socket[_0x07bd('0x76')](_0x07bd('0x5d'),{'UserId':Number(_0x2af323['body'][_0x07bd('0x5f')][_0x5adf01]),'FaxQueueId':Number(_0x2af323['params']['id'])});}return _0x335398;});}})[_0x07bd('0x19')](respondWithResult(_0x3d1c9b,null))[_0x07bd('0x29')](handleError(_0x3d1c9b,null));};exports[_0x07bd('0x74')]=function(_0x349e55,_0xaac9a4){return db[_0x07bd('0x21')][_0x07bd('0x33')]({'where':{'id':_0x349e55['params']['id']}})['then'](handleEntityNotFound(_0xaac9a4,null))[_0x07bd('0x19')](function(_0x663616){if(_0x663616){return _0x663616[_0x07bd('0x74')](_0x349e55[_0x07bd('0x26')][_0x07bd('0x5f')])[_0x07bd('0x19')](function(){if(_['isArray'](_0x349e55[_0x07bd('0x26')]['ids'])){for(var _0x3af55a=0x0;_0x3af55a<_0x349e55['query'][_0x07bd('0x5f')][_0x07bd('0x31')];_0x3af55a+=0x1){socket[_0x07bd('0x76')](_0x07bd('0x77'),{'UserId':Number(_0x349e55[_0x07bd('0x26')]['ids'][_0x3af55a]),'FaxQueueId':Number(_0x349e55[_0x07bd('0x2b')]['id'])});}}else{socket[_0x07bd('0x76')](_0x07bd('0x77'),{'UserId':Number(_0x349e55[_0x07bd('0x26')][_0x07bd('0x5f')]),'FaxQueueId':Number(_0x349e55[_0x07bd('0x2b')]['id'])});}});}})[_0x07bd('0x19')](respondWithStatusCode(_0xaac9a4,null))[_0x07bd('0x29')](handleError(_0xaac9a4,null));};exports[_0x07bd('0x7a')]=function(_0x59b954,_0x95eeb8){var _0x3ca8ed={};var _0x1d8d26={};var _0x576e89;var _0x234fb4;return db[_0x07bd('0x21')][_0x07bd('0x40')]({'where':{'id':_0x59b954[_0x07bd('0x2b')]['id']}})['then'](handleEntityNotFound(_0x95eeb8,null))[_0x07bd('0x19')](function(_0x337d52){if(_0x337d52){_0x576e89=_0x337d52;_0x1d8d26[_0x07bd('0x2c')]=_[_0x07bd('0x41')](db['User'][_0x07bd('0x22')]);_0x1d8d26[_0x07bd('0x26')]=_[_0x07bd('0x41')](_0x59b954['query']);_0x1d8d26[_0x07bd('0x2d')]=_[_0x07bd('0x2e')](_0x1d8d26[_0x07bd('0x2c')],_0x1d8d26[_0x07bd('0x26')]);_0x3ca8ed['attributes']=_['intersection'](_0x1d8d26[_0x07bd('0x2c')],qs[_0x07bd('0x2f')](_0x59b954[_0x07bd('0x26')][_0x07bd('0x2f')]));_0x3ca8ed[_0x07bd('0x30')]=_0x3ca8ed[_0x07bd('0x30')][_0x07bd('0x31')]?_0x3ca8ed['attributes']:_0x1d8d26['model'];_0x3ca8ed[_0x07bd('0x53')]=qs['sort'](_0x59b954[_0x07bd('0x26')][_0x07bd('0x45')]);_0x3ca8ed['where']=qs[_0x07bd('0x2d')](_[_0x07bd('0x46')](_0x59b954[_0x07bd('0x26')],_0x1d8d26[_0x07bd('0x2d')]));if(_0x59b954['query']['filter']){_0x3ca8ed[_0x07bd('0x24')]=_[_0x07bd('0x32')](_0x3ca8ed[_0x07bd('0x24')],{'$or':_[_0x07bd('0x20')](_0x3ca8ed[_0x07bd('0x30')],function(_0x4505d6){var _0xc0e79f={};_0xc0e79f[_0x4505d6]={'$like':'%'+_0x59b954[_0x07bd('0x26')]['filter']+'%'};return _0xc0e79f;})});}_0x3ca8ed=_[_0x07bd('0x32')]({},_0x3ca8ed,_0x59b954['options']);return _0x576e89[_0x07bd('0x7a')](_0x3ca8ed);}})['then'](function(_0x2c5b0e){if(_0x2c5b0e){_0x234fb4=_0x2c5b0e[_0x07bd('0x31')];if(!_0x59b954[_0x07bd('0x26')]['hasOwnProperty'](_0x07bd('0x44'))){_0x3ca8ed[_0x07bd('0x13')]=qs['limit'](_0x59b954[_0x07bd('0x26')][_0x07bd('0x13')]);_0x3ca8ed[_0x07bd('0x11')]=qs[_0x07bd('0x11')](_0x59b954['query'][_0x07bd('0x11')]);}return _0x576e89[_0x07bd('0x7a')](_0x3ca8ed);}})[_0x07bd('0x19')](function(_0x40b94a){if(_0x40b94a){return _0x40b94a?{'count':_0x234fb4,'rows':_0x40b94a}:null;}})[_0x07bd('0x19')](respondWithResult(_0x95eeb8,null))['catch'](handleError(_0x95eeb8,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 8414180..e39b6ca 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 _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 +var _0xeb31=['remove','emit','hasOwnProperty','hook','exports','events','save'];(function(_0x4065c6,_0x53dd4e){var _0x21b71c=function(_0x15d9db){while(--_0x15d9db){_0x4065c6['push'](_0x4065c6['shift']());}};_0x21b71c(++_0x53dd4e);}(_0xeb31,0xa6));var _0x1eb3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeb31[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x1eb3('0x0'));var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1eb3('0x1'),'afterUpdate':'update','afterDestroy':_0x1eb3('0x2')};function emitEvent(_0x3fc04d){return function(_0x68d17c,_0x44eabc,_0x147462){FaxQueueEvents[_0x1eb3('0x3')](_0x3fc04d+':'+_0x68d17c['id'],_0x68d17c);FaxQueueEvents[_0x1eb3('0x3')](_0x3fc04d,_0x68d17c);_0x147462(null);};}for(var e in events){if(events[_0x1eb3('0x4')](e)){var event=events[e];FaxQueue[_0x1eb3('0x5')](e,emitEvent(event));}}module[_0x1eb3('0x6')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index c665dac..4af7421 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 _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 +var _0x5939=['util','../../config/logger','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','fax_queues','lodash'];(function(_0x1ef4d0,_0x5dfe85){var _0xd3fcea=function(_0x42df34){while(--_0x42df34){_0x1ef4d0['push'](_0x1ef4d0['shift']());}};_0xd3fcea(++_0x5dfe85);}(_0x5939,0x149));var _0x9593=function(_0x44923d,_0x35ecb5){_0x44923d=_0x44923d-0x0;var _0x18cc58=_0x5939[_0x44923d];return _0x18cc58;};'use strict';var _=require(_0x9593('0x0'));var util=require(_0x9593('0x1'));var logger=require(_0x9593('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9593('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9593('0x4'));var rimraf=require(_0x9593('0x5'));var config=require(_0x9593('0x6'));var attributes=require(_0x9593('0x7'));module[_0x9593('0x8')]=function(_0x33b7b6,_0x220f71){return _0x33b7b6[_0x9593('0x9')]('FaxQueue',attributes,{'tableName':_0x9593('0xa'),'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 4898c73..ebc3d72 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 _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 +var _0x9300=['then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','model','map','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','register','request'];(function(_0x117f4c,_0x36a9b1){var _0x2b24e9=function(_0x31761b){while(--_0x31761b){_0x117f4c['push'](_0x117f4c['shift']());}};_0x2b24e9(++_0x36a9b1);}(_0x9300,0xe5));var _0x0930=function(_0x244e2d,_0x302d40){_0x244e2d=_0x244e2d-0x0;var _0x3df084=_0x9300[_0x244e2d];return _0x3df084;};'use strict';var _=require(_0x0930('0x0'));var util=require(_0x0930('0x1'));var moment=require(_0x0930('0x2'));var BPromise=require(_0x0930('0x3'));var rs=require(_0x0930('0x4'));var fs=require('fs');var Redis=require(_0x0930('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0930('0x6'));var logger=require(_0x0930('0x7'))(_0x0930('0x8'));var config=require('../../config/environment');var jayson=require(_0x0930('0x9'));var client=jayson[_0x0930('0xa')][_0x0930('0xb')]({'port':0x232a});config[_0x0930('0xc')]=_[_0x0930('0xd')](config['redis'],{'host':_0x0930('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0930('0xc')]));require('./faxQueue.socket')[_0x0930('0xf')](socket);function respondWithRpcPromise(_0x160a94,_0x2fac12,_0x1be0c9){return new BPromise(function(_0x5a1a1e,_0x291260){return client[_0x0930('0x10')](_0x160a94,_0x1be0c9)[_0x0930('0x11')](function(_0x332aa8){logger[_0x0930('0x12')](_0x0930('0x13'),_0x2fac12,_0x0930('0x14'));logger[_0x0930('0x15')](_0x0930('0x16'),_0x2fac12,_0x0930('0x14'),JSON[_0x0930('0x17')](_0x332aa8));if(_0x332aa8[_0x0930('0x18')]){if(_0x332aa8[_0x0930('0x18')]['code']===0x1f4){logger[_0x0930('0x18')](_0x0930('0x13'),_0x2fac12,_0x332aa8[_0x0930('0x18')][_0x0930('0x19')]);return _0x291260(_0x332aa8[_0x0930('0x18')]['message']);}logger[_0x0930('0x18')](_0x0930('0x13'),_0x2fac12,_0x332aa8[_0x0930('0x18')][_0x0930('0x19')]);return _0x5a1a1e(_0x332aa8['error'][_0x0930('0x19')]);}else{logger[_0x0930('0x12')](_0x0930('0x13'),_0x2fac12,_0x0930('0x14'));_0x5a1a1e(_0x332aa8[_0x0930('0x1a')][_0x0930('0x19')]);}})[_0x0930('0x1b')](function(_0x256986){logger[_0x0930('0x18')]('FaxQueue,\x20%s,\x20%s',_0x2fac12,_0x256986);_0x291260(_0x256986);});});}exports[_0x0930('0x1c')]=function(_0x19a687){var _0x488af4=this;return new Promise(function(_0x4dd5f4,_0xc33dd4){return db[_0x0930('0x1d')][_0x0930('0x1e')]({'raw':_0x19a687[_0x0930('0x1f')]?_0x19a687[_0x0930('0x1f')][_0x0930('0x20')]===undefined?!![]:![]:!![],'where':_0x19a687[_0x0930('0x1f')]?_0x19a687[_0x0930('0x1f')][_0x0930('0x21')]||null:null,'attributes':_0x19a687['options']?_0x19a687[_0x0930('0x1f')][_0x0930('0x22')]||null:null,'limit':_0x19a687[_0x0930('0x1f')]?_0x19a687['options'][_0x0930('0x23')]||null:null,'include':_0x19a687[_0x0930('0x1f')]?_0x19a687['options']['include']?_['map'](_0x19a687[_0x0930('0x1f')][_0x0930('0x24')],function(_0x1efab4){return{'model':db[_0x1efab4[_0x0930('0x25')]],'as':_0x1efab4['as'],'attributes':_0x1efab4[_0x0930('0x22')],'include':_0x1efab4[_0x0930('0x24')]?_[_0x0930('0x26')](_0x1efab4[_0x0930('0x24')],function(_0x39c2fb){return{'model':db[_0x39c2fb[_0x0930('0x25')]],'as':_0x39c2fb['as'],'attributes':_0x39c2fb[_0x0930('0x22')],'include':_0x39c2fb[_0x0930('0x24')]?_[_0x0930('0x26')](_0x39c2fb[_0x0930('0x24')],function(_0xe34ae4){return{'model':db[_0xe34ae4[_0x0930('0x25')]],'as':_0xe34ae4['as'],'attributes':_0xe34ae4[_0x0930('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0930('0x11')](function(_0x35852e){logger[_0x0930('0x12')](_0x0930('0x1c'),_0x19a687);logger['debug'](_0x0930('0x1c'),_0x19a687,JSON[_0x0930('0x17')](_0x35852e));_0x4dd5f4(_0x35852e);})[_0x0930('0x1b')](function(_0xbb4954){logger[_0x0930('0x18')]('GetFaxQueue',_0xbb4954[_0x0930('0x19')],_0x19a687);_0xc33dd4(_0x488af4[_0x0930('0x18')](0x1f4,_0xbb4954[_0x0930('0x19')]));});});};exports[_0x0930('0x27')]=function(_0xe0e115){var _0x54524b=this;return new Promise(function(_0x5f11e6,_0x310270){return db[_0x0930('0x1d')][_0x0930('0x28')]({'raw':_0xe0e115[_0x0930('0x1f')]?_0xe0e115[_0x0930('0x1f')][_0x0930('0x20')]===undefined?!![]:![]:!![],'where':_0xe0e115[_0x0930('0x1f')]?_0xe0e115['options']['where']||null:null,'attributes':_0xe0e115[_0x0930('0x1f')]?_0xe0e115[_0x0930('0x1f')][_0x0930('0x22')]||null:null,'include':_0xe0e115[_0x0930('0x1f')]?_0xe0e115['options']['include']?_['map'](_0xe0e115['options'][_0x0930('0x24')],function(_0x54e1bf){return{'model':db[_0x54e1bf['model']],'as':_0x54e1bf['as'],'attributes':_0x54e1bf[_0x0930('0x22')],'include':_0x54e1bf[_0x0930('0x24')]?_[_0x0930('0x26')](_0x54e1bf[_0x0930('0x24')],function(_0xe17596){return{'model':db[_0xe17596['model']],'as':_0xe17596['as'],'attributes':_0xe17596[_0x0930('0x22')],'include':_0xe17596[_0x0930('0x24')]?_[_0x0930('0x26')](_0xe17596[_0x0930('0x24')],function(_0x563b61){return{'model':db[_0x563b61[_0x0930('0x25')]],'as':_0x563b61['as'],'attributes':_0x563b61[_0x0930('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0930('0x11')](function(_0x22fa26){logger[_0x0930('0x12')]('ShowFaxQueue',_0xe0e115);logger[_0x0930('0x15')](_0x0930('0x27'),_0xe0e115,JSON[_0x0930('0x17')](_0x22fa26));_0x5f11e6(_0x22fa26);})[_0x0930('0x1b')](function(_0x3dbb3c){logger[_0x0930('0x18')](_0x0930('0x27'),_0x3dbb3c[_0x0930('0x19')],_0xe0e115);_0x310270(_0x54524b[_0x0930('0x18')](0x1f4,_0x3dbb3c['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 1c4c1e1..d28d6d4 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 _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 +var _0x6386=['removeListener','register','length','faxQueue:','./faxQueue.events','save','remove','update','emit'];(function(_0x17bb31,_0x2fc6f8){var _0x505c71=function(_0x5013cf){while(--_0x5013cf){_0x17bb31['push'](_0x17bb31['shift']());}};_0x505c71(++_0x2fc6f8);}(_0x6386,0x1cf));var _0x6638=function(_0x3fad86,_0x425d92){_0x3fad86=_0x3fad86-0x0;var _0x51cdf3=_0x6386[_0x3fad86];return _0x51cdf3;};'use strict';var FaxQueueEvents=require(_0x6638('0x0'));var events=[_0x6638('0x1'),_0x6638('0x2'),_0x6638('0x3')];function createListener(_0x1146f1,_0x22b8d7){return function(_0x28331f){_0x22b8d7[_0x6638('0x4')](_0x1146f1,_0x28331f);};}function removeListener(_0x1bef1a,_0x1e0ea6){return function(){FaxQueueEvents[_0x6638('0x5')](_0x1bef1a,_0x1e0ea6);};}exports[_0x6638('0x6')]=function(_0x45de5a){for(var _0x3b6cba=0x0,_0x7668db=events[_0x6638('0x7')];_0x3b6cba<_0x7668db;_0x3b6cba++){var _0xfb8f3f=events[_0x3b6cba];var _0x41a09f=createListener(_0x6638('0x8')+_0xfb8f3f,_0x45de5a);FaxQueueEvents['on'](_0xfb8f3f,_0x41a09f);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 2e258e0..47b4f47 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 _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 +var _0xa9fc=['create','addTeams','addAgents','update','destroy','removeTeams','delete','/:id/users','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','index','/describe','isAuthenticated','describe','get','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xa9fc,0x19f));var _0xca9f=function(_0x36c6eb,_0x4fb127){_0x36c6eb=_0x36c6eb-0x0;var _0x30675b=_0xa9fc[_0x36c6eb];return _0x30675b;};'use strict';var multer=require(_0xca9f('0x0'));var util=require(_0xca9f('0x1'));var path=require(_0xca9f('0x2'));var timeout=require(_0xca9f('0x3'));var express=require(_0xca9f('0x4'));var router=express['Router']();var fs_extra=require(_0xca9f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xca9f('0x6'));var config=require(_0xca9f('0x7'));var controller=require('./faxQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xca9f('0x8')]);router['get'](_0xca9f('0x9'),auth[_0xca9f('0xa')](),controller[_0xca9f('0xb')]);router[_0xca9f('0xc')](_0xca9f('0xd'),auth[_0xca9f('0xa')](),controller[_0xca9f('0xe')]);router[_0xca9f('0xc')]('/:id/members',auth[_0xca9f('0xa')](),controller[_0xca9f('0xf')]);router[_0xca9f('0xc')](_0xca9f('0x10'),auth['isAuthenticated'](),controller[_0xca9f('0x11')]);router[_0xca9f('0xc')]('/:id/users',auth[_0xca9f('0xa')](),controller[_0xca9f('0x12')]);router[_0xca9f('0x13')]('/',auth[_0xca9f('0xa')](),controller[_0xca9f('0x14')]);router[_0xca9f('0x13')](_0xca9f('0x10'),auth[_0xca9f('0xa')](),controller[_0xca9f('0x15')]);router[_0xca9f('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0xca9f('0x16')]);router['put']('/:id',auth[_0xca9f('0xa')](),controller[_0xca9f('0x17')]);router['delete'](_0xca9f('0xd'),auth['isAuthenticated'](),controller[_0xca9f('0x18')]);router['delete'](_0xca9f('0x10'),auth[_0xca9f('0xa')](),controller[_0xca9f('0x19')]);router[_0xca9f('0x1a')](_0xca9f('0x1b'),auth['isAuthenticated'](),controller[_0xca9f('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 97df994..2f5a75b 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 _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 +var _0xc03a=['exports','STRING','DATE','moment','sequelize'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xc03a,0x1e3));var _0xac03=function(_0x4579e0,_0x5d02ac){_0x4579e0=_0x4579e0-0x0;var _0x14f17e=_0xc03a[_0x4579e0];return _0x14f17e;};'use strict';var moment=require(_0xac03('0x0'));var Sequelize=require(_0xac03('0x1'));module[_0xac03('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xac03('0x3')]},'joinAt':{'type':Sequelize[_0xac03('0x4')]},'leaveAt':{'type':Sequelize[_0xac03('0x4')]},'acceptAt':{'type':Sequelize[_0xac03('0x4')]},'exitAt':{'type':Sequelize[_0xac03('0x4')]},'reason':{'type':Sequelize[_0xac03('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 890fb0c..3444b43 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 _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 +var _0x81d5=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','name','map','FaxQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','create','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x81d5,0x1ab));var _0x581d=function(_0x10ed50,_0x11533b){_0x10ed50=_0x10ed50-0x0;var _0x4017ee=_0x81d5[_0x10ed50];return _0x4017ee;};'use strict';var emlformat=require(_0x581d('0x0'));var rimraf=require(_0x581d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x581d('0x2'));var rp=require(_0x581d('0x3'));var moment=require(_0x581d('0x4'));var BPromise=require(_0x581d('0x5'));var Mustache=require(_0x581d('0x6'));var util=require('util');var path=require('path');var sox=require(_0x581d('0x7'));var csv=require(_0x581d('0x8'));var ejs=require(_0x581d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x581d('0xa'));var squel=require(_0x581d('0xb'));var crypto=require(_0x581d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x581d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x581d('0xe'));var authService=require(_0x581d('0xf'));var qs=require(_0x581d('0x10'));var as=require(_0x581d('0x11'));var hardwareService=require(_0x581d('0x12'));var logger=require('../../config/logger')(_0x581d('0x13'));var utils=require(_0x581d('0x14'));var config=require(_0x581d('0x15'));var licenseUtil=require(_0x581d('0x16'));var db=require(_0x581d('0x17'))['db'];function respondWithStatusCode(_0x271bd1,_0x1fb6ed){_0x1fb6ed=_0x1fb6ed||0xcc;return function(_0x3329cc){if(_0x3329cc){return _0x271bd1[_0x581d('0x18')](_0x1fb6ed);}return _0x271bd1[_0x581d('0x19')](_0x1fb6ed)['end']();};}function respondWithResult(_0x338c88,_0xfab29f){_0xfab29f=_0xfab29f||0xc8;return function(_0x51a035){if(_0x51a035){return _0x338c88['status'](_0xfab29f)['json'](_0x51a035);}};}function respondWithFilteredResult(_0x4deffa,_0x110e13){return function(_0x550365){if(_0x550365){var _0x1d609f=typeof _0x110e13[_0x581d('0x1a')]==='undefined'&&typeof _0x110e13[_0x581d('0x1b')]==='undefined';var _0x3172f6=_0x550365[_0x581d('0x1c')];var _0x1e059d=_0x1d609f?0x0:_0x110e13[_0x581d('0x1a')];var _0x1f790f=_0x1d609f?_0x550365[_0x581d('0x1c')]:_0x110e13[_0x581d('0x1a')]+_0x110e13['limit'];var _0x2be45b;if(_0x1f790f>=_0x3172f6){_0x1f790f=_0x3172f6;_0x2be45b=0xc8;}else{_0x2be45b=0xce;}_0x4deffa[_0x581d('0x19')](_0x2be45b);return _0x4deffa[_0x581d('0x1d')](_0x581d('0x1e'),_0x1e059d+'-'+_0x1f790f+'/'+_0x3172f6)[_0x581d('0x1f')](_0x550365);}return null;};}function patchUpdates(_0x2a2aba){return function(_0x4635a8){try{jsonpatch[_0x581d('0x20')](_0x4635a8,_0x2a2aba,!![]);}catch(_0x468543){return BPromise[_0x581d('0x21')](_0x468543);}return _0x4635a8[_0x581d('0x22')]();};}function saveUpdates(_0xf74d2b,_0x5add13){return function(_0xb96c3d){if(_0xb96c3d){return _0xb96c3d[_0x581d('0x23')](_0xf74d2b)[_0x581d('0x24')](function(_0x2a4cd9){return _0x2a4cd9;});}return null;};}function removeEntity(_0x2addd8,_0x4f7420){return function(_0x36cc8a){if(_0x36cc8a){return _0x36cc8a[_0x581d('0x25')]()['then'](function(){_0x2addd8[_0x581d('0x19')](0xcc)[_0x581d('0x26')]();});}};}function handleEntityNotFound(_0x2c8fdb,_0x5a3fd7){return function(_0x190545){if(!_0x190545){_0x2c8fdb[_0x581d('0x18')](0x194);}return _0x190545;};}function handleError(_0x146323,_0xc270bc){_0xc270bc=_0xc270bc||0x1f4;return function(_0x38f213){logger[_0x581d('0x27')](_0x38f213['stack']);if(_0x38f213[_0x581d('0x28')]){delete _0x38f213[_0x581d('0x28')];}_0x146323[_0x581d('0x19')](_0xc270bc)['send'](_0x38f213);};}exports['index']=function(_0x504f71,_0x489682){var _0x355efe={},_0x266a2b={},_0x337361={'count':0x0,'rows':[]};var _0x408cce=_[_0x581d('0x29')](db[_0x581d('0x2a')][_0x581d('0x2b')],function(_0x298953){return{'name':_0x298953[_0x581d('0x2c')],'type':_0x298953[_0x581d('0x2d')][_0x581d('0x2e')]};});_0x266a2b['model']=_[_0x581d('0x29')](_0x408cce,'name');_0x266a2b[_0x581d('0x2f')]=_[_0x581d('0x30')](_0x504f71[_0x581d('0x2f')]);_0x266a2b[_0x581d('0x31')]=_[_0x581d('0x32')](_0x266a2b[_0x581d('0x33')],_0x266a2b['query']);_0x355efe[_0x581d('0x34')]=_[_0x581d('0x32')](_0x266a2b['model'],qs['fields'](_0x504f71['query'][_0x581d('0x35')]));_0x355efe[_0x581d('0x34')]=_0x355efe[_0x581d('0x34')][_0x581d('0x36')]?_0x355efe[_0x581d('0x34')]:_0x266a2b[_0x581d('0x33')];if(!_0x504f71[_0x581d('0x2f')]['hasOwnProperty'](_0x581d('0x37'))){_0x355efe[_0x581d('0x1b')]=qs['limit'](_0x504f71[_0x581d('0x2f')][_0x581d('0x1b')]);_0x355efe[_0x581d('0x1a')]=qs[_0x581d('0x1a')](_0x504f71[_0x581d('0x2f')]['offset']);}_0x355efe[_0x581d('0x38')]=qs['sort'](_0x504f71[_0x581d('0x2f')][_0x581d('0x39')]);_0x355efe['where']=qs['filters'](_['pick'](_0x504f71['query'],_0x266a2b[_0x581d('0x31')]),_0x408cce);if(_0x504f71['query'][_0x581d('0x3a')]){_0x355efe['where']=_[_0x581d('0x3b')](_0x355efe[_0x581d('0x3c')],{'$or':_[_0x581d('0x29')](_0x408cce,function(_0x393b2e){if(_0x393b2e[_0x581d('0x2d')]!==_0x581d('0x3d')){var _0x28f091={};_0x28f091[_0x393b2e[_0x581d('0x28')]]={'$like':'%'+_0x504f71[_0x581d('0x2f')][_0x581d('0x3a')]+'%'};return _0x28f091;}})});}_0x355efe=_['merge']({},_0x355efe,_0x504f71['options']);var _0x47668c={'where':_0x355efe[_0x581d('0x3c')]};return db[_0x581d('0x2a')]['count'](_0x47668c)[_0x581d('0x24')](function(_0x1b6aee){_0x337361[_0x581d('0x1c')]=_0x1b6aee;if(_0x504f71['query'][_0x581d('0x3e')]){_0x355efe[_0x581d('0x3f')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x581d('0x40')](_0x355efe);})[_0x581d('0x24')](function(_0x211c64){_0x337361[_0x581d('0x41')]=_0x211c64;return _0x337361;})[_0x581d('0x24')](respondWithFilteredResult(_0x489682,_0x355efe))[_0x581d('0x42')](handleError(_0x489682,null));};exports[_0x581d('0x43')]=function(_0x5550b4,_0x3cadb3){var _0x283743={'raw':!![],'where':{'id':_0x5550b4['params']['id']}},_0x20fbf1={};_0x20fbf1[_0x581d('0x33')]=_[_0x581d('0x30')](db['FaxQueueReport']['rawAttributes']);_0x20fbf1[_0x581d('0x2f')]=_[_0x581d('0x30')](_0x5550b4[_0x581d('0x2f')]);_0x20fbf1['filters']=_[_0x581d('0x32')](_0x20fbf1[_0x581d('0x33')],_0x20fbf1['query']);_0x283743[_0x581d('0x34')]=_['intersection'](_0x20fbf1[_0x581d('0x33')],qs['fields'](_0x5550b4[_0x581d('0x2f')]['fields']));_0x283743['attributes']=_0x283743[_0x581d('0x34')]['length']?_0x283743['attributes']:_0x20fbf1['model'];if(_0x5550b4[_0x581d('0x2f')][_0x581d('0x3e')]){_0x283743[_0x581d('0x3f')]=[{'all':!![]}];}_0x283743=_['merge']({},_0x283743,_0x5550b4[_0x581d('0x44')]);return db[_0x581d('0x2a')]['find'](_0x283743)['then'](handleEntityNotFound(_0x3cadb3,null))[_0x581d('0x24')](respondWithResult(_0x3cadb3,null))['catch'](handleError(_0x3cadb3,null));};exports[_0x581d('0x45')]=function(_0x5a5c30,_0x32eed9){return db[_0x581d('0x2a')]['create'](_0x5a5c30[_0x581d('0x46')],{})[_0x581d('0x24')](respondWithResult(_0x32eed9,0xc9))[_0x581d('0x42')](handleError(_0x32eed9,null));};exports[_0x581d('0x23')]=function(_0x3b8b5e,_0x4dca9e){if(_0x3b8b5e[_0x581d('0x46')]['id']){delete _0x3b8b5e[_0x581d('0x46')]['id'];}return db[_0x581d('0x2a')][_0x581d('0x47')]({'where':{'id':_0x3b8b5e[_0x581d('0x48')]['id']}})[_0x581d('0x24')](handleEntityNotFound(_0x4dca9e,null))[_0x581d('0x24')](saveUpdates(_0x3b8b5e['body'],null))[_0x581d('0x24')](respondWithResult(_0x4dca9e,null))[_0x581d('0x42')](handleError(_0x4dca9e,null));};exports[_0x581d('0x25')]=function(_0x3e95c6,_0xba6b00){return db[_0x581d('0x2a')][_0x581d('0x47')]({'where':{'id':_0x3e95c6['params']['id']}})[_0x581d('0x24')](handleEntityNotFound(_0xba6b00,null))[_0x581d('0x24')](removeEntity(_0xba6b00,null))['catch'](handleError(_0xba6b00,null));};exports[_0x581d('0x49')]=function(_0x508d4c,_0x29f36e){return db[_0x581d('0x2a')][_0x581d('0x49')]()[_0x581d('0x24')](respondWithResult(_0x29f36e,null))['catch'](handleError(_0x29f36e,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 5c87c6a..a671588 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 _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 +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','util'];(function(_0xaf29da,_0x117f5a){var _0x295c51=function(_0x3feaf4){while(--_0x3feaf4){_0xaf29da['push'](_0xaf29da['shift']());}};_0x295c51(++_0x117f5a);}(_0x814b,0x1a2));var _0xb814=function(_0x4f4d19,_0x574245){_0x4f4d19=_0x4f4d19-0x0;var _0x27a258=_0x814b[_0x4f4d19];return _0x27a258;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 623eba0..cd9486f 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 _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 +var _0xc584=['debug','catch','UpdateFaxQueueReport','where','limit','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw'];(function(_0xc8552d,_0x171ccd){var _0xad7dcf=function(_0xf2fd61){while(--_0xf2fd61){_0xc8552d['push'](_0xc8552d['shift']());}};_0xad7dcf(++_0x171ccd);}(_0xc584,0x1a5));var _0x4c58=function(_0x202c61,_0x3673e0){_0x202c61=_0x202c61-0x0;var _0x540691=_0xc584[_0x202c61];return _0x540691;};'use strict';var _=require(_0x4c58('0x0'));var util=require(_0x4c58('0x1'));var moment=require(_0x4c58('0x2'));var BPromise=require(_0x4c58('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c58('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4c58('0x5'));var logger=require('../../config/logger')(_0x4c58('0x6'));var config=require(_0x4c58('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4c58('0x8')][_0x4c58('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e66c4,_0x5aa392,_0x2e2a1c){return new BPromise(function(_0xc10f1,_0x4326e6){return client[_0x4c58('0xa')](_0x4e66c4,_0x2e2a1c)[_0x4c58('0xb')](function(_0xd067b5){logger[_0x4c58('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x5aa392,'request\x20sent');logger['debug'](_0x4c58('0xd'),_0x5aa392,_0x4c58('0xe'),JSON[_0x4c58('0xf')](_0xd067b5));if(_0xd067b5[_0x4c58('0x10')]){if(_0xd067b5[_0x4c58('0x10')][_0x4c58('0x11')]===0x1f4){logger['error'](_0x4c58('0x12'),_0x5aa392,_0xd067b5[_0x4c58('0x10')][_0x4c58('0x13')]);return _0x4326e6(_0xd067b5[_0x4c58('0x10')][_0x4c58('0x13')]);}logger['error'](_0x4c58('0x12'),_0x5aa392,_0xd067b5[_0x4c58('0x10')][_0x4c58('0x13')]);return _0xc10f1(_0xd067b5['error']['message']);}else{logger[_0x4c58('0xc')](_0x4c58('0x12'),_0x5aa392,'request\x20sent');_0xc10f1(_0xd067b5[_0x4c58('0x14')]['message']);}})['catch'](function(_0x19b4db){logger['error'](_0x4c58('0x12'),_0x5aa392,_0x19b4db);_0x4326e6(_0x19b4db);});});}exports[_0x4c58('0x15')]=function(_0x5bf902){var _0x4f1c93=this;return new Promise(function(_0x5e3c56,_0x2f7f23){return db[_0x4c58('0x16')][_0x4c58('0x17')](_0x5bf902[_0x4c58('0x18')],{'raw':_0x5bf902['options']?_0x5bf902[_0x4c58('0x19')][_0x4c58('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x6bbd82){logger[_0x4c58('0xc')](_0x4c58('0x15'),_0x5bf902);logger[_0x4c58('0x1b')]('CreateFaxQueueReport',_0x5bf902,JSON[_0x4c58('0xf')](_0x6bbd82));_0x5e3c56(_0x6bbd82);})[_0x4c58('0x1c')](function(_0x3a1006){logger['error'](_0x4c58('0x15'),_0x3a1006['message'],_0x5bf902);_0x2f7f23(_0x4f1c93[_0x4c58('0x10')](0x1f4,_0x3a1006[_0x4c58('0x13')]));});});};exports[_0x4c58('0x1d')]=function(_0x5551c8){var _0x453c75=this;return new Promise(function(_0x2d8815,_0x1740cf){return db[_0x4c58('0x16')]['update'](_0x5551c8[_0x4c58('0x18')],{'raw':_0x5551c8[_0x4c58('0x19')]?_0x5551c8[_0x4c58('0x19')][_0x4c58('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5551c8['options']?_0x5551c8[_0x4c58('0x19')][_0x4c58('0x1e')]||null:null,'attributes':_0x5551c8[_0x4c58('0x19')]?_0x5551c8['options']['attributes']||null:null,'limit':_0x5551c8[_0x4c58('0x19')]?_0x5551c8[_0x4c58('0x19')][_0x4c58('0x1f')]||null:null})['then'](function(_0x4db6ab){logger['info'](_0x4c58('0x1d'),_0x5551c8);logger['debug']('UpdateFaxQueueReport',_0x5551c8,JSON['stringify'](_0x4db6ab));_0x2d8815(_0x4db6ab);})[_0x4c58('0x1c')](function(_0x39a132){logger[_0x4c58('0x10')](_0x4c58('0x1d'),_0x39a132[_0x4c58('0x13')],_0x5551c8);_0x1740cf(_0x453c75[_0x4c58('0x10')](0x1f4,_0x39a132[_0x4c58('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 4740770..9d50f4c 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 _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 +var _0x9f91=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x5c7b29,_0x5ac661){var _0x34ab1b=function(_0x38452e){while(--_0x38452e){_0x5c7b29['push'](_0x5c7b29['shift']());}};_0x34ab1b(++_0x5ac661);}(_0x9f91,0x13a));var _0x19f9=function(_0x30182f,_0x30ce41){_0x30182f=_0x30182f-0x0;var _0x5207db=_0x9f91[_0x30182f];return _0x5207db;};'use strict';var multer=require(_0x19f9('0x0'));var util=require('util');var path=require(_0x19f9('0x1'));var timeout=require(_0x19f9('0x2'));var express=require(_0x19f9('0x3'));var router=express[_0x19f9('0x4')]();var fs_extra=require(_0x19f9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x19f9('0x6'));var config=require(_0x19f9('0x7'));var controller=require(_0x19f9('0x8'));router[_0x19f9('0x9')]('/',auth[_0x19f9('0xa')](),controller[_0x19f9('0xb')]);router['get'](_0x19f9('0xc'),auth['isAuthenticated'](),controller[_0x19f9('0xd')]);router[_0x19f9('0x9')](_0x19f9('0xe'),auth[_0x19f9('0xa')](),controller[_0x19f9('0xf')]);router['post']('/',auth[_0x19f9('0xa')](),controller[_0x19f9('0x10')]);router[_0x19f9('0x11')](_0x19f9('0xe'),auth['isAuthenticated'](),controller[_0x19f9('0x12')]);router[_0x19f9('0x13')](_0x19f9('0xe'),auth[_0x19f9('0xa')](),controller[_0x19f9('0x14')]);module[_0x19f9('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 7d33b16..15a0d4b 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 _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 +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x2f3067,_0x3bd93d){var _0x63e41e=function(_0x474bba){while(--_0x474bba){_0x2f3067['push'](_0x2f3067['shift']());}};_0x63e41e(++_0x3bd93d);}(_0x008c,0x188));var _0xc008=function(_0x306626,_0x425e93){_0x306626=_0x306626-0x0;var _0x466728=_0x008c[_0x306626];return _0x466728;};'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/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 0a2af25..e1a3881 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 _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 +var _0x1ab7=['to-csv','ejs','fs-extra','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','limit','count','set','reject','save','update','then','destroy','stack','name','send','index','FaxTransferReport','rawAttributes','key','model','map','query','keys','filters','attributes','fields','length','nolimit','sort','pick','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','show','intersection','find','body','describe','rimraf','fast-json-patch','request-promise','moment','mustache','path'];(function(_0x5450d0,_0x325280){var _0x71cbb5=function(_0x2907f4){while(--_0x2907f4){_0x5450d0['push'](_0x5450d0['shift']());}};_0x71cbb5(++_0x325280);}(_0x1ab7,0x106));var _0x71ab=function(_0xe25ee9,_0x1f6d98){_0xe25ee9=_0xe25ee9-0x0;var _0x56c669=_0x1ab7[_0xe25ee9];return _0x56c669;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x71ab('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x71ab('0x1'));var rp=require(_0x71ab('0x2'));var moment=require(_0x71ab('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x71ab('0x4'));var util=require('util');var path=require(_0x71ab('0x5'));var sox=require('sox');var csv=require(_0x71ab('0x6'));var ejs=require(_0x71ab('0x7'));var fs=require('fs');var fs_extra=require(_0x71ab('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x71ab('0x9'));var deskjs=require(_0x71ab('0xa'));var toCsv=require(_0x71ab('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x71ab('0xb'));var authService=require(_0x71ab('0xc'));var qs=require(_0x71ab('0xd'));var as=require(_0x71ab('0xe'));var hardwareService=require(_0x71ab('0xf'));var logger=require(_0x71ab('0x10'))(_0x71ab('0x11'));var utils=require('../../config/utils');var config=require(_0x71ab('0x12'));var licenseUtil=require(_0x71ab('0x13'));var db=require(_0x71ab('0x14'))['db'];function respondWithStatusCode(_0x3eccae,_0x18d731){_0x18d731=_0x18d731||0xcc;return function(_0x52ddda){if(_0x52ddda){return _0x3eccae[_0x71ab('0x15')](_0x18d731);}return _0x3eccae[_0x71ab('0x16')](_0x18d731)['end']();};}function respondWithResult(_0x3b7241,_0x59961a){_0x59961a=_0x59961a||0xc8;return function(_0x3fcf8d){if(_0x3fcf8d){return _0x3b7241['status'](_0x59961a)[_0x71ab('0x17')](_0x3fcf8d);}};}function respondWithFilteredResult(_0x194f75,_0x21f881){return function(_0x2a97d8){if(_0x2a97d8){var _0x482731=typeof _0x21f881[_0x71ab('0x18')]===_0x71ab('0x19')&&typeof _0x21f881[_0x71ab('0x1a')]==='undefined';var _0x44f519=_0x2a97d8[_0x71ab('0x1b')];var _0x17e243=_0x482731?0x0:_0x21f881[_0x71ab('0x18')];var _0x44848f=_0x482731?_0x2a97d8[_0x71ab('0x1b')]:_0x21f881['offset']+_0x21f881['limit'];var _0x21b960;if(_0x44848f>=_0x44f519){_0x44848f=_0x44f519;_0x21b960=0xc8;}else{_0x21b960=0xce;}_0x194f75[_0x71ab('0x16')](_0x21b960);return _0x194f75[_0x71ab('0x1c')]('Content-Range',_0x17e243+'-'+_0x44848f+'/'+_0x44f519)[_0x71ab('0x17')](_0x2a97d8);}return null;};}function patchUpdates(_0x483868){return function(_0x56ec6b){try{jsonpatch['apply'](_0x56ec6b,_0x483868,!![]);}catch(_0x546390){return BPromise[_0x71ab('0x1d')](_0x546390);}return _0x56ec6b[_0x71ab('0x1e')]();};}function saveUpdates(_0x53c887,_0x34559e){return function(_0x24fa9e){if(_0x24fa9e){return _0x24fa9e[_0x71ab('0x1f')](_0x53c887)[_0x71ab('0x20')](function(_0x4e1269){return _0x4e1269;});}return null;};}function removeEntity(_0x3703a5,_0x54c26e){return function(_0x275901){if(_0x275901){return _0x275901[_0x71ab('0x21')]()['then'](function(){_0x3703a5[_0x71ab('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x495682,_0x5a7954){return function(_0x493ea1){if(!_0x493ea1){_0x495682[_0x71ab('0x15')](0x194);}return _0x493ea1;};}function handleError(_0x33b0b1,_0x136fb3){_0x136fb3=_0x136fb3||0x1f4;return function(_0x111011){logger['error'](_0x111011[_0x71ab('0x22')]);if(_0x111011[_0x71ab('0x23')]){delete _0x111011[_0x71ab('0x23')];}_0x33b0b1[_0x71ab('0x16')](_0x136fb3)[_0x71ab('0x24')](_0x111011);};}exports[_0x71ab('0x25')]=function(_0x4ad0aa,_0x553b88){var _0x149155={},_0xf7527f={},_0x4b2cf0={'count':0x0,'rows':[]};var _0x14678a=_['map'](db[_0x71ab('0x26')][_0x71ab('0x27')],function(_0x2dcbd6){return{'name':_0x2dcbd6['fieldName'],'type':_0x2dcbd6['type'][_0x71ab('0x28')]};});_0xf7527f[_0x71ab('0x29')]=_[_0x71ab('0x2a')](_0x14678a,'name');_0xf7527f[_0x71ab('0x2b')]=_[_0x71ab('0x2c')](_0x4ad0aa['query']);_0xf7527f[_0x71ab('0x2d')]=_['intersection'](_0xf7527f[_0x71ab('0x29')],_0xf7527f[_0x71ab('0x2b')]);_0x149155[_0x71ab('0x2e')]=_['intersection'](_0xf7527f[_0x71ab('0x29')],qs[_0x71ab('0x2f')](_0x4ad0aa[_0x71ab('0x2b')][_0x71ab('0x2f')]));_0x149155[_0x71ab('0x2e')]=_0x149155['attributes'][_0x71ab('0x30')]?_0x149155[_0x71ab('0x2e')]:_0xf7527f[_0x71ab('0x29')];if(!_0x4ad0aa[_0x71ab('0x2b')]['hasOwnProperty'](_0x71ab('0x31'))){_0x149155[_0x71ab('0x1a')]=qs['limit'](_0x4ad0aa[_0x71ab('0x2b')]['limit']);_0x149155[_0x71ab('0x18')]=qs[_0x71ab('0x18')](_0x4ad0aa[_0x71ab('0x2b')][_0x71ab('0x18')]);}_0x149155['order']=qs[_0x71ab('0x32')](_0x4ad0aa['query'][_0x71ab('0x32')]);_0x149155['where']=qs[_0x71ab('0x2d')](_[_0x71ab('0x33')](_0x4ad0aa['query'],_0xf7527f['filters']),_0x14678a);if(_0x4ad0aa[_0x71ab('0x2b')]['filter']){_0x149155[_0x71ab('0x34')]=_['merge'](_0x149155['where'],{'$or':_[_0x71ab('0x2a')](_0x14678a,function(_0x261fab){if(_0x261fab[_0x71ab('0x35')]!==_0x71ab('0x36')){var _0x418bf5={};_0x418bf5[_0x261fab[_0x71ab('0x23')]]={'$like':'%'+_0x4ad0aa['query'][_0x71ab('0x37')]+'%'};return _0x418bf5;}})});}_0x149155=_[_0x71ab('0x38')]({},_0x149155,_0x4ad0aa[_0x71ab('0x39')]);var _0x1ad8c5={'where':_0x149155[_0x71ab('0x34')]};return db[_0x71ab('0x26')][_0x71ab('0x1b')](_0x1ad8c5)[_0x71ab('0x20')](function(_0x8db3df){_0x4b2cf0['count']=_0x8db3df;if(_0x4ad0aa['query'][_0x71ab('0x3a')]){_0x149155[_0x71ab('0x3b')]=[{'all':!![]}];}return db[_0x71ab('0x26')][_0x71ab('0x3c')](_0x149155);})['then'](function(_0xd82929){_0x4b2cf0['rows']=_0xd82929;return _0x4b2cf0;})[_0x71ab('0x20')](respondWithFilteredResult(_0x553b88,_0x149155))[_0x71ab('0x3d')](handleError(_0x553b88,null));};exports[_0x71ab('0x3e')]=function(_0x298f6e,_0x211527){var _0x61bff8={'raw':!![],'where':{'id':_0x298f6e['params']['id']}},_0xb71e89={};_0xb71e89[_0x71ab('0x29')]=_[_0x71ab('0x2c')](db[_0x71ab('0x26')]['rawAttributes']);_0xb71e89[_0x71ab('0x2b')]=_['keys'](_0x298f6e[_0x71ab('0x2b')]);_0xb71e89[_0x71ab('0x2d')]=_[_0x71ab('0x3f')](_0xb71e89[_0x71ab('0x29')],_0xb71e89['query']);_0x61bff8[_0x71ab('0x2e')]=_[_0x71ab('0x3f')](_0xb71e89[_0x71ab('0x29')],qs[_0x71ab('0x2f')](_0x298f6e['query'][_0x71ab('0x2f')]));_0x61bff8['attributes']=_0x61bff8[_0x71ab('0x2e')]['length']?_0x61bff8[_0x71ab('0x2e')]:_0xb71e89['model'];if(_0x298f6e[_0x71ab('0x2b')]['includeAll']){_0x61bff8['include']=[{'all':!![]}];}_0x61bff8=_['merge']({},_0x61bff8,_0x298f6e[_0x71ab('0x39')]);return db[_0x71ab('0x26')][_0x71ab('0x40')](_0x61bff8)[_0x71ab('0x20')](handleEntityNotFound(_0x211527,null))[_0x71ab('0x20')](respondWithResult(_0x211527,null))[_0x71ab('0x3d')](handleError(_0x211527,null));};exports['create']=function(_0x4a81fa,_0x52af41){return db[_0x71ab('0x26')]['create'](_0x4a81fa[_0x71ab('0x41')],{})['then'](respondWithResult(_0x52af41,0xc9))['catch'](handleError(_0x52af41,null));};exports[_0x71ab('0x1f')]=function(_0x1ca7dc,_0x1c3c65){if(_0x1ca7dc[_0x71ab('0x41')]['id']){delete _0x1ca7dc[_0x71ab('0x41')]['id'];}return db['FaxTransferReport'][_0x71ab('0x40')]({'where':{'id':_0x1ca7dc['params']['id']}})[_0x71ab('0x20')](handleEntityNotFound(_0x1c3c65,null))[_0x71ab('0x20')](saveUpdates(_0x1ca7dc[_0x71ab('0x41')],null))['then'](respondWithResult(_0x1c3c65,null))[_0x71ab('0x3d')](handleError(_0x1c3c65,null));};exports[_0x71ab('0x21')]=function(_0x1c01f2,_0x520db3){return db['FaxTransferReport'][_0x71ab('0x40')]({'where':{'id':_0x1c01f2['params']['id']}})[_0x71ab('0x20')](handleEntityNotFound(_0x520db3,null))[_0x71ab('0x20')](removeEntity(_0x520db3,null))[_0x71ab('0x3d')](handleError(_0x520db3,null));};exports[_0x71ab('0x42')]=function(_0x3bb40f,_0x4821dc){return db[_0x71ab('0x26')][_0x71ab('0x42')]()[_0x71ab('0x20')](respondWithResult(_0x4821dc,null))['catch'](handleError(_0x4821dc,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index e8b9fc1..fc8904c 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 _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 +var _0xaf69=['define','FaxTransferReport','report_fax_transfer','uniqueid','util','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x461ce6,_0xe9e972){var _0x20efa7=function(_0xfc685d){while(--_0xfc685d){_0x461ce6['push'](_0x461ce6['shift']());}};_0x20efa7(++_0xe9e972);}(_0xaf69,0x13c));var _0x9af6=function(_0x4ea97b,_0x49b493){_0x4ea97b=_0x4ea97b-0x0;var _0x27f1e9=_0xaf69[_0x4ea97b];return _0x27f1e9;};'use strict';var _=require('lodash');var util=require(_0x9af6('0x0'));var logger=require('../../config/logger')(_0x9af6('0x1'));var moment=require(_0x9af6('0x2'));var BPromise=require('bluebird');var rp=require(_0x9af6('0x3'));var fs=require('fs');var path=require(_0x9af6('0x4'));var rimraf=require(_0x9af6('0x5'));var config=require(_0x9af6('0x6'));var attributes=require('./faxTransferReport.attributes');module[_0x9af6('0x7')]=function(_0x5982ed,_0xf7ef2d){return _0x5982ed[_0x9af6('0x8')](_0x9af6('0x9'),attributes,{'tableName':_0x9af6('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9af6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index ecc7d38..c6987d3 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 _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 +var _0xa129=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x57576d,_0x5e2566){var _0x120290=function(_0x2e097){while(--_0x2e097){_0x57576d['push'](_0x57576d['shift']());}};_0x120290(++_0x5e2566);}(_0xa129,0xb7));var _0x9a12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa129[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9a12('0x0'));var util=require(_0x9a12('0x1'));var moment=require(_0x9a12('0x2'));var BPromise=require('bluebird');var rs=require(_0x9a12('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a12('0x4'))['db'];var utils=require(_0x9a12('0x5'));var logger=require(_0x9a12('0x6'))('rpc');var config=require(_0x9a12('0x7'));var jayson=require(_0x9a12('0x8'));var client=jayson[_0x9a12('0x9')][_0x9a12('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49fd13,_0x22e6e8,_0x2353fe){return new BPromise(function(_0x1b4252,_0x188adb){return client[_0x9a12('0xb')](_0x49fd13,_0x2353fe)['then'](function(_0x20ac62){logger[_0x9a12('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x22e6e8,_0x9a12('0xd'));logger[_0x9a12('0xe')](_0x9a12('0xf'),_0x22e6e8,_0x9a12('0xd'),JSON[_0x9a12('0x10')](_0x20ac62));if(_0x20ac62[_0x9a12('0x11')]){if(_0x20ac62[_0x9a12('0x11')][_0x9a12('0x12')]===0x1f4){logger[_0x9a12('0x11')](_0x9a12('0x13'),_0x22e6e8,_0x20ac62['error'][_0x9a12('0x14')]);return _0x188adb(_0x20ac62[_0x9a12('0x11')][_0x9a12('0x14')]);}logger[_0x9a12('0x11')](_0x9a12('0x13'),_0x22e6e8,_0x20ac62[_0x9a12('0x11')][_0x9a12('0x14')]);return _0x1b4252(_0x20ac62[_0x9a12('0x11')][_0x9a12('0x14')]);}else{logger[_0x9a12('0xc')](_0x9a12('0x13'),_0x22e6e8,'request\x20sent');_0x1b4252(_0x20ac62[_0x9a12('0x15')]['message']);}})[_0x9a12('0x16')](function(_0x1eeb8e){logger[_0x9a12('0x11')](_0x9a12('0x13'),_0x22e6e8,_0x1eeb8e);_0x188adb(_0x1eeb8e);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 6c35621..bba8264 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 _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 +var _0xbc57=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','create','update','delete','exports'];(function(_0x255689,_0x28fd4c){var _0x417f69=function(_0x4b8431){while(--_0x4b8431){_0x255689['push'](_0x255689['shift']());}};_0x417f69(++_0x28fd4c);}(_0xbc57,0x1ee));var _0x7bc5=function(_0x3835f4,_0x58b13a){_0x3835f4=_0x3835f4-0x0;var _0x17e2df=_0xbc57[_0x3835f4];return _0x17e2df;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7bc5('0x0'));var timeout=require(_0x7bc5('0x1'));var express=require(_0x7bc5('0x2'));var router=express[_0x7bc5('0x3')]();var fs_extra=require(_0x7bc5('0x4'));var auth=require(_0x7bc5('0x5'));var interaction=require(_0x7bc5('0x6'));var config=require(_0x7bc5('0x7'));var controller=require(_0x7bc5('0x8'));router[_0x7bc5('0x9')]('/',auth[_0x7bc5('0xa')](),controller[_0x7bc5('0xb')]);router[_0x7bc5('0x9')](_0x7bc5('0xc'),auth[_0x7bc5('0xa')](),controller[_0x7bc5('0xd')]);router[_0x7bc5('0x9')](_0x7bc5('0xe'),auth[_0x7bc5('0xa')](),controller['show']);router['post']('/',auth[_0x7bc5('0xa')](),controller[_0x7bc5('0xf')]);router['put'](_0x7bc5('0xe'),auth[_0x7bc5('0xa')](),controller[_0x7bc5('0x10')]);router[_0x7bc5('0x11')]('/:id',auth[_0x7bc5('0xa')](),controller['destroy']);module[_0x7bc5('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 20f8946..dcd0395 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 _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 +var _0x16b0=['show','/:id/configurations','getConfigurations','getFields','create','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x57e73c,_0x256531){var _0xd298b3=function(_0x20e22e){while(--_0x20e22e){_0x57e73c['push'](_0x57e73c['shift']());}};_0xd298b3(++_0x256531);}(_0x16b0,0x1a3));var _0x016b=function(_0x5d170b,_0x26b53a){_0x5d170b=_0x5d170b-0x0;var _0x19e761=_0x16b0[_0x5d170b];return _0x19e761;};'use strict';var multer=require('multer');var util=require(_0x016b('0x0'));var path=require(_0x016b('0x1'));var timeout=require(_0x016b('0x2'));var express=require(_0x016b('0x3'));var router=express[_0x016b('0x4')]();var fs_extra=require(_0x016b('0x5'));var auth=require(_0x016b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x016b('0x7'));var controller=require(_0x016b('0x8'));router[_0x016b('0x9')]('/',auth[_0x016b('0xa')](),controller[_0x016b('0xb')]);router[_0x016b('0x9')](_0x016b('0xc'),auth[_0x016b('0xa')](),controller[_0x016b('0xd')]);router[_0x016b('0x9')](_0x016b('0xe'),auth[_0x016b('0xa')](),controller[_0x016b('0xf')]);router['get']('/:id/fields',auth[_0x016b('0xa')](),controller[_0x016b('0x10')]);router['post']('/',auth[_0x016b('0xa')](),controller[_0x016b('0x11')]);router['post']('/:id/configurations',auth[_0x016b('0xa')](),controller[_0x016b('0x12')]);router[_0x016b('0x13')](_0x016b('0xc'),auth[_0x016b('0xa')](),controller[_0x016b('0x14')]);router[_0x016b('0x15')](_0x016b('0xc'),auth['isAuthenticated'](),controller[_0x016b('0x16')]);module[_0x016b('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 2c43fe8..a09ddb8 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 _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 +var _0x243a=['STRING','basic','ENUM','integrationTab','newTab','exports'];(function(_0x3de221,_0xd26072){var _0x19dfe2=function(_0x576f15){while(--_0x576f15){_0x3de221['push'](_0x3de221['shift']());}};_0x19dfe2(++_0xd26072);}(_0x243a,0xfb));var _0xa243=function(_0x16be0e,_0x5d8b7a){_0x16be0e=_0x16be0e-0x0;var _0x2d2cd6=_0x243a[_0x16be0e];return _0x2d2cd6;};'use strict';var Sequelize=require('sequelize');module[_0xa243('0x0')]={'name':{'type':Sequelize[_0xa243('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa243('0x1')]},'remoteUri':{'type':Sequelize[_0xa243('0x1')]},'authType':{'type':Sequelize['ENUM'](_0xa243('0x2')),'defaultValue':_0xa243('0x2')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xa243('0x1')]},'consumerSecret':{'type':Sequelize[_0xa243('0x1')]},'token':{'type':Sequelize[_0xa243('0x1')]},'tokenSecret':{'type':Sequelize[_0xa243('0x1')]},'serverUrl':{'type':Sequelize[_0xa243('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa243('0x3')](_0xa243('0x4'),_0xa243('0x5')),'defaultValue':_0xa243('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 2643e34..a329b99 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 _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 +var _0x198a=['pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','update','getConfigurations','DeskConfiguration','hasOwnProperty','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','getDescriptions','DeskField','Descriptions','getFields','priority','remoteUri','authType','consumerKey','consumerSecret','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','headers','username','password','toString','_embedded','entries','active','label','test','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','DeskAccount','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','length','order','sort','where','filters'];(function(_0x502137,_0x372ad2){var _0x443ecf=function(_0x4baaad){while(--_0x4baaad){_0x502137['push'](_0x502137['shift']());}};_0x443ecf(++_0x372ad2);}(_0x198a,0x11c));var _0xa198=function(_0x48bea0,_0x4c7a11){_0x48bea0=_0x48bea0-0x0;var _0x58058d=_0x198a[_0x48bea0];return _0x58058d;};'use strict';var emlformat=require(_0xa198('0x0'));var rimraf=require(_0xa198('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa198('0x2'));var rp=require(_0xa198('0x3'));var moment=require(_0xa198('0x4'));var BPromise=require(_0xa198('0x5'));var Mustache=require(_0xa198('0x6'));var util=require(_0xa198('0x7'));var path=require(_0xa198('0x8'));var sox=require(_0xa198('0x9'));var csv=require('to-csv');var ejs=require(_0xa198('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa198('0xb'));var squel=require(_0xa198('0xc'));var crypto=require(_0xa198('0xd'));var jsforce=require(_0xa198('0xe'));var deskjs=require(_0xa198('0xf'));var toCsv=require(_0xa198('0x10'));var querystring=require('querystring');var Papa=require(_0xa198('0x11'));var Redis=require('ioredis');var authService=require(_0xa198('0x12'));var qs=require(_0xa198('0x13'));var as=require(_0xa198('0x14'));var hardwareService=require(_0xa198('0x15'));var logger=require(_0xa198('0x16'))(_0xa198('0x17'));var utils=require(_0xa198('0x18'));var config=require(_0xa198('0x19'));var licenseUtil=require(_0xa198('0x1a'));var db=require(_0xa198('0x1b'))['db'];var integrations=require(_0xa198('0x1c'));function respondWithStatusCode(_0x1e0cc8,_0x5d578f){_0x5d578f=_0x5d578f||0xcc;return function(_0x17de0e){if(_0x17de0e){return _0x1e0cc8[_0xa198('0x1d')](_0x5d578f);}return _0x1e0cc8[_0xa198('0x1e')](_0x5d578f)[_0xa198('0x1f')]();};}function respondWithResult(_0x33516c,_0x1cfe84){_0x1cfe84=_0x1cfe84||0xc8;return function(_0xc3e61c){if(_0xc3e61c){return _0x33516c['status'](_0x1cfe84)[_0xa198('0x20')](_0xc3e61c);}};}function respondWithFilteredResult(_0x222142,_0x13e127){return function(_0x1fb172){if(_0x1fb172){var _0x5e06b9=typeof _0x13e127[_0xa198('0x21')]===_0xa198('0x22')&&typeof _0x13e127[_0xa198('0x23')]===_0xa198('0x22');var _0x18f87b=_0x1fb172['count'];var _0x444148=_0x5e06b9?0x0:_0x13e127[_0xa198('0x21')];var _0x4cea9d=_0x5e06b9?_0x1fb172[_0xa198('0x24')]:_0x13e127['offset']+_0x13e127[_0xa198('0x23')];var _0x1be7be;if(_0x4cea9d>=_0x18f87b){_0x4cea9d=_0x18f87b;_0x1be7be=0xc8;}else{_0x1be7be=0xce;}_0x222142[_0xa198('0x1e')](_0x1be7be);return _0x222142[_0xa198('0x25')](_0xa198('0x26'),_0x444148+'-'+_0x4cea9d+'/'+_0x18f87b)[_0xa198('0x20')](_0x1fb172);}return null;};}function patchUpdates(_0x34be2c){return function(_0x2a4f44){try{jsonpatch['apply'](_0x2a4f44,_0x34be2c,!![]);}catch(_0x45fdb2){return BPromise[_0xa198('0x27')](_0x45fdb2);}return _0x2a4f44[_0xa198('0x28')]();};}function saveUpdates(_0x1b7058,_0xa2189){return function(_0x539919){if(_0x539919){return _0x539919['update'](_0x1b7058)[_0xa198('0x29')](function(_0x917d1c){return _0x917d1c;});}return null;};}function removeEntity(_0x17d8af,_0x1e7094){return function(_0x3e6638){if(_0x3e6638){return _0x3e6638[_0xa198('0x2a')]()[_0xa198('0x29')](function(){_0x17d8af[_0xa198('0x1e')](0xcc)[_0xa198('0x1f')]();});}};}function handleEntityNotFound(_0x1fc084,_0x9d727c){return function(_0x46b420){if(!_0x46b420){_0x1fc084['sendStatus'](0x194);}return _0x46b420;};}function handleError(_0x44142a,_0x2c3537){_0x2c3537=_0x2c3537||0x1f4;return function(_0x937de){logger[_0xa198('0x2b')](_0x937de[_0xa198('0x2c')]);if(_0x937de[_0xa198('0x2d')]){delete _0x937de['name'];}_0x44142a[_0xa198('0x1e')](_0x2c3537)[_0xa198('0x2e')](_0x937de);};}exports[_0xa198('0x2f')]=function(_0x3b2a2e,_0x1e90aa){var _0x5a4237={},_0x4dc22b={},_0x12c650={'count':0x0,'rows':[]};var _0x22b44a=_[_0xa198('0x30')](db[_0xa198('0x31')][_0xa198('0x32')],function(_0x3b1f13){return{'name':_0x3b1f13['fieldName'],'type':_0x3b1f13[_0xa198('0x33')][_0xa198('0x34')]};});_0x4dc22b['model']=_[_0xa198('0x30')](_0x22b44a,_0xa198('0x2d'));_0x4dc22b[_0xa198('0x35')]=_[_0xa198('0x36')](_0x3b2a2e[_0xa198('0x35')]);_0x4dc22b['filters']=_[_0xa198('0x37')](_0x4dc22b['model'],_0x4dc22b[_0xa198('0x35')]);_0x5a4237['attributes']=_[_0xa198('0x37')](_0x4dc22b[_0xa198('0x38')],qs['fields'](_0x3b2a2e['query'][_0xa198('0x39')]));_0x5a4237[_0xa198('0x3a')]=_0x5a4237[_0xa198('0x3a')][_0xa198('0x3b')]?_0x5a4237[_0xa198('0x3a')]:_0x4dc22b[_0xa198('0x38')];if(!_0x3b2a2e[_0xa198('0x35')]['hasOwnProperty']('nolimit')){_0x5a4237[_0xa198('0x23')]=qs[_0xa198('0x23')](_0x3b2a2e['query'][_0xa198('0x23')]);_0x5a4237[_0xa198('0x21')]=qs['offset'](_0x3b2a2e[_0xa198('0x35')]['offset']);}_0x5a4237[_0xa198('0x3c')]=qs[_0xa198('0x3d')](_0x3b2a2e[_0xa198('0x35')][_0xa198('0x3d')]);_0x5a4237[_0xa198('0x3e')]=qs[_0xa198('0x3f')](_[_0xa198('0x40')](_0x3b2a2e[_0xa198('0x35')],_0x4dc22b['filters']),_0x22b44a);if(_0x3b2a2e['query'][_0xa198('0x41')]){_0x5a4237[_0xa198('0x3e')]=_[_0xa198('0x42')](_0x5a4237[_0xa198('0x3e')],{'$or':_[_0xa198('0x30')](_0x22b44a,function(_0xe55b5e){if(_0xe55b5e['type']!==_0xa198('0x43')){var _0x3a804e={};_0x3a804e[_0xe55b5e['name']]={'$like':'%'+_0x3b2a2e[_0xa198('0x35')][_0xa198('0x41')]+'%'};return _0x3a804e;}})});}_0x5a4237=_['merge']({},_0x5a4237,_0x3b2a2e[_0xa198('0x44')]);var _0x252857={'where':_0x5a4237[_0xa198('0x3e')]};return db['DeskAccount'][_0xa198('0x24')](_0x252857)[_0xa198('0x29')](function(_0xf06978){_0x12c650[_0xa198('0x24')]=_0xf06978;if(_0x3b2a2e[_0xa198('0x35')][_0xa198('0x45')]){_0x5a4237[_0xa198('0x46')]=[{'all':!![]}];}return db[_0xa198('0x31')]['findAll'](_0x5a4237);})[_0xa198('0x29')](function(_0x1fd890){_0x12c650['rows']=_0x1fd890;return _0x12c650;})[_0xa198('0x29')](respondWithFilteredResult(_0x1e90aa,_0x5a4237))[_0xa198('0x47')](handleError(_0x1e90aa,null));};exports[_0xa198('0x48')]=function(_0x2dda99,_0x4df61f){var _0x472216={'raw':![],'where':{'id':_0x2dda99[_0xa198('0x49')]['id']}},_0xacce44={};_0xacce44['model']=_[_0xa198('0x36')](db[_0xa198('0x31')][_0xa198('0x32')]);_0xacce44[_0xa198('0x35')]=_[_0xa198('0x36')](_0x2dda99[_0xa198('0x35')]);_0xacce44[_0xa198('0x3f')]=_[_0xa198('0x37')](_0xacce44[_0xa198('0x38')],_0xacce44[_0xa198('0x35')]);_0x472216['attributes']=_[_0xa198('0x37')](_0xacce44[_0xa198('0x38')],qs[_0xa198('0x39')](_0x2dda99['query'][_0xa198('0x39')]));_0x472216[_0xa198('0x3a')]=_0x472216[_0xa198('0x3a')][_0xa198('0x3b')]?_0x472216[_0xa198('0x3a')]:_0xacce44[_0xa198('0x38')];if(_0x2dda99['query'][_0xa198('0x45')]){_0x472216[_0xa198('0x46')]=[{'all':!![]}];}_0x472216=_[_0xa198('0x42')]({},_0x472216,_0x2dda99[_0xa198('0x44')]);return db[_0xa198('0x31')][_0xa198('0x4a')](_0x472216)[_0xa198('0x29')](handleEntityNotFound(_0x4df61f,null))[_0xa198('0x29')](respondWithResult(_0x4df61f,null))[_0xa198('0x47')](handleError(_0x4df61f,null));};exports[_0xa198('0x4b')]=function(_0x212e2c,_0x5a2e1b){return db[_0xa198('0x31')][_0xa198('0x4b')](_0x212e2c[_0xa198('0x4c')],{})[_0xa198('0x29')](respondWithResult(_0x5a2e1b,0xc9))[_0xa198('0x47')](handleError(_0x5a2e1b,null));};exports[_0xa198('0x4d')]=function(_0x294ccf,_0x3c5b4b){if(_0x294ccf[_0xa198('0x4c')]['id']){delete _0x294ccf[_0xa198('0x4c')]['id'];}return db['DeskAccount'][_0xa198('0x4a')]({'where':{'id':_0x294ccf[_0xa198('0x49')]['id']}})['then'](handleEntityNotFound(_0x3c5b4b,null))[_0xa198('0x29')](saveUpdates(_0x294ccf['body'],null))[_0xa198('0x29')](respondWithResult(_0x3c5b4b,null))['catch'](handleError(_0x3c5b4b,null));};exports[_0xa198('0x2a')]=function(_0x3aa661,_0x33830a){return db[_0xa198('0x31')][_0xa198('0x4a')]({'where':{'id':_0x3aa661[_0xa198('0x49')]['id']}})[_0xa198('0x29')](handleEntityNotFound(_0x33830a,null))[_0xa198('0x29')](removeEntity(_0x33830a,null))['catch'](handleError(_0x33830a,null));};exports[_0xa198('0x4e')]=function(_0x5aa6b4,_0x375488,_0x2fcb85){var _0x3257d4={};var _0x39e08d={};var _0xdbe2b2;var _0x1c1c9d;return db[_0xa198('0x31')]['findOne']({'where':{'id':_0x5aa6b4['params']['id']}})[_0xa198('0x29')](handleEntityNotFound(_0x375488,null))[_0xa198('0x29')](function(_0x1dd645){if(_0x1dd645){_0xdbe2b2=_0x1dd645;_0x39e08d['model']=_[_0xa198('0x36')](db[_0xa198('0x4f')][_0xa198('0x32')]);_0x39e08d[_0xa198('0x35')]=_[_0xa198('0x36')](_0x5aa6b4[_0xa198('0x35')]);_0x39e08d[_0xa198('0x3f')]=_[_0xa198('0x37')](_0x39e08d[_0xa198('0x38')],_0x39e08d['query']);_0x3257d4[_0xa198('0x3a')]=_['intersection'](_0x39e08d[_0xa198('0x38')],qs[_0xa198('0x39')](_0x5aa6b4[_0xa198('0x35')][_0xa198('0x39')]));_0x3257d4[_0xa198('0x3a')]=_0x3257d4[_0xa198('0x3a')][_0xa198('0x3b')]?_0x3257d4[_0xa198('0x3a')]:_0x39e08d[_0xa198('0x38')];_0x3257d4[_0xa198('0x3c')]=qs[_0xa198('0x3d')](_0x5aa6b4[_0xa198('0x35')][_0xa198('0x3d')]);_0x3257d4[_0xa198('0x3e')]=qs[_0xa198('0x3f')](_['pick'](_0x5aa6b4['query'],_0x39e08d[_0xa198('0x3f')]));if(_0x5aa6b4[_0xa198('0x35')][_0xa198('0x41')]){_0x3257d4[_0xa198('0x3e')]=_[_0xa198('0x42')](_0x3257d4[_0xa198('0x3e')],{'$or':_[_0xa198('0x30')](_0x3257d4[_0xa198('0x3a')],function(_0x168e53){var _0x543aa1={};_0x543aa1[_0x168e53]={'$like':'%'+_0x5aa6b4['query'][_0xa198('0x41')]+'%'};return _0x543aa1;})});}_0x3257d4=_['merge']({},_0x3257d4,_0x5aa6b4[_0xa198('0x44')]);return _0xdbe2b2[_0xa198('0x4e')](_0x3257d4);}})[_0xa198('0x29')](function(_0x4d0e91){if(_0x4d0e91){_0x1c1c9d=_0x4d0e91['length'];if(!_0x5aa6b4[_0xa198('0x35')][_0xa198('0x50')](_0xa198('0x51'))){_0x3257d4[_0xa198('0x23')]=qs[_0xa198('0x23')](_0x5aa6b4[_0xa198('0x35')][_0xa198('0x23')]);_0x3257d4[_0xa198('0x21')]=qs[_0xa198('0x21')](_0x5aa6b4[_0xa198('0x35')]['offset']);}return _0xdbe2b2[_0xa198('0x4e')](_0x3257d4);}})['then'](function(_0x1388a3){if(_0x1388a3){return _0x1388a3?{'count':_0x1c1c9d,'rows':_0x1388a3}:null;}})[_0xa198('0x29')](respondWithResult(_0x375488,null))[_0xa198('0x47')](handleError(_0x375488,null));};exports[_0xa198('0x52')]=function(_0x1f2915,_0xfea1d3,_0x2432c8){if(_0x1f2915[_0xa198('0x4c')]['id']){delete _0x1f2915['body']['id'];}return db[_0xa198('0x31')][_0xa198('0x53')]({'where':{'id':_0x1f2915[_0xa198('0x49')]['id']}})[_0xa198('0x29')](handleEntityNotFound(_0xfea1d3,null))[_0xa198('0x29')](function(_0x1274f9){if(_0x1274f9){_0x1f2915[_0xa198('0x4c')][_0xa198('0x54')]=_0x1274f9['id'];_0x1f2915[_0xa198('0x4c')][_0xa198('0x55')]=integrations[_0xa198('0x56')](_0x1f2915[_0xa198('0x4c')]['channel'],_0x1f2915['body'][_0xa198('0x33')]);_0x1f2915[_0xa198('0x4c')]['Descriptions']=integrations[_0xa198('0x57')](_0x1f2915[_0xa198('0x4c')]['channel'],_0x1f2915['body'][_0xa198('0x33')]);return db[_0xa198('0x4f')][_0xa198('0x4b')](_0x1f2915[_0xa198('0x4c')],{'include':[{'model':db[_0xa198('0x58')],'as':_0xa198('0x55')},{'model':db[_0xa198('0x58')],'as':_0xa198('0x59')}]});}return null;})[_0xa198('0x29')](respondWithResult(_0xfea1d3,null))['catch'](handleError(_0xfea1d3,null));};exports[_0xa198('0x5a')]=function(_0x52e763,_0x9390ca,_0x3b281f){var _0x38b2c1=[{'name':_0xa198('0x5b'),'label':_0xa198('0x5b'),'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 _0x19a622='';return db[_0xa198('0x31')][_0xa198('0x53')]({'where':{'id':_0x52e763[_0xa198('0x49')]['id']},'attributes':['id',_0xa198('0x5c'),_0xa198('0x5d'),'username','password',_0xa198('0x5e'),_0xa198('0x5f'),'token',_0xa198('0x60')]})[_0xa198('0x29')](handleEntityNotFound(_0x9390ca,null))[_0xa198('0x29')](function(_0x5f54c1){if(_0x5f54c1){_0x19a622=_0x5f54c1[_0xa198('0x5c')];var _0x3b98f4=_0x19a622[_0xa198('0x61')](-0x1);if(_0x3b98f4==='/'){_0x19a622=_0x19a622[_0xa198('0x62')](0x0,_0x19a622[_0xa198('0x63')](_0x3b98f4));}var _0x3eb533={'method':_0xa198('0x64'),'uri':util[_0xa198('0x65')](_0xa198('0x66'),_0x19a622),'headers':{'Content-Type':_0xa198('0x67'),'Accept':_0xa198('0x67')},'json':!![]};if(_0x5f54c1[_0xa198('0x5d')]==='basic'){_0x3eb533[_0xa198('0x68')]['Authorization']=util['format']('Basic\x20%s',new Buffer(util[_0xa198('0x65')]('%s:%s',_0x5f54c1[_0xa198('0x69')],_0x5f54c1[_0xa198('0x6a')]))[_0xa198('0x6b')]('base64'));}return rp(_0x3eb533)[_0xa198('0x29')](function(_0x108d25){return _0x38b2c1['concat'](_[_0xa198('0x30')](_0x108d25[_0xa198('0x6c')][_0xa198('0x6d')],function(_0xcf0058){return{'id':_0xcf0058['name'],'name':_0xcf0058[_0xa198('0x2d')],'type':_0xcf0058[_0xa198('0x33')],'active':_0xcf0058[_0xa198('0x6e')],'label':_0xcf0058[_0xa198('0x6f')],'custom':!![]};}));});}})[_0xa198('0x29')](function(_0x5a371a){return{'count':_0x5a371a[_0xa198('0x3b')],'rows':_0x5a371a};})['then'](respondWithResult(_0x9390ca,null))['catch'](function(_0xd60fbc){var _0x2be450=_0x52e763['query'][_0xa198('0x70')]?0x1f4:_0xd60fbc['statusCode']||0x1f4;logger[_0xa198('0x2b')]('getFields,\x20%s,\x20%s,\x20%s',_0xa198('0x5a'),_0x2be450,JSON[_0xa198('0x71')](_0xd60fbc));delete _0xd60fbc[_0xa198('0x2d')];if(_0x2be450===0x191){_0x2be450=0x190;}_0x9390ca['status'](_0x2be450)[_0xa198('0x2e')](_0x52e763[_0xa198('0x35')][_0xa198('0x70')]?{'message':_0xa198('0x72'),'statusCode':_0xd60fbc[_0xa198('0x73')]}:_0xd60fbc);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 35a15a0..9a5059a 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 _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 +var _0x00ca=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts'];(function(_0x4100b3,_0x15d14e){var _0x9a4c24=function(_0x131e2e){while(--_0x131e2e){_0x4100b3['push'](_0x4100b3['shift']());}};_0x9a4c24(++_0x15d14e);}(_0x00ca,0x17a));var _0xa00c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x00ca[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xa00c('0x0'));var util=require(_0xa00c('0x1'));var logger=require(_0xa00c('0x2'))(_0xa00c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa00c('0x4'));var fs=require('fs');var path=require(_0xa00c('0x5'));var rimraf=require(_0xa00c('0x6'));var config=require(_0xa00c('0x7'));var attributes=require(_0xa00c('0x8'));var integrations=require(_0xa00c('0x9'));module[_0xa00c('0xa')]=function(_0x4bd457,_0x227ee2){return _0x4bd457[_0xa00c('0xb')](_0xa00c('0xc'),attributes,{'tableName':_0xa00c('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 a328a2f..38a5548 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 _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 +var _0x30ca=['result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','debug','ShowDeskAccount','find','lodash','util','moment','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x46c297,_0x13d386){var _0x4274f3=function(_0x111bc5){while(--_0x111bc5){_0x46c297['push'](_0x46c297['shift']());}};_0x4274f3(++_0x13d386);}(_0x30ca,0xbf));var _0xa30c=function(_0x588084,_0x3caff4){_0x588084=_0x588084-0x0;var _0x2b444d=_0x30ca[_0x588084];return _0x2b444d;};'use strict';var _=require(_0xa30c('0x0'));var util=require(_0xa30c('0x1'));var moment=require(_0xa30c('0x2'));var BPromise=require(_0xa30c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa30c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa30c('0x5'));var config=require(_0xa30c('0x6'));var jayson=require(_0xa30c('0x7'));var client=jayson[_0xa30c('0x8')][_0xa30c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26ab74,_0x5f33bf,_0x467b3e){return new BPromise(function(_0x508747,_0x26a739){return client['request'](_0x26ab74,_0x467b3e)[_0xa30c('0xa')](function(_0x462469){logger[_0xa30c('0xb')](_0xa30c('0xc'),_0x5f33bf,_0xa30c('0xd'));logger['debug'](_0xa30c('0xe'),_0x5f33bf,'request\x20sent',JSON[_0xa30c('0xf')](_0x462469));if(_0x462469[_0xa30c('0x10')]){if(_0x462469['error'][_0xa30c('0x11')]===0x1f4){logger[_0xa30c('0x10')](_0xa30c('0xc'),_0x5f33bf,_0x462469[_0xa30c('0x10')]['message']);return _0x26a739(_0x462469[_0xa30c('0x10')][_0xa30c('0x12')]);}logger[_0xa30c('0x10')](_0xa30c('0xc'),_0x5f33bf,_0x462469[_0xa30c('0x10')]['message']);return _0x508747(_0x462469['error'][_0xa30c('0x12')]);}else{logger[_0xa30c('0xb')]('DeskAccount,\x20%s,\x20%s',_0x5f33bf,_0xa30c('0xd'));_0x508747(_0x462469[_0xa30c('0x13')][_0xa30c('0x12')]);}})[_0xa30c('0x14')](function(_0x4212d4){logger[_0xa30c('0x10')](_0xa30c('0xc'),_0x5f33bf,_0x4212d4);_0x26a739(_0x4212d4);});});}exports[_0xa30c('0x15')]=function(_0x379ce3){var _0x45a8f8=this;return new Promise(function(_0x258218,_0x38a66c){return db[_0xa30c('0x16')][_0xa30c('0x17')]({'raw':_0x379ce3[_0xa30c('0x18')]?_0x379ce3[_0xa30c('0x18')][_0xa30c('0x19')]===undefined?!![]:![]:!![],'where':_0x379ce3[_0xa30c('0x18')]?_0x379ce3[_0xa30c('0x18')][_0xa30c('0x1a')]||null:null,'attributes':_0x379ce3[_0xa30c('0x18')]?_0x379ce3[_0xa30c('0x18')][_0xa30c('0x1b')]||null:null,'limit':_0x379ce3['options']?_0x379ce3[_0xa30c('0x18')][_0xa30c('0x1c')]||null:null,'include':_0x379ce3[_0xa30c('0x18')]?_0x379ce3[_0xa30c('0x18')]['include']?_[_0xa30c('0x1d')](_0x379ce3['options']['include'],function(_0x4cb9be){return{'model':db[_0x4cb9be['model']],'as':_0x4cb9be['as'],'attributes':_0x4cb9be['attributes'],'include':_0x4cb9be[_0xa30c('0x1e')]?_[_0xa30c('0x1d')](_0x4cb9be['include'],function(_0x3c4686){return{'model':db[_0x3c4686[_0xa30c('0x1f')]],'as':_0x3c4686['as'],'attributes':_0x3c4686[_0xa30c('0x1b')],'include':_0x3c4686[_0xa30c('0x1e')]?_['map'](_0x3c4686[_0xa30c('0x1e')],function(_0x40bbc6){return{'model':db[_0x40bbc6[_0xa30c('0x1f')]],'as':_0x40bbc6['as'],'attributes':_0x40bbc6[_0xa30c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa30c('0xa')](function(_0x152117){logger[_0xa30c('0xb')]('GetDeskAccount',_0x379ce3);logger[_0xa30c('0x20')](_0xa30c('0x15'),_0x379ce3,JSON[_0xa30c('0xf')](_0x152117));_0x258218(_0x152117);})[_0xa30c('0x14')](function(_0x2eb690){logger[_0xa30c('0x10')](_0xa30c('0x15'),_0x2eb690[_0xa30c('0x12')],_0x379ce3);_0x38a66c(_0x45a8f8[_0xa30c('0x10')](0x1f4,_0x2eb690[_0xa30c('0x12')]));});});};exports[_0xa30c('0x21')]=function(_0xf576f9){var _0x3bda90=this;return new Promise(function(_0x21baea,_0x401886){return db[_0xa30c('0x16')][_0xa30c('0x22')]({'raw':_0xf576f9[_0xa30c('0x18')]?_0xf576f9[_0xa30c('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xf576f9[_0xa30c('0x18')]?_0xf576f9[_0xa30c('0x18')]['where']||null:null,'attributes':_0xf576f9[_0xa30c('0x18')]?_0xf576f9[_0xa30c('0x18')][_0xa30c('0x1b')]||null:null,'include':_0xf576f9[_0xa30c('0x18')]?_0xf576f9[_0xa30c('0x18')][_0xa30c('0x1e')]?_[_0xa30c('0x1d')](_0xf576f9[_0xa30c('0x18')]['include'],function(_0x3805b9){return{'model':db[_0x3805b9[_0xa30c('0x1f')]],'as':_0x3805b9['as'],'attributes':_0x3805b9[_0xa30c('0x1b')],'include':_0x3805b9[_0xa30c('0x1e')]?_[_0xa30c('0x1d')](_0x3805b9[_0xa30c('0x1e')],function(_0x46d936){return{'model':db[_0x46d936[_0xa30c('0x1f')]],'as':_0x46d936['as'],'attributes':_0x46d936[_0xa30c('0x1b')],'include':_0x46d936['include']?_['map'](_0x46d936[_0xa30c('0x1e')],function(_0x296c45){return{'model':db[_0x296c45['model']],'as':_0x296c45['as'],'attributes':_0x296c45[_0xa30c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa30c('0xa')](function(_0x10172a){logger['info'](_0xa30c('0x21'),_0xf576f9);logger[_0xa30c('0x20')]('ShowDeskAccount',_0xf576f9,JSON[_0xa30c('0xf')](_0x10172a));_0x21baea(_0x10172a);})['catch'](function(_0x15271a){logger['error'](_0xa30c('0x21'),_0x15271a['message'],_0xf576f9);_0x401886(_0x3bda90[_0xa30c('0x10')](0x1f4,_0x15271a['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index ccb9aa8..57bf1af 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_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 +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(_0x2d3d0d,_0x67ac82){var _0xca35b6=function(_0x483979){while(--_0x483979){_0x2d3d0d['push'](_0x2d3d0d['shift']());}};_0xca35b6(++_0x67ac82);}(_0x55ca,0x126));var _0xa55c=function(_0x90dfad,_0x4d127a){_0x90dfad=_0x90dfad-0x0;var _0x8cdcc7=_0x55ca[_0x90dfad];return _0x8cdcc7;};'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 5767234..a0da8c2 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 _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 +var _0x9a61=['STRING','sequelize','exports'];(function(_0x5d5a7c,_0x51e29c){var _0x106274=function(_0x4df00a){while(--_0x4df00a){_0x5d5a7c['push'](_0x5d5a7c['shift']());}};_0x106274(++_0x51e29c);}(_0x9a61,0x1a8));var _0x19a6=function(_0x6f7fee,_0x2cb733){_0x6f7fee=_0x6f7fee-0x0;var _0x3bc517=_0x9a61[_0x6f7fee];return _0x3bc517;};'use strict';var Sequelize=require(_0x19a6('0x0'));module[_0x19a6('0x1')]={'name':{'type':Sequelize[_0x19a6('0x2')]},'description':{'type':Sequelize[_0x19a6('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 2d9e897..42ab7ce 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 _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 +var _0xd082=['query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','type','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','getFields','DeskField','order','hasOwnProperty','getSubjects','findOne','getDescriptions','getTags','setTags','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','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','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','name','send','index','DeskConfiguration','key','model','map'];(function(_0x150240,_0x512309){var _0x3aa85b=function(_0x24a91f){while(--_0x24a91f){_0x150240['push'](_0x150240['shift']());}};_0x3aa85b(++_0x512309);}(_0xd082,0x11a));var _0x2d08=function(_0xddb31c,_0x9345e6){_0xddb31c=_0xddb31c-0x0;var _0x34f7a1=_0xd082[_0xddb31c];return _0x34f7a1;};'use strict';var emlformat=require(_0x2d08('0x0'));var rimraf=require(_0x2d08('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d08('0x2'));var rp=require(_0x2d08('0x3'));var moment=require(_0x2d08('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x2d08('0x5'));var sox=require(_0x2d08('0x6'));var csv=require(_0x2d08('0x7'));var ejs=require(_0x2d08('0x8'));var fs=require('fs');var fs_extra=require(_0x2d08('0x9'));var _=require(_0x2d08('0xa'));var squel=require(_0x2d08('0xb'));var crypto=require('crypto');var jsforce=require(_0x2d08('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2d08('0x7'));var querystring=require(_0x2d08('0xd'));var Papa=require(_0x2d08('0xe'));var Redis=require(_0x2d08('0xf'));var authService=require(_0x2d08('0x10'));var qs=require(_0x2d08('0x11'));var as=require(_0x2d08('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2d08('0x13'))(_0x2d08('0x14'));var utils=require(_0x2d08('0x15'));var config=require(_0x2d08('0x16'));var licenseUtil=require(_0x2d08('0x17'));var db=require(_0x2d08('0x18'))['db'];function respondWithStatusCode(_0x586abf,_0x40c8b6){_0x40c8b6=_0x40c8b6||0xcc;return function(_0xbe1ae6){if(_0xbe1ae6){return _0x586abf['sendStatus'](_0x40c8b6);}return _0x586abf['status'](_0x40c8b6)[_0x2d08('0x19')]();};}function respondWithResult(_0x2acaeb,_0x3cef14){_0x3cef14=_0x3cef14||0xc8;return function(_0x3f9724){if(_0x3f9724){return _0x2acaeb[_0x2d08('0x1a')](_0x3cef14)[_0x2d08('0x1b')](_0x3f9724);}};}function respondWithFilteredResult(_0x324380,_0x6c2213){return function(_0x540aed){if(_0x540aed){var _0x393f64=typeof _0x6c2213[_0x2d08('0x1c')]===_0x2d08('0x1d')&&typeof _0x6c2213[_0x2d08('0x1e')]===_0x2d08('0x1d');var _0x4abee5=_0x540aed[_0x2d08('0x1f')];var _0x23e772=_0x393f64?0x0:_0x6c2213['offset'];var _0x2e67ff=_0x393f64?_0x540aed[_0x2d08('0x1f')]:_0x6c2213[_0x2d08('0x1c')]+_0x6c2213[_0x2d08('0x1e')];var _0x938f4b;if(_0x2e67ff>=_0x4abee5){_0x2e67ff=_0x4abee5;_0x938f4b=0xc8;}else{_0x938f4b=0xce;}_0x324380['status'](_0x938f4b);return _0x324380[_0x2d08('0x20')]('Content-Range',_0x23e772+'-'+_0x2e67ff+'/'+_0x4abee5)[_0x2d08('0x1b')](_0x540aed);}return null;};}function patchUpdates(_0x43c693){return function(_0x329eb6){try{jsonpatch[_0x2d08('0x21')](_0x329eb6,_0x43c693,!![]);}catch(_0x4c1453){return BPromise[_0x2d08('0x22')](_0x4c1453);}return _0x329eb6[_0x2d08('0x23')]();};}function saveUpdates(_0x2e7ba0,_0x580f4f){return function(_0x2149de){if(_0x2149de){return _0x2149de['update'](_0x2e7ba0)[_0x2d08('0x24')](function(_0x27c2c4){return _0x27c2c4;});}return null;};}function removeEntity(_0x31fca4,_0x5bc887){return function(_0x16568b){if(_0x16568b){return _0x16568b[_0x2d08('0x25')]()[_0x2d08('0x24')](function(){_0x31fca4[_0x2d08('0x1a')](0xcc)[_0x2d08('0x19')]();});}};}function handleEntityNotFound(_0xac4e0a,_0x5b4db9){return function(_0x4c247f){if(!_0x4c247f){_0xac4e0a['sendStatus'](0x194);}return _0x4c247f;};}function handleError(_0x550244,_0x5aacf7){_0x5aacf7=_0x5aacf7||0x1f4;return function(_0xdc0c80){logger[_0x2d08('0x26')](_0xdc0c80['stack']);if(_0xdc0c80[_0x2d08('0x27')]){delete _0xdc0c80['name'];}_0x550244[_0x2d08('0x1a')](_0x5aacf7)[_0x2d08('0x28')](_0xdc0c80);};}exports[_0x2d08('0x29')]=function(_0x3ed5d6,_0xb57aa6){var _0x17cb94={},_0x211de2={},_0x4cb6c1={'count':0x0,'rows':[]};var _0x5ce5f1=_['map'](db[_0x2d08('0x2a')]['rawAttributes'],function(_0x345080){return{'name':_0x345080['fieldName'],'type':_0x345080['type'][_0x2d08('0x2b')]};});_0x211de2[_0x2d08('0x2c')]=_[_0x2d08('0x2d')](_0x5ce5f1,_0x2d08('0x27'));_0x211de2[_0x2d08('0x2e')]=_[_0x2d08('0x2f')](_0x3ed5d6[_0x2d08('0x2e')]);_0x211de2['filters']=_[_0x2d08('0x30')](_0x211de2[_0x2d08('0x2c')],_0x211de2['query']);_0x17cb94[_0x2d08('0x31')]=_['intersection'](_0x211de2[_0x2d08('0x2c')],qs[_0x2d08('0x32')](_0x3ed5d6[_0x2d08('0x2e')][_0x2d08('0x32')]));_0x17cb94[_0x2d08('0x31')]=_0x17cb94[_0x2d08('0x31')][_0x2d08('0x33')]?_0x17cb94['attributes']:_0x211de2[_0x2d08('0x2c')];if(!_0x3ed5d6[_0x2d08('0x2e')]['hasOwnProperty'](_0x2d08('0x34'))){_0x17cb94['limit']=qs[_0x2d08('0x1e')](_0x3ed5d6[_0x2d08('0x2e')][_0x2d08('0x1e')]);_0x17cb94[_0x2d08('0x1c')]=qs['offset'](_0x3ed5d6[_0x2d08('0x2e')][_0x2d08('0x1c')]);}_0x17cb94['order']=qs[_0x2d08('0x35')](_0x3ed5d6[_0x2d08('0x2e')][_0x2d08('0x35')]);_0x17cb94[_0x2d08('0x36')]=qs[_0x2d08('0x37')](_[_0x2d08('0x38')](_0x3ed5d6[_0x2d08('0x2e')],_0x211de2[_0x2d08('0x37')]),_0x5ce5f1);if(_0x3ed5d6[_0x2d08('0x2e')][_0x2d08('0x39')]){_0x17cb94[_0x2d08('0x36')]=_['merge'](_0x17cb94[_0x2d08('0x36')],{'$or':_['map'](_0x5ce5f1,function(_0x5b2a20){if(_0x5b2a20[_0x2d08('0x3a')]!=='VIRTUAL'){var _0x424c3c={};_0x424c3c[_0x5b2a20[_0x2d08('0x27')]]={'$like':'%'+_0x3ed5d6[_0x2d08('0x2e')][_0x2d08('0x39')]+'%'};return _0x424c3c;}})});}_0x17cb94=_[_0x2d08('0x3b')]({},_0x17cb94,_0x3ed5d6[_0x2d08('0x3c')]);var _0x509548={'where':_0x17cb94[_0x2d08('0x36')]};return db['DeskConfiguration'][_0x2d08('0x1f')](_0x509548)[_0x2d08('0x24')](function(_0xaeae1){_0x4cb6c1[_0x2d08('0x1f')]=_0xaeae1;if(_0x3ed5d6['query'][_0x2d08('0x3d')]){_0x17cb94[_0x2d08('0x3e')]=[{'all':!![]}];}return db[_0x2d08('0x2a')][_0x2d08('0x3f')](_0x17cb94);})[_0x2d08('0x24')](function(_0x299240){_0x4cb6c1[_0x2d08('0x40')]=_0x299240;return _0x4cb6c1;})[_0x2d08('0x24')](respondWithFilteredResult(_0xb57aa6,_0x17cb94))[_0x2d08('0x41')](handleError(_0xb57aa6,null));};exports[_0x2d08('0x42')]=function(_0x5cea6d,_0x424b81){var _0x5cf613={'raw':![],'where':{'id':_0x5cea6d[_0x2d08('0x43')]['id']}},_0x20ecca={};_0x20ecca[_0x2d08('0x2c')]=_[_0x2d08('0x2f')](db['DeskConfiguration'][_0x2d08('0x44')]);_0x20ecca[_0x2d08('0x2e')]=_[_0x2d08('0x2f')](_0x5cea6d['query']);_0x20ecca[_0x2d08('0x37')]=_[_0x2d08('0x30')](_0x20ecca[_0x2d08('0x2c')],_0x20ecca[_0x2d08('0x2e')]);_0x5cf613[_0x2d08('0x31')]=_['intersection'](_0x20ecca['model'],qs['fields'](_0x5cea6d[_0x2d08('0x2e')][_0x2d08('0x32')]));_0x5cf613[_0x2d08('0x31')]=_0x5cf613['attributes'][_0x2d08('0x33')]?_0x5cf613[_0x2d08('0x31')]:_0x20ecca['model'];if(_0x5cea6d[_0x2d08('0x2e')][_0x2d08('0x3d')]){_0x5cf613['include']=[{'all':!![]}];}_0x5cf613=_[_0x2d08('0x3b')]({},_0x5cf613,_0x5cea6d[_0x2d08('0x3c')]);return db['DeskConfiguration'][_0x2d08('0x45')](_0x5cf613)['then'](handleEntityNotFound(_0x424b81,null))[_0x2d08('0x24')](respondWithResult(_0x424b81,null))[_0x2d08('0x41')](handleError(_0x424b81,null));};exports['create']=function(_0x4388a2,_0x20a3fb){return db[_0x2d08('0x2a')][_0x2d08('0x46')](_0x4388a2[_0x2d08('0x47')],{})[_0x2d08('0x24')](respondWithResult(_0x20a3fb,0xc9))[_0x2d08('0x41')](handleError(_0x20a3fb,null));};exports[_0x2d08('0x48')]=function(_0x45e032,_0x19ab10){if(_0x45e032[_0x2d08('0x47')]['id']){delete _0x45e032['body']['id'];}return db[_0x2d08('0x2a')]['find']({'where':{'id':_0x45e032[_0x2d08('0x43')]['id']}})[_0x2d08('0x24')](handleEntityNotFound(_0x19ab10,null))['then'](saveUpdates(_0x45e032['body'],null))['then'](respondWithResult(_0x19ab10,null))[_0x2d08('0x41')](handleError(_0x19ab10,null));};exports[_0x2d08('0x25')]=function(_0xc6c614,_0xa1df84){return db[_0x2d08('0x2a')][_0x2d08('0x45')]({'where':{'id':_0xc6c614['params']['id']}})[_0x2d08('0x24')](handleEntityNotFound(_0xa1df84,null))[_0x2d08('0x24')](removeEntity(_0xa1df84,null))[_0x2d08('0x41')](handleError(_0xa1df84,null));};exports[_0x2d08('0x49')]=function(_0x4e2fc4,_0x5a31f4,_0xc51183){var _0x153f62={};var _0x168342={};var _0x50cc8b;var _0x200575;return db[_0x2d08('0x2a')]['findOne']({'where':{'id':_0x4e2fc4[_0x2d08('0x43')]['id']}})[_0x2d08('0x24')](handleEntityNotFound(_0x5a31f4,null))[_0x2d08('0x24')](function(_0x2613f2){if(_0x2613f2){_0x50cc8b=_0x2613f2;_0x168342[_0x2d08('0x2c')]=_[_0x2d08('0x2f')](db[_0x2d08('0x4a')]['rawAttributes']);_0x168342[_0x2d08('0x2e')]=_['keys'](_0x4e2fc4[_0x2d08('0x2e')]);_0x168342[_0x2d08('0x37')]=_[_0x2d08('0x30')](_0x168342[_0x2d08('0x2c')],_0x168342[_0x2d08('0x2e')]);_0x153f62['attributes']=_['intersection'](_0x168342['model'],qs[_0x2d08('0x32')](_0x4e2fc4['query'][_0x2d08('0x32')]));_0x153f62[_0x2d08('0x31')]=_0x153f62[_0x2d08('0x31')][_0x2d08('0x33')]?_0x153f62[_0x2d08('0x31')]:_0x168342[_0x2d08('0x2c')];_0x153f62[_0x2d08('0x4b')]=qs['sort'](_0x4e2fc4[_0x2d08('0x2e')][_0x2d08('0x35')]);_0x153f62[_0x2d08('0x36')]=qs[_0x2d08('0x37')](_[_0x2d08('0x38')](_0x4e2fc4[_0x2d08('0x2e')],_0x168342[_0x2d08('0x37')]));if(_0x4e2fc4[_0x2d08('0x2e')]['filter']){_0x153f62[_0x2d08('0x36')]=_[_0x2d08('0x3b')](_0x153f62['where'],{'$or':_[_0x2d08('0x2d')](_0x153f62['attributes'],function(_0x167dd2){var _0x49b487={};_0x49b487[_0x167dd2]={'$like':'%'+_0x4e2fc4['query'][_0x2d08('0x39')]+'%'};return _0x49b487;})});}_0x153f62=_['merge']({},_0x153f62,_0x4e2fc4[_0x2d08('0x3c')]);return _0x50cc8b[_0x2d08('0x49')](_0x153f62);}})['then'](function(_0x6352c9){if(_0x6352c9){_0x200575=_0x6352c9[_0x2d08('0x33')];if(!_0x4e2fc4[_0x2d08('0x2e')][_0x2d08('0x4c')](_0x2d08('0x34'))){_0x153f62['limit']=qs[_0x2d08('0x1e')](_0x4e2fc4[_0x2d08('0x2e')][_0x2d08('0x1e')]);_0x153f62['offset']=qs[_0x2d08('0x1c')](_0x4e2fc4['query'][_0x2d08('0x1c')]);}return _0x50cc8b[_0x2d08('0x49')](_0x153f62);}})[_0x2d08('0x24')](function(_0x196bb3){if(_0x196bb3){return _0x196bb3?{'count':_0x200575,'rows':_0x196bb3}:null;}})[_0x2d08('0x24')](respondWithResult(_0x5a31f4,null))[_0x2d08('0x41')](handleError(_0x5a31f4,null));};exports[_0x2d08('0x4d')]=function(_0x11184b,_0x131a45,_0x379b5c){var _0x2f5d61={};var _0x2823bd={};var _0x5efaee;var _0x251090;return db['DeskConfiguration'][_0x2d08('0x4e')]({'where':{'id':_0x11184b[_0x2d08('0x43')]['id']}})[_0x2d08('0x24')](handleEntityNotFound(_0x131a45,null))[_0x2d08('0x24')](function(_0x1f5dbc){if(_0x1f5dbc){_0x5efaee=_0x1f5dbc;_0x2823bd[_0x2d08('0x2c')]=_[_0x2d08('0x2f')](db[_0x2d08('0x4a')][_0x2d08('0x44')]);_0x2823bd[_0x2d08('0x2e')]=_[_0x2d08('0x2f')](_0x11184b['query']);_0x2823bd[_0x2d08('0x37')]=_[_0x2d08('0x30')](_0x2823bd['model'],_0x2823bd[_0x2d08('0x2e')]);_0x2f5d61[_0x2d08('0x31')]=_['intersection'](_0x2823bd[_0x2d08('0x2c')],qs[_0x2d08('0x32')](_0x11184b[_0x2d08('0x2e')]['fields']));_0x2f5d61[_0x2d08('0x31')]=_0x2f5d61[_0x2d08('0x31')][_0x2d08('0x33')]?_0x2f5d61['attributes']:_0x2823bd[_0x2d08('0x2c')];_0x2f5d61[_0x2d08('0x4b')]=qs[_0x2d08('0x35')](_0x11184b[_0x2d08('0x2e')][_0x2d08('0x35')]);_0x2f5d61[_0x2d08('0x36')]=qs[_0x2d08('0x37')](_[_0x2d08('0x38')](_0x11184b[_0x2d08('0x2e')],_0x2823bd[_0x2d08('0x37')]));if(_0x11184b[_0x2d08('0x2e')]['filter']){_0x2f5d61[_0x2d08('0x36')]=_[_0x2d08('0x3b')](_0x2f5d61[_0x2d08('0x36')],{'$or':_[_0x2d08('0x2d')](_0x2f5d61[_0x2d08('0x31')],function(_0x2c82de){var _0xc2fe26={};_0xc2fe26[_0x2c82de]={'$like':'%'+_0x11184b['query'][_0x2d08('0x39')]+'%'};return _0xc2fe26;})});}_0x2f5d61=_[_0x2d08('0x3b')]({},_0x2f5d61,_0x11184b[_0x2d08('0x3c')]);return _0x5efaee[_0x2d08('0x4d')](_0x2f5d61);}})[_0x2d08('0x24')](function(_0x6239ca){if(_0x6239ca){_0x251090=_0x6239ca['length'];if(!_0x11184b[_0x2d08('0x2e')]['hasOwnProperty']('nolimit')){_0x2f5d61[_0x2d08('0x1e')]=qs[_0x2d08('0x1e')](_0x11184b[_0x2d08('0x2e')][_0x2d08('0x1e')]);_0x2f5d61['offset']=qs[_0x2d08('0x1c')](_0x11184b[_0x2d08('0x2e')]['offset']);}return _0x5efaee[_0x2d08('0x4d')](_0x2f5d61);}})[_0x2d08('0x24')](function(_0x2a4563){if(_0x2a4563){return _0x2a4563?{'count':_0x251090,'rows':_0x2a4563}:null;}})[_0x2d08('0x24')](respondWithResult(_0x131a45,null))[_0x2d08('0x41')](handleError(_0x131a45,null));};exports[_0x2d08('0x4f')]=function(_0x40328c,_0x581962,_0x21ce5c){var _0x6ae012={};var _0x10aeea={};var _0x291b17;var _0x37f241;return db['DeskConfiguration'][_0x2d08('0x4e')]({'where':{'id':_0x40328c[_0x2d08('0x43')]['id']}})[_0x2d08('0x24')](handleEntityNotFound(_0x581962,null))[_0x2d08('0x24')](function(_0x496484){if(_0x496484){_0x291b17=_0x496484;_0x10aeea[_0x2d08('0x2c')]=_['keys'](db[_0x2d08('0x4a')][_0x2d08('0x44')]);_0x10aeea['query']=_[_0x2d08('0x2f')](_0x40328c[_0x2d08('0x2e')]);_0x10aeea[_0x2d08('0x37')]=_[_0x2d08('0x30')](_0x10aeea['model'],_0x10aeea[_0x2d08('0x2e')]);_0x6ae012[_0x2d08('0x31')]=_['intersection'](_0x10aeea['model'],qs[_0x2d08('0x32')](_0x40328c[_0x2d08('0x2e')][_0x2d08('0x32')]));_0x6ae012[_0x2d08('0x31')]=_0x6ae012[_0x2d08('0x31')][_0x2d08('0x33')]?_0x6ae012['attributes']:_0x10aeea[_0x2d08('0x2c')];_0x6ae012[_0x2d08('0x4b')]=qs['sort'](_0x40328c['query']['sort']);_0x6ae012[_0x2d08('0x36')]=qs[_0x2d08('0x37')](_[_0x2d08('0x38')](_0x40328c['query'],_0x10aeea['filters']));if(_0x40328c[_0x2d08('0x2e')][_0x2d08('0x39')]){_0x6ae012[_0x2d08('0x36')]=_['merge'](_0x6ae012[_0x2d08('0x36')],{'$or':_[_0x2d08('0x2d')](_0x6ae012[_0x2d08('0x31')],function(_0x4016d1){var _0x2d231c={};_0x2d231c[_0x4016d1]={'$like':'%'+_0x40328c[_0x2d08('0x2e')][_0x2d08('0x39')]+'%'};return _0x2d231c;})});}_0x6ae012=_['merge']({},_0x6ae012,_0x40328c['options']);return _0x291b17['getDescriptions'](_0x6ae012);}})['then'](function(_0x987921){if(_0x987921){_0x37f241=_0x987921[_0x2d08('0x33')];if(!_0x40328c[_0x2d08('0x2e')][_0x2d08('0x4c')](_0x2d08('0x34'))){_0x6ae012[_0x2d08('0x1e')]=qs[_0x2d08('0x1e')](_0x40328c[_0x2d08('0x2e')][_0x2d08('0x1e')]);_0x6ae012[_0x2d08('0x1c')]=qs[_0x2d08('0x1c')](_0x40328c[_0x2d08('0x2e')]['offset']);}return _0x291b17[_0x2d08('0x4f')](_0x6ae012);}})['then'](function(_0x2df608){if(_0x2df608){return _0x2df608?{'count':_0x37f241,'rows':_0x2df608}:null;}})[_0x2d08('0x24')](respondWithResult(_0x581962,null))[_0x2d08('0x41')](handleError(_0x581962,null));};exports['getTags']=function(_0x1531a1,_0x218cde,_0x5e7b38){var _0x33e2c7={};var _0x5780b0={};var _0xd05004;var _0x16f6de;return db[_0x2d08('0x2a')][_0x2d08('0x4e')]({'where':{'id':_0x1531a1[_0x2d08('0x43')]['id']}})[_0x2d08('0x24')](handleEntityNotFound(_0x218cde,null))[_0x2d08('0x24')](function(_0x28ea84){if(_0x28ea84){_0xd05004=_0x28ea84;_0x5780b0[_0x2d08('0x2c')]=_['keys'](db['Tag'][_0x2d08('0x44')]);_0x5780b0['query']=_[_0x2d08('0x2f')](_0x1531a1[_0x2d08('0x2e')]);_0x5780b0[_0x2d08('0x37')]=_[_0x2d08('0x30')](_0x5780b0[_0x2d08('0x2c')],_0x5780b0[_0x2d08('0x2e')]);_0x33e2c7[_0x2d08('0x31')]=_['intersection'](_0x5780b0['model'],qs['fields'](_0x1531a1[_0x2d08('0x2e')]['fields']));_0x33e2c7[_0x2d08('0x31')]=_0x33e2c7[_0x2d08('0x31')][_0x2d08('0x33')]?_0x33e2c7[_0x2d08('0x31')]:_0x5780b0[_0x2d08('0x2c')];_0x33e2c7[_0x2d08('0x4b')]=qs['sort'](_0x1531a1[_0x2d08('0x2e')]['sort']);_0x33e2c7['where']=qs[_0x2d08('0x37')](_[_0x2d08('0x38')](_0x1531a1['query'],_0x5780b0[_0x2d08('0x37')]));if(_0x1531a1[_0x2d08('0x2e')][_0x2d08('0x39')]){_0x33e2c7[_0x2d08('0x36')]=_[_0x2d08('0x3b')](_0x33e2c7['where'],{'$or':_['map'](_0x33e2c7['attributes'],function(_0x5395df){var _0x34ace0={};_0x34ace0[_0x5395df]={'$like':'%'+_0x1531a1[_0x2d08('0x2e')]['filter']+'%'};return _0x34ace0;})});}_0x33e2c7=_[_0x2d08('0x3b')]({},_0x33e2c7,_0x1531a1['options']);return _0xd05004[_0x2d08('0x50')](_0x33e2c7);}})['then'](function(_0x59171e){if(_0x59171e){_0x16f6de=_0x59171e[_0x2d08('0x33')];if(!_0x1531a1['query'][_0x2d08('0x4c')]('nolimit')){_0x33e2c7[_0x2d08('0x1e')]=qs[_0x2d08('0x1e')](_0x1531a1[_0x2d08('0x2e')][_0x2d08('0x1e')]);_0x33e2c7[_0x2d08('0x1c')]=qs['offset'](_0x1531a1['query'][_0x2d08('0x1c')]);}return _0xd05004[_0x2d08('0x50')](_0x33e2c7);}})[_0x2d08('0x24')](function(_0x6392d7){if(_0x6392d7){return _0x6392d7?{'count':_0x16f6de,'rows':_0x6392d7}:null;}})[_0x2d08('0x24')](respondWithResult(_0x218cde,null))['catch'](handleError(_0x218cde,null));};exports[_0x2d08('0x51')]=function(_0x398af0,_0x1e5fbd,_0x4c2bc7){if(_0x398af0['body']['id']){delete _0x398af0[_0x2d08('0x47')]['id'];}return db[_0x2d08('0x2a')]['findOne']({'where':{'id':_0x398af0[_0x2d08('0x43')]['id']}})[_0x2d08('0x24')](handleEntityNotFound(_0x1e5fbd,null))[_0x2d08('0x24')](function(_0x5df7e6){if(_0x5df7e6){return _0x5df7e6['setTags'](_0x398af0['body']['ids']||[]);}return null;})['then'](respondWithResult(_0x1e5fbd,null))[_0x2d08('0x41')](handleError(_0x1e5fbd,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index a964096..5938f3f 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 _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 +var _0x7f1a=['bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','api','moment'];(function(_0x2b576b,_0xaf8e4a){var _0x1c26d1=function(_0x5b14d0){while(--_0x5b14d0){_0x2b576b['push'](_0x2b576b['shift']());}};_0x1c26d1(++_0xaf8e4a);}(_0x7f1a,0x15a));var _0xa7f1=function(_0x21da56,_0x531348){_0x21da56=_0x21da56-0x0;var _0x4a6d9c=_0x7f1a[_0x21da56];return _0x4a6d9c;};'use strict';var _=require(_0xa7f1('0x0'));var util=require(_0xa7f1('0x1'));var logger=require('../../config/logger')(_0xa7f1('0x2'));var moment=require(_0xa7f1('0x3'));var BPromise=require(_0xa7f1('0x4'));var rp=require(_0xa7f1('0x5'));var fs=require('fs');var path=require(_0xa7f1('0x6'));var rimraf=require(_0xa7f1('0x7'));var config=require(_0xa7f1('0x8'));var attributes=require(_0xa7f1('0x9'));module[_0xa7f1('0xa')]=function(_0x202c02,_0x4953b7){return _0x202c02[_0xa7f1('0xb')](_0xa7f1('0xc'),attributes,{'tableName':_0xa7f1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 8e4268b..9e658af 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 _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 +var _0xb955=['../../config/environment','jayson/promise','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x27f700,_0x587393){var _0x57d0d1=function(_0x5096c7){while(--_0x5096c7){_0x27f700['push'](_0x27f700['shift']());}};_0x57d0d1(++_0x587393);}(_0xb955,0x123));var _0x5b95=function(_0x575bdb,_0x57a5a1){_0x575bdb=_0x575bdb-0x0;var _0x519678=_0xb955[_0x575bdb];return _0x519678;};'use strict';var _=require(_0x5b95('0x0'));var util=require(_0x5b95('0x1'));var moment=require(_0x5b95('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5b95('0x3'));var db=require(_0x5b95('0x4'))['db'];var utils=require(_0x5b95('0x5'));var logger=require(_0x5b95('0x6'))(_0x5b95('0x7'));var config=require(_0x5b95('0x8'));var jayson=require(_0x5b95('0x9'));var client=jayson[_0x5b95('0xa')][_0x5b95('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x392ee2,_0x4eb97a,_0xf02d99){return new BPromise(function(_0x23ee42,_0x4b0744){return client['request'](_0x392ee2,_0xf02d99)[_0x5b95('0xc')](function(_0x2bca40){logger[_0x5b95('0xd')](_0x5b95('0xe'),_0x4eb97a,_0x5b95('0xf'));logger[_0x5b95('0x10')](_0x5b95('0x11'),_0x4eb97a,'request\x20sent',JSON[_0x5b95('0x12')](_0x2bca40));if(_0x2bca40['error']){if(_0x2bca40[_0x5b95('0x13')][_0x5b95('0x14')]===0x1f4){logger[_0x5b95('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x4eb97a,_0x2bca40[_0x5b95('0x13')][_0x5b95('0x15')]);return _0x4b0744(_0x2bca40[_0x5b95('0x13')]['message']);}logger[_0x5b95('0x13')](_0x5b95('0xe'),_0x4eb97a,_0x2bca40[_0x5b95('0x13')]['message']);return _0x23ee42(_0x2bca40[_0x5b95('0x13')][_0x5b95('0x15')]);}else{logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x4eb97a,_0x5b95('0xf'));_0x23ee42(_0x2bca40['result'][_0x5b95('0x15')]);}})[_0x5b95('0x16')](function(_0x79abc5){logger[_0x5b95('0x13')](_0x5b95('0xe'),_0x4eb97a,_0x79abc5);_0x4b0744(_0x79abc5);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index c5cfc92..6ae86d1 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 _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 +var _0x6796=['../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x118a12,_0x323a33){var _0x3da036=function(_0x28d39d){while(--_0x28d39d){_0x118a12['push'](_0x118a12['shift']());}};_0x3da036(++_0x323a33);}(_0x6796,0x66));var _0x6679=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0x6796[_0x4dcc2d];return _0x1bbd79;};'use strict';var multer=require(_0x6679('0x0'));var util=require('util');var path=require(_0x6679('0x1'));var timeout=require(_0x6679('0x2'));var express=require('express');var router=express[_0x6679('0x3')]();var fs_extra=require(_0x6679('0x4'));var auth=require(_0x6679('0x5'));var interaction=require(_0x6679('0x6'));var config=require(_0x6679('0x7'));var controller=require(_0x6679('0x8'));router[_0x6679('0x9')]('/',auth[_0x6679('0xa')](),controller['index']);router[_0x6679('0x9')](_0x6679('0xb'),auth[_0x6679('0xa')](),controller[_0x6679('0xc')]);router[_0x6679('0xd')]('/',auth['isAuthenticated'](),controller[_0x6679('0xe')]);router[_0x6679('0xf')]('/:id',auth[_0x6679('0xa')](),controller[_0x6679('0x10')]);router['delete'](_0x6679('0xb'),auth['isAuthenticated'](),controller[_0x6679('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index bd6bc31..65d91fa 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 _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 +var _0xd908=['ENUM','string','variable','customVariable','keyValue','STRING','sequelize','exports'];(function(_0x17a33e,_0x1b38fe){var _0x4801d0=function(_0x23fb6a){while(--_0x23fb6a){_0x17a33e['push'](_0x17a33e['shift']());}};_0x4801d0(++_0x1b38fe);}(_0xd908,0x1ce));var _0x8d90=function(_0x2efd88,_0x5f26d0){_0x2efd88=_0x2efd88-0x0;var _0x1311da=_0xd908[_0x2efd88];return _0x1311da;};'use strict';var Sequelize=require(_0x8d90('0x0'));module[_0x8d90('0x1')]={'type':{'type':Sequelize[_0x8d90('0x2')](_0x8d90('0x3'),_0x8d90('0x4'),_0x8d90('0x5'),_0x8d90('0x6'),'picklist'),'defaultValue':_0x8d90('0x3')},'content':{'type':Sequelize[_0x8d90('0x7')]},'key':{'type':Sequelize[_0x8d90('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x8d90('0x3'),_0x8d90('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x8d90('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8d90('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8d90('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 334199a..ac7d8e6 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 _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 +var _0x1be0=['jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','DeskField','includeAll','findAll','rows','catch','show','params','include','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto'];(function(_0x2ceb3c,_0x1fba66){var _0xc009a5=function(_0x1b8df0){while(--_0x1b8df0){_0x2ceb3c['push'](_0x2ceb3c['shift']());}};_0xc009a5(++_0x1fba66);}(_0x1be0,0x16b));var _0x01be=function(_0x23c5bf,_0x38a350){_0x23c5bf=_0x23c5bf-0x0;var _0x597e78=_0x1be0[_0x23c5bf];return _0x597e78;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x01be('0x0'));var zipdir=require(_0x01be('0x1'));var jsonpatch=require(_0x01be('0x2'));var rp=require(_0x01be('0x3'));var moment=require('moment');var BPromise=require(_0x01be('0x4'));var Mustache=require(_0x01be('0x5'));var util=require(_0x01be('0x6'));var path=require(_0x01be('0x7'));var sox=require('sox');var csv=require(_0x01be('0x8'));var ejs=require(_0x01be('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x01be('0xa'));var crypto=require(_0x01be('0xb'));var jsforce=require(_0x01be('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x01be('0x8'));var querystring=require(_0x01be('0xd'));var Papa=require(_0x01be('0xe'));var Redis=require(_0x01be('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x01be('0x10'));var logger=require(_0x01be('0x11'))(_0x01be('0x12'));var utils=require(_0x01be('0x13'));var config=require(_0x01be('0x14'));var licenseUtil=require(_0x01be('0x15'));var db=require(_0x01be('0x16'))['db'];function respondWithStatusCode(_0x6146b5,_0x500b61){_0x500b61=_0x500b61||0xcc;return function(_0x5e4bb0){if(_0x5e4bb0){return _0x6146b5[_0x01be('0x17')](_0x500b61);}return _0x6146b5[_0x01be('0x18')](_0x500b61)['end']();};}function respondWithResult(_0x2c3f74,_0x4a13bc){_0x4a13bc=_0x4a13bc||0xc8;return function(_0x2ef2b6){if(_0x2ef2b6){return _0x2c3f74[_0x01be('0x18')](_0x4a13bc)[_0x01be('0x19')](_0x2ef2b6);}};}function respondWithFilteredResult(_0x18fb14,_0xf63424){return function(_0x126595){if(_0x126595){var _0x138315=typeof _0xf63424[_0x01be('0x1a')]===_0x01be('0x1b')&&typeof _0xf63424[_0x01be('0x1c')]===_0x01be('0x1b');var _0x30e167=_0x126595[_0x01be('0x1d')];var _0x4bb952=_0x138315?0x0:_0xf63424['offset'];var _0x5870b5=_0x138315?_0x126595[_0x01be('0x1d')]:_0xf63424[_0x01be('0x1a')]+_0xf63424[_0x01be('0x1c')];var _0x5845d8;if(_0x5870b5>=_0x30e167){_0x5870b5=_0x30e167;_0x5845d8=0xc8;}else{_0x5845d8=0xce;}_0x18fb14['status'](_0x5845d8);return _0x18fb14[_0x01be('0x1e')](_0x01be('0x1f'),_0x4bb952+'-'+_0x5870b5+'/'+_0x30e167)[_0x01be('0x19')](_0x126595);}return null;};}function patchUpdates(_0x2cbcdf){return function(_0x10e2fe){try{jsonpatch[_0x01be('0x20')](_0x10e2fe,_0x2cbcdf,!![]);}catch(_0x187bf3){return BPromise[_0x01be('0x21')](_0x187bf3);}return _0x10e2fe[_0x01be('0x22')]();};}function saveUpdates(_0x6502c2,_0x3ac7f1){return function(_0x2569a3){if(_0x2569a3){return _0x2569a3[_0x01be('0x23')](_0x6502c2)[_0x01be('0x24')](function(_0x40cf97){return _0x40cf97;});}return null;};}function removeEntity(_0x2819cf,_0x11c019){return function(_0x1dc049){if(_0x1dc049){return _0x1dc049[_0x01be('0x25')]()[_0x01be('0x24')](function(){_0x2819cf[_0x01be('0x18')](0xcc)[_0x01be('0x26')]();});}};}function handleEntityNotFound(_0x405df8,_0xb6f4e1){return function(_0x265ccb){if(!_0x265ccb){_0x405df8[_0x01be('0x17')](0x194);}return _0x265ccb;};}function handleError(_0x1bcfc2,_0x6d8e6b){_0x6d8e6b=_0x6d8e6b||0x1f4;return function(_0x4f32fc){logger[_0x01be('0x27')](_0x4f32fc[_0x01be('0x28')]);if(_0x4f32fc[_0x01be('0x29')]){delete _0x4f32fc[_0x01be('0x29')];}_0x1bcfc2[_0x01be('0x18')](_0x6d8e6b)[_0x01be('0x2a')](_0x4f32fc);};}exports[_0x01be('0x2b')]=function(_0x2d6fef,_0x25abb3){var _0x52e8d8={},_0x5803a9={},_0x13c906={'count':0x0,'rows':[]};var _0x1fbcaf=_[_0x01be('0x2c')](db['DeskField'][_0x01be('0x2d')],function(_0x5d4894){return{'name':_0x5d4894[_0x01be('0x2e')],'type':_0x5d4894[_0x01be('0x2f')]['key']};});_0x5803a9[_0x01be('0x30')]=_[_0x01be('0x2c')](_0x1fbcaf,_0x01be('0x29'));_0x5803a9['query']=_[_0x01be('0x31')](_0x2d6fef['query']);_0x5803a9[_0x01be('0x32')]=_['intersection'](_0x5803a9[_0x01be('0x30')],_0x5803a9[_0x01be('0x33')]);_0x52e8d8[_0x01be('0x34')]=_[_0x01be('0x35')](_0x5803a9[_0x01be('0x30')],qs[_0x01be('0x36')](_0x2d6fef[_0x01be('0x33')][_0x01be('0x36')]));_0x52e8d8[_0x01be('0x34')]=_0x52e8d8['attributes'][_0x01be('0x37')]?_0x52e8d8[_0x01be('0x34')]:_0x5803a9['model'];if(!_0x2d6fef[_0x01be('0x33')][_0x01be('0x38')]('nolimit')){_0x52e8d8[_0x01be('0x1c')]=qs[_0x01be('0x1c')](_0x2d6fef[_0x01be('0x33')]['limit']);_0x52e8d8[_0x01be('0x1a')]=qs[_0x01be('0x1a')](_0x2d6fef[_0x01be('0x33')][_0x01be('0x1a')]);}_0x52e8d8[_0x01be('0x39')]=qs['sort'](_0x2d6fef[_0x01be('0x33')][_0x01be('0x3a')]);_0x52e8d8['where']=qs[_0x01be('0x32')](_[_0x01be('0x3b')](_0x2d6fef[_0x01be('0x33')],_0x5803a9['filters']),_0x1fbcaf);if(_0x2d6fef['query'][_0x01be('0x3c')]){_0x52e8d8[_0x01be('0x3d')]=_[_0x01be('0x3e')](_0x52e8d8[_0x01be('0x3d')],{'$or':_[_0x01be('0x2c')](_0x1fbcaf,function(_0x5ab6e7){if(_0x5ab6e7[_0x01be('0x2f')]!=='VIRTUAL'){var _0x487e3b={};_0x487e3b[_0x5ab6e7[_0x01be('0x29')]]={'$like':'%'+_0x2d6fef[_0x01be('0x33')]['filter']+'%'};return _0x487e3b;}})});}_0x52e8d8=_['merge']({},_0x52e8d8,_0x2d6fef[_0x01be('0x3f')]);var _0x489d22={'where':_0x52e8d8[_0x01be('0x3d')]};return db[_0x01be('0x40')][_0x01be('0x1d')](_0x489d22)[_0x01be('0x24')](function(_0x6e6787){_0x13c906[_0x01be('0x1d')]=_0x6e6787;if(_0x2d6fef[_0x01be('0x33')][_0x01be('0x41')]){_0x52e8d8['include']=[{'all':!![]}];}return db[_0x01be('0x40')][_0x01be('0x42')](_0x52e8d8);})[_0x01be('0x24')](function(_0x4388c0){_0x13c906[_0x01be('0x43')]=_0x4388c0;return _0x13c906;})['then'](respondWithFilteredResult(_0x25abb3,_0x52e8d8))[_0x01be('0x44')](handleError(_0x25abb3,null));};exports[_0x01be('0x45')]=function(_0x1c2290,_0x1be4e2){var _0x35f7ae={'raw':!![],'where':{'id':_0x1c2290[_0x01be('0x46')]['id']}},_0x1ec7b5={};_0x1ec7b5['model']=_['keys'](db[_0x01be('0x40')][_0x01be('0x2d')]);_0x1ec7b5['query']=_[_0x01be('0x31')](_0x1c2290[_0x01be('0x33')]);_0x1ec7b5[_0x01be('0x32')]=_[_0x01be('0x35')](_0x1ec7b5['model'],_0x1ec7b5[_0x01be('0x33')]);_0x35f7ae[_0x01be('0x34')]=_['intersection'](_0x1ec7b5[_0x01be('0x30')],qs['fields'](_0x1c2290['query'][_0x01be('0x36')]));_0x35f7ae[_0x01be('0x34')]=_0x35f7ae[_0x01be('0x34')][_0x01be('0x37')]?_0x35f7ae[_0x01be('0x34')]:_0x1ec7b5[_0x01be('0x30')];if(_0x1c2290[_0x01be('0x33')][_0x01be('0x41')]){_0x35f7ae[_0x01be('0x47')]=[{'all':!![]}];}_0x35f7ae=_[_0x01be('0x3e')]({},_0x35f7ae,_0x1c2290['options']);return db[_0x01be('0x40')]['find'](_0x35f7ae)[_0x01be('0x24')](handleEntityNotFound(_0x1be4e2,null))['then'](respondWithResult(_0x1be4e2,null))[_0x01be('0x44')](handleError(_0x1be4e2,null));};exports[_0x01be('0x48')]=function(_0x376404,_0x534611){return db[_0x01be('0x40')][_0x01be('0x48')](_0x376404[_0x01be('0x49')],{})[_0x01be('0x24')](respondWithResult(_0x534611,0xc9))[_0x01be('0x44')](handleError(_0x534611,null));};exports[_0x01be('0x23')]=function(_0x7acd73,_0x4ce697){if(_0x7acd73[_0x01be('0x49')]['id']){delete _0x7acd73[_0x01be('0x49')]['id'];}return db['DeskField'][_0x01be('0x4a')]({'where':{'id':_0x7acd73['params']['id']}})[_0x01be('0x24')](handleEntityNotFound(_0x4ce697,null))[_0x01be('0x24')](saveUpdates(_0x7acd73[_0x01be('0x49')],null))[_0x01be('0x24')](respondWithResult(_0x4ce697,null))['catch'](handleError(_0x4ce697,null));};exports['destroy']=function(_0x12cdd8,_0x5e136c){return db[_0x01be('0x40')][_0x01be('0x4a')]({'where':{'id':_0x12cdd8[_0x01be('0x46')]['id']}})[_0x01be('0x24')](handleEntityNotFound(_0x5e136c,null))[_0x01be('0x24')](removeEntity(_0x5e136c,null))[_0x01be('0x44')](handleError(_0x5e136c,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index c7297fb..c36634d 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 _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 +var _0x74f2=['../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x74f2,0xcf));var _0x274f=function(_0x43f1e9,_0x113148){_0x43f1e9=_0x43f1e9-0x0;var _0x2dbeb6=_0x74f2[_0x43f1e9];return _0x2dbeb6;};'use strict';var _=require(_0x274f('0x0'));var util=require('util');var logger=require(_0x274f('0x1'))('api');var moment=require('moment');var BPromise=require(_0x274f('0x2'));var rp=require(_0x274f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x274f('0x4'));var config=require(_0x274f('0x5'));var attributes=require('./intDeskField.attributes');module[_0x274f('0x6')]=function(_0x2406c3,_0x367613){return _0x2406c3[_0x274f('0x7')](_0x274f('0x8'),attributes,{'tableName':_0x274f('0x9'),'paranoid':![],'indexes':[{'name':_0x274f('0xa'),'fields':[_0x274f('0xb'),_0x274f('0xc')],'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 7900367..88b5c1e 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 _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 +var _0xb133=['../../config/logger','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x28611e,_0x586726){var _0x530f69=function(_0x407906){while(--_0x407906){_0x28611e['push'](_0x28611e['shift']());}};_0x530f69(++_0x586726);}(_0xb133,0x1f4));var _0x3b13=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb133[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3b13('0x0'));var util=require(_0x3b13('0x1'));var moment=require('moment');var BPromise=require(_0x3b13('0x2'));var rs=require(_0x3b13('0x3'));var fs=require('fs');var Redis=require(_0x3b13('0x4'));var db=require(_0x3b13('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3b13('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3b13('0x7'));var client=jayson[_0x3b13('0x8')][_0x3b13('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f7e34,_0x8865e4,_0x4bcc0a){return new BPromise(function(_0x4cea14,_0x1d4a50){return client[_0x3b13('0xa')](_0x2f7e34,_0x4bcc0a)[_0x3b13('0xb')](function(_0x57400c){logger[_0x3b13('0xc')](_0x3b13('0xd'),_0x8865e4,_0x3b13('0xe'));logger[_0x3b13('0xf')](_0x3b13('0x10'),_0x8865e4,_0x3b13('0xe'),JSON[_0x3b13('0x11')](_0x57400c));if(_0x57400c[_0x3b13('0x12')]){if(_0x57400c[_0x3b13('0x12')][_0x3b13('0x13')]===0x1f4){logger[_0x3b13('0x12')](_0x3b13('0xd'),_0x8865e4,_0x57400c[_0x3b13('0x12')]['message']);return _0x1d4a50(_0x57400c['error'][_0x3b13('0x14')]);}logger['error']('DeskField,\x20%s,\x20%s',_0x8865e4,_0x57400c['error'][_0x3b13('0x14')]);return _0x4cea14(_0x57400c[_0x3b13('0x12')][_0x3b13('0x14')]);}else{logger[_0x3b13('0xc')]('DeskField,\x20%s,\x20%s',_0x8865e4,_0x3b13('0xe'));_0x4cea14(_0x57400c[_0x3b13('0x15')]['message']);}})['catch'](function(_0xde74ab){logger[_0x3b13('0x12')]('DeskField,\x20%s,\x20%s',_0x8865e4,_0xde74ab);_0x1d4a50(_0xde74ab);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 218ceb4..05cd521 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 _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 +var _0x79a9=['delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','index','/:id','isAuthenticated','show','getConfigurations','post','create','/:id/configurations','addConfiguration','put'];(function(_0x143b88,_0x3888bd){var _0x3c095f=function(_0x3dc143){while(--_0x3dc143){_0x143b88['push'](_0x143b88['shift']());}};_0x3c095f(++_0x3888bd);}(_0x79a9,0x120));var _0x979a=function(_0x3dc688,_0x4c604b){_0x3dc688=_0x3dc688-0x0;var _0x26cea2=_0x79a9[_0x3dc688];return _0x26cea2;};'use strict';var multer=require('multer');var util=require(_0x979a('0x0'));var path=require(_0x979a('0x1'));var timeout=require(_0x979a('0x2'));var express=require(_0x979a('0x3'));var router=express[_0x979a('0x4')]();var fs_extra=require(_0x979a('0x5'));var auth=require(_0x979a('0x6'));var interaction=require(_0x979a('0x7'));var config=require('../../config/environment');var controller=require(_0x979a('0x8'));router[_0x979a('0x9')]('/',auth['isAuthenticated'](),controller[_0x979a('0xa')]);router['get'](_0x979a('0xb'),auth[_0x979a('0xc')](),controller[_0x979a('0xd')]);router[_0x979a('0x9')]('/:id/configurations',auth[_0x979a('0xc')](),controller[_0x979a('0xe')]);router[_0x979a('0x9')]('/:id/fields',auth[_0x979a('0xc')](),controller['getFields']);router[_0x979a('0xf')]('/',auth[_0x979a('0xc')](),controller[_0x979a('0x10')]);router[_0x979a('0xf')](_0x979a('0x11'),auth[_0x979a('0xc')](),controller[_0x979a('0x12')]);router[_0x979a('0x13')](_0x979a('0xb'),auth[_0x979a('0xc')](),controller['update']);router[_0x979a('0x14')](_0x979a('0xb'),auth[_0x979a('0xc')](),controller[_0x979a('0x15')]);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 7d87e85..649b2f7 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 _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 +var _0x42b0=['sequelize','exports','STRING','BOOLEAN'];(function(_0x450bf9,_0x1895de){var _0x268350=function(_0xebafa7){while(--_0xebafa7){_0x450bf9['push'](_0x450bf9['shift']());}};_0x268350(++_0x1895de);}(_0x42b0,0xbc));var _0x042b=function(_0x86ca04,_0x77ec8c){_0x86ca04=_0x86ca04-0x0;var _0x3c4a3b=_0x42b0[_0x86ca04];return _0x3c4a3b;};'use strict';var Sequelize=require(_0x042b('0x0'));module[_0x042b('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x042b('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x042b('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x042b('0x2')]},'serverUrl':{'type':Sequelize[_0x042b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x042b('0x2')]},'modernAuthentication':{'type':Sequelize[_0x042b('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 6c73995..3aa0173 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 _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 +var _0x1b3e=['description','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_url','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','prioritycodename','productidname','productserialnumber','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','concat','username','password','remoteUri','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','POST','tenantId','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','Attributes','remove','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','Wrong\x20credentials','statusCode',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','Value','UserLocalizedLabel','EntityDefinitions(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.','../../components/parsers/qs','api','../../components/integrations/configuration','offset','undefined','limit','count','status','set','Content-Range','json','update','then','destroy','sendStatus','error','stack','name','send','index','Dynamics365Account','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','nolimit','sort','filter','merge','where','options','includeAll','include','rows','show','params','length','find','catch','create','body','getConfigurations','findOne','order','map','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Subjects','slice','lastIndexOf','ticketType','incident','PhoneCall','title'];(function(_0x381372,_0xf0a5a){var _0x4e959a=function(_0x25a897){while(--_0x25a897){_0x381372['push'](_0x381372['shift']());}};_0x4e959a(++_0xf0a5a);}(_0x1b3e,0x128));var _0xe1b3=function(_0x1d0572,_0x888496){_0x1d0572=_0x1d0572-0x0;var _0x25b576=_0x1b3e[_0x1d0572];return _0x25b576;};'use strict';var rp=require('request-promise');var util=require('util');var _=require('lodash');var qs=require(_0xe1b3('0x0'));var logger=require('../../config/logger')(_0xe1b3('0x1'));var db=require('../../mysqldb')['db'];var integrations=require(_0xe1b3('0x2'));function respondWithResult(_0x2a334a,_0xcb92e0){_0xcb92e0=_0xcb92e0||0xc8;return function(_0x324877){if(_0x324877){return _0x2a334a['status'](_0xcb92e0)['json'](_0x324877);}};}function respondWithFilteredResult(_0x163170,_0x2d2b89){return function(_0x50f3f8){if(_0x50f3f8){var _0x4650f1=typeof _0x2d2b89[_0xe1b3('0x3')]===_0xe1b3('0x4')&&typeof _0x2d2b89[_0xe1b3('0x5')]===_0xe1b3('0x4');var _0x41e7ee=_0x50f3f8[_0xe1b3('0x6')];var _0x18259c=_0x4650f1?0x0:_0x2d2b89['offset'];var _0x27ad5a=_0x4650f1?_0x50f3f8[_0xe1b3('0x6')]:_0x2d2b89[_0xe1b3('0x3')]+_0x2d2b89[_0xe1b3('0x5')];var _0x3c73f7;if(_0x27ad5a>=_0x41e7ee){_0x27ad5a=_0x41e7ee;_0x3c73f7=0xc8;}else{_0x3c73f7=0xce;}_0x163170[_0xe1b3('0x7')](_0x3c73f7);return _0x163170[_0xe1b3('0x8')](_0xe1b3('0x9'),_0x18259c+'-'+_0x27ad5a+'/'+_0x41e7ee)[_0xe1b3('0xa')](_0x50f3f8);}return null;};}function saveUpdates(_0x110e68){return function(_0x5128e2){if(_0x5128e2){return _0x5128e2[_0xe1b3('0xb')](_0x110e68)[_0xe1b3('0xc')](function(_0x509441){return _0x509441;});}return null;};}function removeEntity(_0x4aeaef){return function(_0x398814){if(_0x398814){return _0x398814[_0xe1b3('0xd')]()[_0xe1b3('0xc')](function(){_0x4aeaef[_0xe1b3('0x7')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4403ca){return function(_0x3ecd12){if(!_0x3ecd12){_0x4403ca[_0xe1b3('0xe')](0x194);}return _0x3ecd12;};}function handleError(_0x391a8b,_0x31e063){_0x31e063=_0x31e063||0x1f4;return function(_0x25a2a3){logger[_0xe1b3('0xf')](_0x25a2a3[_0xe1b3('0x10')]);if(_0x25a2a3[_0xe1b3('0x11')]){delete _0x25a2a3[_0xe1b3('0x11')];}_0x391a8b[_0xe1b3('0x7')](_0x31e063)[_0xe1b3('0x12')](_0x25a2a3);};}exports[_0xe1b3('0x13')]=function(_0x399751,_0x40bf7a){var _0x1434df={},_0x33589c={},_0x45cbfc={'count':0x0,'rows':[]};var _0x3a7712=_['map'](db[_0xe1b3('0x14')][_0xe1b3('0x15')],function(_0x2bae47){return{'name':_0x2bae47[_0xe1b3('0x16')],'type':_0x2bae47[_0xe1b3('0x17')]['key']};});_0x33589c[_0xe1b3('0x18')]=_['map'](_0x3a7712,_0xe1b3('0x11'));_0x33589c['query']=_[_0xe1b3('0x19')](_0x399751[_0xe1b3('0x1a')]);_0x33589c[_0xe1b3('0x1b')]=_[_0xe1b3('0x1c')](_0x33589c[_0xe1b3('0x18')],_0x33589c['query']);_0x1434df[_0xe1b3('0x1d')]=_[_0xe1b3('0x1c')](_0x33589c['model'],qs[_0xe1b3('0x1e')](_0x399751[_0xe1b3('0x1a')][_0xe1b3('0x1e')]));_0x1434df[_0xe1b3('0x1d')]=_0x1434df[_0xe1b3('0x1d')]['length']?_0x1434df[_0xe1b3('0x1d')]:_0x33589c[_0xe1b3('0x18')];if(!_0x399751[_0xe1b3('0x1a')]['hasOwnProperty'](_0xe1b3('0x1f'))){_0x1434df[_0xe1b3('0x5')]=qs[_0xe1b3('0x5')](_0x399751['query'][_0xe1b3('0x5')]);_0x1434df['offset']=qs[_0xe1b3('0x3')](_0x399751[_0xe1b3('0x1a')][_0xe1b3('0x3')]);}_0x1434df['order']=qs[_0xe1b3('0x20')](_0x399751[_0xe1b3('0x1a')]['sort']);_0x1434df['where']=qs[_0xe1b3('0x1b')](_['pick'](_0x399751[_0xe1b3('0x1a')],_0x33589c[_0xe1b3('0x1b')]),_0x3a7712);if(_0x399751['query'][_0xe1b3('0x21')]){_0x1434df['where']=_[_0xe1b3('0x22')](_0x1434df[_0xe1b3('0x23')],{'$or':_['map'](_0x3a7712,function(_0x433769){if(_0x433769[_0xe1b3('0x17')]!=='VIRTUAL'){var _0x4cae52={};_0x4cae52[_0x433769[_0xe1b3('0x11')]]={'$like':'%'+_0x399751['query'][_0xe1b3('0x21')]+'%'};return _0x4cae52;}})});}_0x1434df=_[_0xe1b3('0x22')]({},_0x1434df,_0x399751[_0xe1b3('0x24')]);var _0x419b4d={'where':_0x1434df['where']};return db[_0xe1b3('0x14')][_0xe1b3('0x6')](_0x419b4d)[_0xe1b3('0xc')](function(_0x2b4bd5){_0x45cbfc['count']=_0x2b4bd5;if(_0x399751[_0xe1b3('0x1a')][_0xe1b3('0x25')]){_0x1434df[_0xe1b3('0x26')]=[{'all':!![]}];}return db[_0xe1b3('0x14')]['findAll'](_0x1434df);})[_0xe1b3('0xc')](function(_0x589b7a){_0x45cbfc[_0xe1b3('0x27')]=_0x589b7a;return _0x45cbfc;})[_0xe1b3('0xc')](respondWithFilteredResult(_0x40bf7a,_0x1434df))['catch'](handleError(_0x40bf7a,null));};exports[_0xe1b3('0x28')]=function(_0x4fd65a,_0x29762f){var _0x56d626={'raw':![],'where':{'id':_0x4fd65a[_0xe1b3('0x29')]['id']}},_0x3a091f={};_0x3a091f['model']=_[_0xe1b3('0x19')](db['Dynamics365Account'][_0xe1b3('0x15')]);_0x3a091f[_0xe1b3('0x1a')]=_[_0xe1b3('0x19')](_0x4fd65a['query']);_0x3a091f[_0xe1b3('0x1b')]=_['intersection'](_0x3a091f[_0xe1b3('0x18')],_0x3a091f[_0xe1b3('0x1a')]);_0x56d626['attributes']=_[_0xe1b3('0x1c')](_0x3a091f[_0xe1b3('0x18')],qs['fields'](_0x4fd65a[_0xe1b3('0x1a')][_0xe1b3('0x1e')]));_0x56d626[_0xe1b3('0x1d')]=_0x56d626[_0xe1b3('0x1d')][_0xe1b3('0x2a')]?_0x56d626[_0xe1b3('0x1d')]:_0x3a091f[_0xe1b3('0x18')];if(_0x4fd65a[_0xe1b3('0x1a')]['includeAll']){_0x56d626['include']=[{'all':!![]}];}_0x56d626=_['merge']({},_0x56d626,_0x4fd65a[_0xe1b3('0x24')]);return db[_0xe1b3('0x14')][_0xe1b3('0x2b')](_0x56d626)[_0xe1b3('0xc')](handleEntityNotFound(_0x29762f,null))[_0xe1b3('0xc')](respondWithResult(_0x29762f,null))[_0xe1b3('0x2c')](handleError(_0x29762f,null));};exports[_0xe1b3('0x2d')]=function(_0x146591,_0x165306){return db[_0xe1b3('0x14')][_0xe1b3('0x2d')](_0x146591[_0xe1b3('0x2e')],{})[_0xe1b3('0xc')](respondWithResult(_0x165306,0xc9))[_0xe1b3('0x2c')](handleError(_0x165306,null));};exports[_0xe1b3('0xb')]=function(_0x1c75ae,_0x11daa9){if(_0x1c75ae[_0xe1b3('0x2e')]['id']){delete _0x1c75ae[_0xe1b3('0x2e')]['id'];}return db[_0xe1b3('0x14')][_0xe1b3('0x2b')]({'where':{'id':_0x1c75ae['params']['id']}})[_0xe1b3('0xc')](handleEntityNotFound(_0x11daa9,null))[_0xe1b3('0xc')](saveUpdates(_0x1c75ae[_0xe1b3('0x2e')],null))[_0xe1b3('0xc')](respondWithResult(_0x11daa9,null))['catch'](handleError(_0x11daa9,null));};exports[_0xe1b3('0xd')]=function(_0x12f02d,_0xa78eb6){return db[_0xe1b3('0x14')][_0xe1b3('0x2b')]({'where':{'id':_0x12f02d[_0xe1b3('0x29')]['id']}})[_0xe1b3('0xc')](handleEntityNotFound(_0xa78eb6,null))[_0xe1b3('0xc')](removeEntity(_0xa78eb6,null))[_0xe1b3('0x2c')](handleError(_0xa78eb6,null));};exports[_0xe1b3('0x2f')]=function(_0x4da0b8,_0x293b58){var _0x44303d={};var _0x5d4629={};var _0x667af6;var _0x2e1fc7;return db[_0xe1b3('0x14')][_0xe1b3('0x30')]({'where':{'id':_0x4da0b8[_0xe1b3('0x29')]['id']}})[_0xe1b3('0xc')](handleEntityNotFound(_0x293b58,null))[_0xe1b3('0xc')](function(_0x58f143){if(_0x58f143){_0x667af6=_0x58f143;_0x5d4629[_0xe1b3('0x18')]=_[_0xe1b3('0x19')](db['Dynamics365Configuration'][_0xe1b3('0x15')]);_0x5d4629[_0xe1b3('0x1a')]=_['keys'](_0x4da0b8[_0xe1b3('0x1a')]);_0x5d4629[_0xe1b3('0x1b')]=_[_0xe1b3('0x1c')](_0x5d4629[_0xe1b3('0x18')],_0x5d4629[_0xe1b3('0x1a')]);_0x44303d[_0xe1b3('0x1d')]=_[_0xe1b3('0x1c')](_0x5d4629[_0xe1b3('0x18')],qs[_0xe1b3('0x1e')](_0x4da0b8[_0xe1b3('0x1a')]['fields']));_0x44303d['attributes']=_0x44303d['attributes'][_0xe1b3('0x2a')]?_0x44303d[_0xe1b3('0x1d')]:_0x5d4629[_0xe1b3('0x18')];_0x44303d[_0xe1b3('0x31')]=qs[_0xe1b3('0x20')](_0x4da0b8['query']['sort']);_0x44303d[_0xe1b3('0x23')]=qs[_0xe1b3('0x1b')](_['pick'](_0x4da0b8[_0xe1b3('0x1a')],_0x5d4629[_0xe1b3('0x1b')]));if(_0x4da0b8['query'][_0xe1b3('0x21')]){_0x44303d[_0xe1b3('0x23')]=_['merge'](_0x44303d[_0xe1b3('0x23')],{'$or':_[_0xe1b3('0x32')](_0x44303d['attributes'],function(_0x4f9f48){var _0x4b7dcc={};_0x4b7dcc[_0x4f9f48]={'$like':'%'+_0x4da0b8['query'][_0xe1b3('0x21')]+'%'};return _0x4b7dcc;})});}_0x44303d=_['merge']({},_0x44303d,_0x4da0b8[_0xe1b3('0x24')]);return _0x667af6[_0xe1b3('0x2f')](_0x44303d);}})[_0xe1b3('0xc')](function(_0x5ac83b){if(_0x5ac83b){_0x2e1fc7=_0x5ac83b[_0xe1b3('0x2a')];if(!_0x4da0b8[_0xe1b3('0x1a')][_0xe1b3('0x33')](_0xe1b3('0x1f'))){_0x44303d[_0xe1b3('0x5')]=qs[_0xe1b3('0x5')](_0x4da0b8[_0xe1b3('0x1a')][_0xe1b3('0x5')]);_0x44303d[_0xe1b3('0x3')]=qs[_0xe1b3('0x3')](_0x4da0b8[_0xe1b3('0x1a')]['offset']);}return _0x667af6['getConfigurations'](_0x44303d);}})[_0xe1b3('0xc')](function(_0x50e5ef){if(_0x50e5ef){return _0x50e5ef?{'count':_0x2e1fc7,'rows':_0x50e5ef}:null;}})[_0xe1b3('0xc')](respondWithResult(_0x293b58,null))[_0xe1b3('0x2c')](handleError(_0x293b58,null));};exports[_0xe1b3('0x34')]=function(_0x4e042c,_0x2dce4c){if(_0x4e042c[_0xe1b3('0x2e')]['id']){delete _0x4e042c[_0xe1b3('0x2e')]['id'];}return db[_0xe1b3('0x14')][_0xe1b3('0x30')]({'where':{'id':_0x4e042c['params']['id']}})['then'](handleEntityNotFound(_0x2dce4c,null))[_0xe1b3('0xc')](function(_0x1e11cf){if(_0x1e11cf){_0x4e042c[_0xe1b3('0x2e')][_0xe1b3('0x35')]=_0x1e11cf['id'];_0x4e042c[_0xe1b3('0x2e')]['Subjects']=integrations[_0xe1b3('0x36')](_0x4e042c['body'][_0xe1b3('0x37')],_0x4e042c[_0xe1b3('0x2e')][_0xe1b3('0x17')]);_0x4e042c[_0xe1b3('0x2e')][_0xe1b3('0x38')]=integrations[_0xe1b3('0x39')](_0x4e042c[_0xe1b3('0x2e')][_0xe1b3('0x37')],_0x4e042c[_0xe1b3('0x2e')]['type']);return db[_0xe1b3('0x3a')]['create'](_0x4e042c['body'],{'include':[{'model':db['Dynamics365Field'],'as':_0xe1b3('0x3b')},{'model':db['Dynamics365Field'],'as':_0xe1b3('0x38')}]});}return null;})[_0xe1b3('0xc')](respondWithResult(_0x2dce4c,null))[_0xe1b3('0x2c')](handleError(_0x2dce4c,null));};function sanitizeRemoteUri(_0x426fed){var _0x7a82a=_0x426fed[_0xe1b3('0x3c')](-0x1);if(_0x7a82a==='/')return _0x426fed['substring'](0x0,_0x426fed[_0xe1b3('0x3d')](_0x7a82a));return _0x426fed;}function getWebApiUrl(_0x217b09){return util['format']('%s/api/data/v9.0/',_0x217b09);}exports['getFields']=function(_0x5b4116,_0x3e592d){var _0x4ab218=_0x5b4116['query'][_0xe1b3('0x3e')];var _0x36f10a=_0x4ab218===_0xe1b3('0x3f')?'Incident':_0xe1b3('0x40');var _0x38877b='';var _0x4d1925='';var _0x43b323='';var _0x4f00ad='';var _0x1671a6='';var _0x57a608='';var _0x25d85e='';var _0x16dce4='';var _0x1fb97c=[_0xe1b3('0x41'),_0xe1b3('0x42'),_0xe1b3('0x43'),_0xe1b3('0x44'),'caseorigincode',_0xe1b3('0x45'),_0xe1b3('0x46'),_0xe1b3('0x47'),_0xe1b3('0x48'),_0xe1b3('0x49')];var _0x243ff8=[_0xe1b3('0x4a'),_0xe1b3('0x4b'),_0xe1b3('0x4c'),_0xe1b3('0x4d'),_0xe1b3('0x4e'),_0xe1b3('0x4f'),_0xe1b3('0x50'),_0xe1b3('0x51'),'createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame',_0xe1b3('0x52'),_0xe1b3('0x53'),_0xe1b3('0x54'),_0xe1b3('0x55'),_0xe1b3('0x56'),'customeridyominame',_0xe1b3('0x57'),_0xe1b3('0x58'),'entityimage_timestamp',_0xe1b3('0x59'),'escalatedon',_0xe1b3('0x5a'),'firstresponsebykpiidname',_0xe1b3('0x5b'),_0xe1b3('0x5c'),_0xe1b3('0x5d'),_0xe1b3('0x5e'),_0xe1b3('0x5f'),_0xe1b3('0x60'),_0xe1b3('0x61'),_0xe1b3('0x62'),_0xe1b3('0x63'),'modifiedbyyominame','modifiedon',_0xe1b3('0x64'),_0xe1b3('0x65'),_0xe1b3('0x66'),_0xe1b3('0x67'),_0xe1b3('0x68'),_0xe1b3('0x69'),'overriddencreatedon',_0xe1b3('0x6a'),_0xe1b3('0x6b'),_0xe1b3('0x6c'),_0xe1b3('0x6d'),'primarycontactidname','primarycontactidyominame',_0xe1b3('0x6e'),_0xe1b3('0x6f'),_0xe1b3('0x70'),'resolveby',_0xe1b3('0x71'),'responseby',_0xe1b3('0x72'),_0xe1b3('0x73'),_0xe1b3('0x74'),'slainvokedidname',_0xe1b3('0x75'),'socialprofileidname',_0xe1b3('0x76'),_0xe1b3('0x77'),_0xe1b3('0x78'),_0xe1b3('0x79'),_0xe1b3('0x7a'),'transactioncurrencyidname',_0xe1b3('0x7b'),_0xe1b3('0x7c'),'versionnumber'];var _0x4c2a65=_0x1fb97c[_0xe1b3('0x7d')](_0x243ff8);return db[_0xe1b3('0x14')]['findOne']({'where':{'id':_0x5b4116[_0xe1b3('0x29')]['id']},'attributes':['id',_0xe1b3('0x7e'),_0xe1b3('0x7f'),_0xe1b3('0x80'),'tenantId',_0xe1b3('0x81'),_0xe1b3('0x82'),_0xe1b3('0x83')],'include':[{'model':db[_0xe1b3('0x84')],'as':_0xe1b3('0x84'),'attributes':['id',_0xe1b3('0x85'),'data7']}]})[_0xe1b3('0xc')](handleEntityNotFound(_0x3e592d,null))[_0xe1b3('0xc')](function(_0x1b57d1){if(_0x1b57d1){if(_0x1b57d1['modernAuthentication']){_0x1b57d1['access_token']=_0x1b57d1[_0xe1b3('0x84')][_0xe1b3('0x85')];_0x16dce4=sanitizeRemoteUri(_0x1b57d1[_0xe1b3('0x84')][_0xe1b3('0x86')]);_0x25d85e=getWebApiUrl(_0x16dce4);return _0x1b57d1;}_0x16dce4=sanitizeRemoteUri(_0x1b57d1[_0xe1b3('0x80')]);_0x25d85e=getWebApiUrl(_0x16dce4);var _0xc8892e={'method':_0xe1b3('0x87'),'uri':'https://login.microsoftonline.com/'+_0x1b57d1[_0xe1b3('0x88')]+_0xe1b3('0x89'),'form':{'client_id':_0x1b57d1[_0xe1b3('0x81')],'resource':_0x16dce4,'username':_0x1b57d1[_0xe1b3('0x7e')],'password':_0x1b57d1[_0xe1b3('0x7f')],'grant_type':'password','client_secret':_0x1b57d1[_0xe1b3('0x82')]},'json':!![]};return rp(_0xc8892e);}})[_0xe1b3('0xc')](function(_0x137c85){_0x57a608=_0x137c85[_0xe1b3('0x8a')];var _0x1ba4c5={'method':_0xe1b3('0x8b'),'uri':encodeURI(_0x25d85e+_0xe1b3('0x8c')+_0x36f10a+'\x27'),'headers':{'Authorization':_0xe1b3('0x8d')+_0x57a608,'If-None-Match':null,'OData-Version':_0xe1b3('0x8e')},'json':!![]};return rp(_0x1ba4c5);})[_0xe1b3('0xc')](function(_0x368239){var _0xafffb2=_0x368239['value'][0x0];var _0x302d34=_0xafffb2[_0xe1b3('0x8f')];var _0x259772={'method':_0xe1b3('0x8b'),'uri':_0x25d85e+'EntityDefinitions('+_0x302d34+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xe1b3('0x8d')+_0x57a608,'If-None-Match':null,'OData-Version':_0xe1b3('0x8e')},'json':!![]};return rp(_0x259772);})['then'](function(_0xbb0a66){_0x38877b=_0xbb0a66;_0x4d1925=_0x38877b[_0xe1b3('0x90')];_0x4d1925=_[_0xe1b3('0x91')](_0x4d1925,function(_0x556939){return!_0x4c2a65['includes'](_0x556939[_0xe1b3('0x92')]);});var _0x3f4621=[];var _0x59af3a=[];_0x4d1925[_0xe1b3('0x93')](function(_0x17881d){if(_0x17881d['@odata.type']){var _0x5a2547=_0x17881d[_0xe1b3('0x94')][_0xe1b3('0x95')](_0x17881d[_0xe1b3('0x94')][_0xe1b3('0x3d')]('.')+0x1);if(_0x5a2547===_0xe1b3('0x96')){_0x3f4621[_0xe1b3('0x97')](getSelectList(_0x25d85e,_0x4ab218,_0x59af3a,_0x38877b[_0xe1b3('0x8f')],_0x17881d[_0xe1b3('0x8f')],_0x57a608));}}});return Promise[_0xe1b3('0x98')](_0x3f4621);})['then'](function(_0x3bb705){_0x43b323=_0x3bb705[0x0];var _0xd7d2d3=[];var _0x3858fd=[];_0x4d1925[_0xe1b3('0x93')](function(_0x230114){if(!_[_0xe1b3('0x99')](_0x230114[_0xe1b3('0x94')])){var _0x3fa3cd=_0x230114['@odata.type'][_0xe1b3('0x95')](_0x230114[_0xe1b3('0x94')][_0xe1b3('0x3d')]('.')+0x1);if(_0x3fa3cd===_0xe1b3('0x9a')){_0xd7d2d3[_0xe1b3('0x97')](getBooleanList(_0x25d85e,_0x4ab218,_0x3858fd,_0x38877b['MetadataId'],_0x230114[_0xe1b3('0x8f')],_0x57a608));}}});return Promise[_0xe1b3('0x98')](_0xd7d2d3);})[_0xe1b3('0xc')](function(_0x844639){_0x4f00ad=_0x844639[0x0];var _0x2388a5=[];var _0x184733=[];_0x4d1925[_0xe1b3('0x93')](function(_0x41fcbd){if(_0x41fcbd[_0xe1b3('0x94')]){var _0x2f6fd4=_0x41fcbd[_0xe1b3('0x94')][_0xe1b3('0x95')](_0x41fcbd[_0xe1b3('0x94')][_0xe1b3('0x3d')]('.')+0x1);if(_0x2f6fd4===_0xe1b3('0x9b')||_0x2f6fd4===_0xe1b3('0x9c')||_0x2f6fd4==='BigIntAttributeMetadata'||_0x2f6fd4===_0xe1b3('0x9d')||_0x2f6fd4===_0xe1b3('0x9e')||_0x2f6fd4===_0xe1b3('0x9f')||_0x2f6fd4==='StatusAttributeMetadata'||_0x2f6fd4===_0xe1b3('0xa0')||_0x2f6fd4===_0xe1b3('0xa1')||_0x2f6fd4===_0xe1b3('0xa2')){_0x2388a5[_0xe1b3('0x97')](getInputList(_0x25d85e,_0x4ab218,_0x2f6fd4,_0x184733,_0x38877b['MetadataId'],_0x41fcbd[_0xe1b3('0x8f')],_0x57a608));}}});return Promise[_0xe1b3('0x98')](_0x2388a5);})[_0xe1b3('0xc')](function(_0x160e76){_0x1671a6=_0x160e76[0x0];var _0x481edf=_0x43b323['concat'](_0x4f00ad)[_0xe1b3('0x7d')](_0x1671a6);var _0x42e3dd={'count':_0x481edf[_0xe1b3('0x2a')],'rows':_0x481edf};return _0x42e3dd;})[_0xe1b3('0xc')](respondWithResult(_0x3e592d,null))[_0xe1b3('0x2c')](function(_0x42460c){var _0x391326=_0x5b4116['query']['test']?0x1f4:_0x42460c['statusCode']||0x1f4;logger[_0xe1b3('0xf')](_0x42460c[_0xe1b3('0x10')]);delete _0x42460c[_0xe1b3('0x11')];if(_0x391326===0x191){_0x391326=0x190;}_0x3e592d[_0xe1b3('0x7')](_0x391326)['send'](_0x5b4116[_0xe1b3('0x1a')][_0xe1b3('0xa3')]?{'message':_0xe1b3('0xa4'),'statusCode':_0x42460c[_0xe1b3('0xa5')]}:_0x42460c);});};function getSelectList(_0x27a8b1,_0x16b576,_0x1ec0b2,_0xda711b,_0x4ceb07,_0x1d1fc9){var _0x2a993f={'method':_0xe1b3('0x8b'),'uri':_0x27a8b1+'EntityDefinitions('+_0xda711b+')/Attributes('+_0x4ceb07+_0xe1b3('0xa6')+_0xe1b3('0xa7'),'headers':{'Authorization':'Bearer\x20'+_0x1d1fc9,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2a993f)['then'](function(_0x34de0a){var _0xa52a4c=[];var _0x314f9b=_0x34de0a['OptionSet'][_0xe1b3('0xa8')];_0x314f9b[_0xe1b3('0x93')](function(_0x481947){_0xa52a4c[_0xe1b3('0x97')]({'name':_0x481947[_0xe1b3('0xa9')]['UserLocalizedLabel'][_0xe1b3('0xa9')],'value':String(_0x481947[_0xe1b3('0xaa')])});});var _0x2d47f0={'id':_0x16b576+'_'+_0x34de0a[_0xe1b3('0x92')],'name':_0x34de0a['DisplayName'][_0xe1b3('0xab')][_0xe1b3('0xa9')],'custom':![],'options':_0xa52a4c};_0x1ec0b2['push'](_0x2d47f0);return _0x1ec0b2;});}function getBooleanList(_0x2631e9,_0xf6e6,_0x1791ab,_0x5e6d93,_0x3b1729,_0x26dcb6){var _0x3daddf={'method':'GET','uri':_0x2631e9+_0xe1b3('0xac')+_0x5e6d93+')/Attributes('+_0x3b1729+_0xe1b3('0xad'),'headers':{'Authorization':'Bearer\x20'+_0x26dcb6,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3daddf)[_0xe1b3('0xc')](function(_0x31ff3c){var _0x35d019=[];_0x35d019[_0xe1b3('0x97')]({'name':_0x31ff3c[_0xe1b3('0xae')][_0xe1b3('0xaf')][_0xe1b3('0xa9')]['UserLocalizedLabel']['Label'],'value':_0xe1b3('0xb0')},{'name':_0x31ff3c[_0xe1b3('0xae')][_0xe1b3('0xb1')][_0xe1b3('0xa9')][_0xe1b3('0xab')]['Label'],'value':'false'});var _0x14b358={'id':_0xf6e6+'_'+_0x31ff3c[_0xe1b3('0x92')],'name':_0x31ff3c[_0xe1b3('0xb2')][_0xe1b3('0xab')][_0xe1b3('0xa9')],'custom':![],'options':_0x35d019};_0x1791ab[_0xe1b3('0x97')](_0x14b358);return _0x1791ab;});}function getInputList(_0x5bc91e,_0x244db8,_0x526fbe,_0x292089,_0x351d5e,_0x50bafc,_0x27f57b){var _0x57bc67={'method':_0xe1b3('0x8b'),'uri':_0x5bc91e+_0xe1b3('0xac')+_0x351d5e+_0xe1b3('0xb3')+_0x50bafc+_0xe1b3('0xb4')+_0x526fbe+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xe1b3('0x8d')+_0x27f57b,'If-None-Match':null,'OData-Version':_0xe1b3('0x8e')},'json':!![]};return rp(_0x57bc67)[_0xe1b3('0xc')](function(_0x467c22){var _0x592b4b={'id':_0x244db8+'_'+_0x467c22[_0xe1b3('0x92')],'name':_0x467c22[_0xe1b3('0xb2')][_0xe1b3('0xab')]?_0x467c22[_0xe1b3('0xb2')]['UserLocalizedLabel'][_0xe1b3('0xa9')]:_0x467c22[_0xe1b3('0x92')],'custom':![],'options':[]};_0x292089[_0xe1b3('0x97')](_0x592b4b);return _0x292089;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 1dc446a..e47d73f 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_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 +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x51f963,_0x419a3b){var _0x31ed94=function(_0x49f923){while(--_0x49f923){_0x51f963['push'](_0x51f963['shift']());}};_0x31ed94(++_0x419a3b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 9c2835e..78a594f 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 _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 +var _0x1727=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','limit','include','map','model','attributes','ShowDynamics365Account','find','where'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x1727,0x172));var _0x7172=function(_0x137fab,_0x2900ed){_0x137fab=_0x137fab-0x0;var _0x128d08=_0x1727[_0x137fab];return _0x128d08;};'use strict';var _=require(_0x7172('0x0'));var util=require(_0x7172('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7172('0x2'));var fs=require('fs');var Redis=require(_0x7172('0x3'));var db=require(_0x7172('0x4'))['db'];var utils=require(_0x7172('0x5'));var logger=require(_0x7172('0x6'))(_0x7172('0x7'));var config=require(_0x7172('0x8'));var jayson=require(_0x7172('0x9'));var client=jayson[_0x7172('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe4a74a,_0x420bcb,_0x411632){return new BPromise(function(_0x147be6,_0x52d010){return client[_0x7172('0xb')](_0xe4a74a,_0x411632)[_0x7172('0xc')](function(_0x579933){logger[_0x7172('0xd')](_0x7172('0xe'),_0x420bcb,_0x7172('0xf'));logger[_0x7172('0x10')](_0x7172('0x11'),_0x420bcb,_0x7172('0xf'),JSON[_0x7172('0x12')](_0x579933));if(_0x579933[_0x7172('0x13')]){if(_0x579933[_0x7172('0x13')][_0x7172('0x14')]===0x1f4){logger[_0x7172('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x420bcb,_0x579933[_0x7172('0x13')][_0x7172('0x15')]);return _0x52d010(_0x579933[_0x7172('0x13')]['message']);}logger['error'](_0x7172('0xe'),_0x420bcb,_0x579933[_0x7172('0x13')]['message']);return _0x147be6(_0x579933[_0x7172('0x13')]['message']);}else{logger[_0x7172('0xd')](_0x7172('0xe'),_0x420bcb,_0x7172('0xf'));_0x147be6(_0x579933[_0x7172('0x16')]['message']);}})[_0x7172('0x17')](function(_0x30b3ec){logger[_0x7172('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x420bcb,_0x30b3ec);_0x52d010(_0x30b3ec);});});}exports[_0x7172('0x18')]=function(_0x4c6b2d){var _0x3ca2df=this;return new Promise(function(_0x222568,_0x3dc6f4){return db[_0x7172('0x19')][_0x7172('0x1a')]({'raw':_0x4c6b2d[_0x7172('0x1b')]?_0x4c6b2d[_0x7172('0x1b')][_0x7172('0x1c')]===undefined?!![]:![]:!![],'where':_0x4c6b2d[_0x7172('0x1b')]?_0x4c6b2d[_0x7172('0x1b')]['where']||null:null,'attributes':_0x4c6b2d[_0x7172('0x1b')]?_0x4c6b2d['options']['attributes']||null:null,'limit':_0x4c6b2d[_0x7172('0x1b')]?_0x4c6b2d[_0x7172('0x1b')][_0x7172('0x1d')]||null:null,'include':_0x4c6b2d['options']?_0x4c6b2d[_0x7172('0x1b')][_0x7172('0x1e')]?_[_0x7172('0x1f')](_0x4c6b2d[_0x7172('0x1b')]['include'],function(_0x2fec1a){return{'model':db[_0x2fec1a[_0x7172('0x20')]],'as':_0x2fec1a['as'],'attributes':_0x2fec1a[_0x7172('0x21')],'include':_0x2fec1a[_0x7172('0x1e')]?_[_0x7172('0x1f')](_0x2fec1a[_0x7172('0x1e')],function(_0x134559){return{'model':db[_0x134559[_0x7172('0x20')]],'as':_0x134559['as'],'attributes':_0x134559['attributes'],'include':_0x134559[_0x7172('0x1e')]?_['map'](_0x134559['include'],function(_0x8c5ac0){return{'model':db[_0x8c5ac0[_0x7172('0x20')]],'as':_0x8c5ac0['as'],'attributes':_0x8c5ac0[_0x7172('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7172('0xc')](function(_0x5883ea){logger[_0x7172('0xd')]('GetDynamics365Account',_0x4c6b2d);logger[_0x7172('0x10')]('GetDynamics365Account',_0x4c6b2d,JSON[_0x7172('0x12')](_0x5883ea));_0x222568(_0x5883ea);})['catch'](function(_0x4b6c51){logger[_0x7172('0x13')]('GetDynamics365Account',_0x4b6c51['message'],_0x4c6b2d);_0x3dc6f4(_0x3ca2df[_0x7172('0x13')](0x1f4,_0x4b6c51[_0x7172('0x15')]));});});};exports[_0x7172('0x22')]=function(_0x2ebed5){var _0x3c6b38=this;return new Promise(function(_0x47b8cf,_0x4b8656){return db[_0x7172('0x19')][_0x7172('0x23')]({'raw':_0x2ebed5[_0x7172('0x1b')]?_0x2ebed5['options']['raw']===undefined?!![]:![]:!![],'where':_0x2ebed5[_0x7172('0x1b')]?_0x2ebed5['options'][_0x7172('0x24')]||null:null,'attributes':_0x2ebed5[_0x7172('0x1b')]?_0x2ebed5[_0x7172('0x1b')][_0x7172('0x21')]||null:null,'include':_0x2ebed5['options']?_0x2ebed5['options'][_0x7172('0x1e')]?_[_0x7172('0x1f')](_0x2ebed5[_0x7172('0x1b')][_0x7172('0x1e')],function(_0x3e9b43){return{'model':db[_0x3e9b43[_0x7172('0x20')]],'as':_0x3e9b43['as'],'attributes':_0x3e9b43[_0x7172('0x21')],'include':_0x3e9b43[_0x7172('0x1e')]?_['map'](_0x3e9b43['include'],function(_0x3b0199){return{'model':db[_0x3b0199['model']],'as':_0x3b0199['as'],'attributes':_0x3b0199[_0x7172('0x21')],'include':_0x3b0199[_0x7172('0x1e')]?_['map'](_0x3b0199[_0x7172('0x1e')],function(_0xb52a32){return{'model':db[_0xb52a32[_0x7172('0x20')]],'as':_0xb52a32['as'],'attributes':_0xb52a32[_0x7172('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x958c7e){logger[_0x7172('0xd')](_0x7172('0x22'),_0x2ebed5);logger[_0x7172('0x10')](_0x7172('0x22'),_0x2ebed5,JSON[_0x7172('0x12')](_0x958c7e));_0x47b8cf(_0x958c7e);})['catch'](function(_0x4cbca8){logger[_0x7172('0x13')](_0x7172('0x22'),_0x4cbca8[_0x7172('0x15')],_0x2ebed5);_0x4b8656(_0x3c6b38[_0x7172('0x13')](0x1f4,_0x4cbca8['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index a337c46..9f272a1 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 _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 +var _0x7044=['isAuthenticated','/:id','show','/:id/fields','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x5d5ab2,_0x1d3681){var _0xb8fe37=function(_0x29a76c){while(--_0x29a76c){_0x5d5ab2['push'](_0x5d5ab2['shift']());}};_0xb8fe37(++_0x1d3681);}(_0x7044,0x147));var _0x4704=function(_0x4f9c08,_0x4d83df){_0x4f9c08=_0x4f9c08-0x0;var _0x4da7e5=_0x7044[_0x4f9c08];return _0x4da7e5;};'use strict';var multer=require(_0x4704('0x0'));var util=require(_0x4704('0x1'));var path=require(_0x4704('0x2'));var timeout=require('connect-timeout');var express=require(_0x4704('0x3'));var router=express[_0x4704('0x4')]();var fs_extra=require(_0x4704('0x5'));var auth=require(_0x4704('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4704('0x7'));var controller=require('./intDynamics365Configuration.controller');router[_0x4704('0x8')]('/',auth[_0x4704('0x9')](),controller['index']);router['get'](_0x4704('0xa'),auth[_0x4704('0x9')](),controller[_0x4704('0xb')]);router[_0x4704('0x8')](_0x4704('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0x4704('0x8')]('/:id/subjects',auth[_0x4704('0x9')](),controller[_0x4704('0xd')]);router[_0x4704('0x8')](_0x4704('0xe'),auth[_0x4704('0x9')](),controller['getDescriptions']);router[_0x4704('0xf')]('/',auth[_0x4704('0x9')](),controller[_0x4704('0x10')]);router[_0x4704('0x11')](_0x4704('0xa'),auth[_0x4704('0x9')](),controller['update']);router[_0x4704('0x12')](_0x4704('0xa'),auth[_0x4704('0x9')](),controller[_0x4704('0x13')]);module[_0x4704('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 712655a..186c9b8 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 _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 +var _0x38c3=['sequelize','exports','ENUM','incident','nothing','contact','STRING','BOOLEAN'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x38c3,0x120));var _0x338c=function(_0x4d821c,_0x22bd0e){_0x4d821c=_0x4d821c-0x0;var _0x15dd5b=_0x38c3[_0x4d821c];return _0x15dd5b;};'use strict';var Sequelize=require(_0x338c('0x0'));module[_0x338c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x338c('0x2')](_0x338c('0x3'),'phonecall'),'defaultValue':_0x338c('0x3')},'moduleCreate':{'type':Sequelize[_0x338c('0x2')]('contact',_0x338c('0x4')),'defaultValue':_0x338c('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x338c('0x6')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x338c('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index eacbd89..a073ec4 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 _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 +var _0x3ff0=['filter','options','include','findAll','then','rows','show','includeAll','find','catch','create','body','destroy','params','getFields','Dynamics365Field','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','sendStatus','error','stack','send','Dynamics365Configuration','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','map','VIRTUAL','name'];(function(_0x3da141,_0x4b94f9){var _0x5cf4d7=function(_0x144848){while(--_0x144848){_0x3da141['push'](_0x3da141['shift']());}};_0x5cf4d7(++_0x4b94f9);}(_0x3ff0,0xfd));var _0x03ff=function(_0x1dd532,_0x36e81c){_0x1dd532=_0x1dd532-0x0;var _0x3732aa=_0x3ff0[_0x1dd532];return _0x3732aa;};'use strict';var emlformat=require(_0x03ff('0x0'));var rimraf=require(_0x03ff('0x1'));var zipdir=require(_0x03ff('0x2'));var jsonpatch=require(_0x03ff('0x3'));var rp=require(_0x03ff('0x4'));var moment=require('moment');var BPromise=require(_0x03ff('0x5'));var Mustache=require(_0x03ff('0x6'));var util=require('util');var path=require(_0x03ff('0x7'));var sox=require(_0x03ff('0x8'));var csv=require(_0x03ff('0x9'));var ejs=require(_0x03ff('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x03ff('0xb'));var crypto=require('crypto');var jsforce=require(_0x03ff('0xc'));var deskjs=require(_0x03ff('0xd'));var toCsv=require(_0x03ff('0x9'));var querystring=require(_0x03ff('0xe'));var Papa=require(_0x03ff('0xf'));var Redis=require(_0x03ff('0x10'));var authService=require(_0x03ff('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x03ff('0x12'))('api');var utils=require(_0x03ff('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x03ff('0x14'));var db=require(_0x03ff('0x15'))['db'];function respondWithStatusCode(_0x327d63,_0x50eba1){_0x50eba1=_0x50eba1||0xcc;return function(_0x470aa5){if(_0x470aa5){return _0x327d63['sendStatus'](_0x50eba1);}return _0x327d63[_0x03ff('0x16')](_0x50eba1)[_0x03ff('0x17')]();};}function respondWithResult(_0x3a9209,_0x274d2e){_0x274d2e=_0x274d2e||0xc8;return function(_0xe15a3c){if(_0xe15a3c){return _0x3a9209[_0x03ff('0x16')](_0x274d2e)[_0x03ff('0x18')](_0xe15a3c);}};}function respondWithFilteredResult(_0x2d531a,_0x2cc456){return function(_0x55f67b){if(_0x55f67b){var _0x53a4a=typeof _0x2cc456[_0x03ff('0x19')]===_0x03ff('0x1a')&&typeof _0x2cc456[_0x03ff('0x1b')]===_0x03ff('0x1a');var _0x361e33=_0x55f67b[_0x03ff('0x1c')];var _0x30b5ca=_0x53a4a?0x0:_0x2cc456[_0x03ff('0x19')];var _0x59f86d=_0x53a4a?_0x55f67b[_0x03ff('0x1c')]:_0x2cc456['offset']+_0x2cc456[_0x03ff('0x1b')];var _0x30a968;if(_0x59f86d>=_0x361e33){_0x59f86d=_0x361e33;_0x30a968=0xc8;}else{_0x30a968=0xce;}_0x2d531a['status'](_0x30a968);return _0x2d531a['set'](_0x03ff('0x1d'),_0x30b5ca+'-'+_0x59f86d+'/'+_0x361e33)['json'](_0x55f67b);}return null;};}function patchUpdates(_0x55d354){return function(_0x391d96){try{jsonpatch[_0x03ff('0x1e')](_0x391d96,_0x55d354,!![]);}catch(_0x6eb110){return BPromise[_0x03ff('0x1f')](_0x6eb110);}return _0x391d96['save']();};}function saveUpdates(_0x2e92bb,_0x5314c4){return function(_0x3d168c){if(_0x3d168c){return _0x3d168c[_0x03ff('0x20')](_0x2e92bb)['then'](function(_0x3f25e9){return _0x3f25e9;});}return null;};}function removeEntity(_0x57b309,_0x3060c4){return function(_0x1a290c){if(_0x1a290c){return _0x1a290c['destroy']()['then'](function(){_0x57b309['status'](0xcc)[_0x03ff('0x17')]();});}};}function handleEntityNotFound(_0x2371fb,_0x26a2b8){return function(_0x292ff0){if(!_0x292ff0){_0x2371fb[_0x03ff('0x21')](0x194);}return _0x292ff0;};}function handleError(_0x34f8ec,_0x150368){_0x150368=_0x150368||0x1f4;return function(_0x1e16f9){logger[_0x03ff('0x22')](_0x1e16f9[_0x03ff('0x23')]);if(_0x1e16f9['name']){delete _0x1e16f9['name'];}_0x34f8ec[_0x03ff('0x16')](_0x150368)[_0x03ff('0x24')](_0x1e16f9);};}exports['index']=function(_0x5963f7,_0x81c9cd){var _0x4cbcf6={},_0x374936={},_0x4e8f7={'count':0x0,'rows':[]};var _0x5b07c8=_['map'](db[_0x03ff('0x25')][_0x03ff('0x26')],function(_0x171e40){return{'name':_0x171e40[_0x03ff('0x27')],'type':_0x171e40[_0x03ff('0x28')]['key']};});_0x374936[_0x03ff('0x29')]=_['map'](_0x5b07c8,'name');_0x374936[_0x03ff('0x2a')]=_[_0x03ff('0x2b')](_0x5963f7[_0x03ff('0x2a')]);_0x374936['filters']=_[_0x03ff('0x2c')](_0x374936[_0x03ff('0x29')],_0x374936[_0x03ff('0x2a')]);_0x4cbcf6[_0x03ff('0x2d')]=_[_0x03ff('0x2c')](_0x374936[_0x03ff('0x29')],qs['fields'](_0x5963f7[_0x03ff('0x2a')][_0x03ff('0x2e')]));_0x4cbcf6[_0x03ff('0x2d')]=_0x4cbcf6[_0x03ff('0x2d')][_0x03ff('0x2f')]?_0x4cbcf6[_0x03ff('0x2d')]:_0x374936[_0x03ff('0x29')];if(!_0x5963f7[_0x03ff('0x2a')][_0x03ff('0x30')](_0x03ff('0x31'))){_0x4cbcf6['limit']=qs[_0x03ff('0x1b')](_0x5963f7[_0x03ff('0x2a')]['limit']);_0x4cbcf6[_0x03ff('0x19')]=qs[_0x03ff('0x19')](_0x5963f7[_0x03ff('0x2a')][_0x03ff('0x19')]);}_0x4cbcf6[_0x03ff('0x32')]=qs[_0x03ff('0x33')](_0x5963f7['query']['sort']);_0x4cbcf6[_0x03ff('0x34')]=qs[_0x03ff('0x35')](_[_0x03ff('0x36')](_0x5963f7[_0x03ff('0x2a')],_0x374936[_0x03ff('0x35')]),_0x5b07c8);if(_0x5963f7[_0x03ff('0x2a')]['filter']){_0x4cbcf6[_0x03ff('0x34')]=_[_0x03ff('0x37')](_0x4cbcf6[_0x03ff('0x34')],{'$or':_[_0x03ff('0x38')](_0x5b07c8,function(_0x1224ae){if(_0x1224ae[_0x03ff('0x28')]!==_0x03ff('0x39')){var _0x3bfdbc={};_0x3bfdbc[_0x1224ae[_0x03ff('0x3a')]]={'$like':'%'+_0x5963f7[_0x03ff('0x2a')][_0x03ff('0x3b')]+'%'};return _0x3bfdbc;}})});}_0x4cbcf6=_[_0x03ff('0x37')]({},_0x4cbcf6,_0x5963f7[_0x03ff('0x3c')]);var _0x27801f={'where':_0x4cbcf6['where']};return db[_0x03ff('0x25')][_0x03ff('0x1c')](_0x27801f)['then'](function(_0x57fc6b){_0x4e8f7[_0x03ff('0x1c')]=_0x57fc6b;if(_0x5963f7[_0x03ff('0x2a')]['includeAll']){_0x4cbcf6[_0x03ff('0x3d')]=[{'all':!![]}];}return db[_0x03ff('0x25')][_0x03ff('0x3e')](_0x4cbcf6);})[_0x03ff('0x3f')](function(_0x435695){_0x4e8f7[_0x03ff('0x40')]=_0x435695;return _0x4e8f7;})[_0x03ff('0x3f')](respondWithFilteredResult(_0x81c9cd,_0x4cbcf6))['catch'](handleError(_0x81c9cd,null));};exports[_0x03ff('0x41')]=function(_0x304a3d,_0x202288){var _0x32a2f6={'raw':![],'where':{'id':_0x304a3d['params']['id']}},_0x163c47={};_0x163c47['model']=_[_0x03ff('0x2b')](db[_0x03ff('0x25')][_0x03ff('0x26')]);_0x163c47[_0x03ff('0x2a')]=_[_0x03ff('0x2b')](_0x304a3d[_0x03ff('0x2a')]);_0x163c47[_0x03ff('0x35')]=_[_0x03ff('0x2c')](_0x163c47[_0x03ff('0x29')],_0x163c47['query']);_0x32a2f6[_0x03ff('0x2d')]=_[_0x03ff('0x2c')](_0x163c47[_0x03ff('0x29')],qs['fields'](_0x304a3d[_0x03ff('0x2a')][_0x03ff('0x2e')]));_0x32a2f6[_0x03ff('0x2d')]=_0x32a2f6[_0x03ff('0x2d')]['length']?_0x32a2f6['attributes']:_0x163c47['model'];if(_0x304a3d[_0x03ff('0x2a')][_0x03ff('0x42')]){_0x32a2f6[_0x03ff('0x3d')]=[{'all':!![]}];}_0x32a2f6=_[_0x03ff('0x37')]({},_0x32a2f6,_0x304a3d[_0x03ff('0x3c')]);return db[_0x03ff('0x25')][_0x03ff('0x43')](_0x32a2f6)[_0x03ff('0x3f')](handleEntityNotFound(_0x202288,null))[_0x03ff('0x3f')](respondWithResult(_0x202288,null))[_0x03ff('0x44')](handleError(_0x202288,null));};exports[_0x03ff('0x45')]=function(_0x21cf18,_0x364f04){return db[_0x03ff('0x25')][_0x03ff('0x45')](_0x21cf18['body'],{})['then'](respondWithResult(_0x364f04,0xc9))['catch'](handleError(_0x364f04,null));};exports[_0x03ff('0x20')]=function(_0x4dbb0d,_0x9de397){if(_0x4dbb0d[_0x03ff('0x46')]['id']){delete _0x4dbb0d[_0x03ff('0x46')]['id'];}return db[_0x03ff('0x25')]['find']({'where':{'id':_0x4dbb0d['params']['id']}})[_0x03ff('0x3f')](handleEntityNotFound(_0x9de397,null))[_0x03ff('0x3f')](saveUpdates(_0x4dbb0d[_0x03ff('0x46')],null))['then'](respondWithResult(_0x9de397,null))[_0x03ff('0x44')](handleError(_0x9de397,null));};exports[_0x03ff('0x47')]=function(_0x2bef46,_0xb23d8e){return db['Dynamics365Configuration'][_0x03ff('0x43')]({'where':{'id':_0x2bef46[_0x03ff('0x48')]['id']}})['then'](handleEntityNotFound(_0xb23d8e,null))[_0x03ff('0x3f')](removeEntity(_0xb23d8e,null))[_0x03ff('0x44')](handleError(_0xb23d8e,null));};exports[_0x03ff('0x49')]=function(_0x4b2693,_0x134536,_0x10bc3f){var _0x3ba162={};var _0x269f65={};var _0x1055be;var _0x598875;return db[_0x03ff('0x25')]['findOne']({'where':{'id':_0x4b2693['params']['id']}})[_0x03ff('0x3f')](handleEntityNotFound(_0x134536,null))[_0x03ff('0x3f')](function(_0x174011){if(_0x174011){_0x1055be=_0x174011;_0x269f65[_0x03ff('0x29')]=_[_0x03ff('0x2b')](db[_0x03ff('0x4a')][_0x03ff('0x26')]);_0x269f65[_0x03ff('0x2a')]=_['keys'](_0x4b2693[_0x03ff('0x2a')]);_0x269f65[_0x03ff('0x35')]=_[_0x03ff('0x2c')](_0x269f65[_0x03ff('0x29')],_0x269f65[_0x03ff('0x2a')]);_0x3ba162['attributes']=_[_0x03ff('0x2c')](_0x269f65['model'],qs['fields'](_0x4b2693['query'][_0x03ff('0x2e')]));_0x3ba162[_0x03ff('0x2d')]=_0x3ba162[_0x03ff('0x2d')][_0x03ff('0x2f')]?_0x3ba162[_0x03ff('0x2d')]:_0x269f65['model'];_0x3ba162[_0x03ff('0x32')]=qs[_0x03ff('0x33')](_0x4b2693['query'][_0x03ff('0x33')]);_0x3ba162[_0x03ff('0x34')]=qs[_0x03ff('0x35')](_[_0x03ff('0x36')](_0x4b2693[_0x03ff('0x2a')],_0x269f65[_0x03ff('0x35')]));if(_0x4b2693['query'][_0x03ff('0x3b')]){_0x3ba162[_0x03ff('0x34')]=_[_0x03ff('0x37')](_0x3ba162[_0x03ff('0x34')],{'$or':_[_0x03ff('0x38')](_0x3ba162['attributes'],function(_0x47e1f9){var _0x5de620={};_0x5de620[_0x47e1f9]={'$like':'%'+_0x4b2693[_0x03ff('0x2a')]['filter']+'%'};return _0x5de620;})});}_0x3ba162=_[_0x03ff('0x37')]({},_0x3ba162,_0x4b2693[_0x03ff('0x3c')]);return _0x1055be[_0x03ff('0x49')](_0x3ba162);}})[_0x03ff('0x3f')](function(_0x55cc0b){if(_0x55cc0b){_0x598875=_0x55cc0b[_0x03ff('0x2f')];if(!_0x4b2693[_0x03ff('0x2a')][_0x03ff('0x30')](_0x03ff('0x31'))){_0x3ba162[_0x03ff('0x1b')]=qs[_0x03ff('0x1b')](_0x4b2693[_0x03ff('0x2a')][_0x03ff('0x1b')]);_0x3ba162[_0x03ff('0x19')]=qs[_0x03ff('0x19')](_0x4b2693[_0x03ff('0x2a')][_0x03ff('0x19')]);}return _0x1055be[_0x03ff('0x49')](_0x3ba162);}})['then'](function(_0xd3a423){if(_0xd3a423){return _0xd3a423?{'count':_0x598875,'rows':_0xd3a423}:null;}})[_0x03ff('0x3f')](respondWithResult(_0x134536,null))[_0x03ff('0x44')](handleError(_0x134536,null));};exports[_0x03ff('0x4b')]=function(_0x4ffbea,_0x138b48,_0x5147a9){var _0x147d25={};var _0x4f8f2a={};var _0x3f307;var _0x10b270;return db[_0x03ff('0x25')][_0x03ff('0x4c')]({'where':{'id':_0x4ffbea[_0x03ff('0x48')]['id']}})[_0x03ff('0x3f')](handleEntityNotFound(_0x138b48,null))['then'](function(_0xc55e05){if(_0xc55e05){_0x3f307=_0xc55e05;_0x4f8f2a[_0x03ff('0x29')]=_[_0x03ff('0x2b')](db[_0x03ff('0x4a')][_0x03ff('0x26')]);_0x4f8f2a['query']=_['keys'](_0x4ffbea[_0x03ff('0x2a')]);_0x4f8f2a['filters']=_[_0x03ff('0x2c')](_0x4f8f2a[_0x03ff('0x29')],_0x4f8f2a[_0x03ff('0x2a')]);_0x147d25['attributes']=_[_0x03ff('0x2c')](_0x4f8f2a[_0x03ff('0x29')],qs[_0x03ff('0x2e')](_0x4ffbea[_0x03ff('0x2a')][_0x03ff('0x2e')]));_0x147d25[_0x03ff('0x2d')]=_0x147d25['attributes']['length']?_0x147d25[_0x03ff('0x2d')]:_0x4f8f2a[_0x03ff('0x29')];_0x147d25[_0x03ff('0x32')]=qs[_0x03ff('0x33')](_0x4ffbea[_0x03ff('0x2a')]['sort']);_0x147d25['where']=qs[_0x03ff('0x35')](_['pick'](_0x4ffbea['query'],_0x4f8f2a[_0x03ff('0x35')]));if(_0x4ffbea[_0x03ff('0x2a')]['filter']){_0x147d25[_0x03ff('0x34')]=_[_0x03ff('0x37')](_0x147d25[_0x03ff('0x34')],{'$or':_[_0x03ff('0x38')](_0x147d25['attributes'],function(_0x1b49fc){var _0x11e7be={};_0x11e7be[_0x1b49fc]={'$like':'%'+_0x4ffbea['query'][_0x03ff('0x3b')]+'%'};return _0x11e7be;})});}_0x147d25=_[_0x03ff('0x37')]({},_0x147d25,_0x4ffbea['options']);return _0x3f307[_0x03ff('0x4b')](_0x147d25);}})[_0x03ff('0x3f')](function(_0x161900){if(_0x161900){_0x10b270=_0x161900[_0x03ff('0x2f')];if(!_0x4ffbea[_0x03ff('0x2a')][_0x03ff('0x30')](_0x03ff('0x31'))){_0x147d25[_0x03ff('0x1b')]=qs[_0x03ff('0x1b')](_0x4ffbea[_0x03ff('0x2a')][_0x03ff('0x1b')]);_0x147d25[_0x03ff('0x19')]=qs[_0x03ff('0x19')](_0x4ffbea['query'][_0x03ff('0x19')]);}return _0x3f307[_0x03ff('0x4b')](_0x147d25);}})['then'](function(_0xd4ba37){if(_0xd4ba37){return _0xd4ba37?{'count':_0x10b270,'rows':_0xd4ba37}:null;}})[_0x03ff('0x3f')](respondWithResult(_0x138b48,null))[_0x03ff('0x44')](handleError(_0x138b48,null));};exports[_0x03ff('0x4d')]=function(_0x137b7a,_0x8bc365,_0xaae4a8){var _0x1ddd31={};var _0x24ac21={};var _0x1168d3;var _0x2b397a;return db[_0x03ff('0x25')]['findOne']({'where':{'id':_0x137b7a[_0x03ff('0x48')]['id']}})[_0x03ff('0x3f')](handleEntityNotFound(_0x8bc365,null))[_0x03ff('0x3f')](function(_0x43227b){if(_0x43227b){_0x1168d3=_0x43227b;_0x24ac21[_0x03ff('0x29')]=_['keys'](db[_0x03ff('0x4a')]['rawAttributes']);_0x24ac21[_0x03ff('0x2a')]=_[_0x03ff('0x2b')](_0x137b7a[_0x03ff('0x2a')]);_0x24ac21[_0x03ff('0x35')]=_[_0x03ff('0x2c')](_0x24ac21[_0x03ff('0x29')],_0x24ac21[_0x03ff('0x2a')]);_0x1ddd31[_0x03ff('0x2d')]=_[_0x03ff('0x2c')](_0x24ac21['model'],qs['fields'](_0x137b7a['query']['fields']));_0x1ddd31[_0x03ff('0x2d')]=_0x1ddd31[_0x03ff('0x2d')][_0x03ff('0x2f')]?_0x1ddd31['attributes']:_0x24ac21['model'];_0x1ddd31[_0x03ff('0x32')]=qs[_0x03ff('0x33')](_0x137b7a['query'][_0x03ff('0x33')]);_0x1ddd31['where']=qs[_0x03ff('0x35')](_[_0x03ff('0x36')](_0x137b7a[_0x03ff('0x2a')],_0x24ac21[_0x03ff('0x35')]));if(_0x137b7a[_0x03ff('0x2a')][_0x03ff('0x3b')]){_0x1ddd31[_0x03ff('0x34')]=_[_0x03ff('0x37')](_0x1ddd31[_0x03ff('0x34')],{'$or':_[_0x03ff('0x38')](_0x1ddd31[_0x03ff('0x2d')],function(_0x37d08d){var _0x26b8e1={};_0x26b8e1[_0x37d08d]={'$like':'%'+_0x137b7a['query']['filter']+'%'};return _0x26b8e1;})});}_0x1ddd31=_[_0x03ff('0x37')]({},_0x1ddd31,_0x137b7a[_0x03ff('0x3c')]);return _0x1168d3['getDescriptions'](_0x1ddd31);}})[_0x03ff('0x3f')](function(_0xa3f571){if(_0xa3f571){_0x2b397a=_0xa3f571['length'];if(!_0x137b7a[_0x03ff('0x2a')][_0x03ff('0x30')]('nolimit')){_0x1ddd31[_0x03ff('0x1b')]=qs['limit'](_0x137b7a[_0x03ff('0x2a')][_0x03ff('0x1b')]);_0x1ddd31[_0x03ff('0x19')]=qs[_0x03ff('0x19')](_0x137b7a[_0x03ff('0x2a')]['offset']);}return _0x1168d3[_0x03ff('0x4d')](_0x1ddd31);}})[_0x03ff('0x3f')](function(_0x286dfa){if(_0x286dfa){return _0x286dfa?{'count':_0x2b397a,'rows':_0x286dfa}:null;}})['then'](respondWithResult(_0x8bc365,null))['catch'](handleError(_0x8bc365,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index f0036eb..850a261 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_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 +var _0x54ef=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','lodash','util'];(function(_0x68e994,_0x3fe71e){var _0x2692f6=function(_0x59c55d){while(--_0x59c55d){_0x68e994['push'](_0x68e994['shift']());}};_0x2692f6(++_0x3fe71e);}(_0x54ef,0x112));var _0xf54e=function(_0x2f74cb,_0x43727c){_0x2f74cb=_0x2f74cb-0x0;var _0x5b6b5e=_0x54ef[_0x2f74cb];return _0x5b6b5e;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var moment=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var rp=require(_0xf54e('0x5'));var fs=require('fs');var path=require(_0xf54e('0x6'));var rimraf=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var attributes=require(_0xf54e('0x9'));module['exports']=function(_0x55e611,_0x18e84e){return _0x55e611[_0xf54e('0xa')](_0xf54e('0xb'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 88aa596..5fd0c27 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 _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 +var _0x79c6=['rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2e15de,_0x3b9a6f){var _0xdaa198=function(_0x575fed){while(--_0x575fed){_0x2e15de['push'](_0x2e15de['shift']());}};_0xdaa198(++_0x3b9a6f);}(_0x79c6,0x151));var _0x679c=function(_0x3358ba,_0x24c5fc){_0x3358ba=_0x3358ba-0x0;var _0x296e73=_0x79c6[_0x3358ba];return _0x296e73;};'use strict';var _=require(_0x679c('0x0'));var util=require(_0x679c('0x1'));var moment=require(_0x679c('0x2'));var BPromise=require(_0x679c('0x3'));var rs=require(_0x679c('0x4'));var fs=require('fs');var Redis=require(_0x679c('0x5'));var db=require(_0x679c('0x6'))['db'];var utils=require(_0x679c('0x7'));var logger=require('../../config/logger')(_0x679c('0x8'));var config=require(_0x679c('0x9'));var jayson=require(_0x679c('0xa'));var client=jayson[_0x679c('0xb')][_0x679c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x76a9c4,_0xabbabb,_0x1c1968){return new BPromise(function(_0x5e1226,_0x5556c9){return client[_0x679c('0xd')](_0x76a9c4,_0x1c1968)['then'](function(_0x7f868e){logger[_0x679c('0xe')](_0x679c('0xf'),_0xabbabb,_0x679c('0x10'));logger[_0x679c('0x11')](_0x679c('0x12'),_0xabbabb,_0x679c('0x10'),JSON[_0x679c('0x13')](_0x7f868e));if(_0x7f868e[_0x679c('0x14')]){if(_0x7f868e[_0x679c('0x14')][_0x679c('0x15')]===0x1f4){logger[_0x679c('0x14')](_0x679c('0xf'),_0xabbabb,_0x7f868e['error'][_0x679c('0x16')]);return _0x5556c9(_0x7f868e[_0x679c('0x14')][_0x679c('0x16')]);}logger[_0x679c('0x14')](_0x679c('0xf'),_0xabbabb,_0x7f868e[_0x679c('0x14')][_0x679c('0x16')]);return _0x5e1226(_0x7f868e[_0x679c('0x14')]['message']);}else{logger[_0x679c('0xe')](_0x679c('0xf'),_0xabbabb,'request\x20sent');_0x5e1226(_0x7f868e['result'][_0x679c('0x16')]);}})['catch'](function(_0x209fd9){logger[_0x679c('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0xabbabb,_0x209fd9);_0x5556c9(_0x209fd9);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 69e085a..e604865 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 _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 +var _0x871a=['util','path','connect-timeout','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','get','/:id','post','update','delete','destroy','exports'];(function(_0x240e97,_0x31b643){var _0x38d32a=function(_0x3d8cfb){while(--_0x3d8cfb){_0x240e97['push'](_0x240e97['shift']());}};_0x38d32a(++_0x31b643);}(_0x871a,0x188));var _0xa871=function(_0x252782,_0x5b7839){_0x252782=_0x252782-0x0;var _0x5123ea=_0x871a[_0x252782];return _0x5123ea;};'use strict';var multer=require('multer');var util=require(_0xa871('0x0'));var path=require(_0xa871('0x1'));var timeout=require(_0xa871('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa871('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa871('0x4'));var controller=require(_0xa871('0x5'));router['get']('/',auth[_0xa871('0x6')](),controller['index']);router[_0xa871('0x7')](_0xa871('0x8'),auth[_0xa871('0x6')](),controller['show']);router[_0xa871('0x9')]('/',auth[_0xa871('0x6')](),controller['create']);router['put'](_0xa871('0x8'),auth[_0xa871('0x6')](),controller[_0xa871('0xa')]);router[_0xa871('0xb')](_0xa871('0x8'),auth[_0xa871('0x6')](),controller[_0xa871('0xc')]);module[_0xa871('0xd')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 5ccbe19..c34d92c 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 _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 +var _0x47a5=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','ENUM'];(function(_0x116ce6,_0x47adf3){var _0x1cda4b=function(_0x115f41){while(--_0x115f41){_0x116ce6['push'](_0x116ce6['shift']());}};_0x1cda4b(++_0x47adf3);}(_0x47a5,0x137));var _0x547a=function(_0x3bddd8,_0x4e2ddf){_0x3bddd8=_0x3bddd8-0x0;var _0xf2e1ab=_0x47a5[_0x3bddd8];return _0xf2e1ab;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x547a('0x0')](_0x547a('0x1'),_0x547a('0x2'),_0x547a('0x3'),_0x547a('0x4'),_0x547a('0x5')),'defaultValue':_0x547a('0x1')},'content':{'type':Sequelize[_0x547a('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x547a('0x1'),_0x547a('0x2'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x547a('0x7')],'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 916f504..edaadf8 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 _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 +var _0xad18=['params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show'];(function(_0x2aeca6,_0x565154){var _0x48c8c9=function(_0x739357){while(--_0x739357){_0x2aeca6['push'](_0x2aeca6['shift']());}};_0x48c8c9(++_0x565154);}(_0xad18,0x131));var _0x8ad1=function(_0x268916,_0x1c27e1){_0x268916=_0x268916-0x0;var _0x38f8a4=_0xad18[_0x268916];return _0x38f8a4;};'use strict';var emlformat=require(_0x8ad1('0x0'));var rimraf=require(_0x8ad1('0x1'));var zipdir=require(_0x8ad1('0x2'));var jsonpatch=require(_0x8ad1('0x3'));var rp=require(_0x8ad1('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8ad1('0x5'));var util=require(_0x8ad1('0x6'));var path=require(_0x8ad1('0x7'));var sox=require(_0x8ad1('0x8'));var csv=require(_0x8ad1('0x9'));var ejs=require(_0x8ad1('0xa'));var fs=require('fs');var fs_extra=require(_0x8ad1('0xb'));var _=require(_0x8ad1('0xc'));var squel=require(_0x8ad1('0xd'));var crypto=require(_0x8ad1('0xe'));var jsforce=require(_0x8ad1('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8ad1('0x9'));var querystring=require(_0x8ad1('0x10'));var Papa=require(_0x8ad1('0x11'));var Redis=require(_0x8ad1('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8ad1('0x13'));var as=require(_0x8ad1('0x14'));var hardwareService=require(_0x8ad1('0x15'));var logger=require(_0x8ad1('0x16'))(_0x8ad1('0x17'));var utils=require('../../config/utils');var config=require(_0x8ad1('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8ad1('0x19'))['db'];function respondWithStatusCode(_0x122c4c,_0x2a25a9){_0x2a25a9=_0x2a25a9||0xcc;return function(_0xf46c07){if(_0xf46c07){return _0x122c4c[_0x8ad1('0x1a')](_0x2a25a9);}return _0x122c4c[_0x8ad1('0x1b')](_0x2a25a9)[_0x8ad1('0x1c')]();};}function respondWithResult(_0x5db1cf,_0x303664){_0x303664=_0x303664||0xc8;return function(_0x288d15){if(_0x288d15){return _0x5db1cf[_0x8ad1('0x1b')](_0x303664)[_0x8ad1('0x1d')](_0x288d15);}};}function respondWithFilteredResult(_0x4f4f77,_0xc8aa7){return function(_0x3872a9){if(_0x3872a9){var _0x1e836b=typeof _0xc8aa7['offset']===_0x8ad1('0x1e')&&typeof _0xc8aa7['limit']==='undefined';var _0x4cf359=_0x3872a9[_0x8ad1('0x1f')];var _0x4e80c7=_0x1e836b?0x0:_0xc8aa7[_0x8ad1('0x20')];var _0x551612=_0x1e836b?_0x3872a9[_0x8ad1('0x1f')]:_0xc8aa7[_0x8ad1('0x20')]+_0xc8aa7[_0x8ad1('0x21')];var _0xad9a2;if(_0x551612>=_0x4cf359){_0x551612=_0x4cf359;_0xad9a2=0xc8;}else{_0xad9a2=0xce;}_0x4f4f77[_0x8ad1('0x1b')](_0xad9a2);return _0x4f4f77[_0x8ad1('0x22')](_0x8ad1('0x23'),_0x4e80c7+'-'+_0x551612+'/'+_0x4cf359)[_0x8ad1('0x1d')](_0x3872a9);}return null;};}function patchUpdates(_0x1b2fe1){return function(_0x8724ea){try{jsonpatch[_0x8ad1('0x24')](_0x8724ea,_0x1b2fe1,!![]);}catch(_0x5f55d4){return BPromise[_0x8ad1('0x25')](_0x5f55d4);}return _0x8724ea['save']();};}function saveUpdates(_0x5a6eb3,_0x2632d){return function(_0x2f430a){if(_0x2f430a){return _0x2f430a[_0x8ad1('0x26')](_0x5a6eb3)[_0x8ad1('0x27')](function(_0x1e0963){return _0x1e0963;});}return null;};}function removeEntity(_0x13bd04,_0x20efce){return function(_0x372833){if(_0x372833){return _0x372833['destroy']()[_0x8ad1('0x27')](function(){_0x13bd04['status'](0xcc)[_0x8ad1('0x1c')]();});}};}function handleEntityNotFound(_0x2feeb0,_0x300d17){return function(_0x1a03eb){if(!_0x1a03eb){_0x2feeb0['sendStatus'](0x194);}return _0x1a03eb;};}function handleError(_0x9dd0ca,_0x53f125){_0x53f125=_0x53f125||0x1f4;return function(_0x170eb1){logger[_0x8ad1('0x28')](_0x170eb1[_0x8ad1('0x29')]);if(_0x170eb1['name']){delete _0x170eb1[_0x8ad1('0x2a')];}_0x9dd0ca[_0x8ad1('0x1b')](_0x53f125)[_0x8ad1('0x2b')](_0x170eb1);};}exports['index']=function(_0x2b20ac,_0x47ab7d){var _0x24646b={},_0x340acc={},_0x5be269={'count':0x0,'rows':[]};var _0xe0276c=_[_0x8ad1('0x2c')](db[_0x8ad1('0x2d')][_0x8ad1('0x2e')],function(_0xf80767){return{'name':_0xf80767[_0x8ad1('0x2f')],'type':_0xf80767[_0x8ad1('0x30')][_0x8ad1('0x31')]};});_0x340acc[_0x8ad1('0x32')]=_[_0x8ad1('0x2c')](_0xe0276c,'name');_0x340acc[_0x8ad1('0x33')]=_[_0x8ad1('0x34')](_0x2b20ac[_0x8ad1('0x33')]);_0x340acc[_0x8ad1('0x35')]=_[_0x8ad1('0x36')](_0x340acc[_0x8ad1('0x32')],_0x340acc[_0x8ad1('0x33')]);_0x24646b[_0x8ad1('0x37')]=_['intersection'](_0x340acc[_0x8ad1('0x32')],qs[_0x8ad1('0x38')](_0x2b20ac[_0x8ad1('0x33')][_0x8ad1('0x38')]));_0x24646b[_0x8ad1('0x37')]=_0x24646b[_0x8ad1('0x37')][_0x8ad1('0x39')]?_0x24646b[_0x8ad1('0x37')]:_0x340acc['model'];if(!_0x2b20ac['query']['hasOwnProperty'](_0x8ad1('0x3a'))){_0x24646b[_0x8ad1('0x21')]=qs[_0x8ad1('0x21')](_0x2b20ac[_0x8ad1('0x33')][_0x8ad1('0x21')]);_0x24646b[_0x8ad1('0x20')]=qs['offset'](_0x2b20ac['query'][_0x8ad1('0x20')]);}_0x24646b['order']=qs['sort'](_0x2b20ac[_0x8ad1('0x33')][_0x8ad1('0x3b')]);_0x24646b[_0x8ad1('0x3c')]=qs[_0x8ad1('0x35')](_['pick'](_0x2b20ac[_0x8ad1('0x33')],_0x340acc[_0x8ad1('0x35')]),_0xe0276c);if(_0x2b20ac['query'][_0x8ad1('0x3d')]){_0x24646b[_0x8ad1('0x3c')]=_[_0x8ad1('0x3e')](_0x24646b['where'],{'$or':_['map'](_0xe0276c,function(_0x4c0b49){if(_0x4c0b49[_0x8ad1('0x30')]!=='VIRTUAL'){var _0x7fa97c={};_0x7fa97c[_0x4c0b49[_0x8ad1('0x2a')]]={'$like':'%'+_0x2b20ac[_0x8ad1('0x33')][_0x8ad1('0x3d')]+'%'};return _0x7fa97c;}})});}_0x24646b=_[_0x8ad1('0x3e')]({},_0x24646b,_0x2b20ac[_0x8ad1('0x3f')]);var _0x2d5c6b={'where':_0x24646b[_0x8ad1('0x3c')]};return db[_0x8ad1('0x2d')][_0x8ad1('0x1f')](_0x2d5c6b)[_0x8ad1('0x27')](function(_0x1464b8){_0x5be269['count']=_0x1464b8;if(_0x2b20ac[_0x8ad1('0x33')][_0x8ad1('0x40')]){_0x24646b[_0x8ad1('0x41')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x8ad1('0x42')](_0x24646b);})[_0x8ad1('0x27')](function(_0x45fba5){_0x5be269[_0x8ad1('0x43')]=_0x45fba5;return _0x5be269;})['then'](respondWithFilteredResult(_0x47ab7d,_0x24646b))[_0x8ad1('0x44')](handleError(_0x47ab7d,null));};exports[_0x8ad1('0x45')]=function(_0x17e799,_0x1a54ef){var _0x2ca95a={'raw':!![],'where':{'id':_0x17e799[_0x8ad1('0x46')]['id']}},_0x5a939d={};_0x5a939d['model']=_[_0x8ad1('0x34')](db['Dynamics365Field'][_0x8ad1('0x2e')]);_0x5a939d[_0x8ad1('0x33')]=_[_0x8ad1('0x34')](_0x17e799[_0x8ad1('0x33')]);_0x5a939d['filters']=_['intersection'](_0x5a939d[_0x8ad1('0x32')],_0x5a939d[_0x8ad1('0x33')]);_0x2ca95a[_0x8ad1('0x37')]=_[_0x8ad1('0x36')](_0x5a939d[_0x8ad1('0x32')],qs[_0x8ad1('0x38')](_0x17e799['query'][_0x8ad1('0x38')]));_0x2ca95a['attributes']=_0x2ca95a['attributes'][_0x8ad1('0x39')]?_0x2ca95a['attributes']:_0x5a939d[_0x8ad1('0x32')];if(_0x17e799[_0x8ad1('0x33')][_0x8ad1('0x40')]){_0x2ca95a['include']=[{'all':!![]}];}_0x2ca95a=_[_0x8ad1('0x3e')]({},_0x2ca95a,_0x17e799[_0x8ad1('0x3f')]);return db[_0x8ad1('0x2d')][_0x8ad1('0x47')](_0x2ca95a)['then'](handleEntityNotFound(_0x1a54ef,null))[_0x8ad1('0x27')](respondWithResult(_0x1a54ef,null))[_0x8ad1('0x44')](handleError(_0x1a54ef,null));};exports[_0x8ad1('0x48')]=function(_0x184b1d,_0x707a0){return db[_0x8ad1('0x2d')][_0x8ad1('0x48')](_0x184b1d['body'],{})[_0x8ad1('0x27')](respondWithResult(_0x707a0,0xc9))[_0x8ad1('0x44')](handleError(_0x707a0,null));};exports[_0x8ad1('0x26')]=function(_0x5a433d,_0x2ee4cd){if(_0x5a433d[_0x8ad1('0x49')]['id']){delete _0x5a433d[_0x8ad1('0x49')]['id'];}return db[_0x8ad1('0x2d')][_0x8ad1('0x47')]({'where':{'id':_0x5a433d[_0x8ad1('0x46')]['id']}})[_0x8ad1('0x27')](handleEntityNotFound(_0x2ee4cd,null))[_0x8ad1('0x27')](saveUpdates(_0x5a433d[_0x8ad1('0x49')],null))[_0x8ad1('0x27')](respondWithResult(_0x2ee4cd,null))[_0x8ad1('0x44')](handleError(_0x2ee4cd,null));};exports[_0x8ad1('0x4a')]=function(_0x3318cb,_0x126659){return db['Dynamics365Field'][_0x8ad1('0x47')]({'where':{'id':_0x3318cb[_0x8ad1('0x46')]['id']}})['then'](handleEntityNotFound(_0x126659,null))[_0x8ad1('0x27')](removeEntity(_0x126659,null))[_0x8ad1('0x44')](handleError(_0x126659,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 3ea537b..8414eb2 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 _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 +var _0x2f94=['exports','define','Dynamics365Field','dynamics365_unique_index','idField','lodash','util','api','moment','bluebird','request-promise','rimraf','./intDynamics365Field.attributes'];(function(_0x2ab76b,_0x176579){var _0x201126=function(_0x11d8c8){while(--_0x11d8c8){_0x2ab76b['push'](_0x2ab76b['shift']());}};_0x201126(++_0x176579);}(_0x2f94,0x157));var _0x42f9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2f94[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x42f9('0x0'));var util=require(_0x42f9('0x1'));var logger=require('../../config/logger')(_0x42f9('0x2'));var moment=require(_0x42f9('0x3'));var BPromise=require(_0x42f9('0x4'));var rp=require(_0x42f9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x42f9('0x6'));var config=require('../../config/environment');var attributes=require(_0x42f9('0x7'));module[_0x42f9('0x8')]=function(_0x2923b9,_0xbbaca){return _0x2923b9[_0x42f9('0x9')](_0x42f9('0xa'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x42f9('0xb'),'fields':[_0x42f9('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 7c3704d..fb5cfc4 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 _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 +var _0x8de0=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','message','result','lodash','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x6949f1,_0x106daa){var _0x2d7590=function(_0x4c495c){while(--_0x4c495c){_0x6949f1['push'](_0x6949f1['shift']());}};_0x2d7590(++_0x106daa);}(_0x8de0,0x1b0));var _0x08de=function(_0x3f29e9,_0xc339d){_0x3f29e9=_0x3f29e9-0x0;var _0x124174=_0x8de0[_0x3f29e9];return _0x124174;};'use strict';var _=require(_0x08de('0x0'));var util=require('util');var moment=require(_0x08de('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x08de('0x2'));var db=require(_0x08de('0x3'))['db'];var utils=require(_0x08de('0x4'));var logger=require('../../config/logger')(_0x08de('0x5'));var config=require(_0x08de('0x6'));var jayson=require(_0x08de('0x7'));var client=jayson[_0x08de('0x8')][_0x08de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x380451,_0x1f4638,_0xff38bd){return new BPromise(function(_0x536fd4,_0x3a2773){return client[_0x08de('0xa')](_0x380451,_0xff38bd)[_0x08de('0xb')](function(_0x5b4578){logger[_0x08de('0xc')](_0x08de('0xd'),_0x1f4638,'request\x20sent');logger[_0x08de('0xe')](_0x08de('0xf'),_0x1f4638,'request\x20sent',JSON['stringify'](_0x5b4578));if(_0x5b4578[_0x08de('0x10')]){if(_0x5b4578[_0x08de('0x10')]['code']===0x1f4){logger[_0x08de('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x1f4638,_0x5b4578['error'][_0x08de('0x11')]);return _0x3a2773(_0x5b4578[_0x08de('0x10')][_0x08de('0x11')]);}logger[_0x08de('0x10')](_0x08de('0xd'),_0x1f4638,_0x5b4578[_0x08de('0x10')]['message']);return _0x536fd4(_0x5b4578[_0x08de('0x10')][_0x08de('0x11')]);}else{logger[_0x08de('0xc')](_0x08de('0xd'),_0x1f4638,'request\x20sent');_0x536fd4(_0x5b4578[_0x08de('0x12')][_0x08de('0x11')]);}})['catch'](function(_0x13f355){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x1f4638,_0x13f355);_0x3a2773(_0x13f355);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 3fcbdcd..41c21cb 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 _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 +var _0x5875=['express','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout'];(function(_0x3af9f1,_0x37a0e2){var _0x15004d=function(_0x4320b8){while(--_0x4320b8){_0x3af9f1['push'](_0x3af9f1['shift']());}};_0x15004d(++_0x37a0e2);}(_0x5875,0xf7));var _0x5587=function(_0x15103f,_0x9caa2){_0x15103f=_0x15103f-0x0;var _0x4c4a6b=_0x5875[_0x15103f];return _0x4c4a6b;};'use strict';var multer=require(_0x5587('0x0'));var util=require('util');var path=require(_0x5587('0x1'));var timeout=require(_0x5587('0x2'));var express=require(_0x5587('0x3'));var router=express['Router']();var fs_extra=require(_0x5587('0x4'));var auth=require(_0x5587('0x5'));var interaction=require(_0x5587('0x6'));var config=require('../../config/environment');var controller=require(_0x5587('0x7'));router[_0x5587('0x8')]('/',auth[_0x5587('0x9')](),controller[_0x5587('0xa')]);router['get']('/:id',auth[_0x5587('0x9')](),controller[_0x5587('0xb')]);router[_0x5587('0x8')](_0x5587('0xc'),auth[_0x5587('0x9')](),controller[_0x5587('0xd')]);router[_0x5587('0x8')](_0x5587('0xe'),auth['isAuthenticated'](),controller[_0x5587('0xf')]);router[_0x5587('0x10')]('/',auth[_0x5587('0x9')](),controller[_0x5587('0x11')]);router[_0x5587('0x10')](_0x5587('0xc'),auth['isAuthenticated'](),controller[_0x5587('0x12')]);router[_0x5587('0x13')]('/:id',auth[_0x5587('0x9')](),controller[_0x5587('0x14')]);router[_0x5587('0x15')](_0x5587('0x16'),auth['isAuthenticated'](),controller[_0x5587('0x17')]);module[_0x5587('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 22d1d5c..ac726eb 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 _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 +var _0xfff0=['username','exports','STRING'];(function(_0x22df9f,_0x9ec477){var _0x4ed906=function(_0x3bdb69){while(--_0x3bdb69){_0x22df9f['push'](_0x22df9f['shift']());}};_0x4ed906(++_0x9ec477);}(_0xfff0,0x139));var _0x0fff=function(_0x3679db,_0x1c3a2f){_0x3679db=_0x3679db-0x0;var _0x5a6212=_0xfff0[_0x3679db];return _0x5a6212;};'use strict';var Sequelize=require('sequelize');module[_0x0fff('0x0')]={'name':{'type':Sequelize[_0x0fff('0x1')]},'description':{'type':Sequelize[_0x0fff('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x0fff('0x2')},'apiKey':{'type':Sequelize[_0x0fff('0x1')]},'remoteUri':{'type':Sequelize[_0x0fff('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x0fff('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index ec061ea..1eea589 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 _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 +var _0x453b=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','FreshdeskAccount','fieldName','type','key','model','keys','intersection','query','attributes','fields','nolimit','order','sort','filters','filter','where','merge','include','findAll','rows','show','params','rawAttributes','length','includeAll','options','find','catch','create','body','getConfigurations','FreshdeskConfiguration','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','findOne','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','description','priority','source','group','company','remove','includes','default','custom_dropdown','label','choices','capitalize','test','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x2f31d0,_0x4fce9a){var _0x1d0256=function(_0x3f1ed5){while(--_0x3f1ed5){_0x2f31d0['push'](_0x2f31d0['shift']());}};_0x1d0256(++_0x4fce9a);}(_0x453b,0x164));var _0xb453=function(_0x1857d0,_0x6eade0){_0x1857d0=_0x1857d0-0x0;var _0x3e3c46=_0x453b[_0x1857d0];return _0x3e3c46;};'use strict';var emlformat=require(_0xb453('0x0'));var rimraf=require(_0xb453('0x1'));var zipdir=require(_0xb453('0x2'));var jsonpatch=require(_0xb453('0x3'));var rp=require(_0xb453('0x4'));var moment=require(_0xb453('0x5'));var BPromise=require(_0xb453('0x6'));var Mustache=require(_0xb453('0x7'));var util=require(_0xb453('0x8'));var path=require(_0xb453('0x9'));var sox=require(_0xb453('0xa'));var csv=require(_0xb453('0xb'));var ejs=require(_0xb453('0xc'));var fs=require('fs');var fs_extra=require(_0xb453('0xd'));var _=require(_0xb453('0xe'));var squel=require(_0xb453('0xf'));var crypto=require('crypto');var jsforce=require(_0xb453('0x10'));var deskjs=require(_0xb453('0x11'));var toCsv=require('to-csv');var querystring=require(_0xb453('0x12'));var Papa=require('papaparse');var Redis=require(_0xb453('0x13'));var authService=require(_0xb453('0x14'));var qs=require(_0xb453('0x15'));var as=require(_0xb453('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb453('0x17'))(_0xb453('0x18'));var utils=require(_0xb453('0x19'));var config=require(_0xb453('0x1a'));var licenseUtil=require(_0xb453('0x1b'));var db=require(_0xb453('0x1c'))['db'];var integrations=require(_0xb453('0x1d'));function respondWithStatusCode(_0x22e39b,_0x2d24b9){_0x2d24b9=_0x2d24b9||0xcc;return function(_0x5deeab){if(_0x5deeab){return _0x22e39b['sendStatus'](_0x2d24b9);}return _0x22e39b['status'](_0x2d24b9)[_0xb453('0x1e')]();};}function respondWithResult(_0x50d908,_0x3853fb){_0x3853fb=_0x3853fb||0xc8;return function(_0x3cd12d){if(_0x3cd12d){return _0x50d908[_0xb453('0x1f')](_0x3853fb)['json'](_0x3cd12d);}};}function respondWithFilteredResult(_0x5ee747,_0x30550b){return function(_0x376b8e){if(_0x376b8e){var _0x1f8b95=typeof _0x30550b[_0xb453('0x20')]===_0xb453('0x21')&&typeof _0x30550b[_0xb453('0x22')]===_0xb453('0x21');var _0x1f8604=_0x376b8e[_0xb453('0x23')];var _0x55d4d8=_0x1f8b95?0x0:_0x30550b['offset'];var _0x521542=_0x1f8b95?_0x376b8e['count']:_0x30550b[_0xb453('0x20')]+_0x30550b[_0xb453('0x22')];var _0x25403e;if(_0x521542>=_0x1f8604){_0x521542=_0x1f8604;_0x25403e=0xc8;}else{_0x25403e=0xce;}_0x5ee747[_0xb453('0x1f')](_0x25403e);return _0x5ee747[_0xb453('0x24')](_0xb453('0x25'),_0x55d4d8+'-'+_0x521542+'/'+_0x1f8604)['json'](_0x376b8e);}return null;};}function patchUpdates(_0x4d1cd7){return function(_0x57293a){try{jsonpatch[_0xb453('0x26')](_0x57293a,_0x4d1cd7,!![]);}catch(_0x50cab2){return BPromise[_0xb453('0x27')](_0x50cab2);}return _0x57293a[_0xb453('0x28')]();};}function saveUpdates(_0x1f87bf,_0x22f284){return function(_0xfffaf){if(_0xfffaf){return _0xfffaf[_0xb453('0x29')](_0x1f87bf)[_0xb453('0x2a')](function(_0x5f8a52){return _0x5f8a52;});}return null;};}function removeEntity(_0x1ab2b6,_0x587862){return function(_0x19e591){if(_0x19e591){return _0x19e591[_0xb453('0x2b')]()[_0xb453('0x2a')](function(){_0x1ab2b6[_0xb453('0x1f')](0xcc)[_0xb453('0x1e')]();});}};}function handleEntityNotFound(_0x45a745,_0x31592f){return function(_0x35293f){if(!_0x35293f){_0x45a745[_0xb453('0x2c')](0x194);}return _0x35293f;};}function handleError(_0x1e65cc,_0x3ecdf6){_0x3ecdf6=_0x3ecdf6||0x1f4;return function(_0x1b2585){logger[_0xb453('0x2d')](_0x1b2585['stack']);if(_0x1b2585[_0xb453('0x2e')]){delete _0x1b2585[_0xb453('0x2e')];}_0x1e65cc[_0xb453('0x1f')](_0x3ecdf6)[_0xb453('0x2f')](_0x1b2585);};}exports[_0xb453('0x30')]=function(_0x3587f9,_0x1a78d0){var _0x2ab342={},_0x1a6c72={},_0x479cc7={'count':0x0,'rows':[]};var _0x3e7418=_[_0xb453('0x31')](db[_0xb453('0x32')]['rawAttributes'],function(_0x4ae042){return{'name':_0x4ae042[_0xb453('0x33')],'type':_0x4ae042[_0xb453('0x34')][_0xb453('0x35')]};});_0x1a6c72[_0xb453('0x36')]=_['map'](_0x3e7418,'name');_0x1a6c72['query']=_[_0xb453('0x37')](_0x3587f9['query']);_0x1a6c72['filters']=_[_0xb453('0x38')](_0x1a6c72[_0xb453('0x36')],_0x1a6c72[_0xb453('0x39')]);_0x2ab342[_0xb453('0x3a')]=_[_0xb453('0x38')](_0x1a6c72[_0xb453('0x36')],qs[_0xb453('0x3b')](_0x3587f9[_0xb453('0x39')]['fields']));_0x2ab342['attributes']=_0x2ab342[_0xb453('0x3a')]['length']?_0x2ab342['attributes']:_0x1a6c72[_0xb453('0x36')];if(!_0x3587f9[_0xb453('0x39')]['hasOwnProperty'](_0xb453('0x3c'))){_0x2ab342[_0xb453('0x22')]=qs[_0xb453('0x22')](_0x3587f9[_0xb453('0x39')][_0xb453('0x22')]);_0x2ab342['offset']=qs['offset'](_0x3587f9['query'][_0xb453('0x20')]);}_0x2ab342[_0xb453('0x3d')]=qs[_0xb453('0x3e')](_0x3587f9['query'][_0xb453('0x3e')]);_0x2ab342['where']=qs[_0xb453('0x3f')](_['pick'](_0x3587f9[_0xb453('0x39')],_0x1a6c72[_0xb453('0x3f')]),_0x3e7418);if(_0x3587f9[_0xb453('0x39')][_0xb453('0x40')]){_0x2ab342[_0xb453('0x41')]=_[_0xb453('0x42')](_0x2ab342[_0xb453('0x41')],{'$or':_[_0xb453('0x31')](_0x3e7418,function(_0x17f851){if(_0x17f851[_0xb453('0x34')]!=='VIRTUAL'){var _0x5461e8={};_0x5461e8[_0x17f851[_0xb453('0x2e')]]={'$like':'%'+_0x3587f9[_0xb453('0x39')][_0xb453('0x40')]+'%'};return _0x5461e8;}})});}_0x2ab342=_[_0xb453('0x42')]({},_0x2ab342,_0x3587f9['options']);var _0x49a4f2={'where':_0x2ab342['where']};return db[_0xb453('0x32')][_0xb453('0x23')](_0x49a4f2)['then'](function(_0x562120){_0x479cc7[_0xb453('0x23')]=_0x562120;if(_0x3587f9[_0xb453('0x39')]['includeAll']){_0x2ab342[_0xb453('0x43')]=[{'all':!![]}];}return db[_0xb453('0x32')][_0xb453('0x44')](_0x2ab342);})[_0xb453('0x2a')](function(_0x45bba2){_0x479cc7[_0xb453('0x45')]=_0x45bba2;return _0x479cc7;})['then'](respondWithFilteredResult(_0x1a78d0,_0x2ab342))['catch'](handleError(_0x1a78d0,null));};exports[_0xb453('0x46')]=function(_0x19fb6e,_0x427408){var _0x3bab40={'raw':![],'where':{'id':_0x19fb6e[_0xb453('0x47')]['id']}},_0x12cd2c={};_0x12cd2c[_0xb453('0x36')]=_[_0xb453('0x37')](db[_0xb453('0x32')][_0xb453('0x48')]);_0x12cd2c[_0xb453('0x39')]=_[_0xb453('0x37')](_0x19fb6e[_0xb453('0x39')]);_0x12cd2c['filters']=_[_0xb453('0x38')](_0x12cd2c['model'],_0x12cd2c[_0xb453('0x39')]);_0x3bab40[_0xb453('0x3a')]=_[_0xb453('0x38')](_0x12cd2c[_0xb453('0x36')],qs[_0xb453('0x3b')](_0x19fb6e[_0xb453('0x39')][_0xb453('0x3b')]));_0x3bab40[_0xb453('0x3a')]=_0x3bab40['attributes'][_0xb453('0x49')]?_0x3bab40[_0xb453('0x3a')]:_0x12cd2c[_0xb453('0x36')];if(_0x19fb6e[_0xb453('0x39')][_0xb453('0x4a')]){_0x3bab40[_0xb453('0x43')]=[{'all':!![]}];}_0x3bab40=_[_0xb453('0x42')]({},_0x3bab40,_0x19fb6e[_0xb453('0x4b')]);return db[_0xb453('0x32')][_0xb453('0x4c')](_0x3bab40)['then'](handleEntityNotFound(_0x427408,null))[_0xb453('0x2a')](respondWithResult(_0x427408,null))[_0xb453('0x4d')](handleError(_0x427408,null));};exports['create']=function(_0x3351df,_0x9b93c6){return db[_0xb453('0x32')][_0xb453('0x4e')](_0x3351df[_0xb453('0x4f')],{})['then'](respondWithResult(_0x9b93c6,0xc9))[_0xb453('0x4d')](handleError(_0x9b93c6,null));};exports[_0xb453('0x29')]=function(_0x4c2a74,_0x24ba2c){if(_0x4c2a74['body']['id']){delete _0x4c2a74[_0xb453('0x4f')]['id'];}return db[_0xb453('0x32')]['find']({'where':{'id':_0x4c2a74[_0xb453('0x47')]['id']}})[_0xb453('0x2a')](handleEntityNotFound(_0x24ba2c,null))[_0xb453('0x2a')](saveUpdates(_0x4c2a74[_0xb453('0x4f')],null))['then'](respondWithResult(_0x24ba2c,null))['catch'](handleError(_0x24ba2c,null));};exports[_0xb453('0x2b')]=function(_0x5bc228,_0x54f917){return db[_0xb453('0x32')][_0xb453('0x4c')]({'where':{'id':_0x5bc228['params']['id']}})[_0xb453('0x2a')](handleEntityNotFound(_0x54f917,null))[_0xb453('0x2a')](removeEntity(_0x54f917,null))['catch'](handleError(_0x54f917,null));};exports[_0xb453('0x50')]=function(_0x5ae3ac,_0x5bbfb2,_0x4c8d84){var _0x40d172={};var _0x1bef48={};var _0x3abe00;var _0x5a534c;return db[_0xb453('0x32')]['findOne']({'where':{'id':_0x5ae3ac[_0xb453('0x47')]['id']}})[_0xb453('0x2a')](handleEntityNotFound(_0x5bbfb2,null))['then'](function(_0x255682){if(_0x255682){_0x3abe00=_0x255682;_0x1bef48['model']=_[_0xb453('0x37')](db[_0xb453('0x51')]['rawAttributes']);_0x1bef48[_0xb453('0x39')]=_[_0xb453('0x37')](_0x5ae3ac[_0xb453('0x39')]);_0x1bef48['filters']=_[_0xb453('0x38')](_0x1bef48['model'],_0x1bef48['query']);_0x40d172[_0xb453('0x3a')]=_[_0xb453('0x38')](_0x1bef48['model'],qs[_0xb453('0x3b')](_0x5ae3ac['query'][_0xb453('0x3b')]));_0x40d172[_0xb453('0x3a')]=_0x40d172[_0xb453('0x3a')][_0xb453('0x49')]?_0x40d172[_0xb453('0x3a')]:_0x1bef48[_0xb453('0x36')];_0x40d172['order']=qs['sort'](_0x5ae3ac[_0xb453('0x39')]['sort']);_0x40d172[_0xb453('0x41')]=qs['filters'](_[_0xb453('0x52')](_0x5ae3ac[_0xb453('0x39')],_0x1bef48['filters']));if(_0x5ae3ac['query'][_0xb453('0x40')]){_0x40d172[_0xb453('0x41')]=_[_0xb453('0x42')](_0x40d172[_0xb453('0x41')],{'$or':_[_0xb453('0x31')](_0x40d172[_0xb453('0x3a')],function(_0x4c1c66){var _0x54afbd={};_0x54afbd[_0x4c1c66]={'$like':'%'+_0x5ae3ac['query'][_0xb453('0x40')]+'%'};return _0x54afbd;})});}_0x40d172=_[_0xb453('0x42')]({},_0x40d172,_0x5ae3ac[_0xb453('0x4b')]);return _0x3abe00[_0xb453('0x50')](_0x40d172);}})[_0xb453('0x2a')](function(_0x56c1a7){if(_0x56c1a7){_0x5a534c=_0x56c1a7[_0xb453('0x49')];if(!_0x5ae3ac['query'][_0xb453('0x53')](_0xb453('0x3c'))){_0x40d172[_0xb453('0x22')]=qs[_0xb453('0x22')](_0x5ae3ac[_0xb453('0x39')][_0xb453('0x22')]);_0x40d172[_0xb453('0x20')]=qs['offset'](_0x5ae3ac['query'][_0xb453('0x20')]);}return _0x3abe00[_0xb453('0x50')](_0x40d172);}})[_0xb453('0x2a')](function(_0x186162){if(_0x186162){return _0x186162?{'count':_0x5a534c,'rows':_0x186162}:null;}})[_0xb453('0x2a')](respondWithResult(_0x5bbfb2,null))[_0xb453('0x4d')](handleError(_0x5bbfb2,null));};exports[_0xb453('0x54')]=function(_0x3c949d,_0x16736a,_0x1b31f5){if(_0x3c949d[_0xb453('0x4f')]['id']){delete _0x3c949d[_0xb453('0x4f')]['id'];}return db[_0xb453('0x32')]['findOne']({'where':{'id':_0x3c949d[_0xb453('0x47')]['id']}})[_0xb453('0x2a')](handleEntityNotFound(_0x16736a,null))[_0xb453('0x2a')](function(_0x189f97){if(_0x189f97){_0x3c949d[_0xb453('0x4f')][_0xb453('0x55')]=_0x189f97['id'];_0x3c949d['body'][_0xb453('0x56')]=integrations['getSubjects'](_0x3c949d[_0xb453('0x4f')][_0xb453('0x57')],_0x3c949d[_0xb453('0x4f')][_0xb453('0x34')]);_0x3c949d['body'][_0xb453('0x58')]=integrations[_0xb453('0x59')](_0x3c949d[_0xb453('0x4f')][_0xb453('0x57')],_0x3c949d[_0xb453('0x4f')][_0xb453('0x34')]);return db[_0xb453('0x51')][_0xb453('0x4e')](_0x3c949d[_0xb453('0x4f')],{'include':[{'model':db[_0xb453('0x5a')],'as':'Subjects'},{'model':db[_0xb453('0x5a')],'as':_0xb453('0x58')}]});}return null;})[_0xb453('0x2a')](respondWithResult(_0x16736a,null))[_0xb453('0x4d')](handleError(_0x16736a,null));};exports[_0xb453('0x5b')]=function(_0x32b057,_0x51d528,_0x895e4e){var _0x3e466a='';return db[_0xb453('0x32')][_0xb453('0x5c')]({'where':{'id':_0x32b057[_0xb453('0x47')]['id']},'attributes':['id',_0xb453('0x5d'),_0xb453('0x5e')]})[_0xb453('0x2a')](handleEntityNotFound(_0x51d528,null))[_0xb453('0x2a')](function(_0x343692){if(_0x343692){_0x3e466a=_0x343692['remoteUri'];var _0x432385=_0x3e466a[_0xb453('0x5f')](-0x1);if(_0x432385==='/'){_0x3e466a=_0x3e466a[_0xb453('0x60')](0x0,_0x3e466a[_0xb453('0x61')](_0x432385));}return rp({'method':_0xb453('0x62'),'uri':util[_0xb453('0x63')](_0xb453('0x64'),_0x3e466a,_0xb453('0x65')),'headers':{'Authorization':util[_0xb453('0x63')](_0xb453('0x66'),new Buffer(util[_0xb453('0x63')](_0xb453('0x67'),_0x343692[_0xb453('0x5e')]))[_0xb453('0x68')](_0xb453('0x69')))},'json':!![]});}})[_0xb453('0x2a')](function(_0x4f32ff){if(_0x4f32ff){var _0x296325=[_0xb453('0x6a'),_0xb453('0x6b'),'agent',_0xb453('0x6c'),_0xb453('0x1f'),_0xb453('0x6d'),'group',_0xb453('0x6e'),'ticket_type',_0xb453('0x6f'),_0xb453('0x70')];_[_0xb453('0x71')](_0x4f32ff,function(_0x1fe938){return _0x296325[_0xb453('0x72')](_0x1fe938['name'])||!_0x1fe938[_0xb453('0x73')]&&_0x1fe938[_0xb453('0x34')]!=='custom_text'&&_0x1fe938[_0xb453('0x34')]!==_0xb453('0x74');});return{'count':_0x4f32ff['length'],'rows':_[_0xb453('0x31')](_0x4f32ff,function(_0x5681ed){return{'id':_0x5681ed['name'],'name':_0x5681ed[_0xb453('0x75')],'custom':!_0x5681ed[_0xb453('0x73')],'options':_0x5681ed[_0xb453('0x76')]?_['map'](_0x5681ed[_0xb453('0x76')],function(_0x59d753){return{'name':_[_0xb453('0x77')](_0x59d753),'value':_0x59d753};}):[]};})};}})[_0xb453('0x2a')](respondWithResult(_0x51d528,null))[_0xb453('0x4d')](function(_0x5f3244){var _0x143ccf=_0x32b057[_0xb453('0x39')][_0xb453('0x78')]?0x1f4:_0x5f3244['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xb453('0x5b'),_0x143ccf,JSON[_0xb453('0x79')](_0x5f3244));delete _0x5f3244[_0xb453('0x2e')];if(_0x143ccf===0x191){_0x143ccf=0x190;}_0x51d528[_0xb453('0x1f')](_0x143ccf)['send'](_0x32b057[_0xb453('0x39')][_0xb453('0x78')]?{'message':_0xb453('0x7a'),'statusCode':_0x5f3244[_0xb453('0x7b')]}:_0x5f3244);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 5bc1f14..25c5897 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 _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 +var _0xce82=['FreshdeskAccount','int_freshdesk_accounts','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define'];(function(_0x3797e0,_0x55e8be){var _0x412f20=function(_0x1ee16f){while(--_0x1ee16f){_0x3797e0['push'](_0x3797e0['shift']());}};_0x412f20(++_0x55e8be);}(_0xce82,0x13a));var _0x2ce8=function(_0x17963b,_0x21fbea){_0x17963b=_0x17963b-0x0;var _0x3faa26=_0xce82[_0x17963b];return _0x3faa26;};'use strict';var _=require(_0x2ce8('0x0'));var util=require(_0x2ce8('0x1'));var logger=require('../../config/logger')(_0x2ce8('0x2'));var moment=require(_0x2ce8('0x3'));var BPromise=require(_0x2ce8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ce8('0x5'));var rimraf=require(_0x2ce8('0x6'));var config=require(_0x2ce8('0x7'));var attributes=require(_0x2ce8('0x8'));var integrations=require(_0x2ce8('0x9'));module['exports']=function(_0x48349a,_0x13cc78){return _0x48349a[_0x2ce8('0xa')](_0x2ce8('0xb'),attributes,{'tableName':_0x2ce8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 10f5bdc..48aef96 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 _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 +var _0xec6b=['stringify','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','attributes','include','map','model','ShowFreshdeskAccount','find','raw','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x338be1,_0x37e9c3){var _0x3e1662=function(_0x2b6bc1){while(--_0x2b6bc1){_0x338be1['push'](_0x338be1['shift']());}};_0x3e1662(++_0x37e9c3);}(_0xec6b,0x129));var _0xbec6=function(_0x4b4d02,_0x3a49cc){_0x4b4d02=_0x4b4d02-0x0;var _0x4d4b24=_0xec6b[_0x4b4d02];return _0x4d4b24;};'use strict';var _=require(_0xbec6('0x0'));var util=require(_0xbec6('0x1'));var moment=require('moment');var BPromise=require(_0xbec6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbec6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbec6('0x4'));var logger=require(_0xbec6('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x51c972,_0x6d3729,_0x5df981){return new BPromise(function(_0x58edd9,_0x3a0c1c){return client[_0xbec6('0x6')](_0x51c972,_0x5df981)[_0xbec6('0x7')](function(_0x3fff36){logger[_0xbec6('0x8')](_0xbec6('0x9'),_0x6d3729,_0xbec6('0xa'));logger[_0xbec6('0xb')](_0xbec6('0xc'),_0x6d3729,_0xbec6('0xa'),JSON[_0xbec6('0xd')](_0x3fff36));if(_0x3fff36[_0xbec6('0xe')]){if(_0x3fff36['error'][_0xbec6('0xf')]===0x1f4){logger['error'](_0xbec6('0x9'),_0x6d3729,_0x3fff36[_0xbec6('0xe')]['message']);return _0x3a0c1c(_0x3fff36[_0xbec6('0xe')]['message']);}logger[_0xbec6('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x6d3729,_0x3fff36[_0xbec6('0xe')]['message']);return _0x58edd9(_0x3fff36[_0xbec6('0xe')][_0xbec6('0x10')]);}else{logger[_0xbec6('0x8')](_0xbec6('0x9'),_0x6d3729,'request\x20sent');_0x58edd9(_0x3fff36[_0xbec6('0x11')]['message']);}})[_0xbec6('0x12')](function(_0x20924c){logger[_0xbec6('0xe')](_0xbec6('0x9'),_0x6d3729,_0x20924c);_0x3a0c1c(_0x20924c);});});}exports[_0xbec6('0x13')]=function(_0x4a18bd){var _0x2e4fbc=this;return new Promise(function(_0x98a9f3,_0x49ce37){return db[_0xbec6('0x14')][_0xbec6('0x15')]({'raw':_0x4a18bd[_0xbec6('0x16')]?_0x4a18bd[_0xbec6('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4a18bd[_0xbec6('0x16')]?_0x4a18bd[_0xbec6('0x16')][_0xbec6('0x17')]||null:null,'attributes':_0x4a18bd[_0xbec6('0x16')]?_0x4a18bd['options'][_0xbec6('0x18')]||null:null,'limit':_0x4a18bd[_0xbec6('0x16')]?_0x4a18bd[_0xbec6('0x16')]['limit']||null:null,'include':_0x4a18bd[_0xbec6('0x16')]?_0x4a18bd['options'][_0xbec6('0x19')]?_[_0xbec6('0x1a')](_0x4a18bd[_0xbec6('0x16')][_0xbec6('0x19')],function(_0x1d882a){return{'model':db[_0x1d882a[_0xbec6('0x1b')]],'as':_0x1d882a['as'],'attributes':_0x1d882a[_0xbec6('0x18')],'include':_0x1d882a[_0xbec6('0x19')]?_[_0xbec6('0x1a')](_0x1d882a[_0xbec6('0x19')],function(_0x59dea8){return{'model':db[_0x59dea8[_0xbec6('0x1b')]],'as':_0x59dea8['as'],'attributes':_0x59dea8[_0xbec6('0x18')],'include':_0x59dea8['include']?_[_0xbec6('0x1a')](_0x59dea8['include'],function(_0x17b98d){return{'model':db[_0x17b98d[_0xbec6('0x1b')]],'as':_0x17b98d['as'],'attributes':_0x17b98d[_0xbec6('0x18')]};}):[]};}):[]};}):[]:[]})[_0xbec6('0x7')](function(_0x450b5f){logger[_0xbec6('0x8')](_0xbec6('0x13'),_0x4a18bd);logger['debug'](_0xbec6('0x13'),_0x4a18bd,JSON[_0xbec6('0xd')](_0x450b5f));_0x98a9f3(_0x450b5f);})[_0xbec6('0x12')](function(_0x1e5bc0){logger['error'](_0xbec6('0x13'),_0x1e5bc0[_0xbec6('0x10')],_0x4a18bd);_0x49ce37(_0x2e4fbc['error'](0x1f4,_0x1e5bc0[_0xbec6('0x10')]));});});};exports[_0xbec6('0x1c')]=function(_0x31a54a){var _0x28a6e1=this;return new Promise(function(_0x5517e3,_0x447a96){return db['FreshdeskAccount'][_0xbec6('0x1d')]({'raw':_0x31a54a['options']?_0x31a54a['options'][_0xbec6('0x1e')]===undefined?!![]:![]:!![],'where':_0x31a54a[_0xbec6('0x16')]?_0x31a54a['options']['where']||null:null,'attributes':_0x31a54a[_0xbec6('0x16')]?_0x31a54a[_0xbec6('0x16')][_0xbec6('0x18')]||null:null,'include':_0x31a54a[_0xbec6('0x16')]?_0x31a54a[_0xbec6('0x16')]['include']?_[_0xbec6('0x1a')](_0x31a54a[_0xbec6('0x16')][_0xbec6('0x19')],function(_0x4c0c97){return{'model':db[_0x4c0c97[_0xbec6('0x1b')]],'as':_0x4c0c97['as'],'attributes':_0x4c0c97[_0xbec6('0x18')],'include':_0x4c0c97[_0xbec6('0x19')]?_[_0xbec6('0x1a')](_0x4c0c97['include'],function(_0x333f33){return{'model':db[_0x333f33[_0xbec6('0x1b')]],'as':_0x333f33['as'],'attributes':_0x333f33[_0xbec6('0x18')],'include':_0x333f33[_0xbec6('0x19')]?_[_0xbec6('0x1a')](_0x333f33['include'],function(_0x3baec0){return{'model':db[_0x3baec0[_0xbec6('0x1b')]],'as':_0x3baec0['as'],'attributes':_0x3baec0['attributes']};}):[]};}):[]};}):[]:[]})[_0xbec6('0x7')](function(_0x4c1249){logger[_0xbec6('0x8')](_0xbec6('0x1c'),_0x31a54a);logger['debug'](_0xbec6('0x1c'),_0x31a54a,JSON[_0xbec6('0xd')](_0x4c1249));_0x5517e3(_0x4c1249);})[_0xbec6('0x12')](function(_0x2fd307){logger['error']('ShowFreshdeskAccount',_0x2fd307[_0xbec6('0x10')],_0x31a54a);_0x447a96(_0x28a6e1[_0xbec6('0xe')](0x1f4,_0x2fd307[_0xbec6('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 1043614..24e498e 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 _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 +var _0x3b27=['/:id/fields','/:id/subjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x3b27,0x8a));var _0x73b2=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x3b27[_0x19b3f9];return _0x18c3f6;};'use strict';var multer=require('multer');var util=require(_0x73b2('0x0'));var path=require(_0x73b2('0x1'));var timeout=require(_0x73b2('0x2'));var express=require(_0x73b2('0x3'));var router=express[_0x73b2('0x4')]();var fs_extra=require(_0x73b2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x73b2('0x6'));var config=require('../../config/environment');var controller=require(_0x73b2('0x7'));router[_0x73b2('0x8')]('/',auth[_0x73b2('0x9')](),controller['index']);router[_0x73b2('0x8')](_0x73b2('0xa'),auth[_0x73b2('0x9')](),controller[_0x73b2('0xb')]);router[_0x73b2('0x8')](_0x73b2('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0x73b2('0x8')](_0x73b2('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x73b2('0x8')]('/:id/descriptions',auth[_0x73b2('0x9')](),controller[_0x73b2('0xe')]);router[_0x73b2('0x8')](_0x73b2('0xf'),auth['isAuthenticated'](),controller[_0x73b2('0x10')]);router[_0x73b2('0x11')]('/',auth[_0x73b2('0x9')](),controller[_0x73b2('0x12')]);router[_0x73b2('0x11')]('/:id/tags',auth[_0x73b2('0x9')](),controller[_0x73b2('0x13')]);router[_0x73b2('0x14')](_0x73b2('0xa'),auth['isAuthenticated'](),controller[_0x73b2('0x15')]);router[_0x73b2('0x16')](_0x73b2('0xa'),auth[_0x73b2('0x9')](),controller[_0x73b2('0x17')]);module[_0x73b2('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 0fa706d..3e81323 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 _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 +var _0xd773=['exports','STRING','sequelize'];(function(_0x4f0159,_0xaf2d85){var _0x2b53a8=function(_0x34e528){while(--_0x34e528){_0x4f0159['push'](_0x4f0159['shift']());}};_0x2b53a8(++_0xaf2d85);}(_0xd773,0x10a));var _0x3d77=function(_0x54c4bc,_0x298d05){_0x54c4bc=_0x54c4bc-0x0;var _0x2fe731=_0xd773[_0x54c4bc];return _0x2fe731;};'use strict';var Sequelize=require(_0x3d77('0x0'));module[_0x3d77('0x1')]={'name':{'type':Sequelize[_0x3d77('0x2')]},'description':{'type':Sequelize[_0x3d77('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 458521e..97a9ebb 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 _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 +var _0xdb45=['keys','options','find','create','body','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','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/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','catch','params'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xdb45,0xb6));var _0x5db4=function(_0x27237c,_0x36f1d4){_0x27237c=_0x27237c-0x0;var _0x1f412e=_0xdb45[_0x27237c];return _0x1f412e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5db4('0x0'));var zipdir=require(_0x5db4('0x1'));var jsonpatch=require(_0x5db4('0x2'));var rp=require('request-promise');var moment=require(_0x5db4('0x3'));var BPromise=require(_0x5db4('0x4'));var Mustache=require('mustache');var util=require(_0x5db4('0x5'));var path=require(_0x5db4('0x6'));var sox=require(_0x5db4('0x7'));var csv=require(_0x5db4('0x8'));var ejs=require(_0x5db4('0x9'));var fs=require('fs');var fs_extra=require(_0x5db4('0xa'));var _=require(_0x5db4('0xb'));var squel=require(_0x5db4('0xc'));var crypto=require(_0x5db4('0xd'));var jsforce=require(_0x5db4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5db4('0x8'));var querystring=require(_0x5db4('0xf'));var Papa=require(_0x5db4('0x10'));var Redis=require(_0x5db4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5db4('0x12'));var as=require(_0x5db4('0x13'));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(_0x5db4('0x14'));var db=require(_0x5db4('0x15'))['db'];function respondWithStatusCode(_0x5d5781,_0x4a9a50){_0x4a9a50=_0x4a9a50||0xcc;return function(_0xc7c24d){if(_0xc7c24d){return _0x5d5781[_0x5db4('0x16')](_0x4a9a50);}return _0x5d5781[_0x5db4('0x17')](_0x4a9a50)[_0x5db4('0x18')]();};}function respondWithResult(_0x4fcf54,_0x56752b){_0x56752b=_0x56752b||0xc8;return function(_0x8ac5c9){if(_0x8ac5c9){return _0x4fcf54[_0x5db4('0x17')](_0x56752b)[_0x5db4('0x19')](_0x8ac5c9);}};}function respondWithFilteredResult(_0x46e1b3,_0x5bb33d){return function(_0x4de025){if(_0x4de025){var _0x35c4d9=typeof _0x5bb33d[_0x5db4('0x1a')]===_0x5db4('0x1b')&&typeof _0x5bb33d[_0x5db4('0x1c')]===_0x5db4('0x1b');var _0x3c55e1=_0x4de025[_0x5db4('0x1d')];var _0x588bb0=_0x35c4d9?0x0:_0x5bb33d[_0x5db4('0x1a')];var _0x2eb2e1=_0x35c4d9?_0x4de025[_0x5db4('0x1d')]:_0x5bb33d['offset']+_0x5bb33d['limit'];var _0x373e6f;if(_0x2eb2e1>=_0x3c55e1){_0x2eb2e1=_0x3c55e1;_0x373e6f=0xc8;}else{_0x373e6f=0xce;}_0x46e1b3[_0x5db4('0x17')](_0x373e6f);return _0x46e1b3[_0x5db4('0x1e')](_0x5db4('0x1f'),_0x588bb0+'-'+_0x2eb2e1+'/'+_0x3c55e1)[_0x5db4('0x19')](_0x4de025);}return null;};}function patchUpdates(_0x5f26e5){return function(_0x32e2dc){try{jsonpatch[_0x5db4('0x20')](_0x32e2dc,_0x5f26e5,!![]);}catch(_0x2390c2){return BPromise[_0x5db4('0x21')](_0x2390c2);}return _0x32e2dc[_0x5db4('0x22')]();};}function saveUpdates(_0x440f6b,_0x393d82){return function(_0x5c142c){if(_0x5c142c){return _0x5c142c[_0x5db4('0x23')](_0x440f6b)[_0x5db4('0x24')](function(_0x113b70){return _0x113b70;});}return null;};}function removeEntity(_0x2101e8,_0x930f01){return function(_0x43a0d9){if(_0x43a0d9){return _0x43a0d9[_0x5db4('0x25')]()[_0x5db4('0x24')](function(){_0x2101e8[_0x5db4('0x17')](0xcc)[_0x5db4('0x18')]();});}};}function handleEntityNotFound(_0x657705,_0x172411){return function(_0x3e5f88){if(!_0x3e5f88){_0x657705[_0x5db4('0x16')](0x194);}return _0x3e5f88;};}function handleError(_0x346ac8,_0x2e23ba){_0x2e23ba=_0x2e23ba||0x1f4;return function(_0x32891d){logger[_0x5db4('0x26')](_0x32891d[_0x5db4('0x27')]);if(_0x32891d[_0x5db4('0x28')]){delete _0x32891d[_0x5db4('0x28')];}_0x346ac8['status'](_0x2e23ba)[_0x5db4('0x29')](_0x32891d);};}exports[_0x5db4('0x2a')]=function(_0x47c070,_0x4dc9c2){var _0x12b719={},_0x3e9e1b={},_0x1b0118={'count':0x0,'rows':[]};var _0x4846ed=_[_0x5db4('0x2b')](db[_0x5db4('0x2c')][_0x5db4('0x2d')],function(_0x14ba97){return{'name':_0x14ba97[_0x5db4('0x2e')],'type':_0x14ba97[_0x5db4('0x2f')][_0x5db4('0x30')]};});_0x3e9e1b[_0x5db4('0x31')]=_[_0x5db4('0x2b')](_0x4846ed,_0x5db4('0x28'));_0x3e9e1b[_0x5db4('0x32')]=_['keys'](_0x47c070['query']);_0x3e9e1b[_0x5db4('0x33')]=_[_0x5db4('0x34')](_0x3e9e1b[_0x5db4('0x31')],_0x3e9e1b[_0x5db4('0x32')]);_0x12b719[_0x5db4('0x35')]=_[_0x5db4('0x34')](_0x3e9e1b['model'],qs[_0x5db4('0x36')](_0x47c070['query']['fields']));_0x12b719[_0x5db4('0x35')]=_0x12b719[_0x5db4('0x35')][_0x5db4('0x37')]?_0x12b719[_0x5db4('0x35')]:_0x3e9e1b['model'];if(!_0x47c070['query'][_0x5db4('0x38')](_0x5db4('0x39'))){_0x12b719['limit']=qs['limit'](_0x47c070[_0x5db4('0x32')]['limit']);_0x12b719[_0x5db4('0x1a')]=qs[_0x5db4('0x1a')](_0x47c070[_0x5db4('0x32')][_0x5db4('0x1a')]);}_0x12b719[_0x5db4('0x3a')]=qs[_0x5db4('0x3b')](_0x47c070[_0x5db4('0x32')][_0x5db4('0x3b')]);_0x12b719['where']=qs[_0x5db4('0x33')](_[_0x5db4('0x3c')](_0x47c070[_0x5db4('0x32')],_0x3e9e1b[_0x5db4('0x33')]),_0x4846ed);if(_0x47c070['query'][_0x5db4('0x3d')]){_0x12b719[_0x5db4('0x3e')]=_[_0x5db4('0x3f')](_0x12b719[_0x5db4('0x3e')],{'$or':_['map'](_0x4846ed,function(_0x968067){if(_0x968067[_0x5db4('0x2f')]!==_0x5db4('0x40')){var _0x449363={};_0x449363[_0x968067[_0x5db4('0x28')]]={'$like':'%'+_0x47c070[_0x5db4('0x32')][_0x5db4('0x3d')]+'%'};return _0x449363;}})});}_0x12b719=_['merge']({},_0x12b719,_0x47c070['options']);var _0x25f8f8={'where':_0x12b719[_0x5db4('0x3e')]};return db[_0x5db4('0x2c')][_0x5db4('0x1d')](_0x25f8f8)[_0x5db4('0x24')](function(_0x526aa5){_0x1b0118[_0x5db4('0x1d')]=_0x526aa5;if(_0x47c070['query'][_0x5db4('0x41')]){_0x12b719[_0x5db4('0x42')]=[{'all':!![]}];}return db[_0x5db4('0x2c')][_0x5db4('0x43')](_0x12b719);})['then'](function(_0x79536f){_0x1b0118['rows']=_0x79536f;return _0x1b0118;})[_0x5db4('0x24')](respondWithFilteredResult(_0x4dc9c2,_0x12b719))[_0x5db4('0x44')](handleError(_0x4dc9c2,null));};exports['show']=function(_0x1ac3ba,_0x1f0ecd){var _0x368a34={'raw':![],'where':{'id':_0x1ac3ba[_0x5db4('0x45')]['id']}},_0x3bee54={};_0x3bee54['model']=_[_0x5db4('0x46')](db['FreshdeskConfiguration'][_0x5db4('0x2d')]);_0x3bee54[_0x5db4('0x32')]=_[_0x5db4('0x46')](_0x1ac3ba['query']);_0x3bee54[_0x5db4('0x33')]=_[_0x5db4('0x34')](_0x3bee54[_0x5db4('0x31')],_0x3bee54['query']);_0x368a34['attributes']=_[_0x5db4('0x34')](_0x3bee54[_0x5db4('0x31')],qs[_0x5db4('0x36')](_0x1ac3ba['query'][_0x5db4('0x36')]));_0x368a34['attributes']=_0x368a34[_0x5db4('0x35')]['length']?_0x368a34[_0x5db4('0x35')]:_0x3bee54[_0x5db4('0x31')];if(_0x1ac3ba[_0x5db4('0x32')][_0x5db4('0x41')]){_0x368a34[_0x5db4('0x42')]=[{'all':!![]}];}_0x368a34=_[_0x5db4('0x3f')]({},_0x368a34,_0x1ac3ba[_0x5db4('0x47')]);return db[_0x5db4('0x2c')][_0x5db4('0x48')](_0x368a34)[_0x5db4('0x24')](handleEntityNotFound(_0x1f0ecd,null))['then'](respondWithResult(_0x1f0ecd,null))[_0x5db4('0x44')](handleError(_0x1f0ecd,null));};exports[_0x5db4('0x49')]=function(_0x27a502,_0x2dfa2d){return db[_0x5db4('0x2c')][_0x5db4('0x49')](_0x27a502[_0x5db4('0x4a')],{})[_0x5db4('0x24')](respondWithResult(_0x2dfa2d,0xc9))['catch'](handleError(_0x2dfa2d,null));};exports[_0x5db4('0x23')]=function(_0x4939b7,_0x2617b8){if(_0x4939b7[_0x5db4('0x4a')]['id']){delete _0x4939b7['body']['id'];}return db[_0x5db4('0x2c')]['find']({'where':{'id':_0x4939b7[_0x5db4('0x45')]['id']}})[_0x5db4('0x24')](handleEntityNotFound(_0x2617b8,null))[_0x5db4('0x24')](saveUpdates(_0x4939b7['body'],null))['then'](respondWithResult(_0x2617b8,null))[_0x5db4('0x44')](handleError(_0x2617b8,null));};exports[_0x5db4('0x25')]=function(_0xafb3c,_0xc02d63){return db[_0x5db4('0x2c')]['find']({'where':{'id':_0xafb3c[_0x5db4('0x45')]['id']}})[_0x5db4('0x24')](handleEntityNotFound(_0xc02d63,null))[_0x5db4('0x24')](removeEntity(_0xc02d63,null))[_0x5db4('0x44')](handleError(_0xc02d63,null));};exports[_0x5db4('0x4b')]=function(_0x2a91ce,_0x556b88,_0x1c68a5){var _0x1e57e1={};var _0x13116e={};var _0x3f92bc;var _0x1814e3;return db[_0x5db4('0x2c')][_0x5db4('0x4c')]({'where':{'id':_0x2a91ce['params']['id']}})[_0x5db4('0x24')](handleEntityNotFound(_0x556b88,null))['then'](function(_0x336b78){if(_0x336b78){_0x3f92bc=_0x336b78;_0x13116e[_0x5db4('0x31')]=_[_0x5db4('0x46')](db[_0x5db4('0x4d')][_0x5db4('0x2d')]);_0x13116e[_0x5db4('0x32')]=_['keys'](_0x2a91ce[_0x5db4('0x32')]);_0x13116e[_0x5db4('0x33')]=_[_0x5db4('0x34')](_0x13116e[_0x5db4('0x31')],_0x13116e[_0x5db4('0x32')]);_0x1e57e1['attributes']=_['intersection'](_0x13116e[_0x5db4('0x31')],qs[_0x5db4('0x36')](_0x2a91ce[_0x5db4('0x32')][_0x5db4('0x36')]));_0x1e57e1[_0x5db4('0x35')]=_0x1e57e1['attributes'][_0x5db4('0x37')]?_0x1e57e1['attributes']:_0x13116e[_0x5db4('0x31')];_0x1e57e1['order']=qs[_0x5db4('0x3b')](_0x2a91ce[_0x5db4('0x32')][_0x5db4('0x3b')]);_0x1e57e1[_0x5db4('0x3e')]=qs['filters'](_[_0x5db4('0x3c')](_0x2a91ce['query'],_0x13116e[_0x5db4('0x33')]));if(_0x2a91ce[_0x5db4('0x32')]['filter']){_0x1e57e1[_0x5db4('0x3e')]=_[_0x5db4('0x3f')](_0x1e57e1[_0x5db4('0x3e')],{'$or':_[_0x5db4('0x2b')](_0x1e57e1['attributes'],function(_0x5e0326){var _0x3e0c8a={};_0x3e0c8a[_0x5e0326]={'$like':'%'+_0x2a91ce[_0x5db4('0x32')][_0x5db4('0x3d')]+'%'};return _0x3e0c8a;})});}_0x1e57e1=_[_0x5db4('0x3f')]({},_0x1e57e1,_0x2a91ce[_0x5db4('0x47')]);return _0x3f92bc[_0x5db4('0x4b')](_0x1e57e1);}})[_0x5db4('0x24')](function(_0x229901){if(_0x229901){_0x1814e3=_0x229901[_0x5db4('0x37')];if(!_0x2a91ce[_0x5db4('0x32')][_0x5db4('0x38')]('nolimit')){_0x1e57e1[_0x5db4('0x1c')]=qs[_0x5db4('0x1c')](_0x2a91ce[_0x5db4('0x32')][_0x5db4('0x1c')]);_0x1e57e1['offset']=qs['offset'](_0x2a91ce['query'][_0x5db4('0x1a')]);}return _0x3f92bc[_0x5db4('0x4b')](_0x1e57e1);}})['then'](function(_0x43118f){if(_0x43118f){return _0x43118f?{'count':_0x1814e3,'rows':_0x43118f}:null;}})[_0x5db4('0x24')](respondWithResult(_0x556b88,null))[_0x5db4('0x44')](handleError(_0x556b88,null));};exports[_0x5db4('0x4e')]=function(_0x14eab3,_0x19ceef,_0x5b57e1){var _0x477d0c={};var _0x23bc02={};var _0x1ff9cd;var _0x168e30;return db[_0x5db4('0x2c')][_0x5db4('0x4c')]({'where':{'id':_0x14eab3[_0x5db4('0x45')]['id']}})[_0x5db4('0x24')](handleEntityNotFound(_0x19ceef,null))[_0x5db4('0x24')](function(_0x4ca902){if(_0x4ca902){_0x1ff9cd=_0x4ca902;_0x23bc02[_0x5db4('0x31')]=_[_0x5db4('0x46')](db[_0x5db4('0x4d')]['rawAttributes']);_0x23bc02['query']=_['keys'](_0x14eab3['query']);_0x23bc02[_0x5db4('0x33')]=_[_0x5db4('0x34')](_0x23bc02[_0x5db4('0x31')],_0x23bc02[_0x5db4('0x32')]);_0x477d0c['attributes']=_[_0x5db4('0x34')](_0x23bc02['model'],qs['fields'](_0x14eab3[_0x5db4('0x32')][_0x5db4('0x36')]));_0x477d0c[_0x5db4('0x35')]=_0x477d0c['attributes'][_0x5db4('0x37')]?_0x477d0c[_0x5db4('0x35')]:_0x23bc02['model'];_0x477d0c[_0x5db4('0x3a')]=qs[_0x5db4('0x3b')](_0x14eab3[_0x5db4('0x32')]['sort']);_0x477d0c[_0x5db4('0x3e')]=qs[_0x5db4('0x33')](_[_0x5db4('0x3c')](_0x14eab3[_0x5db4('0x32')],_0x23bc02['filters']));if(_0x14eab3[_0x5db4('0x32')][_0x5db4('0x3d')]){_0x477d0c[_0x5db4('0x3e')]=_[_0x5db4('0x3f')](_0x477d0c[_0x5db4('0x3e')],{'$or':_['map'](_0x477d0c[_0x5db4('0x35')],function(_0x47195a){var _0x255b4a={};_0x255b4a[_0x47195a]={'$like':'%'+_0x14eab3[_0x5db4('0x32')]['filter']+'%'};return _0x255b4a;})});}_0x477d0c=_[_0x5db4('0x3f')]({},_0x477d0c,_0x14eab3[_0x5db4('0x47')]);return _0x1ff9cd[_0x5db4('0x4e')](_0x477d0c);}})['then'](function(_0x5167fd){if(_0x5167fd){_0x168e30=_0x5167fd[_0x5db4('0x37')];if(!_0x14eab3['query'][_0x5db4('0x38')](_0x5db4('0x39'))){_0x477d0c[_0x5db4('0x1c')]=qs['limit'](_0x14eab3[_0x5db4('0x32')][_0x5db4('0x1c')]);_0x477d0c['offset']=qs[_0x5db4('0x1a')](_0x14eab3[_0x5db4('0x32')][_0x5db4('0x1a')]);}return _0x1ff9cd[_0x5db4('0x4e')](_0x477d0c);}})['then'](function(_0x536448){if(_0x536448){return _0x536448?{'count':_0x168e30,'rows':_0x536448}:null;}})[_0x5db4('0x24')](respondWithResult(_0x19ceef,null))[_0x5db4('0x44')](handleError(_0x19ceef,null));};exports[_0x5db4('0x4f')]=function(_0x1e0b06,_0x208bd4,_0xb734fb){var _0x3dafc2={};var _0x1a7879={};var _0x35820d;var _0x58079e;return db[_0x5db4('0x2c')][_0x5db4('0x4c')]({'where':{'id':_0x1e0b06[_0x5db4('0x45')]['id']}})[_0x5db4('0x24')](handleEntityNotFound(_0x208bd4,null))[_0x5db4('0x24')](function(_0x36976a){if(_0x36976a){_0x35820d=_0x36976a;_0x1a7879[_0x5db4('0x31')]=_[_0x5db4('0x46')](db[_0x5db4('0x4d')][_0x5db4('0x2d')]);_0x1a7879[_0x5db4('0x32')]=_[_0x5db4('0x46')](_0x1e0b06[_0x5db4('0x32')]);_0x1a7879[_0x5db4('0x33')]=_['intersection'](_0x1a7879[_0x5db4('0x31')],_0x1a7879[_0x5db4('0x32')]);_0x3dafc2[_0x5db4('0x35')]=_[_0x5db4('0x34')](_0x1a7879[_0x5db4('0x31')],qs[_0x5db4('0x36')](_0x1e0b06[_0x5db4('0x32')][_0x5db4('0x36')]));_0x3dafc2[_0x5db4('0x35')]=_0x3dafc2[_0x5db4('0x35')][_0x5db4('0x37')]?_0x3dafc2['attributes']:_0x1a7879['model'];_0x3dafc2[_0x5db4('0x3a')]=qs['sort'](_0x1e0b06['query']['sort']);_0x3dafc2['where']=qs['filters'](_[_0x5db4('0x3c')](_0x1e0b06[_0x5db4('0x32')],_0x1a7879[_0x5db4('0x33')]));if(_0x1e0b06[_0x5db4('0x32')][_0x5db4('0x3d')]){_0x3dafc2[_0x5db4('0x3e')]=_[_0x5db4('0x3f')](_0x3dafc2['where'],{'$or':_[_0x5db4('0x2b')](_0x3dafc2[_0x5db4('0x35')],function(_0xe19906){var _0x3df807={};_0x3df807[_0xe19906]={'$like':'%'+_0x1e0b06[_0x5db4('0x32')][_0x5db4('0x3d')]+'%'};return _0x3df807;})});}_0x3dafc2=_[_0x5db4('0x3f')]({},_0x3dafc2,_0x1e0b06[_0x5db4('0x47')]);return _0x35820d['getDescriptions'](_0x3dafc2);}})[_0x5db4('0x24')](function(_0xe2b949){if(_0xe2b949){_0x58079e=_0xe2b949[_0x5db4('0x37')];if(!_0x1e0b06[_0x5db4('0x32')][_0x5db4('0x38')](_0x5db4('0x39'))){_0x3dafc2[_0x5db4('0x1c')]=qs[_0x5db4('0x1c')](_0x1e0b06[_0x5db4('0x32')][_0x5db4('0x1c')]);_0x3dafc2[_0x5db4('0x1a')]=qs[_0x5db4('0x1a')](_0x1e0b06[_0x5db4('0x32')][_0x5db4('0x1a')]);}return _0x35820d['getDescriptions'](_0x3dafc2);}})[_0x5db4('0x24')](function(_0x1217f6){if(_0x1217f6){return _0x1217f6?{'count':_0x58079e,'rows':_0x1217f6}:null;}})[_0x5db4('0x24')](respondWithResult(_0x208bd4,null))[_0x5db4('0x44')](handleError(_0x208bd4,null));};exports[_0x5db4('0x50')]=function(_0x3ab12a,_0x36e5da,_0x207aa1){var _0x364a50={};var _0x4c8caf={};var _0x45f08b;var _0x362cd7;return db[_0x5db4('0x2c')][_0x5db4('0x4c')]({'where':{'id':_0x3ab12a[_0x5db4('0x45')]['id']}})[_0x5db4('0x24')](handleEntityNotFound(_0x36e5da,null))[_0x5db4('0x24')](function(_0x3b634c){if(_0x3b634c){_0x45f08b=_0x3b634c;_0x4c8caf[_0x5db4('0x31')]=_[_0x5db4('0x46')](db[_0x5db4('0x51')][_0x5db4('0x2d')]);_0x4c8caf[_0x5db4('0x32')]=_[_0x5db4('0x46')](_0x3ab12a[_0x5db4('0x32')]);_0x4c8caf[_0x5db4('0x33')]=_[_0x5db4('0x34')](_0x4c8caf['model'],_0x4c8caf[_0x5db4('0x32')]);_0x364a50[_0x5db4('0x35')]=_[_0x5db4('0x34')](_0x4c8caf[_0x5db4('0x31')],qs[_0x5db4('0x36')](_0x3ab12a[_0x5db4('0x32')][_0x5db4('0x36')]));_0x364a50[_0x5db4('0x35')]=_0x364a50['attributes'][_0x5db4('0x37')]?_0x364a50[_0x5db4('0x35')]:_0x4c8caf[_0x5db4('0x31')];_0x364a50['order']=qs[_0x5db4('0x3b')](_0x3ab12a['query'][_0x5db4('0x3b')]);_0x364a50[_0x5db4('0x3e')]=qs[_0x5db4('0x33')](_['pick'](_0x3ab12a[_0x5db4('0x32')],_0x4c8caf['filters']));if(_0x3ab12a[_0x5db4('0x32')][_0x5db4('0x3d')]){_0x364a50[_0x5db4('0x3e')]=_[_0x5db4('0x3f')](_0x364a50[_0x5db4('0x3e')],{'$or':_['map'](_0x364a50[_0x5db4('0x35')],function(_0x30b006){var _0x3a6aab={};_0x3a6aab[_0x30b006]={'$like':'%'+_0x3ab12a['query'][_0x5db4('0x3d')]+'%'};return _0x3a6aab;})});}_0x364a50=_[_0x5db4('0x3f')]({},_0x364a50,_0x3ab12a[_0x5db4('0x47')]);return _0x45f08b[_0x5db4('0x50')](_0x364a50);}})[_0x5db4('0x24')](function(_0x5865f9){if(_0x5865f9){_0x362cd7=_0x5865f9[_0x5db4('0x37')];if(!_0x3ab12a[_0x5db4('0x32')]['hasOwnProperty'](_0x5db4('0x39'))){_0x364a50['limit']=qs[_0x5db4('0x1c')](_0x3ab12a[_0x5db4('0x32')][_0x5db4('0x1c')]);_0x364a50[_0x5db4('0x1a')]=qs[_0x5db4('0x1a')](_0x3ab12a['query']['offset']);}return _0x45f08b['getTags'](_0x364a50);}})[_0x5db4('0x24')](function(_0x8b02d0){if(_0x8b02d0){return _0x8b02d0?{'count':_0x362cd7,'rows':_0x8b02d0}:null;}})['then'](respondWithResult(_0x36e5da,null))[_0x5db4('0x44')](handleError(_0x36e5da,null));};exports[_0x5db4('0x52')]=function(_0x12b6e3,_0x1aeb3b,_0x272460){if(_0x12b6e3[_0x5db4('0x4a')]['id']){delete _0x12b6e3[_0x5db4('0x4a')]['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x12b6e3[_0x5db4('0x45')]['id']}})['then'](handleEntityNotFound(_0x1aeb3b,null))[_0x5db4('0x24')](function(_0x5c9d5c){if(_0x5c9d5c){return _0x5c9d5c[_0x5db4('0x52')](_0x12b6e3[_0x5db4('0x4a')][_0x5db4('0x53')]||[]);}return null;})[_0x5db4('0x24')](respondWithResult(_0x1aeb3b,null))[_0x5db4('0x44')](handleError(_0x1aeb3b,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index b693a92..5743271 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 _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 +var _0x8b9b=['bluebird','path','../../config/environment','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','api','moment'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x8b9b,0x13b));var _0xb8b9=function(_0x409c8b,_0x4892d4){_0x409c8b=_0x409c8b-0x0;var _0x430500=_0x8b9b[_0x409c8b];return _0x430500;};'use strict';var _=require(_0xb8b9('0x0'));var util=require(_0xb8b9('0x1'));var logger=require('../../config/logger')(_0xb8b9('0x2'));var moment=require(_0xb8b9('0x3'));var BPromise=require(_0xb8b9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb8b9('0x5'));var rimraf=require('rimraf');var config=require(_0xb8b9('0x6'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xb8b9('0x7')]=function(_0x1add95,_0x3f22a0){return _0x1add95[_0xb8b9('0x8')](_0xb8b9('0x9'),attributes,{'tableName':_0xb8b9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 63f4017..609e659 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 _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 +var _0xe600=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3605fc,_0x388a23){var _0xd02479=function(_0x47cd22){while(--_0x47cd22){_0x3605fc['push'](_0x3605fc['shift']());}};_0xd02479(++_0x388a23);}(_0xe600,0x101));var _0x0e60=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe600[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0e60('0x0'));var util=require(_0x0e60('0x1'));var moment=require(_0x0e60('0x2'));var BPromise=require(_0x0e60('0x3'));var rs=require(_0x0e60('0x4'));var fs=require('fs');var Redis=require(_0x0e60('0x5'));var db=require(_0x0e60('0x6'))['db'];var utils=require(_0x0e60('0x7'));var logger=require(_0x0e60('0x8'))(_0x0e60('0x9'));var config=require(_0x0e60('0xa'));var jayson=require(_0x0e60('0xb'));var client=jayson['client'][_0x0e60('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x55260e,_0x5ba3ca,_0x4aed93){return new BPromise(function(_0x1a68a1,_0x2f2b52){return client['request'](_0x55260e,_0x4aed93)[_0x0e60('0xd')](function(_0x460c89){logger[_0x0e60('0xe')](_0x0e60('0xf'),_0x5ba3ca,'request\x20sent');logger[_0x0e60('0x10')](_0x0e60('0x11'),_0x5ba3ca,'request\x20sent',JSON['stringify'](_0x460c89));if(_0x460c89[_0x0e60('0x12')]){if(_0x460c89['error'][_0x0e60('0x13')]===0x1f4){logger[_0x0e60('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5ba3ca,_0x460c89[_0x0e60('0x12')]['message']);return _0x2f2b52(_0x460c89[_0x0e60('0x12')][_0x0e60('0x14')]);}logger[_0x0e60('0x12')](_0x0e60('0xf'),_0x5ba3ca,_0x460c89['error'][_0x0e60('0x14')]);return _0x1a68a1(_0x460c89[_0x0e60('0x12')]['message']);}else{logger[_0x0e60('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5ba3ca,_0x0e60('0x15'));_0x1a68a1(_0x460c89[_0x0e60('0x16')][_0x0e60('0x14')]);}})[_0x0e60('0x17')](function(_0xccc038){logger[_0x0e60('0x12')](_0x0e60('0xf'),_0x5ba3ca,_0xccc038);_0x2f2b52(_0xccc038);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index e510089..8ec3ba5 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 _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 +var _0xae7f=['util','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','destroy','exports','multer'];(function(_0x204106,_0x3e2e12){var _0x157a1a=function(_0x7a1440){while(--_0x7a1440){_0x204106['push'](_0x204106['shift']());}};_0x157a1a(++_0x3e2e12);}(_0xae7f,0x68));var _0xfae7=function(_0xc68188,_0x237a6d){_0xc68188=_0xc68188-0x0;var _0x248fe3=_0xae7f[_0xc68188];return _0x248fe3;};'use strict';var multer=require(_0xfae7('0x0'));var util=require(_0xfae7('0x1'));var path=require('path');var timeout=require(_0xfae7('0x2'));var express=require(_0xfae7('0x3'));var router=express[_0xfae7('0x4')]();var fs_extra=require(_0xfae7('0x5'));var auth=require(_0xfae7('0x6'));var interaction=require(_0xfae7('0x7'));var config=require(_0xfae7('0x8'));var controller=require(_0xfae7('0x9'));router[_0xfae7('0xa')]('/',auth['isAuthenticated'](),controller[_0xfae7('0xb')]);router[_0xfae7('0xa')](_0xfae7('0xc'),auth[_0xfae7('0xd')](),controller[_0xfae7('0xe')]);router['post']('/',auth[_0xfae7('0xd')](),controller[_0xfae7('0xf')]);router[_0xfae7('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xfae7('0x11')]);router[_0xfae7('0x12')]('/:id',auth[_0xfae7('0xd')](),controller[_0xfae7('0x13')]);module[_0xfae7('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index d45d5f7..ee9781c 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 _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 +var _0xc97e=['STRING','BOOLEAN','exports','ENUM','string','variable','picklist'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc97e,0x11a));var _0xec97=function(_0x30f53a,_0x55acf8){_0x30f53a=_0x30f53a-0x0;var _0x24fd11=_0xc97e[_0x30f53a];return _0x24fd11;};'use strict';var Sequelize=require('sequelize');module[_0xec97('0x0')]={'type':{'type':Sequelize[_0xec97('0x1')](_0xec97('0x2'),_0xec97('0x3'),'customVariable','keyValue',_0xec97('0x4')),'defaultValue':_0xec97('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xec97('0x2'),_0xec97('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xec97('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xec97('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xec97('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 22c5b5f..74b9016 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 _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 +var _0x235a=['set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','FreshdeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','map','VIRTUAL','filter','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x280b44,_0x42ba2b){var _0x347efa=function(_0x398653){while(--_0x398653){_0x280b44['push'](_0x280b44['shift']());}};_0x347efa(++_0x42ba2b);}(_0x235a,0x1ef));var _0xa235=function(_0x275998,_0x2e6420){_0x275998=_0x275998-0x0;var _0x1558ef=_0x235a[_0x275998];return _0x1558ef;};'use strict';var emlformat=require(_0xa235('0x0'));var rimraf=require(_0xa235('0x1'));var zipdir=require(_0xa235('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa235('0x3'));var moment=require('moment');var BPromise=require(_0xa235('0x4'));var Mustache=require(_0xa235('0x5'));var util=require(_0xa235('0x6'));var path=require(_0xa235('0x7'));var sox=require(_0xa235('0x8'));var csv=require(_0xa235('0x9'));var ejs=require(_0xa235('0xa'));var fs=require('fs');var fs_extra=require(_0xa235('0xb'));var _=require('lodash');var squel=require(_0xa235('0xc'));var crypto=require(_0xa235('0xd'));var jsforce=require(_0xa235('0xe'));var deskjs=require(_0xa235('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa235('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa235('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa235('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa235('0x13'));var config=require(_0xa235('0x14'));var licenseUtil=require(_0xa235('0x15'));var db=require(_0xa235('0x16'))['db'];function respondWithStatusCode(_0x5330db,_0x5510ff){_0x5510ff=_0x5510ff||0xcc;return function(_0x47aad7){if(_0x47aad7){return _0x5330db[_0xa235('0x17')](_0x5510ff);}return _0x5330db[_0xa235('0x18')](_0x5510ff)[_0xa235('0x19')]();};}function respondWithResult(_0x3bf6fc,_0x36b4b1){_0x36b4b1=_0x36b4b1||0xc8;return function(_0x44ea6a){if(_0x44ea6a){return _0x3bf6fc[_0xa235('0x18')](_0x36b4b1)[_0xa235('0x1a')](_0x44ea6a);}};}function respondWithFilteredResult(_0x1369de,_0x4aceee){return function(_0x352463){if(_0x352463){var _0x20cd67=typeof _0x4aceee[_0xa235('0x1b')]===_0xa235('0x1c')&&typeof _0x4aceee[_0xa235('0x1d')]===_0xa235('0x1c');var _0x5c6e95=_0x352463['count'];var _0x446ea2=_0x20cd67?0x0:_0x4aceee[_0xa235('0x1b')];var _0x2b3769=_0x20cd67?_0x352463['count']:_0x4aceee[_0xa235('0x1b')]+_0x4aceee[_0xa235('0x1d')];var _0x3ca514;if(_0x2b3769>=_0x5c6e95){_0x2b3769=_0x5c6e95;_0x3ca514=0xc8;}else{_0x3ca514=0xce;}_0x1369de[_0xa235('0x18')](_0x3ca514);return _0x1369de[_0xa235('0x1e')](_0xa235('0x1f'),_0x446ea2+'-'+_0x2b3769+'/'+_0x5c6e95)[_0xa235('0x1a')](_0x352463);}return null;};}function patchUpdates(_0x483771){return function(_0x5a3bea){try{jsonpatch[_0xa235('0x20')](_0x5a3bea,_0x483771,!![]);}catch(_0x21940f){return BPromise[_0xa235('0x21')](_0x21940f);}return _0x5a3bea[_0xa235('0x22')]();};}function saveUpdates(_0x2e38e,_0x3deeea){return function(_0x3d9f70){if(_0x3d9f70){return _0x3d9f70[_0xa235('0x23')](_0x2e38e)[_0xa235('0x24')](function(_0x216083){return _0x216083;});}return null;};}function removeEntity(_0x3219f1,_0x20292c){return function(_0xee45e1){if(_0xee45e1){return _0xee45e1[_0xa235('0x25')]()[_0xa235('0x24')](function(){_0x3219f1[_0xa235('0x18')](0xcc)[_0xa235('0x19')]();});}};}function handleEntityNotFound(_0x13c868,_0x976c9f){return function(_0x1cb892){if(!_0x1cb892){_0x13c868[_0xa235('0x17')](0x194);}return _0x1cb892;};}function handleError(_0x57f591,_0xe1176c){_0xe1176c=_0xe1176c||0x1f4;return function(_0x533b15){logger[_0xa235('0x26')](_0x533b15['stack']);if(_0x533b15[_0xa235('0x27')]){delete _0x533b15[_0xa235('0x27')];}_0x57f591[_0xa235('0x18')](_0xe1176c)[_0xa235('0x28')](_0x533b15);};}exports[_0xa235('0x29')]=function(_0x5d811a,_0x2585c7){var _0x612f2={},_0x55a21e={},_0x4b33ef={'count':0x0,'rows':[]};var _0x502df9=_['map'](db[_0xa235('0x2a')][_0xa235('0x2b')],function(_0x2d8073){return{'name':_0x2d8073[_0xa235('0x2c')],'type':_0x2d8073[_0xa235('0x2d')][_0xa235('0x2e')]};});_0x55a21e[_0xa235('0x2f')]=_['map'](_0x502df9,'name');_0x55a21e[_0xa235('0x30')]=_[_0xa235('0x31')](_0x5d811a['query']);_0x55a21e[_0xa235('0x32')]=_[_0xa235('0x33')](_0x55a21e[_0xa235('0x2f')],_0x55a21e[_0xa235('0x30')]);_0x612f2[_0xa235('0x34')]=_[_0xa235('0x33')](_0x55a21e[_0xa235('0x2f')],qs[_0xa235('0x35')](_0x5d811a['query'][_0xa235('0x35')]));_0x612f2['attributes']=_0x612f2[_0xa235('0x34')][_0xa235('0x36')]?_0x612f2[_0xa235('0x34')]:_0x55a21e[_0xa235('0x2f')];if(!_0x5d811a[_0xa235('0x30')][_0xa235('0x37')](_0xa235('0x38'))){_0x612f2[_0xa235('0x1d')]=qs[_0xa235('0x1d')](_0x5d811a[_0xa235('0x30')][_0xa235('0x1d')]);_0x612f2[_0xa235('0x1b')]=qs[_0xa235('0x1b')](_0x5d811a['query']['offset']);}_0x612f2['order']=qs[_0xa235('0x39')](_0x5d811a['query'][_0xa235('0x39')]);_0x612f2[_0xa235('0x3a')]=qs[_0xa235('0x32')](_[_0xa235('0x3b')](_0x5d811a[_0xa235('0x30')],_0x55a21e[_0xa235('0x32')]),_0x502df9);if(_0x5d811a[_0xa235('0x30')]['filter']){_0x612f2[_0xa235('0x3a')]=_[_0xa235('0x3c')](_0x612f2['where'],{'$or':_[_0xa235('0x3d')](_0x502df9,function(_0x3fa927){if(_0x3fa927[_0xa235('0x2d')]!==_0xa235('0x3e')){var _0x45cc55={};_0x45cc55[_0x3fa927[_0xa235('0x27')]]={'$like':'%'+_0x5d811a[_0xa235('0x30')][_0xa235('0x3f')]+'%'};return _0x45cc55;}})});}_0x612f2=_[_0xa235('0x3c')]({},_0x612f2,_0x5d811a['options']);var _0x28c259={'where':_0x612f2[_0xa235('0x3a')]};return db[_0xa235('0x2a')][_0xa235('0x40')](_0x28c259)[_0xa235('0x24')](function(_0x542755){_0x4b33ef[_0xa235('0x40')]=_0x542755;if(_0x5d811a[_0xa235('0x30')][_0xa235('0x41')]){_0x612f2[_0xa235('0x42')]=[{'all':!![]}];}return db['FreshdeskField'][_0xa235('0x43')](_0x612f2);})[_0xa235('0x24')](function(_0x47801f){_0x4b33ef[_0xa235('0x44')]=_0x47801f;return _0x4b33ef;})[_0xa235('0x24')](respondWithFilteredResult(_0x2585c7,_0x612f2))[_0xa235('0x45')](handleError(_0x2585c7,null));};exports[_0xa235('0x46')]=function(_0x5c203c,_0x333ed8){var _0x4748d8={'raw':!![],'where':{'id':_0x5c203c[_0xa235('0x47')]['id']}},_0x1e90a9={};_0x1e90a9[_0xa235('0x2f')]=_['keys'](db[_0xa235('0x2a')][_0xa235('0x2b')]);_0x1e90a9[_0xa235('0x30')]=_[_0xa235('0x31')](_0x5c203c[_0xa235('0x30')]);_0x1e90a9['filters']=_[_0xa235('0x33')](_0x1e90a9[_0xa235('0x2f')],_0x1e90a9[_0xa235('0x30')]);_0x4748d8[_0xa235('0x34')]=_[_0xa235('0x33')](_0x1e90a9[_0xa235('0x2f')],qs[_0xa235('0x35')](_0x5c203c[_0xa235('0x30')]['fields']));_0x4748d8[_0xa235('0x34')]=_0x4748d8[_0xa235('0x34')][_0xa235('0x36')]?_0x4748d8[_0xa235('0x34')]:_0x1e90a9[_0xa235('0x2f')];if(_0x5c203c[_0xa235('0x30')][_0xa235('0x41')]){_0x4748d8[_0xa235('0x42')]=[{'all':!![]}];}_0x4748d8=_[_0xa235('0x3c')]({},_0x4748d8,_0x5c203c['options']);return db[_0xa235('0x2a')][_0xa235('0x48')](_0x4748d8)[_0xa235('0x24')](handleEntityNotFound(_0x333ed8,null))[_0xa235('0x24')](respondWithResult(_0x333ed8,null))[_0xa235('0x45')](handleError(_0x333ed8,null));};exports['create']=function(_0x22f11c,_0x11b5e7){return db['FreshdeskField'][_0xa235('0x49')](_0x22f11c[_0xa235('0x4a')],{})[_0xa235('0x24')](respondWithResult(_0x11b5e7,0xc9))[_0xa235('0x45')](handleError(_0x11b5e7,null));};exports['update']=function(_0x16d9e8,_0x4909e9){if(_0x16d9e8[_0xa235('0x4a')]['id']){delete _0x16d9e8[_0xa235('0x4a')]['id'];}return db['FreshdeskField'][_0xa235('0x48')]({'where':{'id':_0x16d9e8[_0xa235('0x47')]['id']}})[_0xa235('0x24')](handleEntityNotFound(_0x4909e9,null))[_0xa235('0x24')](saveUpdates(_0x16d9e8[_0xa235('0x4a')],null))[_0xa235('0x24')](respondWithResult(_0x4909e9,null))[_0xa235('0x45')](handleError(_0x4909e9,null));};exports[_0xa235('0x25')]=function(_0x5ab614,_0x5033dc){return db['FreshdeskField'][_0xa235('0x48')]({'where':{'id':_0x5ab614[_0xa235('0x47')]['id']}})[_0xa235('0x24')](handleEntityNotFound(_0x5033dc,null))[_0xa235('0x24')](removeEntity(_0x5033dc,null))['catch'](handleError(_0x5033dc,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index c116974..0bba975 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 _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 +var _0xc1e8=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','freshdesk_unique_index','idField','FieldId','lodash'];(function(_0xf4add4,_0x5b9cc1){var _0x1c42fb=function(_0x2674c1){while(--_0x2674c1){_0xf4add4['push'](_0xf4add4['shift']());}};_0x1c42fb(++_0x5b9cc1);}(_0xc1e8,0x87));var _0x8c1e=function(_0x24618a,_0x2cd0f4){_0x24618a=_0x24618a-0x0;var _0x2e3d64=_0xc1e8[_0x24618a];return _0x2e3d64;};'use strict';var _=require(_0x8c1e('0x0'));var util=require(_0x8c1e('0x1'));var logger=require(_0x8c1e('0x2'))(_0x8c1e('0x3'));var moment=require(_0x8c1e('0x4'));var BPromise=require(_0x8c1e('0x5'));var rp=require(_0x8c1e('0x6'));var fs=require('fs');var path=require(_0x8c1e('0x7'));var rimraf=require(_0x8c1e('0x8'));var config=require(_0x8c1e('0x9'));var attributes=require(_0x8c1e('0xa'));module[_0x8c1e('0xb')]=function(_0x57e576,_0x380525){return _0x57e576[_0x8c1e('0xc')](_0x8c1e('0xd'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x8c1e('0xe'),'fields':[_0x8c1e('0xf'),_0x8c1e('0x10')],'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 0bd7a89..c7c04ba 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 _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 +var _0xd548=['error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x116a29,_0x4fe941){var _0x16d90f=function(_0x402a8a){while(--_0x402a8a){_0x116a29['push'](_0x116a29['shift']());}};_0x16d90f(++_0x4fe941);}(_0xd548,0x1e0));var _0x8d54=function(_0x59883a,_0x5564cd){_0x59883a=_0x59883a-0x0;var _0x4ffe68=_0xd548[_0x59883a];return _0x4ffe68;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8d54('0x0'));var BPromise=require(_0x8d54('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d54('0x2'));var db=require(_0x8d54('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8d54('0x4'))(_0x8d54('0x5'));var config=require(_0x8d54('0x6'));var jayson=require(_0x8d54('0x7'));var client=jayson[_0x8d54('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x678289,_0x4aee31,_0x5d2023){return new BPromise(function(_0x1a3624,_0x220816){return client[_0x8d54('0x9')](_0x678289,_0x5d2023)['then'](function(_0x4afe38){logger[_0x8d54('0xa')](_0x8d54('0xb'),_0x4aee31,'request\x20sent');logger['debug'](_0x8d54('0xc'),_0x4aee31,_0x8d54('0xd'),JSON['stringify'](_0x4afe38));if(_0x4afe38[_0x8d54('0xe')]){if(_0x4afe38['error'][_0x8d54('0xf')]===0x1f4){logger[_0x8d54('0xe')](_0x8d54('0xb'),_0x4aee31,_0x4afe38[_0x8d54('0xe')]['message']);return _0x220816(_0x4afe38[_0x8d54('0xe')][_0x8d54('0x10')]);}logger['error'](_0x8d54('0xb'),_0x4aee31,_0x4afe38['error'][_0x8d54('0x10')]);return _0x1a3624(_0x4afe38[_0x8d54('0xe')][_0x8d54('0x10')]);}else{logger[_0x8d54('0xa')](_0x8d54('0xb'),_0x4aee31,_0x8d54('0xd'));_0x1a3624(_0x4afe38[_0x8d54('0x11')][_0x8d54('0x10')]);}})[_0x8d54('0x12')](function(_0x205306){logger[_0x8d54('0xe')](_0x8d54('0xb'),_0x4aee31,_0x205306);_0x220816(_0x205306);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 0cdf081..e69869e 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 _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 +var _0xb574=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','index','get','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','/:id','update','delete','destroy','multer','util'];(function(_0x27da38,_0x3a3192){var _0x2ca893=function(_0x3c83ea){while(--_0x3c83ea){_0x27da38['push'](_0x27da38['shift']());}};_0x2ca893(++_0x3a3192);}(_0xb574,0x106));var _0x4b57=function(_0x4f4488,_0x2ce30c){_0x4f4488=_0x4f4488-0x0;var _0x167548=_0xb574[_0x4f4488];return _0x167548;};'use strict';var multer=require(_0x4b57('0x0'));var util=require(_0x4b57('0x1'));var path=require('path');var timeout=require(_0x4b57('0x2'));var express=require(_0x4b57('0x3'));var router=express['Router']();var fs_extra=require(_0x4b57('0x4'));var auth=require(_0x4b57('0x5'));var interaction=require(_0x4b57('0x6'));var config=require(_0x4b57('0x7'));var controller=require(_0x4b57('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x4b57('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x4b57('0xa')](_0x4b57('0xb'),auth[_0x4b57('0xc')](),controller[_0x4b57('0xd')]);router[_0x4b57('0xa')](_0x4b57('0xe'),auth[_0x4b57('0xc')](),controller[_0x4b57('0xf')]);router['post']('/',auth[_0x4b57('0xc')](),controller[_0x4b57('0x10')]);router[_0x4b57('0x11')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x4b57('0x12')]);router[_0x4b57('0x13')](_0x4b57('0x14'),auth[_0x4b57('0xc')](),controller[_0x4b57('0x15')]);router[_0x4b57('0x16')](_0x4b57('0x14'),auth[_0x4b57('0xc')](),controller[_0x4b57('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index b5b0f94..646131b 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x77d4=['exports','STRING','username'];(function(_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 +var _0x4b17=['username','sequelize','STRING'];(function(_0x245d15,_0x347515){var _0x558034=function(_0x5eba1c){while(--_0x5eba1c){_0x245d15['push'](_0x245d15['shift']());}};_0x558034(++_0x347515);}(_0x4b17,0x10f));var _0x74b1=function(_0x584291,_0x24b5b3){_0x584291=_0x584291-0x0;var _0x4e7d08=_0x4b17[_0x584291];return _0x4e7d08;};'use strict';var Sequelize=require(_0x74b1('0x0'));module['exports']={'name':{'type':Sequelize[_0x74b1('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x74b1('0x1')],'unique':_0x74b1('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x74b1('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index e334107..b704b4d 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 _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 +var _0xa319=['includeAll','include','rows','show','params','rawAttributes','fields','length','create','catch','body','find','getConfigurations','findOne','FreshsalesConfiguration','pick','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','Subjects','getFields','username','remoteUri','apiKey','slice','lastIndexOf','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','FreshsalesAccount','fieldName','type','key','model','query','keys','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count'];(function(_0xbcb4bf,_0x5296ed){var _0x3932b3=function(_0x3df0f2){while(--_0x3df0f2){_0xbcb4bf['push'](_0xbcb4bf['shift']());}};_0x3932b3(++_0x5296ed);}(_0xa319,0x1c6));var _0x9a31=function(_0x351739,_0xac9fb3){_0x351739=_0x351739-0x0;var _0x258028=_0xa319[_0x351739];return _0x258028;};'use strict';var emlformat=require(_0x9a31('0x0'));var rimraf=require(_0x9a31('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9a31('0x2'));var moment=require(_0x9a31('0x3'));var BPromise=require(_0x9a31('0x4'));var Mustache=require(_0x9a31('0x5'));var util=require(_0x9a31('0x6'));var path=require('path');var sox=require(_0x9a31('0x7'));var csv=require(_0x9a31('0x8'));var ejs=require(_0x9a31('0x9'));var fs=require('fs');var fs_extra=require(_0x9a31('0xa'));var _=require(_0x9a31('0xb'));var squel=require(_0x9a31('0xc'));var crypto=require(_0x9a31('0xd'));var jsforce=require(_0x9a31('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9a31('0x8'));var querystring=require('querystring');var Papa=require(_0x9a31('0xf'));var Redis=require('ioredis');var authService=require(_0x9a31('0x10'));var qs=require(_0x9a31('0x11'));var as=require(_0x9a31('0x12'));var hardwareService=require(_0x9a31('0x13'));var logger=require('../../config/logger')(_0x9a31('0x14'));var utils=require(_0x9a31('0x15'));var config=require(_0x9a31('0x16'));var licenseUtil=require(_0x9a31('0x17'));var db=require(_0x9a31('0x18'))['db'];var integrations=require(_0x9a31('0x19'));function respondWithStatusCode(_0x5aafe1,_0x3a9eac){_0x3a9eac=_0x3a9eac||0xcc;return function(_0x307fb8){if(_0x307fb8){return _0x5aafe1[_0x9a31('0x1a')](_0x3a9eac);}return _0x5aafe1[_0x9a31('0x1b')](_0x3a9eac)[_0x9a31('0x1c')]();};}function respondWithResult(_0x362c5e,_0x252fd1){_0x252fd1=_0x252fd1||0xc8;return function(_0x5bd261){if(_0x5bd261){return _0x362c5e[_0x9a31('0x1b')](_0x252fd1)[_0x9a31('0x1d')](_0x5bd261);}};}function respondWithFilteredResult(_0x3c9f0d,_0xbdea1){return function(_0x1d4805){if(_0x1d4805){var _0x3f924b=typeof _0xbdea1[_0x9a31('0x1e')]==='undefined'&&typeof _0xbdea1[_0x9a31('0x1f')]===_0x9a31('0x20');var _0x45e199=_0x1d4805['count'];var _0x2ca979=_0x3f924b?0x0:_0xbdea1['offset'];var _0x2152c=_0x3f924b?_0x1d4805['count']:_0xbdea1[_0x9a31('0x1e')]+_0xbdea1[_0x9a31('0x1f')];var _0x51bd04;if(_0x2152c>=_0x45e199){_0x2152c=_0x45e199;_0x51bd04=0xc8;}else{_0x51bd04=0xce;}_0x3c9f0d['status'](_0x51bd04);return _0x3c9f0d[_0x9a31('0x21')](_0x9a31('0x22'),_0x2ca979+'-'+_0x2152c+'/'+_0x45e199)[_0x9a31('0x1d')](_0x1d4805);}return null;};}function patchUpdates(_0x5ba710){return function(_0xb0178){try{jsonpatch[_0x9a31('0x23')](_0xb0178,_0x5ba710,!![]);}catch(_0x300edf){return BPromise[_0x9a31('0x24')](_0x300edf);}return _0xb0178[_0x9a31('0x25')]();};}function saveUpdates(_0x106b4f,_0x3e68c8){return function(_0x24b576){if(_0x24b576){return _0x24b576[_0x9a31('0x26')](_0x106b4f)[_0x9a31('0x27')](function(_0xa0eca5){return _0xa0eca5;});}return null;};}function removeEntity(_0x42615b,_0x1e0d75){return function(_0x32b4d0){if(_0x32b4d0){return _0x32b4d0[_0x9a31('0x28')]()[_0x9a31('0x27')](function(){_0x42615b[_0x9a31('0x1b')](0xcc)[_0x9a31('0x1c')]();});}};}function handleEntityNotFound(_0x19e14e,_0x1eb720){return function(_0x65d01e){if(!_0x65d01e){_0x19e14e[_0x9a31('0x1a')](0x194);}return _0x65d01e;};}function handleError(_0xb79270,_0x154a7b){_0x154a7b=_0x154a7b||0x1f4;return function(_0x4f6208){logger['error'](_0x4f6208[_0x9a31('0x29')]);if(_0x4f6208[_0x9a31('0x2a')]){delete _0x4f6208['name'];}_0xb79270[_0x9a31('0x1b')](_0x154a7b)[_0x9a31('0x2b')](_0x4f6208);};}exports[_0x9a31('0x2c')]=function(_0x3da748,_0x4e9802){var _0x39c321={},_0x2b78a9={},_0x2d4379={'count':0x0,'rows':[]};var _0x4a4b66=_[_0x9a31('0x2d')](db[_0x9a31('0x2e')]['rawAttributes'],function(_0x347e0e){return{'name':_0x347e0e[_0x9a31('0x2f')],'type':_0x347e0e[_0x9a31('0x30')][_0x9a31('0x31')]};});_0x2b78a9[_0x9a31('0x32')]=_[_0x9a31('0x2d')](_0x4a4b66,_0x9a31('0x2a'));_0x2b78a9[_0x9a31('0x33')]=_[_0x9a31('0x34')](_0x3da748[_0x9a31('0x33')]);_0x2b78a9[_0x9a31('0x35')]=_['intersection'](_0x2b78a9[_0x9a31('0x32')],_0x2b78a9[_0x9a31('0x33')]);_0x39c321[_0x9a31('0x36')]=_[_0x9a31('0x37')](_0x2b78a9['model'],qs['fields'](_0x3da748[_0x9a31('0x33')]['fields']));_0x39c321['attributes']=_0x39c321[_0x9a31('0x36')]['length']?_0x39c321[_0x9a31('0x36')]:_0x2b78a9[_0x9a31('0x32')];if(!_0x3da748['query'][_0x9a31('0x38')](_0x9a31('0x39'))){_0x39c321[_0x9a31('0x1f')]=qs[_0x9a31('0x1f')](_0x3da748[_0x9a31('0x33')][_0x9a31('0x1f')]);_0x39c321[_0x9a31('0x1e')]=qs[_0x9a31('0x1e')](_0x3da748[_0x9a31('0x33')][_0x9a31('0x1e')]);}_0x39c321[_0x9a31('0x3a')]=qs[_0x9a31('0x3b')](_0x3da748[_0x9a31('0x33')][_0x9a31('0x3b')]);_0x39c321[_0x9a31('0x3c')]=qs[_0x9a31('0x35')](_['pick'](_0x3da748[_0x9a31('0x33')],_0x2b78a9['filters']),_0x4a4b66);if(_0x3da748[_0x9a31('0x33')][_0x9a31('0x3d')]){_0x39c321[_0x9a31('0x3c')]=_[_0x9a31('0x3e')](_0x39c321['where'],{'$or':_['map'](_0x4a4b66,function(_0x1f4153){if(_0x1f4153[_0x9a31('0x30')]!==_0x9a31('0x3f')){var _0x43e675={};_0x43e675[_0x1f4153[_0x9a31('0x2a')]]={'$like':'%'+_0x3da748[_0x9a31('0x33')][_0x9a31('0x3d')]+'%'};return _0x43e675;}})});}_0x39c321=_[_0x9a31('0x3e')]({},_0x39c321,_0x3da748[_0x9a31('0x40')]);var _0x25cf2f={'where':_0x39c321['where']};return db[_0x9a31('0x2e')][_0x9a31('0x41')](_0x25cf2f)[_0x9a31('0x27')](function(_0x5e947d){_0x2d4379[_0x9a31('0x41')]=_0x5e947d;if(_0x3da748[_0x9a31('0x33')][_0x9a31('0x42')]){_0x39c321[_0x9a31('0x43')]=[{'all':!![]}];}return db['FreshsalesAccount']['findAll'](_0x39c321);})[_0x9a31('0x27')](function(_0x30307b){_0x2d4379[_0x9a31('0x44')]=_0x30307b;return _0x2d4379;})[_0x9a31('0x27')](respondWithFilteredResult(_0x4e9802,_0x39c321))['catch'](handleError(_0x4e9802,null));};exports[_0x9a31('0x45')]=function(_0x236eb0,_0x26995f){var _0x4a203b={'raw':![],'where':{'id':_0x236eb0[_0x9a31('0x46')]['id']}},_0x23b821={};_0x23b821[_0x9a31('0x32')]=_['keys'](db['FreshsalesAccount'][_0x9a31('0x47')]);_0x23b821[_0x9a31('0x33')]=_['keys'](_0x236eb0[_0x9a31('0x33')]);_0x23b821[_0x9a31('0x35')]=_[_0x9a31('0x37')](_0x23b821['model'],_0x23b821[_0x9a31('0x33')]);_0x4a203b['attributes']=_[_0x9a31('0x37')](_0x23b821[_0x9a31('0x32')],qs[_0x9a31('0x48')](_0x236eb0[_0x9a31('0x33')][_0x9a31('0x48')]));_0x4a203b[_0x9a31('0x36')]=_0x4a203b[_0x9a31('0x36')][_0x9a31('0x49')]?_0x4a203b[_0x9a31('0x36')]:_0x23b821[_0x9a31('0x32')];if(_0x236eb0[_0x9a31('0x33')][_0x9a31('0x42')]){_0x4a203b[_0x9a31('0x43')]=[{'all':!![]}];}_0x4a203b=_[_0x9a31('0x3e')]({},_0x4a203b,_0x236eb0[_0x9a31('0x40')]);return db['FreshsalesAccount']['find'](_0x4a203b)[_0x9a31('0x27')](handleEntityNotFound(_0x26995f,null))['then'](respondWithResult(_0x26995f,null))['catch'](handleError(_0x26995f,null));};exports[_0x9a31('0x4a')]=function(_0x56b2e0,_0x3fc04e){return db['FreshsalesAccount']['create'](_0x56b2e0['body'],{})[_0x9a31('0x27')](respondWithResult(_0x3fc04e,0xc9))[_0x9a31('0x4b')](handleError(_0x3fc04e,null));};exports[_0x9a31('0x26')]=function(_0x12b733,_0x166701){if(_0x12b733[_0x9a31('0x4c')]['id']){delete _0x12b733[_0x9a31('0x4c')]['id'];}return db[_0x9a31('0x2e')][_0x9a31('0x4d')]({'where':{'id':_0x12b733[_0x9a31('0x46')]['id']}})[_0x9a31('0x27')](handleEntityNotFound(_0x166701,null))['then'](saveUpdates(_0x12b733[_0x9a31('0x4c')],null))['then'](respondWithResult(_0x166701,null))['catch'](handleError(_0x166701,null));};exports[_0x9a31('0x28')]=function(_0x2e3ce6,_0x586ca9){return db[_0x9a31('0x2e')][_0x9a31('0x4d')]({'where':{'id':_0x2e3ce6['params']['id']}})[_0x9a31('0x27')](handleEntityNotFound(_0x586ca9,null))['then'](removeEntity(_0x586ca9,null))[_0x9a31('0x4b')](handleError(_0x586ca9,null));};exports[_0x9a31('0x4e')]=function(_0x23fb7a,_0x3977b9,_0x53c2ce){var _0x1aac28={};var _0x2131cc={};var _0x4cfffe;var _0x461340;return db[_0x9a31('0x2e')][_0x9a31('0x4f')]({'where':{'id':_0x23fb7a['params']['id']}})[_0x9a31('0x27')](handleEntityNotFound(_0x3977b9,null))['then'](function(_0x1214ff){if(_0x1214ff){_0x4cfffe=_0x1214ff;_0x2131cc[_0x9a31('0x32')]=_['keys'](db[_0x9a31('0x50')][_0x9a31('0x47')]);_0x2131cc[_0x9a31('0x33')]=_['keys'](_0x23fb7a[_0x9a31('0x33')]);_0x2131cc[_0x9a31('0x35')]=_[_0x9a31('0x37')](_0x2131cc[_0x9a31('0x32')],_0x2131cc[_0x9a31('0x33')]);_0x1aac28['attributes']=_[_0x9a31('0x37')](_0x2131cc[_0x9a31('0x32')],qs['fields'](_0x23fb7a[_0x9a31('0x33')][_0x9a31('0x48')]));_0x1aac28[_0x9a31('0x36')]=_0x1aac28['attributes'][_0x9a31('0x49')]?_0x1aac28[_0x9a31('0x36')]:_0x2131cc[_0x9a31('0x32')];_0x1aac28[_0x9a31('0x3a')]=qs[_0x9a31('0x3b')](_0x23fb7a['query'][_0x9a31('0x3b')]);_0x1aac28['where']=qs[_0x9a31('0x35')](_[_0x9a31('0x51')](_0x23fb7a[_0x9a31('0x33')],_0x2131cc[_0x9a31('0x35')]));if(_0x23fb7a[_0x9a31('0x33')]['filter']){_0x1aac28['where']=_[_0x9a31('0x3e')](_0x1aac28['where'],{'$or':_[_0x9a31('0x2d')](_0x1aac28['attributes'],function(_0x2477d9){var _0x211fdc={};_0x211fdc[_0x2477d9]={'$like':'%'+_0x23fb7a['query']['filter']+'%'};return _0x211fdc;})});}_0x1aac28=_[_0x9a31('0x3e')]({},_0x1aac28,_0x23fb7a[_0x9a31('0x40')]);return _0x4cfffe['getConfigurations'](_0x1aac28);}})[_0x9a31('0x27')](function(_0x176966){if(_0x176966){_0x461340=_0x176966['length'];if(!_0x23fb7a[_0x9a31('0x33')][_0x9a31('0x38')]('nolimit')){_0x1aac28['limit']=qs[_0x9a31('0x1f')](_0x23fb7a[_0x9a31('0x33')]['limit']);_0x1aac28['offset']=qs[_0x9a31('0x1e')](_0x23fb7a[_0x9a31('0x33')][_0x9a31('0x1e')]);}return _0x4cfffe[_0x9a31('0x4e')](_0x1aac28);}})['then'](function(_0x37fbb3){if(_0x37fbb3){return _0x37fbb3?{'count':_0x461340,'rows':_0x37fbb3}:null;}})['then'](respondWithResult(_0x3977b9,null))['catch'](handleError(_0x3977b9,null));};exports[_0x9a31('0x52')]=function(_0x1d49cc,_0x29f71c,_0x270280){if(_0x1d49cc[_0x9a31('0x4c')]['id']){delete _0x1d49cc[_0x9a31('0x4c')]['id'];}return db[_0x9a31('0x2e')][_0x9a31('0x4f')]({'where':{'id':_0x1d49cc[_0x9a31('0x46')]['id']}})[_0x9a31('0x27')](handleEntityNotFound(_0x29f71c,null))[_0x9a31('0x27')](function(_0x55d839){if(_0x55d839){_0x1d49cc[_0x9a31('0x4c')]['AccountId']=_0x55d839['id'];_0x1d49cc['body']['Subjects']=integrations[_0x9a31('0x53')](_0x1d49cc[_0x9a31('0x4c')][_0x9a31('0x54')],_0x1d49cc[_0x9a31('0x4c')][_0x9a31('0x30')]);_0x1d49cc[_0x9a31('0x4c')][_0x9a31('0x55')]=integrations[_0x9a31('0x56')](_0x1d49cc['body'][_0x9a31('0x54')],_0x1d49cc[_0x9a31('0x4c')][_0x9a31('0x30')]);return db[_0x9a31('0x50')][_0x9a31('0x4a')](_0x1d49cc['body'],{'include':[{'model':db[_0x9a31('0x57')],'as':_0x9a31('0x58')},{'model':db['FreshsalesField'],'as':_0x9a31('0x55')}]});}return null;})[_0x9a31('0x27')](respondWithResult(_0x29f71c,null))[_0x9a31('0x4b')](handleError(_0x29f71c,null));};exports[_0x9a31('0x59')]=function(_0x372727,_0x5e62a3,_0x58f69a){var _0x2317d1='';var _0x36ca76='';return db[_0x9a31('0x2e')][_0x9a31('0x4f')]({'where':{'id':_0x372727[_0x9a31('0x46')]['id']},'attributes':['id',_0x9a31('0x5a'),_0x9a31('0x5b'),_0x9a31('0x5c')]})[_0x9a31('0x27')](handleEntityNotFound(_0x5e62a3,null))[_0x9a31('0x27')](function(_0x37c344){if(_0x37c344){_0x36ca76=_0x37c344['username'];_0x2317d1=_0x37c344[_0x9a31('0x5b')];var _0x1d6e32=_0x37c344['remoteUri'][_0x9a31('0x5d')](-0x1);if(_0x1d6e32==='/'){_0x2317d1=_0x2317d1['substring'](0x0,_0x2317d1[_0x9a31('0x5e')](_0x1d6e32));}return rp({'method':'GET','uri':util['format']('%s%s',_0x2317d1,'/api/selector/owners'),'headers':{'Authorization':_0x9a31('0x5f')+_0x37c344[_0x9a31('0x5c')]},'json':!![]});}})[_0x9a31('0x27')](function(_0x1a9e95){if(_0x1a9e95){var _0x4c67e3=_0x1a9e95[_0x9a31('0x60')];var _0x1732b8=![];var _0x477f6c=null;for(_0x477f6c=0x0;_0x477f6c<_0x4c67e3[_0x9a31('0x49')];_0x477f6c++){if(_0x4c67e3[_0x477f6c][_0x9a31('0x61')]===_0x36ca76){_0x1732b8=!![];}}if(_0x1732b8){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x9a31('0x62')});}}})[_0x9a31('0x27')](respondWithResult(_0x5e62a3,null))[_0x9a31('0x4b')](function(_0xcbec1a){var _0x89ca75=_0x372727[_0x9a31('0x33')][_0x9a31('0x63')]?0x1f4:_0xcbec1a[_0x9a31('0x64')]||0x1f4;logger[_0x9a31('0x65')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x89ca75,JSON[_0x9a31('0x66')](_0xcbec1a));delete _0xcbec1a[_0x9a31('0x2a')];if(_0x89ca75===0x191){_0x89ca75=0x190;}_0x5e62a3['status'](_0x89ca75)[_0x9a31('0x2b')](_0x372727['query']['test']?{'message':_0x9a31('0x67'),'statusCode':_0xcbec1a[_0x9a31('0x64')]}:_0xcbec1a);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 891065e..ca9bf61 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 _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 +var _0x6050=['moment','bluebird','path','rimraf','../../config/environment','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0x348437,_0x340c5e){var _0x2fb21a=function(_0x17ad26){while(--_0x17ad26){_0x348437['push'](_0x348437['shift']());}};_0x2fb21a(++_0x340c5e);}(_0x6050,0x196));var _0x0605=function(_0x25e693,_0x43c9df){_0x25e693=_0x25e693-0x0;var _0x255a79=_0x6050[_0x25e693];return _0x255a79;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var logger=require(_0x0605('0x2'))(_0x0605('0x3'));var moment=require(_0x0605('0x4'));var BPromise=require(_0x0605('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0605('0x6'));var rimraf=require(_0x0605('0x7'));var config=require(_0x0605('0x8'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xd78d96,_0x578623){return _0xd78d96['define']('FreshsalesAccount',attributes,{'tableName':_0x0605('0x9'),'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 b960ddd..6c673d5 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 _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 +var _0xa456=['message','result','GetFreshsalesAccount','options','raw','where','attributes','limit','include','map','model','stringify','catch','ShowFreshsalesAccount','FreshsalesAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error'];(function(_0x58e7ec,_0x461dac){var _0x5c5578=function(_0x166cf8){while(--_0x166cf8){_0x58e7ec['push'](_0x58e7ec['shift']());}};_0x5c5578(++_0x461dac);}(_0xa456,0x142));var _0x6a45=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xa456[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var moment=require(_0x6a45('0x2'));var BPromise=require(_0x6a45('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6a45('0x4'));var db=require(_0x6a45('0x5'))['db'];var utils=require(_0x6a45('0x6'));var logger=require('../../config/logger')(_0x6a45('0x7'));var config=require(_0x6a45('0x8'));var jayson=require(_0x6a45('0x9'));var client=jayson[_0x6a45('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25cf8d,_0x26bfc0,_0x214514){return new BPromise(function(_0x19e67c,_0x3deb09){return client['request'](_0x25cf8d,_0x214514)[_0x6a45('0xb')](function(_0x517040){logger[_0x6a45('0xc')](_0x6a45('0xd'),_0x26bfc0,_0x6a45('0xe'));logger[_0x6a45('0xf')](_0x6a45('0x10'),_0x26bfc0,'request\x20sent',JSON['stringify'](_0x517040));if(_0x517040[_0x6a45('0x11')]){if(_0x517040[_0x6a45('0x11')]['code']===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x26bfc0,_0x517040[_0x6a45('0x11')][_0x6a45('0x12')]);return _0x3deb09(_0x517040[_0x6a45('0x11')][_0x6a45('0x12')]);}logger[_0x6a45('0x11')]('FreshsalesAccount,\x20%s,\x20%s',_0x26bfc0,_0x517040['error'][_0x6a45('0x12')]);return _0x19e67c(_0x517040[_0x6a45('0x11')]['message']);}else{logger[_0x6a45('0xc')](_0x6a45('0xd'),_0x26bfc0,_0x6a45('0xe'));_0x19e67c(_0x517040[_0x6a45('0x13')]['message']);}})['catch'](function(_0x49023f){logger[_0x6a45('0x11')](_0x6a45('0xd'),_0x26bfc0,_0x49023f);_0x3deb09(_0x49023f);});});}exports[_0x6a45('0x14')]=function(_0x52a055){var _0x379c22=this;return new Promise(function(_0x102981,_0x3439c8){return db['FreshsalesAccount']['findAll']({'raw':_0x52a055['options']?_0x52a055[_0x6a45('0x15')][_0x6a45('0x16')]===undefined?!![]:![]:!![],'where':_0x52a055['options']?_0x52a055[_0x6a45('0x15')][_0x6a45('0x17')]||null:null,'attributes':_0x52a055['options']?_0x52a055[_0x6a45('0x15')][_0x6a45('0x18')]||null:null,'limit':_0x52a055[_0x6a45('0x15')]?_0x52a055[_0x6a45('0x15')][_0x6a45('0x19')]||null:null,'include':_0x52a055['options']?_0x52a055['options'][_0x6a45('0x1a')]?_[_0x6a45('0x1b')](_0x52a055[_0x6a45('0x15')][_0x6a45('0x1a')],function(_0x25a380){return{'model':db[_0x25a380[_0x6a45('0x1c')]],'as':_0x25a380['as'],'attributes':_0x25a380[_0x6a45('0x18')],'include':_0x25a380[_0x6a45('0x1a')]?_[_0x6a45('0x1b')](_0x25a380[_0x6a45('0x1a')],function(_0x1310d7){return{'model':db[_0x1310d7[_0x6a45('0x1c')]],'as':_0x1310d7['as'],'attributes':_0x1310d7['attributes'],'include':_0x1310d7[_0x6a45('0x1a')]?_['map'](_0x1310d7[_0x6a45('0x1a')],function(_0x25467d){return{'model':db[_0x25467d[_0x6a45('0x1c')]],'as':_0x25467d['as'],'attributes':_0x25467d[_0x6a45('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6a45('0xb')](function(_0x526062){logger[_0x6a45('0xc')](_0x6a45('0x14'),_0x52a055);logger[_0x6a45('0xf')](_0x6a45('0x14'),_0x52a055,JSON[_0x6a45('0x1d')](_0x526062));_0x102981(_0x526062);})[_0x6a45('0x1e')](function(_0x3fac9b){logger[_0x6a45('0x11')]('GetFreshsalesAccount',_0x3fac9b[_0x6a45('0x12')],_0x52a055);_0x3439c8(_0x379c22[_0x6a45('0x11')](0x1f4,_0x3fac9b[_0x6a45('0x12')]));});});};exports[_0x6a45('0x1f')]=function(_0x3b07a1){var _0x5dc288=this;return new Promise(function(_0x1f95d4,_0x1f96bf){return db[_0x6a45('0x20')][_0x6a45('0x21')]({'raw':_0x3b07a1['options']?_0x3b07a1['options'][_0x6a45('0x16')]===undefined?!![]:![]:!![],'where':_0x3b07a1['options']?_0x3b07a1[_0x6a45('0x15')]['where']||null:null,'attributes':_0x3b07a1[_0x6a45('0x15')]?_0x3b07a1[_0x6a45('0x15')][_0x6a45('0x18')]||null:null,'include':_0x3b07a1[_0x6a45('0x15')]?_0x3b07a1[_0x6a45('0x15')][_0x6a45('0x1a')]?_[_0x6a45('0x1b')](_0x3b07a1[_0x6a45('0x15')][_0x6a45('0x1a')],function(_0x36f4a4){return{'model':db[_0x36f4a4[_0x6a45('0x1c')]],'as':_0x36f4a4['as'],'attributes':_0x36f4a4[_0x6a45('0x18')],'include':_0x36f4a4[_0x6a45('0x1a')]?_['map'](_0x36f4a4[_0x6a45('0x1a')],function(_0x4ae2ac){return{'model':db[_0x4ae2ac[_0x6a45('0x1c')]],'as':_0x4ae2ac['as'],'attributes':_0x4ae2ac[_0x6a45('0x18')],'include':_0x4ae2ac[_0x6a45('0x1a')]?_[_0x6a45('0x1b')](_0x4ae2ac[_0x6a45('0x1a')],function(_0x2199c1){return{'model':db[_0x2199c1['model']],'as':_0x2199c1['as'],'attributes':_0x2199c1[_0x6a45('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6a45('0xb')](function(_0x2b75f6){logger[_0x6a45('0xc')](_0x6a45('0x1f'),_0x3b07a1);logger[_0x6a45('0xf')]('ShowFreshsalesAccount',_0x3b07a1,JSON[_0x6a45('0x1d')](_0x2b75f6));_0x1f95d4(_0x2b75f6);})[_0x6a45('0x1e')](function(_0x5c76bd){logger[_0x6a45('0x11')](_0x6a45('0x1f'),_0x5c76bd[_0x6a45('0x12')],_0x3b07a1);_0x1f96bf(_0x5dc288[_0x6a45('0x11')](0x1f4,_0x5c76bd[_0x6a45('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 5f982eb..35dff5c 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 _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 +var _0xcc35=['getSubjects','getDescriptions','/:id/fields','getFields','post','put','delete','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','show','get','/:id/subjects'];(function(_0x52e304,_0x1306f0){var _0x5dbe88=function(_0x5defb4){while(--_0x5defb4){_0x52e304['push'](_0x52e304['shift']());}};_0x5dbe88(++_0x1306f0);}(_0xcc35,0xb3));var _0x5cc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc35[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5cc3('0x0'));var util=require(_0x5cc3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x5cc3('0x2'));var auth=require(_0x5cc3('0x3'));var interaction=require(_0x5cc3('0x4'));var config=require(_0x5cc3('0x5'));var controller=require('./intFreshsalesConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x5cc3('0x6'),auth[_0x5cc3('0x7')](),controller[_0x5cc3('0x8')]);router[_0x5cc3('0x9')](_0x5cc3('0xa'),auth[_0x5cc3('0x7')](),controller[_0x5cc3('0xb')]);router[_0x5cc3('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x5cc3('0xc')]);router['get'](_0x5cc3('0xd'),auth[_0x5cc3('0x7')](),controller[_0x5cc3('0xe')]);router[_0x5cc3('0xf')]('/',auth[_0x5cc3('0x7')](),controller['create']);router[_0x5cc3('0x10')]('/:id',auth[_0x5cc3('0x7')](),controller['update']);router[_0x5cc3('0x11')](_0x5cc3('0x6'),auth[_0x5cc3('0x7')](),controller['destroy']);module[_0x5cc3('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index a710717..06f19d1 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 _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 +var _0x888e=['STRING','sequelize','exports'];(function(_0x517c4f,_0x4168a5){var _0x572fdd=function(_0x358cc4){while(--_0x358cc4){_0x517c4f['push'](_0x517c4f['shift']());}};_0x572fdd(++_0x4168a5);}(_0x888e,0x136));var _0xe888=function(_0x31b0d9,_0x367641){_0x31b0d9=_0x31b0d9-0x0;var _0x486776=_0x888e[_0x31b0d9];return _0x486776;};'use strict';var Sequelize=require(_0xe888('0x0'));module[_0xe888('0x1')]={'name':{'type':Sequelize[_0xe888('0x2')]},'description':{'type':Sequelize[_0xe888('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index b569d6f..e198d5b 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 _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 +var _0x9a30=['model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','where','pick','filter','VIRTUAL','merge','options','FreshsalesConfiguration','includeAll','include','findAll','rows','catch','show','find','create','body','params','getSubjects','FreshsalesField','length','sort','getDescriptions','findOne','getFields','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','key'];(function(_0x35bf13,_0x1d9861){var _0x41b1eb=function(_0x30603e){while(--_0x30603e){_0x35bf13['push'](_0x35bf13['shift']());}};_0x41b1eb(++_0x1d9861);}(_0x9a30,0x161));var _0x09a3=function(_0x6c7219,_0xf48897){_0x6c7219=_0x6c7219-0x0;var _0x2155d4=_0x9a30[_0x6c7219];return _0x2155d4;};'use strict';var emlformat=require(_0x09a3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x09a3('0x1'));var jsonpatch=require(_0x09a3('0x2'));var rp=require(_0x09a3('0x3'));var moment=require(_0x09a3('0x4'));var BPromise=require(_0x09a3('0x5'));var Mustache=require(_0x09a3('0x6'));var util=require(_0x09a3('0x7'));var path=require(_0x09a3('0x8'));var sox=require(_0x09a3('0x9'));var csv=require(_0x09a3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x09a3('0xb'));var squel=require(_0x09a3('0xc'));var crypto=require('crypto');var jsforce=require(_0x09a3('0xd'));var deskjs=require(_0x09a3('0xe'));var toCsv=require(_0x09a3('0xa'));var querystring=require(_0x09a3('0xf'));var Papa=require('papaparse');var Redis=require(_0x09a3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x09a3('0x11'));var as=require(_0x09a3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x09a3('0x13'));var utils=require(_0x09a3('0x14'));var config=require(_0x09a3('0x15'));var licenseUtil=require(_0x09a3('0x16'));var db=require(_0x09a3('0x17'))['db'];function respondWithStatusCode(_0x51fb8d,_0x5abd25){_0x5abd25=_0x5abd25||0xcc;return function(_0x5c749b){if(_0x5c749b){return _0x51fb8d[_0x09a3('0x18')](_0x5abd25);}return _0x51fb8d[_0x09a3('0x19')](_0x5abd25)[_0x09a3('0x1a')]();};}function respondWithResult(_0x59d5e6,_0x48ff14){_0x48ff14=_0x48ff14||0xc8;return function(_0x5219b0){if(_0x5219b0){return _0x59d5e6['status'](_0x48ff14)[_0x09a3('0x1b')](_0x5219b0);}};}function respondWithFilteredResult(_0x3e59db,_0x450739){return function(_0x169546){if(_0x169546){var _0x4a7340=typeof _0x450739[_0x09a3('0x1c')]===_0x09a3('0x1d')&&typeof _0x450739[_0x09a3('0x1e')]===_0x09a3('0x1d');var _0x16b535=_0x169546[_0x09a3('0x1f')];var _0x60d6df=_0x4a7340?0x0:_0x450739[_0x09a3('0x1c')];var _0x3aafbd=_0x4a7340?_0x169546[_0x09a3('0x1f')]:_0x450739[_0x09a3('0x1c')]+_0x450739[_0x09a3('0x1e')];var _0x59fad4;if(_0x3aafbd>=_0x16b535){_0x3aafbd=_0x16b535;_0x59fad4=0xc8;}else{_0x59fad4=0xce;}_0x3e59db[_0x09a3('0x19')](_0x59fad4);return _0x3e59db[_0x09a3('0x20')](_0x09a3('0x21'),_0x60d6df+'-'+_0x3aafbd+'/'+_0x16b535)[_0x09a3('0x1b')](_0x169546);}return null;};}function patchUpdates(_0x28983d){return function(_0x2b0f75){try{jsonpatch[_0x09a3('0x22')](_0x2b0f75,_0x28983d,!![]);}catch(_0x9b9036){return BPromise[_0x09a3('0x23')](_0x9b9036);}return _0x2b0f75['save']();};}function saveUpdates(_0xe9e11b,_0x1ab165){return function(_0xcc129e){if(_0xcc129e){return _0xcc129e[_0x09a3('0x24')](_0xe9e11b)['then'](function(_0x22306c){return _0x22306c;});}return null;};}function removeEntity(_0x4e95e1,_0x615a82){return function(_0x472d65){if(_0x472d65){return _0x472d65[_0x09a3('0x25')]()[_0x09a3('0x26')](function(){_0x4e95e1[_0x09a3('0x19')](0xcc)[_0x09a3('0x1a')]();});}};}function handleEntityNotFound(_0x2f5f25,_0x560aa6){return function(_0x5be99d){if(!_0x5be99d){_0x2f5f25[_0x09a3('0x18')](0x194);}return _0x5be99d;};}function handleError(_0x4aabc4,_0x44c9c7){_0x44c9c7=_0x44c9c7||0x1f4;return function(_0x44d87f){logger['error'](_0x44d87f[_0x09a3('0x27')]);if(_0x44d87f[_0x09a3('0x28')]){delete _0x44d87f[_0x09a3('0x28')];}_0x4aabc4[_0x09a3('0x19')](_0x44c9c7)[_0x09a3('0x29')](_0x44d87f);};}exports[_0x09a3('0x2a')]=function(_0x4d1c96,_0x33e4e8){var _0x501e8e={},_0x1d9ebe={},_0x87c493={'count':0x0,'rows':[]};var _0x10a548=_[_0x09a3('0x2b')](db['FreshsalesConfiguration'][_0x09a3('0x2c')],function(_0xb9636e){return{'name':_0xb9636e[_0x09a3('0x2d')],'type':_0xb9636e['type'][_0x09a3('0x2e')]};});_0x1d9ebe[_0x09a3('0x2f')]=_[_0x09a3('0x2b')](_0x10a548,'name');_0x1d9ebe[_0x09a3('0x30')]=_[_0x09a3('0x31')](_0x4d1c96[_0x09a3('0x30')]);_0x1d9ebe[_0x09a3('0x32')]=_[_0x09a3('0x33')](_0x1d9ebe[_0x09a3('0x2f')],_0x1d9ebe[_0x09a3('0x30')]);_0x501e8e[_0x09a3('0x34')]=_[_0x09a3('0x33')](_0x1d9ebe[_0x09a3('0x2f')],qs['fields'](_0x4d1c96[_0x09a3('0x30')][_0x09a3('0x35')]));_0x501e8e[_0x09a3('0x34')]=_0x501e8e[_0x09a3('0x34')]['length']?_0x501e8e['attributes']:_0x1d9ebe[_0x09a3('0x2f')];if(!_0x4d1c96[_0x09a3('0x30')][_0x09a3('0x36')]('nolimit')){_0x501e8e['limit']=qs['limit'](_0x4d1c96[_0x09a3('0x30')][_0x09a3('0x1e')]);_0x501e8e[_0x09a3('0x1c')]=qs['offset'](_0x4d1c96[_0x09a3('0x30')][_0x09a3('0x1c')]);}_0x501e8e[_0x09a3('0x37')]=qs['sort'](_0x4d1c96[_0x09a3('0x30')]['sort']);_0x501e8e[_0x09a3('0x38')]=qs[_0x09a3('0x32')](_[_0x09a3('0x39')](_0x4d1c96['query'],_0x1d9ebe[_0x09a3('0x32')]),_0x10a548);if(_0x4d1c96[_0x09a3('0x30')][_0x09a3('0x3a')]){_0x501e8e[_0x09a3('0x38')]=_['merge'](_0x501e8e[_0x09a3('0x38')],{'$or':_[_0x09a3('0x2b')](_0x10a548,function(_0x39036b){if(_0x39036b['type']!==_0x09a3('0x3b')){var _0x143d7d={};_0x143d7d[_0x39036b[_0x09a3('0x28')]]={'$like':'%'+_0x4d1c96[_0x09a3('0x30')][_0x09a3('0x3a')]+'%'};return _0x143d7d;}})});}_0x501e8e=_[_0x09a3('0x3c')]({},_0x501e8e,_0x4d1c96[_0x09a3('0x3d')]);var _0xfdee4f={'where':_0x501e8e['where']};return db[_0x09a3('0x3e')][_0x09a3('0x1f')](_0xfdee4f)[_0x09a3('0x26')](function(_0x5320be){_0x87c493['count']=_0x5320be;if(_0x4d1c96[_0x09a3('0x30')][_0x09a3('0x3f')]){_0x501e8e[_0x09a3('0x40')]=[{'all':!![]}];}return db[_0x09a3('0x3e')][_0x09a3('0x41')](_0x501e8e);})[_0x09a3('0x26')](function(_0x202318){_0x87c493[_0x09a3('0x42')]=_0x202318;return _0x87c493;})[_0x09a3('0x26')](respondWithFilteredResult(_0x33e4e8,_0x501e8e))[_0x09a3('0x43')](handleError(_0x33e4e8,null));};exports[_0x09a3('0x44')]=function(_0x1b631d,_0x5685ff){var _0x11ba62={'raw':![],'where':{'id':_0x1b631d['params']['id']}},_0x3b61b7={};_0x3b61b7['model']=_[_0x09a3('0x31')](db[_0x09a3('0x3e')]['rawAttributes']);_0x3b61b7[_0x09a3('0x30')]=_[_0x09a3('0x31')](_0x1b631d[_0x09a3('0x30')]);_0x3b61b7[_0x09a3('0x32')]=_[_0x09a3('0x33')](_0x3b61b7[_0x09a3('0x2f')],_0x3b61b7['query']);_0x11ba62['attributes']=_[_0x09a3('0x33')](_0x3b61b7['model'],qs[_0x09a3('0x35')](_0x1b631d[_0x09a3('0x30')][_0x09a3('0x35')]));_0x11ba62[_0x09a3('0x34')]=_0x11ba62[_0x09a3('0x34')]['length']?_0x11ba62['attributes']:_0x3b61b7['model'];if(_0x1b631d[_0x09a3('0x30')][_0x09a3('0x3f')]){_0x11ba62[_0x09a3('0x40')]=[{'all':!![]}];}_0x11ba62=_['merge']({},_0x11ba62,_0x1b631d[_0x09a3('0x3d')]);return db[_0x09a3('0x3e')][_0x09a3('0x45')](_0x11ba62)[_0x09a3('0x26')](handleEntityNotFound(_0x5685ff,null))['then'](respondWithResult(_0x5685ff,null))[_0x09a3('0x43')](handleError(_0x5685ff,null));};exports['create']=function(_0x45c0bc,_0x200734){return db['FreshsalesConfiguration'][_0x09a3('0x46')](_0x45c0bc['body'],{})[_0x09a3('0x26')](respondWithResult(_0x200734,0xc9))[_0x09a3('0x43')](handleError(_0x200734,null));};exports[_0x09a3('0x24')]=function(_0x3b444e,_0x31d8a8){if(_0x3b444e[_0x09a3('0x47')]['id']){delete _0x3b444e[_0x09a3('0x47')]['id'];}return db[_0x09a3('0x3e')][_0x09a3('0x45')]({'where':{'id':_0x3b444e[_0x09a3('0x48')]['id']}})[_0x09a3('0x26')](handleEntityNotFound(_0x31d8a8,null))[_0x09a3('0x26')](saveUpdates(_0x3b444e[_0x09a3('0x47')],null))[_0x09a3('0x26')](respondWithResult(_0x31d8a8,null))[_0x09a3('0x43')](handleError(_0x31d8a8,null));};exports[_0x09a3('0x25')]=function(_0xd07a30,_0x4bbe9c){return db[_0x09a3('0x3e')]['find']({'where':{'id':_0xd07a30[_0x09a3('0x48')]['id']}})['then'](handleEntityNotFound(_0x4bbe9c,null))['then'](removeEntity(_0x4bbe9c,null))['catch'](handleError(_0x4bbe9c,null));};exports[_0x09a3('0x49')]=function(_0x41545c,_0x24024a,_0x3c951c){var _0x16f12f={};var _0x5913f4={};var _0x50fc7c;var _0x2269c6;return db[_0x09a3('0x3e')]['findOne']({'where':{'id':_0x41545c[_0x09a3('0x48')]['id']}})[_0x09a3('0x26')](handleEntityNotFound(_0x24024a,null))[_0x09a3('0x26')](function(_0x5c6246){if(_0x5c6246){_0x50fc7c=_0x5c6246;_0x5913f4[_0x09a3('0x2f')]=_[_0x09a3('0x31')](db[_0x09a3('0x4a')][_0x09a3('0x2c')]);_0x5913f4[_0x09a3('0x30')]=_[_0x09a3('0x31')](_0x41545c[_0x09a3('0x30')]);_0x5913f4[_0x09a3('0x32')]=_[_0x09a3('0x33')](_0x5913f4[_0x09a3('0x2f')],_0x5913f4[_0x09a3('0x30')]);_0x16f12f[_0x09a3('0x34')]=_[_0x09a3('0x33')](_0x5913f4[_0x09a3('0x2f')],qs['fields'](_0x41545c[_0x09a3('0x30')]['fields']));_0x16f12f[_0x09a3('0x34')]=_0x16f12f['attributes'][_0x09a3('0x4b')]?_0x16f12f[_0x09a3('0x34')]:_0x5913f4[_0x09a3('0x2f')];_0x16f12f[_0x09a3('0x37')]=qs[_0x09a3('0x4c')](_0x41545c[_0x09a3('0x30')][_0x09a3('0x4c')]);_0x16f12f[_0x09a3('0x38')]=qs[_0x09a3('0x32')](_['pick'](_0x41545c[_0x09a3('0x30')],_0x5913f4[_0x09a3('0x32')]));if(_0x41545c[_0x09a3('0x30')]['filter']){_0x16f12f[_0x09a3('0x38')]=_[_0x09a3('0x3c')](_0x16f12f[_0x09a3('0x38')],{'$or':_[_0x09a3('0x2b')](_0x16f12f[_0x09a3('0x34')],function(_0x556d1e){var _0x1166e4={};_0x1166e4[_0x556d1e]={'$like':'%'+_0x41545c[_0x09a3('0x30')]['filter']+'%'};return _0x1166e4;})});}_0x16f12f=_[_0x09a3('0x3c')]({},_0x16f12f,_0x41545c[_0x09a3('0x3d')]);return _0x50fc7c[_0x09a3('0x49')](_0x16f12f);}})['then'](function(_0x4cc88d){if(_0x4cc88d){_0x2269c6=_0x4cc88d[_0x09a3('0x4b')];if(!_0x41545c['query'][_0x09a3('0x36')]('nolimit')){_0x16f12f[_0x09a3('0x1e')]=qs[_0x09a3('0x1e')](_0x41545c[_0x09a3('0x30')]['limit']);_0x16f12f[_0x09a3('0x1c')]=qs[_0x09a3('0x1c')](_0x41545c[_0x09a3('0x30')][_0x09a3('0x1c')]);}return _0x50fc7c[_0x09a3('0x49')](_0x16f12f);}})[_0x09a3('0x26')](function(_0x3568c7){if(_0x3568c7){return _0x3568c7?{'count':_0x2269c6,'rows':_0x3568c7}:null;}})[_0x09a3('0x26')](respondWithResult(_0x24024a,null))[_0x09a3('0x43')](handleError(_0x24024a,null));};exports[_0x09a3('0x4d')]=function(_0x4b436b,_0x482f79,_0x5a26c0){var _0x352ead={};var _0x21fbd0={};var _0x29cc1a;var _0x64ec46;return db['FreshsalesConfiguration'][_0x09a3('0x4e')]({'where':{'id':_0x4b436b[_0x09a3('0x48')]['id']}})['then'](handleEntityNotFound(_0x482f79,null))[_0x09a3('0x26')](function(_0x3e3014){if(_0x3e3014){_0x29cc1a=_0x3e3014;_0x21fbd0[_0x09a3('0x2f')]=_[_0x09a3('0x31')](db[_0x09a3('0x4a')]['rawAttributes']);_0x21fbd0['query']=_[_0x09a3('0x31')](_0x4b436b[_0x09a3('0x30')]);_0x21fbd0[_0x09a3('0x32')]=_[_0x09a3('0x33')](_0x21fbd0[_0x09a3('0x2f')],_0x21fbd0[_0x09a3('0x30')]);_0x352ead['attributes']=_[_0x09a3('0x33')](_0x21fbd0['model'],qs[_0x09a3('0x35')](_0x4b436b[_0x09a3('0x30')][_0x09a3('0x35')]));_0x352ead[_0x09a3('0x34')]=_0x352ead[_0x09a3('0x34')][_0x09a3('0x4b')]?_0x352ead[_0x09a3('0x34')]:_0x21fbd0[_0x09a3('0x2f')];_0x352ead[_0x09a3('0x37')]=qs[_0x09a3('0x4c')](_0x4b436b['query'][_0x09a3('0x4c')]);_0x352ead[_0x09a3('0x38')]=qs['filters'](_[_0x09a3('0x39')](_0x4b436b[_0x09a3('0x30')],_0x21fbd0[_0x09a3('0x32')]));if(_0x4b436b[_0x09a3('0x30')][_0x09a3('0x3a')]){_0x352ead[_0x09a3('0x38')]=_[_0x09a3('0x3c')](_0x352ead['where'],{'$or':_[_0x09a3('0x2b')](_0x352ead[_0x09a3('0x34')],function(_0x46f3a9){var _0x46aa68={};_0x46aa68[_0x46f3a9]={'$like':'%'+_0x4b436b[_0x09a3('0x30')][_0x09a3('0x3a')]+'%'};return _0x46aa68;})});}_0x352ead=_[_0x09a3('0x3c')]({},_0x352ead,_0x4b436b[_0x09a3('0x3d')]);return _0x29cc1a[_0x09a3('0x4d')](_0x352ead);}})['then'](function(_0x313496){if(_0x313496){_0x64ec46=_0x313496[_0x09a3('0x4b')];if(!_0x4b436b['query'][_0x09a3('0x36')]('nolimit')){_0x352ead[_0x09a3('0x1e')]=qs[_0x09a3('0x1e')](_0x4b436b['query'][_0x09a3('0x1e')]);_0x352ead['offset']=qs['offset'](_0x4b436b[_0x09a3('0x30')][_0x09a3('0x1c')]);}return _0x29cc1a[_0x09a3('0x4d')](_0x352ead);}})[_0x09a3('0x26')](function(_0x1ce505){if(_0x1ce505){return _0x1ce505?{'count':_0x64ec46,'rows':_0x1ce505}:null;}})['then'](respondWithResult(_0x482f79,null))['catch'](handleError(_0x482f79,null));};exports[_0x09a3('0x4f')]=function(_0x46709c,_0x355a6b,_0x30d629){var _0x4bf90e={};var _0x352ca8={};var _0x1f7bd2;var _0x4c70d9;return db['FreshsalesConfiguration'][_0x09a3('0x4e')]({'where':{'id':_0x46709c[_0x09a3('0x48')]['id']}})['then'](handleEntityNotFound(_0x355a6b,null))[_0x09a3('0x26')](function(_0x38f0a9){if(_0x38f0a9){_0x1f7bd2=_0x38f0a9;_0x352ca8['model']=_['keys'](db[_0x09a3('0x4a')][_0x09a3('0x2c')]);_0x352ca8[_0x09a3('0x30')]=_[_0x09a3('0x31')](_0x46709c[_0x09a3('0x30')]);_0x352ca8[_0x09a3('0x32')]=_[_0x09a3('0x33')](_0x352ca8[_0x09a3('0x2f')],_0x352ca8[_0x09a3('0x30')]);_0x4bf90e[_0x09a3('0x34')]=_[_0x09a3('0x33')](_0x352ca8['model'],qs[_0x09a3('0x35')](_0x46709c[_0x09a3('0x30')][_0x09a3('0x35')]));_0x4bf90e[_0x09a3('0x34')]=_0x4bf90e[_0x09a3('0x34')]['length']?_0x4bf90e['attributes']:_0x352ca8[_0x09a3('0x2f')];_0x4bf90e[_0x09a3('0x37')]=qs[_0x09a3('0x4c')](_0x46709c[_0x09a3('0x30')][_0x09a3('0x4c')]);_0x4bf90e[_0x09a3('0x38')]=qs[_0x09a3('0x32')](_[_0x09a3('0x39')](_0x46709c[_0x09a3('0x30')],_0x352ca8[_0x09a3('0x32')]));if(_0x46709c['query'][_0x09a3('0x3a')]){_0x4bf90e[_0x09a3('0x38')]=_['merge'](_0x4bf90e[_0x09a3('0x38')],{'$or':_[_0x09a3('0x2b')](_0x4bf90e[_0x09a3('0x34')],function(_0x3b5c9c){var _0xd39dac={};_0xd39dac[_0x3b5c9c]={'$like':'%'+_0x46709c['query'][_0x09a3('0x3a')]+'%'};return _0xd39dac;})});}_0x4bf90e=_['merge']({},_0x4bf90e,_0x46709c[_0x09a3('0x3d')]);return _0x1f7bd2['getFields'](_0x4bf90e);}})[_0x09a3('0x26')](function(_0x44fc6b){if(_0x44fc6b){_0x4c70d9=_0x44fc6b[_0x09a3('0x4b')];if(!_0x46709c[_0x09a3('0x30')]['hasOwnProperty']('nolimit')){_0x4bf90e[_0x09a3('0x1e')]=qs[_0x09a3('0x1e')](_0x46709c[_0x09a3('0x30')][_0x09a3('0x1e')]);_0x4bf90e[_0x09a3('0x1c')]=qs['offset'](_0x46709c[_0x09a3('0x30')][_0x09a3('0x1c')]);}return _0x1f7bd2['getFields'](_0x4bf90e);}})[_0x09a3('0x26')](function(_0x4f34cc){if(_0x4f34cc){return _0x4f34cc?{'count':_0x4c70d9,'rows':_0x4f34cc}:null;}})[_0x09a3('0x26')](respondWithResult(_0x355a6b,null))['catch'](handleError(_0x355a6b,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 7b7ac9a..92ebc02 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 _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 +var _0x49b9=['moment','bluebird','path','rimraf','../../config/environment','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','../../config/logger'];(function(_0x6421db,_0x12e1c8){var _0x51876e=function(_0x5bc9ce){while(--_0x5bc9ce){_0x6421db['push'](_0x6421db['shift']());}};_0x51876e(++_0x12e1c8);}(_0x49b9,0x15c));var _0x949b=function(_0x2695dd,_0x1986b1){_0x2695dd=_0x2695dd-0x0;var _0x361e8a=_0x49b9[_0x2695dd];return _0x361e8a;};'use strict';var _=require(_0x949b('0x0'));var util=require('util');var logger=require(_0x949b('0x1'))('api');var moment=require(_0x949b('0x2'));var BPromise=require(_0x949b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x949b('0x4'));var rimraf=require(_0x949b('0x5'));var config=require(_0x949b('0x6'));var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x167721,_0x5b93a3){return _0x167721[_0x949b('0x7')](_0x949b('0x8'),attributes,{'tableName':_0x949b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 7221b3b..b201450 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 _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 +var _0x6bc3=['jayson/promise','client','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x2f8bef,_0x207faf){var _0x347cb7=function(_0x5b1146){while(--_0x5b1146){_0x2f8bef['push'](_0x2f8bef['shift']());}};_0x347cb7(++_0x207faf);}(_0x6bc3,0x1b0));var _0x36bc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6bc3[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x36bc('0x0'));var util=require('util');var moment=require(_0x36bc('0x1'));var BPromise=require(_0x36bc('0x2'));var rs=require(_0x36bc('0x3'));var fs=require('fs');var Redis=require(_0x36bc('0x4'));var db=require(_0x36bc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x36bc('0x6'))('rpc');var config=require(_0x36bc('0x7'));var jayson=require(_0x36bc('0x8'));var client=jayson[_0x36bc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d345a,_0x2c8ed1,_0x2e8824){return new BPromise(function(_0x39fa02,_0x426c24){return client[_0x36bc('0xa')](_0x5d345a,_0x2e8824)[_0x36bc('0xb')](function(_0x5a2114){logger[_0x36bc('0xc')](_0x36bc('0xd'),_0x2c8ed1,'request\x20sent');logger[_0x36bc('0xe')](_0x36bc('0xf'),_0x2c8ed1,_0x36bc('0x10'),JSON[_0x36bc('0x11')](_0x5a2114));if(_0x5a2114[_0x36bc('0x12')]){if(_0x5a2114['error'][_0x36bc('0x13')]===0x1f4){logger[_0x36bc('0x12')](_0x36bc('0xd'),_0x2c8ed1,_0x5a2114[_0x36bc('0x12')]['message']);return _0x426c24(_0x5a2114[_0x36bc('0x12')][_0x36bc('0x14')]);}logger['error'](_0x36bc('0xd'),_0x2c8ed1,_0x5a2114[_0x36bc('0x12')]['message']);return _0x39fa02(_0x5a2114[_0x36bc('0x12')]['message']);}else{logger[_0x36bc('0xc')](_0x36bc('0xd'),_0x2c8ed1,'request\x20sent');_0x39fa02(_0x5a2114[_0x36bc('0x15')][_0x36bc('0x14')]);}})['catch'](function(_0x43f522){logger[_0x36bc('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x2c8ed1,_0x43f522);_0x426c24(_0x43f522);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 6fc7517..b7778bc 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 _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 +var _0xf0ba=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show','post','create','put','update','destroy'];(function(_0xd58823,_0x15c483){var _0x249c0a=function(_0x4b8b67){while(--_0x4b8b67){_0xd58823['push'](_0xd58823['shift']());}};_0x249c0a(++_0x15c483);}(_0xf0ba,0x1ed));var _0xaf0b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf0ba[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xaf0b('0x0'));var util=require(_0xaf0b('0x1'));var path=require(_0xaf0b('0x2'));var timeout=require(_0xaf0b('0x3'));var express=require(_0xaf0b('0x4'));var router=express['Router']();var fs_extra=require(_0xaf0b('0x5'));var auth=require(_0xaf0b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xaf0b('0x7'));var controller=require('./intFreshsalesField.controller');router[_0xaf0b('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xaf0b('0x8')](_0xaf0b('0x9'),auth[_0xaf0b('0xa')](),controller[_0xaf0b('0xb')]);router[_0xaf0b('0xc')]('/',auth['isAuthenticated'](),controller[_0xaf0b('0xd')]);router[_0xaf0b('0xe')](_0xaf0b('0x9'),auth['isAuthenticated'](),controller[_0xaf0b('0xf')]);router['delete'](_0xaf0b('0x9'),auth[_0xaf0b('0xa')](),controller[_0xaf0b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index e0e3936..202ce76 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 _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 +var _0xb88a=['customVariable','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x2b2304,_0x469bc6){var _0x26ae4f=function(_0x1e4088){while(--_0x1e4088){_0x2b2304['push'](_0x2b2304['shift']());}};_0x26ae4f(++_0x469bc6);}(_0xb88a,0xdb));var _0xab88=function(_0x5004d5,_0x50ab11){_0x5004d5=_0x5004d5-0x0;var _0x33469a=_0xb88a[_0x5004d5];return _0x33469a;};'use strict';var Sequelize=require(_0xab88('0x0'));module[_0xab88('0x1')]={'type':{'type':Sequelize[_0xab88('0x2')](_0xab88('0x3'),_0xab88('0x4'),_0xab88('0x5'),'keyValue','picklist'),'defaultValue':_0xab88('0x3')},'content':{'type':Sequelize[_0xab88('0x6')]},'key':{'type':Sequelize[_0xab88('0x6')]},'keyType':{'type':Sequelize['ENUM']('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xab88('0x6')]},'idField':{'type':Sequelize[_0xab88('0x6')]},'nameField':{'type':Sequelize[_0xab88('0x6')]},'customField':{'type':Sequelize[_0xab88('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xab88('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 275fad5..7374dc5 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 _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 +var _0x38c4=['merge','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','options','includeAll','include','FreshsalesField','findAll','rows','show','params','fields'];(function(_0x3a9f29,_0x43e4bf){var _0x48f2a2=function(_0x92bf63){while(--_0x92bf63){_0x3a9f29['push'](_0x3a9f29['shift']());}};_0x48f2a2(++_0x43e4bf);}(_0x38c4,0x190));var _0x438c=function(_0x14ccf5,_0x2ccb79){_0x14ccf5=_0x14ccf5-0x0;var _0x2d9d97=_0x38c4[_0x14ccf5];return _0x2d9d97;};'use strict';var emlformat=require(_0x438c('0x0'));var rimraf=require(_0x438c('0x1'));var zipdir=require(_0x438c('0x2'));var jsonpatch=require(_0x438c('0x3'));var rp=require(_0x438c('0x4'));var moment=require(_0x438c('0x5'));var BPromise=require(_0x438c('0x6'));var Mustache=require(_0x438c('0x7'));var util=require(_0x438c('0x8'));var path=require('path');var sox=require(_0x438c('0x9'));var csv=require(_0x438c('0xa'));var ejs=require(_0x438c('0xb'));var fs=require('fs');var fs_extra=require(_0x438c('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x438c('0xd'));var deskjs=require(_0x438c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x438c('0xf'));var Papa=require(_0x438c('0x10'));var Redis=require(_0x438c('0x11'));var authService=require(_0x438c('0x12'));var qs=require(_0x438c('0x13'));var as=require(_0x438c('0x14'));var hardwareService=require(_0x438c('0x15'));var logger=require('../../config/logger')(_0x438c('0x16'));var utils=require(_0x438c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x438c('0x18'));var db=require(_0x438c('0x19'))['db'];function respondWithStatusCode(_0x57c212,_0x3f3731){_0x3f3731=_0x3f3731||0xcc;return function(_0x20b6bc){if(_0x20b6bc){return _0x57c212[_0x438c('0x1a')](_0x3f3731);}return _0x57c212[_0x438c('0x1b')](_0x3f3731)[_0x438c('0x1c')]();};}function respondWithResult(_0x367710,_0x23534f){_0x23534f=_0x23534f||0xc8;return function(_0x36589b){if(_0x36589b){return _0x367710['status'](_0x23534f)[_0x438c('0x1d')](_0x36589b);}};}function respondWithFilteredResult(_0x473e22,_0x3412dd){return function(_0x4f9530){if(_0x4f9530){var _0x18282b=typeof _0x3412dd[_0x438c('0x1e')]===_0x438c('0x1f')&&typeof _0x3412dd['limit']===_0x438c('0x1f');var _0x5f2fc0=_0x4f9530[_0x438c('0x20')];var _0xf5f337=_0x18282b?0x0:_0x3412dd[_0x438c('0x1e')];var _0xd45e24=_0x18282b?_0x4f9530[_0x438c('0x20')]:_0x3412dd[_0x438c('0x1e')]+_0x3412dd[_0x438c('0x21')];var _0x530a43;if(_0xd45e24>=_0x5f2fc0){_0xd45e24=_0x5f2fc0;_0x530a43=0xc8;}else{_0x530a43=0xce;}_0x473e22['status'](_0x530a43);return _0x473e22[_0x438c('0x22')](_0x438c('0x23'),_0xf5f337+'-'+_0xd45e24+'/'+_0x5f2fc0)[_0x438c('0x1d')](_0x4f9530);}return null;};}function patchUpdates(_0x3e3ba4){return function(_0x5df2c8){try{jsonpatch[_0x438c('0x24')](_0x5df2c8,_0x3e3ba4,!![]);}catch(_0x377191){return BPromise[_0x438c('0x25')](_0x377191);}return _0x5df2c8[_0x438c('0x26')]();};}function saveUpdates(_0x363b9e,_0xc9e92a){return function(_0x1581d6){if(_0x1581d6){return _0x1581d6['update'](_0x363b9e)[_0x438c('0x27')](function(_0x4fe417){return _0x4fe417;});}return null;};}function removeEntity(_0x391288,_0x1459ea){return function(_0x51cc9a){if(_0x51cc9a){return _0x51cc9a[_0x438c('0x28')]()[_0x438c('0x27')](function(){_0x391288[_0x438c('0x1b')](0xcc)[_0x438c('0x1c')]();});}};}function handleEntityNotFound(_0x435887,_0x3a2ca1){return function(_0x18241e){if(!_0x18241e){_0x435887[_0x438c('0x1a')](0x194);}return _0x18241e;};}function handleError(_0x4eda1d,_0xa993ca){_0xa993ca=_0xa993ca||0x1f4;return function(_0x2c33a1){logger[_0x438c('0x29')](_0x2c33a1[_0x438c('0x2a')]);if(_0x2c33a1['name']){delete _0x2c33a1[_0x438c('0x2b')];}_0x4eda1d[_0x438c('0x1b')](_0xa993ca)['send'](_0x2c33a1);};}exports[_0x438c('0x2c')]=function(_0x5ba5fd,_0xafc1d1){var _0xd8a44c={},_0x5dbd88={},_0x4cd1bd={'count':0x0,'rows':[]};var _0x368719=_[_0x438c('0x2d')](db['FreshsalesField'][_0x438c('0x2e')],function(_0x3b298e){return{'name':_0x3b298e[_0x438c('0x2f')],'type':_0x3b298e[_0x438c('0x30')][_0x438c('0x31')]};});_0x5dbd88['model']=_['map'](_0x368719,_0x438c('0x2b'));_0x5dbd88[_0x438c('0x32')]=_[_0x438c('0x33')](_0x5ba5fd[_0x438c('0x32')]);_0x5dbd88['filters']=_[_0x438c('0x34')](_0x5dbd88[_0x438c('0x35')],_0x5dbd88[_0x438c('0x32')]);_0xd8a44c[_0x438c('0x36')]=_[_0x438c('0x34')](_0x5dbd88['model'],qs['fields'](_0x5ba5fd[_0x438c('0x32')]['fields']));_0xd8a44c[_0x438c('0x36')]=_0xd8a44c['attributes'][_0x438c('0x37')]?_0xd8a44c[_0x438c('0x36')]:_0x5dbd88[_0x438c('0x35')];if(!_0x5ba5fd[_0x438c('0x32')][_0x438c('0x38')](_0x438c('0x39'))){_0xd8a44c[_0x438c('0x21')]=qs[_0x438c('0x21')](_0x5ba5fd[_0x438c('0x32')][_0x438c('0x21')]);_0xd8a44c[_0x438c('0x1e')]=qs['offset'](_0x5ba5fd[_0x438c('0x32')][_0x438c('0x1e')]);}_0xd8a44c[_0x438c('0x3a')]=qs[_0x438c('0x3b')](_0x5ba5fd[_0x438c('0x32')]['sort']);_0xd8a44c[_0x438c('0x3c')]=qs['filters'](_[_0x438c('0x3d')](_0x5ba5fd[_0x438c('0x32')],_0x5dbd88[_0x438c('0x3e')]),_0x368719);if(_0x5ba5fd[_0x438c('0x32')][_0x438c('0x3f')]){_0xd8a44c[_0x438c('0x3c')]=_['merge'](_0xd8a44c[_0x438c('0x3c')],{'$or':_['map'](_0x368719,function(_0x1899da){if(_0x1899da[_0x438c('0x30')]!==_0x438c('0x40')){var _0x328e65={};_0x328e65[_0x1899da['name']]={'$like':'%'+_0x5ba5fd['query'][_0x438c('0x3f')]+'%'};return _0x328e65;}})});}_0xd8a44c=_['merge']({},_0xd8a44c,_0x5ba5fd[_0x438c('0x41')]);var _0x5880cd={'where':_0xd8a44c[_0x438c('0x3c')]};return db['FreshsalesField'][_0x438c('0x20')](_0x5880cd)[_0x438c('0x27')](function(_0xa83f57){_0x4cd1bd['count']=_0xa83f57;if(_0x5ba5fd[_0x438c('0x32')][_0x438c('0x42')]){_0xd8a44c[_0x438c('0x43')]=[{'all':!![]}];}return db[_0x438c('0x44')][_0x438c('0x45')](_0xd8a44c);})[_0x438c('0x27')](function(_0x544372){_0x4cd1bd[_0x438c('0x46')]=_0x544372;return _0x4cd1bd;})['then'](respondWithFilteredResult(_0xafc1d1,_0xd8a44c))['catch'](handleError(_0xafc1d1,null));};exports[_0x438c('0x47')]=function(_0x139fdd,_0x206b3d){var _0x59ad80={'raw':!![],'where':{'id':_0x139fdd[_0x438c('0x48')]['id']}},_0x12fd6b={};_0x12fd6b['model']=_['keys'](db[_0x438c('0x44')][_0x438c('0x2e')]);_0x12fd6b[_0x438c('0x32')]=_[_0x438c('0x33')](_0x139fdd['query']);_0x12fd6b[_0x438c('0x3e')]=_[_0x438c('0x34')](_0x12fd6b[_0x438c('0x35')],_0x12fd6b[_0x438c('0x32')]);_0x59ad80['attributes']=_['intersection'](_0x12fd6b['model'],qs[_0x438c('0x49')](_0x139fdd['query'][_0x438c('0x49')]));_0x59ad80['attributes']=_0x59ad80[_0x438c('0x36')][_0x438c('0x37')]?_0x59ad80[_0x438c('0x36')]:_0x12fd6b[_0x438c('0x35')];if(_0x139fdd[_0x438c('0x32')][_0x438c('0x42')]){_0x59ad80[_0x438c('0x43')]=[{'all':!![]}];}_0x59ad80=_[_0x438c('0x4a')]({},_0x59ad80,_0x139fdd[_0x438c('0x41')]);return db[_0x438c('0x44')]['find'](_0x59ad80)[_0x438c('0x27')](handleEntityNotFound(_0x206b3d,null))[_0x438c('0x27')](respondWithResult(_0x206b3d,null))[_0x438c('0x4b')](handleError(_0x206b3d,null));};exports[_0x438c('0x4c')]=function(_0x54045c,_0x57198e){return db[_0x438c('0x44')][_0x438c('0x4c')](_0x54045c[_0x438c('0x4d')],{})[_0x438c('0x27')](respondWithResult(_0x57198e,0xc9))[_0x438c('0x4b')](handleError(_0x57198e,null));};exports['update']=function(_0x2c62f0,_0x3d3501){if(_0x2c62f0[_0x438c('0x4d')]['id']){delete _0x2c62f0[_0x438c('0x4d')]['id'];}return db[_0x438c('0x44')][_0x438c('0x4e')]({'where':{'id':_0x2c62f0[_0x438c('0x48')]['id']}})[_0x438c('0x27')](handleEntityNotFound(_0x3d3501,null))[_0x438c('0x27')](saveUpdates(_0x2c62f0[_0x438c('0x4d')],null))[_0x438c('0x27')](respondWithResult(_0x3d3501,null))[_0x438c('0x4b')](handleError(_0x3d3501,null));};exports[_0x438c('0x28')]=function(_0x1bbf99,_0x5a5eba){return db['FreshsalesField'][_0x438c('0x4e')]({'where':{'id':_0x1bbf99['params']['id']}})[_0x438c('0x27')](handleEntityNotFound(_0x5a5eba,null))['then'](removeEntity(_0x5a5eba,null))[_0x438c('0x4b')](handleError(_0x5a5eba,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 7ca5eea..8b8d98b 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 _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 +var _0x530f=['rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','freshsales_unique_index','idField','FieldId','util','moment','bluebird','request-promise','path'];(function(_0x1f75e8,_0x7fa97f){var _0x120699=function(_0x4d817b){while(--_0x4d817b){_0x1f75e8['push'](_0x1f75e8['shift']());}};_0x120699(++_0x7fa97f);}(_0x530f,0x167));var _0xf530=function(_0x105c6a,_0x48c736){_0x105c6a=_0x105c6a-0x0;var _0x5b844d=_0x530f[_0x105c6a];return _0x5b844d;};'use strict';var _=require('lodash');var util=require(_0xf530('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xf530('0x1'));var BPromise=require(_0xf530('0x2'));var rp=require(_0xf530('0x3'));var fs=require('fs');var path=require(_0xf530('0x4'));var rimraf=require(_0xf530('0x5'));var config=require(_0xf530('0x6'));var attributes=require(_0xf530('0x7'));module[_0xf530('0x8')]=function(_0x58f5f8,_0x3a0301){return _0x58f5f8[_0xf530('0x9')](_0xf530('0xa'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0xf530('0xb'),'fields':[_0xf530('0xc'),_0xf530('0xd')],'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 b8523b8..9edacd3 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 _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 +var _0x33af=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x49d2f7,_0x4404cb){var _0x4cf79b=function(_0x6a7a30){while(--_0x6a7a30){_0x49d2f7['push'](_0x49d2f7['shift']());}};_0x4cf79b(++_0x4404cb);}(_0x33af,0xec));var _0xf33a=function(_0x3d0366,_0x50211a){_0x3d0366=_0x3d0366-0x0;var _0x5ce75e=_0x33af[_0x3d0366];return _0x5ce75e;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var moment=require('moment');var BPromise=require(_0xf33a('0x1'));var rs=require(_0xf33a('0x2'));var fs=require('fs');var Redis=require(_0xf33a('0x3'));var db=require(_0xf33a('0x4'))['db'];var utils=require(_0xf33a('0x5'));var logger=require(_0xf33a('0x6'))('rpc');var config=require(_0xf33a('0x7'));var jayson=require(_0xf33a('0x8'));var client=jayson['client'][_0xf33a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x384b14,_0x1b2b01,_0x2f3730){return new BPromise(function(_0x2baabb,_0x2cb169){return client['request'](_0x384b14,_0x2f3730)[_0xf33a('0xa')](function(_0x14eb0e){logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,_0xf33a('0xd'));logger[_0xf33a('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x1b2b01,'request\x20sent',JSON[_0xf33a('0xf')](_0x14eb0e));if(_0x14eb0e[_0xf33a('0x10')]){if(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x11')]===0x1f4){logger[_0xf33a('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2cb169(_0x14eb0e['error']['message']);}logger[_0xf33a('0x10')](_0xf33a('0xc'),_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2baabb(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);}else{logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,'request\x20sent');_0x2baabb(_0x14eb0e[_0xf33a('0x13')]['message']);}})[_0xf33a('0x14')](function(_0x229389){logger['error'](_0xf33a('0xc'),_0x1b2b01,_0x229389);_0x2cb169(_0x229389);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index eed067a..ef7258e 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_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 +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(_0x55a168,_0x168f0f){var _0x2f03e5=function(_0x7a8a22){while(--_0x7a8a22){_0x55a168['push'](_0x55a168['shift']());}};_0x2f03e5(++_0x168f0f);}(_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/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 dfee4a4..b4935cd 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 _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 +var _0x1b2a=['ENUM','integrationTab','newTab','exports','STRING','username'];(function(_0x599800,_0x4ba841){var _0x5aec6d=function(_0x3b4a25){while(--_0x3b4a25){_0x599800['push'](_0x599800['shift']());}};_0x5aec6d(++_0x4ba841);}(_0x1b2a,0x18f));var _0xa1b2=function(_0x418f1a,_0x126065){_0x418f1a=_0x418f1a-0x0;var _0x432855=_0x1b2a[_0x418f1a];return _0x432855;};'use strict';var Sequelize=require('sequelize');module[_0xa1b2('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa1b2('0x1')]},'username':{'type':Sequelize[_0xa1b2('0x1')],'unique':_0xa1b2('0x2')},'remoteUri':{'type':Sequelize[_0xa1b2('0x1')]},'password':{'type':Sequelize[_0xa1b2('0x1')]},'clientId':{'type':Sequelize[_0xa1b2('0x1')]},'clientSecret':{'type':Sequelize[_0xa1b2('0x1')]},'securityToken':{'type':Sequelize[_0xa1b2('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xa1b2('0x3')](_0xa1b2('0x4'),_0xa1b2('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 67b9b74..6dd411f 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 _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 +var _0x4887=['Connection','login','concat','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','Subject','string','int','boolean','includes','label','picklistValues','value','True','true','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','end','stack','name','send','map','SalesforceAccount','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','update','find','getConfigurations','findOne','SalesforceConfiguration','order','pick','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring'];(function(_0x5b0b32,_0x24ab0b){var _0xcc46ae=function(_0x29cb8e){while(--_0x29cb8e){_0x5b0b32['push'](_0x5b0b32['shift']());}};_0xcc46ae(++_0x24ab0b);}(_0x4887,0x8f));var _0x7488=function(_0x320fcb,_0x4e5e7b){_0x320fcb=_0x320fcb-0x0;var _0x2418b2=_0x4887[_0x320fcb];return _0x2418b2;};'use strict';var emlformat=require(_0x7488('0x0'));var rimraf=require(_0x7488('0x1'));var zipdir=require(_0x7488('0x2'));var jsonpatch=require(_0x7488('0x3'));var rp=require(_0x7488('0x4'));var moment=require(_0x7488('0x5'));var BPromise=require(_0x7488('0x6'));var Mustache=require(_0x7488('0x7'));var util=require(_0x7488('0x8'));var path=require(_0x7488('0x9'));var sox=require('sox');var csv=require(_0x7488('0xa'));var ejs=require(_0x7488('0xb'));var fs=require('fs');var fs_extra=require(_0x7488('0xc'));var _=require(_0x7488('0xd'));var squel=require(_0x7488('0xe'));var crypto=require('crypto');var jsforce=require(_0x7488('0xf'));var deskjs=require(_0x7488('0x10'));var toCsv=require(_0x7488('0xa'));var querystring=require('querystring');var Papa=require(_0x7488('0x11'));var Redis=require(_0x7488('0x12'));var authService=require(_0x7488('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7488('0x14'));var hardwareService=require(_0x7488('0x15'));var logger=require(_0x7488('0x16'))('api');var utils=require(_0x7488('0x17'));var config=require(_0x7488('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7488('0x19'))['db'];var integrations=require(_0x7488('0x1a'));function respondWithStatusCode(_0xa28e76,_0x4ba633){_0x4ba633=_0x4ba633||0xcc;return function(_0x4770fc){if(_0x4770fc){return _0xa28e76[_0x7488('0x1b')](_0x4ba633);}return _0xa28e76[_0x7488('0x1c')](_0x4ba633)['end']();};}function respondWithResult(_0x4b4647,_0xb822f3){_0xb822f3=_0xb822f3||0xc8;return function(_0x228dcb){if(_0x228dcb){return _0x4b4647[_0x7488('0x1c')](_0xb822f3)[_0x7488('0x1d')](_0x228dcb);}};}function respondWithFilteredResult(_0x16c917,_0x373320){return function(_0x393183){if(_0x393183){var _0x5c8228=typeof _0x373320[_0x7488('0x1e')]==='undefined'&&typeof _0x373320['limit']===_0x7488('0x1f');var _0x5e83b5=_0x393183['count'];var _0x84f7f8=_0x5c8228?0x0:_0x373320[_0x7488('0x1e')];var _0x51e716=_0x5c8228?_0x393183[_0x7488('0x20')]:_0x373320[_0x7488('0x1e')]+_0x373320[_0x7488('0x21')];var _0x48ef34;if(_0x51e716>=_0x5e83b5){_0x51e716=_0x5e83b5;_0x48ef34=0xc8;}else{_0x48ef34=0xce;}_0x16c917[_0x7488('0x1c')](_0x48ef34);return _0x16c917[_0x7488('0x22')](_0x7488('0x23'),_0x84f7f8+'-'+_0x51e716+'/'+_0x5e83b5)[_0x7488('0x1d')](_0x393183);}return null;};}function patchUpdates(_0x3950ec){return function(_0x50c639){try{jsonpatch[_0x7488('0x24')](_0x50c639,_0x3950ec,!![]);}catch(_0x587eab){return BPromise[_0x7488('0x25')](_0x587eab);}return _0x50c639['save']();};}function saveUpdates(_0x408c04,_0x4daec3){return function(_0x445167){if(_0x445167){return _0x445167['update'](_0x408c04)[_0x7488('0x26')](function(_0xaf7068){return _0xaf7068;});}return null;};}function removeEntity(_0x52de4b,_0x18f24b){return function(_0x1039d9){if(_0x1039d9){return _0x1039d9[_0x7488('0x27')]()[_0x7488('0x26')](function(){_0x52de4b['status'](0xcc)[_0x7488('0x28')]();});}};}function handleEntityNotFound(_0x4affef,_0x5345b6){return function(_0x559303){if(!_0x559303){_0x4affef['sendStatus'](0x194);}return _0x559303;};}function handleError(_0x124adf,_0x5cacb6){_0x5cacb6=_0x5cacb6||0x1f4;return function(_0xf7bb5c){logger['error'](_0xf7bb5c[_0x7488('0x29')]);if(_0xf7bb5c[_0x7488('0x2a')]){delete _0xf7bb5c[_0x7488('0x2a')];}_0x124adf[_0x7488('0x1c')](_0x5cacb6)[_0x7488('0x2b')](_0xf7bb5c);};}exports['index']=function(_0x4788b0,_0x18bc33){var _0xc92261={},_0x342ed7={},_0x7c515b={'count':0x0,'rows':[]};var _0x2fd9ec=_[_0x7488('0x2c')](db[_0x7488('0x2d')]['rawAttributes'],function(_0x599fd1){return{'name':_0x599fd1[_0x7488('0x2e')],'type':_0x599fd1['type']['key']};});_0x342ed7[_0x7488('0x2f')]=_[_0x7488('0x2c')](_0x2fd9ec,_0x7488('0x2a'));_0x342ed7[_0x7488('0x30')]=_[_0x7488('0x31')](_0x4788b0[_0x7488('0x30')]);_0x342ed7[_0x7488('0x32')]=_[_0x7488('0x33')](_0x342ed7['model'],_0x342ed7['query']);_0xc92261['attributes']=_['intersection'](_0x342ed7[_0x7488('0x2f')],qs[_0x7488('0x34')](_0x4788b0['query'][_0x7488('0x34')]));_0xc92261['attributes']=_0xc92261[_0x7488('0x35')][_0x7488('0x36')]?_0xc92261[_0x7488('0x35')]:_0x342ed7[_0x7488('0x2f')];if(!_0x4788b0[_0x7488('0x30')][_0x7488('0x37')]('nolimit')){_0xc92261['limit']=qs[_0x7488('0x21')](_0x4788b0['query'][_0x7488('0x21')]);_0xc92261[_0x7488('0x1e')]=qs[_0x7488('0x1e')](_0x4788b0[_0x7488('0x30')][_0x7488('0x1e')]);}_0xc92261['order']=qs['sort'](_0x4788b0[_0x7488('0x30')][_0x7488('0x38')]);_0xc92261[_0x7488('0x39')]=qs[_0x7488('0x32')](_['pick'](_0x4788b0[_0x7488('0x30')],_0x342ed7[_0x7488('0x32')]),_0x2fd9ec);if(_0x4788b0[_0x7488('0x30')][_0x7488('0x3a')]){_0xc92261[_0x7488('0x39')]=_[_0x7488('0x3b')](_0xc92261[_0x7488('0x39')],{'$or':_[_0x7488('0x2c')](_0x2fd9ec,function(_0x16f739){if(_0x16f739[_0x7488('0x3c')]!==_0x7488('0x3d')){var _0x1ad4f1={};_0x1ad4f1[_0x16f739[_0x7488('0x2a')]]={'$like':'%'+_0x4788b0['query'][_0x7488('0x3a')]+'%'};return _0x1ad4f1;}})});}_0xc92261=_[_0x7488('0x3b')]({},_0xc92261,_0x4788b0[_0x7488('0x3e')]);var _0x285291={'where':_0xc92261['where']};return db[_0x7488('0x2d')]['count'](_0x285291)[_0x7488('0x26')](function(_0x494874){_0x7c515b[_0x7488('0x20')]=_0x494874;if(_0x4788b0[_0x7488('0x30')][_0x7488('0x3f')]){_0xc92261[_0x7488('0x40')]=[{'all':!![]}];}return db[_0x7488('0x2d')][_0x7488('0x41')](_0xc92261);})[_0x7488('0x26')](function(_0x60145e){_0x7c515b[_0x7488('0x42')]=_0x60145e;return _0x7c515b;})[_0x7488('0x26')](respondWithFilteredResult(_0x18bc33,_0xc92261))[_0x7488('0x43')](handleError(_0x18bc33,null));};exports[_0x7488('0x44')]=function(_0x1fb4fb,_0xa7e606){var _0x185547={'raw':![],'where':{'id':_0x1fb4fb[_0x7488('0x45')]['id']}},_0x331836={};_0x331836['model']=_[_0x7488('0x31')](db[_0x7488('0x2d')][_0x7488('0x46')]);_0x331836[_0x7488('0x30')]=_[_0x7488('0x31')](_0x1fb4fb['query']);_0x331836['filters']=_[_0x7488('0x33')](_0x331836[_0x7488('0x2f')],_0x331836[_0x7488('0x30')]);_0x185547['attributes']=_['intersection'](_0x331836['model'],qs['fields'](_0x1fb4fb['query'][_0x7488('0x34')]));_0x185547[_0x7488('0x35')]=_0x185547[_0x7488('0x35')][_0x7488('0x36')]?_0x185547['attributes']:_0x331836['model'];if(_0x1fb4fb[_0x7488('0x30')]['includeAll']){_0x185547['include']=[{'all':!![]}];}_0x185547=_[_0x7488('0x3b')]({},_0x185547,_0x1fb4fb[_0x7488('0x3e')]);return db['SalesforceAccount']['find'](_0x185547)[_0x7488('0x26')](handleEntityNotFound(_0xa7e606,null))[_0x7488('0x26')](respondWithResult(_0xa7e606,null))[_0x7488('0x43')](handleError(_0xa7e606,null));};exports[_0x7488('0x47')]=function(_0x5b7a97,_0x46553a){return db[_0x7488('0x2d')][_0x7488('0x47')](_0x5b7a97[_0x7488('0x48')],{})[_0x7488('0x26')](respondWithResult(_0x46553a,0xc9))[_0x7488('0x43')](handleError(_0x46553a,null));};exports[_0x7488('0x49')]=function(_0x45f9bb,_0x3f0e8e){if(_0x45f9bb[_0x7488('0x48')]['id']){delete _0x45f9bb[_0x7488('0x48')]['id'];}return db[_0x7488('0x2d')][_0x7488('0x4a')]({'where':{'id':_0x45f9bb[_0x7488('0x45')]['id']}})['then'](handleEntityNotFound(_0x3f0e8e,null))[_0x7488('0x26')](saveUpdates(_0x45f9bb[_0x7488('0x48')],null))[_0x7488('0x26')](respondWithResult(_0x3f0e8e,null))[_0x7488('0x43')](handleError(_0x3f0e8e,null));};exports[_0x7488('0x27')]=function(_0x4fe178,_0xabaceb){return db[_0x7488('0x2d')][_0x7488('0x4a')]({'where':{'id':_0x4fe178['params']['id']}})[_0x7488('0x26')](handleEntityNotFound(_0xabaceb,null))[_0x7488('0x26')](removeEntity(_0xabaceb,null))[_0x7488('0x43')](handleError(_0xabaceb,null));};exports[_0x7488('0x4b')]=function(_0x3d7eda,_0x2fc980,_0xd731bf){var _0xefcecd={};var _0x482dd3={};var _0x2932f3;var _0x4500e1;return db[_0x7488('0x2d')][_0x7488('0x4c')]({'where':{'id':_0x3d7eda[_0x7488('0x45')]['id']}})[_0x7488('0x26')](handleEntityNotFound(_0x2fc980,null))[_0x7488('0x26')](function(_0x1d2e98){if(_0x1d2e98){_0x2932f3=_0x1d2e98;_0x482dd3[_0x7488('0x2f')]=_[_0x7488('0x31')](db[_0x7488('0x4d')][_0x7488('0x46')]);_0x482dd3[_0x7488('0x30')]=_['keys'](_0x3d7eda['query']);_0x482dd3[_0x7488('0x32')]=_['intersection'](_0x482dd3[_0x7488('0x2f')],_0x482dd3[_0x7488('0x30')]);_0xefcecd[_0x7488('0x35')]=_[_0x7488('0x33')](_0x482dd3['model'],qs[_0x7488('0x34')](_0x3d7eda['query']['fields']));_0xefcecd[_0x7488('0x35')]=_0xefcecd[_0x7488('0x35')][_0x7488('0x36')]?_0xefcecd[_0x7488('0x35')]:_0x482dd3[_0x7488('0x2f')];_0xefcecd[_0x7488('0x4e')]=qs[_0x7488('0x38')](_0x3d7eda[_0x7488('0x30')][_0x7488('0x38')]);_0xefcecd[_0x7488('0x39')]=qs[_0x7488('0x32')](_[_0x7488('0x4f')](_0x3d7eda[_0x7488('0x30')],_0x482dd3[_0x7488('0x32')]));if(_0x3d7eda[_0x7488('0x30')][_0x7488('0x3a')]){_0xefcecd['where']=_[_0x7488('0x3b')](_0xefcecd[_0x7488('0x39')],{'$or':_[_0x7488('0x2c')](_0xefcecd[_0x7488('0x35')],function(_0xb14e0c){var _0x514b0a={};_0x514b0a[_0xb14e0c]={'$like':'%'+_0x3d7eda['query']['filter']+'%'};return _0x514b0a;})});}_0xefcecd=_['merge']({},_0xefcecd,_0x3d7eda[_0x7488('0x3e')]);return _0x2932f3[_0x7488('0x4b')](_0xefcecd);}})['then'](function(_0x10a5ec){if(_0x10a5ec){_0x4500e1=_0x10a5ec[_0x7488('0x36')];if(!_0x3d7eda[_0x7488('0x30')][_0x7488('0x37')]('nolimit')){_0xefcecd[_0x7488('0x21')]=qs[_0x7488('0x21')](_0x3d7eda[_0x7488('0x30')]['limit']);_0xefcecd[_0x7488('0x1e')]=qs['offset'](_0x3d7eda[_0x7488('0x30')][_0x7488('0x1e')]);}return _0x2932f3[_0x7488('0x4b')](_0xefcecd);}})['then'](function(_0x4ad2cf){if(_0x4ad2cf){return _0x4ad2cf?{'count':_0x4500e1,'rows':_0x4ad2cf}:null;}})[_0x7488('0x26')](respondWithResult(_0x2fc980,null))['catch'](handleError(_0x2fc980,null));};exports[_0x7488('0x50')]=function(_0x8dec23,_0x264d1e,_0x5e0955){if(_0x8dec23['body']['id']){delete _0x8dec23[_0x7488('0x48')]['id'];}return db[_0x7488('0x2d')][_0x7488('0x4c')]({'where':{'id':_0x8dec23['params']['id']}})['then'](handleEntityNotFound(_0x264d1e,null))['then'](function(_0x557ee6){if(_0x557ee6){_0x8dec23[_0x7488('0x48')]['AccountId']=_0x557ee6['id'];_0x8dec23[_0x7488('0x48')][_0x7488('0x51')]=integrations[_0x7488('0x52')](_0x8dec23[_0x7488('0x48')][_0x7488('0x53')],_0x8dec23['body'][_0x7488('0x3c')]);_0x8dec23[_0x7488('0x48')][_0x7488('0x54')]=integrations[_0x7488('0x55')](_0x8dec23[_0x7488('0x48')][_0x7488('0x53')],_0x8dec23[_0x7488('0x48')][_0x7488('0x3c')]);return db[_0x7488('0x4d')][_0x7488('0x47')](_0x8dec23[_0x7488('0x48')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0x7488('0x56')],'as':_0x7488('0x54')}]});}return null;})['then'](respondWithResult(_0x264d1e,null))['catch'](handleError(_0x264d1e,null));};exports[_0x7488('0x57')]=function(_0x3ae2fc,_0x359661,_0x26c0af){var _0x37cf7e;var _0x5d9736='';var _0x458b71=_0x7488('0x58');return db[_0x7488('0x2d')][_0x7488('0x4c')]({'where':{'id':_0x3ae2fc[_0x7488('0x45')]['id']},'attributes':['id',_0x7488('0x59'),_0x7488('0x5a'),_0x7488('0x5b'),_0x7488('0x5c'),_0x7488('0x5d'),_0x7488('0x5e')]})[_0x7488('0x26')](handleEntityNotFound(_0x359661,null))[_0x7488('0x26')](function(_0x198f5){if(_0x198f5){_0x5d9736=_0x198f5[_0x7488('0x59')];var _0x66cfa6=_0x5d9736[_0x7488('0x5f')](-0x1);if(_0x66cfa6==='/'){_0x5d9736=_0x5d9736[_0x7488('0x60')](0x0,_0x5d9736['lastIndexOf'](_0x66cfa6));}_0x37cf7e=new jsforce[(_0x7488('0x61'))]({'oauth2':{'loginUrl':_0x5d9736,'clientId':_0x198f5[_0x7488('0x5a')],'clientSecret':_0x198f5[_0x7488('0x5b')]}});return _0x37cf7e[_0x7488('0x62')](_0x198f5[_0x7488('0x5c')],_0x198f5[_0x7488('0x5d')][_0x7488('0x63')](_0x198f5[_0x7488('0x5e')]));}})[_0x7488('0x26')](function(_0x2f70d7){if(_0x2f70d7){if(!_['isNil'](_0x3ae2fc[_0x7488('0x30')][_0x7488('0x64')])){_0x458b71=_0x3ae2fc[_0x7488('0x30')]['ticketType'];}return _0x37cf7e[_0x7488('0x65')](_0x458b71)[_0x7488('0x66')]();}})['then'](function(_0xe799af){var _0x57d767=[_0x7488('0x67'),_0x7488('0x68'),_0x7488('0x69'),'IsRecurrence',_0x7488('0x6a'),'Description'];var _0x421685=[_0x7488('0x6b'),_0x7488('0x6c'),'picklist',_0x7488('0x6d'),'email','textarea','phone'];if(_0xe799af){_['remove'](_0xe799af[_0x7488('0x34')],function(_0x371dd3){return _0x57d767['includes'](_0x371dd3[_0x7488('0x2a')])||!_0x421685[_0x7488('0x6e')](_0x371dd3[_0x7488('0x3c')]);});return{'count':_0xe799af['fields'][_0x7488('0x36')],'rows':_[_0x7488('0x2c')](_0xe799af['fields'],function(_0x2019f3){return{'id':_0x2019f3[_0x7488('0x2a')],'name':_0x2019f3[_0x7488('0x6f')],'custom':_0x2019f3['custom'],'options':_0x2019f3[_0x7488('0x70')][_0x7488('0x36')]>0x0?_['map'](_0x2019f3[_0x7488('0x70')],function(_0x4bb812){return{'name':_0x4bb812[_0x7488('0x6f')],'value':_0x4bb812[_0x7488('0x71')]};}):_0x2019f3[_0x7488('0x3c')]=='boolean'?[{'name':_0x7488('0x72'),'value':_0x7488('0x73')},{'name':'False','value':'false'}]:[]};})};}})[_0x7488('0x26')](respondWithResult(_0x359661,null))[_0x7488('0x43')](function(_0x40ae17){var _0x9a287e=_0x3ae2fc['query'][_0x7488('0x74')]?0x1f4:_0x40ae17[_0x7488('0x75')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x7488('0x57'),_0x9a287e,JSON[_0x7488('0x76')](_0x40ae17));delete _0x40ae17[_0x7488('0x2a')];if(_0x9a287e===0x191){_0x9a287e=0x190;}_0x359661[_0x7488('0x1c')](_0x9a287e)[_0x7488('0x2b')](_0x3ae2fc[_0x7488('0x30')][_0x7488('0x74')]?{'message':_0x7488('0x77'),'statusCode':_0x40ae17[_0x7488('0x75')]}:_0x40ae17);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 7acc0dc..b7e23ab 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 _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 +var _0x6d1c=['path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x52c8e8,_0x5ee20d){var _0x31bb1a=function(_0x47233a){while(--_0x47233a){_0x52c8e8['push'](_0x52c8e8['shift']());}};_0x31bb1a(++_0x5ee20d);}(_0x6d1c,0x69));var _0xc6d1=function(_0x561f25,_0x2d95c1){_0x561f25=_0x561f25-0x0;var _0x150e4c=_0x6d1c[_0x561f25];return _0x150e4c;};'use strict';var _=require(_0xc6d1('0x0'));var util=require(_0xc6d1('0x1'));var logger=require(_0xc6d1('0x2'))(_0xc6d1('0x3'));var moment=require(_0xc6d1('0x4'));var BPromise=require(_0xc6d1('0x5'));var rp=require(_0xc6d1('0x6'));var fs=require('fs');var path=require(_0xc6d1('0x7'));var rimraf=require('rimraf');var config=require(_0xc6d1('0x8'));var attributes=require(_0xc6d1('0x9'));var integrations=require(_0xc6d1('0xa'));module['exports']=function(_0x1fe5e7,_0x3e23ec){return _0x1fe5e7[_0xc6d1('0xb')](_0xc6d1('0xc'),attributes,{'tableName':_0xc6d1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 9ff0ca7..bcc10e2 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 _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 +var _0x2a69=['rpc','../../config/environment','client','then','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SalesforceAccount,\x20%s,\x20%s','info','result','catch','SalesforceAccount','options','raw','where','attributes','include','map','model','GetSalesforceAccount','ShowSalesforceAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x9d498b,_0x53b51e){var _0x1491c4=function(_0x5043f7){while(--_0x5043f7){_0x9d498b['push'](_0x9d498b['shift']());}};_0x1491c4(++_0x53b51e);}(_0x2a69,0x159));var _0x92a6=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x2a69[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x92a6('0x0'));var util=require(_0x92a6('0x1'));var moment=require('moment');var BPromise=require(_0x92a6('0x2'));var rs=require(_0x92a6('0x3'));var fs=require('fs');var Redis=require(_0x92a6('0x4'));var db=require(_0x92a6('0x5'))['db'];var utils=require(_0x92a6('0x6'));var logger=require('../../config/logger')(_0x92a6('0x7'));var config=require(_0x92a6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x92a6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fab53,_0x136f8b,_0x4c9b53){return new BPromise(function(_0x34333c,_0x4d095f){return client['request'](_0x2fab53,_0x4c9b53)[_0x92a6('0xa')](function(_0x463dda){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x136f8b,'request\x20sent');logger[_0x92a6('0xb')](_0x92a6('0xc'),_0x136f8b,'request\x20sent',JSON[_0x92a6('0xd')](_0x463dda));if(_0x463dda[_0x92a6('0xe')]){if(_0x463dda['error'][_0x92a6('0xf')]===0x1f4){logger[_0x92a6('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x136f8b,_0x463dda[_0x92a6('0xe')][_0x92a6('0x10')]);return _0x4d095f(_0x463dda[_0x92a6('0xe')][_0x92a6('0x10')]);}logger['error'](_0x92a6('0x11'),_0x136f8b,_0x463dda[_0x92a6('0xe')]['message']);return _0x34333c(_0x463dda[_0x92a6('0xe')][_0x92a6('0x10')]);}else{logger[_0x92a6('0x12')](_0x92a6('0x11'),_0x136f8b,'request\x20sent');_0x34333c(_0x463dda[_0x92a6('0x13')][_0x92a6('0x10')]);}})[_0x92a6('0x14')](function(_0x3f55f8){logger['error'](_0x92a6('0x11'),_0x136f8b,_0x3f55f8);_0x4d095f(_0x3f55f8);});});}exports['GetSalesforceAccount']=function(_0x22379a){var _0x59bbf9=this;return new Promise(function(_0x523f06,_0x45bcb3){return db[_0x92a6('0x15')]['findAll']({'raw':_0x22379a[_0x92a6('0x16')]?_0x22379a[_0x92a6('0x16')][_0x92a6('0x17')]===undefined?!![]:![]:!![],'where':_0x22379a[_0x92a6('0x16')]?_0x22379a[_0x92a6('0x16')][_0x92a6('0x18')]||null:null,'attributes':_0x22379a['options']?_0x22379a[_0x92a6('0x16')][_0x92a6('0x19')]||null:null,'limit':_0x22379a[_0x92a6('0x16')]?_0x22379a[_0x92a6('0x16')]['limit']||null:null,'include':_0x22379a[_0x92a6('0x16')]?_0x22379a['options'][_0x92a6('0x1a')]?_[_0x92a6('0x1b')](_0x22379a[_0x92a6('0x16')][_0x92a6('0x1a')],function(_0x5cca2e){return{'model':db[_0x5cca2e[_0x92a6('0x1c')]],'as':_0x5cca2e['as'],'attributes':_0x5cca2e[_0x92a6('0x19')],'include':_0x5cca2e[_0x92a6('0x1a')]?_[_0x92a6('0x1b')](_0x5cca2e['include'],function(_0x4370b9){return{'model':db[_0x4370b9[_0x92a6('0x1c')]],'as':_0x4370b9['as'],'attributes':_0x4370b9[_0x92a6('0x19')],'include':_0x4370b9[_0x92a6('0x1a')]?_[_0x92a6('0x1b')](_0x4370b9['include'],function(_0x3a380e){return{'model':db[_0x3a380e[_0x92a6('0x1c')]],'as':_0x3a380e['as'],'attributes':_0x3a380e[_0x92a6('0x19')]};}):[]};}):[]};}):[]:[]})[_0x92a6('0xa')](function(_0x33c800){logger[_0x92a6('0x12')](_0x92a6('0x1d'),_0x22379a);logger[_0x92a6('0xb')](_0x92a6('0x1d'),_0x22379a,JSON[_0x92a6('0xd')](_0x33c800));_0x523f06(_0x33c800);})[_0x92a6('0x14')](function(_0x488a12){logger[_0x92a6('0xe')](_0x92a6('0x1d'),_0x488a12[_0x92a6('0x10')],_0x22379a);_0x45bcb3(_0x59bbf9[_0x92a6('0xe')](0x1f4,_0x488a12['message']));});});};exports[_0x92a6('0x1e')]=function(_0x402f85){var _0x576a03=this;return new Promise(function(_0x3aabaf,_0x2b7aa5){return db[_0x92a6('0x15')][_0x92a6('0x1f')]({'raw':_0x402f85[_0x92a6('0x16')]?_0x402f85[_0x92a6('0x16')][_0x92a6('0x17')]===undefined?!![]:![]:!![],'where':_0x402f85['options']?_0x402f85[_0x92a6('0x16')][_0x92a6('0x18')]||null:null,'attributes':_0x402f85['options']?_0x402f85[_0x92a6('0x16')][_0x92a6('0x19')]||null:null,'include':_0x402f85[_0x92a6('0x16')]?_0x402f85[_0x92a6('0x16')][_0x92a6('0x1a')]?_[_0x92a6('0x1b')](_0x402f85[_0x92a6('0x16')]['include'],function(_0x54e2f3){return{'model':db[_0x54e2f3[_0x92a6('0x1c')]],'as':_0x54e2f3['as'],'attributes':_0x54e2f3[_0x92a6('0x19')],'include':_0x54e2f3[_0x92a6('0x1a')]?_[_0x92a6('0x1b')](_0x54e2f3[_0x92a6('0x1a')],function(_0x3be85d){return{'model':db[_0x3be85d[_0x92a6('0x1c')]],'as':_0x3be85d['as'],'attributes':_0x3be85d[_0x92a6('0x19')],'include':_0x3be85d[_0x92a6('0x1a')]?_['map'](_0x3be85d[_0x92a6('0x1a')],function(_0x4c8417){return{'model':db[_0x4c8417[_0x92a6('0x1c')]],'as':_0x4c8417['as'],'attributes':_0x4c8417['attributes']};}):[]};}):[]};}):[]:[]})[_0x92a6('0xa')](function(_0x1c0bcb){logger['info'](_0x92a6('0x1e'),_0x402f85);logger[_0x92a6('0xb')](_0x92a6('0x1e'),_0x402f85,JSON[_0x92a6('0xd')](_0x1c0bcb));_0x3aabaf(_0x1c0bcb);})[_0x92a6('0x14')](function(_0x110313){logger['error']('ShowSalesforceAccount',_0x110313[_0x92a6('0x10')],_0x402f85);_0x2b7aa5(_0x576a03[_0x92a6('0xe')](0x1f4,_0x110313[_0x92a6('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index ea92908..c985bce 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_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 +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(_0xffa198,_0x5a8940){var _0x1e4b50=function(_0x1f1c43){while(--_0x1f1c43){_0xffa198['push'](_0xffa198['shift']());}};_0x1e4b50(++_0x5a8940);}(_0x0b0e,0x187));var _0xe0b0=function(_0x200827,_0x4af951){_0x200827=_0x200827-0x0;var _0x120047=_0x0b0e[_0x200827];return _0x120047;};'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 f68568a..3fcedd7 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 _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 +var _0x3306=['exports','STRING','Task','Case','ENUM','contact_lead','lead','account_contact_lead','account','nothing','contact','sequelize'];(function(_0x214742,_0x51809d){var _0x54a1a4=function(_0x4cf9df){while(--_0x4cf9df){_0x214742['push'](_0x214742['shift']());}};_0x54a1a4(++_0x51809d);}(_0x3306,0x107));var _0x6330=function(_0x204ff4,_0xc30c0b){_0x204ff4=_0x204ff4-0x0;var _0x43b104=_0x3306[_0x204ff4];return _0x43b104;};'use strict';var Sequelize=require(_0x6330('0x0'));module[_0x6330('0x1')]={'name':{'type':Sequelize[_0x6330('0x2')]},'description':{'type':Sequelize[_0x6330('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x6330('0x3'),_0x6330('0x4')),'defaultValue':_0x6330('0x3')},'moduleSearch':{'type':Sequelize[_0x6330('0x5')](_0x6330('0x6'),'contact',_0x6330('0x7'),_0x6330('0x8'),_0x6330('0x9')),'defaultValue':_0x6330('0x6')},'moduleCreate':{'type':Sequelize[_0x6330('0x5')](_0x6330('0xa'),_0x6330('0xb'),_0x6330('0x7'),_0x6330('0x9')),'defaultValue':_0x6330('0x7')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x6330('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x6330('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index b8e61c9..5ce7720 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 _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 +var _0x6395=['intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','catch','params','model','keys','create','body','find','getFields','findOne','SalesforceField','getSubjects','nolimit','getDescriptions','options','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','query','filters'];(function(_0x1c6d74,_0x120249){var _0x4a8549=function(_0x419569){while(--_0x419569){_0x1c6d74['push'](_0x1c6d74['shift']());}};_0x4a8549(++_0x120249);}(_0x6395,0xc8));var _0x5639=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6395[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x5639('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5639('0x1'));var jsonpatch=require(_0x5639('0x2'));var rp=require(_0x5639('0x3'));var moment=require(_0x5639('0x4'));var BPromise=require(_0x5639('0x5'));var Mustache=require(_0x5639('0x6'));var util=require(_0x5639('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x5639('0x8'));var ejs=require(_0x5639('0x9'));var fs=require('fs');var fs_extra=require(_0x5639('0xa'));var _=require(_0x5639('0xb'));var squel=require(_0x5639('0xc'));var crypto=require(_0x5639('0xd'));var jsforce=require(_0x5639('0xe'));var deskjs=require(_0x5639('0xf'));var toCsv=require(_0x5639('0x8'));var querystring=require(_0x5639('0x10'));var Papa=require(_0x5639('0x11'));var Redis=require(_0x5639('0x12'));var authService=require(_0x5639('0x13'));var qs=require(_0x5639('0x14'));var as=require(_0x5639('0x15'));var hardwareService=require(_0x5639('0x16'));var logger=require(_0x5639('0x17'))(_0x5639('0x18'));var utils=require(_0x5639('0x19'));var config=require(_0x5639('0x1a'));var licenseUtil=require(_0x5639('0x1b'));var db=require(_0x5639('0x1c'))['db'];function respondWithStatusCode(_0x683fab,_0x564f54){_0x564f54=_0x564f54||0xcc;return function(_0x45abcb){if(_0x45abcb){return _0x683fab['sendStatus'](_0x564f54);}return _0x683fab[_0x5639('0x1d')](_0x564f54)[_0x5639('0x1e')]();};}function respondWithResult(_0x5f3a8e,_0x37eb30){_0x37eb30=_0x37eb30||0xc8;return function(_0x13ee03){if(_0x13ee03){return _0x5f3a8e[_0x5639('0x1d')](_0x37eb30)[_0x5639('0x1f')](_0x13ee03);}};}function respondWithFilteredResult(_0x46207c,_0x41c1d6){return function(_0x16ffee){if(_0x16ffee){var _0x31be22=typeof _0x41c1d6[_0x5639('0x20')]===_0x5639('0x21')&&typeof _0x41c1d6[_0x5639('0x22')]==='undefined';var _0x1d6eae=_0x16ffee[_0x5639('0x23')];var _0x4efbbb=_0x31be22?0x0:_0x41c1d6[_0x5639('0x20')];var _0x35ef4e=_0x31be22?_0x16ffee[_0x5639('0x23')]:_0x41c1d6[_0x5639('0x20')]+_0x41c1d6['limit'];var _0x3d7e4d;if(_0x35ef4e>=_0x1d6eae){_0x35ef4e=_0x1d6eae;_0x3d7e4d=0xc8;}else{_0x3d7e4d=0xce;}_0x46207c[_0x5639('0x1d')](_0x3d7e4d);return _0x46207c['set'](_0x5639('0x24'),_0x4efbbb+'-'+_0x35ef4e+'/'+_0x1d6eae)[_0x5639('0x1f')](_0x16ffee);}return null;};}function patchUpdates(_0x1aae1a){return function(_0x540e4e){try{jsonpatch['apply'](_0x540e4e,_0x1aae1a,!![]);}catch(_0x4c8ea3){return BPromise[_0x5639('0x25')](_0x4c8ea3);}return _0x540e4e[_0x5639('0x26')]();};}function saveUpdates(_0x1de018,_0x39d553){return function(_0x195e4b){if(_0x195e4b){return _0x195e4b[_0x5639('0x27')](_0x1de018)[_0x5639('0x28')](function(_0x35000d){return _0x35000d;});}return null;};}function removeEntity(_0x2fc680,_0x1f66b4){return function(_0x40c6ec){if(_0x40c6ec){return _0x40c6ec[_0x5639('0x29')]()['then'](function(){_0x2fc680[_0x5639('0x1d')](0xcc)[_0x5639('0x1e')]();});}};}function handleEntityNotFound(_0x5a69c4,_0x4d7b1d){return function(_0x46f19b){if(!_0x46f19b){_0x5a69c4[_0x5639('0x2a')](0x194);}return _0x46f19b;};}function handleError(_0x1551c4,_0x38c4e9){_0x38c4e9=_0x38c4e9||0x1f4;return function(_0x4bf48c){logger[_0x5639('0x2b')](_0x4bf48c[_0x5639('0x2c')]);if(_0x4bf48c[_0x5639('0x2d')]){delete _0x4bf48c['name'];}_0x1551c4[_0x5639('0x1d')](_0x38c4e9)[_0x5639('0x2e')](_0x4bf48c);};}exports[_0x5639('0x2f')]=function(_0x43013c,_0x427352){var _0x136527={},_0x2654a8={},_0x5f0bdd={'count':0x0,'rows':[]};var _0x53d63f=_[_0x5639('0x30')](db[_0x5639('0x31')][_0x5639('0x32')],function(_0x3c57ac){return{'name':_0x3c57ac[_0x5639('0x33')],'type':_0x3c57ac['type'][_0x5639('0x34')]};});_0x2654a8['model']=_[_0x5639('0x30')](_0x53d63f,_0x5639('0x2d'));_0x2654a8['query']=_['keys'](_0x43013c[_0x5639('0x35')]);_0x2654a8[_0x5639('0x36')]=_['intersection'](_0x2654a8['model'],_0x2654a8['query']);_0x136527['attributes']=_[_0x5639('0x37')](_0x2654a8['model'],qs[_0x5639('0x38')](_0x43013c[_0x5639('0x35')][_0x5639('0x38')]));_0x136527[_0x5639('0x39')]=_0x136527[_0x5639('0x39')][_0x5639('0x3a')]?_0x136527[_0x5639('0x39')]:_0x2654a8['model'];if(!_0x43013c[_0x5639('0x35')][_0x5639('0x3b')]('nolimit')){_0x136527[_0x5639('0x22')]=qs[_0x5639('0x22')](_0x43013c[_0x5639('0x35')][_0x5639('0x22')]);_0x136527['offset']=qs[_0x5639('0x20')](_0x43013c[_0x5639('0x35')]['offset']);}_0x136527[_0x5639('0x3c')]=qs[_0x5639('0x3d')](_0x43013c[_0x5639('0x35')]['sort']);_0x136527[_0x5639('0x3e')]=qs['filters'](_[_0x5639('0x3f')](_0x43013c[_0x5639('0x35')],_0x2654a8[_0x5639('0x36')]),_0x53d63f);if(_0x43013c[_0x5639('0x35')][_0x5639('0x40')]){_0x136527['where']=_[_0x5639('0x41')](_0x136527[_0x5639('0x3e')],{'$or':_[_0x5639('0x30')](_0x53d63f,function(_0x5542e7){if(_0x5542e7[_0x5639('0x42')]!=='VIRTUAL'){var _0x478717={};_0x478717[_0x5542e7[_0x5639('0x2d')]]={'$like':'%'+_0x43013c[_0x5639('0x35')][_0x5639('0x40')]+'%'};return _0x478717;}})});}_0x136527=_[_0x5639('0x41')]({},_0x136527,_0x43013c['options']);var _0x455650={'where':_0x136527[_0x5639('0x3e')]};return db['SalesforceConfiguration'][_0x5639('0x23')](_0x455650)['then'](function(_0x2d6213){_0x5f0bdd[_0x5639('0x23')]=_0x2d6213;if(_0x43013c[_0x5639('0x35')][_0x5639('0x43')]){_0x136527[_0x5639('0x44')]=[{'all':!![]}];}return db[_0x5639('0x31')][_0x5639('0x45')](_0x136527);})['then'](function(_0x338a54){_0x5f0bdd[_0x5639('0x46')]=_0x338a54;return _0x5f0bdd;})[_0x5639('0x28')](respondWithFilteredResult(_0x427352,_0x136527))[_0x5639('0x47')](handleError(_0x427352,null));};exports['show']=function(_0x22b4ac,_0x30b003){var _0x455180={'raw':![],'where':{'id':_0x22b4ac[_0x5639('0x48')]['id']}},_0x4c2c1d={};_0x4c2c1d[_0x5639('0x49')]=_[_0x5639('0x4a')](db[_0x5639('0x31')][_0x5639('0x32')]);_0x4c2c1d[_0x5639('0x35')]=_['keys'](_0x22b4ac[_0x5639('0x35')]);_0x4c2c1d[_0x5639('0x36')]=_[_0x5639('0x37')](_0x4c2c1d[_0x5639('0x49')],_0x4c2c1d[_0x5639('0x35')]);_0x455180[_0x5639('0x39')]=_['intersection'](_0x4c2c1d['model'],qs[_0x5639('0x38')](_0x22b4ac['query'][_0x5639('0x38')]));_0x455180['attributes']=_0x455180[_0x5639('0x39')]['length']?_0x455180[_0x5639('0x39')]:_0x4c2c1d[_0x5639('0x49')];if(_0x22b4ac[_0x5639('0x35')][_0x5639('0x43')]){_0x455180[_0x5639('0x44')]=[{'all':!![]}];}_0x455180=_['merge']({},_0x455180,_0x22b4ac['options']);return db['SalesforceConfiguration']['find'](_0x455180)[_0x5639('0x28')](handleEntityNotFound(_0x30b003,null))[_0x5639('0x28')](respondWithResult(_0x30b003,null))[_0x5639('0x47')](handleError(_0x30b003,null));};exports[_0x5639('0x4b')]=function(_0x5d6cb8,_0x2140f5){return db[_0x5639('0x31')][_0x5639('0x4b')](_0x5d6cb8[_0x5639('0x4c')],{})[_0x5639('0x28')](respondWithResult(_0x2140f5,0xc9))[_0x5639('0x47')](handleError(_0x2140f5,null));};exports[_0x5639('0x27')]=function(_0x13760c,_0xc310da){if(_0x13760c[_0x5639('0x4c')]['id']){delete _0x13760c[_0x5639('0x4c')]['id'];}return db[_0x5639('0x31')][_0x5639('0x4d')]({'where':{'id':_0x13760c[_0x5639('0x48')]['id']}})[_0x5639('0x28')](handleEntityNotFound(_0xc310da,null))[_0x5639('0x28')](saveUpdates(_0x13760c[_0x5639('0x4c')],null))['then'](respondWithResult(_0xc310da,null))[_0x5639('0x47')](handleError(_0xc310da,null));};exports[_0x5639('0x29')]=function(_0x39d156,_0xd29fdf){return db[_0x5639('0x31')][_0x5639('0x4d')]({'where':{'id':_0x39d156['params']['id']}})['then'](handleEntityNotFound(_0xd29fdf,null))['then'](removeEntity(_0xd29fdf,null))[_0x5639('0x47')](handleError(_0xd29fdf,null));};exports[_0x5639('0x4e')]=function(_0x544e12,_0x2e6a12,_0x199283){var _0x4016f6={};var _0x4c01fd={};var _0x31a579;var _0x1a1297;return db[_0x5639('0x31')][_0x5639('0x4f')]({'where':{'id':_0x544e12['params']['id']}})[_0x5639('0x28')](handleEntityNotFound(_0x2e6a12,null))[_0x5639('0x28')](function(_0x1b7720){if(_0x1b7720){_0x31a579=_0x1b7720;_0x4c01fd[_0x5639('0x49')]=_[_0x5639('0x4a')](db['SalesforceField'][_0x5639('0x32')]);_0x4c01fd['query']=_[_0x5639('0x4a')](_0x544e12[_0x5639('0x35')]);_0x4c01fd[_0x5639('0x36')]=_['intersection'](_0x4c01fd['model'],_0x4c01fd['query']);_0x4016f6[_0x5639('0x39')]=_[_0x5639('0x37')](_0x4c01fd[_0x5639('0x49')],qs[_0x5639('0x38')](_0x544e12[_0x5639('0x35')][_0x5639('0x38')]));_0x4016f6[_0x5639('0x39')]=_0x4016f6[_0x5639('0x39')][_0x5639('0x3a')]?_0x4016f6[_0x5639('0x39')]:_0x4c01fd[_0x5639('0x49')];_0x4016f6['order']=qs['sort'](_0x544e12['query'][_0x5639('0x3d')]);_0x4016f6[_0x5639('0x3e')]=qs[_0x5639('0x36')](_[_0x5639('0x3f')](_0x544e12[_0x5639('0x35')],_0x4c01fd[_0x5639('0x36')]));if(_0x544e12['query'][_0x5639('0x40')]){_0x4016f6['where']=_[_0x5639('0x41')](_0x4016f6[_0x5639('0x3e')],{'$or':_[_0x5639('0x30')](_0x4016f6['attributes'],function(_0xba91ae){var _0x3d2ed4={};_0x3d2ed4[_0xba91ae]={'$like':'%'+_0x544e12[_0x5639('0x35')][_0x5639('0x40')]+'%'};return _0x3d2ed4;})});}_0x4016f6=_[_0x5639('0x41')]({},_0x4016f6,_0x544e12['options']);return _0x31a579[_0x5639('0x4e')](_0x4016f6);}})['then'](function(_0x371dfc){if(_0x371dfc){_0x1a1297=_0x371dfc[_0x5639('0x3a')];if(!_0x544e12['query'][_0x5639('0x3b')]('nolimit')){_0x4016f6[_0x5639('0x22')]=qs['limit'](_0x544e12[_0x5639('0x35')][_0x5639('0x22')]);_0x4016f6[_0x5639('0x20')]=qs['offset'](_0x544e12[_0x5639('0x35')]['offset']);}return _0x31a579[_0x5639('0x4e')](_0x4016f6);}})['then'](function(_0x473192){if(_0x473192){return _0x473192?{'count':_0x1a1297,'rows':_0x473192}:null;}})[_0x5639('0x28')](respondWithResult(_0x2e6a12,null))[_0x5639('0x47')](handleError(_0x2e6a12,null));};exports['getSubjects']=function(_0x13bd17,_0x3e5d79,_0x2dbb92){var _0x281751={};var _0x2ded87={};var _0x4ccf85;var _0x5c4c74;return db[_0x5639('0x31')]['findOne']({'where':{'id':_0x13bd17[_0x5639('0x48')]['id']}})[_0x5639('0x28')](handleEntityNotFound(_0x3e5d79,null))[_0x5639('0x28')](function(_0x25ed55){if(_0x25ed55){_0x4ccf85=_0x25ed55;_0x2ded87['model']=_[_0x5639('0x4a')](db[_0x5639('0x50')][_0x5639('0x32')]);_0x2ded87[_0x5639('0x35')]=_['keys'](_0x13bd17['query']);_0x2ded87[_0x5639('0x36')]=_[_0x5639('0x37')](_0x2ded87[_0x5639('0x49')],_0x2ded87['query']);_0x281751[_0x5639('0x39')]=_['intersection'](_0x2ded87[_0x5639('0x49')],qs[_0x5639('0x38')](_0x13bd17[_0x5639('0x35')][_0x5639('0x38')]));_0x281751[_0x5639('0x39')]=_0x281751[_0x5639('0x39')][_0x5639('0x3a')]?_0x281751['attributes']:_0x2ded87['model'];_0x281751[_0x5639('0x3c')]=qs[_0x5639('0x3d')](_0x13bd17[_0x5639('0x35')][_0x5639('0x3d')]);_0x281751['where']=qs[_0x5639('0x36')](_['pick'](_0x13bd17['query'],_0x2ded87['filters']));if(_0x13bd17['query'][_0x5639('0x40')]){_0x281751[_0x5639('0x3e')]=_[_0x5639('0x41')](_0x281751[_0x5639('0x3e')],{'$or':_[_0x5639('0x30')](_0x281751[_0x5639('0x39')],function(_0x37d866){var _0x22f952={};_0x22f952[_0x37d866]={'$like':'%'+_0x13bd17[_0x5639('0x35')]['filter']+'%'};return _0x22f952;})});}_0x281751=_[_0x5639('0x41')]({},_0x281751,_0x13bd17['options']);return _0x4ccf85[_0x5639('0x51')](_0x281751);}})[_0x5639('0x28')](function(_0x422323){if(_0x422323){_0x5c4c74=_0x422323[_0x5639('0x3a')];if(!_0x13bd17[_0x5639('0x35')][_0x5639('0x3b')](_0x5639('0x52'))){_0x281751['limit']=qs[_0x5639('0x22')](_0x13bd17[_0x5639('0x35')][_0x5639('0x22')]);_0x281751[_0x5639('0x20')]=qs[_0x5639('0x20')](_0x13bd17[_0x5639('0x35')][_0x5639('0x20')]);}return _0x4ccf85['getSubjects'](_0x281751);}})[_0x5639('0x28')](function(_0x39a706){if(_0x39a706){return _0x39a706?{'count':_0x5c4c74,'rows':_0x39a706}:null;}})[_0x5639('0x28')](respondWithResult(_0x3e5d79,null))[_0x5639('0x47')](handleError(_0x3e5d79,null));};exports[_0x5639('0x53')]=function(_0x31367e,_0x558272,_0x5e5f67){var _0x998596={};var _0xb6cbd1={};var _0x37168b;var _0x40f7c0;return db['SalesforceConfiguration'][_0x5639('0x4f')]({'where':{'id':_0x31367e[_0x5639('0x48')]['id']}})['then'](handleEntityNotFound(_0x558272,null))[_0x5639('0x28')](function(_0x567e12){if(_0x567e12){_0x37168b=_0x567e12;_0xb6cbd1[_0x5639('0x49')]=_[_0x5639('0x4a')](db[_0x5639('0x50')][_0x5639('0x32')]);_0xb6cbd1['query']=_[_0x5639('0x4a')](_0x31367e[_0x5639('0x35')]);_0xb6cbd1[_0x5639('0x36')]=_[_0x5639('0x37')](_0xb6cbd1[_0x5639('0x49')],_0xb6cbd1[_0x5639('0x35')]);_0x998596['attributes']=_[_0x5639('0x37')](_0xb6cbd1[_0x5639('0x49')],qs[_0x5639('0x38')](_0x31367e[_0x5639('0x35')][_0x5639('0x38')]));_0x998596['attributes']=_0x998596['attributes'][_0x5639('0x3a')]?_0x998596[_0x5639('0x39')]:_0xb6cbd1[_0x5639('0x49')];_0x998596[_0x5639('0x3c')]=qs[_0x5639('0x3d')](_0x31367e[_0x5639('0x35')]['sort']);_0x998596[_0x5639('0x3e')]=qs[_0x5639('0x36')](_[_0x5639('0x3f')](_0x31367e['query'],_0xb6cbd1['filters']));if(_0x31367e['query']['filter']){_0x998596[_0x5639('0x3e')]=_[_0x5639('0x41')](_0x998596[_0x5639('0x3e')],{'$or':_[_0x5639('0x30')](_0x998596[_0x5639('0x39')],function(_0x21fe09){var _0x2613a8={};_0x2613a8[_0x21fe09]={'$like':'%'+_0x31367e['query'][_0x5639('0x40')]+'%'};return _0x2613a8;})});}_0x998596=_[_0x5639('0x41')]({},_0x998596,_0x31367e[_0x5639('0x54')]);return _0x37168b[_0x5639('0x53')](_0x998596);}})[_0x5639('0x28')](function(_0x563b60){if(_0x563b60){_0x40f7c0=_0x563b60[_0x5639('0x3a')];if(!_0x31367e['query'][_0x5639('0x3b')](_0x5639('0x52'))){_0x998596[_0x5639('0x22')]=qs[_0x5639('0x22')](_0x31367e[_0x5639('0x35')]['limit']);_0x998596['offset']=qs[_0x5639('0x20')](_0x31367e[_0x5639('0x35')][_0x5639('0x20')]);}return _0x37168b['getDescriptions'](_0x998596);}})[_0x5639('0x28')](function(_0x155abe){if(_0x155abe){return _0x155abe?{'count':_0x40f7c0,'rows':_0x155abe}:null;}})[_0x5639('0x28')](respondWithResult(_0x558272,null))[_0x5639('0x47')](handleError(_0x558272,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 699e9f6..4d34341 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 _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 +var _0x96a9=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','util'];(function(_0x1d7700,_0x303437){var _0x10f3ac=function(_0x4baa79){while(--_0x4baa79){_0x1d7700['push'](_0x1d7700['shift']());}};_0x10f3ac(++_0x303437);}(_0x96a9,0x6d));var _0x996a=function(_0x19a283,_0x452d48){_0x19a283=_0x19a283-0x0;var _0x27a1ec=_0x96a9[_0x19a283];return _0x27a1ec;};'use strict';var _=require('lodash');var util=require(_0x996a('0x0'));var logger=require(_0x996a('0x1'))('api');var moment=require(_0x996a('0x2'));var BPromise=require(_0x996a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x996a('0x4'));var rimraf=require(_0x996a('0x5'));var config=require(_0x996a('0x6'));var attributes=require(_0x996a('0x7'));module[_0x996a('0x8')]=function(_0x2e0c7e,_0x3c30bc){return _0x2e0c7e[_0x996a('0x9')](_0x996a('0xa'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 6bc26da..e41e4e8 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 _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 +var _0xac4a=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x4fcd70,_0x109348){var _0x336588=function(_0x430a8c){while(--_0x430a8c){_0x4fcd70['push'](_0x4fcd70['shift']());}};_0x336588(++_0x109348);}(_0xac4a,0x144));var _0xaac4=function(_0x133669,_0x54afb1){_0x133669=_0x133669-0x0;var _0x2a4ead=_0xac4a[_0x133669];return _0x2a4ead;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaac4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaac4('0x5'));var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require(_0xaac4('0x9'));var client=jayson[_0xaac4('0xa')][_0xaac4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d06cd,_0x3e041f,_0x22c45e){return new BPromise(function(_0x1d731d,_0x1e3b35){return client['request'](_0x3d06cd,_0x22c45e)[_0xaac4('0xc')](function(_0x22f174){logger[_0xaac4('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3e041f,_0xaac4('0xe'));logger[_0xaac4('0xf')](_0xaac4('0x10'),_0x3e041f,'request\x20sent',JSON['stringify'](_0x22f174));if(_0x22f174[_0xaac4('0x11')]){if(_0x22f174['error'][_0xaac4('0x12')]===0x1f4){logger['error'](_0xaac4('0x13'),_0x3e041f,_0x22f174[_0xaac4('0x11')][_0xaac4('0x14')]);return _0x1e3b35(_0x22f174[_0xaac4('0x11')][_0xaac4('0x14')]);}logger[_0xaac4('0x11')](_0xaac4('0x13'),_0x3e041f,_0x22f174['error'][_0xaac4('0x14')]);return _0x1d731d(_0x22f174['error'][_0xaac4('0x14')]);}else{logger['info'](_0xaac4('0x13'),_0x3e041f,_0xaac4('0xe'));_0x1d731d(_0x22f174[_0xaac4('0x15')]['message']);}})['catch'](function(_0x504d98){logger[_0xaac4('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3e041f,_0x504d98);_0x1e3b35(_0x504d98);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 6cb9ab8..b4d4e96 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 _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 +var _0xcc60=['isAuthenticated','show','post','create','put','/:id','delete','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get'];(function(_0x4ce63d,_0x46c45a){var _0x5bdff2=function(_0x209fdd){while(--_0x209fdd){_0x4ce63d['push'](_0x4ce63d['shift']());}};_0x5bdff2(++_0x46c45a);}(_0xcc60,0x119));var _0x0cc6=function(_0x5509f9,_0x173378){_0x5509f9=_0x5509f9-0x0;var _0x18926a=_0xcc60[_0x5509f9];return _0x18926a;};'use strict';var multer=require('multer');var util=require(_0x0cc6('0x0'));var path=require(_0x0cc6('0x1'));var timeout=require(_0x0cc6('0x2'));var express=require(_0x0cc6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0cc6('0x4'));var config=require(_0x0cc6('0x5'));var controller=require(_0x0cc6('0x6'));router[_0x0cc6('0x7')]('/',auth[_0x0cc6('0x8')](),controller['index']);router['get']('/:id',auth[_0x0cc6('0x8')](),controller[_0x0cc6('0x9')]);router[_0x0cc6('0xa')]('/',auth['isAuthenticated'](),controller[_0x0cc6('0xb')]);router[_0x0cc6('0xc')](_0x0cc6('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0cc6('0xe')](_0x0cc6('0xd'),auth[_0x0cc6('0x8')](),controller[_0x0cc6('0xf')]);module[_0x0cc6('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index f09d012..94febbc 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 _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 +var _0xe2ff=['keyValue','picklist','STRING','sequelize','ENUM','string','variable','customVariable'];(function(_0x43afdd,_0x4d584a){var _0x5e122b=function(_0x23c4f5){while(--_0x23c4f5){_0x43afdd['push'](_0x43afdd['shift']());}};_0x5e122b(++_0x4d584a);}(_0xe2ff,0x1c3));var _0xfe2f=function(_0x5f1adf,_0x195272){_0x5f1adf=_0x5f1adf-0x0;var _0x125b6b=_0xe2ff[_0x5f1adf];return _0x125b6b;};'use strict';var Sequelize=require(_0xfe2f('0x0'));module['exports']={'type':{'type':Sequelize[_0xfe2f('0x1')](_0xfe2f('0x2'),_0xfe2f('0x3'),_0xfe2f('0x4'),_0xfe2f('0x5'),_0xfe2f('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xfe2f('0x7')]},'key':{'type':Sequelize[_0xfe2f('0x7')]},'keyType':{'type':Sequelize[_0xfe2f('0x1')](_0xfe2f('0x2'),'variable',_0xfe2f('0x4'))},'keyContent':{'type':Sequelize[_0xfe2f('0x7')]},'idField':{'type':Sequelize[_0xfe2f('0x7')]},'variableName':{'type':Sequelize[_0xfe2f('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 60a4054..e86620f 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 _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 +var _0xf5c8=['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','status','json','offset','undefined','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','map','SalesforceField','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','lodash'];(function(_0xd154cd,_0x389877){var _0x3567a2=function(_0x503ee8){while(--_0x503ee8){_0xd154cd['push'](_0xd154cd['shift']());}};_0x3567a2(++_0x389877);}(_0xf5c8,0x17b));var _0x8f5c=function(_0x4314d7,_0x355218){_0x4314d7=_0x4314d7-0x0;var _0x5c599b=_0xf5c8[_0x4314d7];return _0x5c599b;};'use strict';var emlformat=require(_0x8f5c('0x0'));var rimraf=require(_0x8f5c('0x1'));var zipdir=require(_0x8f5c('0x2'));var jsonpatch=require(_0x8f5c('0x3'));var rp=require(_0x8f5c('0x4'));var moment=require('moment');var BPromise=require(_0x8f5c('0x5'));var Mustache=require(_0x8f5c('0x6'));var util=require('util');var path=require(_0x8f5c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8f5c('0x8'));var fs=require('fs');var fs_extra=require(_0x8f5c('0x9'));var _=require(_0x8f5c('0xa'));var squel=require('squel');var crypto=require(_0x8f5c('0xb'));var jsforce=require(_0x8f5c('0xc'));var deskjs=require(_0x8f5c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8f5c('0xe'));var Papa=require(_0x8f5c('0xf'));var Redis=require(_0x8f5c('0x10'));var authService=require(_0x8f5c('0x11'));var qs=require(_0x8f5c('0x12'));var as=require(_0x8f5c('0x13'));var hardwareService=require(_0x8f5c('0x14'));var logger=require(_0x8f5c('0x15'))(_0x8f5c('0x16'));var utils=require(_0x8f5c('0x17'));var config=require(_0x8f5c('0x18'));var licenseUtil=require(_0x8f5c('0x19'));var db=require(_0x8f5c('0x1a'))['db'];function respondWithStatusCode(_0x43b680,_0x524cf5){_0x524cf5=_0x524cf5||0xcc;return function(_0x435100){if(_0x435100){return _0x43b680[_0x8f5c('0x1b')](_0x524cf5);}return _0x43b680['status'](_0x524cf5)[_0x8f5c('0x1c')]();};}function respondWithResult(_0xdbd953,_0x1fbffd){_0x1fbffd=_0x1fbffd||0xc8;return function(_0x58e4d0){if(_0x58e4d0){return _0xdbd953[_0x8f5c('0x1d')](_0x1fbffd)[_0x8f5c('0x1e')](_0x58e4d0);}};}function respondWithFilteredResult(_0x30428e,_0x46596f){return function(_0x5700c0){if(_0x5700c0){var _0x5d7509=typeof _0x46596f[_0x8f5c('0x1f')]===_0x8f5c('0x20')&&typeof _0x46596f['limit']===_0x8f5c('0x20');var _0xe4d10a=_0x5700c0['count'];var _0x4e2278=_0x5d7509?0x0:_0x46596f[_0x8f5c('0x1f')];var _0x181891=_0x5d7509?_0x5700c0[_0x8f5c('0x21')]:_0x46596f[_0x8f5c('0x1f')]+_0x46596f['limit'];var _0xbf02a0;if(_0x181891>=_0xe4d10a){_0x181891=_0xe4d10a;_0xbf02a0=0xc8;}else{_0xbf02a0=0xce;}_0x30428e[_0x8f5c('0x1d')](_0xbf02a0);return _0x30428e[_0x8f5c('0x22')](_0x8f5c('0x23'),_0x4e2278+'-'+_0x181891+'/'+_0xe4d10a)[_0x8f5c('0x1e')](_0x5700c0);}return null;};}function patchUpdates(_0x3d19ff){return function(_0x544abe){try{jsonpatch['apply'](_0x544abe,_0x3d19ff,!![]);}catch(_0x43a795){return BPromise[_0x8f5c('0x24')](_0x43a795);}return _0x544abe[_0x8f5c('0x25')]();};}function saveUpdates(_0x1756fa,_0x2635bf){return function(_0x31078c){if(_0x31078c){return _0x31078c[_0x8f5c('0x26')](_0x1756fa)['then'](function(_0x5c9eed){return _0x5c9eed;});}return null;};}function removeEntity(_0x1506da,_0x10bb54){return function(_0x304841){if(_0x304841){return _0x304841[_0x8f5c('0x27')]()[_0x8f5c('0x28')](function(){_0x1506da[_0x8f5c('0x1d')](0xcc)[_0x8f5c('0x1c')]();});}};}function handleEntityNotFound(_0x498d6e,_0x1a002a){return function(_0x496008){if(!_0x496008){_0x498d6e[_0x8f5c('0x1b')](0x194);}return _0x496008;};}function handleError(_0x562e7c,_0x2b3ccc){_0x2b3ccc=_0x2b3ccc||0x1f4;return function(_0x830303){logger[_0x8f5c('0x29')](_0x830303[_0x8f5c('0x2a')]);if(_0x830303[_0x8f5c('0x2b')]){delete _0x830303['name'];}_0x562e7c[_0x8f5c('0x1d')](_0x2b3ccc)[_0x8f5c('0x2c')](_0x830303);};}exports['index']=function(_0x2a7ec0,_0x19423c){var _0x91337b={},_0x3fdc47={},_0xbbcd72={'count':0x0,'rows':[]};var _0x396c0b=_[_0x8f5c('0x2d')](db[_0x8f5c('0x2e')]['rawAttributes'],function(_0x26e71d){return{'name':_0x26e71d[_0x8f5c('0x2f')],'type':_0x26e71d[_0x8f5c('0x30')]['key']};});_0x3fdc47[_0x8f5c('0x31')]=_[_0x8f5c('0x2d')](_0x396c0b,_0x8f5c('0x2b'));_0x3fdc47[_0x8f5c('0x32')]=_[_0x8f5c('0x33')](_0x2a7ec0['query']);_0x3fdc47[_0x8f5c('0x34')]=_['intersection'](_0x3fdc47[_0x8f5c('0x31')],_0x3fdc47[_0x8f5c('0x32')]);_0x91337b[_0x8f5c('0x35')]=_[_0x8f5c('0x36')](_0x3fdc47['model'],qs[_0x8f5c('0x37')](_0x2a7ec0[_0x8f5c('0x32')][_0x8f5c('0x37')]));_0x91337b['attributes']=_0x91337b[_0x8f5c('0x35')][_0x8f5c('0x38')]?_0x91337b[_0x8f5c('0x35')]:_0x3fdc47[_0x8f5c('0x31')];if(!_0x2a7ec0[_0x8f5c('0x32')][_0x8f5c('0x39')](_0x8f5c('0x3a'))){_0x91337b['limit']=qs['limit'](_0x2a7ec0[_0x8f5c('0x32')]['limit']);_0x91337b[_0x8f5c('0x1f')]=qs[_0x8f5c('0x1f')](_0x2a7ec0[_0x8f5c('0x32')][_0x8f5c('0x1f')]);}_0x91337b[_0x8f5c('0x3b')]=qs[_0x8f5c('0x3c')](_0x2a7ec0['query'][_0x8f5c('0x3c')]);_0x91337b[_0x8f5c('0x3d')]=qs['filters'](_[_0x8f5c('0x3e')](_0x2a7ec0[_0x8f5c('0x32')],_0x3fdc47['filters']),_0x396c0b);if(_0x2a7ec0[_0x8f5c('0x32')][_0x8f5c('0x3f')]){_0x91337b['where']=_[_0x8f5c('0x40')](_0x91337b[_0x8f5c('0x3d')],{'$or':_[_0x8f5c('0x2d')](_0x396c0b,function(_0x26cc54){if(_0x26cc54[_0x8f5c('0x30')]!==_0x8f5c('0x41')){var _0x450e9a={};_0x450e9a[_0x26cc54[_0x8f5c('0x2b')]]={'$like':'%'+_0x2a7ec0['query'][_0x8f5c('0x3f')]+'%'};return _0x450e9a;}})});}_0x91337b=_[_0x8f5c('0x40')]({},_0x91337b,_0x2a7ec0[_0x8f5c('0x42')]);var _0x37a0b3={'where':_0x91337b[_0x8f5c('0x3d')]};return db['SalesforceField'][_0x8f5c('0x21')](_0x37a0b3)[_0x8f5c('0x28')](function(_0x2b6757){_0xbbcd72[_0x8f5c('0x21')]=_0x2b6757;if(_0x2a7ec0[_0x8f5c('0x32')][_0x8f5c('0x43')]){_0x91337b[_0x8f5c('0x44')]=[{'all':!![]}];}return db[_0x8f5c('0x2e')][_0x8f5c('0x45')](_0x91337b);})['then'](function(_0x474272){_0xbbcd72[_0x8f5c('0x46')]=_0x474272;return _0xbbcd72;})[_0x8f5c('0x28')](respondWithFilteredResult(_0x19423c,_0x91337b))[_0x8f5c('0x47')](handleError(_0x19423c,null));};exports[_0x8f5c('0x48')]=function(_0x493deb,_0x25e0ef){var _0x6d98cf={'raw':!![],'where':{'id':_0x493deb['params']['id']}},_0x3a3350={};_0x3a3350['model']=_['keys'](db[_0x8f5c('0x2e')][_0x8f5c('0x49')]);_0x3a3350[_0x8f5c('0x32')]=_[_0x8f5c('0x33')](_0x493deb['query']);_0x3a3350[_0x8f5c('0x34')]=_['intersection'](_0x3a3350['model'],_0x3a3350['query']);_0x6d98cf[_0x8f5c('0x35')]=_[_0x8f5c('0x36')](_0x3a3350[_0x8f5c('0x31')],qs[_0x8f5c('0x37')](_0x493deb[_0x8f5c('0x32')]['fields']));_0x6d98cf[_0x8f5c('0x35')]=_0x6d98cf[_0x8f5c('0x35')][_0x8f5c('0x38')]?_0x6d98cf['attributes']:_0x3a3350[_0x8f5c('0x31')];if(_0x493deb[_0x8f5c('0x32')]['includeAll']){_0x6d98cf[_0x8f5c('0x44')]=[{'all':!![]}];}_0x6d98cf=_[_0x8f5c('0x40')]({},_0x6d98cf,_0x493deb[_0x8f5c('0x42')]);return db[_0x8f5c('0x2e')][_0x8f5c('0x4a')](_0x6d98cf)[_0x8f5c('0x28')](handleEntityNotFound(_0x25e0ef,null))['then'](respondWithResult(_0x25e0ef,null))[_0x8f5c('0x47')](handleError(_0x25e0ef,null));};exports[_0x8f5c('0x4b')]=function(_0x555c84,_0x22cd63){return db[_0x8f5c('0x2e')]['create'](_0x555c84['body'],{})[_0x8f5c('0x28')](respondWithResult(_0x22cd63,0xc9))['catch'](handleError(_0x22cd63,null));};exports[_0x8f5c('0x26')]=function(_0x5805b1,_0x277f73){if(_0x5805b1[_0x8f5c('0x4c')]['id']){delete _0x5805b1[_0x8f5c('0x4c')]['id'];}return db['SalesforceField'][_0x8f5c('0x4a')]({'where':{'id':_0x5805b1['params']['id']}})[_0x8f5c('0x28')](handleEntityNotFound(_0x277f73,null))[_0x8f5c('0x28')](saveUpdates(_0x5805b1['body'],null))[_0x8f5c('0x28')](respondWithResult(_0x277f73,null))[_0x8f5c('0x47')](handleError(_0x277f73,null));};exports[_0x8f5c('0x27')]=function(_0x35c30e,_0x2c0624){return db['SalesforceField'][_0x8f5c('0x4a')]({'where':{'id':_0x35c30e[_0x8f5c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2c0624,null))[_0x8f5c('0x28')](removeEntity(_0x2c0624,null))['catch'](handleError(_0x2c0624,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 8830c4d..9c78d2d 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 _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 +var _0x6681=['request-promise','path','rimraf','../../config/environment','exports','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','lodash','util','../../config/logger','api','bluebird'];(function(_0xf4129c,_0x44fcf1){var _0x426611=function(_0x3b5bcd){while(--_0x3b5bcd){_0xf4129c['push'](_0xf4129c['shift']());}};_0x426611(++_0x44fcf1);}(_0x6681,0x6b));var _0x1668=function(_0x5c88b9,_0x2cf0f4){_0x5c88b9=_0x5c88b9-0x0;var _0x5ba659=_0x6681[_0x5c88b9];return _0x5ba659;};'use strict';var _=require(_0x1668('0x0'));var util=require(_0x1668('0x1'));var logger=require(_0x1668('0x2'))(_0x1668('0x3'));var moment=require('moment');var BPromise=require(_0x1668('0x4'));var rp=require(_0x1668('0x5'));var fs=require('fs');var path=require(_0x1668('0x6'));var rimraf=require(_0x1668('0x7'));var config=require(_0x1668('0x8'));var attributes=require('./intSalesforceField.attributes');module[_0x1668('0x9')]=function(_0x257cee,_0x210074){return _0x257cee['define'](_0x1668('0xa'),attributes,{'tableName':_0x1668('0xb'),'paranoid':![],'indexes':[{'name':_0x1668('0xc'),'fields':[_0x1668('0xd'),'FieldId'],'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 0424891..50dd3d1 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 _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 +var _0x1589=['code','message','result','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1589,0x1ea));var _0x9158=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x1589[_0x36884e];return _0x1cc367;};'use strict';var _=require('lodash');var util=require(_0x9158('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9158('0x1'));var fs=require('fs');var Redis=require(_0x9158('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x9158('0x3'));var logger=require(_0x9158('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9158('0x5'));var client=jayson['client'][_0x9158('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1d155f,_0x4197b2,_0x83f07c){return new BPromise(function(_0x4018fa,_0x3df96f){return client['request'](_0x1d155f,_0x83f07c)[_0x9158('0x7')](function(_0x5ad097){logger[_0x9158('0x8')](_0x9158('0x9'),_0x4197b2,_0x9158('0xa'));logger['debug'](_0x9158('0xb'),_0x4197b2,'request\x20sent',JSON[_0x9158('0xc')](_0x5ad097));if(_0x5ad097[_0x9158('0xd')]){if(_0x5ad097[_0x9158('0xd')][_0x9158('0xe')]===0x1f4){logger['error']('SalesforceField,\x20%s,\x20%s',_0x4197b2,_0x5ad097[_0x9158('0xd')][_0x9158('0xf')]);return _0x3df96f(_0x5ad097[_0x9158('0xd')][_0x9158('0xf')]);}logger[_0x9158('0xd')](_0x9158('0x9'),_0x4197b2,_0x5ad097[_0x9158('0xd')]['message']);return _0x4018fa(_0x5ad097['error'][_0x9158('0xf')]);}else{logger[_0x9158('0x8')](_0x9158('0x9'),_0x4197b2,'request\x20sent');_0x4018fa(_0x5ad097[_0x9158('0x10')]['message']);}})[_0x9158('0x11')](function(_0x332f43){logger['error'](_0x9158('0x9'),_0x4197b2,_0x332f43);_0x3df96f(_0x332f43);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 8e2627a..48e5437 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 _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 +var _0x366a=['fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','update','destroy','exports','multer','util','path','express','Router'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0x366a,0x85));var _0xa366=function(_0x2ed8f3,_0x4aa12f){_0x2ed8f3=_0x2ed8f3-0x0;var _0x525a55=_0x366a[_0x2ed8f3];return _0x525a55;};'use strict';var multer=require(_0xa366('0x0'));var util=require(_0xa366('0x1'));var path=require(_0xa366('0x2'));var timeout=require('connect-timeout');var express=require(_0xa366('0x3'));var router=express[_0xa366('0x4')]();var fs_extra=require(_0xa366('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa366('0x6'));var config=require(_0xa366('0x7'));var controller=require(_0xa366('0x8'));router['get']('/',auth[_0xa366('0x9')](),controller[_0xa366('0xa')]);router[_0xa366('0xb')](_0xa366('0xc'),auth[_0xa366('0x9')](),controller[_0xa366('0xd')]);router['get'](_0xa366('0xe'),auth[_0xa366('0x9')](),controller[_0xa366('0xf')]);router[_0xa366('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0xa366('0x10')]);router[_0xa366('0x11')]('/',auth[_0xa366('0x9')](),controller[_0xa366('0x12')]);router[_0xa366('0x11')](_0xa366('0xe'),auth['isAuthenticated'](),controller[_0xa366('0x13')]);router['put'](_0xa366('0xc'),auth[_0xa366('0x9')](),controller[_0xa366('0x14')]);router['delete'](_0xa366('0xc'),auth[_0xa366('0x9')](),controller[_0xa366('0x15')]);module[_0xa366('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index f1ee86a..33a6fdb 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 _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 +var _0x69cb=['remoteUri','sequelize','exports','STRING'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x69cb,0x69));var _0xb69c=function(_0xbc4560,_0x4020b8){_0xbc4560=_0xbc4560-0x0;var _0x298cfb=_0x69cb[_0xbc4560];return _0x298cfb;};'use strict';var Sequelize=require(_0xb69c('0x0'));module[_0xb69c('0x1')]={'name':{'type':Sequelize[_0xb69c('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb69c('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xb69c('0x2')]},'email':{'type':Sequelize[_0xb69c('0x2')]},'remoteUri':{'type':Sequelize[_0xb69c('0x2')],'unique':_0xb69c('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 753b546..bc7879e 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 _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 +var _0x1db6=['test','statusCode','send','Wrong\x20credentials','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','end','json','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','status','error','stack','name','index','ServicenowAccount','rawAttributes','fieldName','type','key','map','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','options','includeAll','rows','show','params','keys','include','find','catch','create','body','getConfigurations','findOne','length','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','severity','watch_list','child_incidents','approval_history','opened_by','user_input','sys_created_on','sys_domain','sys_created_by','calendar_stc','cmdb_ci','impact','active','work_notes_list','business_service','expected_start','business_duration','group_list','work_end','resolved_at','caller_id','approval_set','work_notes','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','closed_by','parent_incident','sys_id','contact_type','reopened_by','incident_state','urgency','company','activity_due','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','sys_tags','escalation','upon_approval','correlation_id','location','category','username','password','email','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20'];(function(_0x14a4d0,_0x4c7068){var _0x18c8ab=function(_0x10bd3b){while(--_0x10bd3b){_0x14a4d0['push'](_0x14a4d0['shift']());}};_0x18c8ab(++_0x4c7068);}(_0x1db6,0xbd));var _0x61db=function(_0x383ac1,_0x47f750){_0x383ac1=_0x383ac1-0x0;var _0x31997f=_0x1db6[_0x383ac1];return _0x31997f;};'use strict';var emlformat=require(_0x61db('0x0'));var rimraf=require(_0x61db('0x1'));var zipdir=require(_0x61db('0x2'));var jsonpatch=require(_0x61db('0x3'));var rp=require('request-promise');var moment=require(_0x61db('0x4'));var BPromise=require(_0x61db('0x5'));var Mustache=require(_0x61db('0x6'));var util=require(_0x61db('0x7'));var path=require(_0x61db('0x8'));var sox=require(_0x61db('0x9'));var csv=require(_0x61db('0xa'));var ejs=require(_0x61db('0xb'));var fs=require('fs');var fs_extra=require(_0x61db('0xc'));var _=require(_0x61db('0xd'));var squel=require(_0x61db('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x61db('0xa'));var querystring=require(_0x61db('0xf'));var Papa=require(_0x61db('0x10'));var Redis=require('ioredis');var authService=require(_0x61db('0x11'));var qs=require(_0x61db('0x12'));var as=require(_0x61db('0x13'));var hardwareService=require(_0x61db('0x14'));var logger=require(_0x61db('0x15'))('api');var utils=require(_0x61db('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x61db('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x61db('0x18'));function respondWithStatusCode(_0x2c7504,_0x1207aa){_0x1207aa=_0x1207aa||0xcc;return function(_0x1c4666){if(_0x1c4666){return _0x2c7504[_0x61db('0x19')](_0x1207aa);}return _0x2c7504['status'](_0x1207aa)[_0x61db('0x1a')]();};}function respondWithResult(_0x24b989,_0x288541){_0x288541=_0x288541||0xc8;return function(_0x1312a8){if(_0x1312a8){return _0x24b989['status'](_0x288541)[_0x61db('0x1b')](_0x1312a8);}};}function respondWithFilteredResult(_0x26d0aa,_0x559b6d){return function(_0x58f213){if(_0x58f213){var _0x24c5d1=typeof _0x559b6d['offset']===_0x61db('0x1c')&&typeof _0x559b6d[_0x61db('0x1d')]===_0x61db('0x1c');var _0xfbcf15=_0x58f213['count'];var _0x1ff5b3=_0x24c5d1?0x0:_0x559b6d['offset'];var _0x4a190f=_0x24c5d1?_0x58f213[_0x61db('0x1e')]:_0x559b6d['offset']+_0x559b6d['limit'];var _0xb42986;if(_0x4a190f>=_0xfbcf15){_0x4a190f=_0xfbcf15;_0xb42986=0xc8;}else{_0xb42986=0xce;}_0x26d0aa['status'](_0xb42986);return _0x26d0aa['set'](_0x61db('0x1f'),_0x1ff5b3+'-'+_0x4a190f+'/'+_0xfbcf15)[_0x61db('0x1b')](_0x58f213);}return null;};}function patchUpdates(_0x274b3f){return function(_0x1bb949){try{jsonpatch[_0x61db('0x20')](_0x1bb949,_0x274b3f,!![]);}catch(_0x37085e){return BPromise[_0x61db('0x21')](_0x37085e);}return _0x1bb949[_0x61db('0x22')]();};}function saveUpdates(_0x23ed25,_0x1947d0){return function(_0x4b2a69){if(_0x4b2a69){return _0x4b2a69[_0x61db('0x23')](_0x23ed25)[_0x61db('0x24')](function(_0x19ae8b){return _0x19ae8b;});}return null;};}function removeEntity(_0x1ef4bf,_0x319ddf){return function(_0x1c281d){if(_0x1c281d){return _0x1c281d[_0x61db('0x25')]()[_0x61db('0x24')](function(){_0x1ef4bf[_0x61db('0x26')](0xcc)[_0x61db('0x1a')]();});}};}function handleEntityNotFound(_0x3d9800,_0x406082){return function(_0x4e9a3b){if(!_0x4e9a3b){_0x3d9800['sendStatus'](0x194);}return _0x4e9a3b;};}function handleError(_0x2a137b,_0x229e78){_0x229e78=_0x229e78||0x1f4;return function(_0x4f1407){logger[_0x61db('0x27')](_0x4f1407[_0x61db('0x28')]);if(_0x4f1407[_0x61db('0x29')]){delete _0x4f1407[_0x61db('0x29')];}_0x2a137b[_0x61db('0x26')](_0x229e78)['send'](_0x4f1407);};}exports[_0x61db('0x2a')]=function(_0x56c433,_0x4fe86c){var _0x536d80={},_0x427fcd={},_0x1de64a={'count':0x0,'rows':[]};var _0x2f8fa0=_['map'](db[_0x61db('0x2b')][_0x61db('0x2c')],function(_0x2aea30){return{'name':_0x2aea30[_0x61db('0x2d')],'type':_0x2aea30[_0x61db('0x2e')][_0x61db('0x2f')]};});_0x427fcd['model']=_[_0x61db('0x30')](_0x2f8fa0,'name');_0x427fcd['query']=_['keys'](_0x56c433['query']);_0x427fcd['filters']=_[_0x61db('0x31')](_0x427fcd[_0x61db('0x32')],_0x427fcd[_0x61db('0x33')]);_0x536d80[_0x61db('0x34')]=_[_0x61db('0x31')](_0x427fcd[_0x61db('0x32')],qs[_0x61db('0x35')](_0x56c433['query'][_0x61db('0x35')]));_0x536d80[_0x61db('0x34')]=_0x536d80[_0x61db('0x34')]['length']?_0x536d80['attributes']:_0x427fcd[_0x61db('0x32')];if(!_0x56c433[_0x61db('0x33')][_0x61db('0x36')](_0x61db('0x37'))){_0x536d80[_0x61db('0x1d')]=qs[_0x61db('0x1d')](_0x56c433[_0x61db('0x33')][_0x61db('0x1d')]);_0x536d80['offset']=qs[_0x61db('0x38')](_0x56c433[_0x61db('0x33')]['offset']);}_0x536d80[_0x61db('0x39')]=qs[_0x61db('0x3a')](_0x56c433[_0x61db('0x33')][_0x61db('0x3a')]);_0x536d80[_0x61db('0x3b')]=qs[_0x61db('0x3c')](_[_0x61db('0x3d')](_0x56c433[_0x61db('0x33')],_0x427fcd[_0x61db('0x3c')]),_0x2f8fa0);if(_0x56c433[_0x61db('0x33')][_0x61db('0x3e')]){_0x536d80[_0x61db('0x3b')]=_[_0x61db('0x3f')](_0x536d80[_0x61db('0x3b')],{'$or':_[_0x61db('0x30')](_0x2f8fa0,function(_0x3b0c59){if(_0x3b0c59[_0x61db('0x2e')]!=='VIRTUAL'){var _0x33fb73={};_0x33fb73[_0x3b0c59[_0x61db('0x29')]]={'$like':'%'+_0x56c433[_0x61db('0x33')][_0x61db('0x3e')]+'%'};return _0x33fb73;}})});}_0x536d80=_[_0x61db('0x3f')]({},_0x536d80,_0x56c433[_0x61db('0x40')]);var _0x3f5c91={'where':_0x536d80[_0x61db('0x3b')]};return db[_0x61db('0x2b')][_0x61db('0x1e')](_0x3f5c91)[_0x61db('0x24')](function(_0xa8ac4d){_0x1de64a['count']=_0xa8ac4d;if(_0x56c433[_0x61db('0x33')][_0x61db('0x41')]){_0x536d80['include']=[{'all':!![]}];}return db[_0x61db('0x2b')]['findAll'](_0x536d80);})[_0x61db('0x24')](function(_0x45d6f2){_0x1de64a[_0x61db('0x42')]=_0x45d6f2;return _0x1de64a;})['then'](respondWithFilteredResult(_0x4fe86c,_0x536d80))['catch'](handleError(_0x4fe86c,null));};exports[_0x61db('0x43')]=function(_0x290068,_0x40933e){var _0x53eab5={'raw':![],'where':{'id':_0x290068[_0x61db('0x44')]['id']}},_0x10f7b4={};_0x10f7b4['model']=_[_0x61db('0x45')](db[_0x61db('0x2b')][_0x61db('0x2c')]);_0x10f7b4[_0x61db('0x33')]=_[_0x61db('0x45')](_0x290068[_0x61db('0x33')]);_0x10f7b4[_0x61db('0x3c')]=_['intersection'](_0x10f7b4['model'],_0x10f7b4[_0x61db('0x33')]);_0x53eab5[_0x61db('0x34')]=_[_0x61db('0x31')](_0x10f7b4[_0x61db('0x32')],qs[_0x61db('0x35')](_0x290068[_0x61db('0x33')][_0x61db('0x35')]));_0x53eab5[_0x61db('0x34')]=_0x53eab5['attributes']['length']?_0x53eab5['attributes']:_0x10f7b4[_0x61db('0x32')];if(_0x290068['query'][_0x61db('0x41')]){_0x53eab5[_0x61db('0x46')]=[{'all':!![]}];}_0x53eab5=_[_0x61db('0x3f')]({},_0x53eab5,_0x290068[_0x61db('0x40')]);return db[_0x61db('0x2b')][_0x61db('0x47')](_0x53eab5)['then'](handleEntityNotFound(_0x40933e,null))[_0x61db('0x24')](respondWithResult(_0x40933e,null))[_0x61db('0x48')](handleError(_0x40933e,null));};exports[_0x61db('0x49')]=function(_0x5656ed,_0x14ab59){return db[_0x61db('0x2b')][_0x61db('0x49')](_0x5656ed[_0x61db('0x4a')],{})[_0x61db('0x24')](respondWithResult(_0x14ab59,0xc9))[_0x61db('0x48')](handleError(_0x14ab59,null));};exports[_0x61db('0x23')]=function(_0x33275d,_0xc50a22){if(_0x33275d[_0x61db('0x4a')]['id']){delete _0x33275d[_0x61db('0x4a')]['id'];}return db['ServicenowAccount'][_0x61db('0x47')]({'where':{'id':_0x33275d['params']['id']}})[_0x61db('0x24')](handleEntityNotFound(_0xc50a22,null))[_0x61db('0x24')](saveUpdates(_0x33275d[_0x61db('0x4a')],null))[_0x61db('0x24')](respondWithResult(_0xc50a22,null))[_0x61db('0x48')](handleError(_0xc50a22,null));};exports[_0x61db('0x25')]=function(_0x1b541a,_0x1cf662){return db[_0x61db('0x2b')][_0x61db('0x47')]({'where':{'id':_0x1b541a['params']['id']}})['then'](handleEntityNotFound(_0x1cf662,null))[_0x61db('0x24')](removeEntity(_0x1cf662,null))[_0x61db('0x48')](handleError(_0x1cf662,null));};exports[_0x61db('0x4b')]=function(_0x1847da,_0x437ce5,_0x20fc0a){var _0x1fede6={};var _0x39ab6a={};var _0x1354b9;var _0x535bb3;return db['ServicenowAccount'][_0x61db('0x4c')]({'where':{'id':_0x1847da[_0x61db('0x44')]['id']}})[_0x61db('0x24')](handleEntityNotFound(_0x437ce5,null))[_0x61db('0x24')](function(_0x20dc01){if(_0x20dc01){_0x1354b9=_0x20dc01;_0x39ab6a['model']=_['keys'](db['ServicenowConfiguration'][_0x61db('0x2c')]);_0x39ab6a[_0x61db('0x33')]=_[_0x61db('0x45')](_0x1847da[_0x61db('0x33')]);_0x39ab6a[_0x61db('0x3c')]=_['intersection'](_0x39ab6a[_0x61db('0x32')],_0x39ab6a[_0x61db('0x33')]);_0x1fede6[_0x61db('0x34')]=_[_0x61db('0x31')](_0x39ab6a[_0x61db('0x32')],qs['fields'](_0x1847da[_0x61db('0x33')][_0x61db('0x35')]));_0x1fede6['attributes']=_0x1fede6[_0x61db('0x34')]['length']?_0x1fede6[_0x61db('0x34')]:_0x39ab6a[_0x61db('0x32')];_0x1fede6['order']=qs['sort'](_0x1847da[_0x61db('0x33')][_0x61db('0x3a')]);_0x1fede6[_0x61db('0x3b')]=qs[_0x61db('0x3c')](_['pick'](_0x1847da[_0x61db('0x33')],_0x39ab6a[_0x61db('0x3c')]));if(_0x1847da[_0x61db('0x33')][_0x61db('0x3e')]){_0x1fede6[_0x61db('0x3b')]=_[_0x61db('0x3f')](_0x1fede6[_0x61db('0x3b')],{'$or':_[_0x61db('0x30')](_0x1fede6[_0x61db('0x34')],function(_0x30b207){var _0x293abf={};_0x293abf[_0x30b207]={'$like':'%'+_0x1847da[_0x61db('0x33')][_0x61db('0x3e')]+'%'};return _0x293abf;})});}_0x1fede6=_[_0x61db('0x3f')]({},_0x1fede6,_0x1847da[_0x61db('0x40')]);return _0x1354b9[_0x61db('0x4b')](_0x1fede6);}})[_0x61db('0x24')](function(_0x518589){if(_0x518589){_0x535bb3=_0x518589[_0x61db('0x4d')];if(!_0x1847da['query'][_0x61db('0x36')](_0x61db('0x37'))){_0x1fede6[_0x61db('0x1d')]=qs[_0x61db('0x1d')](_0x1847da[_0x61db('0x33')]['limit']);_0x1fede6['offset']=qs[_0x61db('0x38')](_0x1847da[_0x61db('0x33')][_0x61db('0x38')]);}return _0x1354b9[_0x61db('0x4b')](_0x1fede6);}})[_0x61db('0x24')](function(_0x36923f){if(_0x36923f){return _0x36923f?{'count':_0x535bb3,'rows':_0x36923f}:null;}})[_0x61db('0x24')](respondWithResult(_0x437ce5,null))[_0x61db('0x48')](handleError(_0x437ce5,null));};exports[_0x61db('0x4e')]=function(_0x2fdf9d,_0x124200,_0x58e769){if(_0x2fdf9d[_0x61db('0x4a')]['id']){delete _0x2fdf9d[_0x61db('0x4a')]['id'];}return db[_0x61db('0x2b')][_0x61db('0x4c')]({'where':{'id':_0x2fdf9d[_0x61db('0x44')]['id']}})[_0x61db('0x24')](handleEntityNotFound(_0x124200,null))[_0x61db('0x24')](function(_0x22380b){if(_0x22380b){_0x2fdf9d[_0x61db('0x4a')][_0x61db('0x4f')]=_0x22380b['id'];_0x2fdf9d[_0x61db('0x4a')][_0x61db('0x50')]=integrations[_0x61db('0x51')](_0x2fdf9d['body'][_0x61db('0x52')],_0x2fdf9d[_0x61db('0x4a')]['type']);_0x2fdf9d['body'][_0x61db('0x53')]=integrations[_0x61db('0x54')](_0x2fdf9d['body'][_0x61db('0x52')],_0x2fdf9d[_0x61db('0x4a')][_0x61db('0x2e')]);return db['ServicenowConfiguration'][_0x61db('0x49')](_0x2fdf9d[_0x61db('0x4a')],{'include':[{'model':db['ServicenowField'],'as':_0x61db('0x50')},{'model':db[_0x61db('0x55')],'as':'Descriptions'}]});}return null;})[_0x61db('0x24')](respondWithResult(_0x124200,null))[_0x61db('0x48')](handleError(_0x124200,null));};exports[_0x61db('0x56')]=function(_0xa74651,_0x2fef7c,_0x34897f){var _0x58d19b=[_0x61db('0x57'),_0x61db('0x58'),_0x61db('0x59'),_0x61db('0x5a'),_0x61db('0x5b'),_0x61db('0x5c'),'incident_state',_0x61db('0x5d'),'category'];var _0x3c53e9=['parent',_0x61db('0x57'),'caused_by',_0x61db('0x5e'),'upon_reject','sys_updated_on',_0x61db('0x5f'),'hold_reason',_0x61db('0x60'),'number','resolved_by','sys_updated_by',_0x61db('0x61'),_0x61db('0x62'),_0x61db('0x63'),_0x61db('0x64'),'state',_0x61db('0x65'),_0x61db('0x59'),_0x61db('0x39'),_0x61db('0x66'),'closed_at',_0x61db('0x67'),'delivery_plan',_0x61db('0x68'),_0x61db('0x69'),_0x61db('0x6a'),_0x61db('0x6b'),'priority','sys_domain_path','rfc','time_worked',_0x61db('0x6c'),'opened_at',_0x61db('0x6d'),_0x61db('0x6e'),_0x61db('0x6f'),'reopened_time',_0x61db('0x70'),_0x61db('0x71'),_0x61db('0x72'),_0x61db('0x5a'),_0x61db('0x73'),'short_description','close_code',_0x61db('0x74'),_0x61db('0x75'),_0x61db('0x76'),_0x61db('0x77'),_0x61db('0x78'),_0x61db('0x79'),_0x61db('0x7a'),_0x61db('0x7b'),_0x61db('0x5c'),_0x61db('0x7c'),'close_notes',_0x61db('0x7d'),'follow_up',_0x61db('0x7e'),_0x61db('0x7f'),_0x61db('0x80'),_0x61db('0x81'),_0x61db('0x82'),_0x61db('0x83'),'problem_id',_0x61db('0x84'),'reassignment_count',_0x61db('0x85'),'assigned_to',_0x61db('0x5d'),'comments',_0x61db('0x86'),_0x61db('0x87'),_0x61db('0x88'),_0x61db('0x89'),_0x61db('0x8a'),'reopen_count',_0x61db('0x8b'),_0x61db('0x8c'),_0x61db('0x8d'),_0x61db('0x8e'),_0x61db('0x8f'),_0x61db('0x90')];var _0x1f6e10='';var _0x1fae7a='';var _0x4b72ef=[];var _0x3bc4f3='';var _0x451c88='';var _0x2ea6a9=[];var _0x446e2c='';var _0x5fbc42='';var _0x3a9839={};var _0x380374='';return db[_0x61db('0x2b')]['findOne']({'where':{'id':_0xa74651[_0x61db('0x44')]['id']},'attributes':['id',_0x61db('0x91'),_0x61db('0x92'),_0x61db('0x93'),_0x61db('0x94'),'serverUrl']})[_0x61db('0x24')](handleEntityNotFound(_0x2fef7c,null))[_0x61db('0x24')](function(_0x2de22a){if(_0x2de22a){_0x380374=_0x2de22a[_0x61db('0x94')];var _0x334d70=_0x380374[_0x61db('0x95')](-0x1);if(_0x334d70==='/'){_0x380374=_0x380374[_0x61db('0x96')](0x0,_0x380374[_0x61db('0x97')](_0x334d70));}_0x5fbc42=util[_0x61db('0x98')](_0x61db('0x99'),_0x380374);_0x446e2c=util['format'](_0x61db('0x9a'),_0x380374);_0x3a9839={'user':_0x2de22a['username'],'pass':_0x2de22a[_0x61db('0x92')]};var _0x33d0c0={'method':_0x61db('0x9b'),'uri':_0x5fbc42+'incident?sysparm_display_value=all','auth':_0x3a9839,'json':!![]};return rp(_0x33d0c0);}})['then'](function(_0x424f9d){if(_0x424f9d[_0x61db('0x9c')]['length']>0x0){_0x1f6e10=_0x424f9d[_0x61db('0x9c')];}console[_0x61db('0x9d')](_0x61db('0x9e'),_0x1f6e10);_0x2ea6a9=[];_0x1fae7a=Object[_0x61db('0x9f')]([],_0x1f6e10);_[_0x61db('0xa0')](_0x1fae7a,function(_0x22547f){return!_0x58d19b[_0x61db('0xa1')](_0x22547f[_0x61db('0x29')]);});_0x1fae7a[_0x61db('0xa2')](function(_0x35497a){var _0x2bdf0f=createFieldObject(_0x446e2c,_0x3a9839,_0x35497a[_0x61db('0xa3')],_0x35497a[_0x61db('0x29')],_0x35497a[_0x61db('0xa4')],![]);_0x2ea6a9[_0x61db('0xa5')](_0x2bdf0f);});return Promise[_0x61db('0xa6')](_0x2ea6a9);})[_0x61db('0x24')](function(_0x18465d){_0x4b72ef=_0x18465d;_0x3bc4f3=Object[_0x61db('0x9f')]([],_0x1f6e10);console['log'](_0x61db('0xa7'),_0x1f6e10);_[_0x61db('0xa0')](_0x3bc4f3,function(_0x4128eb){return _0x3c53e9[_0x61db('0xa1')](_0x4128eb[_0x61db('0x29')]);});console[_0x61db('0x9d')](_0x61db('0xa8'),_0x3bc4f3);_0x2ea6a9=[];_0x3bc4f3[_0x61db('0xa2')](function(_0x3ea202){var _0x47db83=createFieldObject(_0x446e2c,_0x3a9839,_0x3ea202[_0x61db('0xa3')],_0x3ea202[_0x61db('0x29')],_0x3ea202[_0x61db('0xa4')],!![]);_0x2ea6a9['push'](_0x47db83);});return Promise['all'](_0x2ea6a9);})[_0x61db('0x24')](function(_0x4d4990){_0x451c88=_0x4d4990;var _0x4af36c=_0x4b72ef[_0x61db('0xa9')](_0x451c88);return{'count':_0x4af36c[_0x61db('0x4d')],'rows':_0x4af36c};})[_0x61db('0x24')](respondWithResult(_0x2fef7c,null))[_0x61db('0x48')](function(_0x4af649){console['log'](_0x61db('0xaa')+_0x4af649);var _0x4572bd=_0xa74651[_0x61db('0x33')][_0x61db('0xab')]?0x1f4:_0x4af649[_0x61db('0xac')]||0x1f4;logger[_0x61db('0x27')](_0x4af649[_0x61db('0x28')]);delete _0x4af649[_0x61db('0x29')];if(_0x4572bd===0x191){_0x4572bd=0x190;}_0x2fef7c[_0x61db('0x26')](_0x4572bd)[_0x61db('0xad')](_0xa74651[_0x61db('0x33')][_0x61db('0xab')]?{'message':_0x61db('0xae'),'statusCode':_0x4af649['statusCode']}:_0x4af649);});};function createFieldObject(_0x26c54a,_0x532caf,_0x28292c,_0x2ce24a,_0x11a0a9,_0x446382){return new Promise(function(_0x3224ea,_0xb79936){var _0x5d9d3c={'id':_0x2ce24a,'name':_0x11a0a9,'custom':_0x446382};if(_0x28292c==='boolean'){_0x5d9d3c['options']=[{'name':'True','value':_0x61db('0xaf')},{'name':_0x61db('0xb0'),'value':'false'}];_0x3224ea(_0x5d9d3c);}else{var _0x19e79c={'method':_0x61db('0x9b'),'uri':_0x26c54a+_0x61db('0xb1')+_0x2ce24a,'auth':_0x532caf,'json':!![]};return rp(_0x19e79c)['then'](function(_0x252804){var _0x147632=[];if(_0x252804[_0x61db('0x9c')]['length']>0x0){_0x252804[_0x61db('0x9c')]['forEach'](function(_0x24c9c7){if(_0x24c9c7[_0x61db('0xb2')]==='false'){var _0x2177f6={'name':_0x24c9c7['label'],'value':_0x24c9c7[_0x61db('0xb3')]};_0x147632[_0x61db('0xa5')](_0x2177f6);}});}_0x5d9d3c[_0x61db('0x40')]=_0x147632;if(_0x5d9d3c['options'][_0x61db('0x4d')]>0x0){_0x3224ea(_0x5d9d3c);}else{if(_0x446382==![]){_0x3224ea();}else{_0x3224ea(_0x5d9d3c);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index f581917..6ba0444 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 _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 +var _0xc4aa=['bluebird','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','util','../../config/logger','api','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xc4aa[_0x1928c9];return _0x51b5fb;};'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'));var integrations=require(_0xac4a('0x8'));module[_0xac4a('0x9')]=function(_0x96be2b,_0x15cd34){return _0x96be2b[_0xac4a('0xa')](_0xac4a('0xb'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 3906266..680b454 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 _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 +var _0x0152=['ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowServicenowAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3c0038,_0x152425){var _0x42366a=function(_0x211609){while(--_0x211609){_0x3c0038['push'](_0x3c0038['shift']());}};_0x42366a(++_0x152425);}(_0x0152,0x1c3));var _0x2015=function(_0xaeccb4,_0x4d068b){_0xaeccb4=_0xaeccb4-0x0;var _0x41d1b0=_0x0152[_0xaeccb4];return _0x41d1b0;};'use strict';var _=require('lodash');var util=require(_0x2015('0x0'));var moment=require(_0x2015('0x1'));var BPromise=require(_0x2015('0x2'));var rs=require(_0x2015('0x3'));var fs=require('fs');var Redis=require(_0x2015('0x4'));var db=require(_0x2015('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2015('0x6'))('rpc');var config=require(_0x2015('0x7'));var jayson=require(_0x2015('0x8'));var client=jayson[_0x2015('0x9')][_0x2015('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa10b98,_0x4d9c1f,_0x22f066){return new BPromise(function(_0x542b84,_0x308682){return client[_0x2015('0xb')](_0xa10b98,_0x22f066)[_0x2015('0xc')](function(_0x2d4d30){logger[_0x2015('0xd')](_0x2015('0xe'),_0x4d9c1f,_0x2015('0xf'));logger[_0x2015('0x10')](_0x2015('0x11'),_0x4d9c1f,_0x2015('0xf'),JSON[_0x2015('0x12')](_0x2d4d30));if(_0x2d4d30[_0x2015('0x13')]){if(_0x2d4d30['error'][_0x2015('0x14')]===0x1f4){logger[_0x2015('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x4d9c1f,_0x2d4d30['error'][_0x2015('0x15')]);return _0x308682(_0x2d4d30[_0x2015('0x13')]['message']);}logger[_0x2015('0x13')](_0x2015('0xe'),_0x4d9c1f,_0x2d4d30[_0x2015('0x13')][_0x2015('0x15')]);return _0x542b84(_0x2d4d30[_0x2015('0x13')][_0x2015('0x15')]);}else{logger['info'](_0x2015('0xe'),_0x4d9c1f,'request\x20sent');_0x542b84(_0x2d4d30['result'][_0x2015('0x15')]);}})[_0x2015('0x16')](function(_0x270e3a){logger[_0x2015('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x4d9c1f,_0x270e3a);_0x308682(_0x270e3a);});});}exports[_0x2015('0x17')]=function(_0x3de401){var _0x3680a2=this;return new Promise(function(_0x3e8058,_0xd18333){return db[_0x2015('0x18')][_0x2015('0x19')]({'raw':_0x3de401[_0x2015('0x1a')]?_0x3de401[_0x2015('0x1a')][_0x2015('0x1b')]===undefined?!![]:![]:!![],'where':_0x3de401[_0x2015('0x1a')]?_0x3de401['options'][_0x2015('0x1c')]||null:null,'attributes':_0x3de401[_0x2015('0x1a')]?_0x3de401[_0x2015('0x1a')][_0x2015('0x1d')]||null:null,'limit':_0x3de401[_0x2015('0x1a')]?_0x3de401['options'][_0x2015('0x1e')]||null:null,'include':_0x3de401[_0x2015('0x1a')]?_0x3de401['options'][_0x2015('0x1f')]?_['map'](_0x3de401[_0x2015('0x1a')]['include'],function(_0x146f21){return{'model':db[_0x146f21[_0x2015('0x20')]],'as':_0x146f21['as'],'attributes':_0x146f21[_0x2015('0x1d')],'include':_0x146f21[_0x2015('0x1f')]?_[_0x2015('0x21')](_0x146f21[_0x2015('0x1f')],function(_0x3f49a3){return{'model':db[_0x3f49a3['model']],'as':_0x3f49a3['as'],'attributes':_0x3f49a3['attributes'],'include':_0x3f49a3[_0x2015('0x1f')]?_[_0x2015('0x21')](_0x3f49a3['include'],function(_0x3d4c6a){return{'model':db[_0x3d4c6a[_0x2015('0x20')]],'as':_0x3d4c6a['as'],'attributes':_0x3d4c6a[_0x2015('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2015('0xc')](function(_0x501cc8){logger[_0x2015('0xd')]('GetServicenowAccount',_0x3de401);logger[_0x2015('0x10')](_0x2015('0x17'),_0x3de401,JSON[_0x2015('0x12')](_0x501cc8));_0x3e8058(_0x501cc8);})[_0x2015('0x16')](function(_0xa6b799){logger[_0x2015('0x13')](_0x2015('0x17'),_0xa6b799[_0x2015('0x15')],_0x3de401);_0xd18333(_0x3680a2[_0x2015('0x13')](0x1f4,_0xa6b799['message']));});});};exports[_0x2015('0x22')]=function(_0xa2fdd2){var _0x50b16e=this;return new Promise(function(_0x2b7fb1,_0x54208e){return db[_0x2015('0x18')][_0x2015('0x23')]({'raw':_0xa2fdd2[_0x2015('0x1a')]?_0xa2fdd2['options']['raw']===undefined?!![]:![]:!![],'where':_0xa2fdd2[_0x2015('0x1a')]?_0xa2fdd2[_0x2015('0x1a')][_0x2015('0x1c')]||null:null,'attributes':_0xa2fdd2[_0x2015('0x1a')]?_0xa2fdd2[_0x2015('0x1a')]['attributes']||null:null,'include':_0xa2fdd2[_0x2015('0x1a')]?_0xa2fdd2[_0x2015('0x1a')][_0x2015('0x1f')]?_[_0x2015('0x21')](_0xa2fdd2[_0x2015('0x1a')][_0x2015('0x1f')],function(_0x467d06){return{'model':db[_0x467d06[_0x2015('0x20')]],'as':_0x467d06['as'],'attributes':_0x467d06[_0x2015('0x1d')],'include':_0x467d06['include']?_[_0x2015('0x21')](_0x467d06[_0x2015('0x1f')],function(_0x5d6dd1){return{'model':db[_0x5d6dd1['model']],'as':_0x5d6dd1['as'],'attributes':_0x5d6dd1[_0x2015('0x1d')],'include':_0x5d6dd1[_0x2015('0x1f')]?_[_0x2015('0x21')](_0x5d6dd1[_0x2015('0x1f')],function(_0x387130){return{'model':db[_0x387130[_0x2015('0x20')]],'as':_0x387130['as'],'attributes':_0x387130[_0x2015('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2015('0xc')](function(_0x2c6997){logger[_0x2015('0xd')](_0x2015('0x22'),_0xa2fdd2);logger[_0x2015('0x10')](_0x2015('0x22'),_0xa2fdd2,JSON[_0x2015('0x12')](_0x2c6997));_0x2b7fb1(_0x2c6997);})[_0x2015('0x16')](function(_0x5c552f){logger[_0x2015('0x13')](_0x2015('0x22'),_0x5c552f[_0x2015('0x15')],_0xa2fdd2);_0x54208e(_0x50b16e[_0x2015('0x13')](0x1f4,_0x5c552f['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index eedea6a..a6f498b 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 _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 +var _0x523e=['show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','/:id','isAuthenticated'];(function(_0x3d1eb3,_0x3ffab4){var _0x5c4d25=function(_0x50ec32){while(--_0x50ec32){_0x3d1eb3['push'](_0x3d1eb3['shift']());}};_0x5c4d25(++_0x3ffab4);}(_0x523e,0x96));var _0xe523=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x523e[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0xe523('0x0'));var path=require('path');var timeout=require(_0xe523('0x1'));var express=require(_0xe523('0x2'));var router=express[_0xe523('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe523('0x4'));var interaction=require(_0xe523('0x5'));var config=require(_0xe523('0x6'));var controller=require(_0xe523('0x7'));router[_0xe523('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe523('0x9'),auth[_0xe523('0xa')](),controller[_0xe523('0xb')]);router[_0xe523('0x8')](_0xe523('0xc'),auth[_0xe523('0xa')](),controller[_0xe523('0xd')]);router[_0xe523('0x8')](_0xe523('0xe'),auth[_0xe523('0xa')](),controller['getSubjects']);router[_0xe523('0x8')](_0xe523('0xf'),auth[_0xe523('0xa')](),controller[_0xe523('0x10')]);router[_0xe523('0x11')]('/',auth['isAuthenticated'](),controller[_0xe523('0x12')]);router['put'](_0xe523('0x9'),auth['isAuthenticated'](),controller[_0xe523('0x13')]);router[_0xe523('0x14')](_0xe523('0x9'),auth[_0xe523('0xa')](),controller[_0xe523('0x15')]);module[_0xe523('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index c7f245c..5c6163f 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 _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 +var _0x872f=['sequelize','exports','STRING'];(function(_0x29da57,_0x93718d){var _0x532a28=function(_0x2c380a){while(--_0x2c380a){_0x29da57['push'](_0x29da57['shift']());}};_0x532a28(++_0x93718d);}(_0x872f,0x84));var _0xf872=function(_0x47c9d1,_0x2bb28c){_0x47c9d1=_0x47c9d1-0x0;var _0x5d54f3=_0x872f[_0x47c9d1];return _0x5d54f3;};'use strict';var Sequelize=require(_0xf872('0x0'));module[_0xf872('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf872('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index b02a0e9..1ab530e 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 _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 +var _0xbbdf=['findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','../../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','Content-Range','reject','then','error','stack','name','map','ServicenowConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','update','body','getFields','order','nolimit','ServicenowField','getSubjects','getDescriptions'];(function(_0xcdb024,_0x48c364){var _0x386966=function(_0x147d12){while(--_0x147d12){_0xcdb024['push'](_0xcdb024['shift']());}};_0x386966(++_0x48c364);}(_0xbbdf,0xeb));var _0xfbbd=function(_0x5744df,_0x30c6cf){_0x5744df=_0x5744df-0x0;var _0xa3fd93=_0xbbdf[_0x5744df];return _0xa3fd93;};'use strict';var emlformat=require(_0xfbbd('0x0'));var rimraf=require(_0xfbbd('0x1'));var zipdir=require(_0xfbbd('0x2'));var jsonpatch=require(_0xfbbd('0x3'));var rp=require(_0xfbbd('0x4'));var moment=require(_0xfbbd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfbbd('0x6'));var util=require('util');var path=require(_0xfbbd('0x7'));var sox=require(_0xfbbd('0x8'));var csv=require(_0xfbbd('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfbbd('0xa'));var _=require(_0xfbbd('0xb'));var squel=require(_0xfbbd('0xc'));var crypto=require('crypto');var jsforce=require(_0xfbbd('0xd'));var deskjs=require(_0xfbbd('0xe'));var toCsv=require(_0xfbbd('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfbbd('0xf'));var qs=require(_0xfbbd('0x10'));var as=require(_0xfbbd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfbbd('0x12'))(_0xfbbd('0x13'));var utils=require(_0xfbbd('0x14'));var config=require(_0xfbbd('0x15'));var licenseUtil=require(_0xfbbd('0x16'));var db=require(_0xfbbd('0x17'))['db'];function respondWithStatusCode(_0x5f65ce,_0x4ca0cf){_0x4ca0cf=_0x4ca0cf||0xcc;return function(_0x39f03d){if(_0x39f03d){return _0x5f65ce[_0xfbbd('0x18')](_0x4ca0cf);}return _0x5f65ce[_0xfbbd('0x19')](_0x4ca0cf)[_0xfbbd('0x1a')]();};}function respondWithResult(_0x46368a,_0x91cc4e){_0x91cc4e=_0x91cc4e||0xc8;return function(_0x185bb8){if(_0x185bb8){return _0x46368a[_0xfbbd('0x19')](_0x91cc4e)[_0xfbbd('0x1b')](_0x185bb8);}};}function respondWithFilteredResult(_0x33a362,_0x1f7f49){return function(_0x1dc389){if(_0x1dc389){var _0x4f534e=typeof _0x1f7f49[_0xfbbd('0x1c')]===_0xfbbd('0x1d')&&typeof _0x1f7f49[_0xfbbd('0x1e')]===_0xfbbd('0x1d');var _0x301b12=_0x1dc389[_0xfbbd('0x1f')];var _0x218400=_0x4f534e?0x0:_0x1f7f49[_0xfbbd('0x1c')];var _0x254f49=_0x4f534e?_0x1dc389['count']:_0x1f7f49['offset']+_0x1f7f49['limit'];var _0x11eb6d;if(_0x254f49>=_0x301b12){_0x254f49=_0x301b12;_0x11eb6d=0xc8;}else{_0x11eb6d=0xce;}_0x33a362['status'](_0x11eb6d);return _0x33a362['set'](_0xfbbd('0x20'),_0x218400+'-'+_0x254f49+'/'+_0x301b12)[_0xfbbd('0x1b')](_0x1dc389);}return null;};}function patchUpdates(_0x3e06ae){return function(_0x5d33a6){try{jsonpatch['apply'](_0x5d33a6,_0x3e06ae,!![]);}catch(_0x1577c3){return BPromise[_0xfbbd('0x21')](_0x1577c3);}return _0x5d33a6['save']();};}function saveUpdates(_0x59db91,_0x5b4d32){return function(_0x4d95c4){if(_0x4d95c4){return _0x4d95c4['update'](_0x59db91)[_0xfbbd('0x22')](function(_0x4e447a){return _0x4e447a;});}return null;};}function removeEntity(_0x204c03,_0x2650c6){return function(_0x148d21){if(_0x148d21){return _0x148d21['destroy']()[_0xfbbd('0x22')](function(){_0x204c03['status'](0xcc)[_0xfbbd('0x1a')]();});}};}function handleEntityNotFound(_0x31fcf6,_0x1f9908){return function(_0x55e64f){if(!_0x55e64f){_0x31fcf6[_0xfbbd('0x18')](0x194);}return _0x55e64f;};}function handleError(_0x4daa04,_0x25be57){_0x25be57=_0x25be57||0x1f4;return function(_0x48d3cb){logger[_0xfbbd('0x23')](_0x48d3cb[_0xfbbd('0x24')]);if(_0x48d3cb[_0xfbbd('0x25')]){delete _0x48d3cb[_0xfbbd('0x25')];}_0x4daa04[_0xfbbd('0x19')](_0x25be57)['send'](_0x48d3cb);};}exports['index']=function(_0x2541c8,_0x5bd48d){var _0x427d4a={},_0x2bdabb={},_0x2db4f6={'count':0x0,'rows':[]};var _0x1656be=_[_0xfbbd('0x26')](db[_0xfbbd('0x27')]['rawAttributes'],function(_0x18644b){return{'name':_0x18644b[_0xfbbd('0x28')],'type':_0x18644b[_0xfbbd('0x29')][_0xfbbd('0x2a')]};});_0x2bdabb[_0xfbbd('0x2b')]=_[_0xfbbd('0x26')](_0x1656be,_0xfbbd('0x25'));_0x2bdabb[_0xfbbd('0x2c')]=_[_0xfbbd('0x2d')](_0x2541c8[_0xfbbd('0x2c')]);_0x2bdabb[_0xfbbd('0x2e')]=_[_0xfbbd('0x2f')](_0x2bdabb[_0xfbbd('0x2b')],_0x2bdabb[_0xfbbd('0x2c')]);_0x427d4a[_0xfbbd('0x30')]=_[_0xfbbd('0x2f')](_0x2bdabb[_0xfbbd('0x2b')],qs[_0xfbbd('0x31')](_0x2541c8[_0xfbbd('0x2c')][_0xfbbd('0x31')]));_0x427d4a[_0xfbbd('0x30')]=_0x427d4a[_0xfbbd('0x30')][_0xfbbd('0x32')]?_0x427d4a['attributes']:_0x2bdabb[_0xfbbd('0x2b')];if(!_0x2541c8['query'][_0xfbbd('0x33')]('nolimit')){_0x427d4a['limit']=qs[_0xfbbd('0x1e')](_0x2541c8[_0xfbbd('0x2c')]['limit']);_0x427d4a[_0xfbbd('0x1c')]=qs[_0xfbbd('0x1c')](_0x2541c8[_0xfbbd('0x2c')]['offset']);}_0x427d4a['order']=qs[_0xfbbd('0x34')](_0x2541c8[_0xfbbd('0x2c')][_0xfbbd('0x34')]);_0x427d4a[_0xfbbd('0x35')]=qs[_0xfbbd('0x2e')](_[_0xfbbd('0x36')](_0x2541c8[_0xfbbd('0x2c')],_0x2bdabb[_0xfbbd('0x2e')]),_0x1656be);if(_0x2541c8[_0xfbbd('0x2c')][_0xfbbd('0x37')]){_0x427d4a['where']=_[_0xfbbd('0x38')](_0x427d4a['where'],{'$or':_[_0xfbbd('0x26')](_0x1656be,function(_0x127143){if(_0x127143['type']!==_0xfbbd('0x39')){var _0x37d675={};_0x37d675[_0x127143['name']]={'$like':'%'+_0x2541c8[_0xfbbd('0x2c')][_0xfbbd('0x37')]+'%'};return _0x37d675;}})});}_0x427d4a=_[_0xfbbd('0x38')]({},_0x427d4a,_0x2541c8[_0xfbbd('0x3a')]);var _0x36bae5={'where':_0x427d4a[_0xfbbd('0x35')]};return db[_0xfbbd('0x27')]['count'](_0x36bae5)['then'](function(_0x56aa5b){_0x2db4f6[_0xfbbd('0x1f')]=_0x56aa5b;if(_0x2541c8[_0xfbbd('0x2c')][_0xfbbd('0x3b')]){_0x427d4a[_0xfbbd('0x3c')]=[{'all':!![]}];}return db[_0xfbbd('0x27')][_0xfbbd('0x3d')](_0x427d4a);})[_0xfbbd('0x22')](function(_0x250cbf){_0x2db4f6[_0xfbbd('0x3e')]=_0x250cbf;return _0x2db4f6;})[_0xfbbd('0x22')](respondWithFilteredResult(_0x5bd48d,_0x427d4a))[_0xfbbd('0x3f')](handleError(_0x5bd48d,null));};exports[_0xfbbd('0x40')]=function(_0x2e232d,_0x3501ef){var _0x312685={'raw':![],'where':{'id':_0x2e232d[_0xfbbd('0x41')]['id']}},_0x29aaa7={};_0x29aaa7[_0xfbbd('0x2b')]=_[_0xfbbd('0x2d')](db[_0xfbbd('0x27')][_0xfbbd('0x42')]);_0x29aaa7[_0xfbbd('0x2c')]=_[_0xfbbd('0x2d')](_0x2e232d[_0xfbbd('0x2c')]);_0x29aaa7[_0xfbbd('0x2e')]=_['intersection'](_0x29aaa7[_0xfbbd('0x2b')],_0x29aaa7[_0xfbbd('0x2c')]);_0x312685[_0xfbbd('0x30')]=_[_0xfbbd('0x2f')](_0x29aaa7['model'],qs['fields'](_0x2e232d['query'][_0xfbbd('0x31')]));_0x312685[_0xfbbd('0x30')]=_0x312685[_0xfbbd('0x30')][_0xfbbd('0x32')]?_0x312685[_0xfbbd('0x30')]:_0x29aaa7[_0xfbbd('0x2b')];if(_0x2e232d['query'][_0xfbbd('0x3b')]){_0x312685[_0xfbbd('0x3c')]=[{'all':!![]}];}_0x312685=_[_0xfbbd('0x38')]({},_0x312685,_0x2e232d[_0xfbbd('0x3a')]);return db[_0xfbbd('0x27')][_0xfbbd('0x43')](_0x312685)[_0xfbbd('0x22')](handleEntityNotFound(_0x3501ef,null))[_0xfbbd('0x22')](respondWithResult(_0x3501ef,null))[_0xfbbd('0x3f')](handleError(_0x3501ef,null));};exports['create']=function(_0x212624,_0x12238e){return db[_0xfbbd('0x27')][_0xfbbd('0x44')](_0x212624['body'],{})[_0xfbbd('0x22')](respondWithResult(_0x12238e,0xc9))[_0xfbbd('0x3f')](handleError(_0x12238e,null));};exports[_0xfbbd('0x45')]=function(_0xf29754,_0xf902b5){if(_0xf29754[_0xfbbd('0x46')]['id']){delete _0xf29754['body']['id'];}return db[_0xfbbd('0x27')][_0xfbbd('0x43')]({'where':{'id':_0xf29754[_0xfbbd('0x41')]['id']}})['then'](handleEntityNotFound(_0xf902b5,null))[_0xfbbd('0x22')](saveUpdates(_0xf29754[_0xfbbd('0x46')],null))[_0xfbbd('0x22')](respondWithResult(_0xf902b5,null))['catch'](handleError(_0xf902b5,null));};exports['destroy']=function(_0x4171b7,_0x2d2ccc){return db[_0xfbbd('0x27')][_0xfbbd('0x43')]({'where':{'id':_0x4171b7[_0xfbbd('0x41')]['id']}})[_0xfbbd('0x22')](handleEntityNotFound(_0x2d2ccc,null))[_0xfbbd('0x22')](removeEntity(_0x2d2ccc,null))['catch'](handleError(_0x2d2ccc,null));};exports[_0xfbbd('0x47')]=function(_0x14a921,_0x122f11,_0x1a07d6){var _0x2704db={};var _0x4887fc={};var _0x38758b;var _0x2ed7f0;return db[_0xfbbd('0x27')]['findOne']({'where':{'id':_0x14a921['params']['id']}})[_0xfbbd('0x22')](handleEntityNotFound(_0x122f11,null))[_0xfbbd('0x22')](function(_0x3a1d4d){if(_0x3a1d4d){_0x38758b=_0x3a1d4d;_0x4887fc[_0xfbbd('0x2b')]=_['keys'](db['ServicenowField'][_0xfbbd('0x42')]);_0x4887fc[_0xfbbd('0x2c')]=_['keys'](_0x14a921[_0xfbbd('0x2c')]);_0x4887fc['filters']=_['intersection'](_0x4887fc['model'],_0x4887fc[_0xfbbd('0x2c')]);_0x2704db['attributes']=_['intersection'](_0x4887fc[_0xfbbd('0x2b')],qs[_0xfbbd('0x31')](_0x14a921[_0xfbbd('0x2c')]['fields']));_0x2704db[_0xfbbd('0x30')]=_0x2704db['attributes']['length']?_0x2704db['attributes']:_0x4887fc[_0xfbbd('0x2b')];_0x2704db[_0xfbbd('0x48')]=qs[_0xfbbd('0x34')](_0x14a921['query']['sort']);_0x2704db['where']=qs[_0xfbbd('0x2e')](_['pick'](_0x14a921[_0xfbbd('0x2c')],_0x4887fc[_0xfbbd('0x2e')]));if(_0x14a921[_0xfbbd('0x2c')][_0xfbbd('0x37')]){_0x2704db[_0xfbbd('0x35')]=_[_0xfbbd('0x38')](_0x2704db[_0xfbbd('0x35')],{'$or':_['map'](_0x2704db[_0xfbbd('0x30')],function(_0x48152b){var _0x4aafed={};_0x4aafed[_0x48152b]={'$like':'%'+_0x14a921['query'][_0xfbbd('0x37')]+'%'};return _0x4aafed;})});}_0x2704db=_['merge']({},_0x2704db,_0x14a921[_0xfbbd('0x3a')]);return _0x38758b[_0xfbbd('0x47')](_0x2704db);}})[_0xfbbd('0x22')](function(_0x129854){if(_0x129854){_0x2ed7f0=_0x129854[_0xfbbd('0x32')];if(!_0x14a921[_0xfbbd('0x2c')]['hasOwnProperty'](_0xfbbd('0x49'))){_0x2704db[_0xfbbd('0x1e')]=qs['limit'](_0x14a921[_0xfbbd('0x2c')]['limit']);_0x2704db[_0xfbbd('0x1c')]=qs[_0xfbbd('0x1c')](_0x14a921[_0xfbbd('0x2c')][_0xfbbd('0x1c')]);}return _0x38758b['getFields'](_0x2704db);}})[_0xfbbd('0x22')](function(_0x5a4583){if(_0x5a4583){return _0x5a4583?{'count':_0x2ed7f0,'rows':_0x5a4583}:null;}})[_0xfbbd('0x22')](respondWithResult(_0x122f11,null))[_0xfbbd('0x3f')](handleError(_0x122f11,null));};exports['getSubjects']=function(_0xdffdb7,_0x42223a,_0x395418){var _0x1b9a96={};var _0x5e5a6f={};var _0x3b3bf5;var _0x297fe6;return db[_0xfbbd('0x27')]['findOne']({'where':{'id':_0xdffdb7['params']['id']}})[_0xfbbd('0x22')](handleEntityNotFound(_0x42223a,null))[_0xfbbd('0x22')](function(_0x1df2bf){if(_0x1df2bf){_0x3b3bf5=_0x1df2bf;_0x5e5a6f[_0xfbbd('0x2b')]=_['keys'](db[_0xfbbd('0x4a')]['rawAttributes']);_0x5e5a6f[_0xfbbd('0x2c')]=_['keys'](_0xdffdb7[_0xfbbd('0x2c')]);_0x5e5a6f[_0xfbbd('0x2e')]=_['intersection'](_0x5e5a6f['model'],_0x5e5a6f[_0xfbbd('0x2c')]);_0x1b9a96['attributes']=_[_0xfbbd('0x2f')](_0x5e5a6f[_0xfbbd('0x2b')],qs['fields'](_0xdffdb7[_0xfbbd('0x2c')][_0xfbbd('0x31')]));_0x1b9a96[_0xfbbd('0x30')]=_0x1b9a96[_0xfbbd('0x30')][_0xfbbd('0x32')]?_0x1b9a96[_0xfbbd('0x30')]:_0x5e5a6f[_0xfbbd('0x2b')];_0x1b9a96[_0xfbbd('0x48')]=qs[_0xfbbd('0x34')](_0xdffdb7['query'][_0xfbbd('0x34')]);_0x1b9a96[_0xfbbd('0x35')]=qs['filters'](_[_0xfbbd('0x36')](_0xdffdb7[_0xfbbd('0x2c')],_0x5e5a6f[_0xfbbd('0x2e')]));if(_0xdffdb7['query'][_0xfbbd('0x37')]){_0x1b9a96[_0xfbbd('0x35')]=_[_0xfbbd('0x38')](_0x1b9a96[_0xfbbd('0x35')],{'$or':_[_0xfbbd('0x26')](_0x1b9a96[_0xfbbd('0x30')],function(_0x7d755b){var _0x5b85f6={};_0x5b85f6[_0x7d755b]={'$like':'%'+_0xdffdb7[_0xfbbd('0x2c')][_0xfbbd('0x37')]+'%'};return _0x5b85f6;})});}_0x1b9a96=_[_0xfbbd('0x38')]({},_0x1b9a96,_0xdffdb7['options']);return _0x3b3bf5[_0xfbbd('0x4b')](_0x1b9a96);}})[_0xfbbd('0x22')](function(_0x4b8e01){if(_0x4b8e01){_0x297fe6=_0x4b8e01['length'];if(!_0xdffdb7[_0xfbbd('0x2c')][_0xfbbd('0x33')]('nolimit')){_0x1b9a96[_0xfbbd('0x1e')]=qs['limit'](_0xdffdb7[_0xfbbd('0x2c')][_0xfbbd('0x1e')]);_0x1b9a96[_0xfbbd('0x1c')]=qs[_0xfbbd('0x1c')](_0xdffdb7[_0xfbbd('0x2c')][_0xfbbd('0x1c')]);}return _0x3b3bf5[_0xfbbd('0x4b')](_0x1b9a96);}})['then'](function(_0x1edddf){if(_0x1edddf){return _0x1edddf?{'count':_0x297fe6,'rows':_0x1edddf}:null;}})[_0xfbbd('0x22')](respondWithResult(_0x42223a,null))[_0xfbbd('0x3f')](handleError(_0x42223a,null));};exports[_0xfbbd('0x4c')]=function(_0x1f14f3,_0x40510a,_0x37db4c){var _0x5dffba={};var _0x1db7c7={};var _0x3c0f4d;var _0x484580;return db['ServicenowConfiguration'][_0xfbbd('0x4d')]({'where':{'id':_0x1f14f3['params']['id']}})[_0xfbbd('0x22')](handleEntityNotFound(_0x40510a,null))[_0xfbbd('0x22')](function(_0x4e37ad){if(_0x4e37ad){_0x3c0f4d=_0x4e37ad;_0x1db7c7[_0xfbbd('0x2b')]=_[_0xfbbd('0x2d')](db['ServicenowField'][_0xfbbd('0x42')]);_0x1db7c7[_0xfbbd('0x2c')]=_[_0xfbbd('0x2d')](_0x1f14f3[_0xfbbd('0x2c')]);_0x1db7c7[_0xfbbd('0x2e')]=_['intersection'](_0x1db7c7[_0xfbbd('0x2b')],_0x1db7c7[_0xfbbd('0x2c')]);_0x5dffba[_0xfbbd('0x30')]=_[_0xfbbd('0x2f')](_0x1db7c7['model'],qs[_0xfbbd('0x31')](_0x1f14f3['query'][_0xfbbd('0x31')]));_0x5dffba['attributes']=_0x5dffba[_0xfbbd('0x30')][_0xfbbd('0x32')]?_0x5dffba[_0xfbbd('0x30')]:_0x1db7c7['model'];_0x5dffba[_0xfbbd('0x48')]=qs[_0xfbbd('0x34')](_0x1f14f3[_0xfbbd('0x2c')][_0xfbbd('0x34')]);_0x5dffba[_0xfbbd('0x35')]=qs['filters'](_['pick'](_0x1f14f3['query'],_0x1db7c7[_0xfbbd('0x2e')]));if(_0x1f14f3['query'][_0xfbbd('0x37')]){_0x5dffba[_0xfbbd('0x35')]=_[_0xfbbd('0x38')](_0x5dffba[_0xfbbd('0x35')],{'$or':_[_0xfbbd('0x26')](_0x5dffba['attributes'],function(_0x106670){var _0x28dcf7={};_0x28dcf7[_0x106670]={'$like':'%'+_0x1f14f3[_0xfbbd('0x2c')][_0xfbbd('0x37')]+'%'};return _0x28dcf7;})});}_0x5dffba=_['merge']({},_0x5dffba,_0x1f14f3[_0xfbbd('0x3a')]);return _0x3c0f4d[_0xfbbd('0x4c')](_0x5dffba);}})[_0xfbbd('0x22')](function(_0x4ca8d8){if(_0x4ca8d8){_0x484580=_0x4ca8d8['length'];if(!_0x1f14f3[_0xfbbd('0x2c')]['hasOwnProperty']('nolimit')){_0x5dffba[_0xfbbd('0x1e')]=qs[_0xfbbd('0x1e')](_0x1f14f3[_0xfbbd('0x2c')][_0xfbbd('0x1e')]);_0x5dffba[_0xfbbd('0x1c')]=qs['offset'](_0x1f14f3[_0xfbbd('0x2c')][_0xfbbd('0x1c')]);}return _0x3c0f4d[_0xfbbd('0x4c')](_0x5dffba);}})[_0xfbbd('0x22')](function(_0x1af07f){if(_0x1af07f){return _0x1af07f?{'count':_0x484580,'rows':_0x1af07f}:null;}})['then'](respondWithResult(_0x40510a,null))[_0xfbbd('0x3f')](handleError(_0x40510a,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index ce91960..f6574a7 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 _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 +var _0x19c3=['bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger','api'];(function(_0x420b24,_0x382adc){var _0x4da552=function(_0x4e1623){while(--_0x4e1623){_0x420b24['push'](_0x420b24['shift']());}};_0x4da552(++_0x382adc);}(_0x19c3,0xf9));var _0x319c=function(_0x20e843,_0x270961){_0x20e843=_0x20e843-0x0;var _0x4c7d4e=_0x19c3[_0x20e843];return _0x4c7d4e;};'use strict';var _=require(_0x319c('0x0'));var util=require('util');var logger=require(_0x319c('0x1'))(_0x319c('0x2'));var moment=require('moment');var BPromise=require(_0x319c('0x3'));var rp=require(_0x319c('0x4'));var fs=require('fs');var path=require(_0x319c('0x5'));var rimraf=require(_0x319c('0x6'));var config=require(_0x319c('0x7'));var attributes=require(_0x319c('0x8'));module['exports']=function(_0x20f77e,_0x53a1de){return _0x20f77e[_0x319c('0x9')](_0x319c('0xa'),attributes,{'tableName':_0x319c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index f52d9dd..74d595e 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 _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 +var _0x016c=['client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x43b08,_0x15f967){var _0x5e05f4=function(_0x4bb0cb){while(--_0x4bb0cb){_0x43b08['push'](_0x43b08['shift']());}};_0x5e05f4(++_0x15f967);}(_0x016c,0x1da));var _0xc016=function(_0xf8de68,_0x5bbaff){_0xf8de68=_0xf8de68-0x0;var _0x3f8ac6=_0x016c[_0xf8de68];return _0x3f8ac6;};'use strict';var _=require(_0xc016('0x0'));var util=require(_0xc016('0x1'));var moment=require(_0xc016('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc016('0x3'));var db=require(_0xc016('0x4'))['db'];var utils=require(_0xc016('0x5'));var logger=require(_0xc016('0x6'))(_0xc016('0x7'));var config=require(_0xc016('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc016('0x9')][_0xc016('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x385e8e,_0x212e52,_0x5f3185){return new BPromise(function(_0x5077c2,_0x27e2d8){return client[_0xc016('0xb')](_0x385e8e,_0x5f3185)['then'](function(_0x1f89b3){logger[_0xc016('0xc')](_0xc016('0xd'),_0x212e52,_0xc016('0xe'));logger[_0xc016('0xf')](_0xc016('0x10'),_0x212e52,_0xc016('0xe'),JSON['stringify'](_0x1f89b3));if(_0x1f89b3[_0xc016('0x11')]){if(_0x1f89b3[_0xc016('0x11')]['code']===0x1f4){logger[_0xc016('0x11')](_0xc016('0xd'),_0x212e52,_0x1f89b3[_0xc016('0x11')]['message']);return _0x27e2d8(_0x1f89b3['error']['message']);}logger['error'](_0xc016('0xd'),_0x212e52,_0x1f89b3[_0xc016('0x11')][_0xc016('0x12')]);return _0x5077c2(_0x1f89b3['error'][_0xc016('0x12')]);}else{logger[_0xc016('0xc')](_0xc016('0xd'),_0x212e52,_0xc016('0xe'));_0x5077c2(_0x1f89b3[_0xc016('0x13')][_0xc016('0x12')]);}})[_0xc016('0x14')](function(_0xaeb15b){logger[_0xc016('0x11')](_0xc016('0xd'),_0x212e52,_0xaeb15b);_0x27e2d8(_0xaeb15b);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index c9b627c..2a61684 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 _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 +var _0xbce8=['get','index','isAuthenticated','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbce8,0x1bb));var _0x8bce=function(_0x24a88e,_0x22a0b8){_0x24a88e=_0x24a88e-0x0;var _0x232cbb=_0xbce8[_0x24a88e];return _0x232cbb;};'use strict';var multer=require(_0x8bce('0x0'));var util=require(_0x8bce('0x1'));var path=require('path');var timeout=require(_0x8bce('0x2'));var express=require('express');var router=express[_0x8bce('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8bce('0x4'));var interaction=require(_0x8bce('0x5'));var config=require('../../config/environment');var controller=require(_0x8bce('0x6'));router[_0x8bce('0x7')]('/',auth['isAuthenticated'](),controller[_0x8bce('0x8')]);router[_0x8bce('0x7')]('/:id',auth[_0x8bce('0x9')](),controller['show']);router[_0x8bce('0xa')]('/',auth[_0x8bce('0x9')](),controller[_0x8bce('0xb')]);router[_0x8bce('0xc')](_0x8bce('0xd'),auth[_0x8bce('0x9')](),controller[_0x8bce('0xe')]);router[_0x8bce('0xf')]('/:id',auth[_0x8bce('0x9')](),controller[_0x8bce('0x10')]);module[_0x8bce('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 10e0ce8..700878a 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 _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 +var _0x4a14=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x15e2f6,_0x464c0e){var _0x28b533=function(_0x5b811c){while(--_0x5b811c){_0x15e2f6['push'](_0x15e2f6['shift']());}};_0x28b533(++_0x464c0e);}(_0x4a14,0x6e));var _0x44a1=function(_0x5b2b2b,_0x2ac388){_0x5b2b2b=_0x5b2b2b-0x0;var _0xb50b9c=_0x4a14[_0x5b2b2b];return _0xb50b9c;};'use strict';var Sequelize=require(_0x44a1('0x0'));module[_0x44a1('0x1')]={'type':{'type':Sequelize[_0x44a1('0x2')](_0x44a1('0x3'),_0x44a1('0x4'),_0x44a1('0x5'),_0x44a1('0x6'),_0x44a1('0x7')),'defaultValue':_0x44a1('0x3')},'content':{'type':Sequelize[_0x44a1('0x8')]},'key':{'type':Sequelize[_0x44a1('0x8')]},'keyType':{'type':Sequelize[_0x44a1('0x2')]('string',_0x44a1('0x4'),_0x44a1('0x5'))},'keyContent':{'type':Sequelize[_0x44a1('0x8')]},'idField':{'type':Sequelize[_0x44a1('0x8')]},'nameField':{'type':Sequelize[_0x44a1('0x8')]},'customField':{'type':Sequelize[_0x44a1('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x44a1('0x8')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index c51cf7d..ad538e5 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 _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 +var _0x26f5=['params','rawAttributes','include','options','create','update','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','stack','name','map','ServicenowField','fieldName','type','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show'];(function(_0x1c0f99,_0x52c12e){var _0x5bbd75=function(_0x5b7c95){while(--_0x5b7c95){_0x1c0f99['push'](_0x1c0f99['shift']());}};_0x5bbd75(++_0x52c12e);}(_0x26f5,0xe3));var _0x526f=function(_0x4d8f90,_0x4a8339){_0x4d8f90=_0x4d8f90-0x0;var _0x498e30=_0x26f5[_0x4d8f90];return _0x498e30;};'use strict';var emlformat=require(_0x526f('0x0'));var rimraf=require(_0x526f('0x1'));var zipdir=require(_0x526f('0x2'));var jsonpatch=require(_0x526f('0x3'));var rp=require('request-promise');var moment=require(_0x526f('0x4'));var BPromise=require(_0x526f('0x5'));var Mustache=require('mustache');var util=require(_0x526f('0x6'));var path=require(_0x526f('0x7'));var sox=require(_0x526f('0x8'));var csv=require(_0x526f('0x9'));var ejs=require(_0x526f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x526f('0xb'));var squel=require('squel');var crypto=require(_0x526f('0xc'));var jsforce=require(_0x526f('0xd'));var deskjs=require(_0x526f('0xe'));var toCsv=require(_0x526f('0x9'));var querystring=require('querystring');var Papa=require(_0x526f('0xf'));var Redis=require(_0x526f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x526f('0x11'));var as=require(_0x526f('0x12'));var hardwareService=require(_0x526f('0x13'));var logger=require(_0x526f('0x14'))(_0x526f('0x15'));var utils=require(_0x526f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x526f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5729c7,_0x44b115){_0x44b115=_0x44b115||0xcc;return function(_0x175945){if(_0x175945){return _0x5729c7[_0x526f('0x18')](_0x44b115);}return _0x5729c7[_0x526f('0x19')](_0x44b115)[_0x526f('0x1a')]();};}function respondWithResult(_0x5cb118,_0x5e8b35){_0x5e8b35=_0x5e8b35||0xc8;return function(_0x23bfe4){if(_0x23bfe4){return _0x5cb118[_0x526f('0x19')](_0x5e8b35)[_0x526f('0x1b')](_0x23bfe4);}};}function respondWithFilteredResult(_0x34413c,_0x462115){return function(_0x48a702){if(_0x48a702){var _0x510676=typeof _0x462115['offset']===_0x526f('0x1c')&&typeof _0x462115[_0x526f('0x1d')]==='undefined';var _0x570a51=_0x48a702['count'];var _0x39f044=_0x510676?0x0:_0x462115['offset'];var _0x190844=_0x510676?_0x48a702[_0x526f('0x1e')]:_0x462115[_0x526f('0x1f')]+_0x462115[_0x526f('0x1d')];var _0x588971;if(_0x190844>=_0x570a51){_0x190844=_0x570a51;_0x588971=0xc8;}else{_0x588971=0xce;}_0x34413c['status'](_0x588971);return _0x34413c[_0x526f('0x20')](_0x526f('0x21'),_0x39f044+'-'+_0x190844+'/'+_0x570a51)['json'](_0x48a702);}return null;};}function patchUpdates(_0x3c8420){return function(_0x4d1aba){try{jsonpatch['apply'](_0x4d1aba,_0x3c8420,!![]);}catch(_0x1dcf85){return BPromise[_0x526f('0x22')](_0x1dcf85);}return _0x4d1aba[_0x526f('0x23')]();};}function saveUpdates(_0x221c4d,_0x21171f){return function(_0x28d5bf){if(_0x28d5bf){return _0x28d5bf['update'](_0x221c4d)[_0x526f('0x24')](function(_0x396176){return _0x396176;});}return null;};}function removeEntity(_0x2ef807,_0x4f80f1){return function(_0x44c9fb){if(_0x44c9fb){return _0x44c9fb[_0x526f('0x25')]()[_0x526f('0x24')](function(){_0x2ef807[_0x526f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a5182,_0x44ee58){return function(_0x49bae6){if(!_0x49bae6){_0x3a5182['sendStatus'](0x194);}return _0x49bae6;};}function handleError(_0x7b2b4e,_0x55f846){_0x55f846=_0x55f846||0x1f4;return function(_0x590118){logger['error'](_0x590118[_0x526f('0x26')]);if(_0x590118[_0x526f('0x27')]){delete _0x590118[_0x526f('0x27')];}_0x7b2b4e[_0x526f('0x19')](_0x55f846)['send'](_0x590118);};}exports['index']=function(_0x346d0a,_0x3f5927){var _0x227e31={},_0x51bd30={},_0x5306ca={'count':0x0,'rows':[]};var _0x5e6a4e=_[_0x526f('0x28')](db[_0x526f('0x29')]['rawAttributes'],function(_0x3dc2fc){return{'name':_0x3dc2fc[_0x526f('0x2a')],'type':_0x3dc2fc[_0x526f('0x2b')]['key']};});_0x51bd30[_0x526f('0x2c')]=_[_0x526f('0x28')](_0x5e6a4e,'name');_0x51bd30[_0x526f('0x2d')]=_[_0x526f('0x2e')](_0x346d0a[_0x526f('0x2d')]);_0x51bd30[_0x526f('0x2f')]=_['intersection'](_0x51bd30[_0x526f('0x2c')],_0x51bd30[_0x526f('0x2d')]);_0x227e31['attributes']=_['intersection'](_0x51bd30[_0x526f('0x2c')],qs[_0x526f('0x30')](_0x346d0a[_0x526f('0x2d')]['fields']));_0x227e31['attributes']=_0x227e31[_0x526f('0x31')][_0x526f('0x32')]?_0x227e31['attributes']:_0x51bd30['model'];if(!_0x346d0a[_0x526f('0x2d')][_0x526f('0x33')](_0x526f('0x34'))){_0x227e31['limit']=qs[_0x526f('0x1d')](_0x346d0a[_0x526f('0x2d')]['limit']);_0x227e31[_0x526f('0x1f')]=qs[_0x526f('0x1f')](_0x346d0a[_0x526f('0x2d')][_0x526f('0x1f')]);}_0x227e31[_0x526f('0x35')]=qs[_0x526f('0x36')](_0x346d0a[_0x526f('0x2d')][_0x526f('0x36')]);_0x227e31[_0x526f('0x37')]=qs['filters'](_[_0x526f('0x38')](_0x346d0a[_0x526f('0x2d')],_0x51bd30[_0x526f('0x2f')]),_0x5e6a4e);if(_0x346d0a[_0x526f('0x2d')][_0x526f('0x39')]){_0x227e31[_0x526f('0x37')]=_[_0x526f('0x3a')](_0x227e31['where'],{'$or':_[_0x526f('0x28')](_0x5e6a4e,function(_0x330a82){if(_0x330a82[_0x526f('0x2b')]!==_0x526f('0x3b')){var _0x2435fc={};_0x2435fc[_0x330a82[_0x526f('0x27')]]={'$like':'%'+_0x346d0a[_0x526f('0x2d')][_0x526f('0x39')]+'%'};return _0x2435fc;}})});}_0x227e31=_[_0x526f('0x3a')]({},_0x227e31,_0x346d0a['options']);var _0x12ba6b={'where':_0x227e31[_0x526f('0x37')]};return db[_0x526f('0x29')][_0x526f('0x1e')](_0x12ba6b)[_0x526f('0x24')](function(_0x26fcfd){_0x5306ca[_0x526f('0x1e')]=_0x26fcfd;if(_0x346d0a[_0x526f('0x2d')][_0x526f('0x3c')]){_0x227e31['include']=[{'all':!![]}];}return db['ServicenowField'][_0x526f('0x3d')](_0x227e31);})[_0x526f('0x24')](function(_0x10bb8e){_0x5306ca[_0x526f('0x3e')]=_0x10bb8e;return _0x5306ca;})['then'](respondWithFilteredResult(_0x3f5927,_0x227e31))[_0x526f('0x3f')](handleError(_0x3f5927,null));};exports[_0x526f('0x40')]=function(_0x33006b,_0x4395fb){var _0x111da1={'raw':!![],'where':{'id':_0x33006b[_0x526f('0x41')]['id']}},_0x590f8f={};_0x590f8f[_0x526f('0x2c')]=_[_0x526f('0x2e')](db[_0x526f('0x29')][_0x526f('0x42')]);_0x590f8f[_0x526f('0x2d')]=_[_0x526f('0x2e')](_0x33006b[_0x526f('0x2d')]);_0x590f8f['filters']=_['intersection'](_0x590f8f['model'],_0x590f8f[_0x526f('0x2d')]);_0x111da1[_0x526f('0x31')]=_['intersection'](_0x590f8f[_0x526f('0x2c')],qs[_0x526f('0x30')](_0x33006b[_0x526f('0x2d')]['fields']));_0x111da1[_0x526f('0x31')]=_0x111da1[_0x526f('0x31')][_0x526f('0x32')]?_0x111da1[_0x526f('0x31')]:_0x590f8f[_0x526f('0x2c')];if(_0x33006b[_0x526f('0x2d')][_0x526f('0x3c')]){_0x111da1[_0x526f('0x43')]=[{'all':!![]}];}_0x111da1=_['merge']({},_0x111da1,_0x33006b[_0x526f('0x44')]);return db['ServicenowField']['find'](_0x111da1)['then'](handleEntityNotFound(_0x4395fb,null))[_0x526f('0x24')](respondWithResult(_0x4395fb,null))['catch'](handleError(_0x4395fb,null));};exports[_0x526f('0x45')]=function(_0x58d7be,_0x11eeb4){return db['ServicenowField'][_0x526f('0x45')](_0x58d7be['body'],{})[_0x526f('0x24')](respondWithResult(_0x11eeb4,0xc9))[_0x526f('0x3f')](handleError(_0x11eeb4,null));};exports[_0x526f('0x46')]=function(_0x38f9c0,_0x1dbdf6){if(_0x38f9c0[_0x526f('0x47')]['id']){delete _0x38f9c0['body']['id'];}return db[_0x526f('0x29')][_0x526f('0x48')]({'where':{'id':_0x38f9c0[_0x526f('0x41')]['id']}})['then'](handleEntityNotFound(_0x1dbdf6,null))[_0x526f('0x24')](saveUpdates(_0x38f9c0['body'],null))[_0x526f('0x24')](respondWithResult(_0x1dbdf6,null))[_0x526f('0x3f')](handleError(_0x1dbdf6,null));};exports[_0x526f('0x25')]=function(_0x5b0e73,_0x5b04c9){return db['ServicenowField'][_0x526f('0x48')]({'where':{'id':_0x5b0e73[_0x526f('0x41')]['id']}})[_0x526f('0x24')](handleEntityNotFound(_0x5b04c9,null))[_0x526f('0x24')](removeEntity(_0x5b04c9,null))[_0x526f('0x3f')](handleError(_0x5b04c9,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 60a0348..5264ef3 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 _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 +var _0x8338=['define','ServicenowField','int_servicenow_fields','servicenow_unique_index','FieldId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports'];(function(_0x187c00,_0x12e588){var _0xf1162f=function(_0x4eac41){while(--_0x4eac41){_0x187c00['push'](_0x187c00['shift']());}};_0xf1162f(++_0x12e588);}(_0x8338,0xe6));var _0x8833=function(_0x1d6f0d,_0x57817f){_0x1d6f0d=_0x1d6f0d-0x0;var _0x277185=_0x8338[_0x1d6f0d];return _0x277185;};'use strict';var _=require(_0x8833('0x0'));var util=require(_0x8833('0x1'));var logger=require(_0x8833('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8833('0x3'));var rp=require(_0x8833('0x4'));var fs=require('fs');var path=require(_0x8833('0x5'));var rimraf=require(_0x8833('0x6'));var config=require(_0x8833('0x7'));var attributes=require(_0x8833('0x8'));module[_0x8833('0x9')]=function(_0x1c2424,_0x345cf3){return _0x1c2424[_0x8833('0xa')](_0x8833('0xb'),attributes,{'tableName':_0x8833('0xc'),'paranoid':![],'indexes':[{'name':_0x8833('0xd'),'fields':['idField',_0x8833('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 c6215fb..d24cbdd 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 _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 +var _0x0713=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4de168,_0x2f9a41){var _0x4ad68c=function(_0x6f2b55){while(--_0x6f2b55){_0x4de168['push'](_0x4de168['shift']());}};_0x4ad68c(++_0x2f9a41);}(_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')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ServicenowField,\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')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index fbcb769..9617e0b 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(_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 +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(_0x27ff2b,_0x50c13f){var _0xedecaf=function(_0x4808da){while(--_0x4808da){_0x27ff2b['push'](_0x27ff2b['shift']());}};_0xedecaf(++_0x50c13f);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 0cf5029..785a94b 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(_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 +var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x4b9609,_0x21c82f){var _0x4ffb78=function(_0x4223ec){while(--_0x4223ec){_0x4b9609['push'](_0x4b9609['shift']());}};_0x4ffb78(++_0x21c82f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 62093dc..bba43a2 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 _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 +var _0xc2cc=['fast-json-patch','moment','mustache','path','to-csv','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','end','status','limit','undefined','count','offset','set','reject','update','destroy','sendStatus','error','stack','name','map','SugarcrmAccount','rawAttributes','fieldName','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filters','merge','type','VIRTUAL','options','then','includeAll','include','findAll','rows','show','params','find','catch','body','getConfigurations','findOne','SugarcrmConfiguration','pick','filter','nolimit','addConfiguration','AccountId','Subjects','getDescriptions','channel','create','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','date_start','duration_hours','parent_id','parent_type','direction','username','password','remoteUri','slice','lastIndexOf','POST','format','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','%s%s','get_module_fields','stringify','values','remove','includes','label','endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','rimraf','zip-dir'];(function(_0x228d44,_0x2a8722){var _0x1623f7=function(_0x4739b4){while(--_0x4739b4){_0x228d44['push'](_0x228d44['shift']());}};_0x1623f7(++_0x2a8722);}(_0xc2cc,0x70));var _0xcc2c=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc2cc[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcc2c('0x0'));var zipdir=require(_0xcc2c('0x1'));var jsonpatch=require(_0xcc2c('0x2'));var rp=require('request-promise');var moment=require(_0xcc2c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcc2c('0x4'));var util=require('util');var path=require(_0xcc2c('0x5'));var sox=require('sox');var csv=require(_0xcc2c('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcc2c('0x7'));var squel=require('squel');var crypto=require(_0xcc2c('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xcc2c('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcc2c('0xa'));var Redis=require(_0xcc2c('0xb'));var authService=require(_0xcc2c('0xc'));var qs=require(_0xcc2c('0xd'));var as=require(_0xcc2c('0xe'));var hardwareService=require(_0xcc2c('0xf'));var logger=require(_0xcc2c('0x10'))(_0xcc2c('0x11'));var utils=require('../../config/utils');var config=require(_0xcc2c('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xcc2c('0x13'))['db'];var integrations=require(_0xcc2c('0x14'));function respondWithStatusCode(_0x3900a4,_0x1f6f0f){_0x1f6f0f=_0x1f6f0f||0xcc;return function(_0x57d7c1){if(_0x57d7c1){return _0x3900a4['sendStatus'](_0x1f6f0f);}return _0x3900a4['status'](_0x1f6f0f)[_0xcc2c('0x15')]();};}function respondWithResult(_0xc1cafd,_0x5086f2){_0x5086f2=_0x5086f2||0xc8;return function(_0x4ad8a2){if(_0x4ad8a2){return _0xc1cafd[_0xcc2c('0x16')](_0x5086f2)['json'](_0x4ad8a2);}};}function respondWithFilteredResult(_0x18a774,_0x344caa){return function(_0x10a651){if(_0x10a651){var _0x38fb6f=typeof _0x344caa['offset']==='undefined'&&typeof _0x344caa[_0xcc2c('0x17')]===_0xcc2c('0x18');var _0x59185d=_0x10a651[_0xcc2c('0x19')];var _0x285deb=_0x38fb6f?0x0:_0x344caa[_0xcc2c('0x1a')];var _0x2a9f02=_0x38fb6f?_0x10a651[_0xcc2c('0x19')]:_0x344caa[_0xcc2c('0x1a')]+_0x344caa[_0xcc2c('0x17')];var _0x5a1f0a;if(_0x2a9f02>=_0x59185d){_0x2a9f02=_0x59185d;_0x5a1f0a=0xc8;}else{_0x5a1f0a=0xce;}_0x18a774[_0xcc2c('0x16')](_0x5a1f0a);return _0x18a774[_0xcc2c('0x1b')]('Content-Range',_0x285deb+'-'+_0x2a9f02+'/'+_0x59185d)['json'](_0x10a651);}return null;};}function patchUpdates(_0x4a67f4){return function(_0x15bbd6){try{jsonpatch['apply'](_0x15bbd6,_0x4a67f4,!![]);}catch(_0x11ee63){return BPromise[_0xcc2c('0x1c')](_0x11ee63);}return _0x15bbd6['save']();};}function saveUpdates(_0x321279,_0x831360){return function(_0x5c7c53){if(_0x5c7c53){return _0x5c7c53[_0xcc2c('0x1d')](_0x321279)['then'](function(_0x31788d){return _0x31788d;});}return null;};}function removeEntity(_0x5233e3,_0x4d5132){return function(_0x26fd43){if(_0x26fd43){return _0x26fd43[_0xcc2c('0x1e')]()['then'](function(){_0x5233e3[_0xcc2c('0x16')](0xcc)[_0xcc2c('0x15')]();});}};}function handleEntityNotFound(_0x3129d3,_0x98ae06){return function(_0x35f59b){if(!_0x35f59b){_0x3129d3[_0xcc2c('0x1f')](0x194);}return _0x35f59b;};}function handleError(_0x4aeb24,_0xaab877){_0xaab877=_0xaab877||0x1f4;return function(_0x17e528){logger[_0xcc2c('0x20')](_0x17e528[_0xcc2c('0x21')]);if(_0x17e528[_0xcc2c('0x22')]){delete _0x17e528['name'];}_0x4aeb24['status'](_0xaab877)['send'](_0x17e528);};}exports['index']=function(_0x28bb05,_0x168ef6){var _0x406515={},_0x2c4ce9={},_0x3ad1aa={'count':0x0,'rows':[]};var _0x184de4=_[_0xcc2c('0x23')](db[_0xcc2c('0x24')][_0xcc2c('0x25')],function(_0x3cd971){return{'name':_0x3cd971[_0xcc2c('0x26')],'type':_0x3cd971['type'][_0xcc2c('0x27')]};});_0x2c4ce9['model']=_['map'](_0x184de4,'name');_0x2c4ce9[_0xcc2c('0x28')]=_[_0xcc2c('0x29')](_0x28bb05['query']);_0x2c4ce9['filters']=_[_0xcc2c('0x2a')](_0x2c4ce9['model'],_0x2c4ce9[_0xcc2c('0x28')]);_0x406515[_0xcc2c('0x2b')]=_[_0xcc2c('0x2a')](_0x2c4ce9[_0xcc2c('0x2c')],qs[_0xcc2c('0x2d')](_0x28bb05['query']['fields']));_0x406515[_0xcc2c('0x2b')]=_0x406515[_0xcc2c('0x2b')][_0xcc2c('0x2e')]?_0x406515[_0xcc2c('0x2b')]:_0x2c4ce9[_0xcc2c('0x2c')];if(!_0x28bb05['query'][_0xcc2c('0x2f')]('nolimit')){_0x406515[_0xcc2c('0x17')]=qs[_0xcc2c('0x17')](_0x28bb05['query'][_0xcc2c('0x17')]);_0x406515['offset']=qs['offset'](_0x28bb05[_0xcc2c('0x28')]['offset']);}_0x406515[_0xcc2c('0x30')]=qs[_0xcc2c('0x31')](_0x28bb05[_0xcc2c('0x28')]['sort']);_0x406515[_0xcc2c('0x32')]=qs[_0xcc2c('0x33')](_['pick'](_0x28bb05[_0xcc2c('0x28')],_0x2c4ce9['filters']),_0x184de4);if(_0x28bb05[_0xcc2c('0x28')]['filter']){_0x406515[_0xcc2c('0x32')]=_[_0xcc2c('0x34')](_0x406515[_0xcc2c('0x32')],{'$or':_['map'](_0x184de4,function(_0x40509e){if(_0x40509e[_0xcc2c('0x35')]!==_0xcc2c('0x36')){var _0x116afd={};_0x116afd[_0x40509e[_0xcc2c('0x22')]]={'$like':'%'+_0x28bb05[_0xcc2c('0x28')]['filter']+'%'};return _0x116afd;}})});}_0x406515=_[_0xcc2c('0x34')]({},_0x406515,_0x28bb05[_0xcc2c('0x37')]);var _0xd6e808={'where':_0x406515[_0xcc2c('0x32')]};return db['SugarcrmAccount'][_0xcc2c('0x19')](_0xd6e808)[_0xcc2c('0x38')](function(_0x1909fb){_0x3ad1aa[_0xcc2c('0x19')]=_0x1909fb;if(_0x28bb05[_0xcc2c('0x28')][_0xcc2c('0x39')]){_0x406515[_0xcc2c('0x3a')]=[{'all':!![]}];}return db[_0xcc2c('0x24')][_0xcc2c('0x3b')](_0x406515);})[_0xcc2c('0x38')](function(_0x5cd4f4){_0x3ad1aa[_0xcc2c('0x3c')]=_0x5cd4f4;return _0x3ad1aa;})[_0xcc2c('0x38')](respondWithFilteredResult(_0x168ef6,_0x406515))['catch'](handleError(_0x168ef6,null));};exports[_0xcc2c('0x3d')]=function(_0x42d8c0,_0x3be3ed){var _0x3e30bf={'raw':![],'where':{'id':_0x42d8c0[_0xcc2c('0x3e')]['id']}},_0x3a1a80={};_0x3a1a80[_0xcc2c('0x2c')]=_['keys'](db[_0xcc2c('0x24')][_0xcc2c('0x25')]);_0x3a1a80[_0xcc2c('0x28')]=_[_0xcc2c('0x29')](_0x42d8c0[_0xcc2c('0x28')]);_0x3a1a80[_0xcc2c('0x33')]=_[_0xcc2c('0x2a')](_0x3a1a80['model'],_0x3a1a80['query']);_0x3e30bf[_0xcc2c('0x2b')]=_[_0xcc2c('0x2a')](_0x3a1a80[_0xcc2c('0x2c')],qs[_0xcc2c('0x2d')](_0x42d8c0[_0xcc2c('0x28')][_0xcc2c('0x2d')]));_0x3e30bf[_0xcc2c('0x2b')]=_0x3e30bf[_0xcc2c('0x2b')][_0xcc2c('0x2e')]?_0x3e30bf[_0xcc2c('0x2b')]:_0x3a1a80['model'];if(_0x42d8c0[_0xcc2c('0x28')]['includeAll']){_0x3e30bf[_0xcc2c('0x3a')]=[{'all':!![]}];}_0x3e30bf=_[_0xcc2c('0x34')]({},_0x3e30bf,_0x42d8c0['options']);return db[_0xcc2c('0x24')][_0xcc2c('0x3f')](_0x3e30bf)[_0xcc2c('0x38')](handleEntityNotFound(_0x3be3ed,null))[_0xcc2c('0x38')](respondWithResult(_0x3be3ed,null))[_0xcc2c('0x40')](handleError(_0x3be3ed,null));};exports['create']=function(_0x4f50fc,_0x283d10){return db['SugarcrmAccount']['create'](_0x4f50fc['body'],{})[_0xcc2c('0x38')](respondWithResult(_0x283d10,0xc9))['catch'](handleError(_0x283d10,null));};exports['update']=function(_0x55a70f,_0x5a1deb){if(_0x55a70f['body']['id']){delete _0x55a70f['body']['id'];}return db[_0xcc2c('0x24')]['find']({'where':{'id':_0x55a70f[_0xcc2c('0x3e')]['id']}})[_0xcc2c('0x38')](handleEntityNotFound(_0x5a1deb,null))[_0xcc2c('0x38')](saveUpdates(_0x55a70f[_0xcc2c('0x41')],null))['then'](respondWithResult(_0x5a1deb,null))[_0xcc2c('0x40')](handleError(_0x5a1deb,null));};exports[_0xcc2c('0x1e')]=function(_0x259949,_0x2b93a7){return db['SugarcrmAccount'][_0xcc2c('0x3f')]({'where':{'id':_0x259949[_0xcc2c('0x3e')]['id']}})[_0xcc2c('0x38')](handleEntityNotFound(_0x2b93a7,null))[_0xcc2c('0x38')](removeEntity(_0x2b93a7,null))[_0xcc2c('0x40')](handleError(_0x2b93a7,null));};exports[_0xcc2c('0x42')]=function(_0x455f59,_0x19c04e,_0x113660){var _0x298c2d={};var _0x19176e={};var _0x46d7e4;var _0x5de4ce;return db[_0xcc2c('0x24')][_0xcc2c('0x43')]({'where':{'id':_0x455f59[_0xcc2c('0x3e')]['id']}})[_0xcc2c('0x38')](handleEntityNotFound(_0x19c04e,null))['then'](function(_0x43c714){if(_0x43c714){_0x46d7e4=_0x43c714;_0x19176e[_0xcc2c('0x2c')]=_[_0xcc2c('0x29')](db[_0xcc2c('0x44')][_0xcc2c('0x25')]);_0x19176e['query']=_[_0xcc2c('0x29')](_0x455f59[_0xcc2c('0x28')]);_0x19176e[_0xcc2c('0x33')]=_['intersection'](_0x19176e[_0xcc2c('0x2c')],_0x19176e[_0xcc2c('0x28')]);_0x298c2d[_0xcc2c('0x2b')]=_[_0xcc2c('0x2a')](_0x19176e[_0xcc2c('0x2c')],qs['fields'](_0x455f59['query'][_0xcc2c('0x2d')]));_0x298c2d['attributes']=_0x298c2d[_0xcc2c('0x2b')][_0xcc2c('0x2e')]?_0x298c2d['attributes']:_0x19176e[_0xcc2c('0x2c')];_0x298c2d[_0xcc2c('0x30')]=qs[_0xcc2c('0x31')](_0x455f59[_0xcc2c('0x28')][_0xcc2c('0x31')]);_0x298c2d['where']=qs[_0xcc2c('0x33')](_[_0xcc2c('0x45')](_0x455f59[_0xcc2c('0x28')],_0x19176e[_0xcc2c('0x33')]));if(_0x455f59[_0xcc2c('0x28')]['filter']){_0x298c2d[_0xcc2c('0x32')]=_[_0xcc2c('0x34')](_0x298c2d[_0xcc2c('0x32')],{'$or':_['map'](_0x298c2d[_0xcc2c('0x2b')],function(_0x159ddc){var _0x1d9629={};_0x1d9629[_0x159ddc]={'$like':'%'+_0x455f59[_0xcc2c('0x28')][_0xcc2c('0x46')]+'%'};return _0x1d9629;})});}_0x298c2d=_[_0xcc2c('0x34')]({},_0x298c2d,_0x455f59[_0xcc2c('0x37')]);return _0x46d7e4['getConfigurations'](_0x298c2d);}})[_0xcc2c('0x38')](function(_0x4df48e){if(_0x4df48e){_0x5de4ce=_0x4df48e[_0xcc2c('0x2e')];if(!_0x455f59[_0xcc2c('0x28')][_0xcc2c('0x2f')](_0xcc2c('0x47'))){_0x298c2d[_0xcc2c('0x17')]=qs[_0xcc2c('0x17')](_0x455f59[_0xcc2c('0x28')][_0xcc2c('0x17')]);_0x298c2d[_0xcc2c('0x1a')]=qs['offset'](_0x455f59[_0xcc2c('0x28')][_0xcc2c('0x1a')]);}return _0x46d7e4['getConfigurations'](_0x298c2d);}})[_0xcc2c('0x38')](function(_0x432094){if(_0x432094){return _0x432094?{'count':_0x5de4ce,'rows':_0x432094}:null;}})['then'](respondWithResult(_0x19c04e,null))[_0xcc2c('0x40')](handleError(_0x19c04e,null));};exports[_0xcc2c('0x48')]=function(_0x1c6630,_0x1c99b4,_0x3902bb){if(_0x1c6630[_0xcc2c('0x41')]['id']){delete _0x1c6630[_0xcc2c('0x41')]['id'];}return db[_0xcc2c('0x24')][_0xcc2c('0x43')]({'where':{'id':_0x1c6630['params']['id']}})['then'](handleEntityNotFound(_0x1c99b4,null))[_0xcc2c('0x38')](function(_0x1c6b2e){if(_0x1c6b2e){_0x1c6630[_0xcc2c('0x41')][_0xcc2c('0x49')]=_0x1c6b2e['id'];_0x1c6630[_0xcc2c('0x41')][_0xcc2c('0x4a')]=integrations['getSubjects'](_0x1c6630[_0xcc2c('0x41')]['channel'],_0x1c6630['body'][_0xcc2c('0x35')]);_0x1c6630[_0xcc2c('0x41')]['Descriptions']=integrations[_0xcc2c('0x4b')](_0x1c6630[_0xcc2c('0x41')][_0xcc2c('0x4c')],_0x1c6630[_0xcc2c('0x41')][_0xcc2c('0x35')]);return db[_0xcc2c('0x44')][_0xcc2c('0x4d')](_0x1c6630[_0xcc2c('0x41')],{'include':[{'model':db['SugarcrmField'],'as':_0xcc2c('0x4a')},{'model':db[_0xcc2c('0x4e')],'as':_0xcc2c('0x4f')}]});}return null;})[_0xcc2c('0x38')](respondWithResult(_0x1c99b4,null))['catch'](handleError(_0x1c99b4,null));};exports[_0xcc2c('0x50')]=function(_0x22daa3,_0x585164,_0x5ea133){var _0x1fc9d8='';var _0x1e8121=['id','name',_0xcc2c('0x51'),_0xcc2c('0x52'),'description',_0xcc2c('0x53'),_0xcc2c('0x54'),'duration_minutes',_0xcc2c('0x55'),_0xcc2c('0x56'),'parent_name',_0xcc2c('0x57')];return db['SugarcrmAccount']['findOne']({'where':{'id':_0x22daa3['params']['id']},'attributes':['id',_0xcc2c('0x58'),_0xcc2c('0x59'),_0xcc2c('0x5a')]})[_0xcc2c('0x38')](handleEntityNotFound(_0x585164,null))[_0xcc2c('0x38')](function(_0x4e182a){if(_0x4e182a){_0x1fc9d8=_0x4e182a[_0xcc2c('0x5a')];var _0x8f136b=_0x1fc9d8[_0xcc2c('0x5b')](-0x1);if(_0x8f136b==='/'){_0x1fc9d8=_0x1fc9d8['substring'](0x0,_0x1fc9d8[_0xcc2c('0x5c')](_0x8f136b));}return rp({'method':_0xcc2c('0x5d'),'uri':util[_0xcc2c('0x5e')]('%s%s',_0x1fc9d8,_0xcc2c('0x5f')),'json':!![],'form':{'method':_0xcc2c('0x60'),'input_type':'JSON','response_type':_0xcc2c('0x61'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x4e182a[_0xcc2c('0x58')],'password':_0x4e182a[_0xcc2c('0x59')],'encryption':_0xcc2c('0x62')},'application':_0xcc2c('0x63')})}});}})['then'](function(_0x1e3880){if(_0x1e3880&&_0x1e3880['name']!==_0xcc2c('0x64')&&_0x1e3880[_0xcc2c('0x22')]!=='Password\x20Expired'){return rp({'method':_0xcc2c('0x5d'),'uri':util[_0xcc2c('0x5e')](_0xcc2c('0x65'),_0x1fc9d8,_0xcc2c('0x5f')),'json':!![],'form':{'method':_0xcc2c('0x66'),'input_type':_0xcc2c('0x61'),'response_type':_0xcc2c('0x61'),'rest_data':JSON[_0xcc2c('0x67')]({'session':_0x1e3880['id'],'module_name':'Calls'})}})[_0xcc2c('0x38')](function(_0x44028e){if(_0x44028e){var _0x488ba0=_[_0xcc2c('0x68')](_0x44028e['module_fields']);_[_0xcc2c('0x69')](_0x488ba0,function(_0x240d51){return _0x1e8121[_0xcc2c('0x6a')](_0x240d51['name']);});return{'count':_0x488ba0[_0xcc2c('0x2e')],'rows':_['map'](_0x488ba0,function(_0x376f43){return{'id':_0x376f43['name'],'name':_0x376f43[_0xcc2c('0x6b')],'custom':_[_0xcc2c('0x6c')](_0x376f43[_0xcc2c('0x22')],'_c')?!![]:![],'options':_0x376f43[_0xcc2c('0x37')]?_['map'](_['values'](_0x376f43['options']),function(_0x394097){return{'name':_0x394097[_0xcc2c('0x6d')],'value':_0x394097[_0xcc2c('0x22')]};}):[]};})};}})['then'](respondWithResult(_0x585164,null))[_0xcc2c('0x40')](function(_0x35f998){var _0x457979=_0x22daa3[_0xcc2c('0x28')]['test']?0x1f4:_0x35f998[_0xcc2c('0x6e')]||0x1f4;logger[_0xcc2c('0x20')](_0xcc2c('0x6f'),_0xcc2c('0x50'),_0x457979,JSON['stringify'](_0x35f998));delete _0x35f998[_0xcc2c('0x22')];if(_0x457979===0x191){_0x457979=0x190;}_0x585164[_0xcc2c('0x16')](_0x457979)[_0xcc2c('0x70')](_0x22daa3[_0xcc2c('0x28')]['test']?{'message':_0xcc2c('0x71'),'statusCode':_0x35f998[_0xcc2c('0x6e')]}:_0x35f998);});}else{var _0x3d6288=0x1f4;_0x585164['status'](_0x3d6288)['send']({'message':_0xcc2c('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 bbce733..37f67e8 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 _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 +var _0x8d41=['api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports','define','int_sugarcrm_accounts','lodash','util','../../config/logger'];(function(_0x5bc41c,_0x926b55){var _0x99951b=function(_0x5a07e8){while(--_0x5a07e8){_0x5bc41c['push'](_0x5bc41c['shift']());}};_0x99951b(++_0x926b55);}(_0x8d41,0x1aa));var _0x18d4=function(_0x2aaa60,_0x22258f){_0x2aaa60=_0x2aaa60-0x0;var _0x2e3fa5=_0x8d41[_0x2aaa60];return _0x2e3fa5;};'use strict';var _=require(_0x18d4('0x0'));var util=require(_0x18d4('0x1'));var logger=require(_0x18d4('0x2'))(_0x18d4('0x3'));var moment=require(_0x18d4('0x4'));var BPromise=require('bluebird');var rp=require(_0x18d4('0x5'));var fs=require('fs');var path=require(_0x18d4('0x6'));var rimraf=require(_0x18d4('0x7'));var config=require(_0x18d4('0x8'));var attributes=require(_0x18d4('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x18d4('0xa')]=function(_0x25b129,_0x31e994){return _0x25b129[_0x18d4('0xb')]('SugarcrmAccount',attributes,{'tableName':_0x18d4('0xc'),'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 4107546..1462d51 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 _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 +var _0x8ff3=['SugarcrmAccount','find','then','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','findAll','options','raw','where','attributes','include','model','map','ShowSugarcrmAccount'];(function(_0xc74616,_0xb493ee){var _0x2a3e9d=function(_0x314300){while(--_0x314300){_0xc74616['push'](_0xc74616['shift']());}};_0x2a3e9d(++_0xb493ee);}(_0x8ff3,0xff));var _0x38ff=function(_0x3e32b1,_0x487a75){_0x3e32b1=_0x3e32b1-0x0;var _0x419327=_0x8ff3[_0x3e32b1];return _0x419327;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x38ff('0x0'));var BPromise=require(_0x38ff('0x1'));var rs=require(_0x38ff('0x2'));var fs=require('fs');var Redis=require(_0x38ff('0x3'));var db=require(_0x38ff('0x4'))['db'];var utils=require(_0x38ff('0x5'));var logger=require(_0x38ff('0x6'))(_0x38ff('0x7'));var config=require(_0x38ff('0x8'));var jayson=require(_0x38ff('0x9'));var client=jayson['client'][_0x38ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4888a0,_0xf65b21,_0x499c29){return new BPromise(function(_0x85db2f,_0x328b58){return client[_0x38ff('0xb')](_0x4888a0,_0x499c29)['then'](function(_0x4b97cf){logger[_0x38ff('0xc')](_0x38ff('0xd'),_0xf65b21,_0x38ff('0xe'));logger[_0x38ff('0xf')](_0x38ff('0x10'),_0xf65b21,_0x38ff('0xe'),JSON[_0x38ff('0x11')](_0x4b97cf));if(_0x4b97cf[_0x38ff('0x12')]){if(_0x4b97cf[_0x38ff('0x12')][_0x38ff('0x13')]===0x1f4){logger['error'](_0x38ff('0xd'),_0xf65b21,_0x4b97cf[_0x38ff('0x12')]['message']);return _0x328b58(_0x4b97cf[_0x38ff('0x12')][_0x38ff('0x14')]);}logger[_0x38ff('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0xf65b21,_0x4b97cf[_0x38ff('0x12')]['message']);return _0x85db2f(_0x4b97cf[_0x38ff('0x12')]['message']);}else{logger['info'](_0x38ff('0xd'),_0xf65b21,_0x38ff('0xe'));_0x85db2f(_0x4b97cf[_0x38ff('0x15')][_0x38ff('0x14')]);}})[_0x38ff('0x16')](function(_0x3c23d6){logger['error'](_0x38ff('0xd'),_0xf65b21,_0x3c23d6);_0x328b58(_0x3c23d6);});});}exports[_0x38ff('0x17')]=function(_0x36b654){var _0x5d7676=this;return new Promise(function(_0x338708,_0x26809b){return db['SugarcrmAccount'][_0x38ff('0x18')]({'raw':_0x36b654[_0x38ff('0x19')]?_0x36b654[_0x38ff('0x19')][_0x38ff('0x1a')]===undefined?!![]:![]:!![],'where':_0x36b654[_0x38ff('0x19')]?_0x36b654[_0x38ff('0x19')][_0x38ff('0x1b')]||null:null,'attributes':_0x36b654[_0x38ff('0x19')]?_0x36b654[_0x38ff('0x19')][_0x38ff('0x1c')]||null:null,'limit':_0x36b654['options']?_0x36b654['options']['limit']||null:null,'include':_0x36b654[_0x38ff('0x19')]?_0x36b654[_0x38ff('0x19')][_0x38ff('0x1d')]?_['map'](_0x36b654[_0x38ff('0x19')][_0x38ff('0x1d')],function(_0x38b90b){return{'model':db[_0x38b90b[_0x38ff('0x1e')]],'as':_0x38b90b['as'],'attributes':_0x38b90b['attributes'],'include':_0x38b90b[_0x38ff('0x1d')]?_[_0x38ff('0x1f')](_0x38b90b[_0x38ff('0x1d')],function(_0x250a9f){return{'model':db[_0x250a9f['model']],'as':_0x250a9f['as'],'attributes':_0x250a9f['attributes'],'include':_0x250a9f['include']?_[_0x38ff('0x1f')](_0x250a9f[_0x38ff('0x1d')],function(_0x2a355b){return{'model':db[_0x2a355b[_0x38ff('0x1e')]],'as':_0x2a355b['as'],'attributes':_0x2a355b[_0x38ff('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5284c6){logger[_0x38ff('0xc')]('GetSugarcrmAccount',_0x36b654);logger[_0x38ff('0xf')](_0x38ff('0x17'),_0x36b654,JSON[_0x38ff('0x11')](_0x5284c6));_0x338708(_0x5284c6);})[_0x38ff('0x16')](function(_0x34eca6){logger['error'](_0x38ff('0x17'),_0x34eca6[_0x38ff('0x14')],_0x36b654);_0x26809b(_0x5d7676[_0x38ff('0x12')](0x1f4,_0x34eca6[_0x38ff('0x14')]));});});};exports[_0x38ff('0x20')]=function(_0xf62a72){var _0x9e73=this;return new Promise(function(_0xb05c5d,_0x232f3f){return db[_0x38ff('0x21')][_0x38ff('0x22')]({'raw':_0xf62a72[_0x38ff('0x19')]?_0xf62a72[_0x38ff('0x19')][_0x38ff('0x1a')]===undefined?!![]:![]:!![],'where':_0xf62a72['options']?_0xf62a72[_0x38ff('0x19')][_0x38ff('0x1b')]||null:null,'attributes':_0xf62a72[_0x38ff('0x19')]?_0xf62a72[_0x38ff('0x19')][_0x38ff('0x1c')]||null:null,'include':_0xf62a72[_0x38ff('0x19')]?_0xf62a72[_0x38ff('0x19')][_0x38ff('0x1d')]?_[_0x38ff('0x1f')](_0xf62a72[_0x38ff('0x19')]['include'],function(_0x2c500e){return{'model':db[_0x2c500e[_0x38ff('0x1e')]],'as':_0x2c500e['as'],'attributes':_0x2c500e[_0x38ff('0x1c')],'include':_0x2c500e[_0x38ff('0x1d')]?_[_0x38ff('0x1f')](_0x2c500e[_0x38ff('0x1d')],function(_0x194210){return{'model':db[_0x194210['model']],'as':_0x194210['as'],'attributes':_0x194210['attributes'],'include':_0x194210[_0x38ff('0x1d')]?_[_0x38ff('0x1f')](_0x194210[_0x38ff('0x1d')],function(_0xb9ade4){return{'model':db[_0xb9ade4[_0x38ff('0x1e')]],'as':_0xb9ade4['as'],'attributes':_0xb9ade4[_0x38ff('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x38ff('0x23')](function(_0x536a3b){logger[_0x38ff('0xc')](_0x38ff('0x20'),_0xf62a72);logger[_0x38ff('0xf')](_0x38ff('0x20'),_0xf62a72,JSON[_0x38ff('0x11')](_0x536a3b));_0xb05c5d(_0x536a3b);})['catch'](function(_0x2a9aa3){logger[_0x38ff('0x12')]('ShowSugarcrmAccount',_0x2a9aa3[_0x38ff('0x14')],_0xf62a72);_0x232f3f(_0x9e73['error'](0x1f4,_0x2a9aa3[_0x38ff('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 6add913..3bcd3dc 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 _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 +var _0x7f86=['show','get','/:id/fields','getFields','/:id/subjects','/:id/descriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','/:id','isAuthenticated'];(function(_0x4760e3,_0x3a0b2a){var _0x112cc0=function(_0x10a918){while(--_0x10a918){_0x4760e3['push'](_0x4760e3['shift']());}};_0x112cc0(++_0x3a0b2a);}(_0x7f86,0x107));var _0x67f8=function(_0x1d0d3f,_0x490693){_0x1d0d3f=_0x1d0d3f-0x0;var _0xdf598e=_0x7f86[_0x1d0d3f];return _0xdf598e;};'use strict';var multer=require(_0x67f8('0x0'));var util=require(_0x67f8('0x1'));var path=require(_0x67f8('0x2'));var timeout=require(_0x67f8('0x3'));var express=require(_0x67f8('0x4'));var router=express['Router']();var fs_extra=require(_0x67f8('0x5'));var auth=require(_0x67f8('0x6'));var interaction=require(_0x67f8('0x7'));var config=require(_0x67f8('0x8'));var controller=require(_0x67f8('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x67f8('0xa'),auth[_0x67f8('0xb')](),controller[_0x67f8('0xc')]);router[_0x67f8('0xd')](_0x67f8('0xe'),auth[_0x67f8('0xb')](),controller[_0x67f8('0xf')]);router[_0x67f8('0xd')](_0x67f8('0x10'),auth[_0x67f8('0xb')](),controller['getSubjects']);router[_0x67f8('0xd')](_0x67f8('0x11'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x67f8('0x12')]('/',auth[_0x67f8('0xb')](),controller[_0x67f8('0x13')]);router[_0x67f8('0x14')](_0x67f8('0xa'),auth[_0x67f8('0xb')](),controller[_0x67f8('0x15')]);router[_0x67f8('0x16')]('/:id',auth[_0x67f8('0xb')](),controller[_0x67f8('0x17')]);module[_0x67f8('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 71f6ec4..ef6755e 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 _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 +var _0x8e08=['sequelize','exports','STRING'];(function(_0x3301c2,_0x20d742){var _0x2f8bd9=function(_0x7843d4){while(--_0x7843d4){_0x3301c2['push'](_0x3301c2['shift']());}};_0x2f8bd9(++_0x20d742);}(_0x8e08,0x135));var _0x88e0=function(_0x1f188c,_0x3d99fd){_0x1f188c=_0x1f188c-0x0;var _0x1bb834=_0x8e08[_0x1f188c];return _0x1bb834;};'use strict';var Sequelize=require(_0x88e0('0x0'));module[_0x88e0('0x1')]={'name':{'type':Sequelize[_0x88e0('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 2f75e51..cc1b5fb 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 _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 +var _0x21dc=['json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','VIRTUAL','filter','merge','include','findAll','catch','show','includeAll','options','update','body','params','findOne','SugarcrmField','pick','getFields','hasOwnProperty','getSubjects','getDescriptions','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x955836,_0x2fc415){var _0x8de282=function(_0xb3ef4){while(--_0xb3ef4){_0x955836['push'](_0x955836['shift']());}};_0x8de282(++_0x2fc415);}(_0x21dc,0x1b0));var _0xc21d=function(_0x5917e4,_0x4a243e){_0x5917e4=_0x5917e4-0x0;var _0x3ebaf3=_0x21dc[_0x5917e4];return _0x3ebaf3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc21d('0x0'));var zipdir=require(_0xc21d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc21d('0x2'));var moment=require('moment');var BPromise=require(_0xc21d('0x3'));var Mustache=require(_0xc21d('0x4'));var util=require('util');var path=require(_0xc21d('0x5'));var sox=require(_0xc21d('0x6'));var csv=require(_0xc21d('0x7'));var ejs=require(_0xc21d('0x8'));var fs=require('fs');var fs_extra=require(_0xc21d('0x9'));var _=require(_0xc21d('0xa'));var squel=require(_0xc21d('0xb'));var crypto=require(_0xc21d('0xc'));var jsforce=require(_0xc21d('0xd'));var deskjs=require(_0xc21d('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc21d('0xf'));var Redis=require(_0xc21d('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc21d('0x11'));var logger=require('../../config/logger')(_0xc21d('0x12'));var utils=require(_0xc21d('0x13'));var config=require(_0xc21d('0x14'));var licenseUtil=require(_0xc21d('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x428eb7,_0x14b900){_0x14b900=_0x14b900||0xcc;return function(_0x29f2d0){if(_0x29f2d0){return _0x428eb7[_0xc21d('0x16')](_0x14b900);}return _0x428eb7[_0xc21d('0x17')](_0x14b900)['end']();};}function respondWithResult(_0xea2153,_0x2eefc7){_0x2eefc7=_0x2eefc7||0xc8;return function(_0x1c8379){if(_0x1c8379){return _0xea2153[_0xc21d('0x17')](_0x2eefc7)[_0xc21d('0x18')](_0x1c8379);}};}function respondWithFilteredResult(_0x22c5e7,_0xe6f73d){return function(_0x13dce5){if(_0x13dce5){var _0xedd748=typeof _0xe6f73d['offset']===_0xc21d('0x19')&&typeof _0xe6f73d[_0xc21d('0x1a')]===_0xc21d('0x19');var _0x2eadf2=_0x13dce5[_0xc21d('0x1b')];var _0x735e59=_0xedd748?0x0:_0xe6f73d[_0xc21d('0x1c')];var _0x15182e=_0xedd748?_0x13dce5['count']:_0xe6f73d[_0xc21d('0x1c')]+_0xe6f73d[_0xc21d('0x1a')];var _0xf2e53a;if(_0x15182e>=_0x2eadf2){_0x15182e=_0x2eadf2;_0xf2e53a=0xc8;}else{_0xf2e53a=0xce;}_0x22c5e7[_0xc21d('0x17')](_0xf2e53a);return _0x22c5e7[_0xc21d('0x1d')](_0xc21d('0x1e'),_0x735e59+'-'+_0x15182e+'/'+_0x2eadf2)['json'](_0x13dce5);}return null;};}function patchUpdates(_0x47cdc0){return function(_0x220d90){try{jsonpatch[_0xc21d('0x1f')](_0x220d90,_0x47cdc0,!![]);}catch(_0x10ec27){return BPromise[_0xc21d('0x20')](_0x10ec27);}return _0x220d90[_0xc21d('0x21')]();};}function saveUpdates(_0x33f528,_0x4bf7b2){return function(_0x1eb52a){if(_0x1eb52a){return _0x1eb52a['update'](_0x33f528)[_0xc21d('0x22')](function(_0x10888e){return _0x10888e;});}return null;};}function removeEntity(_0x18a0e9,_0x5140b9){return function(_0x55ec52){if(_0x55ec52){return _0x55ec52[_0xc21d('0x23')]()['then'](function(){_0x18a0e9[_0xc21d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d1f09,_0x37dd88){return function(_0x351c2c){if(!_0x351c2c){_0x4d1f09['sendStatus'](0x194);}return _0x351c2c;};}function handleError(_0x572f0a,_0x5183ed){_0x5183ed=_0x5183ed||0x1f4;return function(_0x3fb8e8){logger['error'](_0x3fb8e8['stack']);if(_0x3fb8e8['name']){delete _0x3fb8e8[_0xc21d('0x24')];}_0x572f0a[_0xc21d('0x17')](_0x5183ed)[_0xc21d('0x25')](_0x3fb8e8);};}exports[_0xc21d('0x26')]=function(_0x453bce,_0x18cbd9){var _0x5e3182={},_0x109ac1={},_0x107215={'count':0x0,'rows':[]};var _0x21b04d=_[_0xc21d('0x27')](db[_0xc21d('0x28')][_0xc21d('0x29')],function(_0x14dd07){return{'name':_0x14dd07[_0xc21d('0x2a')],'type':_0x14dd07[_0xc21d('0x2b')][_0xc21d('0x2c')]};});_0x109ac1[_0xc21d('0x2d')]=_['map'](_0x21b04d,_0xc21d('0x24'));_0x109ac1['query']=_[_0xc21d('0x2e')](_0x453bce[_0xc21d('0x2f')]);_0x109ac1[_0xc21d('0x30')]=_[_0xc21d('0x31')](_0x109ac1['model'],_0x109ac1['query']);_0x5e3182['attributes']=_[_0xc21d('0x31')](_0x109ac1[_0xc21d('0x2d')],qs[_0xc21d('0x32')](_0x453bce['query']['fields']));_0x5e3182['attributes']=_0x5e3182[_0xc21d('0x33')][_0xc21d('0x34')]?_0x5e3182[_0xc21d('0x33')]:_0x109ac1['model'];if(!_0x453bce[_0xc21d('0x2f')]['hasOwnProperty'](_0xc21d('0x35'))){_0x5e3182[_0xc21d('0x1a')]=qs['limit'](_0x453bce[_0xc21d('0x2f')]['limit']);_0x5e3182['offset']=qs['offset'](_0x453bce[_0xc21d('0x2f')][_0xc21d('0x1c')]);}_0x5e3182[_0xc21d('0x36')]=qs[_0xc21d('0x37')](_0x453bce[_0xc21d('0x2f')][_0xc21d('0x37')]);_0x5e3182[_0xc21d('0x38')]=qs[_0xc21d('0x30')](_['pick'](_0x453bce[_0xc21d('0x2f')],_0x109ac1[_0xc21d('0x30')]),_0x21b04d);if(_0x453bce[_0xc21d('0x2f')]['filter']){_0x5e3182[_0xc21d('0x38')]=_['merge'](_0x5e3182[_0xc21d('0x38')],{'$or':_[_0xc21d('0x27')](_0x21b04d,function(_0xabf608){if(_0xabf608[_0xc21d('0x2b')]!==_0xc21d('0x39')){var _0x1dc446={};_0x1dc446[_0xabf608[_0xc21d('0x24')]]={'$like':'%'+_0x453bce[_0xc21d('0x2f')][_0xc21d('0x3a')]+'%'};return _0x1dc446;}})});}_0x5e3182=_[_0xc21d('0x3b')]({},_0x5e3182,_0x453bce['options']);var _0xba158f={'where':_0x5e3182[_0xc21d('0x38')]};return db[_0xc21d('0x28')][_0xc21d('0x1b')](_0xba158f)[_0xc21d('0x22')](function(_0x26677d){_0x107215[_0xc21d('0x1b')]=_0x26677d;if(_0x453bce[_0xc21d('0x2f')]['includeAll']){_0x5e3182[_0xc21d('0x3c')]=[{'all':!![]}];}return db[_0xc21d('0x28')][_0xc21d('0x3d')](_0x5e3182);})[_0xc21d('0x22')](function(_0x96ecc9){_0x107215['rows']=_0x96ecc9;return _0x107215;})[_0xc21d('0x22')](respondWithFilteredResult(_0x18cbd9,_0x5e3182))[_0xc21d('0x3e')](handleError(_0x18cbd9,null));};exports[_0xc21d('0x3f')]=function(_0x17e7fd,_0x3b5108){var _0x9a0bcb={'raw':![],'where':{'id':_0x17e7fd['params']['id']}},_0x1946ce={};_0x1946ce['model']=_['keys'](db[_0xc21d('0x28')][_0xc21d('0x29')]);_0x1946ce[_0xc21d('0x2f')]=_['keys'](_0x17e7fd[_0xc21d('0x2f')]);_0x1946ce[_0xc21d('0x30')]=_[_0xc21d('0x31')](_0x1946ce['model'],_0x1946ce[_0xc21d('0x2f')]);_0x9a0bcb['attributes']=_[_0xc21d('0x31')](_0x1946ce[_0xc21d('0x2d')],qs[_0xc21d('0x32')](_0x17e7fd[_0xc21d('0x2f')][_0xc21d('0x32')]));_0x9a0bcb[_0xc21d('0x33')]=_0x9a0bcb[_0xc21d('0x33')][_0xc21d('0x34')]?_0x9a0bcb['attributes']:_0x1946ce[_0xc21d('0x2d')];if(_0x17e7fd[_0xc21d('0x2f')][_0xc21d('0x40')]){_0x9a0bcb[_0xc21d('0x3c')]=[{'all':!![]}];}_0x9a0bcb=_[_0xc21d('0x3b')]({},_0x9a0bcb,_0x17e7fd[_0xc21d('0x41')]);return db[_0xc21d('0x28')]['find'](_0x9a0bcb)[_0xc21d('0x22')](handleEntityNotFound(_0x3b5108,null))[_0xc21d('0x22')](respondWithResult(_0x3b5108,null))[_0xc21d('0x3e')](handleError(_0x3b5108,null));};exports['create']=function(_0x3f925d,_0x43b755){return db['SugarcrmConfiguration']['create'](_0x3f925d['body'],{})[_0xc21d('0x22')](respondWithResult(_0x43b755,0xc9))[_0xc21d('0x3e')](handleError(_0x43b755,null));};exports[_0xc21d('0x42')]=function(_0x335566,_0x5531ae){if(_0x335566[_0xc21d('0x43')]['id']){delete _0x335566[_0xc21d('0x43')]['id'];}return db[_0xc21d('0x28')]['find']({'where':{'id':_0x335566[_0xc21d('0x44')]['id']}})[_0xc21d('0x22')](handleEntityNotFound(_0x5531ae,null))['then'](saveUpdates(_0x335566['body'],null))[_0xc21d('0x22')](respondWithResult(_0x5531ae,null))[_0xc21d('0x3e')](handleError(_0x5531ae,null));};exports[_0xc21d('0x23')]=function(_0x2bb2a5,_0x17aeb0){return db['SugarcrmConfiguration']['find']({'where':{'id':_0x2bb2a5[_0xc21d('0x44')]['id']}})['then'](handleEntityNotFound(_0x17aeb0,null))[_0xc21d('0x22')](removeEntity(_0x17aeb0,null))[_0xc21d('0x3e')](handleError(_0x17aeb0,null));};exports['getFields']=function(_0x438771,_0x5c40bc,_0x1dcb79){var _0x5916ed={};var _0x370811={};var _0x2433d4;var _0x10fc42;return db[_0xc21d('0x28')][_0xc21d('0x45')]({'where':{'id':_0x438771[_0xc21d('0x44')]['id']}})[_0xc21d('0x22')](handleEntityNotFound(_0x5c40bc,null))[_0xc21d('0x22')](function(_0x4e9568){if(_0x4e9568){_0x2433d4=_0x4e9568;_0x370811[_0xc21d('0x2d')]=_[_0xc21d('0x2e')](db[_0xc21d('0x46')][_0xc21d('0x29')]);_0x370811[_0xc21d('0x2f')]=_[_0xc21d('0x2e')](_0x438771[_0xc21d('0x2f')]);_0x370811[_0xc21d('0x30')]=_[_0xc21d('0x31')](_0x370811[_0xc21d('0x2d')],_0x370811[_0xc21d('0x2f')]);_0x5916ed[_0xc21d('0x33')]=_[_0xc21d('0x31')](_0x370811[_0xc21d('0x2d')],qs[_0xc21d('0x32')](_0x438771[_0xc21d('0x2f')][_0xc21d('0x32')]));_0x5916ed['attributes']=_0x5916ed[_0xc21d('0x33')][_0xc21d('0x34')]?_0x5916ed[_0xc21d('0x33')]:_0x370811[_0xc21d('0x2d')];_0x5916ed[_0xc21d('0x36')]=qs[_0xc21d('0x37')](_0x438771[_0xc21d('0x2f')][_0xc21d('0x37')]);_0x5916ed[_0xc21d('0x38')]=qs['filters'](_[_0xc21d('0x47')](_0x438771[_0xc21d('0x2f')],_0x370811['filters']));if(_0x438771[_0xc21d('0x2f')][_0xc21d('0x3a')]){_0x5916ed[_0xc21d('0x38')]=_[_0xc21d('0x3b')](_0x5916ed[_0xc21d('0x38')],{'$or':_['map'](_0x5916ed[_0xc21d('0x33')],function(_0x2fbc66){var _0xbc6c36={};_0xbc6c36[_0x2fbc66]={'$like':'%'+_0x438771[_0xc21d('0x2f')]['filter']+'%'};return _0xbc6c36;})});}_0x5916ed=_[_0xc21d('0x3b')]({},_0x5916ed,_0x438771[_0xc21d('0x41')]);return _0x2433d4[_0xc21d('0x48')](_0x5916ed);}})[_0xc21d('0x22')](function(_0x3d81d4){if(_0x3d81d4){_0x10fc42=_0x3d81d4['length'];if(!_0x438771['query'][_0xc21d('0x49')]('nolimit')){_0x5916ed['limit']=qs['limit'](_0x438771['query']['limit']);_0x5916ed['offset']=qs[_0xc21d('0x1c')](_0x438771[_0xc21d('0x2f')][_0xc21d('0x1c')]);}return _0x2433d4[_0xc21d('0x48')](_0x5916ed);}})[_0xc21d('0x22')](function(_0x2bcc2f){if(_0x2bcc2f){return _0x2bcc2f?{'count':_0x10fc42,'rows':_0x2bcc2f}:null;}})[_0xc21d('0x22')](respondWithResult(_0x5c40bc,null))[_0xc21d('0x3e')](handleError(_0x5c40bc,null));};exports['getSubjects']=function(_0x1ec600,_0xe12f3d,_0x2c2606){var _0x1d68d3={};var _0x7f7aa3={};var _0x2d523e;var _0x579222;return db[_0xc21d('0x28')][_0xc21d('0x45')]({'where':{'id':_0x1ec600['params']['id']}})[_0xc21d('0x22')](handleEntityNotFound(_0xe12f3d,null))['then'](function(_0x84f213){if(_0x84f213){_0x2d523e=_0x84f213;_0x7f7aa3[_0xc21d('0x2d')]=_[_0xc21d('0x2e')](db[_0xc21d('0x46')]['rawAttributes']);_0x7f7aa3[_0xc21d('0x2f')]=_[_0xc21d('0x2e')](_0x1ec600[_0xc21d('0x2f')]);_0x7f7aa3[_0xc21d('0x30')]=_[_0xc21d('0x31')](_0x7f7aa3['model'],_0x7f7aa3['query']);_0x1d68d3[_0xc21d('0x33')]=_[_0xc21d('0x31')](_0x7f7aa3[_0xc21d('0x2d')],qs[_0xc21d('0x32')](_0x1ec600[_0xc21d('0x2f')][_0xc21d('0x32')]));_0x1d68d3[_0xc21d('0x33')]=_0x1d68d3['attributes']['length']?_0x1d68d3['attributes']:_0x7f7aa3['model'];_0x1d68d3[_0xc21d('0x36')]=qs['sort'](_0x1ec600[_0xc21d('0x2f')][_0xc21d('0x37')]);_0x1d68d3[_0xc21d('0x38')]=qs[_0xc21d('0x30')](_[_0xc21d('0x47')](_0x1ec600[_0xc21d('0x2f')],_0x7f7aa3[_0xc21d('0x30')]));if(_0x1ec600[_0xc21d('0x2f')][_0xc21d('0x3a')]){_0x1d68d3[_0xc21d('0x38')]=_[_0xc21d('0x3b')](_0x1d68d3['where'],{'$or':_[_0xc21d('0x27')](_0x1d68d3['attributes'],function(_0x12fe1d){var _0x30bcf0={};_0x30bcf0[_0x12fe1d]={'$like':'%'+_0x1ec600['query'][_0xc21d('0x3a')]+'%'};return _0x30bcf0;})});}_0x1d68d3=_[_0xc21d('0x3b')]({},_0x1d68d3,_0x1ec600[_0xc21d('0x41')]);return _0x2d523e[_0xc21d('0x4a')](_0x1d68d3);}})[_0xc21d('0x22')](function(_0x57a2cc){if(_0x57a2cc){_0x579222=_0x57a2cc[_0xc21d('0x34')];if(!_0x1ec600[_0xc21d('0x2f')][_0xc21d('0x49')](_0xc21d('0x35'))){_0x1d68d3['limit']=qs['limit'](_0x1ec600[_0xc21d('0x2f')][_0xc21d('0x1a')]);_0x1d68d3[_0xc21d('0x1c')]=qs[_0xc21d('0x1c')](_0x1ec600[_0xc21d('0x2f')][_0xc21d('0x1c')]);}return _0x2d523e['getSubjects'](_0x1d68d3);}})[_0xc21d('0x22')](function(_0x15e0a1){if(_0x15e0a1){return _0x15e0a1?{'count':_0x579222,'rows':_0x15e0a1}:null;}})['then'](respondWithResult(_0xe12f3d,null))[_0xc21d('0x3e')](handleError(_0xe12f3d,null));};exports[_0xc21d('0x4b')]=function(_0x33351b,_0x16ee43,_0x37b877){var _0x283029={};var _0x468337={};var _0x3d4d10;var _0x29eacf;return db[_0xc21d('0x28')][_0xc21d('0x45')]({'where':{'id':_0x33351b[_0xc21d('0x44')]['id']}})['then'](handleEntityNotFound(_0x16ee43,null))[_0xc21d('0x22')](function(_0x86b5df){if(_0x86b5df){_0x3d4d10=_0x86b5df;_0x468337[_0xc21d('0x2d')]=_[_0xc21d('0x2e')](db[_0xc21d('0x46')]['rawAttributes']);_0x468337['query']=_['keys'](_0x33351b[_0xc21d('0x2f')]);_0x468337[_0xc21d('0x30')]=_[_0xc21d('0x31')](_0x468337[_0xc21d('0x2d')],_0x468337[_0xc21d('0x2f')]);_0x283029[_0xc21d('0x33')]=_[_0xc21d('0x31')](_0x468337['model'],qs[_0xc21d('0x32')](_0x33351b[_0xc21d('0x2f')][_0xc21d('0x32')]));_0x283029['attributes']=_0x283029[_0xc21d('0x33')]['length']?_0x283029[_0xc21d('0x33')]:_0x468337[_0xc21d('0x2d')];_0x283029[_0xc21d('0x36')]=qs[_0xc21d('0x37')](_0x33351b[_0xc21d('0x2f')][_0xc21d('0x37')]);_0x283029['where']=qs[_0xc21d('0x30')](_[_0xc21d('0x47')](_0x33351b[_0xc21d('0x2f')],_0x468337['filters']));if(_0x33351b[_0xc21d('0x2f')]['filter']){_0x283029[_0xc21d('0x38')]=_[_0xc21d('0x3b')](_0x283029['where'],{'$or':_[_0xc21d('0x27')](_0x283029[_0xc21d('0x33')],function(_0x3e4413){var _0x1c00d1={};_0x1c00d1[_0x3e4413]={'$like':'%'+_0x33351b[_0xc21d('0x2f')]['filter']+'%'};return _0x1c00d1;})});}_0x283029=_[_0xc21d('0x3b')]({},_0x283029,_0x33351b['options']);return _0x3d4d10['getDescriptions'](_0x283029);}})['then'](function(_0x18c5c7){if(_0x18c5c7){_0x29eacf=_0x18c5c7['length'];if(!_0x33351b[_0xc21d('0x2f')][_0xc21d('0x49')](_0xc21d('0x35'))){_0x283029[_0xc21d('0x1a')]=qs[_0xc21d('0x1a')](_0x33351b[_0xc21d('0x2f')][_0xc21d('0x1a')]);_0x283029[_0xc21d('0x1c')]=qs[_0xc21d('0x1c')](_0x33351b[_0xc21d('0x2f')][_0xc21d('0x1c')]);}return _0x3d4d10[_0xc21d('0x4b')](_0x283029);}})[_0xc21d('0x22')](function(_0x1227e8){if(_0x1227e8){return _0x1227e8?{'count':_0x29eacf,'rows':_0x1227e8}:null;}})[_0xc21d('0x22')](respondWithResult(_0x16ee43,null))['catch'](handleError(_0x16ee43,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 5a355b4..c569b2e 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 _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 +var _0x0e24=['int_sugarcrm_configurations','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','define','SugarcrmConfiguration'];(function(_0x1c23b2,_0x23ebf0){var _0x227b67=function(_0x2bdfcc){while(--_0x2bdfcc){_0x1c23b2['push'](_0x1c23b2['shift']());}};_0x227b67(++_0x23ebf0);}(_0x0e24,0x12d));var _0x40e2=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x0e24[_0x1b2ff7];return _0x31656a;};'use strict';var _=require(_0x40e2('0x0'));var util=require('util');var logger=require(_0x40e2('0x1'))(_0x40e2('0x2'));var moment=require(_0x40e2('0x3'));var BPromise=require(_0x40e2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x40e2('0x5'));var config=require(_0x40e2('0x6'));var attributes=require('./intSugarcrmConfiguration.attributes');module['exports']=function(_0x41fa5b,_0x55ec1a){return _0x41fa5b[_0x40e2('0x7')](_0x40e2('0x8'),attributes,{'tableName':_0x40e2('0x9'),'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 14c79c5..3cc3784 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 _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 +var _0x228a=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SugarcrmConfiguration,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x721a1f,_0x33d49e){var _0x42eaec=function(_0x4ae9f1){while(--_0x4ae9f1){_0x721a1f['push'](_0x721a1f['shift']());}};_0x42eaec(++_0x33d49e);}(_0x228a,0xe9));var _0xa228=function(_0x3c39f3,_0x41956){_0x3c39f3=_0x3c39f3-0x0;var _0x1924cc=_0x228a[_0x3c39f3];return _0x1924cc;};'use strict';var _=require(_0xa228('0x0'));var util=require(_0xa228('0x1'));var moment=require(_0xa228('0x2'));var BPromise=require(_0xa228('0x3'));var rs=require(_0xa228('0x4'));var fs=require('fs');var Redis=require(_0xa228('0x5'));var db=require(_0xa228('0x6'))['db'];var utils=require(_0xa228('0x7'));var logger=require(_0xa228('0x8'))(_0xa228('0x9'));var config=require(_0xa228('0xa'));var jayson=require(_0xa228('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x489c0f,_0x24718a,_0xc37fa8){return new BPromise(function(_0x2f55cb,_0x4ae754){return client[_0xa228('0xc')](_0x489c0f,_0xc37fa8)[_0xa228('0xd')](function(_0x21fd77){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x24718a,_0xa228('0xe'));logger['debug'](_0xa228('0xf'),_0x24718a,_0xa228('0xe'),JSON[_0xa228('0x10')](_0x21fd77));if(_0x21fd77[_0xa228('0x11')]){if(_0x21fd77['error'][_0xa228('0x12')]===0x1f4){logger[_0xa228('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x24718a,_0x21fd77[_0xa228('0x11')][_0xa228('0x13')]);return _0x4ae754(_0x21fd77[_0xa228('0x11')][_0xa228('0x13')]);}logger[_0xa228('0x11')](_0xa228('0x14'),_0x24718a,_0x21fd77[_0xa228('0x11')][_0xa228('0x13')]);return _0x2f55cb(_0x21fd77[_0xa228('0x11')][_0xa228('0x13')]);}else{logger[_0xa228('0x15')](_0xa228('0x14'),_0x24718a,_0xa228('0xe'));_0x2f55cb(_0x21fd77[_0xa228('0x16')][_0xa228('0x13')]);}})[_0xa228('0x17')](function(_0x2ee921){logger[_0xa228('0x11')](_0xa228('0x14'),_0x24718a,_0x2ee921);_0x4ae754(_0x2ee921);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 12ba1fd..e50613c 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 _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 +var _0x55c0=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','put'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x55c0,0x144));var _0x055c=function(_0x5dbb2,_0x1e3317){_0x5dbb2=_0x5dbb2-0x0;var _0x4ba922=_0x55c0[_0x5dbb2];return _0x4ba922;};'use strict';var multer=require(_0x055c('0x0'));var util=require(_0x055c('0x1'));var path=require(_0x055c('0x2'));var timeout=require(_0x055c('0x3'));var express=require('express');var router=express[_0x055c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x055c('0x5'));var interaction=require(_0x055c('0x6'));var config=require(_0x055c('0x7'));var controller=require(_0x055c('0x8'));router[_0x055c('0x9')]('/',auth[_0x055c('0xa')](),controller[_0x055c('0xb')]);router[_0x055c('0x9')](_0x055c('0xc'),auth[_0x055c('0xa')](),controller[_0x055c('0xd')]);router[_0x055c('0xe')]('/',auth[_0x055c('0xa')](),controller['create']);router[_0x055c('0xf')](_0x055c('0xc'),auth[_0x055c('0xa')](),controller[_0x055c('0x10')]);router[_0x055c('0x11')](_0x055c('0xc'),auth[_0x055c('0xa')](),controller[_0x055c('0x12')]);module[_0x055c('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 4af1fdf..cc268a5 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 _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 +var _0xe43c=['ENUM','string','variable','customVariable','keyValue','STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe43c,0x19e));var _0xce43=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xe43c[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require(_0xce43('0x0'));module[_0xce43('0x1')]={'type':{'type':Sequelize[_0xce43('0x2')](_0xce43('0x3'),_0xce43('0x4'),_0xce43('0x5'),_0xce43('0x6'),'picklist'),'defaultValue':_0xce43('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xce43('0x4'),_0xce43('0x5'))},'keyContent':{'type':Sequelize[_0xce43('0x7')]},'idField':{'type':Sequelize[_0xce43('0x7')]},'nameField':{'type':Sequelize[_0xce43('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 8f8a80a..b8c9bf0 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 _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 +var _0x6f86=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','show','params','rawAttributes','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','SugarcrmField','type','key'];(function(_0x4bc428,_0xf56dd9){var _0x3ca37f=function(_0x39db20){while(--_0x39db20){_0x4bc428['push'](_0x4bc428['shift']());}};_0x3ca37f(++_0xf56dd9);}(_0x6f86,0x1de));var _0x66f8=function(_0x119a07,_0x2289f6){_0x119a07=_0x119a07-0x0;var _0x36025c=_0x6f86[_0x119a07];return _0x36025c;};'use strict';var emlformat=require(_0x66f8('0x0'));var rimraf=require(_0x66f8('0x1'));var zipdir=require(_0x66f8('0x2'));var jsonpatch=require(_0x66f8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x66f8('0x4'));var Mustache=require(_0x66f8('0x5'));var util=require(_0x66f8('0x6'));var path=require(_0x66f8('0x7'));var sox=require(_0x66f8('0x8'));var csv=require(_0x66f8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x66f8('0xa'));var _=require('lodash');var squel=require(_0x66f8('0xb'));var crypto=require(_0x66f8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x66f8('0xd'));var toCsv=require(_0x66f8('0x9'));var querystring=require(_0x66f8('0xe'));var Papa=require(_0x66f8('0xf'));var Redis=require(_0x66f8('0x10'));var authService=require(_0x66f8('0x11'));var qs=require(_0x66f8('0x12'));var as=require(_0x66f8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x66f8('0x14'))('api');var utils=require(_0x66f8('0x15'));var config=require(_0x66f8('0x16'));var licenseUtil=require(_0x66f8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2eb14e,_0x1d0689){_0x1d0689=_0x1d0689||0xcc;return function(_0xb7d44b){if(_0xb7d44b){return _0x2eb14e[_0x66f8('0x18')](_0x1d0689);}return _0x2eb14e[_0x66f8('0x19')](_0x1d0689)[_0x66f8('0x1a')]();};}function respondWithResult(_0x516a14,_0x274220){_0x274220=_0x274220||0xc8;return function(_0x5be837){if(_0x5be837){return _0x516a14[_0x66f8('0x19')](_0x274220)[_0x66f8('0x1b')](_0x5be837);}};}function respondWithFilteredResult(_0x24346f,_0x2ea533){return function(_0x32de14){if(_0x32de14){var _0x284f24=typeof _0x2ea533[_0x66f8('0x1c')]===_0x66f8('0x1d')&&typeof _0x2ea533['limit']===_0x66f8('0x1d');var _0x52e6be=_0x32de14[_0x66f8('0x1e')];var _0x6f99=_0x284f24?0x0:_0x2ea533[_0x66f8('0x1c')];var _0xb8dc09=_0x284f24?_0x32de14['count']:_0x2ea533[_0x66f8('0x1c')]+_0x2ea533[_0x66f8('0x1f')];var _0x239d81;if(_0xb8dc09>=_0x52e6be){_0xb8dc09=_0x52e6be;_0x239d81=0xc8;}else{_0x239d81=0xce;}_0x24346f[_0x66f8('0x19')](_0x239d81);return _0x24346f['set'](_0x66f8('0x20'),_0x6f99+'-'+_0xb8dc09+'/'+_0x52e6be)['json'](_0x32de14);}return null;};}function patchUpdates(_0x451454){return function(_0x225a0f){try{jsonpatch[_0x66f8('0x21')](_0x225a0f,_0x451454,!![]);}catch(_0x144399){return BPromise[_0x66f8('0x22')](_0x144399);}return _0x225a0f['save']();};}function saveUpdates(_0x2a6c05,_0x35eae7){return function(_0x468a14){if(_0x468a14){return _0x468a14[_0x66f8('0x23')](_0x2a6c05)[_0x66f8('0x24')](function(_0x30ae4b){return _0x30ae4b;});}return null;};}function removeEntity(_0x3b7bb7,_0x2a9857){return function(_0x1e7b03){if(_0x1e7b03){return _0x1e7b03[_0x66f8('0x25')]()[_0x66f8('0x24')](function(){_0x3b7bb7[_0x66f8('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56710c,_0x50d07e){return function(_0x1b67de){if(!_0x1b67de){_0x56710c[_0x66f8('0x18')](0x194);}return _0x1b67de;};}function handleError(_0x27221e,_0x51a2bd){_0x51a2bd=_0x51a2bd||0x1f4;return function(_0x168f49){logger[_0x66f8('0x26')](_0x168f49[_0x66f8('0x27')]);if(_0x168f49[_0x66f8('0x28')]){delete _0x168f49[_0x66f8('0x28')];}_0x27221e['status'](_0x51a2bd)[_0x66f8('0x29')](_0x168f49);};}exports[_0x66f8('0x2a')]=function(_0x1b863e,_0xd75549){var _0x329f9a={},_0x41a352={},_0x5a9a6b={'count':0x0,'rows':[]};var _0x40a6da=_[_0x66f8('0x2b')](db[_0x66f8('0x2c')]['rawAttributes'],function(_0x34c52e){return{'name':_0x34c52e['fieldName'],'type':_0x34c52e[_0x66f8('0x2d')][_0x66f8('0x2e')]};});_0x41a352[_0x66f8('0x2f')]=_['map'](_0x40a6da,_0x66f8('0x28'));_0x41a352[_0x66f8('0x30')]=_[_0x66f8('0x31')](_0x1b863e['query']);_0x41a352[_0x66f8('0x32')]=_[_0x66f8('0x33')](_0x41a352[_0x66f8('0x2f')],_0x41a352[_0x66f8('0x30')]);_0x329f9a[_0x66f8('0x34')]=_['intersection'](_0x41a352[_0x66f8('0x2f')],qs[_0x66f8('0x35')](_0x1b863e[_0x66f8('0x30')][_0x66f8('0x35')]));_0x329f9a[_0x66f8('0x34')]=_0x329f9a[_0x66f8('0x34')][_0x66f8('0x36')]?_0x329f9a[_0x66f8('0x34')]:_0x41a352['model'];if(!_0x1b863e[_0x66f8('0x30')][_0x66f8('0x37')](_0x66f8('0x38'))){_0x329f9a[_0x66f8('0x1f')]=qs[_0x66f8('0x1f')](_0x1b863e[_0x66f8('0x30')]['limit']);_0x329f9a[_0x66f8('0x1c')]=qs['offset'](_0x1b863e['query'][_0x66f8('0x1c')]);}_0x329f9a[_0x66f8('0x39')]=qs['sort'](_0x1b863e[_0x66f8('0x30')][_0x66f8('0x3a')]);_0x329f9a[_0x66f8('0x3b')]=qs[_0x66f8('0x32')](_[_0x66f8('0x3c')](_0x1b863e[_0x66f8('0x30')],_0x41a352[_0x66f8('0x32')]),_0x40a6da);if(_0x1b863e[_0x66f8('0x30')][_0x66f8('0x3d')]){_0x329f9a[_0x66f8('0x3b')]=_['merge'](_0x329f9a[_0x66f8('0x3b')],{'$or':_[_0x66f8('0x2b')](_0x40a6da,function(_0x54be3e){if(_0x54be3e[_0x66f8('0x2d')]!==_0x66f8('0x3e')){var _0x653a9b={};_0x653a9b[_0x54be3e['name']]={'$like':'%'+_0x1b863e[_0x66f8('0x30')]['filter']+'%'};return _0x653a9b;}})});}_0x329f9a=_[_0x66f8('0x3f')]({},_0x329f9a,_0x1b863e[_0x66f8('0x40')]);var _0x31bf2a={'where':_0x329f9a['where']};return db['SugarcrmField'][_0x66f8('0x1e')](_0x31bf2a)[_0x66f8('0x24')](function(_0x5ad91d){_0x5a9a6b[_0x66f8('0x1e')]=_0x5ad91d;if(_0x1b863e['query']['includeAll']){_0x329f9a[_0x66f8('0x41')]=[{'all':!![]}];}return db[_0x66f8('0x2c')]['findAll'](_0x329f9a);})[_0x66f8('0x24')](function(_0x11b470){_0x5a9a6b[_0x66f8('0x42')]=_0x11b470;return _0x5a9a6b;})['then'](respondWithFilteredResult(_0xd75549,_0x329f9a))['catch'](handleError(_0xd75549,null));};exports[_0x66f8('0x43')]=function(_0x1354c2,_0x69d173){var _0x3e311d={'raw':!![],'where':{'id':_0x1354c2[_0x66f8('0x44')]['id']}},_0x2adbd6={};_0x2adbd6['model']=_[_0x66f8('0x31')](db[_0x66f8('0x2c')][_0x66f8('0x45')]);_0x2adbd6[_0x66f8('0x30')]=_['keys'](_0x1354c2[_0x66f8('0x30')]);_0x2adbd6[_0x66f8('0x32')]=_[_0x66f8('0x33')](_0x2adbd6[_0x66f8('0x2f')],_0x2adbd6[_0x66f8('0x30')]);_0x3e311d['attributes']=_[_0x66f8('0x33')](_0x2adbd6[_0x66f8('0x2f')],qs[_0x66f8('0x35')](_0x1354c2[_0x66f8('0x30')][_0x66f8('0x35')]));_0x3e311d['attributes']=_0x3e311d['attributes']['length']?_0x3e311d['attributes']:_0x2adbd6[_0x66f8('0x2f')];if(_0x1354c2[_0x66f8('0x30')][_0x66f8('0x46')]){_0x3e311d[_0x66f8('0x41')]=[{'all':!![]}];}_0x3e311d=_[_0x66f8('0x3f')]({},_0x3e311d,_0x1354c2[_0x66f8('0x40')]);return db['SugarcrmField'][_0x66f8('0x47')](_0x3e311d)['then'](handleEntityNotFound(_0x69d173,null))['then'](respondWithResult(_0x69d173,null))[_0x66f8('0x48')](handleError(_0x69d173,null));};exports['create']=function(_0x1c294a,_0x2b1309){return db[_0x66f8('0x2c')][_0x66f8('0x49')](_0x1c294a[_0x66f8('0x4a')],{})[_0x66f8('0x24')](respondWithResult(_0x2b1309,0xc9))['catch'](handleError(_0x2b1309,null));};exports[_0x66f8('0x23')]=function(_0x36384b,_0x231386){if(_0x36384b[_0x66f8('0x4a')]['id']){delete _0x36384b[_0x66f8('0x4a')]['id'];}return db[_0x66f8('0x2c')][_0x66f8('0x47')]({'where':{'id':_0x36384b[_0x66f8('0x44')]['id']}})[_0x66f8('0x24')](handleEntityNotFound(_0x231386,null))[_0x66f8('0x24')](saveUpdates(_0x36384b[_0x66f8('0x4a')],null))[_0x66f8('0x24')](respondWithResult(_0x231386,null))[_0x66f8('0x48')](handleError(_0x231386,null));};exports[_0x66f8('0x25')]=function(_0x3223ef,_0x546e8e){return db['SugarcrmField'][_0x66f8('0x47')]({'where':{'id':_0x3223ef[_0x66f8('0x44')]['id']}})[_0x66f8('0x24')](handleEntityNotFound(_0x546e8e,null))[_0x66f8('0x24')](removeEntity(_0x546e8e,null))[_0x66f8('0x48')](handleError(_0x546e8e,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index f15eee5..fd7d049 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 _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 +var _0x06bb=['moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','../../config/logger','api'];(function(_0xa00884,_0xceb26e){var _0x5348c0=function(_0x217fa7){while(--_0x217fa7){_0xa00884['push'](_0xa00884['shift']());}};_0x5348c0(++_0xceb26e);}(_0x06bb,0x1dd));var _0xb06b=function(_0x4363ee,_0x24f151){_0x4363ee=_0x4363ee-0x0;var _0x1d824f=_0x06bb[_0x4363ee];return _0x1d824f;};'use strict';var _=require(_0xb06b('0x0'));var util=require('util');var logger=require(_0xb06b('0x1'))(_0xb06b('0x2'));var moment=require(_0xb06b('0x3'));var BPromise=require(_0xb06b('0x4'));var rp=require(_0xb06b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb06b('0x6'));var config=require(_0xb06b('0x7'));var attributes=require(_0xb06b('0x8'));module[_0xb06b('0x9')]=function(_0x11f79a,_0x1ee137){return _0x11f79a[_0xb06b('0xa')](_0xb06b('0xb'),attributes,{'tableName':_0xb06b('0xc'),'paranoid':![],'indexes':[{'name':_0xb06b('0xd'),'fields':[_0xb06b('0xe'),_0xb06b('0xf')],'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 4cd8699..fba27de 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 _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 +var _0x438e=['info','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','http','request','then'];(function(_0x3655a1,_0x44ed1d){var _0x364918=function(_0x5753b6){while(--_0x5753b6){_0x3655a1['push'](_0x3655a1['shift']());}};_0x364918(++_0x44ed1d);}(_0x438e,0x19a));var _0xe438=function(_0x175a55,_0x4082fd){_0x175a55=_0x175a55-0x0;var _0x167adf=_0x438e[_0x175a55];return _0x167adf;};'use strict';var _=require(_0xe438('0x0'));var util=require(_0xe438('0x1'));var moment=require(_0xe438('0x2'));var BPromise=require(_0xe438('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe438('0x4'));var db=require(_0xe438('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe438('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe438('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xc5cba,_0x4d7aa3,_0x3b6098){return new BPromise(function(_0x2a3dbb,_0x10e86d){return client[_0xe438('0x8')](_0xc5cba,_0x3b6098)[_0xe438('0x9')](function(_0x37053d){logger[_0xe438('0xa')](_0xe438('0xb'),_0x4d7aa3,'request\x20sent');logger[_0xe438('0xc')](_0xe438('0xd'),_0x4d7aa3,_0xe438('0xe'),JSON[_0xe438('0xf')](_0x37053d));if(_0x37053d[_0xe438('0x10')]){if(_0x37053d[_0xe438('0x10')][_0xe438('0x11')]===0x1f4){logger[_0xe438('0x10')](_0xe438('0xb'),_0x4d7aa3,_0x37053d[_0xe438('0x10')]['message']);return _0x10e86d(_0x37053d[_0xe438('0x10')]['message']);}logger[_0xe438('0x10')](_0xe438('0xb'),_0x4d7aa3,_0x37053d[_0xe438('0x10')][_0xe438('0x12')]);return _0x2a3dbb(_0x37053d[_0xe438('0x10')][_0xe438('0x12')]);}else{logger['info'](_0xe438('0xb'),_0x4d7aa3,'request\x20sent');_0x2a3dbb(_0x37053d[_0xe438('0x13')]['message']);}})[_0xe438('0x14')](function(_0x243947){logger[_0xe438('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x4d7aa3,_0x243947);_0x10e86d(_0x243947);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 5b33dc6..184e751 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 _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 +var _0x5f86=['/:id','show','/:id/configurations','getConfigurations','post','addConfiguration','put','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index'];(function(_0x1c181e,_0x1d5457){var _0x20bcb5=function(_0x30ec15){while(--_0x30ec15){_0x1c181e['push'](_0x1c181e['shift']());}};_0x20bcb5(++_0x1d5457);}(_0x5f86,0x81));var _0x65f8=function(_0x351c9d,_0x2b306e){_0x351c9d=_0x351c9d-0x0;var _0x281bfa=_0x5f86[_0x351c9d];return _0x281bfa;};'use strict';var multer=require('multer');var util=require(_0x65f8('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x65f8('0x1'));var router=express[_0x65f8('0x2')]();var fs_extra=require(_0x65f8('0x3'));var auth=require(_0x65f8('0x4'));var interaction=require(_0x65f8('0x5'));var config=require(_0x65f8('0x6'));var controller=require(_0x65f8('0x7'));router[_0x65f8('0x8')]('/',auth[_0x65f8('0x9')](),controller[_0x65f8('0xa')]);router[_0x65f8('0x8')](_0x65f8('0xb'),auth[_0x65f8('0x9')](),controller[_0x65f8('0xc')]);router[_0x65f8('0x8')](_0x65f8('0xd'),auth[_0x65f8('0x9')](),controller[_0x65f8('0xe')]);router[_0x65f8('0x8')]('/:id/fields',auth[_0x65f8('0x9')](),controller['getFields']);router[_0x65f8('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x65f8('0xf')](_0x65f8('0xd'),auth[_0x65f8('0x9')](),controller[_0x65f8('0x10')]);router[_0x65f8('0x11')](_0x65f8('0xb'),auth[_0x65f8('0x9')](),controller['update']);router['delete']('/:id',auth[_0x65f8('0x9')](),controller[_0x65f8('0x12')]);module[_0x65f8('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 026a70b..9150b3b 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 _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 +var _0xecd1=['STRING','HelpDesk','sequelize','exports'];(function(_0x1b729d,_0x5c5a6f){var _0x256125=function(_0x31481c){while(--_0x31481c){_0x1b729d['push'](_0x1b729d['shift']());}};_0x256125(++_0x5c5a6f);}(_0xecd1,0x13e));var _0x1ecd=function(_0x30c3f7,_0x35672b){_0x30c3f7=_0x30c3f7-0x0;var _0x56443d=_0xecd1[_0x30c3f7];return _0x56443d;};'use strict';var Sequelize=require(_0x1ecd('0x0'));module[_0x1ecd('0x1')]={'name':{'type':Sequelize[_0x1ecd('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x1ecd('0x2')]},'username':{'type':Sequelize[_0x1ecd('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1ecd('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x1ecd('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index e0fd933..cafcab2 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 _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 +var _0x3fcb=['getDescriptions','create','VtigerField','md5','getFields','username','description','moduleName','serverUrl','accessKey','remoteUri','slice','substring','lastIndexOf','format','%s/webservice.php','GET','success','POST','login','result','token','describe','sessionName','reference','owner','includes','remove','false','cf_','picklistValues','label','log','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','save','then','stack','name','send','index','map','VtigerAccount','rawAttributes','type','keys','query','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','body','update','destroy','VtigerConfiguration','getConfigurations','findOne','AccountId','Subjects','getSubjects','channel','Descriptions'];(function(_0x8a1d5a,_0x214c58){var _0x27cf4e=function(_0x7e67d7){while(--_0x7e67d7){_0x8a1d5a['push'](_0x8a1d5a['shift']());}};_0x27cf4e(++_0x214c58);}(_0x3fcb,0xa2));var _0xb3fc=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3fcb[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0xb3fc('0x0'));var rimraf=require(_0xb3fc('0x1'));var zipdir=require(_0xb3fc('0x2'));var jsonpatch=require(_0xb3fc('0x3'));var rp=require(_0xb3fc('0x4'));var moment=require(_0xb3fc('0x5'));var BPromise=require(_0xb3fc('0x6'));var Mustache=require('mustache');var util=require(_0xb3fc('0x7'));var path=require(_0xb3fc('0x8'));var sox=require(_0xb3fc('0x9'));var csv=require(_0xb3fc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb3fc('0xb'));var _=require(_0xb3fc('0xc'));var squel=require(_0xb3fc('0xd'));var crypto=require(_0xb3fc('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb3fc('0xf'));var toCsv=require(_0xb3fc('0xa'));var querystring=require('querystring');var Papa=require(_0xb3fc('0x10'));var Redis=require(_0xb3fc('0x11'));var authService=require(_0xb3fc('0x12'));var qs=require(_0xb3fc('0x13'));var as=require(_0xb3fc('0x14'));var hardwareService=require(_0xb3fc('0x15'));var logger=require(_0xb3fc('0x16'))('api');var utils=require(_0xb3fc('0x17'));var config=require(_0xb3fc('0x18'));var licenseUtil=require(_0xb3fc('0x19'));var db=require(_0xb3fc('0x1a'))['db'];var integrations=require(_0xb3fc('0x1b'));function respondWithStatusCode(_0x337d38,_0x55fbec){_0x55fbec=_0x55fbec||0xcc;return function(_0x12cc88){if(_0x12cc88){return _0x337d38['sendStatus'](_0x55fbec);}return _0x337d38[_0xb3fc('0x1c')](_0x55fbec)[_0xb3fc('0x1d')]();};}function respondWithResult(_0x278c91,_0x11bb07){_0x11bb07=_0x11bb07||0xc8;return function(_0x3e5fdc){if(_0x3e5fdc){return _0x278c91[_0xb3fc('0x1c')](_0x11bb07)[_0xb3fc('0x1e')](_0x3e5fdc);}};}function respondWithFilteredResult(_0x5e2a7a,_0x1c9665){return function(_0x56842a){if(_0x56842a){var _0x571f4f=typeof _0x1c9665['offset']===_0xb3fc('0x1f')&&typeof _0x1c9665['limit']==='undefined';var _0x31e927=_0x56842a['count'];var _0xe04c74=_0x571f4f?0x0:_0x1c9665[_0xb3fc('0x20')];var _0x4a6cdd=_0x571f4f?_0x56842a[_0xb3fc('0x21')]:_0x1c9665[_0xb3fc('0x20')]+_0x1c9665[_0xb3fc('0x22')];var _0x371ed8;if(_0x4a6cdd>=_0x31e927){_0x4a6cdd=_0x31e927;_0x371ed8=0xc8;}else{_0x371ed8=0xce;}_0x5e2a7a[_0xb3fc('0x1c')](_0x371ed8);return _0x5e2a7a[_0xb3fc('0x23')](_0xb3fc('0x24'),_0xe04c74+'-'+_0x4a6cdd+'/'+_0x31e927)[_0xb3fc('0x1e')](_0x56842a);}return null;};}function patchUpdates(_0x1febc3){return function(_0x242496){try{jsonpatch[_0xb3fc('0x25')](_0x242496,_0x1febc3,!![]);}catch(_0x2da6c1){return BPromise['reject'](_0x2da6c1);}return _0x242496[_0xb3fc('0x26')]();};}function saveUpdates(_0x5489d5,_0x2a247b){return function(_0x465ae6){if(_0x465ae6){return _0x465ae6['update'](_0x5489d5)[_0xb3fc('0x27')](function(_0x290324){return _0x290324;});}return null;};}function removeEntity(_0x143cd0,_0x59bcff){return function(_0x287833){if(_0x287833){return _0x287833['destroy']()[_0xb3fc('0x27')](function(){_0x143cd0['status'](0xcc)[_0xb3fc('0x1d')]();});}};}function handleEntityNotFound(_0x4fb61d,_0x1effca){return function(_0x196ef5){if(!_0x196ef5){_0x4fb61d['sendStatus'](0x194);}return _0x196ef5;};}function handleError(_0x16e79c,_0x5ec576){_0x5ec576=_0x5ec576||0x1f4;return function(_0x5847f5){logger['error'](_0x5847f5[_0xb3fc('0x28')]);if(_0x5847f5[_0xb3fc('0x29')]){delete _0x5847f5[_0xb3fc('0x29')];}_0x16e79c[_0xb3fc('0x1c')](_0x5ec576)[_0xb3fc('0x2a')](_0x5847f5);};}exports[_0xb3fc('0x2b')]=function(_0x41e511,_0x25b952){var _0x552e5a={},_0x457b0e={},_0xa4b63f={'count':0x0,'rows':[]};var _0x217f6e=_[_0xb3fc('0x2c')](db[_0xb3fc('0x2d')][_0xb3fc('0x2e')],function(_0x342843){return{'name':_0x342843['fieldName'],'type':_0x342843[_0xb3fc('0x2f')]['key']};});_0x457b0e['model']=_[_0xb3fc('0x2c')](_0x217f6e,_0xb3fc('0x29'));_0x457b0e['query']=_[_0xb3fc('0x30')](_0x41e511['query']);_0x457b0e['filters']=_['intersection'](_0x457b0e['model'],_0x457b0e[_0xb3fc('0x31')]);_0x552e5a[_0xb3fc('0x32')]=_[_0xb3fc('0x33')](_0x457b0e[_0xb3fc('0x34')],qs['fields'](_0x41e511[_0xb3fc('0x31')][_0xb3fc('0x35')]));_0x552e5a[_0xb3fc('0x32')]=_0x552e5a[_0xb3fc('0x32')][_0xb3fc('0x36')]?_0x552e5a[_0xb3fc('0x32')]:_0x457b0e[_0xb3fc('0x34')];if(!_0x41e511['query'][_0xb3fc('0x37')](_0xb3fc('0x38'))){_0x552e5a[_0xb3fc('0x22')]=qs[_0xb3fc('0x22')](_0x41e511[_0xb3fc('0x31')][_0xb3fc('0x22')]);_0x552e5a['offset']=qs[_0xb3fc('0x20')](_0x41e511['query']['offset']);}_0x552e5a[_0xb3fc('0x39')]=qs[_0xb3fc('0x3a')](_0x41e511[_0xb3fc('0x31')]['sort']);_0x552e5a[_0xb3fc('0x3b')]=qs['filters'](_[_0xb3fc('0x3c')](_0x41e511[_0xb3fc('0x31')],_0x457b0e[_0xb3fc('0x3d')]),_0x217f6e);if(_0x41e511['query'][_0xb3fc('0x3e')]){_0x552e5a[_0xb3fc('0x3b')]=_[_0xb3fc('0x3f')](_0x552e5a['where'],{'$or':_[_0xb3fc('0x2c')](_0x217f6e,function(_0x104edc){if(_0x104edc[_0xb3fc('0x2f')]!==_0xb3fc('0x40')){var _0x5393b0={};_0x5393b0[_0x104edc[_0xb3fc('0x29')]]={'$like':'%'+_0x41e511[_0xb3fc('0x31')][_0xb3fc('0x3e')]+'%'};return _0x5393b0;}})});}_0x552e5a=_['merge']({},_0x552e5a,_0x41e511['options']);var _0x2f4f82={'where':_0x552e5a[_0xb3fc('0x3b')]};return db[_0xb3fc('0x2d')][_0xb3fc('0x21')](_0x2f4f82)[_0xb3fc('0x27')](function(_0xb02746){_0xa4b63f[_0xb3fc('0x21')]=_0xb02746;if(_0x41e511[_0xb3fc('0x31')][_0xb3fc('0x41')]){_0x552e5a[_0xb3fc('0x42')]=[{'all':!![]}];}return db[_0xb3fc('0x2d')][_0xb3fc('0x43')](_0x552e5a);})[_0xb3fc('0x27')](function(_0x537473){_0xa4b63f['rows']=_0x537473;return _0xa4b63f;})[_0xb3fc('0x27')](respondWithFilteredResult(_0x25b952,_0x552e5a))[_0xb3fc('0x44')](handleError(_0x25b952,null));};exports[_0xb3fc('0x45')]=function(_0x2252f8,_0x214589){var _0x8fd3bc={'raw':![],'where':{'id':_0x2252f8[_0xb3fc('0x46')]['id']}},_0x51220b={};_0x51220b[_0xb3fc('0x34')]=_['keys'](db[_0xb3fc('0x2d')][_0xb3fc('0x2e')]);_0x51220b[_0xb3fc('0x31')]=_['keys'](_0x2252f8[_0xb3fc('0x31')]);_0x51220b[_0xb3fc('0x3d')]=_[_0xb3fc('0x33')](_0x51220b[_0xb3fc('0x34')],_0x51220b['query']);_0x8fd3bc['attributes']=_[_0xb3fc('0x33')](_0x51220b[_0xb3fc('0x34')],qs['fields'](_0x2252f8[_0xb3fc('0x31')][_0xb3fc('0x35')]));_0x8fd3bc[_0xb3fc('0x32')]=_0x8fd3bc[_0xb3fc('0x32')]['length']?_0x8fd3bc[_0xb3fc('0x32')]:_0x51220b['model'];if(_0x2252f8[_0xb3fc('0x31')][_0xb3fc('0x41')]){_0x8fd3bc[_0xb3fc('0x42')]=[{'all':!![]}];}_0x8fd3bc=_[_0xb3fc('0x3f')]({},_0x8fd3bc,_0x2252f8[_0xb3fc('0x47')]);return db['VtigerAccount'][_0xb3fc('0x48')](_0x8fd3bc)['then'](handleEntityNotFound(_0x214589,null))[_0xb3fc('0x27')](respondWithResult(_0x214589,null))[_0xb3fc('0x44')](handleError(_0x214589,null));};exports['create']=function(_0xf68393,_0x30aa95){return db[_0xb3fc('0x2d')]['create'](_0xf68393[_0xb3fc('0x49')],{})[_0xb3fc('0x27')](respondWithResult(_0x30aa95,0xc9))[_0xb3fc('0x44')](handleError(_0x30aa95,null));};exports[_0xb3fc('0x4a')]=function(_0x5aeab5,_0x284477){if(_0x5aeab5[_0xb3fc('0x49')]['id']){delete _0x5aeab5[_0xb3fc('0x49')]['id'];}return db[_0xb3fc('0x2d')]['find']({'where':{'id':_0x5aeab5[_0xb3fc('0x46')]['id']}})[_0xb3fc('0x27')](handleEntityNotFound(_0x284477,null))['then'](saveUpdates(_0x5aeab5['body'],null))[_0xb3fc('0x27')](respondWithResult(_0x284477,null))['catch'](handleError(_0x284477,null));};exports[_0xb3fc('0x4b')]=function(_0x37598f,_0x5bff02){return db[_0xb3fc('0x2d')][_0xb3fc('0x48')]({'where':{'id':_0x37598f[_0xb3fc('0x46')]['id']}})['then'](handleEntityNotFound(_0x5bff02,null))[_0xb3fc('0x27')](removeEntity(_0x5bff02,null))[_0xb3fc('0x44')](handleError(_0x5bff02,null));};exports['getConfigurations']=function(_0x51cb4c,_0xc0952d,_0x5679dd){var _0x336088={};var _0x36a1c7={};var _0x165bd3;var _0x31b7b8;return db['VtigerAccount']['findOne']({'where':{'id':_0x51cb4c['params']['id']}})['then'](handleEntityNotFound(_0xc0952d,null))[_0xb3fc('0x27')](function(_0x55ab0f){if(_0x55ab0f){_0x165bd3=_0x55ab0f;_0x36a1c7[_0xb3fc('0x34')]=_[_0xb3fc('0x30')](db[_0xb3fc('0x4c')]['rawAttributes']);_0x36a1c7['query']=_[_0xb3fc('0x30')](_0x51cb4c['query']);_0x36a1c7['filters']=_['intersection'](_0x36a1c7[_0xb3fc('0x34')],_0x36a1c7['query']);_0x336088[_0xb3fc('0x32')]=_[_0xb3fc('0x33')](_0x36a1c7[_0xb3fc('0x34')],qs['fields'](_0x51cb4c[_0xb3fc('0x31')][_0xb3fc('0x35')]));_0x336088['attributes']=_0x336088[_0xb3fc('0x32')][_0xb3fc('0x36')]?_0x336088[_0xb3fc('0x32')]:_0x36a1c7[_0xb3fc('0x34')];_0x336088[_0xb3fc('0x39')]=qs[_0xb3fc('0x3a')](_0x51cb4c[_0xb3fc('0x31')][_0xb3fc('0x3a')]);_0x336088[_0xb3fc('0x3b')]=qs[_0xb3fc('0x3d')](_[_0xb3fc('0x3c')](_0x51cb4c['query'],_0x36a1c7[_0xb3fc('0x3d')]));if(_0x51cb4c[_0xb3fc('0x31')][_0xb3fc('0x3e')]){_0x336088[_0xb3fc('0x3b')]=_['merge'](_0x336088['where'],{'$or':_[_0xb3fc('0x2c')](_0x336088[_0xb3fc('0x32')],function(_0x56041c){var _0xad9b05={};_0xad9b05[_0x56041c]={'$like':'%'+_0x51cb4c['query'][_0xb3fc('0x3e')]+'%'};return _0xad9b05;})});}_0x336088=_[_0xb3fc('0x3f')]({},_0x336088,_0x51cb4c[_0xb3fc('0x47')]);return _0x165bd3['getConfigurations'](_0x336088);}})[_0xb3fc('0x27')](function(_0x150baf){if(_0x150baf){_0x31b7b8=_0x150baf[_0xb3fc('0x36')];if(!_0x51cb4c[_0xb3fc('0x31')][_0xb3fc('0x37')](_0xb3fc('0x38'))){_0x336088[_0xb3fc('0x22')]=qs[_0xb3fc('0x22')](_0x51cb4c[_0xb3fc('0x31')][_0xb3fc('0x22')]);_0x336088[_0xb3fc('0x20')]=qs[_0xb3fc('0x20')](_0x51cb4c[_0xb3fc('0x31')]['offset']);}return _0x165bd3[_0xb3fc('0x4d')](_0x336088);}})[_0xb3fc('0x27')](function(_0x5ad0b8){if(_0x5ad0b8){return _0x5ad0b8?{'count':_0x31b7b8,'rows':_0x5ad0b8}:null;}})[_0xb3fc('0x27')](respondWithResult(_0xc0952d,null))[_0xb3fc('0x44')](handleError(_0xc0952d,null));};exports['addConfiguration']=function(_0x284c0f,_0x476632,_0x5c392f){if(_0x284c0f['body']['id']){delete _0x284c0f[_0xb3fc('0x49')]['id'];}return db['VtigerAccount'][_0xb3fc('0x4e')]({'where':{'id':_0x284c0f['params']['id']}})[_0xb3fc('0x27')](handleEntityNotFound(_0x476632,null))[_0xb3fc('0x27')](function(_0x3ff578){if(_0x3ff578){_0x284c0f[_0xb3fc('0x49')][_0xb3fc('0x4f')]=_0x3ff578['id'];_0x284c0f['body'][_0xb3fc('0x50')]=integrations[_0xb3fc('0x51')](_0x284c0f[_0xb3fc('0x49')][_0xb3fc('0x52')],_0x284c0f[_0xb3fc('0x49')]['type']);_0x284c0f[_0xb3fc('0x49')][_0xb3fc('0x53')]=integrations[_0xb3fc('0x54')](_0x284c0f['body']['channel'],_0x284c0f[_0xb3fc('0x49')][_0xb3fc('0x2f')]);return db[_0xb3fc('0x4c')][_0xb3fc('0x55')](_0x284c0f[_0xb3fc('0x49')],{'include':[{'model':db[_0xb3fc('0x56')],'as':_0xb3fc('0x50')},{'model':db[_0xb3fc('0x56')],'as':_0xb3fc('0x53')}]});}return null;})[_0xb3fc('0x27')](respondWithResult(_0x476632,null))['catch'](handleError(_0x476632,null));};var md5=require(_0xb3fc('0x57'));exports[_0xb3fc('0x58')]=function(_0xf28254,_0x298830,_0x5c2e67){var _0x54f171=null;var _0x36ecb0=null;var _0x2837ad=null;var _0x48cd60=null;var _0x3df1a3='';return db[_0xb3fc('0x2d')]['findOne']({'where':{'id':_0xf28254[_0xb3fc('0x46')]['id']},'attributes':['id',_0xb3fc('0x29'),_0xb3fc('0x59'),_0xb3fc('0x5a'),_0xb3fc('0x5b'),'remoteUri',_0xb3fc('0x5c'),_0xb3fc('0x5d')]})['then'](handleEntityNotFound(_0x298830,null))[_0xb3fc('0x27')](function(_0x3f152a){if(_0x3f152a){_0x54f171=_0x3f152a['username'];_0x36ecb0=_0x3f152a[_0xb3fc('0x5d')];_0x2837ad=_0x3f152a['moduleName'];_0x3df1a3=_0x3f152a[_0xb3fc('0x5e')];var _0x1f67ab=_0x3df1a3[_0xb3fc('0x5f')](-0x1);if(_0x1f67ab==='/'){_0x3df1a3=_0x3df1a3[_0xb3fc('0x60')](0x0,_0x3df1a3[_0xb3fc('0x61')](_0x1f67ab));}_0x48cd60=util[_0xb3fc('0x62')](_0xb3fc('0x63'),_0x3df1a3);var _0x2fefac={'method':_0xb3fc('0x64'),'uri':_0x48cd60,'qs':{'operation':'getchallenge','username':_0x3f152a[_0xb3fc('0x59')]},'json':!![]};return rp(_0x2fefac);}})[_0xb3fc('0x27')](function(_0x1c828f){if(_0x1c828f[_0xb3fc('0x65')]){var _0x265ebc={'method':_0xb3fc('0x66'),'uri':_0x48cd60,'form':{'operation':_0xb3fc('0x67'),'username':_0x54f171,'accessKey':md5(_0x1c828f[_0xb3fc('0x68')][_0xb3fc('0x69')]+_0x36ecb0)},'json':!![]};return rp(_0x265ebc);}})[_0xb3fc('0x27')](function(_0x3a10fd){if(_0x3a10fd[_0xb3fc('0x65')]){var _0x590d5b={'method':_0xb3fc('0x64'),'uri':_0x48cd60,'qs':{'operation':_0xb3fc('0x6a'),'username':_0x54f171,'sessionName':_0x3a10fd[_0xb3fc('0x68')][_0xb3fc('0x6b')],'elementType':_0x2837ad},'json':!![]};return rp(_0x590d5b);}})[_0xb3fc('0x27')](function(_0x3c5c00){if(_0x3c5c00['success']){var _0x578a3e=['autogenerated',_0xb3fc('0x6c'),_0xb3fc('0x6d')];_['remove'](_0x3c5c00[_0xb3fc('0x68')][_0xb3fc('0x35')],function(_0xdba814){return _0x578a3e[_0xb3fc('0x6e')](_0xdba814[_0xb3fc('0x2f')]['name']);});_[_0xb3fc('0x6f')](_0x3c5c00[_0xb3fc('0x68')][_0xb3fc('0x35')],function(_0x5311d4){return _0x5311d4['editable']===_0xb3fc('0x70');});return{'count':_0x3c5c00[_0xb3fc('0x68')][_0xb3fc('0x35')][_0xb3fc('0x36')],'rows':_[_0xb3fc('0x2c')](_0x3c5c00[_0xb3fc('0x68')][_0xb3fc('0x35')],function(_0x599c7d){return{'id':_0x599c7d['name'],'name':_0x599c7d['label'],'custom':_['startsWith'](_0x599c7d[_0xb3fc('0x29')],_0xb3fc('0x71'))?!![]:![],'options':_0x599c7d['type'][_0xb3fc('0x29')]==='picklist'&&_0x599c7d[_0xb3fc('0x2f')][_0xb3fc('0x72')][_0xb3fc('0x36')]>0x0?_['map'](_0x599c7d[_0xb3fc('0x2f')]['picklistValues'],function(_0x5bdae6){return{'name':_0x5bdae6[_0xb3fc('0x73')],'value':_0x5bdae6['value']};}):[]};})};}})[_0xb3fc('0x27')](respondWithResult(_0x298830,null))[_0xb3fc('0x44')](function(_0x33ceef){console[_0xb3fc('0x74')]('vTiger\x20error:\x20'+_0x33ceef);var _0x54ce14=_0xf28254[_0xb3fc('0x31')]['test']?0x1f4:_0x33ceef['statusCode']||0x1f4;logger[_0xb3fc('0x75')](_0xb3fc('0x76'),_0xb3fc('0x58'),_0x54ce14,JSON[_0xb3fc('0x77')](_0x33ceef));delete _0x33ceef[_0xb3fc('0x29')];if(_0x54ce14===0x191){_0x54ce14=0x190;}_0x298830['status'](_0x54ce14)[_0xb3fc('0x2a')](_0xf28254['query'][_0xb3fc('0x78')]?{'message':_0xb3fc('0x79'),'statusCode':_0x33ceef[_0xb3fc('0x7a')]}:_0x33ceef);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 34eccf6..d2449b1 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 _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 +var _0x1e31=['define','int_vtiger_accounts','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration'];(function(_0xe2a525,_0x1739f7){var _0x3df847=function(_0x1f391e){while(--_0x1f391e){_0xe2a525['push'](_0xe2a525['shift']());}};_0x3df847(++_0x1739f7);}(_0x1e31,0x162));var _0x11e3=function(_0x360aac,_0xd96009){_0x360aac=_0x360aac-0x0;var _0x5826fd=_0x1e31[_0x360aac];return _0x5826fd;};'use strict';var _=require('lodash');var util=require(_0x11e3('0x0'));var logger=require(_0x11e3('0x1'))(_0x11e3('0x2'));var moment=require('moment');var BPromise=require(_0x11e3('0x3'));var rp=require(_0x11e3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x11e3('0x5'));var config=require(_0x11e3('0x6'));var attributes=require(_0x11e3('0x7'));var integrations=require(_0x11e3('0x8'));module['exports']=function(_0x18934e,_0x29873d){return _0x18934e[_0x11e3('0x9')]('VtigerAccount',attributes,{'tableName':_0x11e3('0xa'),'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 7632754..06a03e9 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 _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 +var _0xcf66=['raw','where','attributes','limit','include','map','model','info','ShowVtigerAccount','find','debug','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount','VtigerAccount','options'];(function(_0x2dde25,_0x36aa4b){var _0x4da423=function(_0x49061f){while(--_0x49061f){_0x2dde25['push'](_0x2dde25['shift']());}};_0x4da423(++_0x36aa4b);}(_0xcf66,0x71));var _0x6cf6=function(_0x33b48d,_0x24bbcf){_0x33b48d=_0x33b48d-0x0;var _0xe97860=_0xcf66[_0x33b48d];return _0xe97860;};'use strict';var _=require(_0x6cf6('0x0'));var util=require(_0x6cf6('0x1'));var moment=require(_0x6cf6('0x2'));var BPromise=require('bluebird');var rs=require(_0x6cf6('0x3'));var fs=require('fs');var Redis=require(_0x6cf6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6cf6('0x5'))(_0x6cf6('0x6'));var config=require('../../config/environment');var jayson=require(_0x6cf6('0x7'));var client=jayson[_0x6cf6('0x8')][_0x6cf6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5eb082,_0x94c6a9,_0x308d0d){return new BPromise(function(_0x36b892,_0x748c93){return client[_0x6cf6('0xa')](_0x5eb082,_0x308d0d)[_0x6cf6('0xb')](function(_0x5b3827){logger['info']('VtigerAccount,\x20%s,\x20%s',_0x94c6a9,_0x6cf6('0xc'));logger['debug'](_0x6cf6('0xd'),_0x94c6a9,_0x6cf6('0xc'),JSON[_0x6cf6('0xe')](_0x5b3827));if(_0x5b3827[_0x6cf6('0xf')]){if(_0x5b3827['error']['code']===0x1f4){logger['error'](_0x6cf6('0x10'),_0x94c6a9,_0x5b3827[_0x6cf6('0xf')][_0x6cf6('0x11')]);return _0x748c93(_0x5b3827[_0x6cf6('0xf')][_0x6cf6('0x11')]);}logger[_0x6cf6('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x94c6a9,_0x5b3827[_0x6cf6('0xf')]['message']);return _0x36b892(_0x5b3827[_0x6cf6('0xf')][_0x6cf6('0x11')]);}else{logger['info'](_0x6cf6('0x10'),_0x94c6a9,_0x6cf6('0xc'));_0x36b892(_0x5b3827[_0x6cf6('0x12')][_0x6cf6('0x11')]);}})[_0x6cf6('0x13')](function(_0x2bdb12){logger[_0x6cf6('0xf')](_0x6cf6('0x10'),_0x94c6a9,_0x2bdb12);_0x748c93(_0x2bdb12);});});}exports[_0x6cf6('0x14')]=function(_0x2ca2b1){var _0x5e8b11=this;return new Promise(function(_0x11d994,_0x22915c){return db[_0x6cf6('0x15')]['findAll']({'raw':_0x2ca2b1[_0x6cf6('0x16')]?_0x2ca2b1[_0x6cf6('0x16')][_0x6cf6('0x17')]===undefined?!![]:![]:!![],'where':_0x2ca2b1[_0x6cf6('0x16')]?_0x2ca2b1[_0x6cf6('0x16')][_0x6cf6('0x18')]||null:null,'attributes':_0x2ca2b1[_0x6cf6('0x16')]?_0x2ca2b1['options'][_0x6cf6('0x19')]||null:null,'limit':_0x2ca2b1[_0x6cf6('0x16')]?_0x2ca2b1[_0x6cf6('0x16')][_0x6cf6('0x1a')]||null:null,'include':_0x2ca2b1[_0x6cf6('0x16')]?_0x2ca2b1[_0x6cf6('0x16')][_0x6cf6('0x1b')]?_[_0x6cf6('0x1c')](_0x2ca2b1['options']['include'],function(_0x276225){return{'model':db[_0x276225['model']],'as':_0x276225['as'],'attributes':_0x276225[_0x6cf6('0x19')],'include':_0x276225[_0x6cf6('0x1b')]?_[_0x6cf6('0x1c')](_0x276225[_0x6cf6('0x1b')],function(_0x3f9871){return{'model':db[_0x3f9871[_0x6cf6('0x1d')]],'as':_0x3f9871['as'],'attributes':_0x3f9871[_0x6cf6('0x19')],'include':_0x3f9871['include']?_[_0x6cf6('0x1c')](_0x3f9871[_0x6cf6('0x1b')],function(_0x3eaa31){return{'model':db[_0x3eaa31['model']],'as':_0x3eaa31['as'],'attributes':_0x3eaa31[_0x6cf6('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6cf6('0xb')](function(_0x2224db){logger[_0x6cf6('0x1e')]('GetVtigerAccount',_0x2ca2b1);logger['debug'](_0x6cf6('0x14'),_0x2ca2b1,JSON[_0x6cf6('0xe')](_0x2224db));_0x11d994(_0x2224db);})[_0x6cf6('0x13')](function(_0x5869e9){logger['error'](_0x6cf6('0x14'),_0x5869e9['message'],_0x2ca2b1);_0x22915c(_0x5e8b11['error'](0x1f4,_0x5869e9['message']));});});};exports[_0x6cf6('0x1f')]=function(_0x65433){var _0x33d308=this;return new Promise(function(_0x42f488,_0x11c848){return db['VtigerAccount'][_0x6cf6('0x20')]({'raw':_0x65433[_0x6cf6('0x16')]?_0x65433[_0x6cf6('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x65433[_0x6cf6('0x16')]?_0x65433[_0x6cf6('0x16')][_0x6cf6('0x18')]||null:null,'attributes':_0x65433[_0x6cf6('0x16')]?_0x65433[_0x6cf6('0x16')][_0x6cf6('0x19')]||null:null,'include':_0x65433[_0x6cf6('0x16')]?_0x65433[_0x6cf6('0x16')][_0x6cf6('0x1b')]?_[_0x6cf6('0x1c')](_0x65433[_0x6cf6('0x16')][_0x6cf6('0x1b')],function(_0x4620b6){return{'model':db[_0x4620b6[_0x6cf6('0x1d')]],'as':_0x4620b6['as'],'attributes':_0x4620b6[_0x6cf6('0x19')],'include':_0x4620b6[_0x6cf6('0x1b')]?_[_0x6cf6('0x1c')](_0x4620b6[_0x6cf6('0x1b')],function(_0x5cc6cd){return{'model':db[_0x5cc6cd[_0x6cf6('0x1d')]],'as':_0x5cc6cd['as'],'attributes':_0x5cc6cd[_0x6cf6('0x19')],'include':_0x5cc6cd[_0x6cf6('0x1b')]?_[_0x6cf6('0x1c')](_0x5cc6cd[_0x6cf6('0x1b')],function(_0x2cf3a3){return{'model':db[_0x2cf3a3[_0x6cf6('0x1d')]],'as':_0x2cf3a3['as'],'attributes':_0x2cf3a3[_0x6cf6('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6cf6('0xb')](function(_0x3718a1){logger[_0x6cf6('0x1e')]('ShowVtigerAccount',_0x65433);logger[_0x6cf6('0x21')](_0x6cf6('0x1f'),_0x65433,JSON[_0x6cf6('0xe')](_0x3718a1));_0x42f488(_0x3718a1);})[_0x6cf6('0x13')](function(_0x31c822){logger[_0x6cf6('0xf')](_0x6cf6('0x1f'),_0x31c822[_0x6cf6('0x11')],_0x65433);_0x11c848(_0x33d308[_0x6cf6('0xf')](0x1f4,_0x31c822['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index f59aaad..b84cb97 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 _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 +var _0x3efb=['/:id/descriptions','getDescriptions','post','create','put','/:id','update','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects'];(function(_0x4bf628,_0x2a0ebd){var _0x542e6f=function(_0x13dd4f){while(--_0x13dd4f){_0x4bf628['push'](_0x4bf628['shift']());}};_0x542e6f(++_0x2a0ebd);}(_0x3efb,0xd7));var _0xb3ef=function(_0x52666e,_0x5b3776){_0x52666e=_0x52666e-0x0;var _0x515330=_0x3efb[_0x52666e];return _0x515330;};'use strict';var multer=require(_0xb3ef('0x0'));var util=require(_0xb3ef('0x1'));var path=require(_0xb3ef('0x2'));var timeout=require('connect-timeout');var express=require(_0xb3ef('0x3'));var router=express['Router']();var fs_extra=require(_0xb3ef('0x4'));var auth=require(_0xb3ef('0x5'));var interaction=require(_0xb3ef('0x6'));var config=require(_0xb3ef('0x7'));var controller=require(_0xb3ef('0x8'));router[_0xb3ef('0x9')]('/',auth[_0xb3ef('0xa')](),controller['index']);router['get']('/:id',auth[_0xb3ef('0xa')](),controller[_0xb3ef('0xb')]);router[_0xb3ef('0x9')](_0xb3ef('0xc'),auth[_0xb3ef('0xa')](),controller['getFields']);router['get'](_0xb3ef('0xd'),auth['isAuthenticated'](),controller[_0xb3ef('0xe')]);router[_0xb3ef('0x9')](_0xb3ef('0xf'),auth['isAuthenticated'](),controller[_0xb3ef('0x10')]);router[_0xb3ef('0x11')]('/',auth['isAuthenticated'](),controller[_0xb3ef('0x12')]);router[_0xb3ef('0x13')](_0xb3ef('0x14'),auth['isAuthenticated'](),controller[_0xb3ef('0x15')]);router['delete'](_0xb3ef('0x14'),auth[_0xb3ef('0xa')](),controller['destroy']);module[_0xb3ef('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 739a2fb..e23ae71 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 _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 +var _0x8884=['sequelize','STRING'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x8884,0x19a));var _0x4888=function(_0x2cbac6,_0x3b32bd){_0x2cbac6=_0x2cbac6-0x0;var _0x1709a8=_0x8884[_0x2cbac6];return _0x1709a8;};'use strict';var Sequelize=require(_0x4888('0x0'));module['exports']={'name':{'type':Sequelize[_0x4888('0x1')]},'description':{'type':Sequelize[_0x4888('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index b945af7..0f55b5c 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 _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 +var _0x5912=['rawAttributes','fieldName','key','model','map','filters','intersection','query','attributes','fields','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','merge','create','body','find','getFields','VtigerField','hasOwnProperty','findOne','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','VtigerConfiguration'];(function(_0x1b6c41,_0x56c974){var _0x3cde58=function(_0x24b471){while(--_0x24b471){_0x1b6c41['push'](_0x1b6c41['shift']());}};_0x3cde58(++_0x56c974);}(_0x5912,0x1cf));var _0x2591=function(_0x3af64a,_0x3d87d5){_0x3af64a=_0x3af64a-0x0;var _0x284090=_0x5912[_0x3af64a];return _0x284090;};'use strict';var emlformat=require(_0x2591('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2591('0x1'));var jsonpatch=require(_0x2591('0x2'));var rp=require(_0x2591('0x3'));var moment=require(_0x2591('0x4'));var BPromise=require(_0x2591('0x5'));var Mustache=require(_0x2591('0x6'));var util=require(_0x2591('0x7'));var path=require('path');var sox=require(_0x2591('0x8'));var csv=require(_0x2591('0x9'));var ejs=require(_0x2591('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2591('0xb'));var squel=require(_0x2591('0xc'));var crypto=require(_0x2591('0xd'));var jsforce=require(_0x2591('0xe'));var deskjs=require(_0x2591('0xf'));var toCsv=require(_0x2591('0x9'));var querystring=require(_0x2591('0x10'));var Papa=require(_0x2591('0x11'));var Redis=require(_0x2591('0x12'));var authService=require(_0x2591('0x13'));var qs=require(_0x2591('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2591('0x15'));var logger=require('../../config/logger')(_0x2591('0x16'));var utils=require(_0x2591('0x17'));var config=require(_0x2591('0x18'));var licenseUtil=require(_0x2591('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x350931,_0x5628bd){_0x5628bd=_0x5628bd||0xcc;return function(_0x477566){if(_0x477566){return _0x350931['sendStatus'](_0x5628bd);}return _0x350931['status'](_0x5628bd)['end']();};}function respondWithResult(_0x561d0b,_0x4eeeb4){_0x4eeeb4=_0x4eeeb4||0xc8;return function(_0x3a381e){if(_0x3a381e){return _0x561d0b[_0x2591('0x1a')](_0x4eeeb4)[_0x2591('0x1b')](_0x3a381e);}};}function respondWithFilteredResult(_0x3df208,_0x2a401f){return function(_0x3547e7){if(_0x3547e7){var _0x1ae634=typeof _0x2a401f[_0x2591('0x1c')]===_0x2591('0x1d')&&typeof _0x2a401f[_0x2591('0x1e')]===_0x2591('0x1d');var _0x4db830=_0x3547e7[_0x2591('0x1f')];var _0x3ca143=_0x1ae634?0x0:_0x2a401f['offset'];var _0x2299e4=_0x1ae634?_0x3547e7[_0x2591('0x1f')]:_0x2a401f[_0x2591('0x1c')]+_0x2a401f['limit'];var _0x9ecd9a;if(_0x2299e4>=_0x4db830){_0x2299e4=_0x4db830;_0x9ecd9a=0xc8;}else{_0x9ecd9a=0xce;}_0x3df208[_0x2591('0x1a')](_0x9ecd9a);return _0x3df208[_0x2591('0x20')](_0x2591('0x21'),_0x3ca143+'-'+_0x2299e4+'/'+_0x4db830)[_0x2591('0x1b')](_0x3547e7);}return null;};}function patchUpdates(_0xd7fbb0){return function(_0x42a7b4){try{jsonpatch[_0x2591('0x22')](_0x42a7b4,_0xd7fbb0,!![]);}catch(_0x476970){return BPromise[_0x2591('0x23')](_0x476970);}return _0x42a7b4[_0x2591('0x24')]();};}function saveUpdates(_0x56de62,_0xc1e8ea){return function(_0x20fe2b){if(_0x20fe2b){return _0x20fe2b[_0x2591('0x25')](_0x56de62)[_0x2591('0x26')](function(_0x2a2eeb){return _0x2a2eeb;});}return null;};}function removeEntity(_0x1b8ebf,_0x3909a0){return function(_0x427c73){if(_0x427c73){return _0x427c73[_0x2591('0x27')]()[_0x2591('0x26')](function(){_0x1b8ebf[_0x2591('0x1a')](0xcc)[_0x2591('0x28')]();});}};}function handleEntityNotFound(_0x166334,_0x43c646){return function(_0x3db34){if(!_0x3db34){_0x166334[_0x2591('0x29')](0x194);}return _0x3db34;};}function handleError(_0x33f415,_0x2b7f52){_0x2b7f52=_0x2b7f52||0x1f4;return function(_0x3c427e){logger[_0x2591('0x2a')](_0x3c427e[_0x2591('0x2b')]);if(_0x3c427e[_0x2591('0x2c')]){delete _0x3c427e[_0x2591('0x2c')];}_0x33f415['status'](_0x2b7f52)[_0x2591('0x2d')](_0x3c427e);};}exports['index']=function(_0xa966c0,_0x219101){var _0x2b1b92={},_0x5a4e89={},_0x49cc30={'count':0x0,'rows':[]};var _0xf10ec2=_['map'](db[_0x2591('0x2e')][_0x2591('0x2f')],function(_0x3d30d5){return{'name':_0x3d30d5[_0x2591('0x30')],'type':_0x3d30d5['type'][_0x2591('0x31')]};});_0x5a4e89[_0x2591('0x32')]=_[_0x2591('0x33')](_0xf10ec2,'name');_0x5a4e89['query']=_['keys'](_0xa966c0['query']);_0x5a4e89[_0x2591('0x34')]=_[_0x2591('0x35')](_0x5a4e89['model'],_0x5a4e89[_0x2591('0x36')]);_0x2b1b92[_0x2591('0x37')]=_[_0x2591('0x35')](_0x5a4e89['model'],qs[_0x2591('0x38')](_0xa966c0[_0x2591('0x36')][_0x2591('0x38')]));_0x2b1b92['attributes']=_0x2b1b92[_0x2591('0x37')]['length']?_0x2b1b92['attributes']:_0x5a4e89[_0x2591('0x32')];if(!_0xa966c0[_0x2591('0x36')]['hasOwnProperty'](_0x2591('0x39'))){_0x2b1b92[_0x2591('0x1e')]=qs['limit'](_0xa966c0['query']['limit']);_0x2b1b92[_0x2591('0x1c')]=qs[_0x2591('0x1c')](_0xa966c0[_0x2591('0x36')][_0x2591('0x1c')]);}_0x2b1b92[_0x2591('0x3a')]=qs[_0x2591('0x3b')](_0xa966c0[_0x2591('0x36')][_0x2591('0x3b')]);_0x2b1b92[_0x2591('0x3c')]=qs[_0x2591('0x34')](_[_0x2591('0x3d')](_0xa966c0[_0x2591('0x36')],_0x5a4e89[_0x2591('0x34')]),_0xf10ec2);if(_0xa966c0[_0x2591('0x36')][_0x2591('0x3e')]){_0x2b1b92[_0x2591('0x3c')]=_['merge'](_0x2b1b92[_0x2591('0x3c')],{'$or':_[_0x2591('0x33')](_0xf10ec2,function(_0x351115){if(_0x351115[_0x2591('0x3f')]!==_0x2591('0x40')){var _0x34008e={};_0x34008e[_0x351115[_0x2591('0x2c')]]={'$like':'%'+_0xa966c0[_0x2591('0x36')]['filter']+'%'};return _0x34008e;}})});}_0x2b1b92=_['merge']({},_0x2b1b92,_0xa966c0[_0x2591('0x41')]);var _0xdafeca={'where':_0x2b1b92['where']};return db[_0x2591('0x2e')][_0x2591('0x1f')](_0xdafeca)[_0x2591('0x26')](function(_0x2cf095){_0x49cc30[_0x2591('0x1f')]=_0x2cf095;if(_0xa966c0['query'][_0x2591('0x42')]){_0x2b1b92[_0x2591('0x43')]=[{'all':!![]}];}return db[_0x2591('0x2e')][_0x2591('0x44')](_0x2b1b92);})[_0x2591('0x26')](function(_0x52d89e){_0x49cc30[_0x2591('0x45')]=_0x52d89e;return _0x49cc30;})[_0x2591('0x26')](respondWithFilteredResult(_0x219101,_0x2b1b92))[_0x2591('0x46')](handleError(_0x219101,null));};exports[_0x2591('0x47')]=function(_0x24be2a,_0x3c92b9){var _0x59bab9={'raw':![],'where':{'id':_0x24be2a[_0x2591('0x48')]['id']}},_0x328f05={};_0x328f05[_0x2591('0x32')]=_[_0x2591('0x49')](db['VtigerConfiguration'][_0x2591('0x2f')]);_0x328f05[_0x2591('0x36')]=_['keys'](_0x24be2a[_0x2591('0x36')]);_0x328f05[_0x2591('0x34')]=_[_0x2591('0x35')](_0x328f05[_0x2591('0x32')],_0x328f05[_0x2591('0x36')]);_0x59bab9['attributes']=_[_0x2591('0x35')](_0x328f05[_0x2591('0x32')],qs[_0x2591('0x38')](_0x24be2a['query'][_0x2591('0x38')]));_0x59bab9['attributes']=_0x59bab9[_0x2591('0x37')][_0x2591('0x4a')]?_0x59bab9[_0x2591('0x37')]:_0x328f05['model'];if(_0x24be2a['query'][_0x2591('0x42')]){_0x59bab9[_0x2591('0x43')]=[{'all':!![]}];}_0x59bab9=_[_0x2591('0x4b')]({},_0x59bab9,_0x24be2a[_0x2591('0x41')]);return db[_0x2591('0x2e')]['find'](_0x59bab9)['then'](handleEntityNotFound(_0x3c92b9,null))['then'](respondWithResult(_0x3c92b9,null))[_0x2591('0x46')](handleError(_0x3c92b9,null));};exports[_0x2591('0x4c')]=function(_0x4c80bc,_0x8ddf08){return db[_0x2591('0x2e')][_0x2591('0x4c')](_0x4c80bc[_0x2591('0x4d')],{})[_0x2591('0x26')](respondWithResult(_0x8ddf08,0xc9))[_0x2591('0x46')](handleError(_0x8ddf08,null));};exports[_0x2591('0x25')]=function(_0x24b902,_0x1427d7){if(_0x24b902['body']['id']){delete _0x24b902[_0x2591('0x4d')]['id'];}return db[_0x2591('0x2e')][_0x2591('0x4e')]({'where':{'id':_0x24b902['params']['id']}})[_0x2591('0x26')](handleEntityNotFound(_0x1427d7,null))[_0x2591('0x26')](saveUpdates(_0x24b902[_0x2591('0x4d')],null))[_0x2591('0x26')](respondWithResult(_0x1427d7,null))[_0x2591('0x46')](handleError(_0x1427d7,null));};exports[_0x2591('0x27')]=function(_0x9fa239,_0x5032ed){return db[_0x2591('0x2e')][_0x2591('0x4e')]({'where':{'id':_0x9fa239['params']['id']}})['then'](handleEntityNotFound(_0x5032ed,null))[_0x2591('0x26')](removeEntity(_0x5032ed,null))[_0x2591('0x46')](handleError(_0x5032ed,null));};exports[_0x2591('0x4f')]=function(_0x4f71e4,_0x1a6013,_0x4293ee){var _0x64ab93={};var _0x17625e={};var _0x1d4a20;var _0x56117d;return db[_0x2591('0x2e')]['findOne']({'where':{'id':_0x4f71e4[_0x2591('0x48')]['id']}})[_0x2591('0x26')](handleEntityNotFound(_0x1a6013,null))[_0x2591('0x26')](function(_0x5e9547){if(_0x5e9547){_0x1d4a20=_0x5e9547;_0x17625e[_0x2591('0x32')]=_['keys'](db[_0x2591('0x50')][_0x2591('0x2f')]);_0x17625e['query']=_[_0x2591('0x49')](_0x4f71e4['query']);_0x17625e[_0x2591('0x34')]=_['intersection'](_0x17625e[_0x2591('0x32')],_0x17625e['query']);_0x64ab93[_0x2591('0x37')]=_[_0x2591('0x35')](_0x17625e[_0x2591('0x32')],qs['fields'](_0x4f71e4['query'][_0x2591('0x38')]));_0x64ab93[_0x2591('0x37')]=_0x64ab93['attributes']['length']?_0x64ab93['attributes']:_0x17625e[_0x2591('0x32')];_0x64ab93[_0x2591('0x3a')]=qs[_0x2591('0x3b')](_0x4f71e4['query']['sort']);_0x64ab93['where']=qs[_0x2591('0x34')](_[_0x2591('0x3d')](_0x4f71e4[_0x2591('0x36')],_0x17625e[_0x2591('0x34')]));if(_0x4f71e4[_0x2591('0x36')][_0x2591('0x3e')]){_0x64ab93[_0x2591('0x3c')]=_[_0x2591('0x4b')](_0x64ab93[_0x2591('0x3c')],{'$or':_[_0x2591('0x33')](_0x64ab93[_0x2591('0x37')],function(_0x23c591){var _0xd7f4c3={};_0xd7f4c3[_0x23c591]={'$like':'%'+_0x4f71e4[_0x2591('0x36')][_0x2591('0x3e')]+'%'};return _0xd7f4c3;})});}_0x64ab93=_[_0x2591('0x4b')]({},_0x64ab93,_0x4f71e4['options']);return _0x1d4a20['getFields'](_0x64ab93);}})[_0x2591('0x26')](function(_0xfb10b9){if(_0xfb10b9){_0x56117d=_0xfb10b9[_0x2591('0x4a')];if(!_0x4f71e4['query'][_0x2591('0x51')](_0x2591('0x39'))){_0x64ab93['limit']=qs[_0x2591('0x1e')](_0x4f71e4['query'][_0x2591('0x1e')]);_0x64ab93[_0x2591('0x1c')]=qs[_0x2591('0x1c')](_0x4f71e4[_0x2591('0x36')]['offset']);}return _0x1d4a20[_0x2591('0x4f')](_0x64ab93);}})['then'](function(_0x4cf3d8){if(_0x4cf3d8){return _0x4cf3d8?{'count':_0x56117d,'rows':_0x4cf3d8}:null;}})['then'](respondWithResult(_0x1a6013,null))['catch'](handleError(_0x1a6013,null));};exports['getSubjects']=function(_0x43e06e,_0x36ac7e,_0x9ffd7f){var _0x2d6dcc={};var _0x3eb6c2={};var _0x47f5ac;var _0x5ce74d;return db['VtigerConfiguration'][_0x2591('0x52')]({'where':{'id':_0x43e06e[_0x2591('0x48')]['id']}})[_0x2591('0x26')](handleEntityNotFound(_0x36ac7e,null))[_0x2591('0x26')](function(_0x3acc7d){if(_0x3acc7d){_0x47f5ac=_0x3acc7d;_0x3eb6c2[_0x2591('0x32')]=_[_0x2591('0x49')](db[_0x2591('0x50')][_0x2591('0x2f')]);_0x3eb6c2['query']=_[_0x2591('0x49')](_0x43e06e[_0x2591('0x36')]);_0x3eb6c2[_0x2591('0x34')]=_['intersection'](_0x3eb6c2[_0x2591('0x32')],_0x3eb6c2[_0x2591('0x36')]);_0x2d6dcc[_0x2591('0x37')]=_['intersection'](_0x3eb6c2[_0x2591('0x32')],qs[_0x2591('0x38')](_0x43e06e[_0x2591('0x36')][_0x2591('0x38')]));_0x2d6dcc['attributes']=_0x2d6dcc['attributes'][_0x2591('0x4a')]?_0x2d6dcc[_0x2591('0x37')]:_0x3eb6c2[_0x2591('0x32')];_0x2d6dcc[_0x2591('0x3a')]=qs['sort'](_0x43e06e['query'][_0x2591('0x3b')]);_0x2d6dcc[_0x2591('0x3c')]=qs[_0x2591('0x34')](_[_0x2591('0x3d')](_0x43e06e[_0x2591('0x36')],_0x3eb6c2[_0x2591('0x34')]));if(_0x43e06e['query'][_0x2591('0x3e')]){_0x2d6dcc['where']=_[_0x2591('0x4b')](_0x2d6dcc['where'],{'$or':_[_0x2591('0x33')](_0x2d6dcc['attributes'],function(_0x382108){var _0x1a5276={};_0x1a5276[_0x382108]={'$like':'%'+_0x43e06e[_0x2591('0x36')][_0x2591('0x3e')]+'%'};return _0x1a5276;})});}_0x2d6dcc=_[_0x2591('0x4b')]({},_0x2d6dcc,_0x43e06e['options']);return _0x47f5ac[_0x2591('0x53')](_0x2d6dcc);}})['then'](function(_0x1f0ff7){if(_0x1f0ff7){_0x5ce74d=_0x1f0ff7['length'];if(!_0x43e06e[_0x2591('0x36')][_0x2591('0x51')](_0x2591('0x39'))){_0x2d6dcc['limit']=qs[_0x2591('0x1e')](_0x43e06e[_0x2591('0x36')]['limit']);_0x2d6dcc['offset']=qs[_0x2591('0x1c')](_0x43e06e[_0x2591('0x36')]['offset']);}return _0x47f5ac[_0x2591('0x53')](_0x2d6dcc);}})[_0x2591('0x26')](function(_0x48cae6){if(_0x48cae6){return _0x48cae6?{'count':_0x5ce74d,'rows':_0x48cae6}:null;}})['then'](respondWithResult(_0x36ac7e,null))[_0x2591('0x46')](handleError(_0x36ac7e,null));};exports[_0x2591('0x54')]=function(_0x3e90a8,_0x5c2ac6,_0x2c4841){var _0xf21699={};var _0x36d4d6={};var _0x376db2;var _0x29589d;return db[_0x2591('0x2e')][_0x2591('0x52')]({'where':{'id':_0x3e90a8[_0x2591('0x48')]['id']}})[_0x2591('0x26')](handleEntityNotFound(_0x5c2ac6,null))[_0x2591('0x26')](function(_0x2b8fe8){if(_0x2b8fe8){_0x376db2=_0x2b8fe8;_0x36d4d6[_0x2591('0x32')]=_['keys'](db[_0x2591('0x50')]['rawAttributes']);_0x36d4d6[_0x2591('0x36')]=_[_0x2591('0x49')](_0x3e90a8[_0x2591('0x36')]);_0x36d4d6[_0x2591('0x34')]=_[_0x2591('0x35')](_0x36d4d6['model'],_0x36d4d6[_0x2591('0x36')]);_0xf21699[_0x2591('0x37')]=_[_0x2591('0x35')](_0x36d4d6[_0x2591('0x32')],qs[_0x2591('0x38')](_0x3e90a8['query'][_0x2591('0x38')]));_0xf21699['attributes']=_0xf21699[_0x2591('0x37')][_0x2591('0x4a')]?_0xf21699['attributes']:_0x36d4d6[_0x2591('0x32')];_0xf21699['order']=qs[_0x2591('0x3b')](_0x3e90a8['query'][_0x2591('0x3b')]);_0xf21699[_0x2591('0x3c')]=qs[_0x2591('0x34')](_[_0x2591('0x3d')](_0x3e90a8[_0x2591('0x36')],_0x36d4d6[_0x2591('0x34')]));if(_0x3e90a8[_0x2591('0x36')][_0x2591('0x3e')]){_0xf21699[_0x2591('0x3c')]=_['merge'](_0xf21699['where'],{'$or':_[_0x2591('0x33')](_0xf21699[_0x2591('0x37')],function(_0xc1f6a9){var _0x26ae08={};_0x26ae08[_0xc1f6a9]={'$like':'%'+_0x3e90a8[_0x2591('0x36')][_0x2591('0x3e')]+'%'};return _0x26ae08;})});}_0xf21699=_[_0x2591('0x4b')]({},_0xf21699,_0x3e90a8[_0x2591('0x41')]);return _0x376db2[_0x2591('0x54')](_0xf21699);}})[_0x2591('0x26')](function(_0x438dc8){if(_0x438dc8){_0x29589d=_0x438dc8['length'];if(!_0x3e90a8[_0x2591('0x36')][_0x2591('0x51')](_0x2591('0x39'))){_0xf21699['limit']=qs[_0x2591('0x1e')](_0x3e90a8['query'][_0x2591('0x1e')]);_0xf21699[_0x2591('0x1c')]=qs[_0x2591('0x1c')](_0x3e90a8[_0x2591('0x36')][_0x2591('0x1c')]);}return _0x376db2[_0x2591('0x54')](_0xf21699);}})[_0x2591('0x26')](function(_0x1dd25e){if(_0x1dd25e){return _0x1dd25e?{'count':_0x29589d,'rows':_0x1dd25e}:null;}})['then'](respondWithResult(_0x5c2ac6,null))[_0x2591('0x46')](handleError(_0x5c2ac6,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 65eb95f..b948486 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 _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 +var _0xfdfe=['exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0xac7ce0,_0x3b60ea){var _0x1f6cdf=function(_0x6196f4){while(--_0x6196f4){_0xac7ce0['push'](_0xac7ce0['shift']());}};_0x1f6cdf(++_0x3b60ea);}(_0xfdfe,0x10e));var _0xefdf=function(_0x30bdf6,_0x1a3d52){_0x30bdf6=_0x30bdf6-0x0;var _0x38ad01=_0xfdfe[_0x30bdf6];return _0x38ad01;};'use strict';var _=require(_0xefdf('0x0'));var util=require(_0xefdf('0x1'));var logger=require(_0xefdf('0x2'))(_0xefdf('0x3'));var moment=require(_0xefdf('0x4'));var BPromise=require('bluebird');var rp=require(_0xefdf('0x5'));var fs=require('fs');var path=require(_0xefdf('0x6'));var rimraf=require(_0xefdf('0x7'));var config=require(_0xefdf('0x8'));var attributes=require(_0xefdf('0x9'));module[_0xefdf('0xa')]=function(_0x100aeb,_0x5e92af){return _0x100aeb[_0xefdf('0xb')](_0xefdf('0xc'),attributes,{'tableName':_0xefdf('0xd'),'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 59ba394..e75dc5e 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 _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 +var _0x0d54=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x4c9818,_0xe14396){var _0x46ce76=function(_0xa6c574){while(--_0xa6c574){_0x4c9818['push'](_0x4c9818['shift']());}};_0x46ce76(++_0xe14396);}(_0x0d54,0x160));var _0x40d5=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x0d54[_0x42bdad];return _0x122626;};'use strict';var _=require(_0x40d5('0x0'));var util=require(_0x40d5('0x1'));var moment=require(_0x40d5('0x2'));var BPromise=require(_0x40d5('0x3'));var rs=require(_0x40d5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x40d5('0x5'))['db'];var utils=require(_0x40d5('0x6'));var logger=require(_0x40d5('0x7'))(_0x40d5('0x8'));var config=require(_0x40d5('0x9'));var jayson=require(_0x40d5('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x741de6,_0x10ac4d,_0x32b7b3){return new BPromise(function(_0x30ce82,_0x4428a3){return client[_0x40d5('0xb')](_0x741de6,_0x32b7b3)[_0x40d5('0xc')](function(_0x59ccc7){logger[_0x40d5('0xd')](_0x40d5('0xe'),_0x10ac4d,_0x40d5('0xf'));logger[_0x40d5('0x10')](_0x40d5('0x11'),_0x10ac4d,_0x40d5('0xf'),JSON[_0x40d5('0x12')](_0x59ccc7));if(_0x59ccc7[_0x40d5('0x13')]){if(_0x59ccc7[_0x40d5('0x13')]['code']===0x1f4){logger[_0x40d5('0x13')](_0x40d5('0xe'),_0x10ac4d,_0x59ccc7[_0x40d5('0x13')][_0x40d5('0x14')]);return _0x4428a3(_0x59ccc7['error'][_0x40d5('0x14')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x10ac4d,_0x59ccc7['error'][_0x40d5('0x14')]);return _0x30ce82(_0x59ccc7[_0x40d5('0x13')][_0x40d5('0x14')]);}else{logger[_0x40d5('0xd')](_0x40d5('0xe'),_0x10ac4d,_0x40d5('0xf'));_0x30ce82(_0x59ccc7['result'][_0x40d5('0x14')]);}})[_0x40d5('0x15')](function(_0x45ce9a){logger[_0x40d5('0x13')](_0x40d5('0xe'),_0x10ac4d,_0x45ce9a);_0x4428a3(_0x45ce9a);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 0886ccd..7b86a78 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 _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 +var _0x8924=['fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','isAuthenticated','get','show','post','put','/:id','update','delete','multer','util','path','connect-timeout','Router'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x8924,0x1c6));var _0x4892=function(_0x208749,_0x2b7b66){_0x208749=_0x208749-0x0;var _0x3e0042=_0x8924[_0x208749];return _0x3e0042;};'use strict';var multer=require(_0x4892('0x0'));var util=require(_0x4892('0x1'));var path=require(_0x4892('0x2'));var timeout=require(_0x4892('0x3'));var express=require('express');var router=express[_0x4892('0x4')]();var fs_extra=require(_0x4892('0x5'));var auth=require(_0x4892('0x6'));var interaction=require(_0x4892('0x7'));var config=require('../../config/environment');var controller=require(_0x4892('0x8'));router['get']('/',auth[_0x4892('0x9')](),controller['index']);router[_0x4892('0xa')]('/:id',auth[_0x4892('0x9')](),controller[_0x4892('0xb')]);router[_0x4892('0xc')]('/',auth[_0x4892('0x9')](),controller['create']);router[_0x4892('0xd')](_0x4892('0xe'),auth[_0x4892('0x9')](),controller[_0x4892('0xf')]);router[_0x4892('0x10')](_0x4892('0xe'),auth[_0x4892('0x9')](),controller['destroy']);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 2d7ba69..1010baf 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 _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 +var _0x64c2=['variable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0xb912f0,_0x3b6133){var _0x4923d6=function(_0x4f7634){while(--_0x4f7634){_0xb912f0['push'](_0xb912f0['shift']());}};_0x4923d6(++_0x3b6133);}(_0x64c2,0x124));var _0x264c=function(_0x35096e,_0x1ef66d){_0x35096e=_0x35096e-0x0;var _0xfe9f23=_0x64c2[_0x35096e];return _0xfe9f23;};'use strict';var Sequelize=require(_0x264c('0x0'));module[_0x264c('0x1')]={'type':{'type':Sequelize[_0x264c('0x2')](_0x264c('0x3'),_0x264c('0x4'),'customVariable','keyValue',_0x264c('0x5')),'defaultValue':_0x264c('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x264c('0x6')]},'keyType':{'type':Sequelize[_0x264c('0x2')](_0x264c('0x3'),_0x264c('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x264c('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x264c('0x6')]},'customField':{'type':Sequelize[_0x264c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 24d9174..47d400e 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 _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 +var _0x6620=['show','rawAttributes','find','create','body','update','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','reject','save','then','destroy','name','send','index','map','VtigerField','fieldName','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0x6620,0x123));var _0x0662=function(_0x3b1715,_0x2f8c36){_0x3b1715=_0x3b1715-0x0;var _0x96600d=_0x6620[_0x3b1715];return _0x96600d;};'use strict';var emlformat=require(_0x0662('0x0'));var rimraf=require(_0x0662('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0662('0x2'));var rp=require(_0x0662('0x3'));var moment=require('moment');var BPromise=require(_0x0662('0x4'));var Mustache=require(_0x0662('0x5'));var util=require(_0x0662('0x6'));var path=require(_0x0662('0x7'));var sox=require(_0x0662('0x8'));var csv=require(_0x0662('0x9'));var ejs=require(_0x0662('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0662('0xb'));var squel=require(_0x0662('0xc'));var crypto=require(_0x0662('0xd'));var jsforce=require(_0x0662('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0662('0xf'));var Papa=require(_0x0662('0x10'));var Redis=require('ioredis');var authService=require(_0x0662('0x11'));var qs=require(_0x0662('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0662('0x13'))(_0x0662('0x14'));var utils=require('../../config/utils');var config=require(_0x0662('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0662('0x16'))['db'];function respondWithStatusCode(_0x36636c,_0x31405f){_0x31405f=_0x31405f||0xcc;return function(_0x295aee){if(_0x295aee){return _0x36636c[_0x0662('0x17')](_0x31405f);}return _0x36636c['status'](_0x31405f)[_0x0662('0x18')]();};}function respondWithResult(_0x2751e2,_0x49ef66){_0x49ef66=_0x49ef66||0xc8;return function(_0x32a3df){if(_0x32a3df){return _0x2751e2['status'](_0x49ef66)[_0x0662('0x19')](_0x32a3df);}};}function respondWithFilteredResult(_0x527b34,_0x448596){return function(_0x543fa2){if(_0x543fa2){var _0x2cc7f7=typeof _0x448596[_0x0662('0x1a')]===_0x0662('0x1b')&&typeof _0x448596[_0x0662('0x1c')]===_0x0662('0x1b');var _0x5c6e17=_0x543fa2[_0x0662('0x1d')];var _0x2beda2=_0x2cc7f7?0x0:_0x448596[_0x0662('0x1a')];var _0x153a99=_0x2cc7f7?_0x543fa2[_0x0662('0x1d')]:_0x448596[_0x0662('0x1a')]+_0x448596['limit'];var _0x5f18f7;if(_0x153a99>=_0x5c6e17){_0x153a99=_0x5c6e17;_0x5f18f7=0xc8;}else{_0x5f18f7=0xce;}_0x527b34[_0x0662('0x1e')](_0x5f18f7);return _0x527b34[_0x0662('0x1f')]('Content-Range',_0x2beda2+'-'+_0x153a99+'/'+_0x5c6e17)[_0x0662('0x19')](_0x543fa2);}return null;};}function patchUpdates(_0x2792b7){return function(_0x59b92a){try{jsonpatch['apply'](_0x59b92a,_0x2792b7,!![]);}catch(_0x26f708){return BPromise[_0x0662('0x20')](_0x26f708);}return _0x59b92a[_0x0662('0x21')]();};}function saveUpdates(_0x5f42ec,_0xb8bba1){return function(_0x41bca1){if(_0x41bca1){return _0x41bca1['update'](_0x5f42ec)[_0x0662('0x22')](function(_0x20933c){return _0x20933c;});}return null;};}function removeEntity(_0x359c3e,_0x30af52){return function(_0x3cd8b9){if(_0x3cd8b9){return _0x3cd8b9[_0x0662('0x23')]()[_0x0662('0x22')](function(){_0x359c3e[_0x0662('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11c915,_0x4e79f0){return function(_0xa380fb){if(!_0xa380fb){_0x11c915['sendStatus'](0x194);}return _0xa380fb;};}function handleError(_0x3c168f,_0x55a9a3){_0x55a9a3=_0x55a9a3||0x1f4;return function(_0x32a6b9){logger['error'](_0x32a6b9['stack']);if(_0x32a6b9[_0x0662('0x24')]){delete _0x32a6b9[_0x0662('0x24')];}_0x3c168f[_0x0662('0x1e')](_0x55a9a3)[_0x0662('0x25')](_0x32a6b9);};}exports[_0x0662('0x26')]=function(_0xfe0a1b,_0x113f4f){var _0x1b5e6c={},_0x557306={},_0x270285={'count':0x0,'rows':[]};var _0xc4d020=_[_0x0662('0x27')](db[_0x0662('0x28')]['rawAttributes'],function(_0x134a1a){return{'name':_0x134a1a[_0x0662('0x29')],'type':_0x134a1a['type']['key']};});_0x557306[_0x0662('0x2a')]=_[_0x0662('0x27')](_0xc4d020,_0x0662('0x24'));_0x557306[_0x0662('0x2b')]=_[_0x0662('0x2c')](_0xfe0a1b[_0x0662('0x2b')]);_0x557306['filters']=_[_0x0662('0x2d')](_0x557306[_0x0662('0x2a')],_0x557306[_0x0662('0x2b')]);_0x1b5e6c['attributes']=_[_0x0662('0x2d')](_0x557306['model'],qs['fields'](_0xfe0a1b[_0x0662('0x2b')][_0x0662('0x2e')]));_0x1b5e6c['attributes']=_0x1b5e6c[_0x0662('0x2f')][_0x0662('0x30')]?_0x1b5e6c[_0x0662('0x2f')]:_0x557306['model'];if(!_0xfe0a1b[_0x0662('0x2b')][_0x0662('0x31')](_0x0662('0x32'))){_0x1b5e6c['limit']=qs[_0x0662('0x1c')](_0xfe0a1b[_0x0662('0x2b')][_0x0662('0x1c')]);_0x1b5e6c['offset']=qs[_0x0662('0x1a')](_0xfe0a1b[_0x0662('0x2b')]['offset']);}_0x1b5e6c[_0x0662('0x33')]=qs['sort'](_0xfe0a1b['query'][_0x0662('0x34')]);_0x1b5e6c['where']=qs[_0x0662('0x35')](_['pick'](_0xfe0a1b['query'],_0x557306['filters']),_0xc4d020);if(_0xfe0a1b[_0x0662('0x2b')][_0x0662('0x36')]){_0x1b5e6c[_0x0662('0x37')]=_[_0x0662('0x38')](_0x1b5e6c['where'],{'$or':_['map'](_0xc4d020,function(_0x148004){if(_0x148004['type']!==_0x0662('0x39')){var _0x42d400={};_0x42d400[_0x148004[_0x0662('0x24')]]={'$like':'%'+_0xfe0a1b[_0x0662('0x2b')][_0x0662('0x36')]+'%'};return _0x42d400;}})});}_0x1b5e6c=_[_0x0662('0x38')]({},_0x1b5e6c,_0xfe0a1b[_0x0662('0x3a')]);var _0x30334a={'where':_0x1b5e6c[_0x0662('0x37')]};return db[_0x0662('0x28')][_0x0662('0x1d')](_0x30334a)[_0x0662('0x22')](function(_0xd16d85){_0x270285[_0x0662('0x1d')]=_0xd16d85;if(_0xfe0a1b['query'][_0x0662('0x3b')]){_0x1b5e6c[_0x0662('0x3c')]=[{'all':!![]}];}return db[_0x0662('0x28')][_0x0662('0x3d')](_0x1b5e6c);})[_0x0662('0x22')](function(_0x43aff2){_0x270285[_0x0662('0x3e')]=_0x43aff2;return _0x270285;})[_0x0662('0x22')](respondWithFilteredResult(_0x113f4f,_0x1b5e6c))[_0x0662('0x3f')](handleError(_0x113f4f,null));};exports[_0x0662('0x40')]=function(_0x2933ed,_0xc63784){var _0xfe3d27={'raw':!![],'where':{'id':_0x2933ed['params']['id']}},_0x3a8099={};_0x3a8099[_0x0662('0x2a')]=_[_0x0662('0x2c')](db[_0x0662('0x28')][_0x0662('0x41')]);_0x3a8099[_0x0662('0x2b')]=_[_0x0662('0x2c')](_0x2933ed[_0x0662('0x2b')]);_0x3a8099[_0x0662('0x35')]=_[_0x0662('0x2d')](_0x3a8099[_0x0662('0x2a')],_0x3a8099[_0x0662('0x2b')]);_0xfe3d27[_0x0662('0x2f')]=_[_0x0662('0x2d')](_0x3a8099[_0x0662('0x2a')],qs[_0x0662('0x2e')](_0x2933ed['query'][_0x0662('0x2e')]));_0xfe3d27[_0x0662('0x2f')]=_0xfe3d27['attributes'][_0x0662('0x30')]?_0xfe3d27[_0x0662('0x2f')]:_0x3a8099['model'];if(_0x2933ed[_0x0662('0x2b')]['includeAll']){_0xfe3d27['include']=[{'all':!![]}];}_0xfe3d27=_[_0x0662('0x38')]({},_0xfe3d27,_0x2933ed['options']);return db[_0x0662('0x28')][_0x0662('0x42')](_0xfe3d27)['then'](handleEntityNotFound(_0xc63784,null))[_0x0662('0x22')](respondWithResult(_0xc63784,null))[_0x0662('0x3f')](handleError(_0xc63784,null));};exports['create']=function(_0x1bd2f5,_0x4923c0){return db['VtigerField'][_0x0662('0x43')](_0x1bd2f5[_0x0662('0x44')],{})[_0x0662('0x22')](respondWithResult(_0x4923c0,0xc9))[_0x0662('0x3f')](handleError(_0x4923c0,null));};exports[_0x0662('0x45')]=function(_0x31fc04,_0x40876f){if(_0x31fc04[_0x0662('0x44')]['id']){delete _0x31fc04['body']['id'];}return db['VtigerField']['find']({'where':{'id':_0x31fc04[_0x0662('0x46')]['id']}})[_0x0662('0x22')](handleEntityNotFound(_0x40876f,null))[_0x0662('0x22')](saveUpdates(_0x31fc04[_0x0662('0x44')],null))[_0x0662('0x22')](respondWithResult(_0x40876f,null))[_0x0662('0x3f')](handleError(_0x40876f,null));};exports[_0x0662('0x23')]=function(_0x2f767d,_0x42beb7){return db['VtigerField'][_0x0662('0x42')]({'where':{'id':_0x2f767d[_0x0662('0x46')]['id']}})[_0x0662('0x22')](handleEntityNotFound(_0x42beb7,null))[_0x0662('0x22')](removeEntity(_0x42beb7,null))[_0x0662('0x3f')](handleError(_0x42beb7,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 04954d3..5f5eee0 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 _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 +var _0xe6f3=['path','rimraf','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2598ac,_0x34a2e7){var _0x415d93=function(_0x5cecc8){while(--_0x5cecc8){_0x2598ac['push'](_0x2598ac['shift']());}};_0x415d93(++_0x34a2e7);}(_0xe6f3,0x116));var _0x3e6f=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xe6f3[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x3e6f('0x0'));var util=require(_0x3e6f('0x1'));var logger=require(_0x3e6f('0x2'))(_0x3e6f('0x3'));var moment=require(_0x3e6f('0x4'));var BPromise=require(_0x3e6f('0x5'));var rp=require(_0x3e6f('0x6'));var fs=require('fs');var path=require(_0x3e6f('0x7'));var rimraf=require(_0x3e6f('0x8'));var config=require('../../config/environment');var attributes=require('./intVtigerField.attributes');module[_0x3e6f('0x9')]=function(_0x204950,_0x29ff4f){return _0x204950[_0x3e6f('0xa')](_0x3e6f('0xb'),attributes,{'tableName':_0x3e6f('0xc'),'paranoid':![],'indexes':[{'name':_0x3e6f('0xd'),'fields':[_0x3e6f('0xe'),'FieldId'],'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 6d8c84c..99d630f 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 _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 +var _0x0a1a=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1c67b3,_0x3fb1ca){var _0x54ecd2=function(_0x4fd560){while(--_0x4fd560){_0x1c67b3['push'](_0x1c67b3['shift']());}};_0x54ecd2(++_0x3fb1ca);}(_0x0a1a,0x161));var _0xa0a1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0a1a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xa0a1('0x0'));var util=require(_0xa0a1('0x1'));var moment=require(_0xa0a1('0x2'));var BPromise=require(_0xa0a1('0x3'));var rs=require(_0xa0a1('0x4'));var fs=require('fs');var Redis=require(_0xa0a1('0x5'));var db=require(_0xa0a1('0x6'))['db'];var utils=require(_0xa0a1('0x7'));var logger=require('../../config/logger')(_0xa0a1('0x8'));var config=require(_0xa0a1('0x9'));var jayson=require(_0xa0a1('0xa'));var client=jayson[_0xa0a1('0xb')][_0xa0a1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e0353,_0x482fd3,_0x2989ff){return new BPromise(function(_0xe8b7b3,_0xf9d4c8){return client[_0xa0a1('0xd')](_0x3e0353,_0x2989ff)[_0xa0a1('0xe')](function(_0x303535){logger[_0xa0a1('0xf')](_0xa0a1('0x10'),_0x482fd3,_0xa0a1('0x11'));logger[_0xa0a1('0x12')](_0xa0a1('0x13'),_0x482fd3,_0xa0a1('0x11'),JSON['stringify'](_0x303535));if(_0x303535[_0xa0a1('0x14')]){if(_0x303535[_0xa0a1('0x14')]['code']===0x1f4){logger[_0xa0a1('0x14')](_0xa0a1('0x10'),_0x482fd3,_0x303535[_0xa0a1('0x14')][_0xa0a1('0x15')]);return _0xf9d4c8(_0x303535[_0xa0a1('0x14')][_0xa0a1('0x15')]);}logger[_0xa0a1('0x14')]('VtigerField,\x20%s,\x20%s',_0x482fd3,_0x303535[_0xa0a1('0x14')][_0xa0a1('0x15')]);return _0xe8b7b3(_0x303535[_0xa0a1('0x14')][_0xa0a1('0x15')]);}else{logger[_0xa0a1('0xf')](_0xa0a1('0x10'),_0x482fd3,_0xa0a1('0x11'));_0xe8b7b3(_0x303535[_0xa0a1('0x16')][_0xa0a1('0x15')]);}})[_0xa0a1('0x17')](function(_0x58074c){logger[_0xa0a1('0x14')]('VtigerField,\x20%s,\x20%s',_0x482fd3,_0x58074c);_0xf9d4c8(_0x58074c);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 4a52d46..8786149 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 _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 +var _0x52d2=['../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x4c5b52,_0x1a945a){var _0x24fce3=function(_0x5be371){while(--_0x5be371){_0x4c5b52['push'](_0x4c5b52['shift']());}};_0x24fce3(++_0x1a945a);}(_0x52d2,0x95));var _0x252d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x52d2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x252d('0x0'));var util=require(_0x252d('0x1'));var path=require('path');var timeout=require(_0x252d('0x2'));var express=require(_0x252d('0x3'));var router=express[_0x252d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x252d('0x5'));var config=require('../../config/environment');var controller=require(_0x252d('0x6'));router[_0x252d('0x7')]('/',auth[_0x252d('0x8')](),controller[_0x252d('0x9')]);router[_0x252d('0x7')]('/:id',auth[_0x252d('0x8')](),controller[_0x252d('0xa')]);router[_0x252d('0x7')](_0x252d('0xb'),auth[_0x252d('0x8')](),controller[_0x252d('0xc')]);router[_0x252d('0x7')](_0x252d('0xd'),auth[_0x252d('0x8')](),controller['getFields']);router[_0x252d('0xe')]('/',auth[_0x252d('0x8')](),controller[_0x252d('0xf')]);router[_0x252d('0xe')](_0x252d('0xb'),auth[_0x252d('0x8')](),controller[_0x252d('0x10')]);router[_0x252d('0x11')](_0x252d('0x12'),auth[_0x252d('0x8')](),controller['update']);router[_0x252d('0x13')](_0x252d('0x12'),auth[_0x252d('0x8')](),controller[_0x252d('0x14')]);module[_0x252d('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 52ecd95..b8cb6fb 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 _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 +var _0x8506=['integrationTab','exports','STRING','username','remoteUri','password','token'];(function(_0x3f4018,_0x4c1543){var _0xf8beb7=function(_0x393c26){while(--_0x393c26){_0x3f4018['push'](_0x3f4018['shift']());}};_0xf8beb7(++_0x4c1543);}(_0x8506,0xe8));var _0x6850=function(_0x58bbef,_0x2d265a){_0x58bbef=_0x58bbef-0x0;var _0x42cd2e=_0x8506[_0x58bbef];return _0x42cd2e;};'use strict';var Sequelize=require('sequelize');module[_0x6850('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6850('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x6850('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x6850('0x1')]},'remoteUri':{'type':Sequelize[_0x6850('0x1')],'unique':_0x6850('0x3')},'authType':{'type':Sequelize['ENUM'](_0x6850('0x4'),_0x6850('0x5')),'defaultValue':_0x6850('0x4')},'serverUrl':{'type':Sequelize[_0x6850('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab','newTab'),'defaultValue':_0x6850('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 2232b2d..bd508d4 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 _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 +var _0x6e6c=['name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','getConfigurations','ZendeskConfiguration','sort','addConfiguration','AccountId','channel','Descriptions','ZendeskField','Subjects','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','format','ticket_fields','headers','Basic\x20%s','%s:%s','base64','%s/token:%s','toString','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','error','stack'];(function(_0xc4e0ed,_0x54dae3){var _0x440d96=function(_0x5b3350){while(--_0x5b3350){_0xc4e0ed['push'](_0xc4e0ed['shift']());}};_0x440d96(++_0x54dae3);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6e6c[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0xc6e6('0x0'));var rimraf=require(_0xc6e6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc6e6('0x2'));var rp=require(_0xc6e6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc6e6('0x4'));var util=require('util');var path=require(_0xc6e6('0x5'));var sox=require('sox');var csv=require(_0xc6e6('0x6'));var ejs=require(_0xc6e6('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc6e6('0x8'));var squel=require(_0xc6e6('0x9'));var crypto=require('crypto');var jsforce=require(_0xc6e6('0xa'));var deskjs=require(_0xc6e6('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc6e6('0xc'));var Papa=require('papaparse');var Redis=require(_0xc6e6('0xd'));var authService=require(_0xc6e6('0xe'));var qs=require(_0xc6e6('0xf'));var as=require(_0xc6e6('0x10'));var hardwareService=require(_0xc6e6('0x11'));var logger=require(_0xc6e6('0x12'))(_0xc6e6('0x13'));var utils=require(_0xc6e6('0x14'));var config=require(_0xc6e6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc6e6('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3a30ce,_0x314d0f){_0x314d0f=_0x314d0f||0xcc;return function(_0x33aea0){if(_0x33aea0){return _0x3a30ce[_0xc6e6('0x17')](_0x314d0f);}return _0x3a30ce['status'](_0x314d0f)[_0xc6e6('0x18')]();};}function respondWithResult(_0x2bfe7d,_0x13be73){_0x13be73=_0x13be73||0xc8;return function(_0x1b6ca9){if(_0x1b6ca9){return _0x2bfe7d[_0xc6e6('0x19')](_0x13be73)['json'](_0x1b6ca9);}};}function respondWithFilteredResult(_0x413cf8,_0x178b34){return function(_0x569474){if(_0x569474){var _0x2f11b0=typeof _0x178b34[_0xc6e6('0x1a')]===_0xc6e6('0x1b')&&typeof _0x178b34['limit']==='undefined';var _0x5867bf=_0x569474[_0xc6e6('0x1c')];var _0x554262=_0x2f11b0?0x0:_0x178b34[_0xc6e6('0x1a')];var _0x2069e4=_0x2f11b0?_0x569474[_0xc6e6('0x1c')]:_0x178b34[_0xc6e6('0x1a')]+_0x178b34[_0xc6e6('0x1d')];var _0x3a0d83;if(_0x2069e4>=_0x5867bf){_0x2069e4=_0x5867bf;_0x3a0d83=0xc8;}else{_0x3a0d83=0xce;}_0x413cf8[_0xc6e6('0x19')](_0x3a0d83);return _0x413cf8[_0xc6e6('0x1e')](_0xc6e6('0x1f'),_0x554262+'-'+_0x2069e4+'/'+_0x5867bf)[_0xc6e6('0x20')](_0x569474);}return null;};}function patchUpdates(_0x4a36b6){return function(_0x428401){try{jsonpatch['apply'](_0x428401,_0x4a36b6,!![]);}catch(_0x1c34cc){return BPromise[_0xc6e6('0x21')](_0x1c34cc);}return _0x428401[_0xc6e6('0x22')]();};}function saveUpdates(_0x2f69f1,_0x4f1d68){return function(_0x35253d){if(_0x35253d){return _0x35253d[_0xc6e6('0x23')](_0x2f69f1)[_0xc6e6('0x24')](function(_0x36ebfa){return _0x36ebfa;});}return null;};}function removeEntity(_0x107561,_0x4c35ae){return function(_0x41fe96){if(_0x41fe96){return _0x41fe96['destroy']()[_0xc6e6('0x24')](function(){_0x107561[_0xc6e6('0x19')](0xcc)[_0xc6e6('0x18')]();});}};}function handleEntityNotFound(_0x64e1dc,_0x53a1bf){return function(_0x3ff8a4){if(!_0x3ff8a4){_0x64e1dc['sendStatus'](0x194);}return _0x3ff8a4;};}function handleError(_0x28577b,_0x534745){_0x534745=_0x534745||0x1f4;return function(_0x267c6a){logger[_0xc6e6('0x25')](_0x267c6a[_0xc6e6('0x26')]);if(_0x267c6a[_0xc6e6('0x27')]){delete _0x267c6a[_0xc6e6('0x27')];}_0x28577b['status'](_0x534745)[_0xc6e6('0x28')](_0x267c6a);};}exports[_0xc6e6('0x29')]=function(_0x166313,_0x1af05c){var _0x4d1284={},_0x34ae96={},_0x50b735={'count':0x0,'rows':[]};var _0x29411c=_[_0xc6e6('0x2a')](db[_0xc6e6('0x2b')][_0xc6e6('0x2c')],function(_0xd3b63){return{'name':_0xd3b63[_0xc6e6('0x2d')],'type':_0xd3b63[_0xc6e6('0x2e')][_0xc6e6('0x2f')]};});_0x34ae96[_0xc6e6('0x30')]=_[_0xc6e6('0x2a')](_0x29411c,_0xc6e6('0x27'));_0x34ae96[_0xc6e6('0x31')]=_[_0xc6e6('0x32')](_0x166313[_0xc6e6('0x31')]);_0x34ae96[_0xc6e6('0x33')]=_[_0xc6e6('0x34')](_0x34ae96[_0xc6e6('0x30')],_0x34ae96['query']);_0x4d1284[_0xc6e6('0x35')]=_[_0xc6e6('0x34')](_0x34ae96['model'],qs['fields'](_0x166313[_0xc6e6('0x31')][_0xc6e6('0x36')]));_0x4d1284[_0xc6e6('0x35')]=_0x4d1284[_0xc6e6('0x35')][_0xc6e6('0x37')]?_0x4d1284[_0xc6e6('0x35')]:_0x34ae96['model'];if(!_0x166313[_0xc6e6('0x31')][_0xc6e6('0x38')](_0xc6e6('0x39'))){_0x4d1284['limit']=qs['limit'](_0x166313[_0xc6e6('0x31')][_0xc6e6('0x1d')]);_0x4d1284[_0xc6e6('0x1a')]=qs[_0xc6e6('0x1a')](_0x166313['query']['offset']);}_0x4d1284[_0xc6e6('0x3a')]=qs['sort'](_0x166313[_0xc6e6('0x31')]['sort']);_0x4d1284[_0xc6e6('0x3b')]=qs[_0xc6e6('0x33')](_[_0xc6e6('0x3c')](_0x166313[_0xc6e6('0x31')],_0x34ae96['filters']),_0x29411c);if(_0x166313['query'][_0xc6e6('0x3d')]){_0x4d1284[_0xc6e6('0x3b')]=_[_0xc6e6('0x3e')](_0x4d1284[_0xc6e6('0x3b')],{'$or':_['map'](_0x29411c,function(_0x4cbdcf){if(_0x4cbdcf[_0xc6e6('0x2e')]!==_0xc6e6('0x3f')){var _0x3a9104={};_0x3a9104[_0x4cbdcf[_0xc6e6('0x27')]]={'$like':'%'+_0x166313['query'][_0xc6e6('0x3d')]+'%'};return _0x3a9104;}})});}_0x4d1284=_[_0xc6e6('0x3e')]({},_0x4d1284,_0x166313['options']);var _0x500b7e={'where':_0x4d1284[_0xc6e6('0x3b')]};return db['ZendeskAccount'][_0xc6e6('0x1c')](_0x500b7e)[_0xc6e6('0x24')](function(_0x53d313){_0x50b735[_0xc6e6('0x1c')]=_0x53d313;if(_0x166313['query'][_0xc6e6('0x40')]){_0x4d1284['include']=[{'all':!![]}];}return db[_0xc6e6('0x2b')][_0xc6e6('0x41')](_0x4d1284);})[_0xc6e6('0x24')](function(_0x2f7af9){_0x50b735[_0xc6e6('0x42')]=_0x2f7af9;return _0x50b735;})[_0xc6e6('0x24')](respondWithFilteredResult(_0x1af05c,_0x4d1284))[_0xc6e6('0x43')](handleError(_0x1af05c,null));};exports[_0xc6e6('0x44')]=function(_0x5ecf6c,_0x5722db){var _0x3e3da6={'raw':![],'where':{'id':_0x5ecf6c[_0xc6e6('0x45')]['id']}},_0x2b494f={};_0x2b494f[_0xc6e6('0x30')]=_['keys'](db[_0xc6e6('0x2b')][_0xc6e6('0x2c')]);_0x2b494f[_0xc6e6('0x31')]=_[_0xc6e6('0x32')](_0x5ecf6c['query']);_0x2b494f[_0xc6e6('0x33')]=_[_0xc6e6('0x34')](_0x2b494f[_0xc6e6('0x30')],_0x2b494f[_0xc6e6('0x31')]);_0x3e3da6[_0xc6e6('0x35')]=_['intersection'](_0x2b494f[_0xc6e6('0x30')],qs['fields'](_0x5ecf6c[_0xc6e6('0x31')]['fields']));_0x3e3da6[_0xc6e6('0x35')]=_0x3e3da6[_0xc6e6('0x35')][_0xc6e6('0x37')]?_0x3e3da6[_0xc6e6('0x35')]:_0x2b494f[_0xc6e6('0x30')];if(_0x5ecf6c[_0xc6e6('0x31')][_0xc6e6('0x40')]){_0x3e3da6[_0xc6e6('0x46')]=[{'all':!![]}];}_0x3e3da6=_['merge']({},_0x3e3da6,_0x5ecf6c[_0xc6e6('0x47')]);return db[_0xc6e6('0x2b')][_0xc6e6('0x48')](_0x3e3da6)['then'](handleEntityNotFound(_0x5722db,null))[_0xc6e6('0x24')](respondWithResult(_0x5722db,null))[_0xc6e6('0x43')](handleError(_0x5722db,null));};exports[_0xc6e6('0x49')]=function(_0x42ed90,_0x7ba471){return db[_0xc6e6('0x2b')][_0xc6e6('0x49')](_0x42ed90[_0xc6e6('0x4a')],{})[_0xc6e6('0x24')](respondWithResult(_0x7ba471,0xc9))[_0xc6e6('0x43')](handleError(_0x7ba471,null));};exports[_0xc6e6('0x23')]=function(_0x470167,_0x3e0117){if(_0x470167[_0xc6e6('0x4a')]['id']){delete _0x470167['body']['id'];}return db[_0xc6e6('0x2b')]['find']({'where':{'id':_0x470167[_0xc6e6('0x45')]['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x3e0117,null))['then'](saveUpdates(_0x470167['body'],null))['then'](respondWithResult(_0x3e0117,null))['catch'](handleError(_0x3e0117,null));};exports['destroy']=function(_0x3edc16,_0x40bbe9){return db[_0xc6e6('0x2b')][_0xc6e6('0x48')]({'where':{'id':_0x3edc16[_0xc6e6('0x45')]['id']}})['then'](handleEntityNotFound(_0x40bbe9,null))['then'](removeEntity(_0x40bbe9,null))[_0xc6e6('0x43')](handleError(_0x40bbe9,null));};exports[_0xc6e6('0x4b')]=function(_0x1aa872,_0x48ba2e,_0x577840){var _0x120a00={};var _0x467e9b={};var _0x286dc1;var _0x286dcf;return db[_0xc6e6('0x2b')]['findOne']({'where':{'id':_0x1aa872[_0xc6e6('0x45')]['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x48ba2e,null))[_0xc6e6('0x24')](function(_0x5113e3){if(_0x5113e3){_0x286dc1=_0x5113e3;_0x467e9b[_0xc6e6('0x30')]=_[_0xc6e6('0x32')](db[_0xc6e6('0x4c')][_0xc6e6('0x2c')]);_0x467e9b[_0xc6e6('0x31')]=_['keys'](_0x1aa872[_0xc6e6('0x31')]);_0x467e9b[_0xc6e6('0x33')]=_[_0xc6e6('0x34')](_0x467e9b[_0xc6e6('0x30')],_0x467e9b[_0xc6e6('0x31')]);_0x120a00['attributes']=_['intersection'](_0x467e9b['model'],qs[_0xc6e6('0x36')](_0x1aa872[_0xc6e6('0x31')][_0xc6e6('0x36')]));_0x120a00[_0xc6e6('0x35')]=_0x120a00[_0xc6e6('0x35')][_0xc6e6('0x37')]?_0x120a00['attributes']:_0x467e9b[_0xc6e6('0x30')];_0x120a00['order']=qs[_0xc6e6('0x4d')](_0x1aa872[_0xc6e6('0x31')][_0xc6e6('0x4d')]);_0x120a00['where']=qs[_0xc6e6('0x33')](_['pick'](_0x1aa872[_0xc6e6('0x31')],_0x467e9b['filters']));if(_0x1aa872['query'][_0xc6e6('0x3d')]){_0x120a00['where']=_['merge'](_0x120a00[_0xc6e6('0x3b')],{'$or':_[_0xc6e6('0x2a')](_0x120a00[_0xc6e6('0x35')],function(_0x20c4cf){var _0x414bc4={};_0x414bc4[_0x20c4cf]={'$like':'%'+_0x1aa872[_0xc6e6('0x31')][_0xc6e6('0x3d')]+'%'};return _0x414bc4;})});}_0x120a00=_[_0xc6e6('0x3e')]({},_0x120a00,_0x1aa872['options']);return _0x286dc1[_0xc6e6('0x4b')](_0x120a00);}})[_0xc6e6('0x24')](function(_0x35b43f){if(_0x35b43f){_0x286dcf=_0x35b43f[_0xc6e6('0x37')];if(!_0x1aa872['query'][_0xc6e6('0x38')](_0xc6e6('0x39'))){_0x120a00[_0xc6e6('0x1d')]=qs['limit'](_0x1aa872['query'][_0xc6e6('0x1d')]);_0x120a00['offset']=qs['offset'](_0x1aa872[_0xc6e6('0x31')][_0xc6e6('0x1a')]);}return _0x286dc1[_0xc6e6('0x4b')](_0x120a00);}})[_0xc6e6('0x24')](function(_0x269f63){if(_0x269f63){return _0x269f63?{'count':_0x286dcf,'rows':_0x269f63}:null;}})[_0xc6e6('0x24')](respondWithResult(_0x48ba2e,null))[_0xc6e6('0x43')](handleError(_0x48ba2e,null));};exports[_0xc6e6('0x4e')]=function(_0x8bfc70,_0x1956be,_0x15404a){if(_0x8bfc70['body']['id']){delete _0x8bfc70['body']['id'];}return db[_0xc6e6('0x2b')]['findOne']({'where':{'id':_0x8bfc70['params']['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x1956be,null))[_0xc6e6('0x24')](function(_0x27c5f0){if(_0x27c5f0){_0x8bfc70['body'][_0xc6e6('0x4f')]=_0x27c5f0['id'];_0x8bfc70[_0xc6e6('0x4a')]['Subjects']=integrations['getSubjects'](_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x50')],_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x2e')]);_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x51')]=integrations['getDescriptions'](_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x50')],_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x2e')]);return db[_0xc6e6('0x4c')]['create'](_0x8bfc70[_0xc6e6('0x4a')],{'include':[{'model':db[_0xc6e6('0x52')],'as':_0xc6e6('0x53')},{'model':db[_0xc6e6('0x52')],'as':_0xc6e6('0x51')}]});}return null;})[_0xc6e6('0x24')](respondWithResult(_0x1956be,null))['catch'](handleError(_0x1956be,null));};exports[_0xc6e6('0x54')]=function(_0x4c4985,_0x46c3df,_0x5c2cfc){var _0x55cec5='';return db[_0xc6e6('0x2b')]['findOne']({'where':{'id':_0x4c4985[_0xc6e6('0x45')]['id']},'attributes':['id',_0xc6e6('0x55'),_0xc6e6('0x56'),_0xc6e6('0x57'),_0xc6e6('0x58'),'remoteUri']})[_0xc6e6('0x24')](handleEntityNotFound(_0x46c3df,null))['then'](function(_0x4bdac6){if(_0x4bdac6){_0x55cec5=_0x4bdac6[_0xc6e6('0x59')];var _0xc38c57=_0x55cec5[_0xc6e6('0x5a')](-0x1);if(_0xc38c57==='/'){_0x55cec5=_0x55cec5['substring'](0x0,_0x55cec5[_0xc6e6('0x5b')](_0xc38c57));}var _0x4ec143={'method':'GET','uri':util[_0xc6e6('0x5c')]('%s/%s',_0x55cec5,_0xc6e6('0x5d')),'json':!![]};switch(_0x4bdac6[_0xc6e6('0x58')]){case _0xc6e6('0x56'):_0x4ec143[_0xc6e6('0x5e')]={'Authorization':util['format'](_0xc6e6('0x5f'),new Buffer(util[_0xc6e6('0x5c')](_0xc6e6('0x60'),_0x4bdac6[_0xc6e6('0x55')],_0x4bdac6[_0xc6e6('0x56')]))['toString'](_0xc6e6('0x61')))};break;case _0xc6e6('0x57'):_0x4ec143[_0xc6e6('0x5e')]={'Authorization':util[_0xc6e6('0x5c')]('Basic\x20%s',new Buffer(util['format'](_0xc6e6('0x62'),_0x4bdac6[_0xc6e6('0x55')],_0x4bdac6[_0xc6e6('0x57')]))[_0xc6e6('0x63')](_0xc6e6('0x61')))};break;default:throw new db[(_0xc6e6('0x64'))][(_0xc6e6('0x65'))](_0xc6e6('0x66'));}return rp(_0x4ec143);}})[_0xc6e6('0x24')](function(_0x4bbe4c){if(_0x4bbe4c){var _0x506679=[_0xc6e6('0x67'),'description',_0xc6e6('0x68'),_0xc6e6('0x69')];_[_0xc6e6('0x6a')](_0x4bbe4c['ticket_fields'],function(_0x5b0c3b){return _0x506679[_0xc6e6('0x6b')](_0x5b0c3b['type']);});return{'count':_0x4bbe4c[_0xc6e6('0x5d')]['length'],'rows':_[_0xc6e6('0x2a')](_0x4bbe4c[_0xc6e6('0x5d')],function(_0x5d867e){return{'id':_0x5d867e['id'],'name':_0x5d867e[_0xc6e6('0x6c')]>0x7?_0x5d867e[_0xc6e6('0x6d')]:_0x5d867e[_0xc6e6('0x2e')],'custom':_0x5d867e['position']>0x7?!![]:![],'options':_0x5d867e[_0xc6e6('0x6e')]?_0x5d867e[_0xc6e6('0x6e')]:_0x5d867e[_0xc6e6('0x6f')]?_0x5d867e['custom_field_options']:[]};})};}})[_0xc6e6('0x24')](respondWithResult(_0x46c3df,null))[_0xc6e6('0x43')](function(_0x4e7b05){var _0x4e0add=_0x4c4985['query'][_0xc6e6('0x70')]?0x1f4:_0x4e7b05[_0xc6e6('0x71')]||0x1f4;logger[_0xc6e6('0x25')](_0xc6e6('0x72'),_0xc6e6('0x54'),_0x4e0add,JSON[_0xc6e6('0x73')](_0x4e7b05));delete _0x4e7b05['name'];if(_0x4e0add===0x191){_0x4e0add=0x190;}_0x46c3df[_0xc6e6('0x19')](_0x4e0add)['send'](_0x4c4985[_0xc6e6('0x31')][_0xc6e6('0x70')]?{'message':_0xc6e6('0x74'),'statusCode':_0x4e7b05['statusCode']}:_0x4e7b05);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index c0b72f5..4f75273 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 _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 +var _0xc1c5=['ZendeskAccount','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc1c5,0x1d7));var _0x5c1c=function(_0x592414,_0x4a78b1){_0x592414=_0x592414-0x0;var _0x4cfb09=_0xc1c5[_0x592414];return _0x4cfb09;};'use strict';var _=require('lodash');var util=require(_0x5c1c('0x0'));var logger=require(_0x5c1c('0x1'))(_0x5c1c('0x2'));var moment=require('moment');var BPromise=require(_0x5c1c('0x3'));var rp=require(_0x5c1c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5c1c('0x5'));var config=require(_0x5c1c('0x6'));var attributes=require(_0x5c1c('0x7'));var integrations=require(_0x5c1c('0x8'));module['exports']=function(_0x28e119,_0x623b1a){return _0x28e119['define'](_0x5c1c('0x9'),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 8ce2cc4..ef6a6a5 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 _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 +var _0xa8d3=['ZendeskAccount','find','raw','ShowZendeskAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','findAll','options','attributes','limit','map','include','model','GetZendeskAccount'];(function(_0x434aa4,_0x5dc559){var _0x34e9b2=function(_0x493f96){while(--_0x493f96){_0x434aa4['push'](_0x434aa4['shift']());}};_0x34e9b2(++_0x5dc559);}(_0xa8d3,0x190));var _0x3a8d=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xa8d3[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x3a8d('0x0'));var util=require(_0x3a8d('0x1'));var moment=require(_0x3a8d('0x2'));var BPromise=require(_0x3a8d('0x3'));var rs=require(_0x3a8d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a8d('0x5'))['db'];var utils=require(_0x3a8d('0x6'));var logger=require(_0x3a8d('0x7'))(_0x3a8d('0x8'));var config=require('../../config/environment');var jayson=require(_0x3a8d('0x9'));var client=jayson[_0x3a8d('0xa')][_0x3a8d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26b032,_0x54ab35,_0x43b2f4){return new BPromise(function(_0x22a4b8,_0x1fe79e){return client[_0x3a8d('0xc')](_0x26b032,_0x43b2f4)[_0x3a8d('0xd')](function(_0x257cb5){logger[_0x3a8d('0xe')](_0x3a8d('0xf'),_0x54ab35,_0x3a8d('0x10'));logger[_0x3a8d('0x11')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x54ab35,_0x3a8d('0x10'),JSON[_0x3a8d('0x12')](_0x257cb5));if(_0x257cb5['error']){if(_0x257cb5[_0x3a8d('0x13')][_0x3a8d('0x14')]===0x1f4){logger['error'](_0x3a8d('0xf'),_0x54ab35,_0x257cb5[_0x3a8d('0x13')]['message']);return _0x1fe79e(_0x257cb5['error'][_0x3a8d('0x15')]);}logger[_0x3a8d('0x13')](_0x3a8d('0xf'),_0x54ab35,_0x257cb5[_0x3a8d('0x13')]['message']);return _0x22a4b8(_0x257cb5['error'][_0x3a8d('0x15')]);}else{logger['info'](_0x3a8d('0xf'),_0x54ab35,_0x3a8d('0x10'));_0x22a4b8(_0x257cb5[_0x3a8d('0x16')][_0x3a8d('0x15')]);}})[_0x3a8d('0x17')](function(_0x326895){logger[_0x3a8d('0x13')](_0x3a8d('0xf'),_0x54ab35,_0x326895);_0x1fe79e(_0x326895);});});}exports['GetZendeskAccount']=function(_0x5d7179){var _0x14eb9f=this;return new Promise(function(_0xb44dbf,_0x53dea6){return db['ZendeskAccount'][_0x3a8d('0x18')]({'raw':_0x5d7179[_0x3a8d('0x19')]?_0x5d7179[_0x3a8d('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5d7179['options']?_0x5d7179[_0x3a8d('0x19')]['where']||null:null,'attributes':_0x5d7179[_0x3a8d('0x19')]?_0x5d7179[_0x3a8d('0x19')][_0x3a8d('0x1a')]||null:null,'limit':_0x5d7179[_0x3a8d('0x19')]?_0x5d7179['options'][_0x3a8d('0x1b')]||null:null,'include':_0x5d7179['options']?_0x5d7179[_0x3a8d('0x19')]['include']?_[_0x3a8d('0x1c')](_0x5d7179[_0x3a8d('0x19')][_0x3a8d('0x1d')],function(_0x525b5c){return{'model':db[_0x525b5c[_0x3a8d('0x1e')]],'as':_0x525b5c['as'],'attributes':_0x525b5c[_0x3a8d('0x1a')],'include':_0x525b5c[_0x3a8d('0x1d')]?_[_0x3a8d('0x1c')](_0x525b5c[_0x3a8d('0x1d')],function(_0x2b2f40){return{'model':db[_0x2b2f40['model']],'as':_0x2b2f40['as'],'attributes':_0x2b2f40['attributes'],'include':_0x2b2f40['include']?_[_0x3a8d('0x1c')](_0x2b2f40[_0x3a8d('0x1d')],function(_0x3101dc){return{'model':db[_0x3101dc['model']],'as':_0x3101dc['as'],'attributes':_0x3101dc['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f5db2){logger[_0x3a8d('0xe')](_0x3a8d('0x1f'),_0x5d7179);logger['debug'](_0x3a8d('0x1f'),_0x5d7179,JSON[_0x3a8d('0x12')](_0x1f5db2));_0xb44dbf(_0x1f5db2);})['catch'](function(_0x1284e8){logger['error']('GetZendeskAccount',_0x1284e8[_0x3a8d('0x15')],_0x5d7179);_0x53dea6(_0x14eb9f['error'](0x1f4,_0x1284e8[_0x3a8d('0x15')]));});});};exports['ShowZendeskAccount']=function(_0x3b01ec){var _0x27b3ae=this;return new Promise(function(_0x480e3b,_0x208662){return db[_0x3a8d('0x20')][_0x3a8d('0x21')]({'raw':_0x3b01ec['options']?_0x3b01ec['options'][_0x3a8d('0x22')]===undefined?!![]:![]:!![],'where':_0x3b01ec[_0x3a8d('0x19')]?_0x3b01ec[_0x3a8d('0x19')]['where']||null:null,'attributes':_0x3b01ec['options']?_0x3b01ec['options'][_0x3a8d('0x1a')]||null:null,'include':_0x3b01ec[_0x3a8d('0x19')]?_0x3b01ec['options']['include']?_['map'](_0x3b01ec[_0x3a8d('0x19')]['include'],function(_0x28e003){return{'model':db[_0x28e003[_0x3a8d('0x1e')]],'as':_0x28e003['as'],'attributes':_0x28e003[_0x3a8d('0x1a')],'include':_0x28e003['include']?_[_0x3a8d('0x1c')](_0x28e003[_0x3a8d('0x1d')],function(_0x4e0de6){return{'model':db[_0x4e0de6['model']],'as':_0x4e0de6['as'],'attributes':_0x4e0de6[_0x3a8d('0x1a')],'include':_0x4e0de6[_0x3a8d('0x1d')]?_[_0x3a8d('0x1c')](_0x4e0de6[_0x3a8d('0x1d')],function(_0x140964){return{'model':db[_0x140964[_0x3a8d('0x1e')]],'as':_0x140964['as'],'attributes':_0x140964[_0x3a8d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3a8d('0xd')](function(_0x297dd2){logger[_0x3a8d('0xe')](_0x3a8d('0x23'),_0x3b01ec);logger[_0x3a8d('0x11')](_0x3a8d('0x23'),_0x3b01ec,JSON[_0x3a8d('0x12')](_0x297dd2));_0x480e3b(_0x297dd2);})[_0x3a8d('0x17')](function(_0x470eb8){logger['error'](_0x3a8d('0x23'),_0x470eb8['message'],_0x3b01ec);_0x208662(_0x27b3ae['error'](0x1f4,_0x470eb8[_0x3a8d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 6e0e74e..d82eaa7 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 _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 +var _0xf4eb=['put','update','delete','/:id','destroy','exports','multer','Router','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/tags','getTags','create','post','setTags'];(function(_0x5d0c3b,_0x4e2806){var _0x1070e1=function(_0x5ce058){while(--_0x5ce058){_0x5d0c3b['push'](_0x5d0c3b['shift']());}};_0x1070e1(++_0x4e2806);}(_0xf4eb,0xec));var _0xbf4e=function(_0x4beb1f,_0x52c21d){_0x4beb1f=_0x4beb1f-0x0;var _0x243ce5=_0xf4eb[_0x4beb1f];return _0x243ce5;};'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')]('/:id',auth[_0xbf4e('0x6')](),controller['show']);router['get'](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0x5')](_0xbf4e('0xa'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xb')]);router['get']('/:id/descriptions',auth[_0xbf4e('0x6')](),controller['getDescriptions']);router[_0xbf4e('0x5')](_0xbf4e('0xc'),auth['isAuthenticated'](),controller[_0xbf4e('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbf4e('0xe')]);router[_0xbf4e('0xf')](_0xbf4e('0xc'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x10')]);router[_0xbf4e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xbf4e('0x12')]);router[_0xbf4e('0x13')](_0xbf4e('0x14'),auth['isAuthenticated'](),controller[_0xbf4e('0x15')]);module[_0xbf4e('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 6a08509..128db50 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 _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 +var _0xb3ed=['exports','STRING','sequelize'];(function(_0x2dfe42,_0x1620e0){var _0x58cc02=function(_0x2a3a18){while(--_0x2a3a18){_0x2dfe42['push'](_0x2dfe42['shift']());}};_0x58cc02(++_0x1620e0);}(_0xb3ed,0xad));var _0xdb3e=function(_0x1eb4cc,_0x411971){_0x1eb4cc=_0x1eb4cc-0x0;var _0x4f4823=_0xb3ed[_0x1eb4cc];return _0x4f4823;};'use strict';var Sequelize=require(_0xdb3e('0x0'));module[_0xdb3e('0x1')]={'name':{'type':Sequelize[_0xdb3e('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 db528bb..b9df4f7 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 _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 +var _0x44c1=['length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','rows','show','params','rawAttributes','fields','include','catch','body','find','getFields','findOne','order','pick','getSubjects','ZendeskField','getDescriptions','Tag','getTags','setTags','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','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','count','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','ZendeskConfiguration','type','key','model','keys','query','filters','intersection','attributes'];(function(_0x1ed116,_0x23bc80){var _0x574066=function(_0x424f9e){while(--_0x424f9e){_0x1ed116['push'](_0x1ed116['shift']());}};_0x574066(++_0x23bc80);}(_0x44c1,0x16d));var _0x144c=function(_0xd04611,_0x6f7365){_0xd04611=_0xd04611-0x0;var _0x72e2db=_0x44c1[_0xd04611];return _0x72e2db;};'use strict';var emlformat=require(_0x144c('0x0'));var rimraf=require(_0x144c('0x1'));var zipdir=require(_0x144c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x144c('0x3'));var moment=require(_0x144c('0x4'));var BPromise=require(_0x144c('0x5'));var Mustache=require(_0x144c('0x6'));var util=require(_0x144c('0x7'));var path=require('path');var sox=require(_0x144c('0x8'));var csv=require(_0x144c('0x9'));var ejs=require(_0x144c('0xa'));var fs=require('fs');var fs_extra=require(_0x144c('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x144c('0xc'));var jsforce=require(_0x144c('0xd'));var deskjs=require(_0x144c('0xe'));var toCsv=require(_0x144c('0x9'));var querystring=require(_0x144c('0xf'));var Papa=require(_0x144c('0x10'));var Redis=require(_0x144c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x144c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x144c('0x13'));var logger=require(_0x144c('0x14'))(_0x144c('0x15'));var utils=require(_0x144c('0x16'));var config=require(_0x144c('0x17'));var licenseUtil=require(_0x144c('0x18'));var db=require(_0x144c('0x19'))['db'];function respondWithStatusCode(_0x4aa39f,_0x594694){_0x594694=_0x594694||0xcc;return function(_0x2960c3){if(_0x2960c3){return _0x4aa39f['sendStatus'](_0x594694);}return _0x4aa39f[_0x144c('0x1a')](_0x594694)[_0x144c('0x1b')]();};}function respondWithResult(_0x38b25d,_0x55bb73){_0x55bb73=_0x55bb73||0xc8;return function(_0x553614){if(_0x553614){return _0x38b25d['status'](_0x55bb73)[_0x144c('0x1c')](_0x553614);}};}function respondWithFilteredResult(_0x949cc8,_0x137158){return function(_0x4786d1){if(_0x4786d1){var _0xe4ecb5=typeof _0x137158[_0x144c('0x1d')]==='undefined'&&typeof _0x137158['limit']===_0x144c('0x1e');var _0x48a990=_0x4786d1[_0x144c('0x1f')];var _0x1d328e=_0xe4ecb5?0x0:_0x137158['offset'];var _0x19dd53=_0xe4ecb5?_0x4786d1['count']:_0x137158[_0x144c('0x1d')]+_0x137158[_0x144c('0x20')];var _0x213e5c;if(_0x19dd53>=_0x48a990){_0x19dd53=_0x48a990;_0x213e5c=0xc8;}else{_0x213e5c=0xce;}_0x949cc8[_0x144c('0x1a')](_0x213e5c);return _0x949cc8['set'](_0x144c('0x21'),_0x1d328e+'-'+_0x19dd53+'/'+_0x48a990)[_0x144c('0x1c')](_0x4786d1);}return null;};}function patchUpdates(_0xe08a04){return function(_0x4d37cd){try{jsonpatch[_0x144c('0x22')](_0x4d37cd,_0xe08a04,!![]);}catch(_0x3dd2a2){return BPromise[_0x144c('0x23')](_0x3dd2a2);}return _0x4d37cd[_0x144c('0x24')]();};}function saveUpdates(_0xf27cad,_0x1913ba){return function(_0x30e4dc){if(_0x30e4dc){return _0x30e4dc[_0x144c('0x25')](_0xf27cad)[_0x144c('0x26')](function(_0x13aaad){return _0x13aaad;});}return null;};}function removeEntity(_0x4dd832,_0x2a0504){return function(_0x177f07){if(_0x177f07){return _0x177f07[_0x144c('0x27')]()[_0x144c('0x26')](function(){_0x4dd832[_0x144c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4be1ad,_0x3577da){return function(_0x147d88){if(!_0x147d88){_0x4be1ad[_0x144c('0x28')](0x194);}return _0x147d88;};}function handleError(_0x3e90ba,_0x2459f4){_0x2459f4=_0x2459f4||0x1f4;return function(_0x42787f){logger[_0x144c('0x29')](_0x42787f[_0x144c('0x2a')]);if(_0x42787f[_0x144c('0x2b')]){delete _0x42787f[_0x144c('0x2b')];}_0x3e90ba[_0x144c('0x1a')](_0x2459f4)[_0x144c('0x2c')](_0x42787f);};}exports['index']=function(_0x444a95,_0xb172bf){var _0x222095={},_0x4295f3={},_0x2830d9={'count':0x0,'rows':[]};var _0x2c8f5a=_[_0x144c('0x2d')](db[_0x144c('0x2e')]['rawAttributes'],function(_0x4f178c){return{'name':_0x4f178c['fieldName'],'type':_0x4f178c[_0x144c('0x2f')][_0x144c('0x30')]};});_0x4295f3[_0x144c('0x31')]=_['map'](_0x2c8f5a,_0x144c('0x2b'));_0x4295f3['query']=_[_0x144c('0x32')](_0x444a95[_0x144c('0x33')]);_0x4295f3[_0x144c('0x34')]=_[_0x144c('0x35')](_0x4295f3[_0x144c('0x31')],_0x4295f3[_0x144c('0x33')]);_0x222095[_0x144c('0x36')]=_[_0x144c('0x35')](_0x4295f3['model'],qs['fields'](_0x444a95[_0x144c('0x33')]['fields']));_0x222095['attributes']=_0x222095[_0x144c('0x36')][_0x144c('0x37')]?_0x222095[_0x144c('0x36')]:_0x4295f3[_0x144c('0x31')];if(!_0x444a95['query'][_0x144c('0x38')](_0x144c('0x39'))){_0x222095[_0x144c('0x20')]=qs[_0x144c('0x20')](_0x444a95['query'][_0x144c('0x20')]);_0x222095[_0x144c('0x1d')]=qs[_0x144c('0x1d')](_0x444a95[_0x144c('0x33')][_0x144c('0x1d')]);}_0x222095['order']=qs[_0x144c('0x3a')](_0x444a95[_0x144c('0x33')][_0x144c('0x3a')]);_0x222095['where']=qs['filters'](_['pick'](_0x444a95['query'],_0x4295f3['filters']),_0x2c8f5a);if(_0x444a95[_0x144c('0x33')][_0x144c('0x3b')]){_0x222095[_0x144c('0x3c')]=_[_0x144c('0x3d')](_0x222095['where'],{'$or':_['map'](_0x2c8f5a,function(_0x574f3c){if(_0x574f3c[_0x144c('0x2f')]!==_0x144c('0x3e')){var _0x4825c2={};_0x4825c2[_0x574f3c[_0x144c('0x2b')]]={'$like':'%'+_0x444a95['query'][_0x144c('0x3b')]+'%'};return _0x4825c2;}})});}_0x222095=_[_0x144c('0x3d')]({},_0x222095,_0x444a95[_0x144c('0x3f')]);var _0x4351bd={'where':_0x222095['where']};return db['ZendeskConfiguration'][_0x144c('0x1f')](_0x4351bd)[_0x144c('0x26')](function(_0xe55f52){_0x2830d9[_0x144c('0x1f')]=_0xe55f52;if(_0x444a95[_0x144c('0x33')][_0x144c('0x40')]){_0x222095['include']=[{'all':!![]}];}return db[_0x144c('0x2e')]['findAll'](_0x222095);})[_0x144c('0x26')](function(_0x5e12de){_0x2830d9[_0x144c('0x41')]=_0x5e12de;return _0x2830d9;})[_0x144c('0x26')](respondWithFilteredResult(_0xb172bf,_0x222095))['catch'](handleError(_0xb172bf,null));};exports[_0x144c('0x42')]=function(_0x5ec78b,_0x3fd38e){var _0x7737ad={'raw':![],'where':{'id':_0x5ec78b[_0x144c('0x43')]['id']}},_0x199e12={};_0x199e12['model']=_[_0x144c('0x32')](db[_0x144c('0x2e')][_0x144c('0x44')]);_0x199e12[_0x144c('0x33')]=_['keys'](_0x5ec78b[_0x144c('0x33')]);_0x199e12[_0x144c('0x34')]=_['intersection'](_0x199e12[_0x144c('0x31')],_0x199e12['query']);_0x7737ad[_0x144c('0x36')]=_[_0x144c('0x35')](_0x199e12[_0x144c('0x31')],qs[_0x144c('0x45')](_0x5ec78b['query'][_0x144c('0x45')]));_0x7737ad[_0x144c('0x36')]=_0x7737ad[_0x144c('0x36')][_0x144c('0x37')]?_0x7737ad[_0x144c('0x36')]:_0x199e12[_0x144c('0x31')];if(_0x5ec78b[_0x144c('0x33')][_0x144c('0x40')]){_0x7737ad[_0x144c('0x46')]=[{'all':!![]}];}_0x7737ad=_[_0x144c('0x3d')]({},_0x7737ad,_0x5ec78b[_0x144c('0x3f')]);return db[_0x144c('0x2e')]['find'](_0x7737ad)['then'](handleEntityNotFound(_0x3fd38e,null))[_0x144c('0x26')](respondWithResult(_0x3fd38e,null))[_0x144c('0x47')](handleError(_0x3fd38e,null));};exports['create']=function(_0x516430,_0x415177){return db[_0x144c('0x2e')]['create'](_0x516430[_0x144c('0x48')],{})[_0x144c('0x26')](respondWithResult(_0x415177,0xc9))[_0x144c('0x47')](handleError(_0x415177,null));};exports['update']=function(_0x476d54,_0x3d1bcb){if(_0x476d54[_0x144c('0x48')]['id']){delete _0x476d54[_0x144c('0x48')]['id'];}return db[_0x144c('0x2e')]['find']({'where':{'id':_0x476d54[_0x144c('0x43')]['id']}})[_0x144c('0x26')](handleEntityNotFound(_0x3d1bcb,null))['then'](saveUpdates(_0x476d54[_0x144c('0x48')],null))[_0x144c('0x26')](respondWithResult(_0x3d1bcb,null))[_0x144c('0x47')](handleError(_0x3d1bcb,null));};exports[_0x144c('0x27')]=function(_0x1100d6,_0x36f37){return db[_0x144c('0x2e')][_0x144c('0x49')]({'where':{'id':_0x1100d6[_0x144c('0x43')]['id']}})['then'](handleEntityNotFound(_0x36f37,null))[_0x144c('0x26')](removeEntity(_0x36f37,null))[_0x144c('0x47')](handleError(_0x36f37,null));};exports[_0x144c('0x4a')]=function(_0x75b6f7,_0x1338ae,_0x1ece7e){var _0x2dec1d={};var _0x53be16={};var _0x16c966;var _0x3580e3;return db['ZendeskConfiguration'][_0x144c('0x4b')]({'where':{'id':_0x75b6f7[_0x144c('0x43')]['id']}})[_0x144c('0x26')](handleEntityNotFound(_0x1338ae,null))['then'](function(_0x49c3b8){if(_0x49c3b8){_0x16c966=_0x49c3b8;_0x53be16[_0x144c('0x31')]=_[_0x144c('0x32')](db['ZendeskField'][_0x144c('0x44')]);_0x53be16[_0x144c('0x33')]=_['keys'](_0x75b6f7[_0x144c('0x33')]);_0x53be16[_0x144c('0x34')]=_[_0x144c('0x35')](_0x53be16[_0x144c('0x31')],_0x53be16['query']);_0x2dec1d[_0x144c('0x36')]=_[_0x144c('0x35')](_0x53be16['model'],qs[_0x144c('0x45')](_0x75b6f7[_0x144c('0x33')][_0x144c('0x45')]));_0x2dec1d[_0x144c('0x36')]=_0x2dec1d[_0x144c('0x36')][_0x144c('0x37')]?_0x2dec1d[_0x144c('0x36')]:_0x53be16[_0x144c('0x31')];_0x2dec1d[_0x144c('0x4c')]=qs[_0x144c('0x3a')](_0x75b6f7['query']['sort']);_0x2dec1d[_0x144c('0x3c')]=qs['filters'](_[_0x144c('0x4d')](_0x75b6f7[_0x144c('0x33')],_0x53be16['filters']));if(_0x75b6f7[_0x144c('0x33')][_0x144c('0x3b')]){_0x2dec1d[_0x144c('0x3c')]=_[_0x144c('0x3d')](_0x2dec1d[_0x144c('0x3c')],{'$or':_['map'](_0x2dec1d[_0x144c('0x36')],function(_0x2b881d){var _0x6b743b={};_0x6b743b[_0x2b881d]={'$like':'%'+_0x75b6f7['query'][_0x144c('0x3b')]+'%'};return _0x6b743b;})});}_0x2dec1d=_[_0x144c('0x3d')]({},_0x2dec1d,_0x75b6f7[_0x144c('0x3f')]);return _0x16c966[_0x144c('0x4a')](_0x2dec1d);}})['then'](function(_0x28f732){if(_0x28f732){_0x3580e3=_0x28f732[_0x144c('0x37')];if(!_0x75b6f7[_0x144c('0x33')][_0x144c('0x38')](_0x144c('0x39'))){_0x2dec1d[_0x144c('0x20')]=qs[_0x144c('0x20')](_0x75b6f7[_0x144c('0x33')]['limit']);_0x2dec1d[_0x144c('0x1d')]=qs[_0x144c('0x1d')](_0x75b6f7[_0x144c('0x33')][_0x144c('0x1d')]);}return _0x16c966['getFields'](_0x2dec1d);}})[_0x144c('0x26')](function(_0xea5496){if(_0xea5496){return _0xea5496?{'count':_0x3580e3,'rows':_0xea5496}:null;}})[_0x144c('0x26')](respondWithResult(_0x1338ae,null))['catch'](handleError(_0x1338ae,null));};exports[_0x144c('0x4e')]=function(_0x571409,_0x2a50c5,_0x31158b){var _0x1b7450={};var _0x2abf09={};var _0x220783;var _0x3c73b2;return db['ZendeskConfiguration'][_0x144c('0x4b')]({'where':{'id':_0x571409[_0x144c('0x43')]['id']}})[_0x144c('0x26')](handleEntityNotFound(_0x2a50c5,null))[_0x144c('0x26')](function(_0x50e3fd){if(_0x50e3fd){_0x220783=_0x50e3fd;_0x2abf09[_0x144c('0x31')]=_['keys'](db[_0x144c('0x4f')]['rawAttributes']);_0x2abf09[_0x144c('0x33')]=_['keys'](_0x571409['query']);_0x2abf09[_0x144c('0x34')]=_[_0x144c('0x35')](_0x2abf09[_0x144c('0x31')],_0x2abf09[_0x144c('0x33')]);_0x1b7450[_0x144c('0x36')]=_[_0x144c('0x35')](_0x2abf09[_0x144c('0x31')],qs[_0x144c('0x45')](_0x571409[_0x144c('0x33')][_0x144c('0x45')]));_0x1b7450[_0x144c('0x36')]=_0x1b7450['attributes'][_0x144c('0x37')]?_0x1b7450['attributes']:_0x2abf09['model'];_0x1b7450[_0x144c('0x4c')]=qs[_0x144c('0x3a')](_0x571409['query'][_0x144c('0x3a')]);_0x1b7450[_0x144c('0x3c')]=qs['filters'](_[_0x144c('0x4d')](_0x571409[_0x144c('0x33')],_0x2abf09[_0x144c('0x34')]));if(_0x571409[_0x144c('0x33')][_0x144c('0x3b')]){_0x1b7450[_0x144c('0x3c')]=_[_0x144c('0x3d')](_0x1b7450['where'],{'$or':_[_0x144c('0x2d')](_0x1b7450['attributes'],function(_0x156d19){var _0x363cfd={};_0x363cfd[_0x156d19]={'$like':'%'+_0x571409[_0x144c('0x33')]['filter']+'%'};return _0x363cfd;})});}_0x1b7450=_['merge']({},_0x1b7450,_0x571409[_0x144c('0x3f')]);return _0x220783[_0x144c('0x4e')](_0x1b7450);}})[_0x144c('0x26')](function(_0x2f85b6){if(_0x2f85b6){_0x3c73b2=_0x2f85b6[_0x144c('0x37')];if(!_0x571409[_0x144c('0x33')][_0x144c('0x38')](_0x144c('0x39'))){_0x1b7450[_0x144c('0x20')]=qs[_0x144c('0x20')](_0x571409[_0x144c('0x33')][_0x144c('0x20')]);_0x1b7450[_0x144c('0x1d')]=qs[_0x144c('0x1d')](_0x571409['query'][_0x144c('0x1d')]);}return _0x220783['getSubjects'](_0x1b7450);}})[_0x144c('0x26')](function(_0xc1f081){if(_0xc1f081){return _0xc1f081?{'count':_0x3c73b2,'rows':_0xc1f081}:null;}})[_0x144c('0x26')](respondWithResult(_0x2a50c5,null))['catch'](handleError(_0x2a50c5,null));};exports['getDescriptions']=function(_0x23be72,_0x4dd243,_0x35331d){var _0x4ca8b5={};var _0x3449c7={};var _0x25189c;var _0x18175c;return db[_0x144c('0x2e')][_0x144c('0x4b')]({'where':{'id':_0x23be72[_0x144c('0x43')]['id']}})[_0x144c('0x26')](handleEntityNotFound(_0x4dd243,null))['then'](function(_0x156172){if(_0x156172){_0x25189c=_0x156172;_0x3449c7[_0x144c('0x31')]=_[_0x144c('0x32')](db[_0x144c('0x4f')][_0x144c('0x44')]);_0x3449c7[_0x144c('0x33')]=_[_0x144c('0x32')](_0x23be72[_0x144c('0x33')]);_0x3449c7['filters']=_[_0x144c('0x35')](_0x3449c7[_0x144c('0x31')],_0x3449c7[_0x144c('0x33')]);_0x4ca8b5[_0x144c('0x36')]=_[_0x144c('0x35')](_0x3449c7['model'],qs[_0x144c('0x45')](_0x23be72[_0x144c('0x33')][_0x144c('0x45')]));_0x4ca8b5['attributes']=_0x4ca8b5[_0x144c('0x36')]['length']?_0x4ca8b5[_0x144c('0x36')]:_0x3449c7[_0x144c('0x31')];_0x4ca8b5[_0x144c('0x4c')]=qs[_0x144c('0x3a')](_0x23be72[_0x144c('0x33')]['sort']);_0x4ca8b5[_0x144c('0x3c')]=qs[_0x144c('0x34')](_[_0x144c('0x4d')](_0x23be72[_0x144c('0x33')],_0x3449c7[_0x144c('0x34')]));if(_0x23be72[_0x144c('0x33')][_0x144c('0x3b')]){_0x4ca8b5['where']=_[_0x144c('0x3d')](_0x4ca8b5[_0x144c('0x3c')],{'$or':_[_0x144c('0x2d')](_0x4ca8b5[_0x144c('0x36')],function(_0x182d78){var _0xb41f6a={};_0xb41f6a[_0x182d78]={'$like':'%'+_0x23be72['query'][_0x144c('0x3b')]+'%'};return _0xb41f6a;})});}_0x4ca8b5=_[_0x144c('0x3d')]({},_0x4ca8b5,_0x23be72['options']);return _0x25189c[_0x144c('0x50')](_0x4ca8b5);}})[_0x144c('0x26')](function(_0x99648b){if(_0x99648b){_0x18175c=_0x99648b['length'];if(!_0x23be72[_0x144c('0x33')][_0x144c('0x38')]('nolimit')){_0x4ca8b5[_0x144c('0x20')]=qs['limit'](_0x23be72[_0x144c('0x33')]['limit']);_0x4ca8b5[_0x144c('0x1d')]=qs[_0x144c('0x1d')](_0x23be72[_0x144c('0x33')][_0x144c('0x1d')]);}return _0x25189c[_0x144c('0x50')](_0x4ca8b5);}})['then'](function(_0x2c379f){if(_0x2c379f){return _0x2c379f?{'count':_0x18175c,'rows':_0x2c379f}:null;}})[_0x144c('0x26')](respondWithResult(_0x4dd243,null))[_0x144c('0x47')](handleError(_0x4dd243,null));};exports['getTags']=function(_0x426519,_0x4f2cd3,_0x2e6734){var _0x46be1a={};var _0x20605a={};var _0x2c545d;var _0x42f10f;return db[_0x144c('0x2e')][_0x144c('0x4b')]({'where':{'id':_0x426519[_0x144c('0x43')]['id']}})['then'](handleEntityNotFound(_0x4f2cd3,null))[_0x144c('0x26')](function(_0x2aadd0){if(_0x2aadd0){_0x2c545d=_0x2aadd0;_0x20605a['model']=_[_0x144c('0x32')](db[_0x144c('0x51')][_0x144c('0x44')]);_0x20605a[_0x144c('0x33')]=_[_0x144c('0x32')](_0x426519[_0x144c('0x33')]);_0x20605a[_0x144c('0x34')]=_['intersection'](_0x20605a[_0x144c('0x31')],_0x20605a[_0x144c('0x33')]);_0x46be1a[_0x144c('0x36')]=_[_0x144c('0x35')](_0x20605a['model'],qs['fields'](_0x426519['query']['fields']));_0x46be1a['attributes']=_0x46be1a[_0x144c('0x36')][_0x144c('0x37')]?_0x46be1a[_0x144c('0x36')]:_0x20605a[_0x144c('0x31')];_0x46be1a[_0x144c('0x4c')]=qs[_0x144c('0x3a')](_0x426519[_0x144c('0x33')][_0x144c('0x3a')]);_0x46be1a['where']=qs[_0x144c('0x34')](_['pick'](_0x426519[_0x144c('0x33')],_0x20605a['filters']));if(_0x426519[_0x144c('0x33')][_0x144c('0x3b')]){_0x46be1a['where']=_['merge'](_0x46be1a[_0x144c('0x3c')],{'$or':_['map'](_0x46be1a[_0x144c('0x36')],function(_0x1609a0){var _0x39345a={};_0x39345a[_0x1609a0]={'$like':'%'+_0x426519[_0x144c('0x33')][_0x144c('0x3b')]+'%'};return _0x39345a;})});}_0x46be1a=_['merge']({},_0x46be1a,_0x426519[_0x144c('0x3f')]);return _0x2c545d[_0x144c('0x52')](_0x46be1a);}})[_0x144c('0x26')](function(_0xcb2211){if(_0xcb2211){_0x42f10f=_0xcb2211[_0x144c('0x37')];if(!_0x426519['query'][_0x144c('0x38')]('nolimit')){_0x46be1a[_0x144c('0x20')]=qs[_0x144c('0x20')](_0x426519[_0x144c('0x33')][_0x144c('0x20')]);_0x46be1a[_0x144c('0x1d')]=qs[_0x144c('0x1d')](_0x426519['query'][_0x144c('0x1d')]);}return _0x2c545d[_0x144c('0x52')](_0x46be1a);}})['then'](function(_0x3dfbb9){if(_0x3dfbb9){return _0x3dfbb9?{'count':_0x42f10f,'rows':_0x3dfbb9}:null;}})[_0x144c('0x26')](respondWithResult(_0x4f2cd3,null))[_0x144c('0x47')](handleError(_0x4f2cd3,null));};exports[_0x144c('0x53')]=function(_0x299f97,_0x1f4769,_0x5dad28){if(_0x299f97[_0x144c('0x48')]['id']){delete _0x299f97['body']['id'];}return db[_0x144c('0x2e')][_0x144c('0x4b')]({'where':{'id':_0x299f97[_0x144c('0x43')]['id']}})['then'](handleEntityNotFound(_0x1f4769,null))[_0x144c('0x26')](function(_0x24f349){if(_0x24f349){return _0x24f349['setTags'](_0x299f97[_0x144c('0x48')]['ids']||[]);}return null;})[_0x144c('0x26')](respondWithResult(_0x1f4769,null))[_0x144c('0x47')](handleError(_0x1f4769,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index ebb5cdb..06861e2 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 _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 +var _0xdd4f=['exports','define','ZendeskConfiguration','lodash','moment','bluebird','path','rimraf','../../config/environment'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x143e5c,_0x1e8445){_0x143e5c=_0x143e5c-0x0;var _0x30406f=_0xdd4f[_0x143e5c];return _0x30406f;};'use strict';var _=require(_0xfdd4('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xfdd4('0x1'));var BPromise=require(_0xfdd4('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfdd4('0x3'));var rimraf=require(_0xfdd4('0x4'));var config=require(_0xfdd4('0x5'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xfdd4('0x6')]=function(_0x43cbcf,_0x30e080){return _0x43cbcf[_0xfdd4('0x7')](_0xfdd4('0x8'),attributes,{'tableName':'int_zendesk_configurations','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 c7d107c..5f72874 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 _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 +var _0x1a21=['../../config/environment','jayson/promise','client','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x1a21,0xd8));var _0x11a2=function(_0x488ca1,_0xf6858e){_0x488ca1=_0x488ca1-0x0;var _0x4dd0a4=_0x1a21[_0x488ca1];return _0x4dd0a4;};'use strict';var _=require(_0x11a2('0x0'));var util=require(_0x11a2('0x1'));var moment=require(_0x11a2('0x2'));var BPromise=require(_0x11a2('0x3'));var rs=require(_0x11a2('0x4'));var fs=require('fs');var Redis=require(_0x11a2('0x5'));var db=require(_0x11a2('0x6'))['db'];var utils=require(_0x11a2('0x7'));var logger=require('../../config/logger')(_0x11a2('0x8'));var config=require(_0x11a2('0x9'));var jayson=require(_0x11a2('0xa'));var client=jayson[_0x11a2('0xb')][_0x11a2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x282968,_0x3a84b0,_0x219545){return new BPromise(function(_0x51b866,_0x558893){return client[_0x11a2('0xd')](_0x282968,_0x219545)['then'](function(_0x5cd635){logger[_0x11a2('0xe')](_0x11a2('0xf'),_0x3a84b0,_0x11a2('0x10'));logger[_0x11a2('0x11')](_0x11a2('0x12'),_0x3a84b0,_0x11a2('0x10'),JSON[_0x11a2('0x13')](_0x5cd635));if(_0x5cd635['error']){if(_0x5cd635[_0x11a2('0x14')][_0x11a2('0x15')]===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x3a84b0,_0x5cd635[_0x11a2('0x14')][_0x11a2('0x16')]);return _0x558893(_0x5cd635[_0x11a2('0x14')][_0x11a2('0x16')]);}logger[_0x11a2('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3a84b0,_0x5cd635['error'][_0x11a2('0x16')]);return _0x51b866(_0x5cd635[_0x11a2('0x14')][_0x11a2('0x16')]);}else{logger['info'](_0x11a2('0xf'),_0x3a84b0,_0x11a2('0x10'));_0x51b866(_0x5cd635[_0x11a2('0x17')][_0x11a2('0x16')]);}})[_0x11a2('0x18')](function(_0x59629a){logger[_0x11a2('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3a84b0,_0x59629a);_0x558893(_0x59629a);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 3c03f83..62ed4f8 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 _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 +var _0x19d4=['util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x4c39a6,_0x40191b){var _0x5ce442=function(_0x217edc){while(--_0x217edc){_0x4c39a6['push'](_0x4c39a6['shift']());}};_0x5ce442(++_0x40191b);}(_0x19d4,0xb3));var _0x419d=function(_0x39364c,_0x26d447){_0x39364c=_0x39364c-0x0;var _0x22c0b9=_0x19d4[_0x39364c];return _0x22c0b9;};'use strict';var multer=require(_0x419d('0x0'));var util=require(_0x419d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x419d('0x2'));var router=express[_0x419d('0x3')]();var fs_extra=require(_0x419d('0x4'));var auth=require(_0x419d('0x5'));var interaction=require(_0x419d('0x6'));var config=require(_0x419d('0x7'));var controller=require(_0x419d('0x8'));router['get']('/',auth[_0x419d('0x9')](),controller[_0x419d('0xa')]);router[_0x419d('0xb')](_0x419d('0xc'),auth['isAuthenticated'](),controller[_0x419d('0xd')]);router[_0x419d('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x419d('0xf')](_0x419d('0xc'),auth['isAuthenticated'](),controller[_0x419d('0x10')]);router[_0x419d('0x11')](_0x419d('0xc'),auth[_0x419d('0x9')](),controller[_0x419d('0x12')]);module[_0x419d('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index f8c6f9b..b23f5b0 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 _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 +var _0x25c5=['picklist','STRING','ENUM','BOOLEAN','sequelize','string','variable','customVariable','keyValue'];(function(_0x25bf9,_0x467adb){var _0x5642e5=function(_0x40b941){while(--_0x40b941){_0x25bf9['push'](_0x25bf9['shift']());}};_0x5642e5(++_0x467adb);}(_0x25c5,0x190));var _0x525c=function(_0x3f6565,_0x12a8bb){_0x3f6565=_0x3f6565-0x0;var _0x4abd23=_0x25c5[_0x3f6565];return _0x4abd23;};'use strict';var Sequelize=require(_0x525c('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x525c('0x1'),_0x525c('0x2'),_0x525c('0x3'),_0x525c('0x4'),_0x525c('0x5')),'defaultValue':_0x525c('0x1')},'content':{'type':Sequelize[_0x525c('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x525c('0x7')](_0x525c('0x1'),_0x525c('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x525c('0x6')]},'idField':{'type':Sequelize[_0x525c('0x6')]},'nameField':{'type':Sequelize[_0x525c('0x6')]},'customField':{'type':Sequelize[_0x525c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x525c('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index e14f3b2..f3e4daf 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 _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 +var _0x0111=['create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','save','update','then','destroy','error','stack','name','send','map','ZendeskField','fieldName','type','keys','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','show','params','length','include','find','catch'];(function(_0x1c0d3a,_0x5917c1){var _0x115215=function(_0x10688e){while(--_0x10688e){_0x1c0d3a['push'](_0x1c0d3a['shift']());}};_0x115215(++_0x5917c1);}(_0x0111,0x16f));var _0x1011=function(_0x1eaf93,_0x241082){_0x1eaf93=_0x1eaf93-0x0;var _0x2825bc=_0x0111[_0x1eaf93];return _0x2825bc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1011('0x0'));var zipdir=require(_0x1011('0x1'));var jsonpatch=require(_0x1011('0x2'));var rp=require(_0x1011('0x3'));var moment=require('moment');var BPromise=require(_0x1011('0x4'));var Mustache=require(_0x1011('0x5'));var util=require(_0x1011('0x6'));var path=require(_0x1011('0x7'));var sox=require(_0x1011('0x8'));var csv=require('to-csv');var ejs=require(_0x1011('0x9'));var fs=require('fs');var fs_extra=require(_0x1011('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1011('0xb'));var jsforce=require(_0x1011('0xc'));var deskjs=require(_0x1011('0xd'));var toCsv=require(_0x1011('0xe'));var querystring=require(_0x1011('0xf'));var Papa=require(_0x1011('0x10'));var Redis=require(_0x1011('0x11'));var authService=require(_0x1011('0x12'));var qs=require(_0x1011('0x13'));var as=require(_0x1011('0x14'));var hardwareService=require(_0x1011('0x15'));var logger=require('../../config/logger')(_0x1011('0x16'));var utils=require(_0x1011('0x17'));var config=require(_0x1011('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1011('0x19'))['db'];function respondWithStatusCode(_0x1757f7,_0x3fb871){_0x3fb871=_0x3fb871||0xcc;return function(_0x356c9e){if(_0x356c9e){return _0x1757f7[_0x1011('0x1a')](_0x3fb871);}return _0x1757f7[_0x1011('0x1b')](_0x3fb871)[_0x1011('0x1c')]();};}function respondWithResult(_0x142a41,_0xd0039){_0xd0039=_0xd0039||0xc8;return function(_0x5e9b46){if(_0x5e9b46){return _0x142a41[_0x1011('0x1b')](_0xd0039)[_0x1011('0x1d')](_0x5e9b46);}};}function respondWithFilteredResult(_0x31735c,_0x1a115d){return function(_0x122fd3){if(_0x122fd3){var _0x5f1ce0=typeof _0x1a115d[_0x1011('0x1e')]===_0x1011('0x1f')&&typeof _0x1a115d[_0x1011('0x20')]===_0x1011('0x1f');var _0x2945cb=_0x122fd3['count'];var _0x16b044=_0x5f1ce0?0x0:_0x1a115d[_0x1011('0x1e')];var _0x141ad1=_0x5f1ce0?_0x122fd3['count']:_0x1a115d['offset']+_0x1a115d['limit'];var _0x27f704;if(_0x141ad1>=_0x2945cb){_0x141ad1=_0x2945cb;_0x27f704=0xc8;}else{_0x27f704=0xce;}_0x31735c[_0x1011('0x1b')](_0x27f704);return _0x31735c[_0x1011('0x21')]('Content-Range',_0x16b044+'-'+_0x141ad1+'/'+_0x2945cb)['json'](_0x122fd3);}return null;};}function patchUpdates(_0xc01626){return function(_0x1f804f){try{jsonpatch['apply'](_0x1f804f,_0xc01626,!![]);}catch(_0x2718a3){return BPromise['reject'](_0x2718a3);}return _0x1f804f[_0x1011('0x22')]();};}function saveUpdates(_0x4ae333,_0x59ba4e){return function(_0x97a2ef){if(_0x97a2ef){return _0x97a2ef[_0x1011('0x23')](_0x4ae333)[_0x1011('0x24')](function(_0x1bc8a0){return _0x1bc8a0;});}return null;};}function removeEntity(_0x52876f,_0x47f373){return function(_0x333b6a){if(_0x333b6a){return _0x333b6a[_0x1011('0x25')]()[_0x1011('0x24')](function(){_0x52876f[_0x1011('0x1b')](0xcc)[_0x1011('0x1c')]();});}};}function handleEntityNotFound(_0x8a6a76,_0xf50b86){return function(_0x33e865){if(!_0x33e865){_0x8a6a76[_0x1011('0x1a')](0x194);}return _0x33e865;};}function handleError(_0x18462b,_0x32cdc7){_0x32cdc7=_0x32cdc7||0x1f4;return function(_0x241af8){logger[_0x1011('0x26')](_0x241af8[_0x1011('0x27')]);if(_0x241af8['name']){delete _0x241af8[_0x1011('0x28')];}_0x18462b['status'](_0x32cdc7)[_0x1011('0x29')](_0x241af8);};}exports['index']=function(_0x5e1bca,_0x18aaac){var _0x1d41fc={},_0x1121e5={},_0x5a093b={'count':0x0,'rows':[]};var _0x28c991=_[_0x1011('0x2a')](db[_0x1011('0x2b')]['rawAttributes'],function(_0x4ba976){return{'name':_0x4ba976[_0x1011('0x2c')],'type':_0x4ba976[_0x1011('0x2d')]['key']};});_0x1121e5['model']=_[_0x1011('0x2a')](_0x28c991,_0x1011('0x28'));_0x1121e5['query']=_[_0x1011('0x2e')](_0x5e1bca['query']);_0x1121e5['filters']=_[_0x1011('0x2f')](_0x1121e5[_0x1011('0x30')],_0x1121e5[_0x1011('0x31')]);_0x1d41fc[_0x1011('0x32')]=_[_0x1011('0x2f')](_0x1121e5[_0x1011('0x30')],qs['fields'](_0x5e1bca[_0x1011('0x31')][_0x1011('0x33')]));_0x1d41fc['attributes']=_0x1d41fc[_0x1011('0x32')]['length']?_0x1d41fc[_0x1011('0x32')]:_0x1121e5[_0x1011('0x30')];if(!_0x5e1bca[_0x1011('0x31')][_0x1011('0x34')](_0x1011('0x35'))){_0x1d41fc[_0x1011('0x20')]=qs['limit'](_0x5e1bca[_0x1011('0x31')][_0x1011('0x20')]);_0x1d41fc[_0x1011('0x1e')]=qs[_0x1011('0x1e')](_0x5e1bca[_0x1011('0x31')][_0x1011('0x1e')]);}_0x1d41fc['order']=qs[_0x1011('0x36')](_0x5e1bca['query'][_0x1011('0x36')]);_0x1d41fc[_0x1011('0x37')]=qs[_0x1011('0x38')](_[_0x1011('0x39')](_0x5e1bca[_0x1011('0x31')],_0x1121e5[_0x1011('0x38')]),_0x28c991);if(_0x5e1bca[_0x1011('0x31')][_0x1011('0x3a')]){_0x1d41fc['where']=_[_0x1011('0x3b')](_0x1d41fc[_0x1011('0x37')],{'$or':_[_0x1011('0x2a')](_0x28c991,function(_0x2260dd){if(_0x2260dd[_0x1011('0x2d')]!==_0x1011('0x3c')){var _0x2eb971={};_0x2eb971[_0x2260dd[_0x1011('0x28')]]={'$like':'%'+_0x5e1bca['query'][_0x1011('0x3a')]+'%'};return _0x2eb971;}})});}_0x1d41fc=_['merge']({},_0x1d41fc,_0x5e1bca[_0x1011('0x3d')]);var _0x1200c8={'where':_0x1d41fc[_0x1011('0x37')]};return db[_0x1011('0x2b')][_0x1011('0x3e')](_0x1200c8)[_0x1011('0x24')](function(_0x2780f0){_0x5a093b[_0x1011('0x3e')]=_0x2780f0;if(_0x5e1bca[_0x1011('0x31')][_0x1011('0x3f')]){_0x1d41fc['include']=[{'all':!![]}];}return db[_0x1011('0x2b')][_0x1011('0x40')](_0x1d41fc);})[_0x1011('0x24')](function(_0x5b5ac7){_0x5a093b['rows']=_0x5b5ac7;return _0x5a093b;})[_0x1011('0x24')](respondWithFilteredResult(_0x18aaac,_0x1d41fc))['catch'](handleError(_0x18aaac,null));};exports[_0x1011('0x41')]=function(_0x5e5f2e,_0x24a759){var _0x7f5618={'raw':!![],'where':{'id':_0x5e5f2e[_0x1011('0x42')]['id']}},_0x1b0a7f={};_0x1b0a7f[_0x1011('0x30')]=_[_0x1011('0x2e')](db['ZendeskField']['rawAttributes']);_0x1b0a7f['query']=_[_0x1011('0x2e')](_0x5e5f2e[_0x1011('0x31')]);_0x1b0a7f[_0x1011('0x38')]=_['intersection'](_0x1b0a7f['model'],_0x1b0a7f['query']);_0x7f5618[_0x1011('0x32')]=_['intersection'](_0x1b0a7f[_0x1011('0x30')],qs[_0x1011('0x33')](_0x5e5f2e[_0x1011('0x31')][_0x1011('0x33')]));_0x7f5618[_0x1011('0x32')]=_0x7f5618[_0x1011('0x32')][_0x1011('0x43')]?_0x7f5618['attributes']:_0x1b0a7f['model'];if(_0x5e5f2e[_0x1011('0x31')][_0x1011('0x3f')]){_0x7f5618[_0x1011('0x44')]=[{'all':!![]}];}_0x7f5618=_[_0x1011('0x3b')]({},_0x7f5618,_0x5e5f2e['options']);return db['ZendeskField'][_0x1011('0x45')](_0x7f5618)[_0x1011('0x24')](handleEntityNotFound(_0x24a759,null))[_0x1011('0x24')](respondWithResult(_0x24a759,null))[_0x1011('0x46')](handleError(_0x24a759,null));};exports[_0x1011('0x47')]=function(_0x5c1e1d,_0x463263){return db['ZendeskField'][_0x1011('0x47')](_0x5c1e1d[_0x1011('0x48')],{})[_0x1011('0x24')](respondWithResult(_0x463263,0xc9))[_0x1011('0x46')](handleError(_0x463263,null));};exports[_0x1011('0x23')]=function(_0x4fecd5,_0x2c82a1){if(_0x4fecd5['body']['id']){delete _0x4fecd5['body']['id'];}return db[_0x1011('0x2b')]['find']({'where':{'id':_0x4fecd5[_0x1011('0x42')]['id']}})[_0x1011('0x24')](handleEntityNotFound(_0x2c82a1,null))['then'](saveUpdates(_0x4fecd5[_0x1011('0x48')],null))[_0x1011('0x24')](respondWithResult(_0x2c82a1,null))[_0x1011('0x46')](handleError(_0x2c82a1,null));};exports[_0x1011('0x25')]=function(_0x498e31,_0x26dec0){return db[_0x1011('0x2b')][_0x1011('0x45')]({'where':{'id':_0x498e31['params']['id']}})[_0x1011('0x24')](handleEntityNotFound(_0x26dec0,null))[_0x1011('0x24')](removeEntity(_0x26dec0,null))[_0x1011('0x46')](handleError(_0x26dec0,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 7e65f7c..85e9d80 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 _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 +var _0xace8=['util','../../config/logger','api','moment','bluebird','request-promise','path','./intZendeskField.attributes','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash'];(function(_0x281eb1,_0x294f80){var _0x5d60ec=function(_0x298c82){while(--_0x298c82){_0x281eb1['push'](_0x281eb1['shift']());}};_0x5d60ec(++_0x294f80);}(_0xace8,0x1d0));var _0x8ace=function(_0x3aaf78,_0x27aa1f){_0x3aaf78=_0x3aaf78-0x0;var _0x1c97b7=_0xace8[_0x3aaf78];return _0x1c97b7;};'use strict';var _=require(_0x8ace('0x0'));var util=require(_0x8ace('0x1'));var logger=require(_0x8ace('0x2'))(_0x8ace('0x3'));var moment=require(_0x8ace('0x4'));var BPromise=require(_0x8ace('0x5'));var rp=require(_0x8ace('0x6'));var fs=require('fs');var path=require(_0x8ace('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8ace('0x8'));module['exports']=function(_0x1a77ba,_0x1ebcc7){return _0x1a77ba[_0x8ace('0x9')](_0x8ace('0xa'),attributes,{'tableName':_0x8ace('0xb'),'paranoid':![],'indexes':[{'name':_0x8ace('0xc'),'fields':[_0x8ace('0xd'),_0x8ace('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index d5444a3..11c317c 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 _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 +var _0x337a=['request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','ZendeskField,\x20%s,\x20%s'];(function(_0x51160c,_0x374b59){var _0x15a3fb=function(_0x5e81bc){while(--_0x5e81bc){_0x51160c['push'](_0x51160c['shift']());}};_0x15a3fb(++_0x374b59);}(_0x337a,0xcf));var _0xa337=function(_0x3da4a6,_0x38e3bd){_0x3da4a6=_0x3da4a6-0x0;var _0x4cf1bd=_0x337a[_0x3da4a6];return _0x4cf1bd;};'use strict';var _=require(_0xa337('0x0'));var util=require(_0xa337('0x1'));var moment=require(_0xa337('0x2'));var BPromise=require(_0xa337('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa337('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa337('0x5'))(_0xa337('0x6'));var config=require(_0xa337('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa337('0x8')][_0xa337('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x390d04,_0x39f4df,_0x49ad32){return new BPromise(function(_0x116e08,_0x1168fb){return client['request'](_0x390d04,_0x49ad32)[_0xa337('0xa')](function(_0x1511aa){logger[_0xa337('0xb')](_0xa337('0xc'),_0x39f4df,_0xa337('0xd'));logger[_0xa337('0xe')](_0xa337('0xf'),_0x39f4df,_0xa337('0xd'),JSON[_0xa337('0x10')](_0x1511aa));if(_0x1511aa[_0xa337('0x11')]){if(_0x1511aa[_0xa337('0x11')][_0xa337('0x12')]===0x1f4){logger[_0xa337('0x11')](_0xa337('0xc'),_0x39f4df,_0x1511aa[_0xa337('0x11')][_0xa337('0x13')]);return _0x1168fb(_0x1511aa['error'][_0xa337('0x13')]);}logger['error'](_0xa337('0xc'),_0x39f4df,_0x1511aa[_0xa337('0x11')][_0xa337('0x13')]);return _0x116e08(_0x1511aa[_0xa337('0x11')]['message']);}else{logger[_0xa337('0xb')]('ZendeskField,\x20%s,\x20%s',_0x39f4df,'request\x20sent');_0x116e08(_0x1511aa[_0xa337('0x14')][_0xa337('0x13')]);}})[_0xa337('0x15')](function(_0x3f9b0d){logger[_0xa337('0x11')](_0xa337('0xc'),_0x39f4df,_0x3f9b0d);_0x1168fb(_0x3f9b0d);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index bc4e7bc..ad1d5d2 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 _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 +var _0x35d6=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','getFields','post','/:id/configurations','update','delete','/:id','destroy','exports','multer','util'];(function(_0x44aa76,_0x2c9362){var _0x151ac7=function(_0x4f30a0){while(--_0x4f30a0){_0x44aa76['push'](_0x44aa76['shift']());}};_0x151ac7(++_0x2c9362);}(_0x35d6,0x1c6));var _0x635d=function(_0x115cc8,_0x5f3547){_0x115cc8=_0x115cc8-0x0;var _0x235dfc=_0x35d6[_0x115cc8];return _0x235dfc;};'use strict';var multer=require(_0x635d('0x0'));var util=require(_0x635d('0x1'));var path=require(_0x635d('0x2'));var timeout=require('connect-timeout');var express=require(_0x635d('0x3'));var router=express[_0x635d('0x4')]();var fs_extra=require(_0x635d('0x5'));var auth=require(_0x635d('0x6'));var interaction=require(_0x635d('0x7'));var config=require(_0x635d('0x8'));var controller=require('./intZohoAccount.controller');router[_0x635d('0x9')]('/',auth[_0x635d('0xa')](),controller['index']);router[_0x635d('0x9')]('/:id',auth[_0x635d('0xa')](),controller['show']);router[_0x635d('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0x635d('0x9')]('/:id/fields',auth[_0x635d('0xa')](),controller[_0x635d('0xb')]);router[_0x635d('0xc')]('/',auth[_0x635d('0xa')](),controller['create']);router[_0x635d('0xc')](_0x635d('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x635d('0xe')]);router[_0x635d('0xf')](_0x635d('0x10'),auth[_0x635d('0xa')](),controller[_0x635d('0x11')]);module[_0x635d('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index ae1068a..ff0ea92 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 _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 +var _0xa8a8=['exports','STRING','sequelize'];(function(_0x3588ae,_0x423afe){var _0x386636=function(_0x2f1b5e){while(--_0x2f1b5e){_0x3588ae['push'](_0x3588ae['shift']());}};_0x386636(++_0x423afe);}(_0xa8a8,0xec));var _0x8a8a=function(_0x2d2b47,_0x1e3e85){_0x2d2b47=_0x2d2b47-0x0;var _0x576c63=_0xa8a8[_0x2d2b47];return _0x576c63;};'use strict';var Sequelize=require(_0x8a8a('0x0'));module[_0x8a8a('0x1')]={'name':{'type':Sequelize[_0x8a8a('0x2')]},'description':{'type':Sequelize[_0x8a8a('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x8a8a('0x2')]},'clientId':{'type':Sequelize[_0x8a8a('0x2')]},'clientSecret':{'type':Sequelize[_0x8a8a('0x2')]},'serverUrl':{'type':Sequelize[_0x8a8a('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x8a8a('0x2')]},'refreshToken':{'type':Sequelize[_0x8a8a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 3c4dd2b..a66317a 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 _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 +var _0x7c6e=['com','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','message','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','api_name','system_mandatory','display_label','data_type','picklist','pick_list_values','test','statusCode','getFields','stringify','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','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','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','index','map','ZohoAccount','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','rawAttributes','create','body','find','getConfigurations','findOne','ZohoConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','zone','clientSecret','code','zoho.eu'];(function(_0x5eff86,_0x2cdd22){var _0x4b3010=function(_0x319012){while(--_0x319012){_0x5eff86['push'](_0x5eff86['shift']());}};_0x4b3010(++_0x2cdd22);}(_0x7c6e,0x121));var _0xe7c6=function(_0x3f7dd4,_0x1b8904){_0x3f7dd4=_0x3f7dd4-0x0;var _0x2726e3=_0x7c6e[_0x3f7dd4];return _0x2726e3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe7c6('0x0'));var zipdir=require(_0xe7c6('0x1'));var jsonpatch=require(_0xe7c6('0x2'));var rp=require(_0xe7c6('0x3'));var moment=require(_0xe7c6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe7c6('0x5'));var path=require(_0xe7c6('0x6'));var sox=require(_0xe7c6('0x7'));var csv=require(_0xe7c6('0x8'));var ejs=require(_0xe7c6('0x9'));var fs=require('fs');var fs_extra=require(_0xe7c6('0xa'));var _=require(_0xe7c6('0xb'));var squel=require(_0xe7c6('0xc'));var crypto=require(_0xe7c6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe7c6('0xe'));var toCsv=require(_0xe7c6('0x8'));var querystring=require(_0xe7c6('0xf'));var Papa=require(_0xe7c6('0x10'));var Redis=require(_0xe7c6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe7c6('0x12'));var as=require(_0xe7c6('0x13'));var hardwareService=require(_0xe7c6('0x14'));var logger=require(_0xe7c6('0x15'))(_0xe7c6('0x16'));var utils=require('../../config/utils');var config=require(_0xe7c6('0x17'));var licenseUtil=require(_0xe7c6('0x18'));var db=require(_0xe7c6('0x19'))['db'];var integrations=require(_0xe7c6('0x1a'));function respondWithStatusCode(_0x1fdb16,_0x2e7898){_0x2e7898=_0x2e7898||0xcc;return function(_0x19d1ab){if(_0x19d1ab){return _0x1fdb16['sendStatus'](_0x2e7898);}return _0x1fdb16[_0xe7c6('0x1b')](_0x2e7898)[_0xe7c6('0x1c')]();};}function respondWithResult(_0x1f4c23,_0x10fa89){_0x10fa89=_0x10fa89||0xc8;return function(_0x3d7690){if(_0x3d7690){return _0x1f4c23['status'](_0x10fa89)[_0xe7c6('0x1d')](_0x3d7690);}};}function respondWithFilteredResult(_0x55aa2a,_0x177796){return function(_0x3b4586){if(_0x3b4586){var _0x429f69=typeof _0x177796[_0xe7c6('0x1e')]===_0xe7c6('0x1f')&&typeof _0x177796[_0xe7c6('0x20')]===_0xe7c6('0x1f');var _0x3dc145=_0x3b4586[_0xe7c6('0x21')];var _0x581c65=_0x429f69?0x0:_0x177796[_0xe7c6('0x1e')];var _0xe7af7e=_0x429f69?_0x3b4586['count']:_0x177796[_0xe7c6('0x1e')]+_0x177796[_0xe7c6('0x20')];var _0x294873;if(_0xe7af7e>=_0x3dc145){_0xe7af7e=_0x3dc145;_0x294873=0xc8;}else{_0x294873=0xce;}_0x55aa2a[_0xe7c6('0x1b')](_0x294873);return _0x55aa2a[_0xe7c6('0x22')](_0xe7c6('0x23'),_0x581c65+'-'+_0xe7af7e+'/'+_0x3dc145)['json'](_0x3b4586);}return null;};}function patchUpdates(_0x4da91b){return function(_0x4cc29d){try{jsonpatch[_0xe7c6('0x24')](_0x4cc29d,_0x4da91b,!![]);}catch(_0x1937a6){return BPromise[_0xe7c6('0x25')](_0x1937a6);}return _0x4cc29d[_0xe7c6('0x26')]();};}function saveUpdates(_0x3ac61c,_0x5c7296){return function(_0x538015){if(_0x538015){return _0x538015[_0xe7c6('0x27')](_0x3ac61c)[_0xe7c6('0x28')](function(_0x415af8){return _0x415af8;});}return null;};}function removeEntity(_0x16f747,_0x527f0d){return function(_0x3ad033){if(_0x3ad033){return _0x3ad033['destroy']()[_0xe7c6('0x28')](function(){_0x16f747[_0xe7c6('0x1b')](0xcc)[_0xe7c6('0x1c')]();});}};}function handleEntityNotFound(_0x3c1496,_0x56f0b3){return function(_0x190116){if(!_0x190116){_0x3c1496[_0xe7c6('0x29')](0x194);}return _0x190116;};}function handleError(_0x27b3a4,_0x2c9e6b){_0x2c9e6b=_0x2c9e6b||0x1f4;return function(_0x44998b){logger['error'](_0x44998b[_0xe7c6('0x2a')]);if(_0x44998b[_0xe7c6('0x2b')]){delete _0x44998b[_0xe7c6('0x2b')];}_0x27b3a4[_0xe7c6('0x1b')](_0x2c9e6b)['send'](_0x44998b);};}exports[_0xe7c6('0x2c')]=function(_0xd9a8db,_0x1d395f){var _0x1c342c={},_0x327e7c={},_0x54ff03={'count':0x0,'rows':[]};var _0x27cba9=_[_0xe7c6('0x2d')](db[_0xe7c6('0x2e')]['rawAttributes'],function(_0x4fb5d2){return{'name':_0x4fb5d2[_0xe7c6('0x2f')],'type':_0x4fb5d2[_0xe7c6('0x30')]['key']};});_0x327e7c[_0xe7c6('0x31')]=_[_0xe7c6('0x2d')](_0x27cba9,_0xe7c6('0x2b'));_0x327e7c[_0xe7c6('0x32')]=_[_0xe7c6('0x33')](_0xd9a8db[_0xe7c6('0x32')]);_0x327e7c[_0xe7c6('0x34')]=_[_0xe7c6('0x35')](_0x327e7c[_0xe7c6('0x31')],_0x327e7c[_0xe7c6('0x32')]);_0x1c342c[_0xe7c6('0x36')]=_[_0xe7c6('0x35')](_0x327e7c[_0xe7c6('0x31')],qs['fields'](_0xd9a8db['query'][_0xe7c6('0x37')]));_0x1c342c[_0xe7c6('0x36')]=_0x1c342c[_0xe7c6('0x36')][_0xe7c6('0x38')]?_0x1c342c['attributes']:_0x327e7c[_0xe7c6('0x31')];if(!_0xd9a8db[_0xe7c6('0x32')]['hasOwnProperty'](_0xe7c6('0x39'))){_0x1c342c[_0xe7c6('0x20')]=qs[_0xe7c6('0x20')](_0xd9a8db['query'][_0xe7c6('0x20')]);_0x1c342c[_0xe7c6('0x1e')]=qs['offset'](_0xd9a8db[_0xe7c6('0x32')][_0xe7c6('0x1e')]);}_0x1c342c[_0xe7c6('0x3a')]=qs[_0xe7c6('0x3b')](_0xd9a8db[_0xe7c6('0x32')]['sort']);_0x1c342c[_0xe7c6('0x3c')]=qs[_0xe7c6('0x34')](_[_0xe7c6('0x3d')](_0xd9a8db[_0xe7c6('0x32')],_0x327e7c[_0xe7c6('0x34')]),_0x27cba9);if(_0xd9a8db['query'][_0xe7c6('0x3e')]){_0x1c342c[_0xe7c6('0x3c')]=_[_0xe7c6('0x3f')](_0x1c342c['where'],{'$or':_[_0xe7c6('0x2d')](_0x27cba9,function(_0xc580c4){if(_0xc580c4[_0xe7c6('0x30')]!==_0xe7c6('0x40')){var _0x370f2b={};_0x370f2b[_0xc580c4['name']]={'$like':'%'+_0xd9a8db['query'][_0xe7c6('0x3e')]+'%'};return _0x370f2b;}})});}_0x1c342c=_[_0xe7c6('0x3f')]({},_0x1c342c,_0xd9a8db[_0xe7c6('0x41')]);var _0x35236b={'where':_0x1c342c[_0xe7c6('0x3c')]};return db[_0xe7c6('0x2e')][_0xe7c6('0x21')](_0x35236b)[_0xe7c6('0x28')](function(_0x2241be){_0x54ff03['count']=_0x2241be;if(_0xd9a8db[_0xe7c6('0x32')][_0xe7c6('0x42')]){_0x1c342c[_0xe7c6('0x43')]=[{'all':!![]}];}return db[_0xe7c6('0x2e')]['findAll'](_0x1c342c);})['then'](function(_0x2ec2cb){_0x54ff03['rows']=_0x2ec2cb;return _0x54ff03;})[_0xe7c6('0x28')](respondWithFilteredResult(_0x1d395f,_0x1c342c))[_0xe7c6('0x44')](handleError(_0x1d395f,null));};exports[_0xe7c6('0x45')]=function(_0xb474f6,_0x40d26b){var _0x1f250d={'raw':![],'where':{'id':_0xb474f6[_0xe7c6('0x46')]['id']}},_0x5b4740={};_0x5b4740[_0xe7c6('0x31')]=_[_0xe7c6('0x33')](db[_0xe7c6('0x2e')][_0xe7c6('0x47')]);_0x5b4740['query']=_[_0xe7c6('0x33')](_0xb474f6[_0xe7c6('0x32')]);_0x5b4740[_0xe7c6('0x34')]=_[_0xe7c6('0x35')](_0x5b4740[_0xe7c6('0x31')],_0x5b4740[_0xe7c6('0x32')]);_0x1f250d['attributes']=_[_0xe7c6('0x35')](_0x5b4740['model'],qs[_0xe7c6('0x37')](_0xb474f6['query'][_0xe7c6('0x37')]));_0x1f250d[_0xe7c6('0x36')]=_0x1f250d[_0xe7c6('0x36')][_0xe7c6('0x38')]?_0x1f250d[_0xe7c6('0x36')]:_0x5b4740[_0xe7c6('0x31')];if(_0xb474f6['query']['includeAll']){_0x1f250d[_0xe7c6('0x43')]=[{'all':!![]}];}_0x1f250d=_[_0xe7c6('0x3f')]({},_0x1f250d,_0xb474f6[_0xe7c6('0x41')]);return db[_0xe7c6('0x2e')]['find'](_0x1f250d)[_0xe7c6('0x28')](handleEntityNotFound(_0x40d26b,null))[_0xe7c6('0x28')](respondWithResult(_0x40d26b,null))[_0xe7c6('0x44')](handleError(_0x40d26b,null));};exports[_0xe7c6('0x48')]=function(_0xb69dce,_0x1f239b){return db[_0xe7c6('0x2e')][_0xe7c6('0x48')](_0xb69dce[_0xe7c6('0x49')],{})[_0xe7c6('0x28')](respondWithResult(_0x1f239b,0xc9))[_0xe7c6('0x44')](handleError(_0x1f239b,null));};exports[_0xe7c6('0x27')]=function(_0x2429a6,_0x31e401){if(_0x2429a6[_0xe7c6('0x49')]['id']){delete _0x2429a6['body']['id'];}return db['ZohoAccount'][_0xe7c6('0x4a')]({'where':{'id':_0x2429a6['params']['id']}})[_0xe7c6('0x28')](handleEntityNotFound(_0x31e401,null))[_0xe7c6('0x28')](saveUpdates(_0x2429a6[_0xe7c6('0x49')],null))[_0xe7c6('0x28')](respondWithResult(_0x31e401,null))[_0xe7c6('0x44')](handleError(_0x31e401,null));};exports['destroy']=function(_0x242251,_0xce13c3){return db[_0xe7c6('0x2e')]['find']({'where':{'id':_0x242251[_0xe7c6('0x46')]['id']}})[_0xe7c6('0x28')](handleEntityNotFound(_0xce13c3,null))[_0xe7c6('0x28')](removeEntity(_0xce13c3,null))[_0xe7c6('0x44')](handleError(_0xce13c3,null));};exports[_0xe7c6('0x4b')]=function(_0x47497f,_0x45409c,_0x43cc7b){var _0x5a2cf6={};var _0x2a4a31={};var _0x1372c9;var _0x3dd0d5;return db[_0xe7c6('0x2e')][_0xe7c6('0x4c')]({'where':{'id':_0x47497f[_0xe7c6('0x46')]['id']}})['then'](handleEntityNotFound(_0x45409c,null))[_0xe7c6('0x28')](function(_0x19bd0e){if(_0x19bd0e){_0x1372c9=_0x19bd0e;_0x2a4a31[_0xe7c6('0x31')]=_['keys'](db[_0xe7c6('0x4d')]['rawAttributes']);_0x2a4a31[_0xe7c6('0x32')]=_[_0xe7c6('0x33')](_0x47497f[_0xe7c6('0x32')]);_0x2a4a31[_0xe7c6('0x34')]=_[_0xe7c6('0x35')](_0x2a4a31[_0xe7c6('0x31')],_0x2a4a31[_0xe7c6('0x32')]);_0x5a2cf6[_0xe7c6('0x36')]=_[_0xe7c6('0x35')](_0x2a4a31['model'],qs[_0xe7c6('0x37')](_0x47497f[_0xe7c6('0x32')][_0xe7c6('0x37')]));_0x5a2cf6[_0xe7c6('0x36')]=_0x5a2cf6[_0xe7c6('0x36')][_0xe7c6('0x38')]?_0x5a2cf6[_0xe7c6('0x36')]:_0x2a4a31[_0xe7c6('0x31')];_0x5a2cf6['order']=qs['sort'](_0x47497f[_0xe7c6('0x32')][_0xe7c6('0x3b')]);_0x5a2cf6[_0xe7c6('0x3c')]=qs[_0xe7c6('0x34')](_[_0xe7c6('0x3d')](_0x47497f['query'],_0x2a4a31['filters']));if(_0x47497f[_0xe7c6('0x32')][_0xe7c6('0x3e')]){_0x5a2cf6[_0xe7c6('0x3c')]=_[_0xe7c6('0x3f')](_0x5a2cf6[_0xe7c6('0x3c')],{'$or':_['map'](_0x5a2cf6['attributes'],function(_0x1beb6f){var _0x2dfe44={};_0x2dfe44[_0x1beb6f]={'$like':'%'+_0x47497f[_0xe7c6('0x32')][_0xe7c6('0x3e')]+'%'};return _0x2dfe44;})});}_0x5a2cf6=_[_0xe7c6('0x3f')]({},_0x5a2cf6,_0x47497f['options']);return _0x1372c9[_0xe7c6('0x4b')](_0x5a2cf6);}})[_0xe7c6('0x28')](function(_0x50fcad){if(_0x50fcad){_0x3dd0d5=_0x50fcad[_0xe7c6('0x38')];if(!_0x47497f[_0xe7c6('0x32')]['hasOwnProperty'](_0xe7c6('0x39'))){_0x5a2cf6[_0xe7c6('0x20')]=qs[_0xe7c6('0x20')](_0x47497f['query'][_0xe7c6('0x20')]);_0x5a2cf6[_0xe7c6('0x1e')]=qs[_0xe7c6('0x1e')](_0x47497f[_0xe7c6('0x32')]['offset']);}return _0x1372c9[_0xe7c6('0x4b')](_0x5a2cf6);}})[_0xe7c6('0x28')](function(_0x377c69){if(_0x377c69){return _0x377c69?{'count':_0x3dd0d5,'rows':_0x377c69}:null;}})[_0xe7c6('0x28')](respondWithResult(_0x45409c,null))['catch'](handleError(_0x45409c,null));};exports['addConfiguration']=function(_0x42a937,_0x3f5a1a,_0x1c846b){if(_0x42a937[_0xe7c6('0x49')]['id']){delete _0x42a937[_0xe7c6('0x49')]['id'];}return db[_0xe7c6('0x2e')][_0xe7c6('0x4c')]({'where':{'id':_0x42a937['params']['id']}})[_0xe7c6('0x28')](handleEntityNotFound(_0x3f5a1a,null))[_0xe7c6('0x28')](function(_0x241376){if(_0x241376){_0x42a937[_0xe7c6('0x49')][_0xe7c6('0x4e')]=_0x241376['id'];_0x42a937['body'][_0xe7c6('0x4f')]=integrations[_0xe7c6('0x50')](_0x42a937[_0xe7c6('0x49')][_0xe7c6('0x51')],_0x42a937[_0xe7c6('0x49')][_0xe7c6('0x30')]);_0x42a937[_0xe7c6('0x49')][_0xe7c6('0x52')]=integrations[_0xe7c6('0x53')](_0x42a937[_0xe7c6('0x49')][_0xe7c6('0x51')],_0x42a937['body'][_0xe7c6('0x30')]);return db['ZohoConfiguration'][_0xe7c6('0x48')](_0x42a937[_0xe7c6('0x49')],{'include':[{'model':db['ZohoField'],'as':_0xe7c6('0x4f')},{'model':db[_0xe7c6('0x54')],'as':'Descriptions'}]});}return null;})[_0xe7c6('0x28')](respondWithResult(_0x3f5a1a,null))['catch'](handleError(_0x3f5a1a,null));};function getAccessToken(_0x554e09){return new Promise(function(_0xa78e8d,_0x51b11b){var _0xb7ff1;switch(_0x554e09['zone']){case'US':_0xb7ff1=_0xe7c6('0x55');break;case'AU':_0xb7ff1=_0xe7c6('0x56');break;case'EU':_0xb7ff1=_0xe7c6('0x57');break;case'IN':_0xb7ff1='https://accounts.zoho.in';break;case'CN':_0xb7ff1='https://accounts.zoho.com.cn';break;default:_0xb7ff1='https://accounts.zoho.eu';break;}var _0x4055bb={'method':'POST','uri':_0xb7ff1+_0xe7c6('0x58'),'qs':{'refresh_token':_0x554e09[_0xe7c6('0x59')],'client_id':_0x554e09[_0xe7c6('0x5a')],'client_secret':_0x554e09['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x4055bb)[_0xe7c6('0x28')](function(_0x28452f){if(_0x28452f[_0xe7c6('0x5b')]){_0xa78e8d(_0x28452f[_0xe7c6('0x5b')]);}else{_0x51b11b(_0xe7c6('0x5c'));}})[_0xe7c6('0x44')](function(_0x5627b9){_0x51b11b(_0x5627b9);});});}exports['getFields']=function(_0x54646a,_0x367022,_0x47a252){var _0x1e877a,_0xea19e,_0x18f236,_0x4f0986,_0x3b36fd;return db[_0xe7c6('0x2e')][_0xe7c6('0x4c')]({'where':{'id':_0x54646a['params']['id']},'attributes':['id',_0xe7c6('0x5d'),_0xe7c6('0x5e'),_0xe7c6('0x5a'),_0xe7c6('0x5f'),'serverUrl',_0xe7c6('0x60'),_0xe7c6('0x59')]})[_0xe7c6('0x28')](handleEntityNotFound(_0x367022,null))[_0xe7c6('0x28')](function(_0xbb6140){_0x3b36fd=_0xbb6140;_0x1e877a=_0x3b36fd['host'];_0xea19e=_0x1e877a===_0xe7c6('0x61')?'eu':_0xe7c6('0x62');_0x18f236=_0x3b36fd[_0xe7c6('0x63')];var _0x46df3b=_0x18f236[_0xe7c6('0x64')](-0x1);if(_0x46df3b==='/'||_0x46df3b==='\x5c'||_0x46df3b===':'){_0x18f236=_0x18f236[_0xe7c6('0x65')](0x0,_0x18f236[_0xe7c6('0x66')](_0x46df3b));}if(!_0x3b36fd[_0xe7c6('0x59')]){throw new Error(_0xe7c6('0x67'));}return getAccessToken(_0x3b36fd);})[_0xe7c6('0x28')](function(_0x3f1b0a){if(_0x3f1b0a){return rp({'method':_0xe7c6('0x68'),'uri':util['format'](_0xe7c6('0x69'),_0xea19e),'qs':{'module':_0xe7c6('0x6a')},'headers':{'Authorization':_0xe7c6('0x6b')+_0x3f1b0a},'json':!![]});}})[_0xe7c6('0x28')](function(_0x4f0cdf){if(_0x4f0cdf){if(_0x4f0cdf[_0xe7c6('0x6c')]&&_0x4f0cdf[_0xe7c6('0x6c')][_0xe7c6('0x6d')]){throw new Error(_0x4f0cdf[_0xe7c6('0x6c')][_0xe7c6('0x6d')][_0xe7c6('0x6e')]);}var _0x420b77=[];var _0xa3a266=[];var _0x22f3c0=[_0xe7c6('0x6f'),_0xe7c6('0x70'),'Description',_0xe7c6('0x71'),_0xe7c6('0x72'),_0xe7c6('0x73'),_0xe7c6('0x74'),'Call_Type'];_0xa3a266=_[_0xe7c6('0x75')](_0x4f0cdf[_0xe7c6('0x37')],function(_0x33f5aa){return _0x22f3c0[_0xe7c6('0x76')](_0x33f5aa[_0xe7c6('0x77')]);});for(var _0x12f478=0x0;_0x12f478<_0xa3a266['length'];_0x12f478++){if(_0xa3a266[_0x12f478][_0xe7c6('0x78')]===![]){_0x420b77['push']({'id':_0xa3a266[_0x12f478]['id'],'name':_0xa3a266[_0x12f478][_0xe7c6('0x79')],'custom':_0xa3a266[_0x12f478]['custom_field'],'options':_0xa3a266[_0x12f478][_0xe7c6('0x7a')]===_0xe7c6('0x7b')&&_0xa3a266[_0x12f478]['pick_list_values'][_0xe7c6('0x38')]>-0x1?_[_0xe7c6('0x2d')](_0xa3a266[_0x12f478][_0xe7c6('0x7c')],function(_0x876c37){return{'name':_0x876c37,'value':_0x876c37};}):[]});}}return{'count':_0x420b77[_0xe7c6('0x38')],'rows':_0x420b77};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x367022,null))[_0xe7c6('0x44')](function(_0x29844a){var _0x247cbc=_0x54646a['query'][_0xe7c6('0x7d')]?0x1f4:_0x29844a[_0xe7c6('0x7e')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xe7c6('0x7f'),_0x247cbc,JSON[_0xe7c6('0x80')](_0x29844a));delete _0x29844a[_0xe7c6('0x2b')];if(_0x247cbc===0x191){_0x247cbc=0x190;}_0x367022[_0xe7c6('0x1b')](_0x247cbc)['send'](_0x54646a['query'][_0xe7c6('0x7d')]?{'message':'Wrong\x20credentials','statusCode':_0x29844a[_0xe7c6('0x7e')]}:_0x29844a);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 1b864fd..eaa984c 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 _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 +var _0xd585=['./intZohoAccount.attributes','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','code','host','slice','substring','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','clientSecret','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','error','format','clientId','https://accounts.zoho.com','https://accounts.zoho.com.cn','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x19cf38,_0x173546){var _0x22f483=function(_0x4c13c8){while(--_0x4c13c8){_0x19cf38['push'](_0x19cf38['shift']());}};_0x22f483(++_0x173546);}(_0xd585,0xf3));var _0x5d58=function(_0x1a14d7,_0x192602){_0x1a14d7=_0x1a14d7-0x0;var _0x462d19=_0xd585[_0x1a14d7];return _0x462d19;};'use strict';var _=require(_0x5d58('0x0'));var util=require(_0x5d58('0x1'));var logger=require(_0x5d58('0x2'))(_0x5d58('0x3'));var moment=require('moment');var BPromise=require(_0x5d58('0x4'));var rp=require(_0x5d58('0x5'));var fs=require('fs');var path=require(_0x5d58('0x6'));var rimraf=require(_0x5d58('0x7'));var config=require(_0x5d58('0x8'));var attributes=require(_0x5d58('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x3df19e,_0x4d1901){return _0x3df19e[_0x5d58('0xa')](_0x5d58('0xb'),attributes,{'tableName':_0x5d58('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x263ebb,_0x36219b,_0x7293df){if(_0x263ebb[_0x5d58('0xd')]('zone')||_0x263ebb['changed'](_0x5d58('0xe'))||_0x263ebb[_0x5d58('0xd')]('clientId')||_0x263ebb[_0x5d58('0xd')]('clientSecret')||_0x263ebb[_0x5d58('0xd')](_0x5d58('0xf'))||_0x263ebb[_0x5d58('0xd')](_0x5d58('0x10'))){var _0x201eba,_0x4e951d;_0x201eba=_0x263ebb[_0x5d58('0xe')];var _0x5c1fef=_0x201eba[_0x5d58('0x11')](-0x1);if(_0x5c1fef==='/'||_0x5c1fef==='\x5c'||_0x5c1fef===':'){_0x201eba=_0x201eba[_0x5d58('0x12')](0x0,_0x201eba['lastIndexOf'](_0x5c1fef));}switch(_0x263ebb[_0x5d58('0x13')]){case'US':_0x4e951d='https://accounts.zoho.com';break;case'AU':_0x4e951d=_0x5d58('0x14');break;case'IN':_0x4e951d=_0x5d58('0x15');break;case'CN':_0x4e951d='https://accounts.zoho.com.cn';break;default:_0x4e951d=_0x5d58('0x16');break;}var _0x3ffd63={'method':_0x5d58('0x17'),'uri':_0x4e951d+_0x5d58('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x263ebb['clientId'],'client_secret':_0x263ebb[_0x5d58('0x19')],'redirect_uri':_0x263ebb['serverUrl'],'code':_0x263ebb['code']},'headers':{'Content-Type':_0x5d58('0x1a')}};return rp(_0x3ffd63)[_0x5d58('0x1b')](function(_0xf9ac95){var _0x2828b0=JSON[_0x5d58('0x1c')](_0xf9ac95);if(_0x2828b0[_0x5d58('0x1d')]){_0x263ebb[_0x5d58('0x1e')]=_0x2828b0[_0x5d58('0x1d')];logger[_0x5d58('0x1f')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x263ebb['name'],_0x263ebb['id']));}else{logger['error'](util['format'](_0x5d58('0x20'),_0x263ebb[_0x5d58('0x21')],_0x263ebb['id']),util[_0x5d58('0x22')](_0x2828b0,{'showHidden':![],'depth':null}));}return _0x7293df(null,_0x36219b);})[_0x5d58('0x23')](function(_0x57807b){logger[_0x5d58('0x24')](util[_0x5d58('0x25')](_0x5d58('0x20'),_0x263ebb[_0x5d58('0x21')],_0x263ebb['id']),util[_0x5d58('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x7293df(_0x57807b);});}else{return _0x7293df(null,_0x36219b);}},'beforeUpdate':function(_0x30b7ae,_0x511af5,_0x9b8a2f){if(_0x30b7ae[_0x5d58('0xd')](_0x5d58('0x13'))||_0x30b7ae[_0x5d58('0xd')](_0x5d58('0xe'))||_0x30b7ae[_0x5d58('0xd')](_0x5d58('0x26'))||_0x30b7ae[_0x5d58('0xd')](_0x5d58('0x19'))||_0x30b7ae[_0x5d58('0xd')]('code')||_0x30b7ae[_0x5d58('0xd')]('host')){var _0x4c6451,_0x23da27;_0x4c6451=_0x30b7ae[_0x5d58('0xe')];var _0x94675c=_0x4c6451[_0x5d58('0x11')](-0x1);if(_0x94675c==='/'||_0x94675c==='\x5c'||_0x94675c===':'){_0x4c6451=_0x4c6451[_0x5d58('0x12')](0x0,_0x4c6451['lastIndexOf'](_0x94675c));}switch(_0x30b7ae[_0x5d58('0x13')]){case'US':_0x23da27=_0x5d58('0x27');break;case'AU':_0x23da27=_0x5d58('0x14');break;case'IN':_0x23da27='https://accounts.zoho.in';break;case'CN':_0x23da27=_0x5d58('0x28');break;default:_0x23da27=_0x5d58('0x16');break;}var _0x3cff52={'method':_0x5d58('0x17'),'uri':_0x23da27+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x30b7ae[_0x5d58('0x26')],'client_secret':_0x30b7ae['clientSecret'],'redirect_uri':_0x30b7ae[_0x5d58('0xe')],'code':_0x30b7ae[_0x5d58('0xf')]},'headers':{'Content-Type':_0x5d58('0x1a')}};return rp(_0x3cff52)['then'](function(_0xd344ee){var _0x152010=JSON[_0x5d58('0x1c')](_0xd344ee);if(_0x152010[_0x5d58('0x1d')]){_0x30b7ae[_0x5d58('0x1e')]=_0x152010[_0x5d58('0x1d')];logger[_0x5d58('0x1f')](util[_0x5d58('0x25')](_0x5d58('0x29'),_0x30b7ae['name'],_0x30b7ae['id']));}else{logger[_0x5d58('0x24')](util[_0x5d58('0x25')](_0x5d58('0x20'),_0x30b7ae[_0x5d58('0x21')],_0x30b7ae['id']),util[_0x5d58('0x22')](_0x152010,{'showHidden':![],'depth':null}));}return _0x9b8a2f(null,_0x511af5);})['catch'](function(_0x45234d){logger[_0x5d58('0x24')](util['format'](_0x5d58('0x20'),_0x30b7ae[_0x5d58('0x21')],_0x30b7ae['id']),util[_0x5d58('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x9b8a2f(_0x45234d);});}else{return _0x9b8a2f(null,_0x511af5);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index a9186f0..ddd9896 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 _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 +var _0x853e=['util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','ZohoAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','find','ShowZohoAccount'];(function(_0x59deb3,_0x1278a4){var _0x3875d3=function(_0x4cbdc1){while(--_0x4cbdc1){_0x59deb3['push'](_0x59deb3['shift']());}};_0x3875d3(++_0x1278a4);}(_0x853e,0x1ea));var _0xe853=function(_0x237443,_0x282cd4){_0x237443=_0x237443-0x0;var _0x3d3ff9=_0x853e[_0x237443];return _0x3d3ff9;};'use strict';var _=require('lodash');var util=require(_0xe853('0x0'));var moment=require('moment');var BPromise=require(_0xe853('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe853('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe853('0x3'));var logger=require(_0xe853('0x4'))(_0xe853('0x5'));var config=require(_0xe853('0x6'));var jayson=require(_0xe853('0x7'));var client=jayson['client'][_0xe853('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x131614,_0xab8d0d,_0x25e6e1){return new BPromise(function(_0xe3d468,_0x36d502){return client[_0xe853('0x9')](_0x131614,_0x25e6e1)[_0xe853('0xa')](function(_0x213f17){logger[_0xe853('0xb')]('ZohoAccount,\x20%s,\x20%s',_0xab8d0d,'request\x20sent');logger['debug'](_0xe853('0xc'),_0xab8d0d,'request\x20sent',JSON['stringify'](_0x213f17));if(_0x213f17[_0xe853('0xd')]){if(_0x213f17[_0xe853('0xd')][_0xe853('0xe')]===0x1f4){logger['error'](_0xe853('0xf'),_0xab8d0d,_0x213f17[_0xe853('0xd')][_0xe853('0x10')]);return _0x36d502(_0x213f17[_0xe853('0xd')][_0xe853('0x10')]);}logger[_0xe853('0xd')](_0xe853('0xf'),_0xab8d0d,_0x213f17['error']['message']);return _0xe3d468(_0x213f17['error']['message']);}else{logger[_0xe853('0xb')](_0xe853('0xf'),_0xab8d0d,_0xe853('0x11'));_0xe3d468(_0x213f17[_0xe853('0x12')][_0xe853('0x10')]);}})[_0xe853('0x13')](function(_0x335ca3){logger[_0xe853('0xd')](_0xe853('0xf'),_0xab8d0d,_0x335ca3);_0x36d502(_0x335ca3);});});}exports[_0xe853('0x14')]=function(_0x30d868){var _0x1d2526=this;return new Promise(function(_0x459007,_0x3295cc){return db[_0xe853('0x15')][_0xe853('0x16')]({'raw':_0x30d868['options']?_0x30d868[_0xe853('0x17')][_0xe853('0x18')]===undefined?!![]:![]:!![],'where':_0x30d868[_0xe853('0x17')]?_0x30d868[_0xe853('0x17')][_0xe853('0x19')]||null:null,'attributes':_0x30d868[_0xe853('0x17')]?_0x30d868[_0xe853('0x17')][_0xe853('0x1a')]||null:null,'limit':_0x30d868[_0xe853('0x17')]?_0x30d868[_0xe853('0x17')][_0xe853('0x1b')]||null:null,'include':_0x30d868['options']?_0x30d868[_0xe853('0x17')][_0xe853('0x1c')]?_[_0xe853('0x1d')](_0x30d868[_0xe853('0x17')][_0xe853('0x1c')],function(_0xc875b2){return{'model':db[_0xc875b2[_0xe853('0x1e')]],'as':_0xc875b2['as'],'attributes':_0xc875b2[_0xe853('0x1a')],'include':_0xc875b2['include']?_[_0xe853('0x1d')](_0xc875b2[_0xe853('0x1c')],function(_0x198895){return{'model':db[_0x198895[_0xe853('0x1e')]],'as':_0x198895['as'],'attributes':_0x198895[_0xe853('0x1a')],'include':_0x198895['include']?_[_0xe853('0x1d')](_0x198895[_0xe853('0x1c')],function(_0x49d8ed){return{'model':db[_0x49d8ed[_0xe853('0x1e')]],'as':_0x49d8ed['as'],'attributes':_0x49d8ed['attributes']};}):[]};}):[]};}):[]:[]})[_0xe853('0xa')](function(_0x545738){logger['info'](_0xe853('0x14'),_0x30d868);logger[_0xe853('0x1f')](_0xe853('0x14'),_0x30d868,JSON[_0xe853('0x20')](_0x545738));_0x459007(_0x545738);})[_0xe853('0x13')](function(_0x1e99c8){logger[_0xe853('0xd')](_0xe853('0x14'),_0x1e99c8[_0xe853('0x10')],_0x30d868);_0x3295cc(_0x1d2526[_0xe853('0xd')](0x1f4,_0x1e99c8[_0xe853('0x10')]));});});};exports['ShowZohoAccount']=function(_0x139fa2){var _0x82cb01=this;return new Promise(function(_0x47cace,_0xf159f9){return db['ZohoAccount'][_0xe853('0x21')]({'raw':_0x139fa2[_0xe853('0x17')]?_0x139fa2[_0xe853('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x139fa2[_0xe853('0x17')]?_0x139fa2[_0xe853('0x17')][_0xe853('0x19')]||null:null,'attributes':_0x139fa2[_0xe853('0x17')]?_0x139fa2[_0xe853('0x17')][_0xe853('0x1a')]||null:null,'include':_0x139fa2[_0xe853('0x17')]?_0x139fa2[_0xe853('0x17')][_0xe853('0x1c')]?_[_0xe853('0x1d')](_0x139fa2[_0xe853('0x17')]['include'],function(_0x323317){return{'model':db[_0x323317['model']],'as':_0x323317['as'],'attributes':_0x323317[_0xe853('0x1a')],'include':_0x323317[_0xe853('0x1c')]?_[_0xe853('0x1d')](_0x323317[_0xe853('0x1c')],function(_0x4ee5b2){return{'model':db[_0x4ee5b2[_0xe853('0x1e')]],'as':_0x4ee5b2['as'],'attributes':_0x4ee5b2[_0xe853('0x1a')],'include':_0x4ee5b2[_0xe853('0x1c')]?_[_0xe853('0x1d')](_0x4ee5b2[_0xe853('0x1c')],function(_0xbf08f9){return{'model':db[_0xbf08f9['model']],'as':_0xbf08f9['as'],'attributes':_0xbf08f9[_0xe853('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe853('0xa')](function(_0x13bd8d){logger[_0xe853('0xb')](_0xe853('0x22'),_0x139fa2);logger[_0xe853('0x1f')](_0xe853('0x22'),_0x139fa2,JSON[_0xe853('0x20')](_0x13bd8d));_0x47cace(_0x13bd8d);})[_0xe853('0x13')](function(_0x5d9735){logger['error'](_0xe853('0x22'),_0x5d9735[_0xe853('0x10')],_0x139fa2);_0xf159f9(_0x82cb01[_0xe853('0xd')](0x1f4,_0x5d9735['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 35ed98a..3c49760 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 _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 +var _0x211d=['post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x3f43c4,_0x3e4d40){var _0x2106d3=function(_0x3518d8){while(--_0x3518d8){_0x3f43c4['push'](_0x3f43c4['shift']());}};_0x2106d3(++_0x3e4d40);}(_0x211d,0x175));var _0xd211=function(_0x376e5d,_0x2e41fe){_0x376e5d=_0x376e5d-0x0;var _0x237eb0=_0x211d[_0x376e5d];return _0x237eb0;};'use strict';var multer=require(_0xd211('0x0'));var util=require(_0xd211('0x1'));var path=require(_0xd211('0x2'));var timeout=require(_0xd211('0x3'));var express=require(_0xd211('0x4'));var router=express[_0xd211('0x5')]();var fs_extra=require(_0xd211('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd211('0x7'));var config=require(_0xd211('0x8'));var controller=require('./intZohoConfiguration.controller');router[_0xd211('0x9')]('/',auth[_0xd211('0xa')](),controller['index']);router[_0xd211('0x9')](_0xd211('0xb'),auth[_0xd211('0xa')](),controller[_0xd211('0xc')]);router[_0xd211('0x9')](_0xd211('0xd'),auth[_0xd211('0xa')](),controller[_0xd211('0xe')]);router[_0xd211('0x9')](_0xd211('0xf'),auth[_0xd211('0xa')](),controller[_0xd211('0x10')]);router[_0xd211('0x9')](_0xd211('0x11'),auth[_0xd211('0xa')](),controller['getDescriptions']);router[_0xd211('0x12')]('/',auth[_0xd211('0xa')](),controller[_0xd211('0x13')]);router[_0xd211('0x14')](_0xd211('0xb'),auth[_0xd211('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xd211('0x15')]);module[_0xd211('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index f3e62db..62f7814 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 _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 +var _0x605e=['exports','ENUM','lead','contact_lead','contact','STRING','sequelize'];(function(_0xf5bba0,_0x3494ae){var _0x56f8c7=function(_0x4e096b){while(--_0x4e096b){_0xf5bba0['push'](_0xf5bba0['shift']());}};_0x56f8c7(++_0x3494ae);}(_0x605e,0x1b8));var _0xe605=function(_0x3fe14b,_0x171900){_0x3fe14b=_0x3fe14b-0x0;var _0x15d797=_0x605e[_0x3fe14b];return _0x15d797;};'use strict';var Sequelize=require(_0xe605('0x0'));module[_0xe605('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xe605('0x2')](_0xe605('0x3'),'contact','nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xe605('0x2')](_0xe605('0x4'),_0xe605('0x5'),'lead'),'defaultValue':_0xe605('0x4')},'description':{'type':Sequelize[_0xe605('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 1ee286c..d6164ba 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 _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 +var _0xacb1=['pick','filter','merge','VIRTUAL','options','ZohoConfiguration','count','include','findAll','rows','catch','show','params','keys','rawAttributes','length','includeAll','find','create','body','destroy','getFields','ZohoField','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','apply','reject','save','update','then','error','name','index','type','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x37672c,_0x4780dd){var _0x32710a=function(_0xb72484){while(--_0xb72484){_0x37672c['push'](_0x37672c['shift']());}};_0x32710a(++_0x4780dd);}(_0xacb1,0x15a));var _0x1acb=function(_0x6739d7,_0x4e03b8){_0x6739d7=_0x6739d7-0x0;var _0x2792a3=_0xacb1[_0x6739d7];return _0x2792a3;};'use strict';var emlformat=require(_0x1acb('0x0'));var rimraf=require(_0x1acb('0x1'));var zipdir=require(_0x1acb('0x2'));var jsonpatch=require(_0x1acb('0x3'));var rp=require(_0x1acb('0x4'));var moment=require(_0x1acb('0x5'));var BPromise=require(_0x1acb('0x6'));var Mustache=require(_0x1acb('0x7'));var util=require(_0x1acb('0x8'));var path=require('path');var sox=require(_0x1acb('0x9'));var csv=require(_0x1acb('0xa'));var ejs=require(_0x1acb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1acb('0xc'));var crypto=require(_0x1acb('0xd'));var jsforce=require(_0x1acb('0xe'));var deskjs=require(_0x1acb('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1acb('0x10'));var Papa=require(_0x1acb('0x11'));var Redis=require('ioredis');var authService=require(_0x1acb('0x12'));var qs=require(_0x1acb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1acb('0x14'))(_0x1acb('0x15'));var utils=require(_0x1acb('0x16'));var config=require(_0x1acb('0x17'));var licenseUtil=require(_0x1acb('0x18'));var db=require(_0x1acb('0x19'))['db'];function respondWithStatusCode(_0xd19d67,_0x59d4e9){_0x59d4e9=_0x59d4e9||0xcc;return function(_0x397857){if(_0x397857){return _0xd19d67[_0x1acb('0x1a')](_0x59d4e9);}return _0xd19d67[_0x1acb('0x1b')](_0x59d4e9)[_0x1acb('0x1c')]();};}function respondWithResult(_0x52993f,_0x344197){_0x344197=_0x344197||0xc8;return function(_0x2db7f4){if(_0x2db7f4){return _0x52993f['status'](_0x344197)['json'](_0x2db7f4);}};}function respondWithFilteredResult(_0x185fe4,_0x44313b){return function(_0x1ce91f){if(_0x1ce91f){var _0x17b11c=typeof _0x44313b[_0x1acb('0x1d')]==='undefined'&&typeof _0x44313b['limit']==='undefined';var _0x33fc57=_0x1ce91f['count'];var _0x4a69a9=_0x17b11c?0x0:_0x44313b[_0x1acb('0x1d')];var _0x35b913=_0x17b11c?_0x1ce91f['count']:_0x44313b[_0x1acb('0x1d')]+_0x44313b[_0x1acb('0x1e')];var _0x3a2321;if(_0x35b913>=_0x33fc57){_0x35b913=_0x33fc57;_0x3a2321=0xc8;}else{_0x3a2321=0xce;}_0x185fe4[_0x1acb('0x1b')](_0x3a2321);return _0x185fe4[_0x1acb('0x1f')](_0x1acb('0x20'),_0x4a69a9+'-'+_0x35b913+'/'+_0x33fc57)['json'](_0x1ce91f);}return null;};}function patchUpdates(_0x1bdf06){return function(_0x1b85bc){try{jsonpatch[_0x1acb('0x21')](_0x1b85bc,_0x1bdf06,!![]);}catch(_0x19062c){return BPromise[_0x1acb('0x22')](_0x19062c);}return _0x1b85bc[_0x1acb('0x23')]();};}function saveUpdates(_0x5212ef,_0x516a53){return function(_0x3148a4){if(_0x3148a4){return _0x3148a4[_0x1acb('0x24')](_0x5212ef)[_0x1acb('0x25')](function(_0x57cead){return _0x57cead;});}return null;};}function removeEntity(_0x5e487d,_0x175919){return function(_0x5712c5){if(_0x5712c5){return _0x5712c5['destroy']()[_0x1acb('0x25')](function(){_0x5e487d[_0x1acb('0x1b')](0xcc)[_0x1acb('0x1c')]();});}};}function handleEntityNotFound(_0x25f2fa,_0x4c30d7){return function(_0x1b0c49){if(!_0x1b0c49){_0x25f2fa['sendStatus'](0x194);}return _0x1b0c49;};}function handleError(_0x1cb68c,_0x2aac31){_0x2aac31=_0x2aac31||0x1f4;return function(_0x1c7099){logger[_0x1acb('0x26')](_0x1c7099['stack']);if(_0x1c7099[_0x1acb('0x27')]){delete _0x1c7099['name'];}_0x1cb68c[_0x1acb('0x1b')](_0x2aac31)['send'](_0x1c7099);};}exports[_0x1acb('0x28')]=function(_0x27bae5,_0x1f21a3){var _0x52c526={},_0x4629f6={},_0xf3d3dc={'count':0x0,'rows':[]};var _0x3d429=_['map'](db['ZohoConfiguration']['rawAttributes'],function(_0x1887ac){return{'name':_0x1887ac['fieldName'],'type':_0x1887ac[_0x1acb('0x29')]['key']};});_0x4629f6[_0x1acb('0x2a')]=_[_0x1acb('0x2b')](_0x3d429,_0x1acb('0x27'));_0x4629f6[_0x1acb('0x2c')]=_['keys'](_0x27bae5[_0x1acb('0x2c')]);_0x4629f6['filters']=_[_0x1acb('0x2d')](_0x4629f6['model'],_0x4629f6[_0x1acb('0x2c')]);_0x52c526[_0x1acb('0x2e')]=_[_0x1acb('0x2d')](_0x4629f6['model'],qs[_0x1acb('0x2f')](_0x27bae5[_0x1acb('0x2c')][_0x1acb('0x2f')]));_0x52c526[_0x1acb('0x2e')]=_0x52c526[_0x1acb('0x2e')]['length']?_0x52c526[_0x1acb('0x2e')]:_0x4629f6[_0x1acb('0x2a')];if(!_0x27bae5['query'][_0x1acb('0x30')](_0x1acb('0x31'))){_0x52c526[_0x1acb('0x1e')]=qs[_0x1acb('0x1e')](_0x27bae5['query'][_0x1acb('0x1e')]);_0x52c526[_0x1acb('0x1d')]=qs[_0x1acb('0x1d')](_0x27bae5[_0x1acb('0x2c')][_0x1acb('0x1d')]);}_0x52c526[_0x1acb('0x32')]=qs[_0x1acb('0x33')](_0x27bae5[_0x1acb('0x2c')][_0x1acb('0x33')]);_0x52c526[_0x1acb('0x34')]=qs[_0x1acb('0x35')](_[_0x1acb('0x36')](_0x27bae5['query'],_0x4629f6[_0x1acb('0x35')]),_0x3d429);if(_0x27bae5['query'][_0x1acb('0x37')]){_0x52c526[_0x1acb('0x34')]=_[_0x1acb('0x38')](_0x52c526[_0x1acb('0x34')],{'$or':_[_0x1acb('0x2b')](_0x3d429,function(_0x489073){if(_0x489073[_0x1acb('0x29')]!==_0x1acb('0x39')){var _0x4ba974={};_0x4ba974[_0x489073[_0x1acb('0x27')]]={'$like':'%'+_0x27bae5[_0x1acb('0x2c')][_0x1acb('0x37')]+'%'};return _0x4ba974;}})});}_0x52c526=_['merge']({},_0x52c526,_0x27bae5[_0x1acb('0x3a')]);var _0x3d1627={'where':_0x52c526[_0x1acb('0x34')]};return db[_0x1acb('0x3b')][_0x1acb('0x3c')](_0x3d1627)[_0x1acb('0x25')](function(_0xafe169){_0xf3d3dc['count']=_0xafe169;if(_0x27bae5[_0x1acb('0x2c')]['includeAll']){_0x52c526[_0x1acb('0x3d')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x1acb('0x3e')](_0x52c526);})[_0x1acb('0x25')](function(_0x38207d){_0xf3d3dc[_0x1acb('0x3f')]=_0x38207d;return _0xf3d3dc;})[_0x1acb('0x25')](respondWithFilteredResult(_0x1f21a3,_0x52c526))[_0x1acb('0x40')](handleError(_0x1f21a3,null));};exports[_0x1acb('0x41')]=function(_0x50ae32,_0x4f809e){var _0x198e02={'raw':![],'where':{'id':_0x50ae32[_0x1acb('0x42')]['id']}},_0x471989={};_0x471989[_0x1acb('0x2a')]=_[_0x1acb('0x43')](db['ZohoConfiguration'][_0x1acb('0x44')]);_0x471989[_0x1acb('0x2c')]=_[_0x1acb('0x43')](_0x50ae32[_0x1acb('0x2c')]);_0x471989['filters']=_[_0x1acb('0x2d')](_0x471989[_0x1acb('0x2a')],_0x471989[_0x1acb('0x2c')]);_0x198e02[_0x1acb('0x2e')]=_[_0x1acb('0x2d')](_0x471989['model'],qs['fields'](_0x50ae32['query'][_0x1acb('0x2f')]));_0x198e02[_0x1acb('0x2e')]=_0x198e02[_0x1acb('0x2e')][_0x1acb('0x45')]?_0x198e02['attributes']:_0x471989[_0x1acb('0x2a')];if(_0x50ae32[_0x1acb('0x2c')][_0x1acb('0x46')]){_0x198e02[_0x1acb('0x3d')]=[{'all':!![]}];}_0x198e02=_['merge']({},_0x198e02,_0x50ae32['options']);return db[_0x1acb('0x3b')][_0x1acb('0x47')](_0x198e02)[_0x1acb('0x25')](handleEntityNotFound(_0x4f809e,null))[_0x1acb('0x25')](respondWithResult(_0x4f809e,null))[_0x1acb('0x40')](handleError(_0x4f809e,null));};exports[_0x1acb('0x48')]=function(_0x496609,_0x1854bb){return db[_0x1acb('0x3b')]['create'](_0x496609[_0x1acb('0x49')],{})[_0x1acb('0x25')](respondWithResult(_0x1854bb,0xc9))[_0x1acb('0x40')](handleError(_0x1854bb,null));};exports[_0x1acb('0x24')]=function(_0xc055f6,_0x52c648){if(_0xc055f6[_0x1acb('0x49')]['id']){delete _0xc055f6[_0x1acb('0x49')]['id'];}return db[_0x1acb('0x3b')][_0x1acb('0x47')]({'where':{'id':_0xc055f6[_0x1acb('0x42')]['id']}})['then'](handleEntityNotFound(_0x52c648,null))[_0x1acb('0x25')](saveUpdates(_0xc055f6[_0x1acb('0x49')],null))[_0x1acb('0x25')](respondWithResult(_0x52c648,null))[_0x1acb('0x40')](handleError(_0x52c648,null));};exports[_0x1acb('0x4a')]=function(_0x126c3d,_0x486184){return db[_0x1acb('0x3b')][_0x1acb('0x47')]({'where':{'id':_0x126c3d['params']['id']}})[_0x1acb('0x25')](handleEntityNotFound(_0x486184,null))[_0x1acb('0x25')](removeEntity(_0x486184,null))['catch'](handleError(_0x486184,null));};exports[_0x1acb('0x4b')]=function(_0x231c07,_0x45ae2f,_0x2823f6){var _0x310ca5={};var _0x5c50cf={};var _0x3127ee;var _0x33c671;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x231c07[_0x1acb('0x42')]['id']}})['then'](handleEntityNotFound(_0x45ae2f,null))[_0x1acb('0x25')](function(_0x222e1b){if(_0x222e1b){_0x3127ee=_0x222e1b;_0x5c50cf['model']=_[_0x1acb('0x43')](db[_0x1acb('0x4c')][_0x1acb('0x44')]);_0x5c50cf[_0x1acb('0x2c')]=_[_0x1acb('0x43')](_0x231c07[_0x1acb('0x2c')]);_0x5c50cf[_0x1acb('0x35')]=_['intersection'](_0x5c50cf[_0x1acb('0x2a')],_0x5c50cf[_0x1acb('0x2c')]);_0x310ca5[_0x1acb('0x2e')]=_[_0x1acb('0x2d')](_0x5c50cf[_0x1acb('0x2a')],qs[_0x1acb('0x2f')](_0x231c07['query']['fields']));_0x310ca5[_0x1acb('0x2e')]=_0x310ca5['attributes'][_0x1acb('0x45')]?_0x310ca5[_0x1acb('0x2e')]:_0x5c50cf[_0x1acb('0x2a')];_0x310ca5[_0x1acb('0x32')]=qs['sort'](_0x231c07['query'][_0x1acb('0x33')]);_0x310ca5[_0x1acb('0x34')]=qs[_0x1acb('0x35')](_['pick'](_0x231c07[_0x1acb('0x2c')],_0x5c50cf[_0x1acb('0x35')]));if(_0x231c07[_0x1acb('0x2c')][_0x1acb('0x37')]){_0x310ca5[_0x1acb('0x34')]=_[_0x1acb('0x38')](_0x310ca5[_0x1acb('0x34')],{'$or':_[_0x1acb('0x2b')](_0x310ca5[_0x1acb('0x2e')],function(_0x34ab87){var _0x4fa0ea={};_0x4fa0ea[_0x34ab87]={'$like':'%'+_0x231c07[_0x1acb('0x2c')][_0x1acb('0x37')]+'%'};return _0x4fa0ea;})});}_0x310ca5=_[_0x1acb('0x38')]({},_0x310ca5,_0x231c07[_0x1acb('0x3a')]);return _0x3127ee[_0x1acb('0x4b')](_0x310ca5);}})['then'](function(_0x10c5f2){if(_0x10c5f2){_0x33c671=_0x10c5f2[_0x1acb('0x45')];if(!_0x231c07[_0x1acb('0x2c')][_0x1acb('0x30')](_0x1acb('0x31'))){_0x310ca5[_0x1acb('0x1e')]=qs[_0x1acb('0x1e')](_0x231c07['query'][_0x1acb('0x1e')]);_0x310ca5[_0x1acb('0x1d')]=qs[_0x1acb('0x1d')](_0x231c07['query'][_0x1acb('0x1d')]);}return _0x3127ee[_0x1acb('0x4b')](_0x310ca5);}})[_0x1acb('0x25')](function(_0x42d1c0){if(_0x42d1c0){return _0x42d1c0?{'count':_0x33c671,'rows':_0x42d1c0}:null;}})['then'](respondWithResult(_0x45ae2f,null))[_0x1acb('0x40')](handleError(_0x45ae2f,null));};exports[_0x1acb('0x4d')]=function(_0x1283cb,_0x13d67b,_0x134108){var _0x107e27={};var _0x2a3af8={};var _0x38f5ea;var _0x3f3472;return db[_0x1acb('0x3b')][_0x1acb('0x4e')]({'where':{'id':_0x1283cb[_0x1acb('0x42')]['id']}})['then'](handleEntityNotFound(_0x13d67b,null))[_0x1acb('0x25')](function(_0x401956){if(_0x401956){_0x38f5ea=_0x401956;_0x2a3af8[_0x1acb('0x2a')]=_[_0x1acb('0x43')](db['ZohoField'][_0x1acb('0x44')]);_0x2a3af8[_0x1acb('0x2c')]=_['keys'](_0x1283cb['query']);_0x2a3af8['filters']=_[_0x1acb('0x2d')](_0x2a3af8[_0x1acb('0x2a')],_0x2a3af8[_0x1acb('0x2c')]);_0x107e27['attributes']=_[_0x1acb('0x2d')](_0x2a3af8[_0x1acb('0x2a')],qs['fields'](_0x1283cb[_0x1acb('0x2c')]['fields']));_0x107e27['attributes']=_0x107e27[_0x1acb('0x2e')][_0x1acb('0x45')]?_0x107e27['attributes']:_0x2a3af8[_0x1acb('0x2a')];_0x107e27[_0x1acb('0x32')]=qs[_0x1acb('0x33')](_0x1283cb[_0x1acb('0x2c')][_0x1acb('0x33')]);_0x107e27['where']=qs[_0x1acb('0x35')](_['pick'](_0x1283cb[_0x1acb('0x2c')],_0x2a3af8[_0x1acb('0x35')]));if(_0x1283cb[_0x1acb('0x2c')][_0x1acb('0x37')]){_0x107e27[_0x1acb('0x34')]=_[_0x1acb('0x38')](_0x107e27[_0x1acb('0x34')],{'$or':_[_0x1acb('0x2b')](_0x107e27[_0x1acb('0x2e')],function(_0x533cb4){var _0x4ebce7={};_0x4ebce7[_0x533cb4]={'$like':'%'+_0x1283cb[_0x1acb('0x2c')][_0x1acb('0x37')]+'%'};return _0x4ebce7;})});}_0x107e27=_[_0x1acb('0x38')]({},_0x107e27,_0x1283cb[_0x1acb('0x3a')]);return _0x38f5ea[_0x1acb('0x4d')](_0x107e27);}})[_0x1acb('0x25')](function(_0x43a702){if(_0x43a702){_0x3f3472=_0x43a702[_0x1acb('0x45')];if(!_0x1283cb['query']['hasOwnProperty']('nolimit')){_0x107e27['limit']=qs[_0x1acb('0x1e')](_0x1283cb[_0x1acb('0x2c')][_0x1acb('0x1e')]);_0x107e27[_0x1acb('0x1d')]=qs['offset'](_0x1283cb[_0x1acb('0x2c')][_0x1acb('0x1d')]);}return _0x38f5ea[_0x1acb('0x4d')](_0x107e27);}})[_0x1acb('0x25')](function(_0x4d3e3f){if(_0x4d3e3f){return _0x4d3e3f?{'count':_0x3f3472,'rows':_0x4d3e3f}:null;}})[_0x1acb('0x25')](respondWithResult(_0x13d67b,null))[_0x1acb('0x40')](handleError(_0x13d67b,null));};exports['getDescriptions']=function(_0x30829a,_0x4d5e1b,_0x2cc2cd){var _0x587793={};var _0x38276d={};var _0x1b75e5;var _0x2adb57;return db['ZohoConfiguration'][_0x1acb('0x4e')]({'where':{'id':_0x30829a[_0x1acb('0x42')]['id']}})[_0x1acb('0x25')](handleEntityNotFound(_0x4d5e1b,null))[_0x1acb('0x25')](function(_0x519ddc){if(_0x519ddc){_0x1b75e5=_0x519ddc;_0x38276d['model']=_[_0x1acb('0x43')](db[_0x1acb('0x4c')]['rawAttributes']);_0x38276d[_0x1acb('0x2c')]=_[_0x1acb('0x43')](_0x30829a[_0x1acb('0x2c')]);_0x38276d[_0x1acb('0x35')]=_[_0x1acb('0x2d')](_0x38276d[_0x1acb('0x2a')],_0x38276d[_0x1acb('0x2c')]);_0x587793[_0x1acb('0x2e')]=_[_0x1acb('0x2d')](_0x38276d[_0x1acb('0x2a')],qs[_0x1acb('0x2f')](_0x30829a[_0x1acb('0x2c')][_0x1acb('0x2f')]));_0x587793[_0x1acb('0x2e')]=_0x587793[_0x1acb('0x2e')][_0x1acb('0x45')]?_0x587793[_0x1acb('0x2e')]:_0x38276d['model'];_0x587793[_0x1acb('0x32')]=qs[_0x1acb('0x33')](_0x30829a[_0x1acb('0x2c')]['sort']);_0x587793[_0x1acb('0x34')]=qs[_0x1acb('0x35')](_[_0x1acb('0x36')](_0x30829a[_0x1acb('0x2c')],_0x38276d[_0x1acb('0x35')]));if(_0x30829a[_0x1acb('0x2c')][_0x1acb('0x37')]){_0x587793[_0x1acb('0x34')]=_[_0x1acb('0x38')](_0x587793['where'],{'$or':_[_0x1acb('0x2b')](_0x587793[_0x1acb('0x2e')],function(_0x4654b3){var _0x1d3d2a={};_0x1d3d2a[_0x4654b3]={'$like':'%'+_0x30829a[_0x1acb('0x2c')]['filter']+'%'};return _0x1d3d2a;})});}_0x587793=_[_0x1acb('0x38')]({},_0x587793,_0x30829a['options']);return _0x1b75e5[_0x1acb('0x4f')](_0x587793);}})[_0x1acb('0x25')](function(_0x4e9845){if(_0x4e9845){_0x2adb57=_0x4e9845[_0x1acb('0x45')];if(!_0x30829a[_0x1acb('0x2c')][_0x1acb('0x30')](_0x1acb('0x31'))){_0x587793['limit']=qs[_0x1acb('0x1e')](_0x30829a['query'][_0x1acb('0x1e')]);_0x587793[_0x1acb('0x1d')]=qs[_0x1acb('0x1d')](_0x30829a[_0x1acb('0x2c')][_0x1acb('0x1d')]);}return _0x1b75e5[_0x1acb('0x4f')](_0x587793);}})[_0x1acb('0x25')](function(_0x1f6696){if(_0x1f6696){return _0x1f6696?{'count':_0x2adb57,'rows':_0x1f6696}:null;}})['then'](respondWithResult(_0x4d5e1b,null))['catch'](handleError(_0x4d5e1b,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 55b2ce6..fad9c2b 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 _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 +var _0x5dba=['moment','path','rimraf','exports','define','int_zoho_configurations','lodash','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5dba,0x1da));var _0xa5db=function(_0x24d92a,_0x5dcc4d){_0x24d92a=_0x24d92a-0x0;var _0x2d5aed=_0x5dba[_0x24d92a];return _0x2d5aed;};'use strict';var _=require(_0xa5db('0x0'));var util=require('util');var logger=require(_0xa5db('0x1'))(_0xa5db('0x2'));var moment=require(_0xa5db('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa5db('0x4'));var rimraf=require(_0xa5db('0x5'));var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0xa5db('0x6')]=function(_0x3a9a66,_0xdd0d39){return _0x3a9a66[_0xa5db('0x7')]('ZohoConfiguration',attributes,{'tableName':_0xa5db('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 17c6c39..0d442b5 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 _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 +var _0xb7a4=['bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util'];(function(_0x20a089,_0x158776){var _0x4521e9=function(_0x5b1728){while(--_0x5b1728){_0x20a089['push'](_0x20a089['shift']());}};_0x4521e9(++_0x158776);}(_0xb7a4,0xfd));var _0x4b7a=function(_0x16decb,_0x57d16f){_0x16decb=_0x16decb-0x0;var _0x3277da=_0xb7a4[_0x16decb];return _0x3277da;};'use strict';var _=require(_0x4b7a('0x0'));var util=require(_0x4b7a('0x1'));var moment=require('moment');var BPromise=require(_0x4b7a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4b7a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4b7a('0x4'))('rpc');var config=require(_0x4b7a('0x5'));var jayson=require(_0x4b7a('0x6'));var client=jayson[_0x4b7a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11ac9f,_0x397119,_0x3fbfde){return new BPromise(function(_0x4b41d1,_0x3cacb4){return client[_0x4b7a('0x8')](_0x11ac9f,_0x3fbfde)['then'](function(_0x201013){logger[_0x4b7a('0x9')](_0x4b7a('0xa'),_0x397119,_0x4b7a('0xb'));logger[_0x4b7a('0xc')](_0x4b7a('0xd'),_0x397119,_0x4b7a('0xb'),JSON['stringify'](_0x201013));if(_0x201013[_0x4b7a('0xe')]){if(_0x201013['error']['code']===0x1f4){logger[_0x4b7a('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x397119,_0x201013[_0x4b7a('0xe')][_0x4b7a('0xf')]);return _0x3cacb4(_0x201013[_0x4b7a('0xe')][_0x4b7a('0xf')]);}logger[_0x4b7a('0xe')](_0x4b7a('0xa'),_0x397119,_0x201013['error'][_0x4b7a('0xf')]);return _0x4b41d1(_0x201013[_0x4b7a('0xe')][_0x4b7a('0xf')]);}else{logger[_0x4b7a('0x9')](_0x4b7a('0xa'),_0x397119,_0x4b7a('0xb'));_0x4b41d1(_0x201013['result'][_0x4b7a('0xf')]);}})[_0x4b7a('0x10')](function(_0x2d6c04){logger['error'](_0x4b7a('0xa'),_0x397119,_0x2d6c04);_0x3cacb4(_0x2d6c04);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index aab5d60..a86c2a3 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 _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 +var _0x922c=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer'];(function(_0x120376,_0x571898){var _0x28c529=function(_0x4f130c){while(--_0x4f130c){_0x120376['push'](_0x120376['shift']());}};_0x28c529(++_0x571898);}(_0x922c,0x11c));var _0xc922=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x922c[_0x2080a3];return _0x8d7d17;};'use strict';var multer=require(_0xc922('0x0'));var util=require('util');var path=require(_0xc922('0x1'));var timeout=require('connect-timeout');var express=require(_0xc922('0x2'));var router=express[_0xc922('0x3')]();var fs_extra=require(_0xc922('0x4'));var auth=require(_0xc922('0x5'));var interaction=require(_0xc922('0x6'));var config=require(_0xc922('0x7'));var controller=require(_0xc922('0x8'));router[_0xc922('0x9')]('/',auth[_0xc922('0xa')](),controller[_0xc922('0xb')]);router[_0xc922('0x9')](_0xc922('0xc'),auth[_0xc922('0xa')](),controller[_0xc922('0xd')]);router[_0xc922('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc922('0xf')](_0xc922('0xc'),auth[_0xc922('0xa')](),controller[_0xc922('0x10')]);router[_0xc922('0x11')](_0xc922('0xc'),auth[_0xc922('0xa')](),controller[_0xc922('0x12')]);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 f56479d..c05ede8 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 _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 +var _0x0a46=['picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x4924ae,_0x1dd735){var _0x2238e4=function(_0x48dc88){while(--_0x48dc88){_0x4924ae['push'](_0x4924ae['shift']());}};_0x2238e4(++_0x1dd735);}(_0x0a46,0xa4));var _0x60a4=function(_0x4410b7,_0x1523af){_0x4410b7=_0x4410b7-0x0;var _0x31e4f0=_0x0a46[_0x4410b7];return _0x31e4f0;};'use strict';var Sequelize=require(_0x60a4('0x0'));module[_0x60a4('0x1')]={'type':{'type':Sequelize[_0x60a4('0x2')](_0x60a4('0x3'),_0x60a4('0x4'),_0x60a4('0x5'),_0x60a4('0x6'),_0x60a4('0x7')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x60a4('0x8')]},'keyType':{'type':Sequelize[_0x60a4('0x2')]('string',_0x60a4('0x4'),_0x60a4('0x5'))},'keyContent':{'type':Sequelize[_0x60a4('0x8')]},'idField':{'type':Sequelize[_0x60a4('0x8')]},'nameField':{'type':Sequelize[_0x60a4('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x60a4('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 8399f5d..d63cac3 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 _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 +var _0xfbf7=['set','Content-Range','json','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','map','ZohoField','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','length','include','find','create','body','params','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit'];(function(_0x42f919,_0x37c612){var _0x3d5250=function(_0x21547f){while(--_0x21547f){_0x42f919['push'](_0x42f919['shift']());}};_0x3d5250(++_0x37c612);}(_0xfbf7,0x113));var _0x7fbf=function(_0x49d375,_0x36f3fc){_0x49d375=_0x49d375-0x0;var _0x5d0289=_0xfbf7[_0x49d375];return _0x5d0289;};'use strict';var emlformat=require(_0x7fbf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7fbf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7fbf('0x2'));var moment=require(_0x7fbf('0x3'));var BPromise=require(_0x7fbf('0x4'));var Mustache=require(_0x7fbf('0x5'));var util=require(_0x7fbf('0x6'));var path=require(_0x7fbf('0x7'));var sox=require(_0x7fbf('0x8'));var csv=require(_0x7fbf('0x9'));var ejs=require(_0x7fbf('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7fbf('0xb'));var squel=require(_0x7fbf('0xc'));var crypto=require(_0x7fbf('0xd'));var jsforce=require(_0x7fbf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7fbf('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7fbf('0xf'));var authService=require(_0x7fbf('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7fbf('0x11'));var hardwareService=require(_0x7fbf('0x12'));var logger=require('../../config/logger')(_0x7fbf('0x13'));var utils=require(_0x7fbf('0x14'));var config=require(_0x7fbf('0x15'));var licenseUtil=require(_0x7fbf('0x16'));var db=require(_0x7fbf('0x17'))['db'];function respondWithStatusCode(_0x42f11b,_0xb52843){_0xb52843=_0xb52843||0xcc;return function(_0x1adf53){if(_0x1adf53){return _0x42f11b['sendStatus'](_0xb52843);}return _0x42f11b[_0x7fbf('0x18')](_0xb52843)['end']();};}function respondWithResult(_0x2d52b4,_0x554684){_0x554684=_0x554684||0xc8;return function(_0x48fe44){if(_0x48fe44){return _0x2d52b4['status'](_0x554684)['json'](_0x48fe44);}};}function respondWithFilteredResult(_0x4fd0ff,_0xff3af9){return function(_0x20acca){if(_0x20acca){var _0x81a575=typeof _0xff3af9[_0x7fbf('0x19')]===_0x7fbf('0x1a')&&typeof _0xff3af9['limit']===_0x7fbf('0x1a');var _0x58ffdc=_0x20acca['count'];var _0x132160=_0x81a575?0x0:_0xff3af9[_0x7fbf('0x19')];var _0x4b1a61=_0x81a575?_0x20acca[_0x7fbf('0x1b')]:_0xff3af9[_0x7fbf('0x19')]+_0xff3af9[_0x7fbf('0x1c')];var _0x9f3c60;if(_0x4b1a61>=_0x58ffdc){_0x4b1a61=_0x58ffdc;_0x9f3c60=0xc8;}else{_0x9f3c60=0xce;}_0x4fd0ff[_0x7fbf('0x18')](_0x9f3c60);return _0x4fd0ff[_0x7fbf('0x1d')](_0x7fbf('0x1e'),_0x132160+'-'+_0x4b1a61+'/'+_0x58ffdc)[_0x7fbf('0x1f')](_0x20acca);}return null;};}function patchUpdates(_0x5865d3){return function(_0x25d73b){try{jsonpatch[_0x7fbf('0x20')](_0x25d73b,_0x5865d3,!![]);}catch(_0x429eaf){return BPromise[_0x7fbf('0x21')](_0x429eaf);}return _0x25d73b[_0x7fbf('0x22')]();};}function saveUpdates(_0x47bc19,_0x15ed37){return function(_0x42b8d6){if(_0x42b8d6){return _0x42b8d6[_0x7fbf('0x23')](_0x47bc19)[_0x7fbf('0x24')](function(_0x469876){return _0x469876;});}return null;};}function removeEntity(_0x351690,_0x436ea0){return function(_0x44ce6e){if(_0x44ce6e){return _0x44ce6e[_0x7fbf('0x25')]()['then'](function(){_0x351690[_0x7fbf('0x18')](0xcc)[_0x7fbf('0x26')]();});}};}function handleEntityNotFound(_0x3089c4,_0x1d88d2){return function(_0x1eece1){if(!_0x1eece1){_0x3089c4[_0x7fbf('0x27')](0x194);}return _0x1eece1;};}function handleError(_0x3c7b48,_0x6b58bb){_0x6b58bb=_0x6b58bb||0x1f4;return function(_0x451809){logger[_0x7fbf('0x28')](_0x451809[_0x7fbf('0x29')]);if(_0x451809[_0x7fbf('0x2a')]){delete _0x451809[_0x7fbf('0x2a')];}_0x3c7b48[_0x7fbf('0x18')](_0x6b58bb)[_0x7fbf('0x2b')](_0x451809);};}exports['index']=function(_0x3ba867,_0x5eeb55){var _0x2565b4={},_0x5d46cf={},_0x221cc7={'count':0x0,'rows':[]};var _0x5988f5=_[_0x7fbf('0x2c')](db[_0x7fbf('0x2d')][_0x7fbf('0x2e')],function(_0x2ac154){return{'name':_0x2ac154[_0x7fbf('0x2f')],'type':_0x2ac154['type'][_0x7fbf('0x30')]};});_0x5d46cf['model']=_[_0x7fbf('0x2c')](_0x5988f5,_0x7fbf('0x2a'));_0x5d46cf[_0x7fbf('0x31')]=_[_0x7fbf('0x32')](_0x3ba867[_0x7fbf('0x31')]);_0x5d46cf[_0x7fbf('0x33')]=_['intersection'](_0x5d46cf[_0x7fbf('0x34')],_0x5d46cf[_0x7fbf('0x31')]);_0x2565b4[_0x7fbf('0x35')]=_[_0x7fbf('0x36')](_0x5d46cf[_0x7fbf('0x34')],qs[_0x7fbf('0x37')](_0x3ba867[_0x7fbf('0x31')]['fields']));_0x2565b4['attributes']=_0x2565b4[_0x7fbf('0x35')]['length']?_0x2565b4[_0x7fbf('0x35')]:_0x5d46cf[_0x7fbf('0x34')];if(!_0x3ba867[_0x7fbf('0x31')][_0x7fbf('0x38')]('nolimit')){_0x2565b4[_0x7fbf('0x1c')]=qs[_0x7fbf('0x1c')](_0x3ba867[_0x7fbf('0x31')][_0x7fbf('0x1c')]);_0x2565b4['offset']=qs['offset'](_0x3ba867[_0x7fbf('0x31')][_0x7fbf('0x19')]);}_0x2565b4['order']=qs[_0x7fbf('0x39')](_0x3ba867['query'][_0x7fbf('0x39')]);_0x2565b4[_0x7fbf('0x3a')]=qs[_0x7fbf('0x33')](_[_0x7fbf('0x3b')](_0x3ba867[_0x7fbf('0x31')],_0x5d46cf[_0x7fbf('0x33')]),_0x5988f5);if(_0x3ba867[_0x7fbf('0x31')][_0x7fbf('0x3c')]){_0x2565b4['where']=_[_0x7fbf('0x3d')](_0x2565b4[_0x7fbf('0x3a')],{'$or':_['map'](_0x5988f5,function(_0x422193){if(_0x422193[_0x7fbf('0x3e')]!==_0x7fbf('0x3f')){var _0x111e67={};_0x111e67[_0x422193[_0x7fbf('0x2a')]]={'$like':'%'+_0x3ba867[_0x7fbf('0x31')][_0x7fbf('0x3c')]+'%'};return _0x111e67;}})});}_0x2565b4=_[_0x7fbf('0x3d')]({},_0x2565b4,_0x3ba867[_0x7fbf('0x40')]);var _0x1923d2={'where':_0x2565b4[_0x7fbf('0x3a')]};return db[_0x7fbf('0x2d')][_0x7fbf('0x1b')](_0x1923d2)[_0x7fbf('0x24')](function(_0x150f10){_0x221cc7[_0x7fbf('0x1b')]=_0x150f10;if(_0x3ba867[_0x7fbf('0x31')][_0x7fbf('0x41')]){_0x2565b4['include']=[{'all':!![]}];}return db['ZohoField'][_0x7fbf('0x42')](_0x2565b4);})[_0x7fbf('0x24')](function(_0x2ab52a){_0x221cc7[_0x7fbf('0x43')]=_0x2ab52a;return _0x221cc7;})['then'](respondWithFilteredResult(_0x5eeb55,_0x2565b4))[_0x7fbf('0x44')](handleError(_0x5eeb55,null));};exports[_0x7fbf('0x45')]=function(_0x40102b,_0x27675c){var _0x44e0c9={'raw':!![],'where':{'id':_0x40102b['params']['id']}},_0x1c8c99={};_0x1c8c99[_0x7fbf('0x34')]=_[_0x7fbf('0x32')](db[_0x7fbf('0x2d')][_0x7fbf('0x2e')]);_0x1c8c99[_0x7fbf('0x31')]=_[_0x7fbf('0x32')](_0x40102b[_0x7fbf('0x31')]);_0x1c8c99['filters']=_[_0x7fbf('0x36')](_0x1c8c99[_0x7fbf('0x34')],_0x1c8c99[_0x7fbf('0x31')]);_0x44e0c9['attributes']=_[_0x7fbf('0x36')](_0x1c8c99[_0x7fbf('0x34')],qs[_0x7fbf('0x37')](_0x40102b[_0x7fbf('0x31')][_0x7fbf('0x37')]));_0x44e0c9[_0x7fbf('0x35')]=_0x44e0c9[_0x7fbf('0x35')][_0x7fbf('0x46')]?_0x44e0c9['attributes']:_0x1c8c99[_0x7fbf('0x34')];if(_0x40102b[_0x7fbf('0x31')]['includeAll']){_0x44e0c9[_0x7fbf('0x47')]=[{'all':!![]}];}_0x44e0c9=_[_0x7fbf('0x3d')]({},_0x44e0c9,_0x40102b['options']);return db[_0x7fbf('0x2d')][_0x7fbf('0x48')](_0x44e0c9)[_0x7fbf('0x24')](handleEntityNotFound(_0x27675c,null))[_0x7fbf('0x24')](respondWithResult(_0x27675c,null))[_0x7fbf('0x44')](handleError(_0x27675c,null));};exports['create']=function(_0x3ad66b,_0xd2af2e){return db['ZohoField'][_0x7fbf('0x49')](_0x3ad66b[_0x7fbf('0x4a')],{})[_0x7fbf('0x24')](respondWithResult(_0xd2af2e,0xc9))[_0x7fbf('0x44')](handleError(_0xd2af2e,null));};exports[_0x7fbf('0x23')]=function(_0x333ad6,_0x38a5ba){if(_0x333ad6[_0x7fbf('0x4a')]['id']){delete _0x333ad6[_0x7fbf('0x4a')]['id'];}return db['ZohoField'][_0x7fbf('0x48')]({'where':{'id':_0x333ad6[_0x7fbf('0x4b')]['id']}})[_0x7fbf('0x24')](handleEntityNotFound(_0x38a5ba,null))[_0x7fbf('0x24')](saveUpdates(_0x333ad6['body'],null))['then'](respondWithResult(_0x38a5ba,null))['catch'](handleError(_0x38a5ba,null));};exports['destroy']=function(_0x231ecb,_0x13a4cb){return db[_0x7fbf('0x2d')][_0x7fbf('0x48')]({'where':{'id':_0x231ecb[_0x7fbf('0x4b')]['id']}})[_0x7fbf('0x24')](handleEntityNotFound(_0x13a4cb,null))[_0x7fbf('0x24')](removeEntity(_0x13a4cb,null))[_0x7fbf('0x44')](handleError(_0x13a4cb,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index dd4b403..239e916 100644 --- a/server/api/intZohoField/intZohoField.model.js +++ b/server/api/intZohoField/intZohoField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x90b1=['FieldId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','define','ZohoField','int_zoho_fields','zoho_unique_index','idField'];(function(_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 +var _0x958a=['moment','bluebird','request-promise','path','../../config/environment','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','lodash','util','api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x958a,0x128));var _0xa958=function(_0x134521,_0x4ea0e7){_0x134521=_0x134521-0x0;var _0x10917c=_0x958a[_0x134521];return _0x10917c;};'use strict';var _=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var logger=require('../../config/logger')(_0xa958('0x2'));var moment=require(_0xa958('0x3'));var BPromise=require(_0xa958('0x4'));var rp=require(_0xa958('0x5'));var fs=require('fs');var path=require(_0xa958('0x6'));var rimraf=require('rimraf');var config=require(_0xa958('0x7'));var attributes=require('./intZohoField.attributes');module[_0xa958('0x8')]=function(_0x9b7d9e,_0x2692d6){return _0x9b7d9e[_0xa958('0x9')](_0xa958('0xa'),attributes,{'tableName':_0xa958('0xb'),'paranoid':![],'indexes':[{'name':_0xa958('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 9ae997d..203d188 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 _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 +var _0x5dce=['ZohoField,\x20%s,\x20%s','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5dce,0x1bf));var _0xe5dc=function(_0x20534c,_0xe46275){_0x20534c=_0x20534c-0x0;var _0x1925cc=_0x5dce[_0x20534c];return _0x1925cc;};'use strict';var _=require(_0xe5dc('0x0'));var util=require(_0xe5dc('0x1'));var moment=require(_0xe5dc('0x2'));var BPromise=require('bluebird');var rs=require(_0xe5dc('0x3'));var fs=require('fs');var Redis=require(_0xe5dc('0x4'));var db=require(_0xe5dc('0x5'))['db'];var utils=require(_0xe5dc('0x6'));var logger=require('../../config/logger')(_0xe5dc('0x7'));var config=require(_0xe5dc('0x8'));var jayson=require(_0xe5dc('0x9'));var client=jayson[_0xe5dc('0xa')][_0xe5dc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12d934,_0x51fae6,_0x587ee2){return new BPromise(function(_0x14a18c,_0x841a14){return client[_0xe5dc('0xc')](_0x12d934,_0x587ee2)['then'](function(_0x57b855){logger['info'](_0xe5dc('0xd'),_0x51fae6,'request\x20sent');logger['debug'](_0xe5dc('0xe'),_0x51fae6,'request\x20sent',JSON[_0xe5dc('0xf')](_0x57b855));if(_0x57b855[_0xe5dc('0x10')]){if(_0x57b855['error'][_0xe5dc('0x11')]===0x1f4){logger['error'](_0xe5dc('0xd'),_0x51fae6,_0x57b855['error'][_0xe5dc('0x12')]);return _0x841a14(_0x57b855['error'][_0xe5dc('0x12')]);}logger['error'](_0xe5dc('0xd'),_0x51fae6,_0x57b855[_0xe5dc('0x10')][_0xe5dc('0x12')]);return _0x14a18c(_0x57b855['error'][_0xe5dc('0x12')]);}else{logger[_0xe5dc('0x13')]('ZohoField,\x20%s,\x20%s',_0x51fae6,_0xe5dc('0x14'));_0x14a18c(_0x57b855[_0xe5dc('0x15')]['message']);}})[_0xe5dc('0x16')](function(_0x43b58c){logger[_0xe5dc('0x10')](_0xe5dc('0xd'),_0x51fae6,_0x43b58c);_0x841a14(_0x43b58c);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 0042955..3d6d75b 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 _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 +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x48987a,_0x4cfc6d){var _0xb2d155=function(_0x47b872){while(--_0x47b872){_0x48987a['push'](_0x48987a['shift']());}};_0xb2d155(++_0x4cfc6d);}(_0xe706,0xa3));var _0x6e70=function(_0x1c2051,_0x4cb6b9){_0x1c2051=_0x1c2051-0x0;var _0x2b58a0=_0xe706[_0x1c2051];return _0x2b58a0;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index c453075..712109c 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 _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 +var _0xca79=['STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','exports'];(function(_0x3a18f3,_0xa6b079){var _0x431120=function(_0x3ce96e){while(--_0x3ce96e){_0x3a18f3['push'](_0x3a18f3['shift']());}};_0x431120(++_0xa6b079);}(_0xca79,0x1a9));var _0x9ca7=function(_0x3514da,_0x533609){_0x3514da=_0x3514da-0x0;var _0xb5f3b9=_0xca79[_0x3514da];return _0xb5f3b9;};'use strict';var Sequelize=require('sequelize');module[_0x9ca7('0x0')]={'name':{'type':Sequelize[_0x9ca7('0x1')],'allowNull':![],'unique':_0x9ca7('0x2')},'version':{'type':Sequelize[_0x9ca7('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x9ca7('0x1')],'defaultValue':_0x9ca7('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x9ca7('0x1')]},'type':{'type':Sequelize[_0x9ca7('0x1')]},'size':{'type':Sequelize[_0x9ca7('0x4')]},'active':{'type':Sequelize[_0x9ca7('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x9ca7('0x1')]},'logo':{'type':Sequelize[_0x9ca7('0x1')]},'state':{'type':Sequelize[_0x9ca7('0x1')],'unique':'state'},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x9ca7('0x1')]},'remoteUri':{'type':Sequelize[_0x9ca7('0x1')]},'link':{'type':Sequelize[_0x9ca7('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 2b4088f..14f3771 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 _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 +var _0xc4aa=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','Integration','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xc4aa[_0x5f09c5];return _0x426ad9;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=typeof _0x11e101[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x11e101[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x3e88e3=_0x26dbb8[_0xac4a('0x1e')];var _0x28e304=_0x4a2119?0x0:_0x11e101[_0xac4a('0x1b')];var _0x546c5d=_0x4a2119?_0x26dbb8['count']:_0x11e101[_0xac4a('0x1b')]+_0x11e101[_0xac4a('0x1d')];var _0x39b691;if(_0x546c5d>=_0x3e88e3){_0x546c5d=_0x3e88e3;_0x39b691=0xc8;}else{_0x39b691=0xce;}_0x42c7fc['status'](_0x39b691);return _0x42c7fc[_0xac4a('0x1f')](_0xac4a('0x20'),_0x28e304+'-'+_0x546c5d+'/'+_0x3e88e3)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x3a3cdb){return function(_0x123694){try{jsonpatch[_0xac4a('0x21')](_0x123694,_0x3a3cdb,!![]);}catch(_0xe38996){return BPromise[_0xac4a('0x22')](_0xe38996);}return _0x123694['save']();};}function saveUpdates(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x23')](_0x3d8f0a)[_0xac4a('0x24')](function(_0x3eacd3){return _0x3eacd3;});}return null;};}function removeEntity(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(_0x1b7998){return _0x1b7998[_0xac4a('0x25')]()[_0xac4a('0x24')](function(){_0x947d8e[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x2b0dc2,_0x222507){return function(_0x36054a){if(!_0x36054a){_0x2b0dc2[_0xac4a('0x17')](0x194);}return _0x36054a;};}function handleError(_0x3bc318,_0x1d0539){_0x1d0539=_0x1d0539||0x1f4;return function(_0x215a31){logger[_0xac4a('0x26')](_0x215a31[_0xac4a('0x27')]);if(_0x215a31[_0xac4a('0x28')]){delete _0x215a31[_0xac4a('0x28')];}_0x3bc318['status'](_0x1d0539)[_0xac4a('0x29')](_0x215a31);};}exports[_0xac4a('0x2a')]=function(_0x42a33c,_0x2772fe){var _0x116700={},_0x4a5a9e={},_0x47f49c={'count':0x0,'rows':[]};var _0xdb7e=_[_0xac4a('0x2b')](db[_0xac4a('0x2c')]['rawAttributes'],function(_0x4bda1f){return{'name':_0x4bda1f[_0xac4a('0x2d')],'type':_0x4bda1f[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x4a5a9e[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0xdb7e,'name');_0x4a5a9e[_0xac4a('0x31')]=_['keys'](_0x42a33c[_0xac4a('0x31')]);_0x4a5a9e['filters']=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],_0x4a5a9e[_0xac4a('0x31')]);_0x116700[_0xac4a('0x33')]=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x34')]));_0x116700[_0xac4a('0x33')]=_0x116700[_0xac4a('0x33')][_0xac4a('0x35')]?_0x116700[_0xac4a('0x33')]:_0x4a5a9e[_0xac4a('0x30')];if(!_0x42a33c['query'][_0xac4a('0x36')](_0xac4a('0x37'))){_0x116700['limit']=qs[_0xac4a('0x1d')](_0x42a33c[_0xac4a('0x31')]['limit']);_0x116700['offset']=qs[_0xac4a('0x1b')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x1b')]);}_0x116700[_0xac4a('0x38')]=qs['sort'](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x39')]);_0x116700['where']=qs[_0xac4a('0x3a')](_[_0xac4a('0x3b')](_0x42a33c[_0xac4a('0x31')],_0x4a5a9e['filters']),_0xdb7e);if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x3c')]){_0x116700[_0xac4a('0x3d')]=_['merge'](_0x116700[_0xac4a('0x3d')],{'$or':_[_0xac4a('0x2b')](_0xdb7e,function(_0x4b9faf){if(_0x4b9faf['type']!==_0xac4a('0x3e')){var _0x5e0926={};_0x5e0926[_0x4b9faf['name']]={'$like':'%'+_0x42a33c['query']['filter']+'%'};return _0x5e0926;}})});}_0x116700=_[_0xac4a('0x3f')]({},_0x116700,_0x42a33c[_0xac4a('0x40')]);var _0x37834b={'where':_0x116700[_0xac4a('0x3d')]};return db[_0xac4a('0x2c')][_0xac4a('0x1e')](_0x37834b)[_0xac4a('0x24')](function(_0x2b16f0){_0x47f49c[_0xac4a('0x1e')]=_0x2b16f0;if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x41')]){_0x116700[_0xac4a('0x42')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x116700);})['then'](function(_0x1e1cc5){_0x47f49c[_0xac4a('0x43')]=_0x1e1cc5;return _0x47f49c;})[_0xac4a('0x24')](respondWithFilteredResult(_0x2772fe,_0x116700))[_0xac4a('0x44')](handleError(_0x2772fe,null));};exports[_0xac4a('0x45')]=function(_0x411543,_0x8febf0){var _0x3441f2={'raw':![],'where':{'id':_0x411543[_0xac4a('0x46')]['id']}},_0x3e9973={};_0x3e9973['model']=_[_0xac4a('0x47')](db[_0xac4a('0x2c')][_0xac4a('0x48')]);_0x3e9973[_0xac4a('0x31')]=_[_0xac4a('0x47')](_0x411543['query']);_0x3e9973[_0xac4a('0x3a')]=_[_0xac4a('0x32')](_0x3e9973['model'],_0x3e9973[_0xac4a('0x31')]);_0x3441f2['attributes']=_[_0xac4a('0x32')](_0x3e9973[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x411543[_0xac4a('0x31')][_0xac4a('0x34')]));_0x3441f2[_0xac4a('0x33')]=_0x3441f2[_0xac4a('0x33')][_0xac4a('0x35')]?_0x3441f2[_0xac4a('0x33')]:_0x3e9973[_0xac4a('0x30')];if(_0x411543[_0xac4a('0x31')][_0xac4a('0x41')]){_0x3441f2['include']=[{'all':!![]}];}_0x3441f2=_[_0xac4a('0x3f')]({},_0x3441f2,_0x411543[_0xac4a('0x40')]);return db[_0xac4a('0x2c')]['find'](_0x3441f2)[_0xac4a('0x24')](handleEntityNotFound(_0x8febf0,null))[_0xac4a('0x24')](respondWithResult(_0x8febf0,null))['catch'](handleError(_0x8febf0,null));};exports[_0xac4a('0x49')]=function(_0x5a7f6e,_0x244950){return db[_0xac4a('0x2c')][_0xac4a('0x49')](_0x5a7f6e['body'],{})['then'](respondWithResult(_0x244950,0xc9))[_0xac4a('0x44')](handleError(_0x244950,null));};exports['update']=function(_0x18ae96,_0x566258){if(_0x18ae96[_0xac4a('0x4a')]['id']){delete _0x18ae96['body']['id'];}return db[_0xac4a('0x2c')][_0xac4a('0x4b')]({'where':{'id':_0x18ae96[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x566258,null))['then'](saveUpdates(_0x18ae96[_0xac4a('0x4a')],null))[_0xac4a('0x24')](respondWithResult(_0x566258,null))[_0xac4a('0x44')](handleError(_0x566258,null));};exports[_0xac4a('0x25')]=function(_0x2f30e2,_0x138876){return db[_0xac4a('0x2c')]['find']({'where':{'id':_0x2f30e2[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x138876,null))['then'](removeEntity(_0x138876,null))[_0xac4a('0x44')](handleError(_0x138876,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 589c2b6..8a4a96b 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 _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 +var _0x4205=['api','moment','bluebird','rimraf','../../config/environment','./integration.attributes','exports','Integration','lodash','../../config/logger'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x4205,0x1de));var _0x5420=function(_0x539acb,_0x5e89f1){_0x539acb=_0x539acb-0x0;var _0x5c98b6=_0x4205[_0x539acb];return _0x5c98b6;};'use strict';var _=require(_0x5420('0x0'));var util=require('util');var logger=require(_0x5420('0x1'))(_0x5420('0x2'));var moment=require(_0x5420('0x3'));var BPromise=require(_0x5420('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5420('0x5'));var config=require(_0x5420('0x6'));var attributes=require(_0x5420('0x7'));module[_0x5420('0x8')]=function(_0x36ef18,_0x496868){return _0x36ef18['define'](_0x5420('0x9'),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 54a3780..6e9ddce 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 _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 +var _0x955f=['Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http','request','then','info'];(function(_0x9664b9,_0x51d10e){var _0x420c36=function(_0x131a18){while(--_0x131a18){_0x9664b9['push'](_0x9664b9['shift']());}};_0x420c36(++_0x51d10e);}(_0x955f,0x1eb));var _0xf955=function(_0x2ffcf3,_0x38f289){_0x2ffcf3=_0x2ffcf3-0x0;var _0x38a806=_0x955f[_0x2ffcf3];return _0x38a806;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var moment=require(_0xf955('0x2'));var BPromise=require(_0xf955('0x3'));var rs=require(_0xf955('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf955('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf955('0x6'));var config=require('../../config/environment');var jayson=require(_0xf955('0x7'));var client=jayson[_0xf955('0x8')][_0xf955('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59d5b3,_0x18432f,_0x20c096){return new BPromise(function(_0x4f58fb,_0x254b38){return client[_0xf955('0xa')](_0x59d5b3,_0x20c096)[_0xf955('0xb')](function(_0x38b190){logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,_0xf955('0xe'));logger['debug'](_0xf955('0xf'),_0x18432f,'request\x20sent',JSON[_0xf955('0x10')](_0x38b190));if(_0x38b190[_0xf955('0x11')]){if(_0x38b190[_0xf955('0x11')]['code']===0x1f4){logger[_0xf955('0x11')]('Integration,\x20%s,\x20%s',_0x18432f,_0x38b190[_0xf955('0x11')]['message']);return _0x254b38(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);return _0x4f58fb(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}else{logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,'request\x20sent');_0x4f58fb(_0x38b190[_0xf955('0x13')]['message']);}})[_0xf955('0x14')](function(_0x3a814f){logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x3a814f);_0x254b38(_0x3a814f);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 1a0ba6e..789c0f2 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 _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 +var _0x955f=['post','create','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x119e3d,_0x3b9033){var _0x32db8a=function(_0x1df1b0){while(--_0x1df1b0){_0x119e3d['push'](_0x119e3d['shift']());}};_0x32db8a(++_0x3b9033);}(_0x955f,0x1eb));var _0xf955=function(_0x3568c8,_0x18b63f){_0x3568c8=_0x3568c8-0x0;var _0xafca6=_0x955f[_0x3568c8];return _0xafca6;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./integrationReport.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['describe']);router[_0xf955('0x7')](_0xf955('0xb'),auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0xd')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router['put'](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0xf')]);router[_0xf955('0x10')](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 6861581..99d3b1f 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 _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 +var _0xa1f0=['BOOLEAN','TEXT','SENT','SENDING','RECEIVED','FAILED','exports','STRING','INTEGER','DATE'];(function(_0xdce6c6,_0x2ab39f){var _0x573ca1=function(_0x2ad2b5){while(--_0x2ad2b5){_0xdce6c6['push'](_0xdce6c6['shift']());}};_0x573ca1(++_0x2ab39f);}(_0xa1f0,0x7e));var _0x0a1f=function(_0x275255,_0x10cc82){_0x275255=_0x275255-0x0;var _0x34949f=_0xa1f0[_0x275255];return _0x34949f;};'use strict';var Sequelize=require('sequelize');module[_0x0a1f('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x0a1f('0x1')]},'exitStatus':{'type':Sequelize[_0x0a1f('0x1')]},'ticketId':{'type':Sequelize[_0x0a1f('0x1')]},'integrationId':{'type':Sequelize[_0x0a1f('0x2')]},'contacts':{'type':Sequelize[_0x0a1f('0x1')]},'uniqueid':{'type':Sequelize[_0x0a1f('0x1')]},'calleridnum':{'type':Sequelize[_0x0a1f('0x1')]},'calleridname':{'type':Sequelize[_0x0a1f('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x0a1f('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x0a1f('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x0a1f('0x2')]},'agentcomplete':{'type':Sequelize[_0x0a1f('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x0a1f('0x2')]},'agentacw':{'type':Sequelize[_0x0a1f('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x0a1f('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x0a1f('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x0a1f('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x0a1f('0x3')]},'lastevent':{'type':Sequelize[_0x0a1f('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x0a1f('0x2')]},'channelstatedesc':{'type':Sequelize[_0x0a1f('0x1')]},'connectedlinenum':{'type':Sequelize[_0x0a1f('0x1')]},'connectedlinename':{'type':Sequelize[_0x0a1f('0x1')]},'language':{'type':Sequelize[_0x0a1f('0x1')]},'accountcode':{'type':Sequelize[_0x0a1f('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x0a1f('0x1')]},'priority':{'type':Sequelize[_0x0a1f('0x1')]},'destchannel':{'type':Sequelize[_0x0a1f('0x1')]},'destchannelstate':{'type':Sequelize[_0x0a1f('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x0a1f('0x1')]},'destcalleridname':{'type':Sequelize[_0x0a1f('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x0a1f('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x0a1f('0x1')]},'destlanguage':{'type':Sequelize[_0x0a1f('0x1')]},'destaccountcode':{'type':Sequelize[_0x0a1f('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x0a1f('0x1')]},'destuniqueid':{'type':Sequelize[_0x0a1f('0x1')]},'messageId':{'type':Sequelize[_0x0a1f('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x0a1f('0x1')]},'from':{'type':Sequelize[_0x0a1f('0x1')]},'to':{'type':Sequelize[_0x0a1f('0x1')]},'cc':{'type':Sequelize[_0x0a1f('0x1')]},'attachment':{'type':Sequelize[_0x0a1f('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x0a1f('0x5')]},'status':{'type':Sequelize['ENUM'](_0x0a1f('0x6'),_0x0a1f('0x7'),_0x0a1f('0x8'),_0x0a1f('0x9'))},'url':{'type':Sequelize[_0x0a1f('0x1')]},'app':{'type':Sequelize[_0x0a1f('0x1')]},'appdata':{'type':Sequelize[_0x0a1f('0x1')]},'projectId':{'type':Sequelize[_0x0a1f('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 23754c6..190412e 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 _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 +var _0x03f6=['catch','show','keys','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','sendStatus','stack','name','send','index','map','IntegrationReport','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows'];(function(_0x54afe6,_0x4bb075){var _0x4fc29d=function(_0x562921){while(--_0x562921){_0x54afe6['push'](_0x54afe6['shift']());}};_0x4fc29d(++_0x4bb075);}(_0x03f6,0x12d));var _0x603f=function(_0x400d77,_0x57d796){_0x400d77=_0x400d77-0x0;var _0x3abdee=_0x03f6[_0x400d77];return _0x3abdee;};'use strict';var emlformat=require(_0x603f('0x0'));var rimraf=require(_0x603f('0x1'));var zipdir=require(_0x603f('0x2'));var jsonpatch=require(_0x603f('0x3'));var rp=require('request-promise');var moment=require(_0x603f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x603f('0x5'));var util=require(_0x603f('0x6'));var path=require('path');var sox=require(_0x603f('0x7'));var csv=require(_0x603f('0x8'));var ejs=require(_0x603f('0x9'));var fs=require('fs');var fs_extra=require(_0x603f('0xa'));var _=require('lodash');var squel=require(_0x603f('0xb'));var crypto=require(_0x603f('0xc'));var jsforce=require(_0x603f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x603f('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x603f('0xe'));var authService=require(_0x603f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x603f('0x10'));var hardwareService=require(_0x603f('0x11'));var logger=require(_0x603f('0x12'))(_0x603f('0x13'));var utils=require('../../config/utils');var config=require(_0x603f('0x14'));var licenseUtil=require(_0x603f('0x15'));var db=require(_0x603f('0x16'))['db'];function respondWithStatusCode(_0x4d7d3e,_0x2db608){_0x2db608=_0x2db608||0xcc;return function(_0x1622a0){if(_0x1622a0){return _0x4d7d3e['sendStatus'](_0x2db608);}return _0x4d7d3e[_0x603f('0x17')](_0x2db608)[_0x603f('0x18')]();};}function respondWithResult(_0x3c03c0,_0x5ce593){_0x5ce593=_0x5ce593||0xc8;return function(_0x332e6a){if(_0x332e6a){return _0x3c03c0[_0x603f('0x17')](_0x5ce593)[_0x603f('0x19')](_0x332e6a);}};}function respondWithFilteredResult(_0x39fff9,_0x3486ec){return function(_0x53795b){if(_0x53795b){var _0x32dd96=typeof _0x3486ec[_0x603f('0x1a')]===_0x603f('0x1b')&&typeof _0x3486ec[_0x603f('0x1c')]===_0x603f('0x1b');var _0x462e70=_0x53795b[_0x603f('0x1d')];var _0x13c979=_0x32dd96?0x0:_0x3486ec[_0x603f('0x1a')];var _0x196583=_0x32dd96?_0x53795b['count']:_0x3486ec[_0x603f('0x1a')]+_0x3486ec['limit'];var _0x17c92f;if(_0x196583>=_0x462e70){_0x196583=_0x462e70;_0x17c92f=0xc8;}else{_0x17c92f=0xce;}_0x39fff9['status'](_0x17c92f);return _0x39fff9[_0x603f('0x1e')]('Content-Range',_0x13c979+'-'+_0x196583+'/'+_0x462e70)[_0x603f('0x19')](_0x53795b);}return null;};}function patchUpdates(_0x75baf8){return function(_0x2b76b0){try{jsonpatch[_0x603f('0x1f')](_0x2b76b0,_0x75baf8,!![]);}catch(_0x45477a){return BPromise['reject'](_0x45477a);}return _0x2b76b0[_0x603f('0x20')]();};}function saveUpdates(_0x17d659,_0x5b59cb){return function(_0x4b4a9d){if(_0x4b4a9d){return _0x4b4a9d[_0x603f('0x21')](_0x17d659)['then'](function(_0x4b6665){return _0x4b6665;});}return null;};}function removeEntity(_0x528365,_0x1d68af){return function(_0x14954a){if(_0x14954a){return _0x14954a['destroy']()[_0x603f('0x22')](function(){_0x528365['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d2112,_0x29315e){return function(_0x1f95e9){if(!_0x1f95e9){_0x2d2112[_0x603f('0x23')](0x194);}return _0x1f95e9;};}function handleError(_0x205e2e,_0x1808e6){_0x1808e6=_0x1808e6||0x1f4;return function(_0x13e65e){logger['error'](_0x13e65e[_0x603f('0x24')]);if(_0x13e65e[_0x603f('0x25')]){delete _0x13e65e[_0x603f('0x25')];}_0x205e2e[_0x603f('0x17')](_0x1808e6)[_0x603f('0x26')](_0x13e65e);};}exports[_0x603f('0x27')]=function(_0x129316,_0x47c834){var _0x1dbe15={},_0x4f7ccd={},_0x5a5d4c={'count':0x0,'rows':[]};var _0x3e43a2=_[_0x603f('0x28')](db[_0x603f('0x29')][_0x603f('0x2a')],function(_0x2d05f8){return{'name':_0x2d05f8['fieldName'],'type':_0x2d05f8[_0x603f('0x2b')][_0x603f('0x2c')]};});_0x4f7ccd[_0x603f('0x2d')]=_[_0x603f('0x28')](_0x3e43a2,_0x603f('0x25'));_0x4f7ccd['query']=_['keys'](_0x129316[_0x603f('0x2e')]);_0x4f7ccd[_0x603f('0x2f')]=_['intersection'](_0x4f7ccd[_0x603f('0x2d')],_0x4f7ccd['query']);_0x1dbe15[_0x603f('0x30')]=_[_0x603f('0x31')](_0x4f7ccd[_0x603f('0x2d')],qs['fields'](_0x129316['query'][_0x603f('0x32')]));_0x1dbe15[_0x603f('0x30')]=_0x1dbe15[_0x603f('0x30')][_0x603f('0x33')]?_0x1dbe15[_0x603f('0x30')]:_0x4f7ccd[_0x603f('0x2d')];if(!_0x129316[_0x603f('0x2e')]['hasOwnProperty']('nolimit')){_0x1dbe15[_0x603f('0x1c')]=qs[_0x603f('0x1c')](_0x129316['query']['limit']);_0x1dbe15[_0x603f('0x1a')]=qs['offset'](_0x129316[_0x603f('0x2e')]['offset']);}_0x1dbe15[_0x603f('0x34')]=qs[_0x603f('0x35')](_0x129316[_0x603f('0x2e')][_0x603f('0x35')]);_0x1dbe15['where']=qs['filters'](_[_0x603f('0x36')](_0x129316[_0x603f('0x2e')],_0x4f7ccd[_0x603f('0x2f')]),_0x3e43a2);if(_0x129316['query']['filter']){_0x1dbe15[_0x603f('0x37')]=_[_0x603f('0x38')](_0x1dbe15[_0x603f('0x37')],{'$or':_[_0x603f('0x28')](_0x3e43a2,function(_0x5d094c){if(_0x5d094c[_0x603f('0x2b')]!==_0x603f('0x39')){var _0xda5fae={};_0xda5fae[_0x5d094c[_0x603f('0x25')]]={'$like':'%'+_0x129316[_0x603f('0x2e')][_0x603f('0x3a')]+'%'};return _0xda5fae;}})});}_0x1dbe15=_['merge']({},_0x1dbe15,_0x129316[_0x603f('0x3b')]);var _0x53aa0c={'where':_0x1dbe15[_0x603f('0x37')]};return db[_0x603f('0x29')][_0x603f('0x1d')](_0x53aa0c)[_0x603f('0x22')](function(_0xc084e4){_0x5a5d4c[_0x603f('0x1d')]=_0xc084e4;if(_0x129316[_0x603f('0x2e')][_0x603f('0x3c')]){_0x1dbe15[_0x603f('0x3d')]=[{'all':!![]}];}return db[_0x603f('0x29')][_0x603f('0x3e')](_0x1dbe15);})[_0x603f('0x22')](function(_0x3a8cf2){_0x5a5d4c[_0x603f('0x3f')]=_0x3a8cf2;return _0x5a5d4c;})[_0x603f('0x22')](respondWithFilteredResult(_0x47c834,_0x1dbe15))[_0x603f('0x40')](handleError(_0x47c834,null));};exports[_0x603f('0x41')]=function(_0x30548d,_0xdb55f5){var _0x3a242a={'raw':![],'where':{'id':_0x30548d['params']['id']}},_0x49b972={};_0x49b972['model']=_[_0x603f('0x42')](db['IntegrationReport'][_0x603f('0x2a')]);_0x49b972[_0x603f('0x2e')]=_[_0x603f('0x42')](_0x30548d[_0x603f('0x2e')]);_0x49b972[_0x603f('0x2f')]=_[_0x603f('0x31')](_0x49b972[_0x603f('0x2d')],_0x49b972[_0x603f('0x2e')]);_0x3a242a[_0x603f('0x30')]=_[_0x603f('0x31')](_0x49b972[_0x603f('0x2d')],qs[_0x603f('0x32')](_0x30548d['query'][_0x603f('0x32')]));_0x3a242a[_0x603f('0x30')]=_0x3a242a[_0x603f('0x30')][_0x603f('0x33')]?_0x3a242a[_0x603f('0x30')]:_0x49b972['model'];if(_0x30548d[_0x603f('0x2e')]['includeAll']){_0x3a242a[_0x603f('0x3d')]=[{'all':!![]}];}_0x3a242a=_['merge']({},_0x3a242a,_0x30548d[_0x603f('0x3b')]);return db[_0x603f('0x29')][_0x603f('0x43')](_0x3a242a)[_0x603f('0x22')](handleEntityNotFound(_0xdb55f5,null))[_0x603f('0x22')](respondWithResult(_0xdb55f5,null))[_0x603f('0x40')](handleError(_0xdb55f5,null));};exports['create']=function(_0xfde2b6,_0x3cd16f){return db['IntegrationReport'][_0x603f('0x44')](_0xfde2b6[_0x603f('0x45')],{})[_0x603f('0x22')](respondWithResult(_0x3cd16f,0xc9))['catch'](handleError(_0x3cd16f,null));};exports[_0x603f('0x21')]=function(_0x44afea,_0x2f8795){if(_0x44afea['body']['id']){delete _0x44afea[_0x603f('0x45')]['id'];}return db[_0x603f('0x29')][_0x603f('0x43')]({'where':{'id':_0x44afea[_0x603f('0x46')]['id']}})[_0x603f('0x22')](handleEntityNotFound(_0x2f8795,null))[_0x603f('0x22')](saveUpdates(_0x44afea[_0x603f('0x45')],null))[_0x603f('0x22')](respondWithResult(_0x2f8795,null))[_0x603f('0x40')](handleError(_0x2f8795,null));};exports[_0x603f('0x47')]=function(_0x5934e6,_0x5aeb2f){return db[_0x603f('0x29')][_0x603f('0x43')]({'where':{'id':_0x5934e6[_0x603f('0x46')]['id']}})[_0x603f('0x22')](handleEntityNotFound(_0x5aeb2f,null))[_0x603f('0x22')](removeEntity(_0x5aeb2f,null))['catch'](handleError(_0x5aeb2f,null));};exports[_0x603f('0x48')]=function(_0x130b60,_0x525910){return db[_0x603f('0x29')][_0x603f('0x48')]()[_0x603f('0x22')](respondWithResult(_0x525910,null))[_0x603f('0x40')](handleError(_0x525910,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 9b35f38..bdf1359 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 _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 +var _0xabab=['api','moment','request-promise','rimraf','../../config/environment','./integrationReport.attributes','exports','IntegrationReport','report_integration','lodash','util','../../config/logger'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xabab,0x81));var _0xbaba=function(_0x210c1e,_0x4d5349){_0x210c1e=_0x210c1e-0x0;var _0xf8e022=_0xabab[_0x210c1e];return _0xf8e022;};'use strict';var _=require(_0xbaba('0x0'));var util=require(_0xbaba('0x1'));var logger=require(_0xbaba('0x2'))(_0xbaba('0x3'));var moment=require(_0xbaba('0x4'));var BPromise=require('bluebird');var rp=require(_0xbaba('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbaba('0x6'));var config=require(_0xbaba('0x7'));var attributes=require(_0xbaba('0x8'));module[_0xbaba('0x9')]=function(_0x5701e9,_0x48b719){return _0x5701e9['define'](_0xbaba('0xa'),attributes,{'tableName':_0xbaba('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index d16fe15..42bdd65 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 _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 +var _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x53ec,0x192));var _0xc53e=function(_0x5d2ed9,_0x16c436){_0x5d2ed9=_0x5d2ed9-0x0;var _0x4262c5=_0x53ec[_0x5d2ed9];return _0x4262c5;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 07b719d..2ca3ded 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 _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 +var _0x5162=['../../config/environment','./interval.controller','get','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','create','post','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3c7488,_0xf5d9d9){var _0x175ea9=function(_0x37d315){while(--_0x37d315){_0x3c7488['push'](_0x3c7488['shift']());}};_0x175ea9(++_0xf5d9d9);}(_0x5162,0x103));var _0x2516=function(_0x7b6f59,_0x7cc38d){_0x7b6f59=_0x7b6f59-0x0;var _0x278caf=_0x5162[_0x7b6f59];return _0x278caf;};'use strict';var multer=require(_0x2516('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2516('0x1')]();var fs_extra=require(_0x2516('0x2'));var auth=require(_0x2516('0x3'));var interaction=require(_0x2516('0x4'));var config=require(_0x2516('0x5'));var controller=require(_0x2516('0x6'));router[_0x2516('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2516('0x8'),auth[_0x2516('0x9')](),controller[_0x2516('0xa')]);router[_0x2516('0x7')](_0x2516('0xb'),auth[_0x2516('0x9')](),controller[_0x2516('0xc')]);router['post']('/',auth[_0x2516('0x9')](),controller[_0x2516('0xd')]);router[_0x2516('0xe')]('/:id/sub_intervals',auth['isAuthenticated'](),controller['addInterval']);router['post'](_0x2516('0xf'),auth[_0x2516('0x9')](),controller[_0x2516('0x10')]);router[_0x2516('0x11')]('/:id',auth[_0x2516('0x9')](),controller[_0x2516('0x12')]);router[_0x2516('0x13')](_0x2516('0x8'),auth[_0x2516('0x9')](),controller[_0x2516('0x14')]);module[_0x2516('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index f452afc..6666ea5 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 _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 +var _0x58ba=['sequelize','exports','STRING'];(function(_0x41ce1e,_0x40a674){var _0x324f8c=function(_0x1a7e62){while(--_0x1a7e62){_0x41ce1e['push'](_0x41ce1e['shift']());}};_0x324f8c(++_0x40a674);}(_0x58ba,0x11d));var _0xa58b=function(_0x1f4639,_0x67d565){_0x1f4639=_0x1f4639-0x0;var _0x41efa4=_0x58ba[_0x1f4639];return _0x41efa4;};'use strict';var Sequelize=require(_0xa58b('0x0'));module[_0xa58b('0x1')]={'name':{'type':Sequelize[_0xa58b('0x2')]},'description':{'type':Sequelize[_0xa58b('0x2')]},'interval':{'type':Sequelize[_0xa58b('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index f2f3e02..f97a60e 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 _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 +var _0x4192=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','rows','show','params','keys','includeAll','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Intervals','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','addIntervals','sequelize','transaction','bulkCreate','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','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','../../components/extensions/rewrite','sendStatus','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','status','stack','name','send','index','map','Interval','fieldName','type','key','query','filters','intersection','model'];(function(_0x672855,_0x56d8c2){var _0x59b8d1=function(_0x3a2bf8){while(--_0x3a2bf8){_0x672855['push'](_0x672855['shift']());}};_0x59b8d1(++_0x56d8c2);}(_0x4192,0x149));var _0x2419=function(_0x7709d5,_0x3a0bc4){_0x7709d5=_0x7709d5-0x0;var _0x36e23c=_0x4192[_0x7709d5];return _0x36e23c;};'use strict';var emlformat=require(_0x2419('0x0'));var rimraf=require(_0x2419('0x1'));var zipdir=require(_0x2419('0x2'));var jsonpatch=require(_0x2419('0x3'));var rp=require(_0x2419('0x4'));var moment=require(_0x2419('0x5'));var BPromise=require(_0x2419('0x6'));var Mustache=require(_0x2419('0x7'));var util=require(_0x2419('0x8'));var path=require('path');var sox=require(_0x2419('0x9'));var csv=require(_0x2419('0xa'));var ejs=require(_0x2419('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2419('0xc'));var crypto=require(_0x2419('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2419('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2419('0xf'));var Papa=require(_0x2419('0x10'));var Redis=require(_0x2419('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2419('0x12'));var as=require(_0x2419('0x13'));var hardwareService=require(_0x2419('0x14'));var logger=require(_0x2419('0x15'))(_0x2419('0x16'));var utils=require(_0x2419('0x17'));var config=require(_0x2419('0x18'));var licenseUtil=require(_0x2419('0x19'));var db=require(_0x2419('0x1a'))['db'];var extensions=require(_0x2419('0x1b'));function respondWithStatusCode(_0x518e47,_0x97f046){_0x97f046=_0x97f046||0xcc;return function(_0xd4973d){if(_0xd4973d){return _0x518e47[_0x2419('0x1c')](_0x97f046);}return _0x518e47['status'](_0x97f046)[_0x2419('0x1d')]();};}function respondWithResult(_0x49a9a2,_0x33b801){_0x33b801=_0x33b801||0xc8;return function(_0x2a31b8){if(_0x2a31b8){return _0x49a9a2['status'](_0x33b801)[_0x2419('0x1e')](_0x2a31b8);}};}function respondWithFilteredResult(_0x2527dc,_0x525934){return function(_0x49c7b3){if(_0x49c7b3){var _0x1e35db=typeof _0x525934['offset']===_0x2419('0x1f')&&typeof _0x525934['limit']==='undefined';var _0x3860aa=_0x49c7b3['count'];var _0xcde5e5=_0x1e35db?0x0:_0x525934['offset'];var _0x4c27fa=_0x1e35db?_0x49c7b3[_0x2419('0x20')]:_0x525934[_0x2419('0x21')]+_0x525934[_0x2419('0x22')];var _0x3e27fe;if(_0x4c27fa>=_0x3860aa){_0x4c27fa=_0x3860aa;_0x3e27fe=0xc8;}else{_0x3e27fe=0xce;}_0x2527dc['status'](_0x3e27fe);return _0x2527dc[_0x2419('0x23')](_0x2419('0x24'),_0xcde5e5+'-'+_0x4c27fa+'/'+_0x3860aa)['json'](_0x49c7b3);}return null;};}function patchUpdates(_0x645b5b){return function(_0xfbb6d5){try{jsonpatch[_0x2419('0x25')](_0xfbb6d5,_0x645b5b,!![]);}catch(_0x1ac06f){return BPromise[_0x2419('0x26')](_0x1ac06f);}return _0xfbb6d5[_0x2419('0x27')]();};}function saveUpdates(_0x304782,_0x15acf9){return function(_0x15fb1a){if(_0x15fb1a){return _0x15fb1a[_0x2419('0x28')](_0x304782)[_0x2419('0x29')](function(_0x2d7131){return _0x2d7131;});}return null;};}function removeEntity(_0x20da29,_0x3e8a9b){return function(_0x319304){if(_0x319304){return _0x319304['destroy']()[_0x2419('0x29')](function(){var _0x277e36=_0x319304[_0x2419('0x2a')]({'plain':!![]});var _0x5121e4='Intervals';return db[_0x2419('0x2b')][_0x2419('0x2c')]({'where':{'type':_0x5121e4,'resourceId':_0x277e36['id']}})[_0x2419('0x29')](function(){return _0x319304;});})['then'](function(){_0x20da29[_0x2419('0x2d')](0xcc)[_0x2419('0x1d')]();});}};}function handleEntityNotFound(_0x37d167,_0x2a68d8){return function(_0x4b18b0){if(!_0x4b18b0){_0x37d167['sendStatus'](0x194);}return _0x4b18b0;};}function handleError(_0x94a710,_0x236158){_0x236158=_0x236158||0x1f4;return function(_0x29b057){logger['error'](_0x29b057[_0x2419('0x2e')]);if(_0x29b057['name']){delete _0x29b057[_0x2419('0x2f')];}_0x94a710[_0x2419('0x2d')](_0x236158)[_0x2419('0x30')](_0x29b057);};}exports[_0x2419('0x31')]=function(_0x55b829,_0x3d0dde){var _0x3858d0={},_0x2713fe={},_0x3cbfa5={'count':0x0,'rows':[]};var _0x16ce5b=_[_0x2419('0x32')](db[_0x2419('0x33')]['rawAttributes'],function(_0x5ae2c3){return{'name':_0x5ae2c3[_0x2419('0x34')],'type':_0x5ae2c3[_0x2419('0x35')][_0x2419('0x36')]};});_0x2713fe['model']=_[_0x2419('0x32')](_0x16ce5b,'name');_0x2713fe[_0x2419('0x37')]=_['keys'](_0x55b829[_0x2419('0x37')]);_0x2713fe[_0x2419('0x38')]=_[_0x2419('0x39')](_0x2713fe[_0x2419('0x3a')],_0x2713fe['query']);_0x3858d0[_0x2419('0x3b')]=_['intersection'](_0x2713fe[_0x2419('0x3a')],qs[_0x2419('0x3c')](_0x55b829[_0x2419('0x37')][_0x2419('0x3c')]));_0x3858d0[_0x2419('0x3b')]=_0x3858d0[_0x2419('0x3b')][_0x2419('0x3d')]?_0x3858d0[_0x2419('0x3b')]:_0x2713fe['model'];if(!_0x55b829[_0x2419('0x37')][_0x2419('0x3e')](_0x2419('0x3f'))){_0x3858d0[_0x2419('0x22')]=qs[_0x2419('0x22')](_0x55b829['query']['limit']);_0x3858d0[_0x2419('0x21')]=qs[_0x2419('0x21')](_0x55b829[_0x2419('0x37')][_0x2419('0x21')]);}_0x3858d0[_0x2419('0x40')]=qs[_0x2419('0x41')](_0x55b829[_0x2419('0x37')]['sort']);_0x3858d0[_0x2419('0x42')]=qs[_0x2419('0x38')](_[_0x2419('0x43')](_0x55b829[_0x2419('0x37')],_0x2713fe[_0x2419('0x38')]),_0x16ce5b);if(_0x55b829[_0x2419('0x37')][_0x2419('0x44')]){_0x3858d0[_0x2419('0x42')]=_['merge'](_0x3858d0[_0x2419('0x42')],{'$or':_['map'](_0x16ce5b,function(_0x546a9e){if(_0x546a9e['type']!=='VIRTUAL'){var _0xb2f623={};_0xb2f623[_0x546a9e[_0x2419('0x2f')]]={'$like':'%'+_0x55b829[_0x2419('0x37')][_0x2419('0x44')]+'%'};return _0xb2f623;}})});}_0x3858d0=_[_0x2419('0x45')]({},_0x3858d0,_0x55b829[_0x2419('0x46')]);var _0x18895b={'where':_0x3858d0[_0x2419('0x42')]};return db['Interval']['count'](_0x18895b)[_0x2419('0x29')](function(_0x45a1d6){_0x3cbfa5[_0x2419('0x20')]=_0x45a1d6;if(_0x55b829['query']['includeAll']){_0x3858d0[_0x2419('0x47')]=[{'all':!![]}];}return db[_0x2419('0x33')]['findAll'](_0x3858d0);})['then'](function(_0x3c8960){_0x3cbfa5[_0x2419('0x48')]=_0x3c8960;return _0x3cbfa5;})[_0x2419('0x29')](respondWithFilteredResult(_0x3d0dde,_0x3858d0))['catch'](handleError(_0x3d0dde,null));};exports[_0x2419('0x49')]=function(_0x2db8e3,_0x3043b4){var _0x33cd13={'raw':!![],'where':{'id':_0x2db8e3[_0x2419('0x4a')]['id']}},_0x5d9bbe={};_0x5d9bbe[_0x2419('0x3a')]=_['keys'](db[_0x2419('0x33')]['rawAttributes']);_0x5d9bbe['query']=_[_0x2419('0x4b')](_0x2db8e3[_0x2419('0x37')]);_0x5d9bbe[_0x2419('0x38')]=_['intersection'](_0x5d9bbe[_0x2419('0x3a')],_0x5d9bbe[_0x2419('0x37')]);_0x33cd13['attributes']=_[_0x2419('0x39')](_0x5d9bbe[_0x2419('0x3a')],qs[_0x2419('0x3c')](_0x2db8e3[_0x2419('0x37')][_0x2419('0x3c')]));_0x33cd13[_0x2419('0x3b')]=_0x33cd13[_0x2419('0x3b')][_0x2419('0x3d')]?_0x33cd13['attributes']:_0x5d9bbe['model'];if(_0x2db8e3[_0x2419('0x37')][_0x2419('0x4c')]){_0x33cd13[_0x2419('0x47')]=[{'all':!![]}];}_0x33cd13=_[_0x2419('0x45')]({},_0x33cd13,_0x2db8e3[_0x2419('0x46')]);return db[_0x2419('0x33')][_0x2419('0x4d')](_0x33cd13)[_0x2419('0x29')](handleEntityNotFound(_0x3043b4,null))[_0x2419('0x29')](respondWithResult(_0x3043b4,null))[_0x2419('0x4e')](handleError(_0x3043b4,null));};exports[_0x2419('0x4f')]=function(_0xd1a2a3,_0x49a016){return db[_0x2419('0x33')]['create'](_0xd1a2a3[_0x2419('0x50')],{})['then'](function(_0x3300a8){var _0x9ef117=_0xd1a2a3['user']['get']({'plain':!![]});if(!_0x9ef117)throw new Error(_0x2419('0x51'));if(_0x9ef117[_0x2419('0x52')]===_0x2419('0x53')){var _0x17b8bd=_0x3300a8['get']({'plain':!![]});var _0x3223c6=_0x2419('0x54');return db[_0x2419('0x55')]['find']({'where':{'name':_0x3223c6,'userProfileId':_0x9ef117['userProfileId']},'raw':!![]})['then'](function(_0x41e4fe){if(_0x41e4fe&&_0x41e4fe['autoAssociation']===0x0){return db['UserProfileResource'][_0x2419('0x4f')]({'name':_0x17b8bd[_0x2419('0x2f')],'resourceId':_0x17b8bd['id'],'type':_0x41e4fe[_0x2419('0x2f')],'sectionId':_0x41e4fe['id']},{})[_0x2419('0x29')](function(){return _0x3300a8;});}else{return _0x3300a8;}})[_0x2419('0x4e')](function(_0x4c1c71){logger[_0x2419('0x56')](_0x2419('0x57'),_0x4c1c71);throw _0x4c1c71;});}return _0x3300a8;})[_0x2419('0x29')](respondWithResult(_0x49a016,0xc9))['catch'](handleError(_0x49a016,null));};exports[_0x2419('0x28')]=function(_0x4095f6,_0x489a93){if(_0x4095f6[_0x2419('0x50')]['id']){delete _0x4095f6['body']['id'];}return db[_0x2419('0x33')][_0x2419('0x4d')]({'where':{'id':_0x4095f6[_0x2419('0x4a')]['id']}})[_0x2419('0x29')](handleEntityNotFound(_0x489a93,null))[_0x2419('0x29')](saveUpdates(_0x4095f6[_0x2419('0x50')],null))[_0x2419('0x29')](respondWithResult(_0x489a93,null))[_0x2419('0x4e')](handleError(_0x489a93,null));};exports[_0x2419('0x2c')]=function(_0x329e88,_0x58d1ba){return db['Interval'][_0x2419('0x4d')]({'where':{'id':_0x329e88[_0x2419('0x4a')]['id']}})['then'](handleEntityNotFound(_0x58d1ba,null))['then'](removeEntity(_0x58d1ba,null))[_0x2419('0x4e')](handleError(_0x58d1ba,null));};exports[_0x2419('0x58')]=function(_0x2527f2,_0x258a9c,_0x49b5e1){if(_0x2527f2[_0x2419('0x50')]['id']){delete _0x2527f2[_0x2419('0x50')]['id'];}return db[_0x2419('0x33')][_0x2419('0x4d')]({'where':{'id':_0x2527f2[_0x2419('0x4a')]['id']}})['then'](handleEntityNotFound(_0x258a9c,null))['then'](function(_0x5522e4){if(_0x5522e4){_0x2527f2[_0x2419('0x50')][_0x2419('0x59')]=_0x5522e4['id'];return db[_0x2419('0x33')][_0x2419('0x4f')](_0x2527f2[_0x2419('0x50')]);}})['then'](respondWithResult(_0x258a9c,null))[_0x2419('0x4e')](handleError(_0x258a9c,null));};exports[_0x2419('0x5a')]=function(_0x135e95,_0x41d225,_0x22c01b){var _0x4765b9={};var _0x30ae89={};var _0x4bc0be;var _0x579dca;return db['Interval'][_0x2419('0x5b')]({'where':{'id':_0x135e95[_0x2419('0x4a')]['id']}})[_0x2419('0x29')](handleEntityNotFound(_0x41d225,null))[_0x2419('0x29')](function(_0x4c03c7){if(_0x4c03c7){_0x4bc0be=_0x4c03c7;_0x30ae89[_0x2419('0x3a')]=_[_0x2419('0x4b')](db[_0x2419('0x33')]['rawAttributes']);_0x30ae89[_0x2419('0x37')]=_[_0x2419('0x4b')](_0x135e95['query']);_0x30ae89['filters']=_[_0x2419('0x39')](_0x30ae89['model'],_0x30ae89[_0x2419('0x37')]);_0x4765b9[_0x2419('0x3b')]=_[_0x2419('0x39')](_0x30ae89['model'],qs[_0x2419('0x3c')](_0x135e95['query'][_0x2419('0x3c')]));_0x4765b9['attributes']=_0x4765b9[_0x2419('0x3b')][_0x2419('0x3d')]?_0x4765b9[_0x2419('0x3b')]:_0x30ae89[_0x2419('0x3a')];_0x4765b9[_0x2419('0x40')]=qs[_0x2419('0x41')](_0x135e95[_0x2419('0x37')]['sort']);_0x4765b9['where']=qs[_0x2419('0x38')](_[_0x2419('0x43')](_0x135e95['query'],_0x30ae89[_0x2419('0x38')]));if(_0x135e95[_0x2419('0x37')][_0x2419('0x44')]){_0x4765b9[_0x2419('0x42')]=_[_0x2419('0x45')](_0x4765b9[_0x2419('0x42')],{'$or':_[_0x2419('0x32')](_0x4765b9['attributes'],function(_0x313403){var _0x3155e5={};_0x3155e5[_0x313403]={'$like':'%'+_0x135e95[_0x2419('0x37')][_0x2419('0x44')]+'%'};return _0x3155e5;})});}_0x4765b9=_[_0x2419('0x45')]({},_0x4765b9,_0x135e95[_0x2419('0x46')]);return _0x4bc0be[_0x2419('0x5a')](_0x4765b9);}})[_0x2419('0x29')](function(_0x36ddd9){if(_0x36ddd9){_0x579dca=_0x36ddd9[_0x2419('0x3d')];if(!_0x135e95['query'][_0x2419('0x3e')](_0x2419('0x3f'))){_0x4765b9[_0x2419('0x22')]=qs[_0x2419('0x22')](_0x135e95[_0x2419('0x37')][_0x2419('0x22')]);_0x4765b9['offset']=qs[_0x2419('0x21')](_0x135e95['query'][_0x2419('0x21')]);}return _0x4bc0be[_0x2419('0x5a')](_0x4765b9);}})[_0x2419('0x29')](function(_0x678bc2){if(_0x678bc2){return _0x678bc2?{'count':_0x579dca,'rows':_0x678bc2}:null;}})[_0x2419('0x29')](respondWithResult(_0x41d225,null))[_0x2419('0x4e')](handleError(_0x41d225,null));};exports[_0x2419('0x5c')]=function(_0x2b6f06,_0x5f6a7,_0x35474f){return db[_0x2419('0x33')]['findOne']({'where':{'id':_0x2b6f06[_0x2419('0x4a')]['id']}})[_0x2419('0x29')](handleEntityNotFound(_0x5f6a7,null))[_0x2419('0x29')](function(_0x5527a9){if(_0x5527a9){return db[_0x2419('0x5d')][_0x2419('0x5e')](function(_0x2ec376){return db[_0x2419('0x33')][_0x2419('0x2c')]({'where':{'IntervalId':_0x2b6f06[_0x2419('0x4a')]['id']},'transaction':_0x2ec376})[_0x2419('0x29')](function(_0x384452){var _0x3a9ccc=_[_0x2419('0x32')](_0x2b6f06[_0x2419('0x50')],function(_0x2f2800){delete _0x2f2800['id'];_0x2f2800[_0x2419('0x59')]=_0x2b6f06['params']['id'];return _0x2f2800;});return db[_0x2419('0x33')][_0x2419('0x5f')](_0x3a9ccc,{'transaction':_0x2ec376});});})[_0x2419('0x29')](function(){return db[_0x2419('0x33')][_0x2419('0x60')]({'where':{'IntervalId':_0x2b6f06[_0x2419('0x4a')]['id']}});});}})[_0x2419('0x29')](respondWithResult(_0x5f6a7,null))[_0x2419('0x4e')](handleError(_0x5f6a7,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 9a46203..708dfc1 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 _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 +var _0x2b6b=['string','getIntervals','then','all','../../components/extensions/rewrite','../../utils/iftime','iftime','define','tools_intervals','rewrite','interval'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2b6b,0xa9));var _0xb2b6=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x2b6b[_0x3bf83f];return _0x22c4a9;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0xb2b6('0x0'));var iftime=require(_0xb2b6('0x1'))[_0xb2b6('0x2')];module['exports']=function(_0x178bee){return _0x178bee[_0xb2b6('0x3')]('Interval',attributes,{'tableName':_0xb2b6('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x31320c){extensions['rewrite'](_0x178bee,_0x31320c);},'afterBulkCreate':function(_0x223d09,_0x3013ff,_0x2a7c9e){_0x2a7c9e();extensions[_0xb2b6('0x5')](_0x178bee,_0x223d09[0x0]);},'afterUpdate':function(_0x4fe2d9){extensions[_0xb2b6('0x5')](_0x178bee,_0x4fe2d9);},'afterDestroy':function(_0xf04e99){extensions[_0xb2b6('0x5')](_0x178bee,_0xf04e99);}},'instanceMethods':{'ifTime':function(_0x1f2ed8=undefined,_0x17aa8d=new Date()){if(typeof this[_0xb2b6('0x6')]===_0xb2b6('0x7')){return iftime(this[_0xb2b6('0x6')],_0x1f2ed8,_0x17aa8d);}else{return this[_0xb2b6('0x8')]()[_0xb2b6('0x9')](function(_0x3cfd24){return Promise[_0xb2b6('0xa')](_0x3cfd24['map'](function(_0x4af8d3){return _0x4af8d3['ifTime'](_0x1f2ed8,_0x17aa8d);}));})[_0xb2b6('0x9')](function(_0x22cf7e){return _0x22cf7e['reduce'](function(_0x39c519,_0xe94b91){return _0x39c519||_0xe94b91;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 1a4d6f3..6dc865b 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 _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 +var _0x8288=['where','all','ifTime','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','intervalIds','isArray','intervals','string','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','Iftime','silly','resolve','reduce','IntervalIftime','lodash','util','../../utils/iftime','iftime','../../config/logger','GetInterval','Interval','findAll','options','attributes','include','map','model','then','info','debug','stringify','catch','error','message','ShowInterval','find'];(function(_0x10609c,_0xb21b1e){var _0xb66922=function(_0x51da65){while(--_0x51da65){_0x10609c['push'](_0x10609c['shift']());}};_0xb66922(++_0xb21b1e);}(_0x8288,0x1b8));var _0x8828=function(_0x4306b4,_0x354c84){_0x4306b4=_0x4306b4-0x0;var _0x1b4639=_0x8288[_0x4306b4];return _0x1b4639;};'use strict';var _=require(_0x8828('0x0'));var util=require(_0x8828('0x1'));var db=require('../../mysqldb')['db'];var iftime=require(_0x8828('0x2'))[_0x8828('0x3')];var logger=require(_0x8828('0x4'))('rpc');exports[_0x8828('0x5')]=function(_0x16bd92){var _0x111c4e=this;return new Promise(function(_0x202301,_0x1e570e){return db[_0x8828('0x6')][_0x8828('0x7')]({'raw':_0x16bd92['options']?_0x16bd92[_0x8828('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x16bd92[_0x8828('0x8')]?_0x16bd92[_0x8828('0x8')]['where']||null:null,'attributes':_0x16bd92[_0x8828('0x8')]?_0x16bd92[_0x8828('0x8')][_0x8828('0x9')]||null:null,'limit':_0x16bd92['options']?_0x16bd92['options']['limit']||null:null,'include':_0x16bd92['options']?_0x16bd92[_0x8828('0x8')][_0x8828('0xa')]?_[_0x8828('0xb')](_0x16bd92[_0x8828('0x8')]['include'],function(_0x233120){return{'model':db[_0x233120[_0x8828('0xc')]],'as':_0x233120['as'],'attributes':_0x233120[_0x8828('0x9')],'include':_0x233120['include']?_[_0x8828('0xb')](_0x233120['include'],function(_0x2cd3f7){return{'model':db[_0x2cd3f7['model']],'as':_0x2cd3f7['as'],'attributes':_0x2cd3f7[_0x8828('0x9')],'include':_0x2cd3f7[_0x8828('0xa')]?_[_0x8828('0xb')](_0x2cd3f7[_0x8828('0xa')],function(_0x117c26){return{'model':db[_0x117c26[_0x8828('0xc')]],'as':_0x117c26['as'],'attributes':_0x117c26[_0x8828('0x9')]};}):[]};}):[]};}):[]:[]})[_0x8828('0xd')](function(_0x57757e){logger[_0x8828('0xe')](_0x8828('0x5'),_0x16bd92);logger[_0x8828('0xf')](_0x8828('0x5'),_0x16bd92,JSON[_0x8828('0x10')](_0x57757e));_0x202301(_0x57757e);})[_0x8828('0x11')](function(_0x16b57f){logger[_0x8828('0x12')]('GetInterval',_0x16b57f['message'],_0x16bd92);_0x1e570e(_0x111c4e[_0x8828('0x12')](0x1f4,_0x16b57f[_0x8828('0x13')]));});});};exports[_0x8828('0x14')]=function(_0x5e99ba){var _0x22f668=this;return new Promise(function(_0x4220c8,_0x689db0){return db[_0x8828('0x6')][_0x8828('0x15')]({'raw':_0x5e99ba[_0x8828('0x8')]?_0x5e99ba['options']['raw']===undefined?!![]:![]:!![],'where':_0x5e99ba[_0x8828('0x8')]?_0x5e99ba['options'][_0x8828('0x16')]||null:null,'attributes':_0x5e99ba[_0x8828('0x8')]?_0x5e99ba[_0x8828('0x8')][_0x8828('0x9')]||null:null,'include':_0x5e99ba[_0x8828('0x8')]?_0x5e99ba[_0x8828('0x8')][_0x8828('0xa')]?_[_0x8828('0xb')](_0x5e99ba[_0x8828('0x8')]['include'],function(_0x2ace9c){return{'model':db[_0x2ace9c[_0x8828('0xc')]],'as':_0x2ace9c['as'],'attributes':_0x2ace9c[_0x8828('0x9')],'include':_0x2ace9c[_0x8828('0xa')]?_[_0x8828('0xb')](_0x2ace9c[_0x8828('0xa')],function(_0x253800){return{'model':db[_0x253800[_0x8828('0xc')]],'as':_0x253800['as'],'attributes':_0x253800[_0x8828('0x9')],'include':_0x253800['include']?_[_0x8828('0xb')](_0x253800[_0x8828('0xa')],function(_0x220673){return{'model':db[_0x220673['model']],'as':_0x220673['as'],'attributes':_0x220673[_0x8828('0x9')]};}):[]};}):[]};}):[]:[]})[_0x8828('0xd')](function(_0x51960e){logger['info'](_0x8828('0x14'),_0x5e99ba);logger[_0x8828('0xf')]('ShowInterval',_0x5e99ba,JSON[_0x8828('0x10')](_0x51960e));_0x4220c8(_0x51960e);})['catch'](function(_0x3bf33e){logger[_0x8828('0x12')](_0x8828('0x14'),_0x3bf33e[_0x8828('0x13')],_0x5e99ba);_0x689db0(_0x22f668[_0x8828('0x12')](0x1f4,_0x3bf33e[_0x8828('0x13')]));});});};function checkArrayOfIntervals(_0x5948ff,_0x50fec6){var _0x3f5567=[];return db['Interval']['findAll']({'where':{'id':_0x5948ff}})[_0x8828('0xd')](function(_0x5bf1cc){_0x3f5567=_0x5bf1cc;return Promise[_0x8828('0x17')](_0x3f5567[_0x8828('0xb')](function(_0xe613e1){return _0xe613e1[_0x8828('0x18')](_0x50fec6);}));})[_0x8828('0xd')](function(_0x30202e){var _0x288708=_0x30202e['reduce'](function(_0x42ca39,_0x42c9d0){return _0x42ca39||_0x42c9d0;},![]);logger[_0x8828('0xe')](util[_0x8828('0x19')](_0x8828('0x1a'),_0x3f5567['map'](function(_0x73bb56){return _0x73bb56[_0x8828('0x1b')];})[_0x8828('0x1c')](',\x20'),_0x3f5567[_0x8828('0xb')](function(_0xb9bd37){return _0xb9bd37['id'];})[_0x8828('0x1c')](',\x20')));return _0x288708;});}function checkSingleInterval(_0x4813c5,_0x167140){return db[_0x8828('0x6')][_0x8828('0x1d')](_0x4813c5)['then'](function(_0x7e8837){if(_0x7e8837){logger[_0x8828('0xe')](util[_0x8828('0x19')](_0x8828('0x1e'),_0x7e8837[_0x8828('0x1b')],_0x7e8837['id']));return _0x7e8837[_0x8828('0x18')](_0x167140);}});}exports['IntervalIftime']=function(_0x54b484){var _0x2c5823=_0x54b484[_0x8828('0x1f')];var _0x2416a7=Array[_0x8828('0x20')](_0x54b484[_0x8828('0x21')])?_0x54b484[_0x8828('0x21')]:typeof _0x54b484[_0x8828('0x21')]===_0x8828('0x22')?[_0x54b484['intervals']]:[];var _0x5b356a=_0x54b484['timezone']||undefined;var _0x28693f=![];if(_0x2416a7[_0x8828('0x23')]){logger[_0x8828('0xe')](util[_0x8828('0x19')](_0x8828('0x24'),_0x2416a7['join'](';\x20')));}if(_0x5b356a){logger[_0x8828('0xe')](util[_0x8828('0x19')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x5b356a));}logger['debug'](_0x8828('0x25'),_0x28693f);logger[_0x8828('0x26')]('IntervalIftime',_0x54b484);return Promise[_0x8828('0x27')]()[_0x8828('0xd')](function(){if(Array[_0x8828('0x20')](_0x2c5823)){return checkArrayOfIntervals(_0x2c5823,_0x5b356a);}else if(_0x2c5823){return checkSingleInterval(_0x2c5823,_0x5b356a);}})[_0x8828('0xd')](function(_0x224945){var _0x3d3f39=_0x2416a7[_0x8828('0x28')](function(_0x48f4b0,_0x55c858){return _0x48f4b0||iftime(_0x55c858,_0x5b356a);},![]);_0x28693f=_0x224945||_0x3d3f39;return _0x28693f;})[_0x8828('0x11')](function(_0x584a28){logger[_0x8828('0x12')](_0x8828('0x29'),_0x54b484,_0x584a28);throw this['error'](0x1f4,_0x584a28[_0x8828('0x13')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index d7eef5e..d9e74c0 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_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 +var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x0b0e,0x187));var _0xe0b0=function(_0x246890,_0x46b964){_0x246890=_0x246890-0x0;var _0x2b2a5a=_0x0b0e[_0x246890];return _0x2b2a5a;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 724e0ee..75ca30b 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 _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 +var _0x5a39=['utf8','data','status','statusCode','parse','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','../../config/logger','api','3eAmWpBVP0','key','MOTGUI','summary','Report','description','stringify','issuetype','fields','customfield_11500','customfield_11501','oldToken','customfield_11502','name','customfield_11504','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','base64','setEncoding'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5a39,0x138));var _0x95a3=function(_0xba248b,_0x1ca690){_0xba248b=_0xba248b-0x0;var _0x3d2d45=_0x5a39[_0xba248b];return _0x3d2d45;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require(_0x95a3('0x0'))(_0x95a3('0x1'));var USERNAME='support';var PASSWORD=_0x95a3('0x2');function openIssue(_0x3f696a,_0x53a23b){var _0x4cbd2c={'fields':{'project':{'key':_0x3f696a[_0x95a3('0x3')]||_0x95a3('0x4')},'summary':(_0x3f696a[_0x95a3('0x5')]||_0x95a3('0x6'))+'\x20from\x20'+_0x3f696a['ip'],'description':_0x3f696a[_0x95a3('0x7')]||JSON[_0x95a3('0x8')](_0x3f696a),'issuetype':{'name':_0x3f696a[_0x95a3('0x9')]||'Bug'}}};_0x4cbd2c[_0x95a3('0xa')][_0x95a3('0xb')]=_0x3f696a['email'];_0x4cbd2c[_0x95a3('0xa')][_0x95a3('0xc')]=_0x3f696a[_0x95a3('0xd')];_0x4cbd2c[_0x95a3('0xa')][_0x95a3('0xe')]=_0x3f696a['newToken'];_0x4cbd2c[_0x95a3('0xa')]['customfield_11503']=_0x3f696a[_0x95a3('0xf')];_0x4cbd2c[_0x95a3('0xa')][_0x95a3('0x10')]=_0x3f696a['reason'];_0x4cbd2c[_0x95a3('0xa')][_0x95a3('0x11')]=_0x3f696a['ip'];var _0xa3a7aa={'host':_0x95a3('0x12'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x95a3('0x13'),'timeout':0x4e20,'headers':{'Content-Type':_0x95a3('0x14'),'Authorization':_0x95a3('0x15')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x95a3('0x16'))}};var _0x3abb97=JSON[_0x95a3('0x8')](_0x4cbd2c);var _0x1c3de1=https['request'](_0xa3a7aa,function(_0x1d23e9){_0x1d23e9[_0x95a3('0x17')](_0x95a3('0x18'));var _0x597b8d='';_0x1d23e9['on'](_0x95a3('0x19'),function(_0x4360e5){_0x597b8d+=_0x4360e5;});_0x1d23e9['on']('end',function(){if(_0x53a23b){return _0x53a23b[_0x95a3('0x1a')](_0x1d23e9[_0x95a3('0x1b')])['json'](JSON[_0x95a3('0x1c')](_0x597b8d));}});});_0x1c3de1['on'](_0x95a3('0x1d'),function(_0x3c96b9){if(_0x53a23b){return _0x53a23b[_0x95a3('0x1a')](0x1f4)[_0x95a3('0x1e')]({'errors':[{'message':_0x95a3('0x1f'),'type':_0x95a3('0x20')}]});}});_0x1c3de1[_0x95a3('0x21')](_0x3abb97);_0x1c3de1['end']();}exports[_0x95a3('0x22')]=openIssue;exports[_0x95a3('0x23')]=function(_0x51044c,_0x808481){_0x51044c[_0x95a3('0x24')]['ip']=_0x51044c[_0x95a3('0x25')][_0x95a3('0x26')]||_0x51044c[_0x95a3('0x27')][_0x95a3('0x28')]||_0x51044c['socket'][_0x95a3('0x28')]||_0x51044c[_0x95a3('0x27')][_0x95a3('0x29')][_0x95a3('0x28')];return openIssue(_0x51044c[_0x95a3('0x24')],_0x808481);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 6e7c0e2..f532fd2 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 _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 +var _0x9c44=['update','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./jscriptyAnswerReport.controller','isAuthenticated','index','get','/describe','/:id','show','create','put'];(function(_0x5a21a4,_0xc836c4){var _0x3dc8d7=function(_0x3b6adb){while(--_0x3b6adb){_0x5a21a4['push'](_0x5a21a4['shift']());}};_0x3dc8d7(++_0xc836c4);}(_0x9c44,0x178));var _0x49c4=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x9c44[_0x3d42d8];return _0x27fc41;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x49c4('0xd')]);router[_0x49c4('0xe')]('/:id',auth[_0x49c4('0x7')](),controller[_0x49c4('0xf')]);router['delete']('/:id',auth[_0x49c4('0x7')](),controller[_0x49c4('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 037785f..7e1547d 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(_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 +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x7a54,0x106));var _0x47a5=function(_0x18cdb3,_0x464d8f){_0x18cdb3=_0x18cdb3-0x0;var _0x16e5f8=_0x7a54[_0x18cdb3];return _0x16e5f8;};'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 9d4f1d3..f778362 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 _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 +var _0x165d=['attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','fields','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','end','offset','undefined','count','limit','status','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model'];(function(_0x59ad89,_0x41cdbd){var _0x463e97=function(_0x4bc593){while(--_0x4bc593){_0x59ad89['push'](_0x59ad89['shift']());}};_0x463e97(++_0x41cdbd);}(_0x165d,0x14a));var _0xd165=function(_0x4caf6d,_0x5a4a0d){_0x4caf6d=_0x4caf6d-0x0;var _0x144166=_0x165d[_0x4caf6d];return _0x144166;};'use strict';var emlformat=require(_0xd165('0x0'));var rimraf=require(_0xd165('0x1'));var zipdir=require(_0xd165('0x2'));var jsonpatch=require(_0xd165('0x3'));var rp=require(_0xd165('0x4'));var moment=require(_0xd165('0x5'));var BPromise=require(_0xd165('0x6'));var Mustache=require('mustache');var util=require(_0xd165('0x7'));var path=require(_0xd165('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd165('0x9'));var _=require(_0xd165('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd165('0xb'));var deskjs=require(_0xd165('0xc'));var toCsv=require(_0xd165('0xd'));var querystring=require(_0xd165('0xe'));var Papa=require(_0xd165('0xf'));var Redis=require(_0xd165('0x10'));var authService=require(_0xd165('0x11'));var qs=require(_0xd165('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd165('0x13'));var logger=require(_0xd165('0x14'))(_0xd165('0x15'));var utils=require('../../config/utils');var config=require(_0xd165('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd165('0x17'))['db'];function respondWithStatusCode(_0x267f62,_0x2eee5c){_0x2eee5c=_0x2eee5c||0xcc;return function(_0x430499){if(_0x430499){return _0x267f62['sendStatus'](_0x2eee5c);}return _0x267f62['status'](_0x2eee5c)[_0xd165('0x18')]();};}function respondWithResult(_0x17521a,_0x3e586a){_0x3e586a=_0x3e586a||0xc8;return function(_0x51fa95){if(_0x51fa95){return _0x17521a['status'](_0x3e586a)['json'](_0x51fa95);}};}function respondWithFilteredResult(_0x693c9b,_0x3e6032){return function(_0x4c86c6){if(_0x4c86c6){var _0x170839=typeof _0x3e6032[_0xd165('0x19')]==='undefined'&&typeof _0x3e6032['limit']===_0xd165('0x1a');var _0x30378f=_0x4c86c6['count'];var _0x551561=_0x170839?0x0:_0x3e6032['offset'];var _0x529cc9=_0x170839?_0x4c86c6[_0xd165('0x1b')]:_0x3e6032[_0xd165('0x19')]+_0x3e6032[_0xd165('0x1c')];var _0x7ed688;if(_0x529cc9>=_0x30378f){_0x529cc9=_0x30378f;_0x7ed688=0xc8;}else{_0x7ed688=0xce;}_0x693c9b[_0xd165('0x1d')](_0x7ed688);return _0x693c9b[_0xd165('0x1e')](_0xd165('0x1f'),_0x551561+'-'+_0x529cc9+'/'+_0x30378f)[_0xd165('0x20')](_0x4c86c6);}return null;};}function patchUpdates(_0x332b0a){return function(_0x4ec084){try{jsonpatch[_0xd165('0x21')](_0x4ec084,_0x332b0a,!![]);}catch(_0x492257){return BPromise[_0xd165('0x22')](_0x492257);}return _0x4ec084[_0xd165('0x23')]();};}function saveUpdates(_0x5e9d0a,_0x46a462){return function(_0x3a3b5a){if(_0x3a3b5a){return _0x3a3b5a['update'](_0x5e9d0a)[_0xd165('0x24')](function(_0x33754b){return _0x33754b;});}return null;};}function removeEntity(_0x26ae3b,_0x5a86a2){return function(_0x36838b){if(_0x36838b){return _0x36838b[_0xd165('0x25')]()[_0xd165('0x24')](function(){_0x26ae3b[_0xd165('0x1d')](0xcc)[_0xd165('0x18')]();});}};}function handleEntityNotFound(_0x21a42e,_0x528ea8){return function(_0x43946e){if(!_0x43946e){_0x21a42e[_0xd165('0x26')](0x194);}return _0x43946e;};}function handleError(_0x3c80b7,_0x11167c){_0x11167c=_0x11167c||0x1f4;return function(_0x45183b){logger[_0xd165('0x27')](_0x45183b[_0xd165('0x28')]);if(_0x45183b['name']){delete _0x45183b[_0xd165('0x29')];}_0x3c80b7['status'](_0x11167c)[_0xd165('0x2a')](_0x45183b);};}exports[_0xd165('0x2b')]=function(_0xeefe8,_0x4c503a){var _0x2e71e3={},_0x33ef5f={},_0x1db50b={'count':0x0,'rows':[]};var _0x38f4d3=_['map'](db[_0xd165('0x2c')][_0xd165('0x2d')],function(_0x11a46c){return{'name':_0x11a46c[_0xd165('0x2e')],'type':_0x11a46c[_0xd165('0x2f')][_0xd165('0x30')]};});_0x33ef5f['model']=_[_0xd165('0x31')](_0x38f4d3,_0xd165('0x29'));_0x33ef5f['query']=_[_0xd165('0x32')](_0xeefe8[_0xd165('0x33')]);_0x33ef5f[_0xd165('0x34')]=_[_0xd165('0x35')](_0x33ef5f[_0xd165('0x36')],_0x33ef5f[_0xd165('0x33')]);_0x2e71e3['attributes']=_['intersection'](_0x33ef5f[_0xd165('0x36')],qs['fields'](_0xeefe8[_0xd165('0x33')]['fields']));_0x2e71e3[_0xd165('0x37')]=_0x2e71e3['attributes'][_0xd165('0x38')]?_0x2e71e3[_0xd165('0x37')]:_0x33ef5f[_0xd165('0x36')];if(!_0xeefe8[_0xd165('0x33')][_0xd165('0x39')](_0xd165('0x3a'))){_0x2e71e3[_0xd165('0x1c')]=qs[_0xd165('0x1c')](_0xeefe8[_0xd165('0x33')][_0xd165('0x1c')]);_0x2e71e3[_0xd165('0x19')]=qs[_0xd165('0x19')](_0xeefe8[_0xd165('0x33')][_0xd165('0x19')]);}_0x2e71e3['order']=qs[_0xd165('0x3b')](_0xeefe8[_0xd165('0x33')][_0xd165('0x3b')]);_0x2e71e3[_0xd165('0x3c')]=qs[_0xd165('0x34')](_['pick'](_0xeefe8['query'],_0x33ef5f['filters']),_0x38f4d3);if(_0xeefe8[_0xd165('0x33')][_0xd165('0x3d')]){_0x2e71e3[_0xd165('0x3c')]=_[_0xd165('0x3e')](_0x2e71e3[_0xd165('0x3c')],{'$or':_[_0xd165('0x31')](_0x38f4d3,function(_0x250200){if(_0x250200[_0xd165('0x2f')]!==_0xd165('0x3f')){var _0x1a2e19={};_0x1a2e19[_0x250200[_0xd165('0x29')]]={'$like':'%'+_0xeefe8['query'][_0xd165('0x3d')]+'%'};return _0x1a2e19;}})});}_0x2e71e3=_[_0xd165('0x3e')]({},_0x2e71e3,_0xeefe8[_0xd165('0x40')]);var _0xcafb72={'where':_0x2e71e3[_0xd165('0x3c')]};return db['JscriptyAnswerReport'][_0xd165('0x1b')](_0xcafb72)[_0xd165('0x24')](function(_0x5e3708){_0x1db50b[_0xd165('0x1b')]=_0x5e3708;if(_0xeefe8[_0xd165('0x33')][_0xd165('0x41')]){_0x2e71e3[_0xd165('0x42')]=[{'all':!![]}];}return db[_0xd165('0x2c')][_0xd165('0x43')](_0x2e71e3);})['then'](function(_0x4a5b12){_0x1db50b[_0xd165('0x44')]=_0x4a5b12;return _0x1db50b;})[_0xd165('0x24')](respondWithFilteredResult(_0x4c503a,_0x2e71e3))[_0xd165('0x45')](handleError(_0x4c503a,null));};exports[_0xd165('0x46')]=function(_0x36202f,_0x363290){var _0x290384={'raw':!![],'where':{'id':_0x36202f['params']['id']}},_0xb446f8={};_0xb446f8[_0xd165('0x36')]=_['keys'](db[_0xd165('0x2c')][_0xd165('0x2d')]);_0xb446f8[_0xd165('0x33')]=_[_0xd165('0x32')](_0x36202f[_0xd165('0x33')]);_0xb446f8[_0xd165('0x34')]=_['intersection'](_0xb446f8[_0xd165('0x36')],_0xb446f8[_0xd165('0x33')]);_0x290384[_0xd165('0x37')]=_['intersection'](_0xb446f8[_0xd165('0x36')],qs['fields'](_0x36202f[_0xd165('0x33')][_0xd165('0x47')]));_0x290384[_0xd165('0x37')]=_0x290384[_0xd165('0x37')][_0xd165('0x38')]?_0x290384[_0xd165('0x37')]:_0xb446f8[_0xd165('0x36')];if(_0x36202f['query']['includeAll']){_0x290384['include']=[{'all':!![]}];}_0x290384=_['merge']({},_0x290384,_0x36202f['options']);return db[_0xd165('0x2c')][_0xd165('0x48')](_0x290384)[_0xd165('0x24')](handleEntityNotFound(_0x363290,null))[_0xd165('0x24')](respondWithResult(_0x363290,null))[_0xd165('0x45')](handleError(_0x363290,null));};exports[_0xd165('0x49')]=function(_0x5e73e5,_0x4c729d){return db[_0xd165('0x2c')][_0xd165('0x49')](_0x5e73e5[_0xd165('0x4a')],{})[_0xd165('0x24')](respondWithResult(_0x4c729d,0xc9))[_0xd165('0x45')](handleError(_0x4c729d,null));};exports['update']=function(_0x54f064,_0xd0e787){if(_0x54f064[_0xd165('0x4a')]['id']){delete _0x54f064['body']['id'];}return db[_0xd165('0x2c')][_0xd165('0x48')]({'where':{'id':_0x54f064[_0xd165('0x4b')]['id']}})[_0xd165('0x24')](handleEntityNotFound(_0xd0e787,null))[_0xd165('0x24')](saveUpdates(_0x54f064[_0xd165('0x4a')],null))[_0xd165('0x24')](respondWithResult(_0xd0e787,null))[_0xd165('0x45')](handleError(_0xd0e787,null));};exports[_0xd165('0x25')]=function(_0x1dc329,_0x18f83d){return db['JscriptyAnswerReport'][_0xd165('0x48')]({'where':{'id':_0x1dc329[_0xd165('0x4b')]['id']}})['then'](handleEntityNotFound(_0x18f83d,null))['then'](removeEntity(_0x18f83d,null))[_0xd165('0x45')](handleError(_0x18f83d,null));};exports[_0xd165('0x4c')]=function(_0x4480ac,_0x2d06cb){return db['JscriptyAnswerReport'][_0xd165('0x4c')]()[_0xd165('0x24')](respondWithResult(_0x2d06cb,null))[_0xd165('0x45')](handleError(_0x2d06cb,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 5778a3f..9cd30bd 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 _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 +var _0x29fa=['path','rimraf','./jscriptyAnswerReport.attributes','JscriptyAnswerReport','report_jscripty_answers','lodash','../../config/logger','bluebird','request-promise'];(function(_0x274d6b,_0x3d537c){var _0x5bdb46=function(_0x3f8b06){while(--_0x3f8b06){_0x274d6b['push'](_0x274d6b['shift']());}};_0x5bdb46(++_0x3d537c);}(_0x29fa,0xb9));var _0xa29f=function(_0x3e91a9,_0x53c466){_0x3e91a9=_0x3e91a9-0x0;var _0x25c9ad=_0x29fa[_0x3e91a9];return _0x25c9ad;};'use strict';var _=require(_0xa29f('0x0'));var util=require('util');var logger=require(_0xa29f('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa29f('0x2'));var rp=require(_0xa29f('0x3'));var fs=require('fs');var path=require(_0xa29f('0x4'));var rimraf=require(_0xa29f('0x5'));var config=require('../../config/environment');var attributes=require(_0xa29f('0x6'));module['exports']=function(_0x2b833d,_0x27e94a){return _0x2b833d['define'](_0xa29f('0x7'),attributes,{'tableName':_0xa29f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 5c174e1..4a5ab50 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 _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 +var _0xf172=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','client','http','request','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch'];(function(_0x2ee20d,_0x354e70){var _0xade530=function(_0x1db7cc){while(--_0x1db7cc){_0x2ee20d['push'](_0x2ee20d['shift']());}};_0xade530(++_0x354e70);}(_0xf172,0xab));var _0x2f17=function(_0xe6612a,_0x160233){_0xe6612a=_0xe6612a-0x0;var _0x404010=_0xf172[_0xe6612a];return _0x404010;};'use strict';var _=require(_0x2f17('0x0'));var util=require(_0x2f17('0x1'));var moment=require(_0x2f17('0x2'));var BPromise=require(_0x2f17('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f17('0x4'))['db'];var utils=require(_0x2f17('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2f17('0x6')][_0x2f17('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x33c4f2,_0x28b17f,_0x575cf8){return new BPromise(function(_0x455a12,_0x119eb5){return client[_0x2f17('0x8')](_0x33c4f2,_0x575cf8)['then'](function(_0x1e1515){logger['info'](_0x2f17('0x9'),_0x28b17f,_0x2f17('0xa'));logger[_0x2f17('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x28b17f,'request\x20sent',JSON[_0x2f17('0xc')](_0x1e1515));if(_0x1e1515[_0x2f17('0xd')]){if(_0x1e1515['error'][_0x2f17('0xe')]===0x1f4){logger['error'](_0x2f17('0x9'),_0x28b17f,_0x1e1515[_0x2f17('0xd')][_0x2f17('0xf')]);return _0x119eb5(_0x1e1515[_0x2f17('0xd')]['message']);}logger[_0x2f17('0xd')](_0x2f17('0x9'),_0x28b17f,_0x1e1515['error']['message']);return _0x455a12(_0x1e1515[_0x2f17('0xd')]['message']);}else{logger[_0x2f17('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x28b17f,_0x2f17('0xa'));_0x455a12(_0x1e1515[_0x2f17('0x11')][_0x2f17('0xf')]);}})[_0x2f17('0x12')](function(_0x26bd0c){logger[_0x2f17('0xd')](_0x2f17('0x9'),_0x28b17f,_0x26bd0c);_0x119eb5(_0x26bd0c);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index c498ce7..30ed5e9 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 _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 +var _0x6898=['../../config/environment','./jscriptyProject.controller','get','index','/:id','isAuthenticated','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','put','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6898,0x199));var _0x8689=function(_0x13dba5,_0x9c86f6){_0x13dba5=_0x13dba5-0x0;var _0x4189b8=_0x6898[_0x13dba5];return _0x4189b8;};'use strict';var multer=require('multer');var util=require(_0x8689('0x0'));var path=require(_0x8689('0x1'));var timeout=require(_0x8689('0x2'));var express=require(_0x8689('0x3'));var router=express[_0x8689('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8689('0x5'));var interaction=require(_0x8689('0x6'));var config=require(_0x8689('0x7'));var controller=require(_0x8689('0x8'));router[_0x8689('0x9')]('/',auth['isAuthenticated'](),controller[_0x8689('0xa')]);router[_0x8689('0x9')](_0x8689('0xb'),auth[_0x8689('0xc')](),controller['show']);router['get'](_0x8689('0xd'),auth['isAuthenticated'](),controller[_0x8689('0xe')]);router['get'](_0x8689('0xf'),auth[_0x8689('0xc')](),controller[_0x8689('0x10')]);router[_0x8689('0x9')](_0x8689('0x11'),auth['isAuthenticated'](),timeout(_0x8689('0x12')),controller[_0x8689('0x13')]);router[_0x8689('0x14')]('/',auth[_0x8689('0xc')](),controller[_0x8689('0x15')]);router[_0x8689('0x14')](_0x8689('0x16'),auth[_0x8689('0xc')](),controller[_0x8689('0x17')]);router[_0x8689('0x18')](_0x8689('0xb'),auth[_0x8689('0xc')](),controller['update']);router['delete'](_0x8689('0xb'),auth[_0x8689('0xc')](),controller[_0x8689('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 1e9c14e..6b48c25 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 _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 +var _0x6e89=['TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','exports','STRING','name'];(function(_0xd066c8,_0x46b223){var _0x369df2=function(_0x314fb9){while(--_0x314fb9){_0xd066c8['push'](_0xd066c8['shift']());}};_0x369df2(++_0x46b223);}(_0x6e89,0x6c));var _0x96e8=function(_0x2a7875,_0x593104){_0x2a7875=_0x2a7875-0x0;var _0x55b782=_0x6e89[_0x2a7875];return _0x55b782;};'use strict';var Sequelize=require(_0x96e8('0x0'));var _=require('lodash');var util=require('util');module[_0x96e8('0x1')]={'name':{'type':Sequelize[_0x96e8('0x2')],'unique':_0x96e8('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x96e8('0x4')](_0x96e8('0x5')),'set':function(_0x112104){if(_[_0x96e8('0x6')](_0x112104)){this[_0x96e8('0x7')](_0x96e8('0x8'),JSON[_0x96e8('0x9')](_0x112104));}else if(_[_0x96e8('0xa')](_0x112104)){this['setDataValue'](_0x96e8('0x8'),_0x112104);}else{this[_0x96e8('0x7')](_0x96e8('0x8'),util[_0x96e8('0xb')](_0x96e8('0xc'),this[_0x96e8('0xd')](_0x96e8('0x3'))||'',this[_0x96e8('0xd')](_0x96e8('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x96e8('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 2076dbd..3f68104 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 _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 +var _0x38e7=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','JscriptyProject','include','rows','show','params','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Projects','UserProfileSection','userProfileId','UserProfileResource','includeAll','options','get','omit','createdAt','updatedAt','body','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','order','pick','ProjectId','findAll','getAnswers','findOne','JscriptyAnswerReport','number','toString','indexOf','replace','startTime','starttime','parse','JscriptySessionReport','JscriptyQuestionReport','-createdAt','questionId','question','answer','push','isEmpty','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format'];(function(_0x87212a,_0x360989){var _0x216047=function(_0x4d9ccf){while(--_0x4d9ccf){_0x87212a['push'](_0x87212a['shift']());}};_0x216047(++_0x360989);}(_0x38e7,0x1eb));var _0x738e=function(_0xabbd2f,_0x44d05a){_0xabbd2f=_0xabbd2f-0x0;var _0x34a040=_0x38e7[_0xabbd2f];return _0x34a040;};'use strict';var emlformat=require(_0x738e('0x0'));var rimraf=require(_0x738e('0x1'));var zipdir=require(_0x738e('0x2'));var jsonpatch=require(_0x738e('0x3'));var rp=require(_0x738e('0x4'));var moment=require(_0x738e('0x5'));var BPromise=require(_0x738e('0x6'));var Mustache=require(_0x738e('0x7'));var util=require(_0x738e('0x8'));var path=require(_0x738e('0x9'));var sox=require(_0x738e('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x738e('0xb'));var squel=require(_0x738e('0xc'));var crypto=require(_0x738e('0xd'));var jsforce=require(_0x738e('0xe'));var deskjs=require(_0x738e('0xf'));var toCsv=require(_0x738e('0x10'));var querystring=require(_0x738e('0x11'));var Papa=require(_0x738e('0x12'));var Redis=require(_0x738e('0x13'));var authService=require(_0x738e('0x14'));var qs=require(_0x738e('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x738e('0x16'))('api');var utils=require(_0x738e('0x17'));var config=require(_0x738e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x738e('0x19'))['db'];function respondWithStatusCode(_0x493d1a,_0x1766f2){_0x1766f2=_0x1766f2||0xcc;return function(_0x579327){if(_0x579327){return _0x493d1a[_0x738e('0x1a')](_0x1766f2);}return _0x493d1a[_0x738e('0x1b')](_0x1766f2)[_0x738e('0x1c')]();};}function respondWithResult(_0x2253a0,_0x485f03){_0x485f03=_0x485f03||0xc8;return function(_0x26e9a0){if(_0x26e9a0){return _0x2253a0[_0x738e('0x1b')](_0x485f03)[_0x738e('0x1d')](_0x26e9a0);}};}function respondWithFilteredResult(_0x2af80f,_0x463be3){return function(_0x1a8215){if(_0x1a8215){var _0x5edf88=typeof _0x463be3[_0x738e('0x1e')]===_0x738e('0x1f')&&typeof _0x463be3['limit']===_0x738e('0x1f');var _0x56d8e1=_0x1a8215[_0x738e('0x20')];var _0x3add89=_0x5edf88?0x0:_0x463be3[_0x738e('0x1e')];var _0x130bc5=_0x5edf88?_0x1a8215[_0x738e('0x20')]:_0x463be3[_0x738e('0x1e')]+_0x463be3[_0x738e('0x21')];var _0x498284;if(_0x130bc5>=_0x56d8e1){_0x130bc5=_0x56d8e1;_0x498284=0xc8;}else{_0x498284=0xce;}_0x2af80f[_0x738e('0x1b')](_0x498284);return _0x2af80f['set'](_0x738e('0x22'),_0x3add89+'-'+_0x130bc5+'/'+_0x56d8e1)[_0x738e('0x1d')](_0x1a8215);}return null;};}function patchUpdates(_0xb1d393){return function(_0x5f2d11){try{jsonpatch[_0x738e('0x23')](_0x5f2d11,_0xb1d393,!![]);}catch(_0x2bb2ff){return BPromise[_0x738e('0x24')](_0x2bb2ff);}return _0x5f2d11[_0x738e('0x25')]();};}function saveUpdates(_0xca9396,_0x3d8c4b){return function(_0x48ffbe){if(_0x48ffbe){return _0x48ffbe[_0x738e('0x26')](_0xca9396)[_0x738e('0x27')](function(_0x500473){return _0x500473;});}return null;};}function removeEntity(_0x309187,_0x609ed6){return function(_0xf1cde0){if(_0xf1cde0){return _0xf1cde0['destroy']()[_0x738e('0x27')](function(){var _0x17673=_0xf1cde0['get']({'plain':!![]});var _0x275850='Projects';return db['UserProfileResource'][_0x738e('0x28')]({'where':{'type':_0x275850,'resourceId':_0x17673['id']}})[_0x738e('0x27')](function(){return _0xf1cde0;});})[_0x738e('0x27')](function(){_0x309187[_0x738e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c6efd,_0x3ba474){return function(_0x3b4a25){if(!_0x3b4a25){_0x3c6efd[_0x738e('0x1a')](0x194);}return _0x3b4a25;};}function handleError(_0x17b36a,_0x37c2dc){_0x37c2dc=_0x37c2dc||0x1f4;return function(_0x2e3a94){logger[_0x738e('0x29')](_0x2e3a94[_0x738e('0x2a')]);if(_0x2e3a94[_0x738e('0x2b')]){delete _0x2e3a94[_0x738e('0x2b')];}_0x17b36a[_0x738e('0x1b')](_0x37c2dc)[_0x738e('0x2c')](_0x2e3a94);};}exports[_0x738e('0x2d')]=function(_0x1ebcb6,_0x587276){var _0x3216ac={},_0x11cfb0={},_0x2b98fe={'count':0x0,'rows':[]};var _0x155ab9=_['map'](db['JscriptyProject'][_0x738e('0x2e')],function(_0x3963e){return{'name':_0x3963e['fieldName'],'type':_0x3963e[_0x738e('0x2f')][_0x738e('0x30')]};});_0x11cfb0[_0x738e('0x31')]=_[_0x738e('0x32')](_0x155ab9,_0x738e('0x2b'));_0x11cfb0[_0x738e('0x33')]=_[_0x738e('0x34')](_0x1ebcb6['query']);_0x11cfb0[_0x738e('0x35')]=_[_0x738e('0x36')](_0x11cfb0[_0x738e('0x31')],_0x11cfb0[_0x738e('0x33')]);_0x3216ac[_0x738e('0x37')]=_[_0x738e('0x36')](_0x11cfb0[_0x738e('0x31')],qs[_0x738e('0x38')](_0x1ebcb6[_0x738e('0x33')][_0x738e('0x38')]));_0x3216ac['attributes']=_0x3216ac[_0x738e('0x37')][_0x738e('0x39')]?_0x3216ac[_0x738e('0x37')]:_0x11cfb0['model'];if(!_0x1ebcb6['query'][_0x738e('0x3a')](_0x738e('0x3b'))){_0x3216ac[_0x738e('0x21')]=qs[_0x738e('0x21')](_0x1ebcb6[_0x738e('0x33')][_0x738e('0x21')]);_0x3216ac[_0x738e('0x1e')]=qs['offset'](_0x1ebcb6['query'][_0x738e('0x1e')]);}_0x3216ac['order']=qs[_0x738e('0x3c')](_0x1ebcb6[_0x738e('0x33')]['sort']);_0x3216ac[_0x738e('0x3d')]=qs[_0x738e('0x35')](_['pick'](_0x1ebcb6[_0x738e('0x33')],_0x11cfb0[_0x738e('0x35')]),_0x155ab9);if(_0x1ebcb6[_0x738e('0x33')][_0x738e('0x3e')]){_0x3216ac[_0x738e('0x3d')]=_[_0x738e('0x3f')](_0x3216ac[_0x738e('0x3d')],{'$or':_[_0x738e('0x32')](_0x155ab9,function(_0x495e9d){if(_0x495e9d[_0x738e('0x2f')]!==_0x738e('0x40')){var _0x23d12b={};_0x23d12b[_0x495e9d[_0x738e('0x2b')]]={'$like':'%'+_0x1ebcb6[_0x738e('0x33')][_0x738e('0x3e')]+'%'};return _0x23d12b;}})});}_0x3216ac=_[_0x738e('0x3f')]({},_0x3216ac,_0x1ebcb6['options']);var _0x597768={'where':_0x3216ac['where']};return db[_0x738e('0x41')]['count'](_0x597768)['then'](function(_0x42a19f){_0x2b98fe[_0x738e('0x20')]=_0x42a19f;if(_0x1ebcb6['query']['includeAll']){_0x3216ac[_0x738e('0x42')]=[{'all':!![]}];}return db[_0x738e('0x41')]['findAll'](_0x3216ac);})[_0x738e('0x27')](function(_0x5e5d37){_0x2b98fe[_0x738e('0x43')]=_0x5e5d37;return _0x2b98fe;})[_0x738e('0x27')](respondWithFilteredResult(_0x587276,_0x3216ac))['catch'](handleError(_0x587276,null));};exports[_0x738e('0x44')]=function(_0x3950b1,_0x2dd327){var _0x51f1a5={'raw':![],'where':{'id':_0x3950b1[_0x738e('0x45')]['id']}},_0x78604a={};_0x78604a[_0x738e('0x31')]=_[_0x738e('0x34')](db[_0x738e('0x41')][_0x738e('0x2e')]);_0x78604a['query']=_[_0x738e('0x34')](_0x3950b1['query']);_0x78604a['filters']=_['intersection'](_0x78604a[_0x738e('0x31')],_0x78604a[_0x738e('0x33')]);_0x51f1a5[_0x738e('0x37')]=_[_0x738e('0x36')](_0x78604a[_0x738e('0x31')],qs[_0x738e('0x38')](_0x3950b1[_0x738e('0x33')]['fields']));_0x51f1a5[_0x738e('0x37')]=_0x51f1a5['attributes']['length']?_0x51f1a5['attributes']:_0x78604a[_0x738e('0x31')];if(_0x3950b1['query']['includeAll']){_0x51f1a5[_0x738e('0x42')]=[{'all':!![]}];}_0x51f1a5=_['merge']({},_0x51f1a5,_0x3950b1['options']);return db[_0x738e('0x41')][_0x738e('0x46')](_0x51f1a5)['then'](handleEntityNotFound(_0x2dd327,null))[_0x738e('0x27')](respondWithResult(_0x2dd327,null))[_0x738e('0x47')](handleError(_0x2dd327,null));};exports[_0x738e('0x48')]=function(_0x1a7ca1,_0x436f70){return db['JscriptyProject'][_0x738e('0x48')](_0x1a7ca1['body'],{})[_0x738e('0x27')](function(_0x38ed07){var _0x4937f2=_0x1a7ca1[_0x738e('0x49')]['get']({'plain':!![]});if(!_0x4937f2)throw new Error(_0x738e('0x4a'));if(_0x4937f2['role']===_0x738e('0x49')){var _0x4708bc=_0x38ed07['get']({'plain':!![]});var _0x4cc997=_0x738e('0x4b');return db[_0x738e('0x4c')][_0x738e('0x46')]({'where':{'name':_0x4cc997,'userProfileId':_0x4937f2[_0x738e('0x4d')]},'raw':!![]})[_0x738e('0x27')](function(_0x1c528b){if(_0x1c528b&&_0x1c528b['autoAssociation']===0x0){return db[_0x738e('0x4e')][_0x738e('0x48')]({'name':_0x4708bc['name'],'resourceId':_0x4708bc['id'],'type':_0x1c528b['name'],'sectionId':_0x1c528b['id']},{})['then'](function(){return _0x38ed07;});}else{return _0x38ed07;}})['catch'](function(_0x519657){logger[_0x738e('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x519657);throw _0x519657;});}return _0x38ed07;})[_0x738e('0x27')](respondWithResult(_0x436f70,0xc9))[_0x738e('0x47')](handleError(_0x436f70,null));};exports['clone']=function(_0x30fd23,_0x36561d){var _0x17c3d5={'where':{'id':_0x30fd23[_0x738e('0x45')]['id']}},_0x51111e={};_0x51111e['model']=_['keys'](db['JscriptyProject'][_0x738e('0x2e')]);_0x17c3d5['attributes']=_[_0x738e('0x36')](_0x51111e['model'],qs['fields'](_0x30fd23[_0x738e('0x33')][_0x738e('0x38')]));_0x17c3d5[_0x738e('0x37')]=_0x17c3d5[_0x738e('0x37')]['length']?_0x17c3d5['attributes']:_0x51111e['model'];if(_0x30fd23[_0x738e('0x33')][_0x738e('0x4f')]){_0x17c3d5[_0x738e('0x42')]=[{'all':!![]}];}_0x17c3d5=_[_0x738e('0x3f')]({},_0x17c3d5,_0x30fd23[_0x738e('0x50')]);return db['JscriptyProject'][_0x738e('0x46')](_0x17c3d5)[_0x738e('0x27')](handleEntityNotFound(_0x36561d,null))[_0x738e('0x27')](function(_0x12a381){if(_0x12a381){var _0x203644=_0x12a381[_0x738e('0x51')]({'plain':!![]});_0x203644=qs[_0x738e('0x52')](_0x203644,['id',_0x738e('0x53'),_0x738e('0x54')]);_0x30fd23[_0x738e('0x55')]=_[_0x738e('0x52')](_0x30fd23[_0x738e('0x55')],['id',_0x738e('0x53'),_0x738e('0x54')]);return db[_0x738e('0x41')][_0x738e('0x48')](_['merge'](_0x203644,_0x30fd23[_0x738e('0x55')]),{'include':_0x30fd23[_0x738e('0x33')][_0x738e('0x4f')]?[{'all':!![]}]:undefined})[_0x738e('0x27')](function(_0x25d9d9){var _0xafc5bf=_0x30fd23['user'][_0x738e('0x51')]({'plain':!![]});if(!_0xafc5bf)throw new Error(_0x738e('0x4a'));if(_0xafc5bf[_0x738e('0x56')]===_0x738e('0x49')){var _0xfeeb5c=_0x25d9d9[_0x738e('0x51')]({'plain':!![]});var _0x361bb5=_0x738e('0x4b');return db[_0x738e('0x4c')][_0x738e('0x46')]({'where':{'name':_0x361bb5,'userProfileId':_0xafc5bf[_0x738e('0x4d')]},'raw':!![]})['then'](function(_0x4a4c24){if(_0x4a4c24&&_0x4a4c24[_0x738e('0x57')]===0x0){return db[_0x738e('0x4e')][_0x738e('0x48')]({'name':_0xfeeb5c['name'],'resourceId':_0xfeeb5c['id'],'type':_0x4a4c24[_0x738e('0x2b')],'sectionId':_0x4a4c24['id']},{})[_0x738e('0x27')](function(){return _0x25d9d9;});}else{return _0x25d9d9;}})[_0x738e('0x47')](function(_0x3ba754){logger[_0x738e('0x29')](_0x738e('0x58'),_0x3ba754);throw _0x3ba754;});}return _0x25d9d9;});}})['then'](respondWithResult(_0x36561d,0xc9))['catch'](handleError(_0x36561d,null));};exports[_0x738e('0x26')]=function(_0x147cb8,_0x384f2c){if(_0x147cb8[_0x738e('0x55')]['id']){delete _0x147cb8[_0x738e('0x55')]['id'];}return db[_0x738e('0x41')]['find']({'where':{'id':_0x147cb8[_0x738e('0x45')]['id']}})[_0x738e('0x27')](handleEntityNotFound(_0x384f2c,null))[_0x738e('0x27')](saveUpdates(_0x147cb8[_0x738e('0x55')],null))[_0x738e('0x27')](respondWithResult(_0x384f2c,null))[_0x738e('0x47')](handleError(_0x384f2c,null));};exports[_0x738e('0x28')]=function(_0x57b170,_0x14b8d2){return db[_0x738e('0x41')][_0x738e('0x46')]({'where':{'id':_0x57b170['params']['id']}})[_0x738e('0x27')](handleEntityNotFound(_0x14b8d2,null))[_0x738e('0x27')](removeEntity(_0x14b8d2,null))[_0x738e('0x47')](handleError(_0x14b8d2,null));};exports[_0x738e('0x59')]=function(_0x499c04,_0x3274ef,_0x32356e){var _0x257eb3={'raw':!![],'where':{}};var _0x7f5076={};var _0xbee7db={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x499c04[_0x738e('0x45')]['id']}})['then'](handleEntityNotFound(_0x3274ef,null))[_0x738e('0x27')](function(_0x3a8dde){if(_0x3a8dde){_0x7f5076[_0x738e('0x31')]=_[_0x738e('0x34')](db['JscriptySessionReport'][_0x738e('0x2e')]);_0x7f5076[_0x738e('0x33')]=_['keys'](_0x499c04[_0x738e('0x33')]);_0x7f5076[_0x738e('0x35')]=_['intersection'](_0x7f5076[_0x738e('0x31')],_0x7f5076[_0x738e('0x33')]);_0x257eb3[_0x738e('0x37')]=_[_0x738e('0x36')](_0x7f5076[_0x738e('0x31')],qs[_0x738e('0x38')](_0x499c04[_0x738e('0x33')][_0x738e('0x38')]));_0x257eb3[_0x738e('0x37')]=_0x257eb3[_0x738e('0x37')][_0x738e('0x39')]?_0x257eb3[_0x738e('0x37')]:_0x7f5076[_0x738e('0x31')];if(!_0x499c04[_0x738e('0x33')][_0x738e('0x3a')](_0x738e('0x3b'))){_0x257eb3[_0x738e('0x21')]=qs[_0x738e('0x21')](_0x499c04[_0x738e('0x33')][_0x738e('0x21')]);_0x257eb3[_0x738e('0x1e')]=qs[_0x738e('0x1e')](_0x499c04[_0x738e('0x33')][_0x738e('0x1e')]);}_0x257eb3[_0x738e('0x5a')]=qs[_0x738e('0x3c')](_0x499c04[_0x738e('0x33')][_0x738e('0x3c')]);_0x257eb3[_0x738e('0x3d')]=qs[_0x738e('0x35')](_[_0x738e('0x5b')](_0x499c04[_0x738e('0x33')],_0x7f5076[_0x738e('0x35')]));_0x257eb3['where'][_0x738e('0x5c')]=_0x3a8dde['id'];if(_0x499c04[_0x738e('0x33')][_0x738e('0x3e')]){_0x257eb3[_0x738e('0x3d')]=_[_0x738e('0x3f')](_0x257eb3[_0x738e('0x3d')],{'$or':_[_0x738e('0x32')](_0x257eb3[_0x738e('0x37')],function(_0x27a02f){var _0x180afd={};_0x180afd[_0x27a02f]={'$like':'%'+_0x499c04[_0x738e('0x33')][_0x738e('0x3e')]+'%'};return _0x180afd;})});}_0x257eb3=_['merge']({},_0x257eb3,_0x499c04[_0x738e('0x50')]);return db['JscriptySessionReport'][_0x738e('0x20')]({'where':_0x257eb3[_0x738e('0x3d')]})[_0x738e('0x27')](function(_0x1c572f){_0xbee7db['count']=_0x1c572f;if(_0x499c04['query'][_0x738e('0x4f')]){_0x257eb3['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x738e('0x5d')](_0x257eb3);})[_0x738e('0x27')](function(_0x5a986f){_0xbee7db['rows']=_0x5a986f;return _0xbee7db;});}})[_0x738e('0x27')](respondWithFilteredResult(_0x3274ef,_0x257eb3))[_0x738e('0x47')](handleError(_0x3274ef,null));};exports[_0x738e('0x5e')]=function(_0x512492,_0x21476e,_0x5a94bd){var _0x52222a={'raw':!![],'where':{}};var _0x497704={};var _0x4c7bfe={'count':0x0,'rows':[]};return db[_0x738e('0x41')][_0x738e('0x5f')]({'where':{'id':_0x512492[_0x738e('0x45')]['id']}})[_0x738e('0x27')](handleEntityNotFound(_0x21476e,null))[_0x738e('0x27')](function(_0x3ddc36){if(_0x3ddc36){_0x497704[_0x738e('0x31')]=_['keys'](db[_0x738e('0x60')][_0x738e('0x2e')]);_0x497704[_0x738e('0x33')]=_['keys'](_0x512492[_0x738e('0x33')]);_0x497704[_0x738e('0x35')]=_[_0x738e('0x36')](_0x497704[_0x738e('0x31')],_0x497704['query']);_0x52222a[_0x738e('0x37')]=_[_0x738e('0x36')](_0x497704[_0x738e('0x31')],qs[_0x738e('0x38')](_0x512492[_0x738e('0x33')][_0x738e('0x38')]));_0x52222a[_0x738e('0x37')]=_0x52222a[_0x738e('0x37')][_0x738e('0x39')]?_0x52222a[_0x738e('0x37')]:_0x497704[_0x738e('0x31')];if(!_0x512492[_0x738e('0x33')]['hasOwnProperty'](_0x738e('0x3b'))){_0x52222a['limit']=qs[_0x738e('0x21')](_0x512492['query'][_0x738e('0x21')]);_0x52222a[_0x738e('0x1e')]=qs['offset'](_0x512492['query'][_0x738e('0x1e')]);}_0x52222a[_0x738e('0x5a')]=qs[_0x738e('0x3c')](_0x512492['query']['sort']);_0x52222a[_0x738e('0x3d')]=qs[_0x738e('0x35')](_[_0x738e('0x5b')](_0x512492[_0x738e('0x33')],_0x497704['filters']));_0x52222a[_0x738e('0x3d')][_0x738e('0x5c')]=_0x3ddc36['id'];if(_0x512492[_0x738e('0x33')][_0x738e('0x3e')]){_0x52222a['where']=_[_0x738e('0x3f')](_0x52222a[_0x738e('0x3d')],{'$or':_[_0x738e('0x32')](_0x52222a['attributes'],function(_0x55099e){var _0x1a4c8a={};_0x1a4c8a[_0x55099e]={'$like':'%'+_0x512492['query'][_0x738e('0x3e')]+'%'};return _0x1a4c8a;})});}_0x52222a=_[_0x738e('0x3f')]({},_0x52222a,_0x512492['options']);return db['JscriptyAnswerReport'][_0x738e('0x20')]({'where':_0x52222a['where']})[_0x738e('0x27')](function(_0xb9a0f8){_0x4c7bfe[_0x738e('0x20')]=_0xb9a0f8;if(_0x512492['query'][_0x738e('0x4f')]){_0x52222a['include']=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x52222a);})[_0x738e('0x27')](function(_0x4f20c3){_0x4c7bfe['rows']=_0x4f20c3;return _0x4c7bfe;});}})[_0x738e('0x27')](respondWithFilteredResult(_0x21476e,_0x52222a))[_0x738e('0x47')](handleError(_0x21476e,null));};function char(_0x4e0cbc){return _0x738e('0x61')===typeof _0x4e0cbc?String['fromCharCode'][_0x738e('0x23')](null,arguments):_0x4e0cbc;}function needsEncapsulation(_0x318b55){return!!_0x318b55&&(_0x318b55[_0x738e('0x62')]()[_0x738e('0x63')](char(0xd))>=0x0||_0x318b55[_0x738e('0x62')]()['indexOf'](char(0xa))>=0x0||_0x318b55[_0x738e('0x62')]()[_0x738e('0x63')](char(0x2c))>=0x0||_0x318b55[_0x738e('0x62')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x40d06c){var _0x22e789=char(0x22),_0x33a843='\x5c'+char(0x22),_0x48eb41=_0x40d06c[_0x738e('0x62')]()[_0x738e('0x64')](new RegExp(_0x22e789,'g'),_0x33a843);return _0x22e789+_0x48eb41+_0x22e789;}exports['getSummary']=function(_0x4b1a47,_0x1c3609,_0x5ec459){var _0xddf6ca,_0x275afa;var _0x49fe73={'where':{'ProjectId':_0x4b1a47[_0x738e('0x45')]['id']}};if(_0x4b1a47[_0x738e('0x33')][_0x738e('0x65')]){_0x49fe73['where'][_0x738e('0x66')]=JSON[_0x738e('0x67')](_0x4b1a47[_0x738e('0x33')][_0x738e('0x65')]);}return db[_0x738e('0x68')]['findAll'](_0x49fe73)[_0x738e('0x27')](handleEntityNotFound(_0x1c3609,null))[_0x738e('0x27')](function(_0x1a9ff8){if(_0x1a9ff8){_0xddf6ca=_0x1a9ff8;return db[_0x738e('0x69')][_0x738e('0x5d')]({'where':{'SessionId':{'$in':_[_0x738e('0x32')](_0xddf6ca,'id')},'ProjectId':_0x4b1a47[_0x738e('0x45')]['id']},'order':_0x738e('0x6a')});}})[_0x738e('0x27')](handleEntityNotFound(_0x1c3609,null))[_0x738e('0x27')](function(_0x2bbf1d){if(_0x2bbf1d){_0x275afa=_0x2bbf1d;var _0x429480={};for(var _0x565d52=0x0,_0x527b7d=_0x275afa['length'];_0x565d52<_0x527b7d;_0x565d52++){if(!_0x429480[_0x738e('0x3a')](_0x275afa[_0x565d52][_0x738e('0x6b')])){_0x429480[_0x275afa[_0x565d52][_0x738e('0x6b')]]=needsEncapsulation(_0x275afa[_0x565d52][_0x738e('0x6c')])?encapsulate(_0x275afa[_0x565d52][_0x738e('0x6c')]):_0x275afa[_0x565d52][_0x738e('0x6c')];}}var _0x1dece0=[],_0x2982dc={};for(var _0x3155a2=0x0,_0x2e1797=_0xddf6ca['length'];_0x3155a2<_0x2e1797;_0x3155a2++){_0x2982dc={'ProjectId':_0x4b1a47['params']['id'],'SessionId':_0xddf6ca[_0x3155a2]['id'],'StartTime':moment(_0xddf6ca[_0x3155a2]['starttime'])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x4e9380=0x0,_0x4cc06d=_0x275afa[_0x738e('0x39')];_0x4e9380<_0x4cc06d;_0x4e9380++){if(_0x275afa[_0x4e9380]['SessionId']==_0xddf6ca[_0x3155a2]['id']&&_0x429480[_0x738e('0x3a')](_0x275afa[_0x4e9380]['questionId'])){_0x2982dc[_0x429480[_0x275afa[_0x4e9380]['questionId']]]=_0x275afa[_0x4e9380][_0x738e('0x6d')];}}for(var _0xfd9cc in _0x429480){if(!_0x2982dc[_0x738e('0x3a')](_0x429480[_0xfd9cc])){_0x2982dc[_0x429480[_0xfd9cc]]=null;}}_0x1dece0[_0x738e('0x6e')](_0x2982dc);}return _0x1dece0;}})[_0x738e('0x27')](function(_0x3e2aee){if(!_[_0x738e('0x6f')](_0x3e2aee)){var _0x16ec4f=toCsv(_0x3e2aee);var _0x29b447=Date[_0x738e('0x70')]();fs[_0x738e('0x71')](util[_0x738e('0x72')](_0x738e('0x73'),_0x4b1a47[_0x738e('0x45')]['id'],_0x29b447),_0x16ec4f);_0x1c3609[_0x738e('0x74')](_0x738e('0x75'),_0x738e('0x76')+util[_0x738e('0x72')](_0x738e('0x77'),_0x4b1a47[_0x738e('0x45')]['id'],_0x29b447));_0x1c3609[_0x738e('0x74')](_0x738e('0x78'),_0x738e('0x79'));return _0x1c3609[_0x738e('0x7a')](util['format'](_0x738e('0x73'),_0x4b1a47[_0x738e('0x45')]['id'],_0x29b447));}else{return _0x1c3609[_0x738e('0x1a')](0xcc);}})[_0x738e('0x47')](handleError(_0x1c3609,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 35108bd..fc38f56 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 _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 +var _0xa2c8=['exports','define','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x4078af,_0x4e6fb2){var _0x346a6c=function(_0x51aa02){while(--_0x51aa02){_0x4078af['push'](_0x4078af['shift']());}};_0x346a6c(++_0x4e6fb2);}(_0xa2c8,0x99));var _0x8a2c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa2c8[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8a2c('0x0'));var util=require(_0x8a2c('0x1'));var logger=require(_0x8a2c('0x2'))(_0x8a2c('0x3'));var moment=require(_0x8a2c('0x4'));var BPromise=require(_0x8a2c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a2c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module[_0x8a2c('0x7')]=function(_0x40fb26,_0x3f754a){return _0x40fb26[_0x8a2c('0x8')]('JscriptyProject',attributes,{'tableName':_0x8a2c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 7b421df..5482474 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 _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 +var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','JscriptyProject,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x37c471,_0x5a2f41){var _0x27feb5=function(_0x2e534d){while(--_0x2e534d){_0x37c471['push'](_0x37c471['shift']());}};_0x27feb5(++_0x5a2f41);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'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']('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('JscriptyProject,\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')]('JscriptyProject,\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')]('JscriptyProject,\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 diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 2f9ff23..986dcab 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 _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 +var _0xf119=['Router','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','index','describe','post','create','update','/:id','destroy','multer','util','path','connect-timeout','express'];(function(_0x121d5c,_0x1fe2c4){var _0x2b817a=function(_0x57a8a3){while(--_0x57a8a3){_0x121d5c['push'](_0x121d5c['shift']());}};_0x2b817a(++_0x1fe2c4);}(_0xf119,0x1ab));var _0x9f11=function(_0x3656ea,_0x38108b){_0x3656ea=_0x3656ea-0x0;var _0x6d3e9b=_0xf119[_0x3656ea];return _0x6d3e9b;};'use strict';var multer=require(_0x9f11('0x0'));var util=require(_0x9f11('0x1'));var path=require(_0x9f11('0x2'));var timeout=require(_0x9f11('0x3'));var express=require(_0x9f11('0x4'));var router=express[_0x9f11('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9f11('0x6'));var interaction=require(_0x9f11('0x7'));var config=require('../../config/environment');var controller=require(_0x9f11('0x8'));router[_0x9f11('0x9')]('/',auth[_0x9f11('0xa')](),controller[_0x9f11('0xb')]);router['get']('/describe',auth[_0x9f11('0xa')](),controller[_0x9f11('0xc')]);router[_0x9f11('0x9')]('/:id',auth[_0x9f11('0xa')](),controller['show']);router[_0x9f11('0xd')]('/',auth[_0x9f11('0xa')](),controller[_0x9f11('0xe')]);router['put']('/:id',auth[_0x9f11('0xa')](),controller[_0x9f11('0xf')]);router['delete'](_0x9f11('0x10'),auth[_0x9f11('0xa')](),controller[_0x9f11('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index a6af062..45cd8f6 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(_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 +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x7a54,0x106));var _0x47a5=function(_0x3ddb60,_0x415bae){_0x3ddb60=_0x3ddb60-0x0;var _0x4a0149=_0x7a54[_0x3ddb60];return _0x4a0149;};'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 a7ee555..174bc13 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 _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 +var _0xd432=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','JscriptyQuestionReport','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x1599a5,_0x1cede4){var _0x580593=function(_0x26c0f8){while(--_0x26c0f8){_0x1599a5['push'](_0x1599a5['shift']());}};_0x580593(++_0x1cede4);}(_0xd432,0x15c));var _0x2d43=function(_0x3f3240,_0x5990ca){_0x3f3240=_0x3f3240-0x0;var _0x5eaf2d=_0xd432[_0x3f3240];return _0x5eaf2d;};'use strict';var emlformat=require(_0x2d43('0x0'));var rimraf=require(_0x2d43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d43('0x2'));var rp=require(_0x2d43('0x3'));var moment=require(_0x2d43('0x4'));var BPromise=require(_0x2d43('0x5'));var Mustache=require(_0x2d43('0x6'));var util=require(_0x2d43('0x7'));var path=require(_0x2d43('0x8'));var sox=require(_0x2d43('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d43('0xa'));var squel=require(_0x2d43('0xb'));var crypto=require('crypto');var jsforce=require(_0x2d43('0xc'));var deskjs=require(_0x2d43('0xd'));var toCsv=require(_0x2d43('0xe'));var querystring=require(_0x2d43('0xf'));var Papa=require(_0x2d43('0x10'));var Redis=require(_0x2d43('0x11'));var authService=require(_0x2d43('0x12'));var qs=require(_0x2d43('0x13'));var as=require(_0x2d43('0x14'));var hardwareService=require(_0x2d43('0x15'));var logger=require(_0x2d43('0x16'))('api');var utils=require(_0x2d43('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2d43('0x18'));var db=require(_0x2d43('0x19'))['db'];function respondWithStatusCode(_0x24ebe8,_0x5b7420){_0x5b7420=_0x5b7420||0xcc;return function(_0xeda33e){if(_0xeda33e){return _0x24ebe8[_0x2d43('0x1a')](_0x5b7420);}return _0x24ebe8[_0x2d43('0x1b')](_0x5b7420)['end']();};}function respondWithResult(_0xea5d9,_0x2845ef){_0x2845ef=_0x2845ef||0xc8;return function(_0x111862){if(_0x111862){return _0xea5d9[_0x2d43('0x1b')](_0x2845ef)[_0x2d43('0x1c')](_0x111862);}};}function respondWithFilteredResult(_0x58b06b,_0x1d2cae){return function(_0x40ff52){if(_0x40ff52){var _0x597182=typeof _0x1d2cae[_0x2d43('0x1d')]===_0x2d43('0x1e')&&typeof _0x1d2cae[_0x2d43('0x1f')]===_0x2d43('0x1e');var _0x150d90=_0x40ff52[_0x2d43('0x20')];var _0x44a45b=_0x597182?0x0:_0x1d2cae[_0x2d43('0x1d')];var _0x280b49=_0x597182?_0x40ff52[_0x2d43('0x20')]:_0x1d2cae[_0x2d43('0x1d')]+_0x1d2cae['limit'];var _0x1abcf1;if(_0x280b49>=_0x150d90){_0x280b49=_0x150d90;_0x1abcf1=0xc8;}else{_0x1abcf1=0xce;}_0x58b06b[_0x2d43('0x1b')](_0x1abcf1);return _0x58b06b[_0x2d43('0x21')](_0x2d43('0x22'),_0x44a45b+'-'+_0x280b49+'/'+_0x150d90)[_0x2d43('0x1c')](_0x40ff52);}return null;};}function patchUpdates(_0x2ce40f){return function(_0x3e5d1f){try{jsonpatch[_0x2d43('0x23')](_0x3e5d1f,_0x2ce40f,!![]);}catch(_0x53f81a){return BPromise['reject'](_0x53f81a);}return _0x3e5d1f[_0x2d43('0x24')]();};}function saveUpdates(_0x366fea,_0x5e10e9){return function(_0x226c3a){if(_0x226c3a){return _0x226c3a[_0x2d43('0x25')](_0x366fea)['then'](function(_0x5def1e){return _0x5def1e;});}return null;};}function removeEntity(_0x315a19,_0x513b17){return function(_0x21061e){if(_0x21061e){return _0x21061e['destroy']()[_0x2d43('0x26')](function(){_0x315a19[_0x2d43('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfd45ac,_0x257c3a){return function(_0x1308b8){if(!_0x1308b8){_0xfd45ac[_0x2d43('0x1a')](0x194);}return _0x1308b8;};}function handleError(_0x5e7881,_0x29eb6f){_0x29eb6f=_0x29eb6f||0x1f4;return function(_0x3b4731){logger[_0x2d43('0x27')](_0x3b4731[_0x2d43('0x28')]);if(_0x3b4731[_0x2d43('0x29')]){delete _0x3b4731[_0x2d43('0x29')];}_0x5e7881[_0x2d43('0x1b')](_0x29eb6f)[_0x2d43('0x2a')](_0x3b4731);};}exports[_0x2d43('0x2b')]=function(_0x84ff60,_0x445b97){var _0x98467={},_0x299d3e={},_0x41b6fa={'count':0x0,'rows':[]};var _0x2be134=_[_0x2d43('0x2c')](db['JscriptyQuestionReport'][_0x2d43('0x2d')],function(_0x2b6f76){return{'name':_0x2b6f76[_0x2d43('0x2e')],'type':_0x2b6f76[_0x2d43('0x2f')][_0x2d43('0x30')]};});_0x299d3e[_0x2d43('0x31')]=_['map'](_0x2be134,_0x2d43('0x29'));_0x299d3e[_0x2d43('0x32')]=_[_0x2d43('0x33')](_0x84ff60[_0x2d43('0x32')]);_0x299d3e[_0x2d43('0x34')]=_[_0x2d43('0x35')](_0x299d3e[_0x2d43('0x31')],_0x299d3e[_0x2d43('0x32')]);_0x98467[_0x2d43('0x36')]=_[_0x2d43('0x35')](_0x299d3e[_0x2d43('0x31')],qs[_0x2d43('0x37')](_0x84ff60[_0x2d43('0x32')][_0x2d43('0x37')]));_0x98467[_0x2d43('0x36')]=_0x98467[_0x2d43('0x36')][_0x2d43('0x38')]?_0x98467[_0x2d43('0x36')]:_0x299d3e[_0x2d43('0x31')];if(!_0x84ff60[_0x2d43('0x32')][_0x2d43('0x39')](_0x2d43('0x3a'))){_0x98467[_0x2d43('0x1f')]=qs[_0x2d43('0x1f')](_0x84ff60[_0x2d43('0x32')][_0x2d43('0x1f')]);_0x98467['offset']=qs['offset'](_0x84ff60[_0x2d43('0x32')]['offset']);}_0x98467[_0x2d43('0x3b')]=qs[_0x2d43('0x3c')](_0x84ff60['query'][_0x2d43('0x3c')]);_0x98467[_0x2d43('0x3d')]=qs[_0x2d43('0x34')](_[_0x2d43('0x3e')](_0x84ff60[_0x2d43('0x32')],_0x299d3e[_0x2d43('0x34')]),_0x2be134);if(_0x84ff60['query']['filter']){_0x98467[_0x2d43('0x3d')]=_[_0x2d43('0x3f')](_0x98467[_0x2d43('0x3d')],{'$or':_[_0x2d43('0x2c')](_0x2be134,function(_0x1bd232){if(_0x1bd232[_0x2d43('0x2f')]!==_0x2d43('0x40')){var _0x5eafd9={};_0x5eafd9[_0x1bd232['name']]={'$like':'%'+_0x84ff60[_0x2d43('0x32')][_0x2d43('0x41')]+'%'};return _0x5eafd9;}})});}_0x98467=_[_0x2d43('0x3f')]({},_0x98467,_0x84ff60[_0x2d43('0x42')]);var _0x25709d={'where':_0x98467[_0x2d43('0x3d')]};return db['JscriptyQuestionReport'][_0x2d43('0x20')](_0x25709d)[_0x2d43('0x26')](function(_0x5a6c64){_0x41b6fa['count']=_0x5a6c64;if(_0x84ff60[_0x2d43('0x32')][_0x2d43('0x43')]){_0x98467[_0x2d43('0x44')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x2d43('0x45')](_0x98467);})['then'](function(_0x1cadc0){_0x41b6fa[_0x2d43('0x46')]=_0x1cadc0;return _0x41b6fa;})['then'](respondWithFilteredResult(_0x445b97,_0x98467))[_0x2d43('0x47')](handleError(_0x445b97,null));};exports[_0x2d43('0x48')]=function(_0x4c098e,_0x470287){var _0x1e6b80={'raw':!![],'where':{'id':_0x4c098e[_0x2d43('0x49')]['id']}},_0x32fbff={};_0x32fbff[_0x2d43('0x31')]=_[_0x2d43('0x33')](db[_0x2d43('0x4a')]['rawAttributes']);_0x32fbff[_0x2d43('0x32')]=_[_0x2d43('0x33')](_0x4c098e[_0x2d43('0x32')]);_0x32fbff[_0x2d43('0x34')]=_[_0x2d43('0x35')](_0x32fbff[_0x2d43('0x31')],_0x32fbff[_0x2d43('0x32')]);_0x1e6b80[_0x2d43('0x36')]=_[_0x2d43('0x35')](_0x32fbff[_0x2d43('0x31')],qs[_0x2d43('0x37')](_0x4c098e['query'][_0x2d43('0x37')]));_0x1e6b80[_0x2d43('0x36')]=_0x1e6b80[_0x2d43('0x36')][_0x2d43('0x38')]?_0x1e6b80[_0x2d43('0x36')]:_0x32fbff[_0x2d43('0x31')];if(_0x4c098e['query'][_0x2d43('0x43')]){_0x1e6b80[_0x2d43('0x44')]=[{'all':!![]}];}_0x1e6b80=_[_0x2d43('0x3f')]({},_0x1e6b80,_0x4c098e['options']);return db[_0x2d43('0x4a')][_0x2d43('0x4b')](_0x1e6b80)[_0x2d43('0x26')](handleEntityNotFound(_0x470287,null))[_0x2d43('0x26')](respondWithResult(_0x470287,null))[_0x2d43('0x47')](handleError(_0x470287,null));};exports[_0x2d43('0x4c')]=function(_0x4ff5ac,_0x14c1b3){return db[_0x2d43('0x4a')][_0x2d43('0x4c')](_0x4ff5ac[_0x2d43('0x4d')],{})['then'](respondWithResult(_0x14c1b3,0xc9))[_0x2d43('0x47')](handleError(_0x14c1b3,null));};exports[_0x2d43('0x25')]=function(_0x3c6a72,_0x53b99b){if(_0x3c6a72[_0x2d43('0x4d')]['id']){delete _0x3c6a72[_0x2d43('0x4d')]['id'];}return db[_0x2d43('0x4a')][_0x2d43('0x4b')]({'where':{'id':_0x3c6a72[_0x2d43('0x49')]['id']}})[_0x2d43('0x26')](handleEntityNotFound(_0x53b99b,null))['then'](saveUpdates(_0x3c6a72['body'],null))[_0x2d43('0x26')](respondWithResult(_0x53b99b,null))[_0x2d43('0x47')](handleError(_0x53b99b,null));};exports[_0x2d43('0x4e')]=function(_0x289fae,_0x5cefd0){return db[_0x2d43('0x4a')][_0x2d43('0x4b')]({'where':{'id':_0x289fae[_0x2d43('0x49')]['id']}})[_0x2d43('0x26')](handleEntityNotFound(_0x5cefd0,null))[_0x2d43('0x26')](removeEntity(_0x5cefd0,null))[_0x2d43('0x47')](handleError(_0x5cefd0,null));};exports[_0x2d43('0x4f')]=function(_0x5649e4,_0x3a573c){return db['JscriptyQuestionReport'][_0x2d43('0x4f')]()['then'](respondWithResult(_0x3a573c,null))['catch'](handleError(_0x3a573c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index c151f93..2f43387 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 _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 +var _0xefdb=['../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xefdb,0x1a6));var _0xbefd=function(_0x39d812,_0x13406a){_0x39d812=_0x39d812-0x0;var _0x366d02=_0xefdb[_0x39d812];return _0x366d02;};'use strict';var _=require('lodash');var util=require(_0xbefd('0x0'));var logger=require(_0xbefd('0x1'))(_0xbefd('0x2'));var moment=require(_0xbefd('0x3'));var BPromise=require(_0xbefd('0x4'));var rp=require(_0xbefd('0x5'));var fs=require('fs');var path=require(_0xbefd('0x6'));var rimraf=require('rimraf');var config=require(_0xbefd('0x7'));var attributes=require(_0xbefd('0x8'));module[_0xbefd('0x9')]=function(_0x565358,_0x2155e2){return _0x565358[_0xbefd('0xa')](_0xbefd('0xb'),attributes,{'tableName':_0xbefd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index ea2d132..5f9ed11 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 _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 +var _0x9d8a=['http','then','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x4e996a,_0x381f6d){var _0x30b0e6=function(_0x2c5e44){while(--_0x2c5e44){_0x4e996a['push'](_0x4e996a['shift']());}};_0x30b0e6(++_0x381f6d);}(_0x9d8a,0x1af));var _0xa9d8=function(_0x43bcf0,_0xa554dd){_0x43bcf0=_0x43bcf0-0x0;var _0x2f2a69=_0x9d8a[_0x43bcf0];return _0x2f2a69;};'use strict';var _=require(_0xa9d8('0x0'));var util=require(_0xa9d8('0x1'));var moment=require('moment');var BPromise=require(_0xa9d8('0x2'));var rs=require(_0xa9d8('0x3'));var fs=require('fs');var Redis=require(_0xa9d8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa9d8('0x5'));var logger=require(_0xa9d8('0x6'))(_0xa9d8('0x7'));var config=require(_0xa9d8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa9d8('0x9')][_0xa9d8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29bc27,_0x1bef0b,_0xc927){return new BPromise(function(_0x3bf62a,_0x3a1f78){return client['request'](_0x29bc27,_0xc927)[_0xa9d8('0xb')](function(_0x440e43){logger[_0xa9d8('0xc')](_0xa9d8('0xd'),_0x1bef0b,'request\x20sent');logger[_0xa9d8('0xe')](_0xa9d8('0xf'),_0x1bef0b,_0xa9d8('0x10'),JSON[_0xa9d8('0x11')](_0x440e43));if(_0x440e43[_0xa9d8('0x12')]){if(_0x440e43['error'][_0xa9d8('0x13')]===0x1f4){logger[_0xa9d8('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1bef0b,_0x440e43[_0xa9d8('0x12')][_0xa9d8('0x14')]);return _0x3a1f78(_0x440e43[_0xa9d8('0x12')][_0xa9d8('0x14')]);}logger['error'](_0xa9d8('0xd'),_0x1bef0b,_0x440e43[_0xa9d8('0x12')][_0xa9d8('0x14')]);return _0x3bf62a(_0x440e43[_0xa9d8('0x12')][_0xa9d8('0x14')]);}else{logger[_0xa9d8('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1bef0b,_0xa9d8('0x10'));_0x3bf62a(_0x440e43['result'][_0xa9d8('0x14')]);}})['catch'](function(_0x5a2690){logger[_0xa9d8('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1bef0b,_0x5a2690);_0x3a1f78(_0x5a2690);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 7f898d0..2b8ae58 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 _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 +var _0x5372=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','getQuestions','post','put','update','delete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5372,0x16a));var _0x2537=function(_0x3e2fee,_0x1a8be3){_0x3e2fee=_0x3e2fee-0x0;var _0x170717=_0x5372[_0x3e2fee];return _0x170717;};'use strict';var multer=require(_0x2537('0x0'));var util=require('util');var path=require(_0x2537('0x1'));var timeout=require(_0x2537('0x2'));var express=require(_0x2537('0x3'));var router=express[_0x2537('0x4')]();var fs_extra=require(_0x2537('0x5'));var auth=require(_0x2537('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2537('0x7'));var controller=require(_0x2537('0x8'));router[_0x2537('0x9')]('/',auth[_0x2537('0xa')](),controller[_0x2537('0xb')]);router[_0x2537('0x9')](_0x2537('0xc'),auth[_0x2537('0xa')](),controller[_0x2537('0xd')]);router['get'](_0x2537('0xe'),auth[_0x2537('0xa')](),controller[_0x2537('0xf')]);router['get'](_0x2537('0x10'),auth[_0x2537('0xa')](),controller[_0x2537('0x11')]);router[_0x2537('0x12')]('/',auth[_0x2537('0xa')](),controller['create']);router[_0x2537('0x13')](_0x2537('0xe'),auth[_0x2537('0xa')](),controller[_0x2537('0x14')]);router[_0x2537('0x15')]('/:id',auth[_0x2537('0xa')](),controller[_0x2537('0x16')]);module[_0x2537('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index e34f030..99a93dc 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 _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 +var _0xe201=['STRING','BOOLEAN','moment','sequelize','exports','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe201,0x1f1));var _0x1e20=function(_0xd13cad,_0xea397a){_0xd13cad=_0xd13cad-0x0;var _0xc744f2=_0xe201[_0xd13cad];return _0xc744f2;};'use strict';var moment=require(_0x1e20('0x0'));var Sequelize=require(_0x1e20('0x1'));module[_0x1e20('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x5c76d1){this[_0x1e20('0x3')](_0x1e20('0x4'),_0x5c76d1);this[_0x1e20('0x3')](_0x1e20('0x5'),moment()[_0x1e20('0x6')](_0x1e20('0x7')));}},'endtime':{'type':Sequelize[_0x1e20('0x8')]},'membername':{'type':Sequelize[_0x1e20('0x9')]},'projectname':{'type':Sequelize[_0x1e20('0x9')]},'queue':{'type':Sequelize[_0x1e20('0x9')]},'uniqueid':{'type':Sequelize[_0x1e20('0x9')]},'calleridname':{'type':Sequelize[_0x1e20('0x9')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x1e20('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index d61b218..93f20c3 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 _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 +var _0x0c5d=['save','then','destroy','error','stack','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','JscriptySessionReport','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','pick','SessionId','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','apply','reject'];(function(_0x3d4b2f,_0x3f28c3){var _0x3cd8c4=function(_0x2204f8){while(--_0x2204f8){_0x3d4b2f['push'](_0x3d4b2f['shift']());}};_0x3cd8c4(++_0x3f28c3);}(_0x0c5d,0x109));var _0xd0c5=function(_0x11617c,_0x20bf0c){_0x11617c=_0x11617c-0x0;var _0x459588=_0x0c5d[_0x11617c];return _0x459588;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd0c5('0x0'));var zipdir=require(_0xd0c5('0x1'));var jsonpatch=require(_0xd0c5('0x2'));var rp=require('request-promise');var moment=require(_0xd0c5('0x3'));var BPromise=require(_0xd0c5('0x4'));var Mustache=require(_0xd0c5('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd0c5('0x6'));var fs=require('fs');var fs_extra=require(_0xd0c5('0x7'));var _=require(_0xd0c5('0x8'));var squel=require(_0xd0c5('0x9'));var crypto=require(_0xd0c5('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd0c5('0xb'));var Papa=require(_0xd0c5('0xc'));var Redis=require(_0xd0c5('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd0c5('0xe'));var as=require(_0xd0c5('0xf'));var hardwareService=require(_0xd0c5('0x10'));var logger=require('../../config/logger')(_0xd0c5('0x11'));var utils=require(_0xd0c5('0x12'));var config=require(_0xd0c5('0x13'));var licenseUtil=require(_0xd0c5('0x14'));var db=require(_0xd0c5('0x15'))['db'];function respondWithStatusCode(_0x2df571,_0x562c03){_0x562c03=_0x562c03||0xcc;return function(_0xa5caf3){if(_0xa5caf3){return _0x2df571[_0xd0c5('0x16')](_0x562c03);}return _0x2df571[_0xd0c5('0x17')](_0x562c03)[_0xd0c5('0x18')]();};}function respondWithResult(_0x439310,_0x4f3e87){_0x4f3e87=_0x4f3e87||0xc8;return function(_0x198edc){if(_0x198edc){return _0x439310['status'](_0x4f3e87)['json'](_0x198edc);}};}function respondWithFilteredResult(_0x40c300,_0x2fd39d){return function(_0x5c7df0){if(_0x5c7df0){var _0x1f3a21=typeof _0x2fd39d[_0xd0c5('0x19')]==='undefined'&&typeof _0x2fd39d['limit']===_0xd0c5('0x1a');var _0xf483d0=_0x5c7df0[_0xd0c5('0x1b')];var _0x193e94=_0x1f3a21?0x0:_0x2fd39d['offset'];var _0x37ac8a=_0x1f3a21?_0x5c7df0['count']:_0x2fd39d[_0xd0c5('0x19')]+_0x2fd39d[_0xd0c5('0x1c')];var _0x380602;if(_0x37ac8a>=_0xf483d0){_0x37ac8a=_0xf483d0;_0x380602=0xc8;}else{_0x380602=0xce;}_0x40c300[_0xd0c5('0x17')](_0x380602);return _0x40c300['set']('Content-Range',_0x193e94+'-'+_0x37ac8a+'/'+_0xf483d0)['json'](_0x5c7df0);}return null;};}function patchUpdates(_0x968686){return function(_0xcb523e){try{jsonpatch[_0xd0c5('0x1d')](_0xcb523e,_0x968686,!![]);}catch(_0x3c8615){return BPromise[_0xd0c5('0x1e')](_0x3c8615);}return _0xcb523e[_0xd0c5('0x1f')]();};}function saveUpdates(_0xf0090b,_0x19c650){return function(_0x358094){if(_0x358094){return _0x358094['update'](_0xf0090b)[_0xd0c5('0x20')](function(_0x5887ce){return _0x5887ce;});}return null;};}function removeEntity(_0x7a3309,_0x10f710){return function(_0x43fbac){if(_0x43fbac){return _0x43fbac[_0xd0c5('0x21')]()[_0xd0c5('0x20')](function(){_0x7a3309[_0xd0c5('0x17')](0xcc)[_0xd0c5('0x18')]();});}};}function handleEntityNotFound(_0x2313ba,_0x353006){return function(_0x49adad){if(!_0x49adad){_0x2313ba[_0xd0c5('0x16')](0x194);}return _0x49adad;};}function handleError(_0x378ed9,_0x5223bb){_0x5223bb=_0x5223bb||0x1f4;return function(_0x73d08b){logger[_0xd0c5('0x22')](_0x73d08b[_0xd0c5('0x23')]);if(_0x73d08b['name']){delete _0x73d08b['name'];}_0x378ed9['status'](_0x5223bb)[_0xd0c5('0x24')](_0x73d08b);};}exports[_0xd0c5('0x25')]=function(_0x87828f,_0x5bf017){var _0x5918fc={},_0x365a32={},_0x5db2f4={'count':0x0,'rows':[]};var _0x593534=_[_0xd0c5('0x26')](db['JscriptySessionReport'][_0xd0c5('0x27')],function(_0x5dabbb){return{'name':_0x5dabbb[_0xd0c5('0x28')],'type':_0x5dabbb[_0xd0c5('0x29')]['key']};});_0x365a32[_0xd0c5('0x2a')]=_[_0xd0c5('0x26')](_0x593534,'name');_0x365a32[_0xd0c5('0x2b')]=_[_0xd0c5('0x2c')](_0x87828f['query']);_0x365a32[_0xd0c5('0x2d')]=_[_0xd0c5('0x2e')](_0x365a32[_0xd0c5('0x2a')],_0x365a32['query']);_0x5918fc['attributes']=_[_0xd0c5('0x2e')](_0x365a32[_0xd0c5('0x2a')],qs[_0xd0c5('0x2f')](_0x87828f[_0xd0c5('0x2b')][_0xd0c5('0x2f')]));_0x5918fc['attributes']=_0x5918fc[_0xd0c5('0x30')]['length']?_0x5918fc['attributes']:_0x365a32[_0xd0c5('0x2a')];if(!_0x87828f[_0xd0c5('0x2b')][_0xd0c5('0x31')](_0xd0c5('0x32'))){_0x5918fc[_0xd0c5('0x1c')]=qs[_0xd0c5('0x1c')](_0x87828f[_0xd0c5('0x2b')][_0xd0c5('0x1c')]);_0x5918fc[_0xd0c5('0x19')]=qs[_0xd0c5('0x19')](_0x87828f[_0xd0c5('0x2b')][_0xd0c5('0x19')]);}_0x5918fc[_0xd0c5('0x33')]=qs[_0xd0c5('0x34')](_0x87828f[_0xd0c5('0x2b')][_0xd0c5('0x34')]);_0x5918fc[_0xd0c5('0x35')]=qs['filters'](_['pick'](_0x87828f[_0xd0c5('0x2b')],_0x365a32['filters']),_0x593534);if(_0x87828f[_0xd0c5('0x2b')][_0xd0c5('0x36')]){_0x5918fc['where']=_['merge'](_0x5918fc[_0xd0c5('0x35')],{'$or':_['map'](_0x593534,function(_0xf82048){if(_0xf82048[_0xd0c5('0x29')]!=='VIRTUAL'){var _0x24aae4={};_0x24aae4[_0xf82048['name']]={'$like':'%'+_0x87828f[_0xd0c5('0x2b')][_0xd0c5('0x36')]+'%'};return _0x24aae4;}})});}_0x5918fc=_[_0xd0c5('0x37')]({},_0x5918fc,_0x87828f['options']);var _0x26831f={'where':_0x5918fc[_0xd0c5('0x35')]};return db[_0xd0c5('0x38')][_0xd0c5('0x1b')](_0x26831f)[_0xd0c5('0x20')](function(_0x220e32){_0x5db2f4[_0xd0c5('0x1b')]=_0x220e32;if(_0x87828f[_0xd0c5('0x2b')][_0xd0c5('0x39')]){_0x5918fc[_0xd0c5('0x3a')]=[{'all':!![]}];}return db[_0xd0c5('0x38')][_0xd0c5('0x3b')](_0x5918fc);})[_0xd0c5('0x20')](function(_0x429b5e){_0x5db2f4[_0xd0c5('0x3c')]=_0x429b5e;return _0x5db2f4;})[_0xd0c5('0x20')](respondWithFilteredResult(_0x5bf017,_0x5918fc))['catch'](handleError(_0x5bf017,null));};exports[_0xd0c5('0x3d')]=function(_0x30eaaa,_0x463141){var _0x2b21d7={'raw':!![],'where':{'id':_0x30eaaa[_0xd0c5('0x3e')]['id']}},_0x1724db={};_0x1724db[_0xd0c5('0x2a')]=_[_0xd0c5('0x2c')](db[_0xd0c5('0x38')][_0xd0c5('0x27')]);_0x1724db['query']=_['keys'](_0x30eaaa[_0xd0c5('0x2b')]);_0x1724db[_0xd0c5('0x2d')]=_[_0xd0c5('0x2e')](_0x1724db[_0xd0c5('0x2a')],_0x1724db['query']);_0x2b21d7[_0xd0c5('0x30')]=_[_0xd0c5('0x2e')](_0x1724db[_0xd0c5('0x2a')],qs['fields'](_0x30eaaa[_0xd0c5('0x2b')][_0xd0c5('0x2f')]));_0x2b21d7['attributes']=_0x2b21d7['attributes'][_0xd0c5('0x3f')]?_0x2b21d7[_0xd0c5('0x30')]:_0x1724db[_0xd0c5('0x2a')];if(_0x30eaaa[_0xd0c5('0x2b')][_0xd0c5('0x39')]){_0x2b21d7['include']=[{'all':!![]}];}_0x2b21d7=_[_0xd0c5('0x37')]({},_0x2b21d7,_0x30eaaa['options']);return db[_0xd0c5('0x38')][_0xd0c5('0x40')](_0x2b21d7)[_0xd0c5('0x20')](handleEntityNotFound(_0x463141,null))[_0xd0c5('0x20')](respondWithResult(_0x463141,null))[_0xd0c5('0x41')](handleError(_0x463141,null));};exports['create']=function(_0x3a5883,_0x4d8e90){return db[_0xd0c5('0x38')][_0xd0c5('0x42')](_0x3a5883[_0xd0c5('0x43')],{})[_0xd0c5('0x20')](respondWithResult(_0x4d8e90,0xc9))[_0xd0c5('0x41')](handleError(_0x4d8e90,null));};exports['update']=function(_0x10225f,_0x38994c){if(_0x10225f[_0xd0c5('0x43')]['id']){delete _0x10225f['body']['id'];}return db[_0xd0c5('0x38')][_0xd0c5('0x40')]({'where':{'id':_0x10225f[_0xd0c5('0x3e')]['id']}})[_0xd0c5('0x20')](handleEntityNotFound(_0x38994c,null))['then'](saveUpdates(_0x10225f[_0xd0c5('0x43')],null))[_0xd0c5('0x20')](respondWithResult(_0x38994c,null))[_0xd0c5('0x41')](handleError(_0x38994c,null));};exports[_0xd0c5('0x21')]=function(_0x3acbd5,_0x217e4f){return db[_0xd0c5('0x38')][_0xd0c5('0x40')]({'where':{'id':_0x3acbd5['params']['id']}})[_0xd0c5('0x20')](handleEntityNotFound(_0x217e4f,null))['then'](removeEntity(_0x217e4f,null))[_0xd0c5('0x41')](handleError(_0x217e4f,null));};exports[_0xd0c5('0x44')]=function(_0x5a07f8,_0x4d2221){return db[_0xd0c5('0x38')][_0xd0c5('0x44')]()[_0xd0c5('0x20')](respondWithResult(_0x4d2221,null))[_0xd0c5('0x41')](handleError(_0x4d2221,null));};exports[_0xd0c5('0x45')]=function(_0x137a4d,_0x5dcf96,_0x21f550){var _0x3f1bb7={'raw':!![],'where':{}};var _0x2ecee2={};var _0x45ccee={'count':0x0,'rows':[]};return db[_0xd0c5('0x38')][_0xd0c5('0x46')]({'where':{'id':_0x137a4d[_0xd0c5('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5dcf96,null))['then'](function(_0x3c6036){if(_0x3c6036){_0x2ecee2[_0xd0c5('0x2a')]=_['keys'](db[_0xd0c5('0x47')]['rawAttributes']);_0x2ecee2[_0xd0c5('0x2b')]=_['keys'](_0x137a4d[_0xd0c5('0x2b')]);_0x2ecee2[_0xd0c5('0x2d')]=_['intersection'](_0x2ecee2[_0xd0c5('0x2a')],_0x2ecee2[_0xd0c5('0x2b')]);_0x3f1bb7[_0xd0c5('0x30')]=_[_0xd0c5('0x2e')](_0x2ecee2[_0xd0c5('0x2a')],qs[_0xd0c5('0x2f')](_0x137a4d[_0xd0c5('0x2b')][_0xd0c5('0x2f')]));_0x3f1bb7[_0xd0c5('0x30')]=_0x3f1bb7[_0xd0c5('0x30')][_0xd0c5('0x3f')]?_0x3f1bb7[_0xd0c5('0x30')]:_0x2ecee2[_0xd0c5('0x2a')];if(!_0x137a4d[_0xd0c5('0x2b')]['hasOwnProperty']('nolimit')){_0x3f1bb7['limit']=qs[_0xd0c5('0x1c')](_0x137a4d['query'][_0xd0c5('0x1c')]);_0x3f1bb7[_0xd0c5('0x19')]=qs['offset'](_0x137a4d[_0xd0c5('0x2b')][_0xd0c5('0x19')]);}_0x3f1bb7[_0xd0c5('0x33')]=qs[_0xd0c5('0x34')](_0x137a4d[_0xd0c5('0x2b')][_0xd0c5('0x34')]);_0x3f1bb7[_0xd0c5('0x35')]=qs['filters'](_[_0xd0c5('0x48')](_0x137a4d[_0xd0c5('0x2b')],_0x2ecee2['filters']));_0x3f1bb7[_0xd0c5('0x35')][_0xd0c5('0x49')]=_0x3c6036['id'];if(_0x137a4d[_0xd0c5('0x2b')]['filter']){_0x3f1bb7[_0xd0c5('0x35')]=_['merge'](_0x3f1bb7[_0xd0c5('0x35')],{'$or':_[_0xd0c5('0x26')](_0x3f1bb7[_0xd0c5('0x30')],function(_0x4b5885){var _0x525ea4={};_0x525ea4[_0x4b5885]={'$like':'%'+_0x137a4d[_0xd0c5('0x2b')][_0xd0c5('0x36')]+'%'};return _0x525ea4;})});}_0x3f1bb7=_[_0xd0c5('0x37')]({},_0x3f1bb7,_0x137a4d['options']);return db['JscriptyQuestionReport'][_0xd0c5('0x1b')]({'where':_0x3f1bb7[_0xd0c5('0x35')]})['then'](function(_0x3370ad){_0x45ccee[_0xd0c5('0x1b')]=_0x3370ad;if(_0x137a4d[_0xd0c5('0x2b')][_0xd0c5('0x39')]){_0x3f1bb7[_0xd0c5('0x3a')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xd0c5('0x3b')](_0x3f1bb7);})[_0xd0c5('0x20')](function(_0x371aaa){_0x45ccee['rows']=_0x371aaa;return _0x45ccee;});}})[_0xd0c5('0x20')](respondWithFilteredResult(_0x5dcf96,_0x3f1bb7))[_0xd0c5('0x41')](handleError(_0x5dcf96,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 213f854..4a578a5 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 _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 +var _0x31f0=['./jscriptySessionReport.attributes','define','report_jscripty_sessions','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x44dcf4,_0x9a5ee8){var _0x19b076=function(_0x2afcf3){while(--_0x2afcf3){_0x44dcf4['push'](_0x44dcf4['shift']());}};_0x19b076(++_0x9a5ee8);}(_0x31f0,0xb7));var _0x031f=function(_0x40e257,_0x1d0d7f){_0x40e257=_0x40e257-0x0;var _0x2111c2=_0x31f0[_0x40e257];return _0x2111c2;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var logger=require(_0x031f('0x1'))('api');var moment=require(_0x031f('0x2'));var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require('rimraf');var config=require(_0x031f('0x6'));var attributes=require(_0x031f('0x7'));module['exports']=function(_0x4c0f94,_0x56328c){return _0x4c0f94[_0x031f('0x8')]('JscriptySessionReport',attributes,{'tableName':_0x031f('0x9'),'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 ec19911..4503917 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 _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 +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0xf1f2e0,_0x37c415){var _0x991373=function(_0x5baf7f){while(--_0x5baf7f){_0xf1f2e0['push'](_0xf1f2e0['shift']());}};_0x991373(++_0x37c415);}(_0xadb5,0xad));var _0x5adb=function(_0x57447b,_0x29d9ed){_0x57447b=_0x57447b-0x0;var _0x6f2d11=_0xadb5[_0x57447b];return _0x6f2d11;};'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']('JscriptySessionReport,\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/license/index.js b/server/api/license/index.js index e9b1a31..9d65b93 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 _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 +var _0x7a9c=['exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','put','/:id','isAuthenticated','/download_log_file','downloadLogFile'];(function(_0x2a4a0a,_0x42b1fb){var _0x43636b=function(_0x5a35ea){while(--_0x5a35ea){_0x2a4a0a['push'](_0x2a4a0a['shift']());}};_0x43636b(++_0x42b1fb);}(_0x7a9c,0x1f1));var _0xc7a9=function(_0x3be7ff,_0x12e714){_0x3be7ff=_0x3be7ff-0x0;var _0x186721=_0x7a9c[_0x3be7ff];return _0x186721;};'use strict';var multer=require(_0xc7a9('0x0'));var util=require(_0xc7a9('0x1'));var path=require('path');var timeout=require(_0xc7a9('0x2'));var express=require('express');var router=express[_0xc7a9('0x3')]();var fs_extra=require(_0xc7a9('0x4'));var auth=require(_0xc7a9('0x5'));var interaction=require(_0xc7a9('0x6'));var config=require(_0xc7a9('0x7'));var controller=require('./license.controller');router[_0xc7a9('0x8')]('/',controller[_0xc7a9('0x9')]);router[_0xc7a9('0xa')](_0xc7a9('0xb'),auth[_0xc7a9('0xc')](),controller['update']);router['get'](_0xc7a9('0xd'),auth[_0xc7a9('0xc')](),controller[_0xc7a9('0xe')]);module[_0xc7a9('0xf')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 6afe894..cb015ee 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 _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 +var _0x4d8c=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x117fed,_0x457fb2){var _0x3911ad=function(_0x2f4a62){while(--_0x2f4a62){_0x117fed['push'](_0x117fed['shift']());}};_0x3911ad(++_0x457fb2);}(_0x4d8c,0x7c));var _0xc4d8=function(_0xc4ae54,_0x31430e){_0xc4ae54=_0xc4ae54-0x0;var _0x3b819f=_0x4d8c[_0xc4ae54];return _0x3b819f;};'use strict';var Sequelize=require(_0xc4d8('0x0'));module[_0xc4d8('0x1')]={'license':{'type':Sequelize[_0xc4d8('0x2')]},'data1':{'type':Sequelize[_0xc4d8('0x3')]},'data2':{'type':Sequelize[_0xc4d8('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xc4d8('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 faf8d5c..19989bf 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 _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 +var _0x6bff=['count','set','apply','save','update','then','destroy','sendStatus','error','stack','name','send','License','rawAttributes','query','keys','filters','intersection','model','fields','attributes','catch','body','find','get','checkLicense','key','demo','downloadLogFile','license-info.log','join','log','xcally','setHeader','attachment;\x20filename=','Content-Type','text/plain','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined'];(function(_0x39bb0a,_0x4b98a6){var _0x3ca657=function(_0x1fd89){while(--_0x1fd89){_0x39bb0a['push'](_0x39bb0a['shift']());}};_0x3ca657(++_0x4b98a6);}(_0x6bff,0x1b1));var _0xf6bf=function(_0x216d4a,_0x51cfd8){_0x216d4a=_0x216d4a-0x0;var _0xe6a2d2=_0x6bff[_0x216d4a];return _0xe6a2d2;};'use strict';var emlformat=require(_0xf6bf('0x0'));var rimraf=require(_0xf6bf('0x1'));var zipdir=require(_0xf6bf('0x2'));var jsonpatch=require(_0xf6bf('0x3'));var rp=require(_0xf6bf('0x4'));var moment=require(_0xf6bf('0x5'));var BPromise=require(_0xf6bf('0x6'));var Mustache=require(_0xf6bf('0x7'));var util=require(_0xf6bf('0x8'));var path=require('path');var sox=require(_0xf6bf('0x9'));var csv=require(_0xf6bf('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf6bf('0xb'));var squel=require(_0xf6bf('0xc'));var crypto=require(_0xf6bf('0xd'));var jsforce=require(_0xf6bf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf6bf('0xa'));var querystring=require('querystring');var Papa=require(_0xf6bf('0xf'));var Redis=require(_0xf6bf('0x10'));var authService=require(_0xf6bf('0x11'));var qs=require(_0xf6bf('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf6bf('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xf6bf('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf6bf('0x15'));var db=require(_0xf6bf('0x16'))['db'];function respondWithStatusCode(_0x32bd7b,_0x1ab5f0){_0x1ab5f0=_0x1ab5f0||0xcc;return function(_0x2b52ee){if(_0x2b52ee){return _0x32bd7b['sendStatus'](_0x1ab5f0);}return _0x32bd7b[_0xf6bf('0x17')](_0x1ab5f0)[_0xf6bf('0x18')]();};}function respondWithResult(_0x41fcd4,_0x25701c){_0x25701c=_0x25701c||0xc8;return function(_0x1215e3){if(_0x1215e3){return _0x41fcd4[_0xf6bf('0x17')](_0x25701c)[_0xf6bf('0x19')](_0x1215e3);}};}function respondWithFilteredResult(_0x4ac11a,_0x4db8ef){return function(_0x30544b){if(_0x30544b){var _0x218ba7=typeof _0x4db8ef[_0xf6bf('0x1a')]==='undefined'&&typeof _0x4db8ef[_0xf6bf('0x1b')]===_0xf6bf('0x1c');var _0x3b253b=_0x30544b[_0xf6bf('0x1d')];var _0x34e23d=_0x218ba7?0x0:_0x4db8ef[_0xf6bf('0x1a')];var _0xa986be=_0x218ba7?_0x30544b['count']:_0x4db8ef[_0xf6bf('0x1a')]+_0x4db8ef[_0xf6bf('0x1b')];var _0xdb9461;if(_0xa986be>=_0x3b253b){_0xa986be=_0x3b253b;_0xdb9461=0xc8;}else{_0xdb9461=0xce;}_0x4ac11a[_0xf6bf('0x17')](_0xdb9461);return _0x4ac11a[_0xf6bf('0x1e')]('Content-Range',_0x34e23d+'-'+_0xa986be+'/'+_0x3b253b)[_0xf6bf('0x19')](_0x30544b);}return null;};}function patchUpdates(_0x3d9bc8){return function(_0x295768){try{jsonpatch[_0xf6bf('0x1f')](_0x295768,_0x3d9bc8,!![]);}catch(_0x5e1e55){return BPromise['reject'](_0x5e1e55);}return _0x295768[_0xf6bf('0x20')]();};}function saveUpdates(_0x55748b,_0xde4804){return function(_0x357955){if(_0x357955){return _0x357955[_0xf6bf('0x21')](_0x55748b)[_0xf6bf('0x22')](function(_0x1e977c){return _0x1e977c;});}return null;};}function removeEntity(_0x2339fc,_0x3c96f1){return function(_0x447471){if(_0x447471){return _0x447471[_0xf6bf('0x23')]()[_0xf6bf('0x22')](function(){_0x2339fc[_0xf6bf('0x17')](0xcc)[_0xf6bf('0x18')]();});}};}function handleEntityNotFound(_0x1112e9,_0xede1f2){return function(_0x5f2a7b){if(!_0x5f2a7b){_0x1112e9[_0xf6bf('0x24')](0x194);}return _0x5f2a7b;};}function handleError(_0x5d1bf1,_0x292b9b){_0x292b9b=_0x292b9b||0x1f4;return function(_0xf18d99){logger[_0xf6bf('0x25')](_0xf18d99[_0xf6bf('0x26')]);if(_0xf18d99[_0xf6bf('0x27')]){delete _0xf18d99[_0xf6bf('0x27')];}_0x5d1bf1[_0xf6bf('0x17')](_0x292b9b)[_0xf6bf('0x28')](_0xf18d99);};}var utilLicense=require(_0xf6bf('0x15'));exports['index']=function(_0x3702cb,_0x5ba798){var _0x37716e={'raw':!![],'where':{'id':0x1}},_0x54915b={};_0x54915b['model']=_['keys'](db[_0xf6bf('0x29')][_0xf6bf('0x2a')]);_0x54915b[_0xf6bf('0x2b')]=_[_0xf6bf('0x2c')](_0x3702cb['query']);_0x54915b[_0xf6bf('0x2d')]=_[_0xf6bf('0x2e')](_0x54915b['model'],_0x54915b[_0xf6bf('0x2b')]);_0x37716e['attributes']=_[_0xf6bf('0x2e')](_0x54915b[_0xf6bf('0x2f')],qs[_0xf6bf('0x30')](_0x3702cb[_0xf6bf('0x2b')][_0xf6bf('0x30')]));_0x37716e[_0xf6bf('0x31')]=_0x37716e[_0xf6bf('0x31')]['length']?_0x37716e['attributes']:_0x54915b[_0xf6bf('0x2f')];_0x37716e=_['merge']({},_0x37716e,_0x3702cb['options']);return utilLicense['getLicense'](_0x37716e)[_0xf6bf('0x22')](respondWithResult(_0x5ba798,null))[_0xf6bf('0x32')](handleError(_0x5ba798,null));};exports[_0xf6bf('0x21')]=function(_0x312547,_0x414d32){if(_0x312547[_0xf6bf('0x33')]['id']){delete _0x312547[_0xf6bf('0x33')]['id'];}return db[_0xf6bf('0x29')][_0xf6bf('0x34')]({'where':{'id':_0x312547['params']['id']}})[_0xf6bf('0x22')](handleEntityNotFound(_0x414d32,null))['then'](function(_0x516172){var _0x15cdba=_0x516172[_0xf6bf('0x35')]({'plain':!![]});return utilLicense[_0xf6bf('0x36')](_0x15cdba,_0x312547[_0xf6bf('0x33')][_0xf6bf('0x37')]);})['then'](function(_0x156567){if(!_0x156567[_0xf6bf('0x38')]){return saveUpdates(_0x312547[_0xf6bf('0x33')],null);}return _0x156567;})[_0xf6bf('0x22')](respondWithResult(_0x414d32,null))['catch'](handleError(_0x414d32,null));};exports[_0xf6bf('0x39')]=function(_0x544f38,_0x1c4de7){var _0x318662=_0xf6bf('0x3a');var _0x43b3cc=path[_0xf6bf('0x3b')]('/var',_0xf6bf('0x3c'),_0xf6bf('0x3d'),_0x318662);_0x1c4de7[_0xf6bf('0x3e')]('Content-disposition',_0xf6bf('0x3f')+_0x318662);_0x1c4de7[_0xf6bf('0x1e')](_0xf6bf('0x40'),_0xf6bf('0x41'));_0x1c4de7['download'](_0x43b3cc);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index d64aae5..7ebf9a7 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 _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 +var _0x1c64=['exports','define','License','license','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./license.attributes'];(function(_0x4bfe08,_0x48ae7b){var _0x1f9125=function(_0x11450e){while(--_0x11450e){_0x4bfe08['push'](_0x4bfe08['shift']());}};_0x1f9125(++_0x48ae7b);}(_0x1c64,0x17d));var _0x41c6=function(_0x1e4834,_0x9806bb){_0x1e4834=_0x1e4834-0x0;var _0x3eced3=_0x1c64[_0x1e4834];return _0x3eced3;};'use strict';var _=require(_0x41c6('0x0'));var util=require(_0x41c6('0x1'));var logger=require(_0x41c6('0x2'))(_0x41c6('0x3'));var moment=require('moment');var BPromise=require(_0x41c6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x41c6('0x5'));var rimraf=require(_0x41c6('0x6'));var config=require(_0x41c6('0x7'));var attributes=require(_0x41c6('0x8'));module[_0x41c6('0x9')]=function(_0x2634ff,_0x1ea4f2){return _0x2634ff[_0x41c6('0xa')](_0x41c6('0xb'),attributes,{'tableName':_0x41c6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 9f8832c..87f5158 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 _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 +var _0x2a0a=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','License,\x20%s,\x20%s','message','result'];(function(_0x3f6066,_0x2582d6){var _0x169181=function(_0x1a5f43){while(--_0x1a5f43){_0x3f6066['push'](_0x3f6066['shift']());}};_0x169181(++_0x2582d6);}(_0x2a0a,0x121));var _0xa2a0=function(_0x3f4bc0,_0x2d1c53){_0x3f4bc0=_0x3f4bc0-0x0;var _0x702e6a=_0x2a0a[_0x3f4bc0];return _0x702e6a;};'use strict';var _=require('lodash');var util=require(_0xa2a0('0x0'));var moment=require(_0xa2a0('0x1'));var BPromise=require(_0xa2a0('0x2'));var rs=require(_0xa2a0('0x3'));var fs=require('fs');var Redis=require(_0xa2a0('0x4'));var db=require(_0xa2a0('0x5'))['db'];var utils=require(_0xa2a0('0x6'));var logger=require(_0xa2a0('0x7'))(_0xa2a0('0x8'));var config=require(_0xa2a0('0x9'));var jayson=require(_0xa2a0('0xa'));var client=jayson[_0xa2a0('0xb')][_0xa2a0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c631b,_0x5a02d4,_0x445095){return new BPromise(function(_0xa08228,_0x1af3b2){return client[_0xa2a0('0xd')](_0x2c631b,_0x445095)[_0xa2a0('0xe')](function(_0xec9e4f){logger['info']('License,\x20%s,\x20%s',_0x5a02d4,'request\x20sent');logger[_0xa2a0('0xf')](_0xa2a0('0x10'),_0x5a02d4,_0xa2a0('0x11'),JSON[_0xa2a0('0x12')](_0xec9e4f));if(_0xec9e4f[_0xa2a0('0x13')]){if(_0xec9e4f[_0xa2a0('0x13')]['code']===0x1f4){logger[_0xa2a0('0x13')](_0xa2a0('0x14'),_0x5a02d4,_0xec9e4f[_0xa2a0('0x13')][_0xa2a0('0x15')]);return _0x1af3b2(_0xec9e4f[_0xa2a0('0x13')][_0xa2a0('0x15')]);}logger[_0xa2a0('0x13')](_0xa2a0('0x14'),_0x5a02d4,_0xec9e4f[_0xa2a0('0x13')][_0xa2a0('0x15')]);return _0xa08228(_0xec9e4f[_0xa2a0('0x13')][_0xa2a0('0x15')]);}else{logger['info']('License,\x20%s,\x20%s',_0x5a02d4,_0xa2a0('0x11'));_0xa08228(_0xec9e4f[_0xa2a0('0x16')]['message']);}})[_0xa2a0('0x17')](function(_0x1f7851){logger[_0xa2a0('0x13')]('License,\x20%s,\x20%s',_0x5a02d4,_0x1f7851);_0x1af3b2(_0x1f7851);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index bef4273..5d5577f 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 _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 +var _0x7304=['index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','/:id/users','put','update','delete','removeDispositions','removeAnswers','removeSmtp','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x2c9a28,_0x30b126){var _0x17023b=function(_0x518bbc){while(--_0x518bbc){_0x2c9a28['push'](_0x2c9a28['shift']());}};_0x17023b(++_0x30b126);}(_0x7304,0x1f3));var _0x4730=function(_0xfd495c,_0x4a3c1a){_0xfd495c=_0xfd495c-0x0;var _0x561dd8=_0x7304[_0xfd495c];return _0x561dd8;};'use strict';var multer=require(_0x4730('0x0'));var util=require(_0x4730('0x1'));var path=require(_0x4730('0x2'));var timeout=require(_0x4730('0x3'));var express=require(_0x4730('0x4'));var router=express[_0x4730('0x5')]();var fs_extra=require(_0x4730('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4730('0x7'));var config=require(_0x4730('0x8'));var controller=require('./mailAccount.controller');router[_0x4730('0x9')]('/',auth[_0x4730('0xa')](),controller[_0x4730('0xb')]);router[_0x4730('0x9')](_0x4730('0xc'),auth[_0x4730('0xa')](),controller[_0x4730('0xd')]);router[_0x4730('0x9')](_0x4730('0xe'),auth[_0x4730('0xa')](),controller[_0x4730('0xf')]);router[_0x4730('0x9')](_0x4730('0x10'),auth['isAuthenticated'](),controller[_0x4730('0x11')]);router[_0x4730('0x9')]('/:id/canned_answers',auth[_0x4730('0xa')](),controller[_0x4730('0x12')]);router[_0x4730('0x9')](_0x4730('0x13'),auth['isAuthenticated'](),controller[_0x4730('0x14')]);router[_0x4730('0x9')](_0x4730('0x15'),auth[_0x4730('0xa')](),controller[_0x4730('0x16')]);router['get'](_0x4730('0x17'),auth[_0x4730('0xa')](),controller[_0x4730('0x18')]);router[_0x4730('0x9')](_0x4730('0x19'),auth[_0x4730('0xa')](),controller[_0x4730('0x1a')]);router[_0x4730('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0x4730('0x1b')]);router[_0x4730('0x9')](_0x4730('0x1c'),auth[_0x4730('0xa')](),controller[_0x4730('0x1d')]);router[_0x4730('0x9')]('/:id/users',auth[_0x4730('0xa')](),controller[_0x4730('0x1e')]);router[_0x4730('0x1f')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x4730('0x20')]);router['post'](_0x4730('0x21'),auth['isAuthenticated'](),controller[_0x4730('0x22')]);router['post']('/',auth[_0x4730('0xa')](),controller[_0x4730('0x23')]);router[_0x4730('0x1f')](_0x4730('0x13'),auth[_0x4730('0xa')](),controller[_0x4730('0x24')]);router['post']('/:id/out_servers',auth['isAuthenticated'](),controller[_0x4730('0x25')]);router[_0x4730('0x1f')]('/:id/interactions',auth[_0x4730('0xa')](),controller[_0x4730('0x26')]);router['post'](_0x4730('0x19'),auth[_0x4730('0xa')](),controller[_0x4730('0x27')]);router[_0x4730('0x1f')](_0x4730('0x28'),auth[_0x4730('0xa')](),controller[_0x4730('0x29')]);router['post'](_0x4730('0x2a'),auth[_0x4730('0xa')](),controller['addAgents']);router[_0x4730('0x2b')]('/:id',auth[_0x4730('0xa')](),controller[_0x4730('0x2c')]);router[_0x4730('0x2d')](_0x4730('0x10'),auth[_0x4730('0xa')](),controller[_0x4730('0x2e')]);router[_0x4730('0x2d')](_0x4730('0x21'),auth[_0x4730('0xa')](),controller[_0x4730('0x2f')]);router[_0x4730('0x2d')](_0x4730('0x13'),auth[_0x4730('0xa')](),controller['removeImap']);router['delete'](_0x4730('0x15'),auth['isAuthenticated'](),controller[_0x4730('0x30')]);router[_0x4730('0x2d')](_0x4730('0xe'),auth['isAuthenticated'](),controller[_0x4730('0x31')]);router[_0x4730('0x2d')](_0x4730('0x2a'),auth[_0x4730('0xa')](),controller['removeAgents']);module[_0x4730('0x32')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 94b59dd..7ab2991 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 _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 +var _0xf534=['mandatoryDisposition','ENUM','hotmail','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','INTEGER','UNSIGNED','TEXT','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf534,0x16c));var _0x4f53=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf534[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x4f53('0x0'));module[_0x4f53('0x1')]={'description':{'type':Sequelize[_0x4f53('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x4f53('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x4f53('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x4f53('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x4f53('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x4f53('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x4f53('0x4')](0x2)[_0x4f53('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x4f53('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x4f53('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4f53('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4f53('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4f53('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4f53('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4f53('0x4')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x4f53('0x3')],'defaultValue':![],'comment':_0x4f53('0x7'),'set':function(_0x3e3d86){if(!_0x3e3d86)this[_0x4f53('0x8')](_0x4f53('0x9'),null);this[_0x4f53('0x8')](_0x4f53('0xa'),_0x3e3d86);}},'provider':{'type':Sequelize[_0x4f53('0xb')]('gmail',_0x4f53('0xc'),'yahoo',_0x4f53('0xd')),'defaultValue':null,'get':function(){if(!this['getDataValue']('provider'))return'custom';return this[_0x4f53('0xe')](_0x4f53('0xf'));},'set':function(_0x131f7a){if(_0x131f7a===_0x4f53('0x10'))_0x131f7a=null;return this[_0x4f53('0x8')]('provider',_0x131f7a);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index c782198..31ab7f9 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 _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 +var _0x4319=['localhost','socket.io-emitter','./mailAccount.socket','register','client','http','request','then','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','info','catch','sendStatus','end','status','offset','undefined','count','limit','set','json','update','get','MailAccounts','UserProfileResource','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','smtp.gmail.com','hotmail','Unknown\x20email\x20service\x20provider','user','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','username','Imap','Smtp','index','MailServerOut','Pause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','include','findAll','show','params','MailServerIn','mandatoryDispositionPause','includeAll','find','body','provider','custom','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','pick','rows','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','create','email','ListId','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','fullname','internal','Tag','Tags','color','tag','sequelize','Transaction','ISOLATION_LEVELS','MailApplication','destroy','bulkCreate','findAndCountAll','priority','finally','getApplications','getMessages','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','CmList','List','updatedAt','DESC','Smtp\x20configuration\x20not\x20found','isNil','from','%s\x20<%s>','attachments','join','root','SendMail','List\x20not\x20found','Contacts','messageId','subject','attach','out','Interaction','Messages','verifySmtp','CloudProvider','getSmtpOptions','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','defaults'];(function(_0x53b4ac,_0x29d9f8){var _0x29c7c4=function(_0x107a75){while(--_0x107a75){_0x53b4ac['push'](_0x53b4ac['shift']());}};_0x29c7c4(++_0x29d9f8);}(_0x4319,0xba));var _0x9431=function(_0x1baa84,_0x3c938e){_0x1baa84=_0x1baa84-0x0;var _0x18523b=_0x4319[_0x1baa84];return _0x18523b;};'use strict';var moment=require(_0x9431('0x0'));var BPromise=require(_0x9431('0x1'));var util=require(_0x9431('0x2'));var path=require(_0x9431('0x3'));var _=require(_0x9431('0x4'));var juice=require(_0x9431('0x5'));var Redis=require(_0x9431('0x6'));var qs=require(_0x9431('0x7'));var logger=require(_0x9431('0x8'))('api');var config=require('../../config/environment');var db=require(_0x9431('0x9'))['db'];config[_0x9431('0xa')]=_[_0x9431('0xb')](config[_0x9431('0xa')],{'host':_0x9431('0xc'),'port':0x18eb});var socket=require(_0x9431('0xd'))(new Redis(config[_0x9431('0xa')]));require(_0x9431('0xe'))[_0x9431('0xf')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9431('0x10')][_0x9431('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x193da6,_0x998c88,_0x150e6c,_0x589b12){return new BPromise(function(_0x11c6ea,_0x1377f3){var _0x5ddd05=_0x589b12||client;return _0x5ddd05[_0x9431('0x12')](_0x193da6,_0x150e6c)[_0x9431('0x13')](function(_0x3e13e7){logger['info']('MailAccount,\x20%s,\x20%s',_0x998c88,_0x9431('0x14'));logger[_0x9431('0x15')](_0x9431('0x16'),_0x998c88,_0x9431('0x14'),JSON['stringify'](_0x3e13e7));if(_0x3e13e7['error']){if(_0x3e13e7[_0x9431('0x17')][_0x9431('0x18')]===0x1f4){logger[_0x9431('0x17')](_0x9431('0x19'),_0x998c88,_0x3e13e7[_0x9431('0x17')][_0x9431('0x1a')]);return _0x1377f3(_0x3e13e7['error'][_0x9431('0x1a')]);}logger[_0x9431('0x17')](_0x9431('0x19'),_0x998c88,_0x3e13e7[_0x9431('0x17')]['message']);return _0x11c6ea(_0x3e13e7[_0x9431('0x17')][_0x9431('0x1a')]);}else{logger[_0x9431('0x1b')](_0x9431('0x19'),_0x998c88,'request\x20sent');_0x11c6ea(_0x3e13e7['result'][_0x9431('0x1a')]);}})[_0x9431('0x1c')](function(_0x1eaaf4){logger[_0x9431('0x17')](_0x9431('0x19'),_0x998c88,_0x1eaaf4);_0x1377f3(_0x1eaaf4);});});}function respondWithStatusCode(_0x946128,_0x829931){_0x829931=_0x829931||0xcc;return function(_0x1220f1){if(_0x1220f1){return _0x946128[_0x9431('0x1d')](_0x829931);}return _0x946128['status'](_0x829931)[_0x9431('0x1e')]();};}function respondWithResult(_0x155d80,_0x58dbeb){_0x58dbeb=_0x58dbeb||0xc8;return function(_0x49f9d8){if(_0x49f9d8){return _0x155d80[_0x9431('0x1f')](_0x58dbeb)['json'](_0x49f9d8);}};}function respondWithFilteredResult(_0x41c0ee,_0x116592){return function(_0x55f91f){if(_0x55f91f){var _0x57e461=typeof _0x116592[_0x9431('0x20')]===_0x9431('0x21')&&typeof _0x116592['limit']==='undefined';var _0xc6d273=_0x55f91f['count'];var _0x18dd9a=_0x57e461?0x0:_0x116592[_0x9431('0x20')];var _0x168152=_0x57e461?_0x55f91f[_0x9431('0x22')]:_0x116592[_0x9431('0x20')]+_0x116592[_0x9431('0x23')];var _0x1de67b;if(_0x168152>=_0xc6d273){_0x168152=_0xc6d273;_0x1de67b=0xc8;}else{_0x1de67b=0xce;}_0x41c0ee[_0x9431('0x1f')](_0x1de67b);return _0x41c0ee[_0x9431('0x24')]('Content-Range',_0x18dd9a+'-'+_0x168152+'/'+_0xc6d273)[_0x9431('0x25')](_0x55f91f);}return null;};}function saveUpdates(_0x5b933d){return function(_0xb3caff){if(_0xb3caff){return _0xb3caff[_0x9431('0x26')](_0x5b933d)['then'](function(_0x216664){return _0x216664;});}return null;};}function removeEntity(_0x5a13ee){return function(_0x324e49){if(_0x324e49){return _0x324e49['destroy']()[_0x9431('0x13')](function(){var _0x27edf2=_0x324e49[_0x9431('0x27')]({'plain':!![]});var _0x8b72e3=_0x9431('0x28');return db[_0x9431('0x29')]['destroy']({'where':{'type':_0x8b72e3,'resourceId':_0x27edf2['id']}})['then'](function(){return _0x324e49;});})[_0x9431('0x13')](function(){_0x5a13ee[_0x9431('0x1f')](0xcc)[_0x9431('0x1e')]();});}};}function handleEntityNotFound(_0x419781){return function(_0x181bbe){if(!_0x181bbe){_0x419781[_0x9431('0x1d')](0x194);}return _0x181bbe;};}function handleError(_0x521e89,_0x2edffe){_0x2edffe=_0x2edffe||0x1f4;return function(_0x30f39b){logger[_0x9431('0x17')](_0x30f39b[_0x9431('0x2a')]);if(_0x30f39b[_0x9431('0x2b')]){delete _0x30f39b[_0x9431('0x2b')];}_0x521e89[_0x9431('0x1f')](_0x2edffe)[_0x9431('0x2c')](_0x30f39b);};}function getImapHost(_0x4a0c25){switch(_0x4a0c25){case _0x9431('0x2d'):return _0x9431('0x2e');case _0x9431('0x2f'):return _0x9431('0x30');case'hotmail':return _0x9431('0x31');case _0x9431('0x32'):return _0x9431('0x33');}throw new Error('Unknown\x20email\x20service\x20provider',_0x4a0c25);}function getSmtpHost(_0x5458a0){switch(_0x5458a0){case'gmail':return _0x9431('0x34');case _0x9431('0x2f'):return'smtp.mail.yahoo.com';case _0x9431('0x35'):return'smtp-mail.outlook.com';case _0x9431('0x32'):return'smtp.office365.com';}throw new Error(_0x9431('0x36'),_0x5458a0);}function getAuthenticationOptions(_0xbd6ae,_0x596bdc){var _0x3fec4b={};var _0x157730={};if(_0xbd6ae){_0x3fec4b[_0x9431('0x37')]=_0x157730['user']=_0x596bdc['username'];_0x3fec4b[_0x9431('0x38')]=_0x157730[_0x9431('0x39')]=_0x596bdc[_0x9431('0x38')];if(_0x596bdc['modernAuthentication']){_0x3fec4b[_0x9431('0x3a')]=_0x157730[_0x9431('0x3a')]=!![];_0x3fec4b[_0x9431('0x3b')]=_0x157730[_0x9431('0x3b')]=_0x596bdc[_0x9431('0x3b')];_0x3fec4b[_0x9431('0x38')]=_0x157730['pass']=null;}else{_0x3fec4b[_0x9431('0x3b')]=_0x157730[_0x9431('0x3b')]=null;}_0x3fec4b[_0x9431('0x3c')]=getImapHost(_0xbd6ae);_0x3fec4b[_0x9431('0x3d')]=0x3e1;_0x157730[_0x9431('0x3c')]=getSmtpHost(_0xbd6ae);_0x157730[_0x9431('0x3d')]=0x24b;_0x157730[_0x9431('0x3e')]=![];_0x3fec4b[_0x9431('0x3f')]=_0x157730[_0x9431('0x3f')]=null;}else{if(_0x596bdc[_0x9431('0x40')]){_0x3fec4b[_0x9431('0x37')]=_0x157730[_0x9431('0x37')]=_0x596bdc[_0x9431('0x41')];_0x3fec4b['password']=_0x157730[_0x9431('0x39')]=_0x596bdc[_0x9431('0x38')];}else{_0x3fec4b[_0x9431('0x40')]=_0x157730[_0x9431('0x40')]=![];_0x3fec4b[_0x9431('0x37')]=_0x157730['user']=null;_0x3fec4b[_0x9431('0x38')]=_0x157730[_0x9431('0x39')]=null;}_0x3fec4b[_0x9431('0x3c')]=_0x596bdc[_0x9431('0x42')][_0x9431('0x3c')];_0x3fec4b[_0x9431('0x3d')]=_0x596bdc[_0x9431('0x42')]['port'];_0x157730[_0x9431('0x3c')]=_0x596bdc['Smtp'][_0x9431('0x3c')];_0x157730[_0x9431('0x3d')]=_0x596bdc[_0x9431('0x43')][_0x9431('0x3d')];}return{'Imap':_0x3fec4b,'Smtp':_0x157730};}exports[_0x9431('0x44')]=function(_0x4ef666,_0x4a6914){var _0x2460d3={'include':[{'model':db['MailServerIn'],'as':_0x9431('0x42')},{'model':db[_0x9431('0x45')],'as':'Smtp'},{'model':db[_0x9431('0x46')],'as':'mandatoryDispositionPause'}]},_0x364924={},_0x475a40={'count':0x0,'rows':[]};var _0x5f09e7=_[_0x9431('0x47')](db[_0x9431('0x48')][_0x9431('0x49')],function(_0x437180){return{'name':_0x437180[_0x9431('0x4a')],'type':_0x437180[_0x9431('0x4b')][_0x9431('0x4c')]};});_0x364924[_0x9431('0x4d')]=_[_0x9431('0x47')](_0x5f09e7,_0x9431('0x2b'));_0x364924[_0x9431('0x4e')]=_[_0x9431('0x4f')](_0x4ef666[_0x9431('0x4e')]);_0x364924['filters']=_[_0x9431('0x50')](_0x364924[_0x9431('0x4d')],_0x364924[_0x9431('0x4e')]);_0x2460d3['attributes']=_[_0x9431('0x50')](_0x364924[_0x9431('0x4d')],qs[_0x9431('0x51')](_0x4ef666[_0x9431('0x4e')][_0x9431('0x51')]));_0x2460d3['attributes']=_0x2460d3[_0x9431('0x52')][_0x9431('0x53')]?_0x2460d3[_0x9431('0x52')]:_0x364924[_0x9431('0x4d')];if(!_0x4ef666[_0x9431('0x4e')][_0x9431('0x54')](_0x9431('0x55'))){_0x2460d3[_0x9431('0x23')]=qs[_0x9431('0x23')](_0x4ef666[_0x9431('0x4e')][_0x9431('0x23')]);_0x2460d3[_0x9431('0x20')]=qs[_0x9431('0x20')](_0x4ef666[_0x9431('0x4e')][_0x9431('0x20')]);}_0x2460d3[_0x9431('0x56')]=qs[_0x9431('0x57')](_0x4ef666[_0x9431('0x4e')][_0x9431('0x57')]);_0x2460d3[_0x9431('0x58')]=qs[_0x9431('0x59')](_['pick'](_0x4ef666[_0x9431('0x4e')],_0x364924[_0x9431('0x59')]),_0x5f09e7);if(_0x4ef666[_0x9431('0x4e')][_0x9431('0x5a')]){_0x2460d3[_0x9431('0x58')]=_['merge'](_0x2460d3['where'],{'$or':_[_0x9431('0x47')](_0x5f09e7,function(_0x1f7199){if(_0x1f7199[_0x9431('0x4b')]!==_0x9431('0x5b')){var _0x4f08a7={};_0x4f08a7[_0x1f7199['name']]={'$like':'%'+_0x4ef666[_0x9431('0x4e')][_0x9431('0x5a')]+'%'};return _0x4f08a7;}})});}_0x2460d3=_[_0x9431('0x5c')]({},_0x2460d3,_0x4ef666[_0x9431('0x5d')]);var _0x2556f7={'where':_0x2460d3[_0x9431('0x58')]};return db[_0x9431('0x48')][_0x9431('0x22')](_0x2556f7)['then'](function(_0x52aa2d){_0x475a40['count']=_0x52aa2d;if(_0x4ef666['query']['includeAll']){_0x2460d3[_0x9431('0x5e')]=[{'all':!![]}];}return db[_0x9431('0x48')][_0x9431('0x5f')](_0x2460d3);})[_0x9431('0x13')](function(_0x11ef3c){_0x475a40['rows']=_0x11ef3c;return _0x475a40;})[_0x9431('0x13')](respondWithFilteredResult(_0x4a6914,_0x2460d3))[_0x9431('0x1c')](handleError(_0x4a6914,null));};exports[_0x9431('0x60')]=function(_0x1223f1,_0x378d45){var _0x4c2e5d={'raw':![],'where':{'id':_0x1223f1[_0x9431('0x61')]['id']},'include':[{'model':db[_0x9431('0x62')],'as':_0x9431('0x42')},{'model':db['MailServerOut'],'as':_0x9431('0x43')},{'model':db[_0x9431('0x46')],'as':_0x9431('0x63')}]},_0x37b3fa={};_0x37b3fa['model']=_[_0x9431('0x4f')](db[_0x9431('0x48')]['rawAttributes']);_0x37b3fa[_0x9431('0x4e')]=_['keys'](_0x1223f1[_0x9431('0x4e')]);_0x37b3fa[_0x9431('0x59')]=_['intersection'](_0x37b3fa[_0x9431('0x4d')],_0x37b3fa[_0x9431('0x4e')]);_0x4c2e5d[_0x9431('0x52')]=_[_0x9431('0x50')](_0x37b3fa[_0x9431('0x4d')],qs['fields'](_0x1223f1[_0x9431('0x4e')][_0x9431('0x51')]));_0x4c2e5d[_0x9431('0x52')]=_0x4c2e5d[_0x9431('0x52')]['length']?_0x4c2e5d['attributes']:_0x37b3fa[_0x9431('0x4d')];if(_0x1223f1['query'][_0x9431('0x64')]){_0x4c2e5d['include']=[{'all':!![]}];}_0x4c2e5d=_[_0x9431('0x5c')]({},_0x4c2e5d,_0x1223f1[_0x9431('0x5d')]);return db[_0x9431('0x48')][_0x9431('0x65')](_0x4c2e5d)['then'](handleEntityNotFound(_0x378d45,null))['then'](respondWithResult(_0x378d45,null))['catch'](handleError(_0x378d45,null));};exports['update']=function(_0x18e128,_0x4d65a4){if(_0x18e128[_0x9431('0x66')]['id']){delete _0x18e128[_0x9431('0x66')]['id'];}var _0x57b207=_0x18e128['body'][_0x9431('0x67')]===_0x9431('0x68')?null:_0x18e128[_0x9431('0x66')][_0x9431('0x67')];var _0x518646=_0x18e128[_0x9431('0x66')]['Imap']||{};var _0x51bef4=_0x18e128['body'][_0x9431('0x43')]||{};if(_0x57b207){_0x518646[_0x9431('0x3c')]=getImapHost(_0x57b207);_0x518646['port']=0x3e1;_0x51bef4['host']=getSmtpHost(_0x57b207);_0x51bef4[_0x9431('0x3d')]=0x24b;_0x51bef4[_0x9431('0x3e')]=![];}if(_0x51bef4[_0x9431('0x3a')]){_0x51bef4[_0x9431('0x3e')]=![];}else{_0x51bef4['CloudProviderId']=null;}if(!_0x518646[_0x9431('0x3a')])_0x518646[_0x9431('0x3b')]=null;_0x18e128[_0x9431('0x66')][_0x9431('0x42')]=_0x518646;_0x18e128[_0x9431('0x66')][_0x9431('0x43')]=_0x51bef4;return db[_0x9431('0x48')][_0x9431('0x65')]({'where':{'id':_0x18e128[_0x9431('0x61')]['id']},'include':[{'model':db[_0x9431('0x62')],'as':_0x9431('0x42')},{'model':db[_0x9431('0x45')],'as':_0x9431('0x43')},{'model':db[_0x9431('0x46')],'as':_0x9431('0x63')}]})[_0x9431('0x13')](handleEntityNotFound(_0x4d65a4,null))[_0x9431('0x13')](function(_0x497899){if(!_0x497899)throw new Error('Mail\x20Account\x20not\x20found');if(_0x497899['service'])delete _0x18e128[_0x9431('0x66')][_0x9431('0x42')];return _0x497899;})[_0x9431('0x13')](saveUpdates(_0x18e128[_0x9431('0x66')],null))[_0x9431('0x13')](function(_0x2c861e){if(!_0x18e128[_0x9431('0x66')][_0x9431('0x42')])return _0x2c861e;return db[_0x9431('0x62')][_0x9431('0x26')](_0x18e128[_0x9431('0x66')][_0x9431('0x42')],{'where':{'MailAccountId':_0x2c861e['id']}})[_0x9431('0x13')](function(){return _0x2c861e;});})[_0x9431('0x13')](function(_0x18396f){if(!_0x18e128[_0x9431('0x66')][_0x9431('0x43')])return _0x18396f;return db[_0x9431('0x45')][_0x9431('0x26')](_0x18e128[_0x9431('0x66')][_0x9431('0x43')],{'where':{'MailAccountId':_0x18396f['id']}})[_0x9431('0x13')](function(){return _0x18396f;});})[_0x9431('0x13')](respondWithResult(_0x4d65a4,null))['catch'](handleError(_0x4d65a4,null));};exports['describe']=function(_0x257f58,_0x22bbcf){return db[_0x9431('0x48')][_0x9431('0x69')]()[_0x9431('0x13')](respondWithResult(_0x22bbcf,null))[_0x9431('0x1c')](handleError(_0x22bbcf,null));};exports[_0x9431('0x6a')]=function(_0x30efeb,_0xb26ed4){if(_0x30efeb[_0x9431('0x66')]['id']){delete _0x30efeb[_0x9431('0x66')]['id'];}return db[_0x9431('0x48')][_0x9431('0x65')]({'where':{'id':_0x30efeb['params']['id']}})[_0x9431('0x13')](handleEntityNotFound(_0xb26ed4,null))[_0x9431('0x13')](function(_0x12da14){if(_0x12da14){_0x30efeb[_0x9431('0x66')][_0x9431('0x6b')]=_0x12da14['id'];return db[_0x9431('0x6c')]['create'](_0x30efeb[_0x9431('0x66')]);}})[_0x9431('0x13')](respondWithResult(_0xb26ed4,null))[_0x9431('0x1c')](handleError(_0xb26ed4,null));};exports[_0x9431('0x6d')]=function(_0x44e391,_0x359b15){var _0x4e6dbc={'raw':![],'where':{}};var _0x30e44a={};var _0x2fc281={'count':0x0,'rows':[]};return db[_0x9431('0x48')][_0x9431('0x6e')]({'where':{'id':_0x44e391[_0x9431('0x61')]['id']}})[_0x9431('0x13')](handleEntityNotFound(_0x359b15,null))['then'](function(_0x35ff91){if(_0x35ff91){_0x30e44a[_0x9431('0x4d')]=_['keys'](db['Disposition'][_0x9431('0x49')]);_0x30e44a[_0x9431('0x4e')]=_[_0x9431('0x4f')](_0x44e391[_0x9431('0x4e')]);_0x30e44a[_0x9431('0x59')]=_[_0x9431('0x50')](_0x30e44a[_0x9431('0x4d')],_0x30e44a['query']);_0x4e6dbc[_0x9431('0x52')]=_['intersection'](_0x30e44a['model'],qs[_0x9431('0x51')](_0x44e391[_0x9431('0x4e')][_0x9431('0x51')]));_0x4e6dbc['attributes']=_0x4e6dbc[_0x9431('0x52')][_0x9431('0x53')]?_0x4e6dbc[_0x9431('0x52')]:_0x30e44a['model'];if(!_0x44e391['query'][_0x9431('0x54')](_0x9431('0x55'))){_0x4e6dbc[_0x9431('0x23')]=qs['limit'](_0x44e391[_0x9431('0x4e')]['limit']);_0x4e6dbc[_0x9431('0x20')]=qs['offset'](_0x44e391[_0x9431('0x4e')][_0x9431('0x20')]);}_0x4e6dbc['order']=qs[_0x9431('0x57')](_0x44e391['query'][_0x9431('0x57')]);_0x4e6dbc[_0x9431('0x58')]=qs[_0x9431('0x59')](_[_0x9431('0x6f')](_0x44e391[_0x9431('0x4e')],_0x30e44a[_0x9431('0x59')]));_0x4e6dbc['where'][_0x9431('0x6b')]=_0x35ff91['id'];if(_0x44e391['query'][_0x9431('0x5a')]){_0x4e6dbc[_0x9431('0x58')]=_['merge'](_0x4e6dbc['where'],{'$or':_[_0x9431('0x47')](_0x4e6dbc[_0x9431('0x52')],function(_0x234e46){var _0x446a8f={};_0x446a8f[_0x234e46]={'$like':'%'+_0x44e391[_0x9431('0x4e')][_0x9431('0x5a')]+'%'};return _0x446a8f;})});}_0x4e6dbc=_['merge']({},_0x4e6dbc,_0x44e391['options']);return db[_0x9431('0x6c')][_0x9431('0x22')]({'where':_0x4e6dbc['where']})[_0x9431('0x13')](function(_0x2beb1f){_0x2fc281[_0x9431('0x22')]=_0x2beb1f;if(_0x44e391[_0x9431('0x4e')]['includeAll']){_0x4e6dbc[_0x9431('0x5e')]=[{'all':!![]}];}return db[_0x9431('0x6c')]['findAll'](_0x4e6dbc);})['then'](function(_0x84e22c){_0x2fc281[_0x9431('0x70')]=_0x84e22c;return _0x2fc281;});}})['then'](respondWithFilteredResult(_0x359b15,_0x4e6dbc))['catch'](handleError(_0x359b15,null));};exports['removeDispositions']=function(_0x258a32,_0x249660){return db[_0x9431('0x48')][_0x9431('0x65')]({'where':{'id':_0x258a32[_0x9431('0x61')]['id']}})[_0x9431('0x13')](handleEntityNotFound(_0x249660,null))[_0x9431('0x13')](function(_0x13e4ae){if(_0x13e4ae){return _0x13e4ae['removeDispositions'](_0x258a32[_0x9431('0x4e')][_0x9431('0x71')]);}})[_0x9431('0x13')](respondWithStatusCode(_0x249660,null))['catch'](handleError(_0x249660,null));};exports[_0x9431('0x72')]=function(_0x8adcba,_0x370b6d){if(_0x8adcba[_0x9431('0x66')]['id']){delete _0x8adcba[_0x9431('0x66')]['id'];}return db[_0x9431('0x48')][_0x9431('0x65')]({'where':{'id':_0x8adcba[_0x9431('0x61')]['id']}})['then'](handleEntityNotFound(_0x370b6d,null))[_0x9431('0x13')](function(_0x268653){if(_0x268653){_0x8adcba[_0x9431('0x66')][_0x9431('0x6b')]=_0x268653['id'];return db['CannedAnswer']['create'](_0x8adcba['body']);}})[_0x9431('0x13')](respondWithResult(_0x370b6d,null))[_0x9431('0x1c')](handleError(_0x370b6d,null));};exports[_0x9431('0x73')]=function(_0x10b645,_0x584eaa){var _0x5557c3={'raw':![],'where':{}};var _0x198163={};var _0x48dd22={'count':0x0,'rows':[]};return db['MailAccount'][_0x9431('0x6e')]({'where':{'id':_0x10b645[_0x9431('0x61')]['id']}})[_0x9431('0x13')](handleEntityNotFound(_0x584eaa,null))[_0x9431('0x13')](function(_0x72a393){if(_0x72a393){_0x198163[_0x9431('0x4d')]=_['keys'](db[_0x9431('0x74')][_0x9431('0x49')]);_0x198163[_0x9431('0x4e')]=_[_0x9431('0x4f')](_0x10b645[_0x9431('0x4e')]);_0x198163[_0x9431('0x59')]=_[_0x9431('0x50')](_0x198163[_0x9431('0x4d')],_0x198163[_0x9431('0x4e')]);_0x5557c3['attributes']=_[_0x9431('0x50')](_0x198163['model'],qs['fields'](_0x10b645[_0x9431('0x4e')][_0x9431('0x51')]));_0x5557c3[_0x9431('0x52')]=_0x5557c3[_0x9431('0x52')][_0x9431('0x53')]?_0x5557c3[_0x9431('0x52')]:_0x198163['model'];if(!_0x10b645[_0x9431('0x4e')][_0x9431('0x54')]('nolimit')){_0x5557c3[_0x9431('0x23')]=qs[_0x9431('0x23')](_0x10b645['query'][_0x9431('0x23')]);_0x5557c3[_0x9431('0x20')]=qs[_0x9431('0x20')](_0x10b645[_0x9431('0x4e')][_0x9431('0x20')]);}_0x5557c3[_0x9431('0x56')]=qs[_0x9431('0x57')](_0x10b645[_0x9431('0x4e')][_0x9431('0x57')]);_0x5557c3[_0x9431('0x58')]=qs[_0x9431('0x59')](_[_0x9431('0x6f')](_0x10b645[_0x9431('0x4e')],_0x198163['filters']));_0x5557c3[_0x9431('0x58')][_0x9431('0x6b')]=_0x72a393['id'];if(_0x10b645[_0x9431('0x4e')][_0x9431('0x5a')]){_0x5557c3['where']=_[_0x9431('0x5c')](_0x5557c3['where'],{'$or':_[_0x9431('0x47')](_0x5557c3[_0x9431('0x52')],function(_0x16a68e){var _0x5c1f24={};_0x5c1f24[_0x16a68e]={'$like':'%'+_0x10b645[_0x9431('0x4e')][_0x9431('0x5a')]+'%'};return _0x5c1f24;})});}_0x5557c3=_[_0x9431('0x5c')]({},_0x5557c3,_0x10b645[_0x9431('0x5d')]);return db['CannedAnswer'][_0x9431('0x22')]({'where':_0x5557c3['where']})[_0x9431('0x13')](function(_0x2be8b6){_0x48dd22[_0x9431('0x22')]=_0x2be8b6;if(_0x10b645['query'][_0x9431('0x64')]){_0x5557c3[_0x9431('0x5e')]=[{'all':!![]}];}return db[_0x9431('0x74')][_0x9431('0x5f')](_0x5557c3);})['then'](function(_0x5d6459){_0x48dd22[_0x9431('0x70')]=_0x5d6459;return _0x48dd22;});}})[_0x9431('0x13')](respondWithFilteredResult(_0x584eaa,_0x5557c3))[_0x9431('0x1c')](handleError(_0x584eaa,null));};exports['removeAnswers']=function(_0x72c9f,_0x31fc80){return db[_0x9431('0x48')][_0x9431('0x65')]({'where':{'id':_0x72c9f['params']['id']}})[_0x9431('0x13')](handleEntityNotFound(_0x31fc80,null))[_0x9431('0x13')](function(_0x3ffda8){if(_0x3ffda8){return _0x3ffda8[_0x9431('0x75')](_0x72c9f[_0x9431('0x4e')][_0x9431('0x71')]);}})[_0x9431('0x13')](respondWithStatusCode(_0x31fc80,null))[_0x9431('0x1c')](handleError(_0x31fc80,null));};exports[_0x9431('0x76')]=function(_0x5f49c6,_0xbf619c){var _0x2b3571={'name':_0x5f49c6['body']['name'],'key':_0x5f49c6[_0x9431('0x66')][_0x9431('0x4c')],'provider':_0x5f49c6['body'][_0x9431('0x67')]===_0x9431('0x68')?null:_0x5f49c6[_0x9431('0x66')][_0x9431('0x67')],'email':_0x5f49c6[_0x9431('0x66')][_0x9431('0x77')],'ListId':_0x5f49c6[_0x9431('0x66')][_0x9431('0x78')],'active':!_['isNil'](_0x5f49c6[_0x9431('0x66')][_0x9431('0x79')])?_0x5f49c6['body'][_0x9431('0x79')]:!![],'description':_0x5f49c6[_0x9431('0x66')][_0x9431('0x7a')]||null};var _0x4ac0e5=getAuthenticationOptions(_0x2b3571['provider'],_0x5f49c6[_0x9431('0x66')]);_0x2b3571[_0x9431('0x42')]=_0x4ac0e5[_0x9431('0x42')];_0x2b3571['Smtp']=_0x4ac0e5[_0x9431('0x43')];return db[_0x9431('0x48')][_0x9431('0x76')](_0x2b3571,{'include':[{'model':db[_0x9431('0x45')],'as':_0x9431('0x43')},{'model':db[_0x9431('0x62')],'as':_0x9431('0x42')}]})['then'](function(_0x13a757){var _0x530a75=_0x5f49c6[_0x9431('0x37')][_0x9431('0x27')]({'plain':!![]});if(!_0x530a75)throw new Error(_0x9431('0x7b'));if(_0x530a75['role']===_0x9431('0x37')){var _0x1bf3f7=_0x13a757[_0x9431('0x27')]({'plain':!![]});return db[_0x9431('0x7c')][_0x9431('0x65')]({'where':{'name':_0x9431('0x28'),'userProfileId':_0x530a75[_0x9431('0x7d')]},'raw':!![]})[_0x9431('0x13')](function(_0x3c304b){if(_0x3c304b&&_0x3c304b[_0x9431('0x7e')]===0x0){return db[_0x9431('0x29')]['create']({'name':_0x1bf3f7[_0x9431('0x2b')],'resourceId':_0x1bf3f7['id'],'type':_0x3c304b[_0x9431('0x2b')],'sectionId':_0x3c304b['id']},{})[_0x9431('0x13')](function(){return _0x13a757;});}else{return _0x13a757;}})[_0x9431('0x1c')](function(_0x34ab56){logger[_0x9431('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x34ab56);throw _0x34ab56;});}return _0x13a757;})['then'](respondWithResult(_0xbf619c,0xc9))[_0x9431('0x1c')](handleError(_0xbf619c,null));};exports[_0x9431('0x7f')]=function(_0x5707f7,_0x4cfe03){return db[_0x9431('0x48')][_0x9431('0x6e')]({'where':{'id':_0x5707f7['params']['id']}})[_0x9431('0x13')](handleEntityNotFound(_0x4cfe03,null))[_0x9431('0x13')](function(_0x167758){if(_0x167758){return _0x167758[_0x9431('0x7f')]();}return null;})[_0x9431('0x13')](respondWithResult(_0x4cfe03,null))[_0x9431('0x1c')](handleError(_0x4cfe03,null));};exports[_0x9431('0x80')]=function(_0x11ef03,_0x4154e5){if(_0x11ef03[_0x9431('0x66')]['id']){delete _0x11ef03['body']['id'];}return db[_0x9431('0x48')][_0x9431('0x65')]({'where':{'id':_0x11ef03[_0x9431('0x61')]['id']}})['then'](handleEntityNotFound(_0x4154e5,null))[_0x9431('0x13')](function(_0x279d1e){if(_0x279d1e){_0x11ef03[_0x9431('0x66')][_0x9431('0x6b')]=_0x279d1e['id'];return db[_0x9431('0x62')][_0x9431('0x76')](_0x11ef03[_0x9431('0x66')]);}})[_0x9431('0x13')](respondWithResult(_0x4154e5,null))['catch'](handleError(_0x4154e5,null));};exports[_0x9431('0x81')]=function(_0x7e3935,_0x28e7b2){return db[_0x9431('0x48')][_0x9431('0x6e')]({'where':{'id':_0x7e3935[_0x9431('0x61')]['id']}})['then'](handleEntityNotFound(_0x28e7b2,null))[_0x9431('0x13')](function(_0x528cbb){if(_0x528cbb){return _0x528cbb[_0x9431('0x82')](null);}return null;})[_0x9431('0x13')](respondWithStatusCode(_0x28e7b2,null))[_0x9431('0x1c')](handleError(_0x28e7b2,null));};exports[_0x9431('0x83')]=function(_0x3323e7,_0x1cad72){return db['MailAccount'][_0x9431('0x6e')]({'where':{'id':_0x3323e7['params']['id']}})[_0x9431('0x13')](handleEntityNotFound(_0x1cad72,null))[_0x9431('0x13')](function(_0x2b41a0){if(_0x2b41a0){return _0x2b41a0['getSmtp']();}return null;})['then'](respondWithResult(_0x1cad72,null))['catch'](handleError(_0x1cad72,null));};exports['addSmtp']=function(_0x31f61e,_0x236bb4){if(_0x31f61e[_0x9431('0x66')]['id']){delete _0x31f61e[_0x9431('0x66')]['id'];}return db[_0x9431('0x48')][_0x9431('0x65')]({'where':{'id':_0x31f61e[_0x9431('0x61')]['id']}})[_0x9431('0x13')](handleEntityNotFound(_0x236bb4,null))[_0x9431('0x13')](function(_0x192bd6){if(_0x192bd6){_0x31f61e[_0x9431('0x66')][_0x9431('0x6b')]=_0x192bd6['id'];return db[_0x9431('0x45')][_0x9431('0x76')](_0x31f61e[_0x9431('0x66')]);}})[_0x9431('0x13')](respondWithResult(_0x236bb4,null))[_0x9431('0x1c')](handleError(_0x236bb4,null));};exports[_0x9431('0x84')]=function(_0x502f08,_0x442c8e){return db[_0x9431('0x48')][_0x9431('0x6e')]({'where':{'id':_0x502f08['params']['id']}})[_0x9431('0x13')](handleEntityNotFound(_0x442c8e,null))[_0x9431('0x13')](function(_0x9e2309){if(_0x9e2309){return _0x9e2309[_0x9431('0x85')](null);}return null;})[_0x9431('0x13')](respondWithStatusCode(_0x442c8e,null))['catch'](handleError(_0x442c8e,null));};exports[_0x9431('0x86')]=function(_0x4fde86,_0x97748e){return db[_0x9431('0x87')]['find']({'where':{'id':_0x4fde86[_0x9431('0x61')]['id']}})[_0x9431('0x13')](handleEntityNotFound(_0x97748e,null))[_0x9431('0x13')](function(_0x214bec){if(_0x214bec){return _0x214bec[_0x9431('0x86')](_0x4fde86[_0x9431('0x66')][_0x9431('0x71')],_[_0x9431('0x88')](_0x4fde86[_0x9431('0x66')],[_0x9431('0x71'),'id'])||{});}})[_0x9431('0x13')](respondWithResult(_0x97748e,null))[_0x9431('0x1c')](handleError(_0x97748e,null));};exports[_0x9431('0x89')]=function(_0x5545a0,_0x4187bb){var _0x168b13={'raw':![],'where':{}};var _0x3bd523={};var _0x56a076={'count':0x0,'rows':[]};return db[_0x9431('0x48')][_0x9431('0x6e')]({'where':{'id':_0x5545a0[_0x9431('0x61')]['id']}})['then'](handleEntityNotFound(_0x4187bb,null))[_0x9431('0x13')](function(_0x3e78c8){if(_0x3e78c8){_0x3bd523[_0x9431('0x4d')]=_[_0x9431('0x4f')](db[_0x9431('0x87')]['rawAttributes']);_0x3bd523[_0x9431('0x4e')]=_[_0x9431('0x4f')](_0x5545a0[_0x9431('0x4e')]);_0x3bd523['filters']=_[_0x9431('0x50')](_0x3bd523[_0x9431('0x4d')],_0x3bd523[_0x9431('0x4e')]);_0x168b13['attributes']=_['intersection'](_0x3bd523[_0x9431('0x4d')],qs['fields'](_0x5545a0[_0x9431('0x4e')][_0x9431('0x51')]));_0x168b13[_0x9431('0x52')]=_0x168b13['attributes'][_0x9431('0x53')]?_0x168b13[_0x9431('0x52')]:_0x3bd523[_0x9431('0x4d')];if(!_0x5545a0['query']['hasOwnProperty'](_0x9431('0x55'))){_0x168b13[_0x9431('0x23')]=qs[_0x9431('0x23')](_0x5545a0[_0x9431('0x4e')][_0x9431('0x23')]);_0x168b13[_0x9431('0x20')]=qs['offset'](_0x5545a0[_0x9431('0x4e')]['offset']);}_0x168b13[_0x9431('0x56')]=qs[_0x9431('0x57')](_0x5545a0[_0x9431('0x4e')]['sort']);_0x168b13[_0x9431('0x58')]=qs['filters'](_[_0x9431('0x6f')](_0x5545a0[_0x9431('0x4e')],_0x3bd523[_0x9431('0x59')]));_0x168b13[_0x9431('0x58')]['MailAccountId']=_0x3e78c8['id'];if(_0x5545a0[_0x9431('0x4e')]['filter']){_0x168b13['where']=_[_0x9431('0x5c')](_0x168b13[_0x9431('0x58')],{'$or':_[_0x9431('0x47')](_0x168b13[_0x9431('0x52')],function(_0x46f3f7){var _0x4969d5={};_0x4969d5[_0x46f3f7]={'$like':'%'+_0x5545a0[_0x9431('0x4e')]['filter']+'%'};return _0x4969d5;})});}_0x168b13=_[_0x9431('0x5c')]({},_0x168b13,_0x5545a0[_0x9431('0x5d')]);return db[_0x9431('0x87')]['count']({'where':_0x168b13[_0x9431('0x58')]})[_0x9431('0x13')](function(_0x22f179){_0x56a076[_0x9431('0x22')]=_0x22f179;if(_0x5545a0['query'][_0x9431('0x64')]){_0x168b13[_0x9431('0x5e')]=[{'model':db[_0x9431('0x8a')],'as':_0x9431('0x8b'),'required':![]},{'model':db[_0x9431('0x8c')],'as':'Owner','attributes':['name',_0x9431('0x8d'),_0x9431('0x8e')],'required':![]},{'model':db[_0x9431('0x8f')],'as':_0x9431('0x90'),'attributes':['id',_0x9431('0x2b'),_0x9431('0x91')],'where':_0x5545a0['query'][_0x9431('0x92')]?{'id':_0x5545a0['query']['tag']}:undefined,'required':_0x5545a0[_0x9431('0x4e')][_0x9431('0x92')]?!![]:![]}];}return db['MailInteraction']['findAll'](_0x168b13);})[_0x9431('0x13')](function(_0x369bf5){_0x56a076['rows']=_0x369bf5;return _0x56a076;});}})[_0x9431('0x13')](respondWithFilteredResult(_0x4187bb,_0x168b13))[_0x9431('0x1c')](handleError(_0x4187bb,null));};exports['addApplications']=function addApplications(_0x3383a5,_0x2a921b){var _0x268ef1=_0x3383a5['params']['id'];var _0x57ff55=_0x3383a5[_0x9431('0x66')];var _0x5b68d6=0xc8;var _0x3741f0=null;return db[_0x9431('0x93')]['transaction']({'isolationLevel':db[_0x9431('0x93')][_0x9431('0x94')][_0x9431('0x95')]['READ_COMMITTED']},function(_0x27331b){return db['MailAccount'][_0x9431('0x6e')]({'where':{'id':_0x268ef1},'transaction':_0x27331b})['then'](function(_0x1de599){if(_0x1de599){return db[_0x9431('0x96')][_0x9431('0x97')]({'where':{'MailAccountId':_0x268ef1},'transaction':_0x27331b})['then'](function(){var _0x57e6e0=_['map'](_0x57ff55,function(_0xa474f6){_0xa474f6[_0x9431('0x6b')]=_0x268ef1;return _0xa474f6;});return db['MailApplication'][_0x9431('0x98')](_0x57e6e0,{'transaction':_0x27331b});});}else{_0x5b68d6=0x194;_0x3741f0=[];}});})['then'](function(){if(_0x5b68d6!==0x194){return db[_0x9431('0x96')][_0x9431('0x99')]({'where':{'MailAccountId':_0x268ef1},'order':_0x9431('0x9a')})[_0x9431('0x13')](function(_0x27c70){_0x3741f0=_0x27c70;});}})[_0x9431('0x1c')](function(_0x53565a){_0x5b68d6=0x1f4;logger[_0x9431('0x17')](_0x53565a[_0x9431('0x2a')]);if(_0x53565a['name']){delete _0x53565a['name'];}_0x3741f0=_0x53565a;})[_0x9431('0x9b')](function(){if(_0x3741f0===null){_0x2a921b['sendStatus'](_0x5b68d6);}else{if(_0x5b68d6===0x1f4){_0x2a921b[_0x9431('0x1f')](_0x5b68d6)[_0x9431('0x2c')](_0x3741f0);}else{_0x2a921b[_0x9431('0x1f')](_0x5b68d6)[_0x9431('0x25')](_0x3741f0);}}});};exports[_0x9431('0x9c')]=function(_0x245199,_0x3f8bea){var _0x4b934d={};var _0x41ae65={};var _0x4c2f22;var _0x28c1ba;return db[_0x9431('0x48')][_0x9431('0x6e')]({'where':{'id':_0x245199[_0x9431('0x61')]['id']}})[_0x9431('0x13')](handleEntityNotFound(_0x3f8bea,null))[_0x9431('0x13')](function(_0x4eef81){if(_0x4eef81){_0x4c2f22=_0x4eef81;_0x41ae65[_0x9431('0x4d')]=_[_0x9431('0x4f')](db[_0x9431('0x96')][_0x9431('0x49')]);_0x41ae65[_0x9431('0x4e')]=_['keys'](_0x245199[_0x9431('0x4e')]);_0x41ae65[_0x9431('0x59')]=_['intersection'](_0x41ae65[_0x9431('0x4d')],_0x41ae65['query']);_0x4b934d['attributes']=_[_0x9431('0x50')](_0x41ae65[_0x9431('0x4d')],qs[_0x9431('0x51')](_0x245199['query'][_0x9431('0x51')]));_0x4b934d[_0x9431('0x52')]=_0x4b934d[_0x9431('0x52')][_0x9431('0x53')]?_0x4b934d[_0x9431('0x52')]:_0x41ae65[_0x9431('0x4d')];_0x4b934d[_0x9431('0x56')]=qs[_0x9431('0x57')](_0x245199['query']['sort']);_0x4b934d[_0x9431('0x58')]=qs[_0x9431('0x59')](_[_0x9431('0x6f')](_0x245199[_0x9431('0x4e')],_0x41ae65['filters']));if(_0x245199[_0x9431('0x4e')][_0x9431('0x5a')]){_0x4b934d['where']=_[_0x9431('0x5c')](_0x4b934d[_0x9431('0x58')],{'$or':_[_0x9431('0x47')](_0x4b934d[_0x9431('0x52')],function(_0x5b5af7){var _0x108585={};_0x108585[_0x5b5af7]={'$like':'%'+_0x245199[_0x9431('0x4e')]['filter']+'%'};return _0x108585;})});}_0x4b934d=_[_0x9431('0x5c')]({},_0x4b934d,_0x245199[_0x9431('0x5d')]);return _0x4c2f22[_0x9431('0x9c')](_0x4b934d);}})[_0x9431('0x13')](function(_0x198c69){if(_0x198c69){_0x28c1ba=_0x198c69[_0x9431('0x53')];if(!_0x245199['query'][_0x9431('0x54')](_0x9431('0x55'))){_0x4b934d[_0x9431('0x23')]=qs['limit'](_0x245199[_0x9431('0x4e')][_0x9431('0x23')]);_0x4b934d['offset']=qs[_0x9431('0x20')](_0x245199['query']['offset']);}return _0x4c2f22[_0x9431('0x9c')](_0x4b934d);}})[_0x9431('0x13')](function(_0x3198c1){if(_0x3198c1){return _0x3198c1?{'count':_0x28c1ba,'rows':_0x3198c1}:null;}})['then'](respondWithResult(_0x3f8bea,null))['catch'](handleError(_0x3f8bea,null));};exports[_0x9431('0x9d')]=function(_0x248935,_0x552d6a){var _0x510295={'raw':!![],'where':{}};var _0x43dc44={};var _0x3afac2={'count':0x0,'rows':[]};return db[_0x9431('0x48')][_0x9431('0x6e')]({'where':{'id':_0x248935[_0x9431('0x61')]['id']}})[_0x9431('0x13')](handleEntityNotFound(_0x552d6a,null))[_0x9431('0x13')](function(_0x1c2760){if(_0x1c2760){_0x43dc44['model']=_[_0x9431('0x4f')](db['MailMessage'][_0x9431('0x49')]);_0x43dc44[_0x9431('0x4e')]=_['keys'](_0x248935[_0x9431('0x4e')]);_0x43dc44[_0x9431('0x59')]=_[_0x9431('0x50')](_0x43dc44[_0x9431('0x4d')],_0x43dc44[_0x9431('0x4e')]);_0x510295[_0x9431('0x52')]=_[_0x9431('0x50')](_0x43dc44[_0x9431('0x4d')],qs[_0x9431('0x51')](_0x248935[_0x9431('0x4e')]['fields']));_0x510295[_0x9431('0x52')]=_0x510295[_0x9431('0x52')][_0x9431('0x53')]?_0x510295['attributes']:_0x43dc44[_0x9431('0x4d')];if(!_0x248935['query'][_0x9431('0x54')](_0x9431('0x55'))){_0x510295['limit']=qs[_0x9431('0x23')](_0x248935[_0x9431('0x4e')][_0x9431('0x23')]);_0x510295['offset']=qs[_0x9431('0x20')](_0x248935[_0x9431('0x4e')][_0x9431('0x20')]);}_0x510295[_0x9431('0x56')]=qs['sort'](_0x248935[_0x9431('0x4e')][_0x9431('0x57')]);_0x510295['where']=qs[_0x9431('0x59')](_[_0x9431('0x6f')](_0x248935['query'],_0x43dc44[_0x9431('0x59')]));_0x510295[_0x9431('0x58')][_0x9431('0x6b')]=_0x1c2760['id'];if(_0x248935[_0x9431('0x4e')]['filter']){_0x510295[_0x9431('0x58')]=_[_0x9431('0x5c')](_0x510295['where'],{'$or':_[_0x9431('0x47')](_0x510295[_0x9431('0x52')],function(_0x38d57c){var _0x3e19d6={};_0x3e19d6[_0x38d57c]={'$like':'%'+_0x248935[_0x9431('0x4e')][_0x9431('0x5a')]+'%'};return _0x3e19d6;})});}if(_0x248935[_0x9431('0x4e')]['$gte']){var _0x518da1=_0x248935['query']['$gte'][_0x9431('0x9e')](',');var _0x4a5fcf={};_0x4a5fcf[_0x518da1[0x0]]={'$gte':moment(_0x518da1[0x1])[_0x9431('0x9f')](_0x9431('0xa0'))};_0x510295[_0x9431('0x58')]=_['merge'](_0x510295[_0x9431('0x58')],_0x4a5fcf);}_0x510295=_[_0x9431('0x5c')]({},_0x510295,_0x248935[_0x9431('0x5d')]);return db[_0x9431('0xa1')]['count']({'where':_0x510295[_0x9431('0x58')]})['then'](function(_0x5cfc55){_0x3afac2[_0x9431('0x22')]=_0x5cfc55;if(_0x248935[_0x9431('0x4e')][_0x9431('0x64')]){_0x510295['include']=[{'all':!![]}];}return db[_0x9431('0xa1')]['findAll'](_0x510295);})[_0x9431('0x13')](function(_0x2c5fd7){if(_0x248935[_0x9431('0x4e')][_0x9431('0xa2')]==='true'){for(var _0x4759ba=0x0;_0x4759ba<_0x2c5fd7['length'];_0x4759ba++){_0x2c5fd7[_0x4759ba][_0x9431('0x66')]=juice(_0x2c5fd7[_0x4759ba][_0x9431('0x66')]);}}_0x3afac2[_0x9431('0x70')]=_0x2c5fd7;return _0x3afac2;});}})[_0x9431('0x13')](respondWithFilteredResult(_0x552d6a,_0x510295))[_0x9431('0x1c')](handleError(_0x552d6a,null));};exports[_0x9431('0x2c')]=function(_0x167cc8,_0xf7333c){var _0x59adbf,_0x24fa27={},_0x12651d;if(_0x167cc8[_0x9431('0x66')]['to']){_0x12651d=_0x167cc8['body']['to']['split'](',')[0x0];}return db[_0x9431('0x48')][_0x9431('0x65')]({'where':{'id':_0x167cc8['params']['id']},'include':[{'model':db[_0x9431('0xa3')],'as':_0x9431('0xa4'),'include':[{'model':db[_0x9431('0x8a')],'as':'Contacts','where':{'email':_0x12651d},'limit':0x1,'order':[[_0x9431('0xa5'),_0x9431('0xa6')]]}]},{'model':db[_0x9431('0x45')],'as':_0x9431('0x43'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0xf7333c,null))['then'](function(_0x7ba994){if(!_0x7ba994)return;_0x59adbf=_0x7ba994;if(!_0x7ba994[_0x9431('0x43')])throw new Error(_0x9431('0xa7'));if(_[_0x9431('0xa8')](_0x167cc8['body'][_0x9431('0xa9')])){_0x167cc8[_0x9431('0x66')]['from']=util[_0x9431('0x9f')](_0x9431('0xaa'),_0x7ba994[_0x9431('0x2b')],_0x7ba994[_0x9431('0x77')]||_0x7ba994[_0x9431('0x43')]['user']);}if(_0x167cc8['body'][_0x9431('0xab')]&&_0x167cc8['body'][_0x9431('0xab')][_0x9431('0x53')]){for(var _0x277d60=0x0;_0x277d60<_0x167cc8[_0x9431('0x66')][_0x9431('0xab')][_0x9431('0x53')];_0x277d60+=0x1){_0x167cc8[_0x9431('0x66')][_0x9431('0xab')][_0x277d60]={'filename':_0x167cc8[_0x9431('0x66')][_0x9431('0xab')][_0x277d60][_0x9431('0x2b')],'path':path[_0x9431('0xac')](config[_0x9431('0xad')],'server/files/attachments',_0x167cc8[_0x9431('0x66')][_0x9431('0xab')][_0x277d60]['basename'])};}}var _0x578064=_0x7ba994['getSmtpOptions']();return respondWithRpcPromise(_0x9431('0xae'),'sendMail',{'account':_0x578064,'message':_0x167cc8['body']});})['then'](function(_0x495356){if(!_0x495356)return;_0x24fa27=_0x495356;if(!_0x59adbf[_0x9431('0xa4')])throw new Error(_0x9431('0xaf'));if(_0x59adbf[_0x9431('0xa4')][_0x9431('0xb0')][_0x9431('0x53')])return _0x59adbf[_0x9431('0xa4')][_0x9431('0xb0')][0x0];return db[_0x9431('0x8a')][_0x9431('0x76')](_[_0x9431('0xb')](_0x167cc8[_0x9431('0x66')],{'firstName':_0x167cc8[_0x9431('0x66')]['to'],'email':_0x167cc8[_0x9431('0x66')]['to'],'phone':_0x167cc8[_0x9431('0x66')]['to'],'ListId':_0x59adbf[_0x9431('0x78')]}));})['then'](function(_0x315133){if(!_0x315133)return;var _0x53b5f0={'UserId':_0x167cc8[_0x9431('0x37')]['id'],'ContactId':_0x315133['id'],'MailAccountId':_0x59adbf['id'],'inReplyTo':_0x24fa27[_0x9431('0xb1')],'to':_0x167cc8[_0x9431('0x66')][_0x9431('0xa9')],'cc':_0x167cc8['body']['cc'],'subject':_0x167cc8[_0x9431('0x66')][_0x9431('0xb2')],'attach':_0x167cc8[_0x9431('0x66')][_0x9431('0xb3')],'firstMsgDirection':_0x9431('0xb4'),'lastMsgAt':moment()[_0x9431('0x9f')](_0x9431('0xa0')),'lastMsgDirection':_0x9431('0xb4'),'Messages':[_['merge'](_0x167cc8[_0x9431('0x66')],{'messageId':_0x24fa27[_0x9431('0xb1')],'sentAt':moment()[_0x9431('0x9f')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x59adbf['id'],'UserId':_0x167cc8[_0x9431('0x37')]['id'],'ContactId':_0x315133['id']})]};if(_0x167cc8[_0x9431('0x66')][_0x9431('0xb5')]){_0x53b5f0=_['merge'](_0x53b5f0,_0x167cc8[_0x9431('0x66')][_0x9431('0xb5')]);}return db[_0x9431('0x87')][_0x9431('0x76')](_0x53b5f0,{'include':[{'model':db[_0x9431('0xa1')],'as':_0x9431('0xb6')}]});})[_0x9431('0x13')](respondWithResult(_0xf7333c,null))[_0x9431('0x1c')](handleError(_0xf7333c,null));};exports[_0x9431('0xb7')]=function(_0x3ade86,_0x5e787c){return db['MailAccount'][_0x9431('0x65')]({'where':{'id':_0x3ade86[_0x9431('0x61')]['id']},'include':[{'model':db[_0x9431('0x45')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x9431('0xb8')],'as':_0x9431('0xb8'),'raw':!![]}]}]})[_0x9431('0x13')](handleEntityNotFound(_0x5e787c,null))[_0x9431('0x13')](function(_0x57a949){if(!_0x57a949['Smtp'])return;var _0x148d46=_0x57a949[_0x9431('0xb9')]();return respondWithRpcPromise(_0x9431('0xba'),_0x9431('0xb7'),{'account':_0x148d46});})[_0x9431('0x13')](respondWithResult(_0x5e787c,null))[_0x9431('0x1c')](handleError(_0x5e787c,null));};exports[_0x9431('0x97')]=function(_0x4aa6fa,_0x31827f){return db[_0x9431('0x48')][_0x9431('0x65')]({'where':{'id':_0x4aa6fa['params']['id']}})[_0x9431('0x13')](handleEntityNotFound(_0x31827f,null))[_0x9431('0x13')](function(_0xfc3a18){if(_0xfc3a18&&_0xfc3a18[_0x9431('0x3f')]){throw new db[(_0x9431('0xbb'))][(_0x9431('0xbc'))](_0x9431('0xbd'));}return _0xfc3a18;})[_0x9431('0x13')](removeEntity(_0x31827f,null))[_0x9431('0x1c')](handleError(_0x31827f,null));};exports[_0x9431('0xbe')]=function(_0x30a3ea,_0xf51165){return db[_0x9431('0x48')][_0x9431('0x65')]({'where':{'id':_0x30a3ea[_0x9431('0x61')]['id']}})[_0x9431('0x13')](handleEntityNotFound(_0xf51165,null))['then'](function(_0x331243){if(_0x331243){return _0x331243['addAgents'](_0x30a3ea['body']['ids'],_[_0x9431('0x88')](_0x30a3ea['body'],[_0x9431('0x71'),'id'])||{})[_0x9431('0xbf')](function(_0x3665cb){for(var _0x1db5d5=0x0;_0x1db5d5<_0x30a3ea[_0x9431('0x66')][_0x9431('0x71')][_0x9431('0x53')];_0x1db5d5+=0x1){socket[_0x9431('0xc0')](_0x9431('0xc1'),{'UserId':Number(_0x30a3ea['body'][_0x9431('0x71')][_0x1db5d5]),'MailAccountId':Number(_0x30a3ea['params']['id'])});}return _0x3665cb;});}})[_0x9431('0x13')](respondWithResult(_0xf51165,null))[_0x9431('0x1c')](handleError(_0xf51165,null));};exports[_0x9431('0xc2')]=function(_0x26a907,_0x11c858){return db[_0x9431('0x48')]['find']({'where':{'id':_0x26a907[_0x9431('0x61')]['id']}})[_0x9431('0x13')](handleEntityNotFound(_0x11c858,null))[_0x9431('0x13')](function(_0x52465c){if(_0x52465c){return _0x52465c[_0x9431('0xc2')](_0x26a907[_0x9431('0x4e')][_0x9431('0x71')])[_0x9431('0x13')](function(){if(_[_0x9431('0xc3')](_0x26a907[_0x9431('0x4e')][_0x9431('0x71')])){for(var _0x45a875=0x0;_0x45a875<_0x26a907['query'][_0x9431('0x71')][_0x9431('0x53')];_0x45a875+=0x1){socket[_0x9431('0xc0')](_0x9431('0xc4'),{'UserId':Number(_0x26a907[_0x9431('0x4e')]['ids'][_0x45a875]),'MailAccountId':Number(_0x26a907['params']['id'])});}}else{socket[_0x9431('0xc0')](_0x9431('0xc4'),{'UserId':Number(_0x26a907[_0x9431('0x4e')][_0x9431('0x71')]),'MailAccountId':Number(_0x26a907[_0x9431('0x61')]['id'])});}});}})[_0x9431('0x13')](respondWithStatusCode(_0x11c858,null))[_0x9431('0x1c')](handleError(_0x11c858,null));};exports[_0x9431('0xc5')]=function(_0x4cf768,_0xb74a0a){var _0x570f5f={};var _0x2f4319={};var _0x15636e;var _0x506d8e;return db[_0x9431('0x48')]['findOne']({'where':{'id':_0x4cf768[_0x9431('0x61')]['id']}})[_0x9431('0x13')](handleEntityNotFound(_0xb74a0a,null))['then'](function(_0x4301fa){if(_0x4301fa){_0x15636e=_0x4301fa;_0x2f4319[_0x9431('0x4d')]=_[_0x9431('0x4f')](db[_0x9431('0x8c')]['rawAttributes']);_0x2f4319[_0x9431('0x4e')]=_[_0x9431('0x4f')](_0x4cf768[_0x9431('0x4e')]);_0x2f4319[_0x9431('0x59')]=_[_0x9431('0x50')](_0x2f4319[_0x9431('0x4d')],_0x2f4319[_0x9431('0x4e')]);_0x570f5f['attributes']=_[_0x9431('0x50')](_0x2f4319[_0x9431('0x4d')],qs[_0x9431('0x51')](_0x4cf768[_0x9431('0x4e')][_0x9431('0x51')]));_0x570f5f[_0x9431('0x52')]=_0x570f5f[_0x9431('0x52')][_0x9431('0x53')]?_0x570f5f['attributes']:_0x2f4319[_0x9431('0x4d')];_0x570f5f['order']=qs[_0x9431('0x57')](_0x4cf768[_0x9431('0x4e')]['sort']);_0x570f5f[_0x9431('0x58')]=qs[_0x9431('0x59')](_[_0x9431('0x6f')](_0x4cf768[_0x9431('0x4e')],_0x2f4319[_0x9431('0x59')]));if(_0x4cf768[_0x9431('0x4e')][_0x9431('0x5a')]){_0x570f5f[_0x9431('0x58')]=_['merge'](_0x570f5f[_0x9431('0x58')],{'$or':_[_0x9431('0x47')](_0x570f5f[_0x9431('0x52')],function(_0x1f54f2){var _0x264088={};_0x264088[_0x1f54f2]={'$like':'%'+_0x4cf768[_0x9431('0x4e')][_0x9431('0x5a')]+'%'};return _0x264088;})});}_0x570f5f=_[_0x9431('0x5c')]({},_0x570f5f,_0x4cf768['options']);return _0x15636e['getAgents'](_0x570f5f);}})['then'](function(_0x4a25a6){if(_0x4a25a6){_0x506d8e=_0x4a25a6['length'];if(!_0x4cf768['query'][_0x9431('0x54')](_0x9431('0x55'))){_0x570f5f[_0x9431('0x23')]=qs[_0x9431('0x23')](_0x4cf768[_0x9431('0x4e')][_0x9431('0x23')]);_0x570f5f[_0x9431('0x20')]=qs['offset'](_0x4cf768[_0x9431('0x4e')]['offset']);}return _0x15636e[_0x9431('0xc5')](_0x570f5f);}})['then'](function(_0x1f9ae8){if(_0x1f9ae8){return _0x1f9ae8?{'count':_0x506d8e,'rows':_0x1f9ae8}:null;}})[_0x9431('0x13')](respondWithResult(_0xb74a0a,null))[_0x9431('0x1c')](handleError(_0xb74a0a,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 66c7125..4f5052b 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 _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 +var _0xdd0c=['setMaxListeners','update','remove','emit','hook','exports','events','../../mysqldb','MailAccount'];(function(_0x4349d1,_0xc9c746){var _0x3b9bff=function(_0x1f7f28){while(--_0x1f7f28){_0x4349d1['push'](_0x4349d1['shift']());}};_0x3b9bff(++_0xc9c746);}(_0xdd0c,0x1ad));var _0xcdd0=function(_0x59c088,_0x2936e9){_0x59c088=_0x59c088-0x0;var _0x515183=_0xdd0c[_0x59c088];return _0x515183;};'use strict';var EventEmitter=require(_0xcdd0('0x0'));var MailAccount=require(_0xcdd0('0x1'))['db'][_0xcdd0('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xcdd0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcdd0('0x4'),'afterDestroy':_0xcdd0('0x5')};function emitEvent(_0x284276){return function(_0x221bc5,_0x8cb3e2,_0x5e5702){MailAccountEvents[_0xcdd0('0x6')](_0x284276+':'+_0x221bc5['id'],_0x221bc5);MailAccountEvents[_0xcdd0('0x6')](_0x284276,_0x221bc5);_0x5e5702(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0xcdd0('0x7')](e,emitEvent(event));}}module[_0xcdd0('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 022b66c..aee6e96 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 _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 +var _0xc084=['user','data5','pass','./mailAccount.attributes','exports','define','mail_accounts','provider','custom','service','host','Smtp','port','secure','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2'];(function(_0x49be9c,_0x113d81){var _0xc7e7b4=function(_0x192a0f){while(--_0x192a0f){_0x49be9c['push'](_0x49be9c['shift']());}};_0xc7e7b4(++_0x113d81);}(_0xc084,0x192));var _0x4c08=function(_0x4009af,_0x1bc8ac){_0x4009af=_0x4009af-0x0;var _0x16e058=_0xc084[_0x4009af];return _0x16e058;};'use strict';var attributes=require(_0x4c08('0x0'));module[_0x4c08('0x1')]=function(_0x477350){return _0x477350[_0x4c08('0x2')]('MailAccount',attributes,{'tableName':_0x4c08('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x2b2301=this;var _0x4c42e1={'id':_0x2b2301['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2b2301[_0x4c08('0x4')]!==_0x4c08('0x5')){_0x4c42e1[_0x4c08('0x6')]=_0x2b2301[_0x4c08('0x4')];}else{_0x4c42e1[_0x4c08('0x7')]=_0x2b2301[_0x4c08('0x8')][_0x4c08('0x7')];_0x4c42e1[_0x4c08('0x9')]=_0x2b2301[_0x4c08('0x8')][_0x4c08('0x9')];_0x4c42e1['secure']=_0x2b2301[_0x4c08('0x8')][_0x4c08('0xa')];}if(_0x2b2301[_0x4c08('0x8')]['authentication']){if(_0x2b2301[_0x4c08('0x8')][_0x4c08('0xb')]){if(!_0x2b2301[_0x4c08('0x8')][_0x4c08('0xc')])throw new Error(_0x4c08('0xd'));_0x4c42e1[_0x4c08('0xe')]={'type':_0x4c08('0xf'),'user':_0x2b2301['Smtp'][_0x4c08('0x10')],'accessToken':_0x2b2301['Smtp'][_0x4c08('0xc')][_0x4c08('0x11')]};}else{_0x4c42e1[_0x4c08('0xe')]={'user':_0x2b2301[_0x4c08('0x8')][_0x4c08('0x10')],'pass':_0x2b2301['Smtp'][_0x4c08('0x12')]};}}return _0x4c42e1;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index d1a4279..833354d 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 _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 +var _0x90ec=['Messages','inReplyTo','Contact\x20not\x20found','spread','update','interaction','created','bcc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','agent','waitForTheAssignedAgent','queueId','unshift','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','request\x20sent','stringify','error','code','MailAccount,\x20%s,\x20%s','message','catch','MailAccount','options','raw','where','attributes','limit','map','include','model','GetMailAccount','debug','find','smtp','setDataValue','smtpOptions','getSmtpOptions','ShowMailAccount','NotifyMailAccount','body','difference','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','omit','applications','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*','from','create','List\x20not\x20found','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage'];(function(_0x545c47,_0x2c5c95){var _0x2150ce=function(_0x1d0351){while(--_0x1d0351){_0x545c47['push'](_0x545c47['shift']());}};_0x2150ce(++_0x2c5c95);}(_0x90ec,0x1d4));var _0xc90e=function(_0x53c7f0,_0x2b9b5e){_0x53c7f0=_0x53c7f0-0x0;var _0x47734b=_0x90ec[_0x53c7f0];return _0x47734b;};'use strict';var _=require(_0xc90e('0x0'));var moment=require(_0xc90e('0x1'));var BPromise=require('bluebird');var rs=require(_0xc90e('0x2'));var Redis=require(_0xc90e('0x3'));var db=require(_0xc90e('0x4'))['db'];var logger=require(_0xc90e('0x5'))(_0xc90e('0x6'));var config=require('../../config/environment');var jayson=require(_0xc90e('0x7'));var client=jayson[_0xc90e('0x8')][_0xc90e('0x9')]({'port':0x232c});config['redis']=_[_0xc90e('0xa')](config['redis'],{'host':_0xc90e('0xb'),'port':0x18eb});var socket=require(_0xc90e('0xc'))(new Redis(config['redis']));require(_0xc90e('0xd'))[_0xc90e('0xe')](socket);function respondWithRpcPromise(_0x121335,_0x1a02ad,_0x3702ed){return new BPromise(function(_0x1bfb66,_0x386e63){return client[_0xc90e('0xf')](_0x121335,_0x3702ed)[_0xc90e('0x10')](function(_0x574156){logger[_0xc90e('0x11')]('MailAccount,\x20%s,\x20%s',_0x1a02ad,'request\x20sent');logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x1a02ad,_0xc90e('0x12'),JSON[_0xc90e('0x13')](_0x574156));if(_0x574156['error']){if(_0x574156[_0xc90e('0x14')][_0xc90e('0x15')]===0x1f4){logger['error'](_0xc90e('0x16'),_0x1a02ad,_0x574156[_0xc90e('0x14')][_0xc90e('0x17')]);return _0x386e63(_0x574156[_0xc90e('0x14')][_0xc90e('0x17')]);}logger[_0xc90e('0x14')]('MailAccount,\x20%s,\x20%s',_0x1a02ad,_0x574156[_0xc90e('0x14')][_0xc90e('0x17')]);return _0x1bfb66(_0x574156['error'][_0xc90e('0x17')]);}else{logger['info'](_0xc90e('0x16'),_0x1a02ad,_0xc90e('0x12'));_0x1bfb66(_0x574156['result'][_0xc90e('0x17')]);}})[_0xc90e('0x18')](function(_0x17ec6b){logger['error']('MailAccount,\x20%s,\x20%s',_0x1a02ad,_0x17ec6b);_0x386e63(_0x17ec6b);});});}exports['GetMailAccount']=function(_0x161a3a){var _0x147120=this;return new Promise(function(_0x25b1d7,_0x1dc258){return db[_0xc90e('0x19')]['findAll']({'raw':_0x161a3a[_0xc90e('0x1a')]?_0x161a3a['options'][_0xc90e('0x1b')]===undefined?!![]:![]:!![],'where':_0x161a3a[_0xc90e('0x1a')]?_0x161a3a['options'][_0xc90e('0x1c')]||null:null,'attributes':_0x161a3a[_0xc90e('0x1a')]?_0x161a3a[_0xc90e('0x1a')][_0xc90e('0x1d')]||null:null,'limit':_0x161a3a[_0xc90e('0x1a')]?_0x161a3a[_0xc90e('0x1a')][_0xc90e('0x1e')]||null:null,'include':_0x161a3a[_0xc90e('0x1a')]?_0x161a3a[_0xc90e('0x1a')]['include']?_[_0xc90e('0x1f')](_0x161a3a[_0xc90e('0x1a')][_0xc90e('0x20')],function(_0x380f3f){return{'model':db[_0x380f3f[_0xc90e('0x21')]],'as':_0x380f3f['as'],'attributes':_0x380f3f['attributes'],'include':_0x380f3f[_0xc90e('0x20')]?_[_0xc90e('0x1f')](_0x380f3f[_0xc90e('0x20')],function(_0x4fde04){return{'model':db[_0x4fde04[_0xc90e('0x21')]],'as':_0x4fde04['as'],'attributes':_0x4fde04[_0xc90e('0x1d')],'include':_0x4fde04[_0xc90e('0x20')]?_[_0xc90e('0x1f')](_0x4fde04[_0xc90e('0x20')],function(_0x270040){return{'model':db[_0x270040['model']],'as':_0x270040['as'],'attributes':_0x270040['attributes']};}):[]};}):[]};}):[]:[]})[_0xc90e('0x10')](function(_0x550e8f){logger[_0xc90e('0x11')](_0xc90e('0x22'),_0x161a3a);logger[_0xc90e('0x23')](_0xc90e('0x22'),_0x161a3a,JSON[_0xc90e('0x13')](_0x550e8f));_0x25b1d7(_0x550e8f);})[_0xc90e('0x18')](function(_0x42b79b){logger['error'](_0xc90e('0x22'),_0x42b79b[_0xc90e('0x17')],_0x161a3a);_0x1dc258(_0x147120['error'](0x1f4,_0x42b79b[_0xc90e('0x17')]));});});};exports['ShowMailAccount']=function(_0x25c9d5){var _0x297d85=this;return new Promise(function(_0xad857d,_0x3ecbc1){return db[_0xc90e('0x19')][_0xc90e('0x24')]({'raw':_0x25c9d5[_0xc90e('0x1a')]?_0x25c9d5[_0xc90e('0x1a')][_0xc90e('0x1b')]===undefined?!![]:![]:!![],'where':_0x25c9d5['options']?_0x25c9d5['options'][_0xc90e('0x1c')]||null:null,'attributes':_0x25c9d5[_0xc90e('0x1a')]?_0x25c9d5[_0xc90e('0x1a')][_0xc90e('0x1d')]||null:null,'include':_0x25c9d5[_0xc90e('0x1a')]?_0x25c9d5[_0xc90e('0x1a')][_0xc90e('0x20')]?_[_0xc90e('0x1f')](_0x25c9d5[_0xc90e('0x1a')][_0xc90e('0x20')],function(_0x4fc508){return{'model':db[_0x4fc508[_0xc90e('0x21')]],'as':_0x4fc508['as'],'attributes':_0x4fc508[_0xc90e('0x1d')],'include':_0x4fc508[_0xc90e('0x20')]?_[_0xc90e('0x1f')](_0x4fc508['include'],function(_0x5bcfe4){return{'model':db[_0x5bcfe4['model']],'as':_0x5bcfe4['as'],'attributes':_0x5bcfe4[_0xc90e('0x1d')],'include':_0x5bcfe4[_0xc90e('0x20')]?_[_0xc90e('0x1f')](_0x5bcfe4[_0xc90e('0x20')],function(_0x19d37e){return{'model':db[_0x19d37e['model']],'as':_0x19d37e['as'],'attributes':_0x19d37e[_0xc90e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc90e('0x10')](function(_0x1139eb){if(_0x25c9d5[_0xc90e('0x1a')][_0xc90e('0x25')]===!![])_0x1139eb[_0xc90e('0x26')](_0xc90e('0x27'),_0x1139eb[_0xc90e('0x28')]());logger[_0xc90e('0x11')](_0xc90e('0x29'),_0x25c9d5);logger[_0xc90e('0x23')](_0xc90e('0x29'),_0x25c9d5,JSON[_0xc90e('0x13')](_0x1139eb));_0xad857d(_0x1139eb);})['catch'](function(_0x42bce8){logger[_0xc90e('0x14')]('ShowMailAccount',_0x42bce8['message'],_0x25c9d5);_0x3ecbc1(_0x297d85[_0xc90e('0x14')](0x1f4,_0x42bce8['message']));});});};exports[_0xc90e('0x2a')]=function(_0x2c8829){var _0x5005cf=this;return new Promise(function(_0xca9e25,_0x4d7911){var _0x51ead2={'body':_0x2c8829[_0xc90e('0x2b')],'channel':'mail'};var _0x4baaea=_[_0xc90e('0x2c')](_[_0xc90e('0x2d')](db['CmContact'][_0xc90e('0x2e')]),[_0xc90e('0x2f'),_0xc90e('0x30'),_0xc90e('0x31'),_0xc90e('0x32')]);var _0x25b5da=![];if(_0x2c8829[_0xc90e('0x2b')]['id']){delete _0x2c8829[_0xc90e('0x2b')]['id'];}if(_['isNil'](_0x2c8829[_0xc90e('0x2b')]['from'])){return _0x4d7911(_0x5005cf['error'](0x1f4,_0xc90e('0x33')));}if(_['isNil'](_0x2c8829[_0xc90e('0x2b')]['body'])||_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x2b')]===''){return _0x4d7911(_0x5005cf[_0xc90e('0x14')](0x1f4,_0xc90e('0x34')));}if(_[_0xc90e('0x35')](_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x36')])){return _0x4d7911(_0x5005cf[_0xc90e('0x14')](0x1f4,_0xc90e('0x37')+_0x4baaea));}if(!_['includes'](_0x4baaea,_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x36')])){return _0x4d7911(_0x5005cf[_0xc90e('0x14')](0x1f4,_0xc90e('0x38')+_0x4baaea));}var _0x5dd284={};_0x5dd284[_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x36')]]=_0x2c8829[_0xc90e('0x2b')]['from'];return db[_0xc90e('0x19')]['find']({'where':{'id':_0x2c8829[_0xc90e('0x39')]['id']},'include':[{'model':db['CmList'],'as':_0xc90e('0x3a'),'include':[{'model':db['CmContact'],'as':_0xc90e('0x3b'),'where':_0x5dd284,'limit':0x1,'order':[[_0xc90e('0x30'),_0xc90e('0x3c')]]}]},{'model':db[_0xc90e('0x3d')],'as':_0xc90e('0x3e')},{'model':db[_0xc90e('0x3f')],'as':_0xc90e('0x40'),'include':[{'model':db[_0xc90e('0x41')],'as':'CloudProvider'}]}]})[_0xc90e('0x10')](function(_0x3de64f){if(_0x3de64f&&_0x3de64f['List']){var _0x50751f=_0x3de64f[_0xc90e('0x42')]({'plain':!![]});_0x51ead2['account']=_[_0xc90e('0x43')](_0x50751f,[_0xc90e('0x3e'),_0xc90e('0x3a')]);_0x51ead2[_0xc90e('0x39')][_0xc90e('0x27')]=_0x3de64f['getSmtpOptions']();_0x51ead2[_0xc90e('0x44')]=_0x50751f[_0xc90e('0x3e')];_0x51ead2['list']=_0x50751f[_0xc90e('0x3a')];_0x51ead2['applications']=_[_0xc90e('0x45')](_0x51ead2['applications'],[_0xc90e('0x46')],[_0xc90e('0x47')]);if(_0x51ead2[_0xc90e('0x39')]&&_0x51ead2[_0xc90e('0x39')][_0xc90e('0x48')]){_0x51ead2[_0xc90e('0x44')][_0xc90e('0x49')]({'id':0x0,'priority':_0x51ead2[_0xc90e('0x44')][_0xc90e('0x4a')]+0x1,'app':_0xc90e('0x4b'),'appdata':_0xc90e('0x48'),'interval':_0xc90e('0x4c')});}if(_0x51ead2[_0xc90e('0x39')][_0xc90e('0x3e')]){delete _0x51ead2[_0xc90e('0x39')][_0xc90e('0x3e')];}if(_0x51ead2['account'][_0xc90e('0x3a')]){delete _0x51ead2[_0xc90e('0x39')][_0xc90e('0x3a')];}if(_0x50751f[_0xc90e('0x3a')][_0xc90e('0x3b')][_0xc90e('0x4a')]){return _0x50751f[_0xc90e('0x3a')]['Contacts'][0x0];}var _0x1ec7f2=_['defaults'](_0x2c8829[_0xc90e('0x2b')],{'firstName':_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x4d')],'ListId':_0x50751f[_0xc90e('0x32')]});_0x1ec7f2[_0x2c8829[_0xc90e('0x2b')]['mapKey']]=_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x4d')];return db['CmContact'][_0xc90e('0x4e')](_0x1ec7f2);}else{throw new Error(_0xc90e('0x4f'));}})[_0xc90e('0x10')](function(_0xaebbb3){_0x51ead2['contact']=_0xaebbb3;if(_0xaebbb3){if(!_0x2c8829['body'][_0xc90e('0x17')][_0xc90e('0x50')]){_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x17')][_0xc90e('0x50')]=rs['generate']()+'\x20'+_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x17')]['from'];}var _0x4a0f64={'ContactId':_0xaebbb3['id'],'MailAccountId':_0x2c8829[_0xc90e('0x39')]['id'],'inReplyTo':_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x17')][_0xc90e('0x50')],'to':_0x2c8829['body'][_0xc90e('0x17')][_0xc90e('0x4d')],'cc':_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x17')]['cc'],'subject':_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x17')][_0xc90e('0x51')],'attach':_0x2c8829[_0xc90e('0x2b')]['message'][_0xc90e('0x52')],'lastMsgAt':moment()[_0xc90e('0x53')](_0xc90e('0x54')),'lastMsgDirection':'in'};return db[_0xc90e('0x55')][_0xc90e('0x24')]({'where':{'closed':![],'MailAccountId':_0x2c8829['account']['id']},'include':[{'model':db[_0xc90e('0x56')],'as':_0xc90e('0x57'),'attributes':[_0xc90e('0x50')],'where':{'messageId':_0x2c8829['body']['message'][_0xc90e('0x58')]}}]})['then'](function(_0x311083){if(_0x311083){return[_0x311083,![]];}return db['MailInteraction'][_0xc90e('0x4e')](_0x4a0f64)[_0xc90e('0x10')](function(_0x26b89b){return[_0x26b89b,!![]];});});}else{throw new Error(_0xc90e('0x59'));}})[_0xc90e('0x5a')](function(_0x379847,_0xb44c95){if(_0x379847){_0x25b5da=_0xb44c95;if(!_0xb44c95){return _0x379847[_0xc90e('0x5b')]({'inReplyTo':_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x17')][_0xc90e('0x50')],'to':_0x2c8829[_0xc90e('0x2b')]['message'][_0xc90e('0x4d')],'cc':_0x2c8829['body']['message']['cc'],'subject':_0x2c8829['body']['message'][_0xc90e('0x51')],'attach':_0x379847[_0xc90e('0x52')]?_0x379847['attach']:_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x17')][_0xc90e('0x52')],'substatus':null,'substatusAt':moment()[_0xc90e('0x53')](_0xc90e('0x54')),'lastMsgAt':moment()[_0xc90e('0x53')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x379847;}}})[_0xc90e('0x10')](function(_0x1cd004){_0x51ead2[_0xc90e('0x5c')]=_0x1cd004[_0xc90e('0x42')]({'plain':!![]});_0x51ead2[_0xc90e('0x5c')][_0xc90e('0x5d')]=_0x25b5da;return db['MailMessage'][_0xc90e('0x4e')]({'body':_0x2c8829['body'][_0xc90e('0x2b')],'MailAccountId':_0x2c8829['account']['id'],'MailInteractionId':_0x1cd004['id'],'direction':'in','ContactId':_0x51ead2['contact']['id'],'messageId':_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x17')]['messageId'],'from':_0x2c8829[_0xc90e('0x2b')]['message']['from'],'to':_0x2c8829['body']['message']['to'],'cc':_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x17')]['cc'],'subject':_0x2c8829['body'][_0xc90e('0x17')][_0xc90e('0x51')],'attach':_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x17')][_0xc90e('0x52')],'Attachments':_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x17')]['attachments'],'originTo':_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x17')]['originTo'],'originCc':_0x2c8829['body'][_0xc90e('0x17')]['originCc'],'bcc':_0x2c8829['body'][_0xc90e('0x17')][_0xc90e('0x5e')],'ChatWebsiteId':_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x17')][_0xc90e('0x5f')]||null,'originChannel':_0x2c8829[_0xc90e('0x2b')][_0xc90e('0x17')]['originChannel']||_0xc90e('0x60'),'ChatOfflineMessageId':_0x2c8829[_0xc90e('0x2b')]['message'][_0xc90e('0x61')]||null},{'include':[{'model':db[_0xc90e('0x62')],'as':_0xc90e('0x63')}]});})['then'](function(_0x4e2379){_0x51ead2[_0xc90e('0x17')]=_0x4e2379;if(!_0x51ead2['interaction'][_0xc90e('0x64')]){return;}return db[_0xc90e('0x65')][_0xc90e('0x24')]({'attributes':['id',_0xc90e('0x66')],'where':{'id':_0x51ead2['interaction'][_0xc90e('0x64')]}});})[_0xc90e('0x10')](function(_0x3fa08e){if(_0x3fa08e){_0x51ead2[_0xc90e('0x44')]['unshift']({'id':0x0,'priority':0x0,'app':_0xc90e('0x67'),'appdata':_0x3fa08e['name']+','+(_0x51ead2[_0xc90e('0x39')][_0xc90e('0x68')]||0xa),'interval':_0xc90e('0x4c')});}if(!_0x51ead2[_0xc90e('0x5c')][_0xc90e('0x69')]){return;}return db['MailQueue'][_0xc90e('0x24')]({'attributes':['id',_0xc90e('0x66')],'where':{'id':_0x51ead2['interaction'][_0xc90e('0x69')]}});})[_0xc90e('0x10')](function(_0xd7c0d9){if(_0xd7c0d9){_0x51ead2[_0xc90e('0x44')][_0xc90e('0x6a')]({'id':0x0,'priority':0x1,'app':_0xc90e('0x6b'),'appdata':_0xd7c0d9['name']+','+(_0x51ead2['account'][_0xc90e('0x6c')]||0x12c),'interval':_0xc90e('0x4c')});}return respondWithRpcPromise(_0xc90e('0x6d'),_0xc90e('0x6e'),_0x51ead2);})['then'](function(_0x23be25){_0xca9e25(_0x23be25);})['catch'](function(_0x5b5b61){_0x4d7911(_0x5005cf[_0xc90e('0x14')](0x1f4,_0x5b5b61[_0xc90e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 0304354..3b67b24 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 _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 +var _0xfc61=['length','./mailAccount.events','save','remove','update','emit','removeListener'];(function(_0x557a59,_0xda6692){var _0x21176d=function(_0xbc8118){while(--_0xbc8118){_0x557a59['push'](_0x557a59['shift']());}};_0x21176d(++_0xda6692);}(_0xfc61,0x78));var _0x1fc6=function(_0x9b7e1c,_0x3680d7){_0x9b7e1c=_0x9b7e1c-0x0;var _0xa3b16=_0xfc61[_0x9b7e1c];return _0xa3b16;};'use strict';var MailAccountEvents=require(_0x1fc6('0x0'));var events=[_0x1fc6('0x1'),_0x1fc6('0x2'),_0x1fc6('0x3')];function createListener(_0x49b30c,_0x569481){return function(_0x4be6d6){_0x569481[_0x1fc6('0x4')](_0x49b30c,_0x4be6d6);};}function removeListener(_0x3a7772,_0x451c27){return function(){MailAccountEvents[_0x1fc6('0x5')](_0x3a7772,_0x451c27);};}exports['register']=function(_0x5b5f8c){for(var _0x2c32ca=0x0,_0x2afe7c=events[_0x1fc6('0x6')];_0x2c32ca<_0x2afe7c;_0x2c32ca++){var _0x3b7967=events[_0x2c32ca];var _0x377d87=createListener('mailAccount:'+_0x3b7967,_0x5b5f8c);MailAccountEvents['on'](_0x3b7967,_0x377d87);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index afd1f25..21407bd 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 _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 +var _0x5ea8=['put','/:id','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./mailApplication.controller','get','isAuthenticated','show'];(function(_0xf9ec57,_0x206572){var _0x33af02=function(_0x348e87){while(--_0x348e87){_0xf9ec57['push'](_0xf9ec57['shift']());}};_0x33af02(++_0x206572);}(_0x5ea8,0x94));var _0x85ea=function(_0x39c6c9,_0x3f09d3){_0x39c6c9=_0x39c6c9-0x0;var _0x5d8d32=_0x5ea8[_0x39c6c9];return _0x5d8d32;};'use strict';var multer=require(_0x85ea('0x0'));var util=require(_0x85ea('0x1'));var path=require(_0x85ea('0x2'));var timeout=require(_0x85ea('0x3'));var express=require('express');var router=express[_0x85ea('0x4')]();var fs_extra=require(_0x85ea('0x5'));var auth=require(_0x85ea('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x85ea('0x7'));var controller=require(_0x85ea('0x8'));router[_0x85ea('0x9')]('/:id',auth[_0x85ea('0xa')](),controller[_0x85ea('0xb')]);router[_0x85ea('0xc')](_0x85ea('0xd'),auth['isAuthenticated'](),controller[_0x85ea('0xe')]);router[_0x85ea('0xf')](_0x85ea('0xd'),auth[_0x85ea('0xa')](),controller['destroy']);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 d56d2af..50fb2e8 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 _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 +var _0xfc18=['TEXT','STRING','sequelize','INTEGER','noop'];(function(_0x5b00a0,_0x3430e1){var _0x3fb7ce=function(_0x5a975c){while(--_0x5a975c){_0x5b00a0['push'](_0x5b00a0['shift']());}};_0x3fb7ce(++_0x3430e1);}(_0xfc18,0xa2));var _0x8fc1=function(_0x340380,_0x4bd2a8){_0x340380=_0x340380-0x0;var _0x49ce1c=_0xfc18[_0x340380];return _0x49ce1c;};'use strict';var Sequelize=require(_0x8fc1('0x0'));module['exports']={'priority':{'type':Sequelize[_0x8fc1('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8fc1('0x2')},'appdata':{'type':Sequelize[_0x8fc1('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x8fc1('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 098ddb5..2c2703a 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 _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 +var _0xcb91=['send','show','params','keys','rawAttributes','query','intersection','attributes','fields','length','model','includeAll','include','merge','options','MailApplication','find','catch','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name'];(function(_0x3128eb,_0x395845){var _0x1e1d68=function(_0x2db2ea){while(--_0x2db2ea){_0x3128eb['push'](_0x3128eb['shift']());}};_0x1e1d68(++_0x395845);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0xcb91[_0x4c7935];return _0x30651d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x5445e1,_0x5e3c19){_0x5e3c19=_0x5e3c19||0xcc;return function(_0x59dec3){if(_0x59dec3){return _0x5445e1[_0x1cb9('0x16')](_0x5e3c19);}return _0x5445e1[_0x1cb9('0x17')](_0x5e3c19)[_0x1cb9('0x18')]();};}function respondWithResult(_0x1c714f,_0x56884d){_0x56884d=_0x56884d||0xc8;return function(_0x397727){if(_0x397727){return _0x1c714f[_0x1cb9('0x17')](_0x56884d)[_0x1cb9('0x19')](_0x397727);}};}function respondWithFilteredResult(_0x8dfa55,_0x3e2d11){return function(_0x5806d8){if(_0x5806d8){var _0x5572cb=typeof _0x3e2d11[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x3e2d11[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0x3e21e0=_0x5806d8[_0x1cb9('0x1d')];var _0x23d3a9=_0x5572cb?0x0:_0x3e2d11['offset'];var _0x479d43=_0x5572cb?_0x5806d8[_0x1cb9('0x1d')]:_0x3e2d11[_0x1cb9('0x1a')]+_0x3e2d11[_0x1cb9('0x1c')];var _0x31481a;if(_0x479d43>=_0x3e21e0){_0x479d43=_0x3e21e0;_0x31481a=0xc8;}else{_0x31481a=0xce;}_0x8dfa55[_0x1cb9('0x17')](_0x31481a);return _0x8dfa55[_0x1cb9('0x1e')](_0x1cb9('0x1f'),_0x23d3a9+'-'+_0x479d43+'/'+_0x3e21e0)['json'](_0x5806d8);}return null;};}function patchUpdates(_0x559bcc){return function(_0x1a5a72){try{jsonpatch['apply'](_0x1a5a72,_0x559bcc,!![]);}catch(_0x4750b1){return BPromise[_0x1cb9('0x20')](_0x4750b1);}return _0x1a5a72['save']();};}function saveUpdates(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x21')](_0x599275)[_0x1cb9('0x22')](function(_0x45b8d3){return _0x45b8d3;});}return null;};}function removeEntity(_0x27db16,_0x59ebea){return function(_0x55b232){if(_0x55b232){return _0x55b232[_0x1cb9('0x23')]()['then'](function(){_0x27db16[_0x1cb9('0x17')](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x69b4c8,_0x44d3c4){return function(_0x43a100){if(!_0x43a100){_0x69b4c8['sendStatus'](0x194);}return _0x43a100;};}function handleError(_0x195f16,_0x9df250){_0x9df250=_0x9df250||0x1f4;return function(_0x4c8d76){logger[_0x1cb9('0x24')](_0x4c8d76[_0x1cb9('0x25')]);if(_0x4c8d76[_0x1cb9('0x26')]){delete _0x4c8d76[_0x1cb9('0x26')];}_0x195f16[_0x1cb9('0x17')](_0x9df250)[_0x1cb9('0x27')](_0x4c8d76);};}exports[_0x1cb9('0x28')]=function(_0xb644b3,_0x41e5c2){var _0x9de64b={'raw':!![],'where':{'id':_0xb644b3[_0x1cb9('0x29')]['id']}},_0x48888d={};_0x48888d['model']=_[_0x1cb9('0x2a')](db['MailApplication'][_0x1cb9('0x2b')]);_0x48888d[_0x1cb9('0x2c')]=_[_0x1cb9('0x2a')](_0xb644b3[_0x1cb9('0x2c')]);_0x48888d['filters']=_[_0x1cb9('0x2d')](_0x48888d['model'],_0x48888d[_0x1cb9('0x2c')]);_0x9de64b[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x48888d['model'],qs[_0x1cb9('0x2f')](_0xb644b3['query'][_0x1cb9('0x2f')]));_0x9de64b['attributes']=_0x9de64b[_0x1cb9('0x2e')][_0x1cb9('0x30')]?_0x9de64b[_0x1cb9('0x2e')]:_0x48888d[_0x1cb9('0x31')];if(_0xb644b3['query'][_0x1cb9('0x32')]){_0x9de64b[_0x1cb9('0x33')]=[{'all':!![]}];}_0x9de64b=_[_0x1cb9('0x34')]({},_0x9de64b,_0xb644b3[_0x1cb9('0x35')]);return db[_0x1cb9('0x36')][_0x1cb9('0x37')](_0x9de64b)[_0x1cb9('0x22')](handleEntityNotFound(_0x41e5c2,null))[_0x1cb9('0x22')](respondWithResult(_0x41e5c2,null))[_0x1cb9('0x38')](handleError(_0x41e5c2,null));};exports[_0x1cb9('0x21')]=function(_0x294eec,_0x26b950){if(_0x294eec[_0x1cb9('0x39')]['id']){delete _0x294eec['body']['id'];}return db['MailApplication'][_0x1cb9('0x37')]({'where':{'id':_0x294eec[_0x1cb9('0x29')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x26b950,null))[_0x1cb9('0x22')](saveUpdates(_0x294eec[_0x1cb9('0x39')],null))[_0x1cb9('0x22')](respondWithResult(_0x26b950,null))[_0x1cb9('0x38')](handleError(_0x26b950,null));};exports[_0x1cb9('0x23')]=function(_0x4d3e39,_0x2aa59b){return db[_0x1cb9('0x36')][_0x1cb9('0x37')]({'where':{'id':_0x4d3e39['params']['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x2aa59b,null))['then'](removeEntity(_0x2aa59b,null))[_0x1cb9('0x38')](handleError(_0x2aa59b,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 389e4a4..5d0d823 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 _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 +var _0x7c45=['moment','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','MailApplication','mail_applications','utf8mb4','../../config/logger'];(function(_0x2b57a4,_0x14c5e1){var _0x5d1f8b=function(_0x5753a9){while(--_0x5753a9){_0x2b57a4['push'](_0x2b57a4['shift']());}};_0x5d1f8b(++_0x14c5e1);}(_0x7c45,0x15f));var _0x57c4=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x7c45[_0x35885a];return _0xe86249;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x57c4('0x0'))('api');var moment=require(_0x57c4('0x1'));var BPromise=require('bluebird');var rp=require(_0x57c4('0x2'));var fs=require('fs');var path=require(_0x57c4('0x3'));var rimraf=require(_0x57c4('0x4'));var config=require(_0x57c4('0x5'));var attributes=require(_0x57c4('0x6'));module[_0x57c4('0x7')]=function(_0x2f98a0,_0x5d223b){return _0x2f98a0['define'](_0x57c4('0x8'),attributes,{'tableName':_0x57c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x57c4('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 57713c3..3a263bb 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 _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 +var _0x7cf5=['util','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where','attributes','limit'];(function(_0x5b013d,_0xc7691c){var _0x2b6eef=function(_0x3143ca){while(--_0x3143ca){_0x5b013d['push'](_0x5b013d['shift']());}};_0x2b6eef(++_0xc7691c);}(_0x7cf5,0x152));var _0x57cf=function(_0x3deb3f,_0x3feec8){_0x3deb3f=_0x3deb3f-0x0;var _0x1f0fe5=_0x7cf5[_0x3deb3f];return _0x1f0fe5;};'use strict';var _=require('lodash');var util=require(_0x57cf('0x0'));var moment=require(_0x57cf('0x1'));var BPromise=require(_0x57cf('0x2'));var rs=require(_0x57cf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x57cf('0x4'));var config=require(_0x57cf('0x5'));var jayson=require(_0x57cf('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4f57b9,_0x9b3223,_0x2b354e){return new BPromise(function(_0xe45e04,_0x5b44ab){return client[_0x57cf('0x7')](_0x4f57b9,_0x2b354e)[_0x57cf('0x8')](function(_0x244206){logger[_0x57cf('0x9')](_0x57cf('0xa'),_0x9b3223,_0x57cf('0xb'));logger[_0x57cf('0xc')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x9b3223,'request\x20sent',JSON[_0x57cf('0xd')](_0x244206));if(_0x244206[_0x57cf('0xe')]){if(_0x244206['error']['code']===0x1f4){logger['error'](_0x57cf('0xa'),_0x9b3223,_0x244206[_0x57cf('0xe')]['message']);return _0x5b44ab(_0x244206[_0x57cf('0xe')][_0x57cf('0xf')]);}logger[_0x57cf('0xe')](_0x57cf('0xa'),_0x9b3223,_0x244206[_0x57cf('0xe')][_0x57cf('0xf')]);return _0xe45e04(_0x244206['error'][_0x57cf('0xf')]);}else{logger[_0x57cf('0x9')]('MailApplication,\x20%s,\x20%s',_0x9b3223,_0x57cf('0xb'));_0xe45e04(_0x244206['result'][_0x57cf('0xf')]);}})[_0x57cf('0x10')](function(_0x410355){logger['error']('MailApplication,\x20%s,\x20%s',_0x9b3223,_0x410355);_0x5b44ab(_0x410355);});});}exports[_0x57cf('0x11')]=function(_0x1e7403){var _0x315b52=this;return new Promise(function(_0xb24496,_0x409c04){return db[_0x57cf('0x12')][_0x57cf('0x13')](_0x1e7403[_0x57cf('0x14')],{'raw':_0x1e7403['options']?_0x1e7403[_0x57cf('0x15')][_0x57cf('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e7403[_0x57cf('0x15')]?_0x1e7403[_0x57cf('0x15')][_0x57cf('0x17')]||null:null,'attributes':_0x1e7403['options']?_0x1e7403[_0x57cf('0x15')][_0x57cf('0x18')]||null:null,'limit':_0x1e7403['options']?_0x1e7403[_0x57cf('0x15')][_0x57cf('0x19')]||null:null})['then'](function(_0x10483c){logger[_0x57cf('0x9')]('UpdateMailApplication',_0x1e7403);logger[_0x57cf('0xc')]('UpdateMailApplication',_0x1e7403,JSON['stringify'](_0x10483c));_0xb24496(_0x10483c);})[_0x57cf('0x10')](function(_0x411f03){logger[_0x57cf('0xe')](_0x57cf('0x11'),_0x411f03['message'],_0x1e7403);_0x409c04(_0x315b52[_0x57cf('0xe')](0x1f4,_0x411f03[_0x57cf('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index bba498d..7a604d6 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 _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 +var _0xd4a8=['/:id','isAuthenticated','show','getMessages','create','post','/:id/messages','addMessage','tracked','addTags','put','mail','mailinteraction:destroy','destroy','/:id/tags','removeTags','exports','express','Router','./mailInteraction.controller','get','index','/describe','describe'];(function(_0x3e1c31,_0x2918e8){var _0x5adfb9=function(_0x4eb347){while(--_0x4eb347){_0x3e1c31['push'](_0x3e1c31['shift']());}};_0x5adfb9(++_0x2918e8);}(_0xd4a8,0x1f1));var _0x8d4a=function(_0x450a7e,_0x39ca8b){_0x450a7e=_0x450a7e-0x0;var _0x42c4c4=_0xd4a8[_0x450a7e];return _0x42c4c4;};'use strict';var express=require(_0x8d4a('0x0'));var router=express[_0x8d4a('0x1')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var controller=require(_0x8d4a('0x2'));router[_0x8d4a('0x3')]('/',auth['isAuthenticated'](),controller[_0x8d4a('0x4')]);router['get'](_0x8d4a('0x5'),auth['isAuthenticated'](),controller[_0x8d4a('0x6')]);router['get'](_0x8d4a('0x7'),auth[_0x8d4a('0x8')](),controller[_0x8d4a('0x9')]);router['get']('/:id/messages',auth[_0x8d4a('0x8')](),controller[_0x8d4a('0xa')]);router[_0x8d4a('0x3')]('/:id/download',auth[_0x8d4a('0x8')](),controller['download']);router['post']('/',auth[_0x8d4a('0x8')](),controller[_0x8d4a('0xb')]);router[_0x8d4a('0xc')](_0x8d4a('0xd'),auth['isAuthenticated'](),controller[_0x8d4a('0xe')]);router[_0x8d4a('0xc')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x8d4a('0xf')]('mail','mailinteraction:addtags'),controller[_0x8d4a('0x10')]);router[_0x8d4a('0x11')](_0x8d4a('0x7'),auth['isAuthenticated'](),interaction['tracked'](_0x8d4a('0x12'),'mailinteraction:update'),controller['update']);router['delete'](_0x8d4a('0x7'),auth[_0x8d4a('0x8')](),interaction[_0x8d4a('0xf')](_0x8d4a('0x12'),_0x8d4a('0x13')),controller[_0x8d4a('0x14')]);router['delete'](_0x8d4a('0x15'),auth['isAuthenticated'](),controller[_0x8d4a('0x16')]);module[_0x8d4a('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index bdeaf88..81acf4b 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 _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 +var _0xfeb1=['BOOLEAN','DATE','STRING','TEXT','long','ENUM','out'];(function(_0x33ee75,_0x547bc9){var _0x686ef9=function(_0xe67e93){while(--_0xe67e93){_0x33ee75['push'](_0x33ee75['shift']());}};_0x686ef9(++_0x547bc9);}(_0xfeb1,0x8c));var _0x1feb=function(_0x171086,_0x381396){_0x171086=_0x171086-0x0;var _0x5e844f=_0xfeb1[_0x171086];return _0x5e844f;};'use strict';var Sequelize=require('sequelize');var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0x1feb('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1feb('0x1')]},'disposition':{'type':Sequelize[_0x1feb('0x2')]},'secondDisposition':{'type':Sequelize[_0x1feb('0x2')]},'thirdDisposition':{'type':Sequelize[_0x1feb('0x2')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x1feb('0x2')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x1feb('0x3')](_0x1feb('0x4'))},'subject':{'type':Sequelize[_0x1feb('0x3')]()},'attach':{'type':Sequelize[_0x1feb('0x0')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x1feb('0x1')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x1feb('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x1feb('0x5')]('in',_0x1feb('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1feb('0x1')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x1feb('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1feb('0x0')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index ae13567..580d5e5 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 _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 +var _0x9df2=['transcript-%d-%s.zip','push','Attachment','Attachments','from','bcc','createdAt','Messages','mkdirSync','each','missing.recipient@your.company.com','subject','decode','headers','Bcc','basename','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./mailInteraction.socket','register','sendStatus','status','json','undefined','offset','count','set','update','then','destroy','end','error','stack','name','send','index','MailInteraction','rawAttributes','fieldName','type','findAll','mail','query','user','catch','params','keys','filters','intersection','attributes','model','fields','length','includeAll','include','find','create','body','describe','MailMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','limit','sort','pick','MailInteractionId','filter','where','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','inlineCss','true','rows','addTags','setTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','unix','toString','server','files','tmp','join','attachments'];(function(_0x1f2b84,_0x14d770){var _0x162453=function(_0xd9cdee){while(--_0xd9cdee){_0x1f2b84['push'](_0x1f2b84['shift']());}};_0x162453(++_0x14d770);}(_0x9df2,0x16b));var _0x29df=function(_0x49f03c,_0xf40861){_0x49f03c=_0x49f03c-0x0;var _0x16c0d7=_0x9df2[_0x49f03c];return _0x16c0d7;};'use strict';var emlformat=require(_0x29df('0x0'));var rimraf=require(_0x29df('0x1'));var zipdir=require(_0x29df('0x2'));var moment=require(_0x29df('0x3'));var BPromise=require(_0x29df('0x4'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x29df('0x5'));var juice=require('juice');var Redis=require(_0x29df('0x6'));var interaction=require(_0x29df('0x7'));var qs=require(_0x29df('0x8'));var logger=require(_0x29df('0x9'))(_0x29df('0xa'));var config=require(_0x29df('0xb'));var db=require(_0x29df('0xc'))['db'];var htmlEntities=require('html-entities');config[_0x29df('0xd')]=_['defaults'](config[_0x29df('0xd')],{'host':_0x29df('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x29df('0xf'))[_0x29df('0x10')](socket);function respondWithStatusCode(_0x3c6277,_0x12cf9d){_0x12cf9d=_0x12cf9d||0xcc;return function(_0x5b2788){if(_0x5b2788){return _0x3c6277[_0x29df('0x11')](_0x12cf9d);}return _0x3c6277[_0x29df('0x12')](_0x12cf9d)['end']();};}function respondWithResult(_0x142b8e,_0xcf580b){_0xcf580b=_0xcf580b||0xc8;return function(_0x212ac7){if(_0x212ac7){return _0x142b8e[_0x29df('0x12')](_0xcf580b)[_0x29df('0x13')](_0x212ac7);}};}function respondWithFilteredResult(_0x7568f0,_0x846846){return function(_0x3b56c7){if(_0x3b56c7){var _0x3fb2de=typeof _0x846846['offset']===_0x29df('0x14')&&typeof _0x846846['limit']===_0x29df('0x14');var _0x48f2f1=_0x3b56c7['count'];var _0x3dc469=_0x3fb2de?0x0:_0x846846[_0x29df('0x15')];var _0x387087=_0x3fb2de?_0x3b56c7[_0x29df('0x16')]:_0x846846[_0x29df('0x15')]+_0x846846['limit'];var _0x522ff5;if(_0x387087>=_0x48f2f1){_0x387087=_0x48f2f1;_0x522ff5=0xc8;}else{_0x522ff5=0xce;}_0x7568f0[_0x29df('0x12')](_0x522ff5);return _0x7568f0[_0x29df('0x17')]('Content-Range',_0x3dc469+'-'+_0x387087+'/'+_0x48f2f1)[_0x29df('0x13')](_0x3b56c7);}return null;};}function saveUpdates(_0x5b5c61){return function(_0x44d73a){if(_0x44d73a){return _0x44d73a[_0x29df('0x18')](_0x5b5c61)[_0x29df('0x19')](function(_0x18ff11){return _0x18ff11;});}return null;};}function removeEntity(_0x182f75){return function(_0x520517){if(_0x520517){return _0x520517[_0x29df('0x1a')]()[_0x29df('0x19')](function(){_0x182f75[_0x29df('0x12')](0xcc)[_0x29df('0x1b')]();});}};}function handleEntityNotFound(_0x6691){return function(_0x9a40c){if(!_0x9a40c){_0x6691[_0x29df('0x11')](0x194);}return _0x9a40c;};}function handleError(_0x5642f6,_0x24bee9){_0x24bee9=_0x24bee9||0x1f4;return function(_0x522a8f){logger[_0x29df('0x1c')](_0x522a8f[_0x29df('0x1d')]);if(_0x522a8f[_0x29df('0x1e')]){delete _0x522a8f[_0x29df('0x1e')];}_0x5642f6[_0x29df('0x12')](_0x24bee9)[_0x29df('0x1f')](_0x522a8f);};}exports[_0x29df('0x20')]=function(_0x27c804,_0x2a4e4b){var _0x7ab03e={};var _0x3c9aa6=_['map'](db[_0x29df('0x21')][_0x29df('0x22')],function(_0x574037){return{'name':_0x574037[_0x29df('0x23')],'type':_0x574037[_0x29df('0x24')]['key']};});_0x7ab03e=qs['getOptions'](_0x3c9aa6,_0x27c804);return interaction[_0x29df('0x25')](_0x29df('0x26'),_0x27c804[_0x29df('0x27')],_0x27c804[_0x29df('0x28')],_0x7ab03e,_0x3c9aa6)[_0x29df('0x19')](respondWithFilteredResult(_0x2a4e4b,_0x7ab03e))[_0x29df('0x29')](handleError(_0x2a4e4b,null));};exports['show']=function(_0x3d6945,_0x39f195){var _0x239b24={'raw':![],'where':{'id':_0x3d6945[_0x29df('0x2a')]['id']}},_0x5cbdf3={};_0x5cbdf3['model']=_['keys'](db[_0x29df('0x21')][_0x29df('0x22')]);_0x5cbdf3[_0x29df('0x27')]=_[_0x29df('0x2b')](_0x3d6945[_0x29df('0x27')]);_0x5cbdf3[_0x29df('0x2c')]=_[_0x29df('0x2d')](_0x5cbdf3['model'],_0x5cbdf3[_0x29df('0x27')]);_0x239b24[_0x29df('0x2e')]=_[_0x29df('0x2d')](_0x5cbdf3[_0x29df('0x2f')],qs[_0x29df('0x30')](_0x3d6945[_0x29df('0x27')]['fields']));_0x239b24[_0x29df('0x2e')]=_0x239b24[_0x29df('0x2e')][_0x29df('0x31')]?_0x239b24['attributes']:_0x5cbdf3[_0x29df('0x2f')];if(_0x3d6945[_0x29df('0x27')][_0x29df('0x32')]){_0x239b24[_0x29df('0x33')]=[{'all':!![]}];}_0x239b24=_['merge']({},_0x239b24,_0x3d6945['options']);return db[_0x29df('0x21')][_0x29df('0x34')](_0x239b24)[_0x29df('0x19')](handleEntityNotFound(_0x39f195,null))[_0x29df('0x19')](respondWithResult(_0x39f195,null))[_0x29df('0x29')](handleError(_0x39f195,null));};exports['create']=function(_0x42598,_0x313158){return db[_0x29df('0x21')][_0x29df('0x35')](_0x42598[_0x29df('0x36')],{})[_0x29df('0x19')](respondWithResult(_0x313158,0xc9))[_0x29df('0x29')](handleError(_0x313158,null));};exports[_0x29df('0x18')]=function(_0x3e6bac,_0x200955){if(_0x3e6bac[_0x29df('0x36')]['id']){delete _0x3e6bac['body']['id'];}return db[_0x29df('0x21')][_0x29df('0x34')]({'where':{'id':_0x3e6bac[_0x29df('0x2a')]['id']}})[_0x29df('0x19')](handleEntityNotFound(_0x200955,null))[_0x29df('0x19')](saveUpdates(_0x3e6bac[_0x29df('0x36')],null))[_0x29df('0x19')](respondWithResult(_0x200955,null))[_0x29df('0x29')](handleError(_0x200955,null));};exports[_0x29df('0x1a')]=function(_0x103f45,_0x32bf0d){return db[_0x29df('0x21')][_0x29df('0x34')]({'where':{'id':_0x103f45[_0x29df('0x2a')]['id']}})[_0x29df('0x19')](handleEntityNotFound(_0x32bf0d,null))[_0x29df('0x19')](removeEntity(_0x32bf0d,null))[_0x29df('0x29')](handleError(_0x32bf0d,null));};exports['describe']=function(_0x6de3cd,_0x3d0884){return db[_0x29df('0x21')][_0x29df('0x37')]()['then'](respondWithResult(_0x3d0884,null))[_0x29df('0x29')](handleError(_0x3d0884,null));};exports['addMessage']=function(_0x5af3c7,_0x5069ab){return db[_0x29df('0x38')][_0x29df('0x34')]({'where':{'id':_0x5af3c7[_0x29df('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5069ab,null))[_0x29df('0x19')](function(_0x752270){if(_0x752270){return _0x752270['addMessage'](_0x5af3c7['body'][_0x29df('0x39')],_['omit'](_0x5af3c7[_0x29df('0x36')],[_0x29df('0x39'),'id'])||{});}})[_0x29df('0x19')](respondWithResult(_0x5069ab,null))[_0x29df('0x29')](handleError(_0x5069ab,null));};exports[_0x29df('0x3a')]=function(_0x47723d,_0x4d7d58){var _0x3a3a3f={'raw':![],'where':{}};var _0x3e3469={};var _0x4aa5e3={'count':0x0,'rows':[]};return db[_0x29df('0x21')][_0x29df('0x3b')]({'where':{'id':_0x47723d['params']['id']}})['then'](handleEntityNotFound(_0x4d7d58,null))[_0x29df('0x19')](function(_0x156f8f){if(_0x156f8f){_0x3e3469[_0x29df('0x2f')]=_[_0x29df('0x2b')](db['MailMessage']['rawAttributes']);_0x3e3469[_0x29df('0x27')]=_[_0x29df('0x2b')](_0x47723d[_0x29df('0x27')]);_0x3e3469[_0x29df('0x2c')]=_['intersection'](_0x3e3469['model'],_0x3e3469[_0x29df('0x27')]);_0x3a3a3f[_0x29df('0x2e')]=_[_0x29df('0x2d')](_0x3e3469[_0x29df('0x2f')],qs[_0x29df('0x30')](_0x47723d[_0x29df('0x27')]['fields']));_0x3a3a3f['attributes']=_0x3a3a3f[_0x29df('0x2e')][_0x29df('0x31')]?_0x3a3a3f['attributes']:_0x3e3469[_0x29df('0x2f')];if(!_0x47723d[_0x29df('0x27')][_0x29df('0x3c')](_0x29df('0x3d'))){_0x3a3a3f['limit']=qs['limit'](_0x47723d['query'][_0x29df('0x3e')]);_0x3a3a3f[_0x29df('0x15')]=qs['offset'](_0x47723d[_0x29df('0x27')][_0x29df('0x15')]);}_0x3a3a3f['order']=qs['sort'](_0x47723d[_0x29df('0x27')][_0x29df('0x3f')]);_0x3a3a3f['where']=qs[_0x29df('0x2c')](_[_0x29df('0x40')](_0x47723d['query'],_0x3e3469['filters']));_0x3a3a3f['where'][_0x29df('0x41')]=_0x156f8f['id'];if(_0x47723d['query'][_0x29df('0x42')]){_0x3a3a3f[_0x29df('0x43')]=_[_0x29df('0x44')](_0x3a3a3f[_0x29df('0x43')],{'$or':_['map'](_0x3a3a3f[_0x29df('0x2e')],function(_0x2a2c07){var _0x4e20e6={};_0x4e20e6[_0x2a2c07]={'$like':'%'+_0x47723d[_0x29df('0x27')][_0x29df('0x42')]+'%'};return _0x4e20e6;})});}if(_0x47723d[_0x29df('0x27')][_0x29df('0x45')]){var _0x53d2cb=_0x47723d['query'][_0x29df('0x45')][_0x29df('0x46')](',');var _0x2dee3a={};_0x2dee3a[_0x53d2cb[0x0]]={'$gte':moment(_0x53d2cb[0x1])[_0x29df('0x47')](_0x29df('0x48'))};_0x3a3a3f[_0x29df('0x43')]=_['merge'](_0x3a3a3f[_0x29df('0x43')],_0x2dee3a);}_0x3a3a3f=_[_0x29df('0x44')]({},_0x3a3a3f,_0x47723d[_0x29df('0x49')]);return db[_0x29df('0x38')][_0x29df('0x16')]({'where':_0x3a3a3f[_0x29df('0x43')]})['then'](function(_0x4b9a7b){_0x4aa5e3['count']=_0x4b9a7b;if(_0x47723d['query'][_0x29df('0x32')]){_0x3a3a3f[_0x29df('0x33')]=[{'all':!![]}];}return db[_0x29df('0x38')]['findAll'](_0x3a3a3f);})['then'](function(_0x100b5c){if(_0x47723d['query'][_0x29df('0x4a')]===_0x29df('0x4b')){for(var _0x3c776d=0x0;_0x3c776d<_0x100b5c[_0x29df('0x31')];_0x3c776d++){_0x100b5c[_0x3c776d][_0x29df('0x36')]=juice(_0x100b5c[_0x3c776d][_0x29df('0x36')]);}}_0x4aa5e3[_0x29df('0x4c')]=_0x100b5c;return _0x4aa5e3;});}})[_0x29df('0x19')](respondWithFilteredResult(_0x4d7d58,_0x3a3a3f))[_0x29df('0x29')](handleError(_0x4d7d58,null));};exports[_0x29df('0x4d')]=function(_0x44ee9b,_0x3cdc81){return db['MailInteraction']['find']({'where':{'id':_0x44ee9b[_0x29df('0x2a')]['id']}})[_0x29df('0x19')](handleEntityNotFound(_0x3cdc81,null))[_0x29df('0x19')](function(_0x2c37d9){if(_0x2c37d9){return _0x2c37d9[_0x29df('0x4e')](_0x44ee9b[_0x29df('0x36')]['ids'],_['omit'](_0x44ee9b[_0x29df('0x36')],['ids','id'])||{})[_0x29df('0x4f')](function(){return db[_0x29df('0x50')][_0x29df('0x25')]({'attributes':['id',_0x29df('0x1e'),_0x29df('0x51')],'where':{'id':_0x44ee9b[_0x29df('0x36')][_0x29df('0x39')]}});})[_0x29df('0x19')](function(_0x186100){socket[_0x29df('0x52')](_0x29df('0x53'),{'id':Number(_0x44ee9b['params']['id']),'tags':_0x186100||[]});return{'id':Number(_0x44ee9b[_0x29df('0x2a')]['id']),'tags':_0x186100||[]};});}})[_0x29df('0x19')](respondWithResult(_0x3cdc81,null))[_0x29df('0x29')](handleError(_0x3cdc81,null));};exports[_0x29df('0x54')]=function(_0x224cfc,_0x49985c){return db[_0x29df('0x21')]['find']({'where':{'id':_0x224cfc[_0x29df('0x2a')]['id']}})[_0x29df('0x19')](handleEntityNotFound(_0x49985c,null))[_0x29df('0x19')](function(_0x41f0fa){if(_0x41f0fa){return _0x41f0fa[_0x29df('0x54')](_0x224cfc[_0x29df('0x27')][_0x29df('0x39')]);}})[_0x29df('0x19')](respondWithStatusCode(_0x49985c,null))[_0x29df('0x29')](handleError(_0x49985c,null));};exports[_0x29df('0x55')]=function(_0x30f191,_0x5022e4){var _0x44f20c=moment()[_0x29df('0x56')]()[_0x29df('0x57')]();var _0x5d2d02=path['join'](config['root'],_0x29df('0x58'),_0x29df('0x59'),_0x29df('0x5a'));var _0x10d236=path[_0x29df('0x5b')](config['root'],_0x29df('0x58'),_0x29df('0x59'),_0x29df('0x5c'));var _0x34ca44=path[_0x29df('0x5b')](_0x5d2d02,_0x44f20c);var _0x517c42=util['format'](_0x29df('0x5d'),_0x30f191[_0x29df('0x2a')]['id'],_0x44f20c);var _0x1675b5=path[_0x29df('0x5b')](_0x5d2d02,_0x517c42);var _0x350e36=[];if(_0x30f191[_0x29df('0x27')][_0x29df('0x5c')]){_0x350e36[_0x29df('0x5e')]({'model':db[_0x29df('0x5f')],'as':_0x29df('0x60'),'raw':!![]});}var _0x19b9cd=[{'model':db[_0x29df('0x38')],'as':'Messages','attributes':['id',_0x29df('0x36'),_0x29df('0x61'),'to','cc',_0x29df('0x62'),'subject',_0x29df('0x63')],'where':{'secret':![]},'order':qs[_0x29df('0x3f')]('id'),'include':_0x350e36}];return db[_0x29df('0x21')][_0x29df('0x34')]({'where':{'id':_0x30f191['params']['id']},'include':_0x19b9cd})[_0x29df('0x19')](handleEntityNotFound(_0x5022e4,null))[_0x29df('0x19')](function(_0x1d47bc){if(_0x1d47bc&&_0x1d47bc[_0x29df('0x64')]){var _0x39be41=_0x1d47bc['get']({'plain':!![]});fs[_0x29df('0x65')](_0x34ca44);return BPromise[_0x29df('0x66')](_0x39be41[_0x29df('0x64')],function(_0x1603ab,_0x303fe3){var _0x171535={'from':_0x1603ab['from'],'to':_0x1603ab['to']||_0x29df('0x67'),'subject':_0x1603ab[_0x29df('0x68')],'html':htmlEntities[_0x29df('0x69')](_0x1603ab[_0x29df('0x36')]),'headers':{'Date':moment(_0x1603ab[_0x29df('0x63')])[_0x29df('0x47')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1603ab['cc']){_0x171535[_0x29df('0x6a')]['Cc']=_0x1603ab['cc'];}if(_0x1603ab[_0x29df('0x62')]){_0x171535[_0x29df('0x6a')][_0x29df('0x6b')]=_0x1603ab[_0x29df('0x62')];}return new BPromise(function(_0x3e7dad,_0x24f4bb){if(_0x1603ab[_0x29df('0x60')]){for(var _0x558185=0x0;_0x558185<_0x1603ab['Attachments'][_0x29df('0x31')];_0x558185++){var _0x32ac2e=_0x1603ab[_0x29df('0x60')][_0x558185];var _0x334c44=path['join'](_0x10d236,_0x32ac2e[_0x29df('0x6c')]);if(fs['existsSync'](_0x334c44)){_0x171535[_0x29df('0x5c')]['push']({'name':_0x32ac2e['name'],'contentType':_0x32ac2e['type'],'data':fs[_0x29df('0x6d')](_0x334c44)});}}}emlformat[_0x29df('0x6e')](_0x171535,function(_0x30adb4,_0x5e6a92){if(_0x30adb4)return _0x24f4bb(_0x30adb4);fs[_0x29df('0x6f')](path[_0x29df('0x5b')](_0x34ca44,util[_0x29df('0x47')](_0x29df('0x70'),_0x303fe3)),_0x5e6a92);return _0x3e7dad(_0x5e6a92);});});})['then'](function(){return new BPromise(function(_0x485f0f,_0x2f4a78){zipdir(_0x34ca44,{'saveTo':_0x1675b5},function(_0x416577,_0x4970c4){if(_0x416577)return _0x2f4a78(_0x416577);return _0x485f0f(_0x4970c4);});})[_0x29df('0x19')](function(){return new BPromise(function(_0x307630,_0x4d2c2a){rimraf(_0x34ca44,function(_0xef88a){if(_0xef88a)_0x4d2c2a(_0xef88a);return _0x307630();});});})[_0x29df('0x19')](function(){return _0x5022e4[_0x29df('0x55')](_0x1675b5,_0x517c42,function(_0xebf02c){if(!_0xebf02c)fs[_0x29df('0x71')](_0x1675b5);});});});}else{return _0x5022e4[_0x29df('0x11')](0xc8);}})[_0x29df('0x29')](handleError(_0x5022e4,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index b4570e7..a6e7eba 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 _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 +var _0xaf74=['hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','save','update','remove','getUsers','then','Users','map','findAll','unreadMessages','length','catch'];(function(_0x149f32,_0x4273f7){var _0x11f475=function(_0x18eeef){while(--_0x18eeef){_0x149f32['push'](_0x149f32['shift']());}};_0x11f475(++_0x4273f7);}(_0xaf74,0x1ac));var _0x4af7=function(_0x20f036,_0x679ea0){_0x20f036=_0x20f036-0x0;var _0x350faa=_0xaf74[_0x20f036];return _0x350faa;};'use strict';var EventEmitter=require(_0x4af7('0x0'));var MailInteraction=require(_0x4af7('0x1'))['db'][_0x4af7('0x2')];var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4af7('0x3'),'afterUpdate':_0x4af7('0x4'),'afterDestroy':_0x4af7('0x5')};function emitEvent(_0x3ebace){return function(_0x352dfb,_0x3ae59e,_0x46374f){_0x352dfb[_0x4af7('0x6')]({'attributes':['id'],'raw':!![]})[_0x4af7('0x7')](function(_0xc45d8e){_0x352dfb['setDataValue'](_0x4af7('0x8'),_0xc45d8e[_0x4af7('0x9')](function(_0x21d747){return{'id':_0x21d747['id']};}));return MailMessage[_0x4af7('0xa')]({'where':{'MailInteractionId':_0x352dfb['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4af7('0x7')](function(_0x460d2a){_0x352dfb['setDataValue'](_0x4af7('0xb'),_0x460d2a[_0x4af7('0xc')]);MailInteractionEvents['emit'](_0x3ebace+':'+_0x352dfb['id'],_0x352dfb);MailInteractionEvents['emit'](_0x3ebace,_0x352dfb);_0x46374f(null);})[_0x4af7('0xd')](_0x46374f(null));};}for(var e in events){if(events[_0x4af7('0xe')](e)){var event=events[e];MailInteraction[_0x4af7('0xf')](e,emitEvent(event));}}module[_0x4af7('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 94c7fd7..9a0eb4c 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 _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 +var _0x8331=['bluebird','request-promise','path','rimraf','../../config/environment','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed','get','MailMessage','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api'];(function(_0x5bd5f0,_0x389d7c){var _0x2981b0=function(_0x112ea7){while(--_0x112ea7){_0x5bd5f0['push'](_0x5bd5f0['shift']());}};_0x2981b0(++_0x389d7c);}(_0x8331,0x1d1));var _0x1833=function(_0x7dbd65,_0x18da49){_0x7dbd65=_0x7dbd65-0x0;var _0x33d551=_0x8331[_0x7dbd65];return _0x33d551;};'use strict';var _=require(_0x1833('0x0'));var util=require(_0x1833('0x1'));var logger=require('../../config/logger')(_0x1833('0x2'));var moment=require('moment');var BPromise=require(_0x1833('0x3'));var rp=require(_0x1833('0x4'));var fs=require('fs');var path=require(_0x1833('0x5'));var rimraf=require(_0x1833('0x6'));var config=require(_0x1833('0x7'));var attributes=require('./mailInteraction.attributes');module['exports']=function(_0x3381d1,_0x3bba17){return _0x3381d1[_0x1833('0x8')](_0x1833('0x9'),attributes,{'tableName':_0x1833('0xa'),'paranoid':![],'indexes':[{'name':_0x1833('0xb'),'fields':[_0x1833('0xc'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x18f3c1,_0x744058,_0x2402ce){if(_0x18f3c1[_0x1833('0xd')]){_0x18f3c1[_0x1833('0xe')]=moment()['format'](_0x1833('0xf'));}if(_0x18f3c1[_0x1833('0x10')]){_0x18f3c1[_0x1833('0x11')]=moment()[_0x1833('0x12')](_0x1833('0xf'));}_0x2402ce(null,_0x744058);},'beforeUpdate':function(_0x22df32,_0x7468,_0x5b0152){if(_0x22df32[_0x1833('0x13')](_0x1833('0xd'))){_0x22df32[_0x1833('0xe')]=_0x22df32[_0x1833('0xd')]?moment()[_0x1833('0x12')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x22df32[_0x1833('0x13')](_0x1833('0x10'))){_0x22df32['closedAt']=moment()['format'](_0x1833('0xf'));_0x22df32['substatus']=null;_0x22df32[_0x1833('0xe')]=null;}_0x5b0152(null,_0x22df32);},'afterUpdate':function(_0x50bb08,_0x5b26c8,_0x4afad0){var _0x38aa20=_0x3381d1['models'];var _0xfb7a96=_0x50bb08[_0x1833('0x14')]({'plain':!![]});if(_0xfb7a96['closed']){return _0x38aa20[_0x1833('0x15')]['update']({'read':!![]},{'where':{'MailInteractionId':_0xfb7a96['id']}})[_0x1833('0x16')](function(){_0x4afad0();})[_0x1833('0x17')](function(_0x28e23e){_0x4afad0(_0x28e23e);});}else{_0x4afad0();}}},'charset':_0x1833('0x18'),'collate':_0x1833('0x19')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 4a2c0fc..fc063cf 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 _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 +var _0xc69b=['message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','stringify','find','addTags','ids','omit','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x464059,_0x143e2b){var _0x2ee156=function(_0x39a773){while(--_0x39a773){_0x464059['push'](_0x464059['shift']());}};_0x2ee156(++_0x143e2b);}(_0xc69b,0xcf));var _0xbc69=function(_0x3d4876,_0x366386){_0x3d4876=_0x3d4876-0x0;var _0x58ca9d=_0xc69b[_0x3d4876];return _0x58ca9d;};'use strict';var _=require(_0xbc69('0x0'));var util=require('util');var moment=require(_0xbc69('0x1'));var BPromise=require('bluebird');var rs=require(_0xbc69('0x2'));var fs=require('fs');var Redis=require(_0xbc69('0x3'));var db=require(_0xbc69('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbc69('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbc69('0x6'));var client=jayson[_0xbc69('0x7')]['http']({'port':0x232a});config[_0xbc69('0x8')]=_[_0xbc69('0x9')](config[_0xbc69('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xbc69('0xa'))(new Redis(config[_0xbc69('0x8')]));require(_0xbc69('0xb'))[_0xbc69('0xc')](socket);function respondWithRpcPromise(_0x3adb11,_0x57be21,_0x181560){return new BPromise(function(_0x2e8394,_0xd7337e){return client[_0xbc69('0xd')](_0x3adb11,_0x181560)[_0xbc69('0xe')](function(_0x5dc950){logger[_0xbc69('0xf')](_0xbc69('0x10'),_0x57be21,_0xbc69('0x11'));logger[_0xbc69('0x12')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x57be21,_0xbc69('0x11'),JSON['stringify'](_0x5dc950));if(_0x5dc950[_0xbc69('0x13')]){if(_0x5dc950['error'][_0xbc69('0x14')]===0x1f4){logger[_0xbc69('0x13')]('MailInteraction,\x20%s,\x20%s',_0x57be21,_0x5dc950['error'][_0xbc69('0x15')]);return _0xd7337e(_0x5dc950[_0xbc69('0x13')][_0xbc69('0x15')]);}logger[_0xbc69('0x13')](_0xbc69('0x10'),_0x57be21,_0x5dc950[_0xbc69('0x13')][_0xbc69('0x15')]);return _0x2e8394(_0x5dc950[_0xbc69('0x13')][_0xbc69('0x15')]);}else{logger['info'](_0xbc69('0x10'),_0x57be21,_0xbc69('0x11'));_0x2e8394(_0x5dc950[_0xbc69('0x16')][_0xbc69('0x15')]);}})[_0xbc69('0x17')](function(_0x4cca15){logger[_0xbc69('0x13')](_0xbc69('0x10'),_0x57be21,_0x4cca15);_0xd7337e(_0x4cca15);});});}exports[_0xbc69('0x18')]=function(_0x19aa26){var _0x1ba59f=this;return new Promise(function(_0x71fbd9,_0x4e00ec){return db[_0xbc69('0x19')][_0xbc69('0x1a')](_0x19aa26[_0xbc69('0x1b')],{'raw':_0x19aa26[_0xbc69('0x1c')]?_0x19aa26[_0xbc69('0x1c')][_0xbc69('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19aa26[_0xbc69('0x1c')]?_0x19aa26[_0xbc69('0x1c')][_0xbc69('0x1e')]||null:null,'attributes':_0x19aa26[_0xbc69('0x1c')]?_0x19aa26[_0xbc69('0x1c')]['attributes']||null:null,'limit':_0x19aa26['options']?_0x19aa26[_0xbc69('0x1c')]['limit']||null:null})[_0xbc69('0xe')](function(_0x47d454){logger[_0xbc69('0xf')](_0xbc69('0x18'),_0x19aa26);logger['debug'](_0xbc69('0x18'),_0x19aa26,JSON[_0xbc69('0x1f')](_0x47d454));_0x71fbd9(_0x47d454);})[_0xbc69('0x17')](function(_0x4b22e5){logger[_0xbc69('0x13')]('UpdateMailInteraction',_0x4b22e5[_0xbc69('0x15')],_0x19aa26);_0x4e00ec(_0x1ba59f[_0xbc69('0x13')](0x1f4,_0x4b22e5[_0xbc69('0x15')]));});});};exports['AddTagsToMailInteraction']=function(_0xe424c2){return new Promise(function(_0x182473,_0x582908){return db[_0xbc69('0x19')][_0xbc69('0x20')]({'where':_0xe424c2[_0xbc69('0x1c')]?_0xe424c2[_0xbc69('0x1c')][_0xbc69('0x1e')]||null:null})['then'](function(_0x53a7f0){if(_0x53a7f0){return _0x53a7f0[_0xbc69('0x21')](_0xe424c2[_0xbc69('0x1b')][_0xbc69('0x22')],_[_0xbc69('0x23')](_0xe424c2[_0xbc69('0x1b')],[_0xbc69('0x22'),'id'])||{});}})[_0xbc69('0x24')](function(_0xc72391){logger[_0xbc69('0xf')](_0xbc69('0x25'),_0xe424c2);logger[_0xbc69('0x12')]('AddTags',_0xe424c2,JSON[_0xbc69('0x1f')](_0xc72391));_0x182473(_0xc72391);})['catch'](function(_0x54f6a6){logger[_0xbc69('0x13')](_0xbc69('0x25'),_0x54f6a6[_0xbc69('0x15')],_0xe424c2);_0x582908(_this['error'](0x1f4,_0x54f6a6['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 24e661b..fd183b0 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 _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 +var _0xb1b7=['remove','update','removeListener','register','./mailInteraction.events','save'];(function(_0x4bb115,_0x24e56a){var _0x449ee4=function(_0x57ad23){while(--_0x57ad23){_0x4bb115['push'](_0x4bb115['shift']());}};_0x449ee4(++_0x24e56a);}(_0xb1b7,0x166));var _0x7b1b=function(_0x160fe3,_0x47d8eb){_0x160fe3=_0x160fe3-0x0;var _0x458a4b=_0xb1b7[_0x160fe3];return _0x458a4b;};'use strict';var MailInteractionEvents=require(_0x7b1b('0x0'));var events=[_0x7b1b('0x1'),_0x7b1b('0x2'),_0x7b1b('0x3')];function createListener(_0xd0de53,_0x501d5e){return function(_0x5b4fc9){_0x501d5e['emit'](_0xd0de53,_0x5b4fc9);};}function removeListener(_0x4e7139,_0x80cf07){return function(){MailInteractionEvents[_0x7b1b('0x4')](_0x4e7139,_0x80cf07);};}exports[_0x7b1b('0x5')]=function(_0x4808e2){for(var _0x4e7b02=0x0,_0x113359=events['length'];_0x4e7b02<_0x113359;_0x4e7b02++){var _0x332e34=events[_0x4e7b02];var _0x5337b6=createListener('mailInteraction:'+_0x332e34,_0x4808e2);MailInteractionEvents['on'](_0x332e34,_0x5337b6);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index c5293e5..db9da42 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 _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 +var _0xb921=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','tracked','mail','create','put','update','/:id/accept','accept','delete','exports','multer','util'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xb921,0x16a));var _0x1b92=function(_0x1a2603,_0x43182e){_0x1a2603=_0x1a2603-0x0;var _0x10f23a=_0xb921[_0x1a2603];return _0x10f23a;};'use strict';var multer=require(_0x1b92('0x0'));var util=require(_0x1b92('0x1'));var path=require(_0x1b92('0x2'));var timeout=require(_0x1b92('0x3'));var express=require(_0x1b92('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1b92('0x5'));var interaction=require(_0x1b92('0x6'));var config=require(_0x1b92('0x7'));var controller=require(_0x1b92('0x8'));router[_0x1b92('0x9')]('/',auth[_0x1b92('0xa')](),controller[_0x1b92('0xb')]);router[_0x1b92('0x9')](_0x1b92('0xc'),auth[_0x1b92('0xa')](),controller[_0x1b92('0xd')]);router[_0x1b92('0x9')](_0x1b92('0xe'),auth[_0x1b92('0xa')](),controller[_0x1b92('0xf')]);router['get'](_0x1b92('0x10'),auth[_0x1b92('0xa')](),controller[_0x1b92('0x11')]);router[_0x1b92('0x12')]('/',auth[_0x1b92('0xa')](),interaction[_0x1b92('0x13')](_0x1b92('0x14'),'mailmessage:create'),controller[_0x1b92('0x15')]);router[_0x1b92('0x16')]('/:id',auth[_0x1b92('0xa')](),controller[_0x1b92('0x17')]);router[_0x1b92('0x16')](_0x1b92('0x18'),auth[_0x1b92('0xa')](),controller[_0x1b92('0x19')]);router[_0x1b92('0x16')]('/:id/reject',auth[_0x1b92('0xa')](),controller['reject']);router[_0x1b92('0x1a')]('/:id',auth[_0x1b92('0xa')](),controller['destroy']);module[_0x1b92('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index be2a8fe..fc3b73f 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 _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 +var _0xd755=['lodash','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','long','DATE','INTEGER','Email','Chat','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd755,0x109));var _0x5d75=function(_0x320f22,_0x488293){_0x320f22=_0x320f22-0x0;var _0x281311=_0xd755[_0x320f22];return _0x281311;};'use strict';var Sequelize=require(_0x5d75('0x0'));var _=require(_0x5d75('0x1'));module[_0x5d75('0x2')]={'body':{'type':Sequelize[_0x5d75('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5d75('0x3')](_0x5d75('0x4'))},'read':{'type':Sequelize[_0x5d75('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5d75('0x6')]('in','out'),'defaultValue':_0x5d75('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5d75('0x8')](0x1fe)},'from':{'type':Sequelize[_0x5d75('0x8')]},'to':{'type':Sequelize[_0x5d75('0x3')](_0x5d75('0x9'))},'cc':{'type':Sequelize[_0x5d75('0x3')]('long')},'bcc':{'type':Sequelize[_0x5d75('0x3')]('long')},'subject':{'type':Sequelize[_0x5d75('0x3')]},'sentAt':{'type':Sequelize[_0x5d75('0xa')]},'attach':{'type':Sequelize[_0x5d75('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x5d75('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x5d75('0x3')](_0x5d75('0x9'))},'originCc':{'type':Sequelize[_0x5d75('0x3')](_0x5d75('0x9'))},'originChannel':{'type':Sequelize[_0x5d75('0x6')](_0x5d75('0xc'),_0x5d75('0xd')),'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 89597e7..8a48a95 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 _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 +var _0x14e0=['client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','update','destroy','end','sendStatus','stack','name','send','index','MailMessage','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','show','includeAll','find','params','body','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','Contacts','DESC','MailServerOut','Smtp','attachments','join','server/files/attachments','defaults','ListId','sendMail','messageId','format','accept','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','MailInteractionId','isNil','info','user','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','Sequelize','rejectmessage','unix','root','server','files','tmp','bcc','subject','createdAt','Attachment','Attachments','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','push','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','lodash','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','socket.io-emitter','html-entities','./mailMessage.socket','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x14e0,0x8d));var _0x014e=function(_0xc0638b,_0x2fccf4){_0xc0638b=_0xc0638b-0x0;var _0xd57dfa=_0x14e0[_0xc0638b];return _0xd57dfa;};'use strict';var emlformat=require(_0x014e('0x0'));var moment=require(_0x014e('0x1'));var BPromise=require(_0x014e('0x2'));var util=require(_0x014e('0x3'));var path=require(_0x014e('0x4'));var fs=require('fs');var _=require(_0x014e('0x5'));var Redis=require('ioredis');var htmlToText=require('html-to-text');var qs=require(_0x014e('0x6'));var logger=require(_0x014e('0x7'))(_0x014e('0x8'));var interaction_log=require(_0x014e('0x7'))(_0x014e('0x9'));var config=require(_0x014e('0xa'));var db=require(_0x014e('0xb'))['db'];config[_0x014e('0xc')]=_['defaults'](config[_0x014e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x014e('0xd'))(new Redis(config['redis']));var htmlEntities=require(_0x014e('0xe'));require(_0x014e('0xf'))['register'](socket);var jayson=require(_0x014e('0x10'));var client=jayson[_0x014e('0x11')][_0x014e('0x12')]({'port':0x232c});var client9003=jayson['client'][_0x014e('0x12')]({'port':0x232b});var client9002=jayson['client'][_0x014e('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x2a8a1e,_0x481b0d,_0x259170,_0xec4c0e){return new BPromise(function(_0x3915c9,_0x18756a){var _0x4cfcce=_0xec4c0e||client;return _0x4cfcce[_0x014e('0x13')](_0x2a8a1e,_0x259170)[_0x014e('0x14')](function(_0x3da3de){logger['info'](_0x014e('0x15'),_0x481b0d,'request\x20sent');logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x481b0d,_0x014e('0x16'),JSON[_0x014e('0x17')](_0x3da3de));if(_0x3da3de[_0x014e('0x18')]){if(_0x3da3de[_0x014e('0x18')][_0x014e('0x19')]===0x1f4){logger['error'](_0x014e('0x15'),_0x481b0d,_0x3da3de[_0x014e('0x18')][_0x014e('0x1a')]);return _0x18756a(_0x3da3de[_0x014e('0x18')][_0x014e('0x1a')]);}logger[_0x014e('0x18')](_0x014e('0x15'),_0x481b0d,_0x3da3de[_0x014e('0x18')]['message']);return _0x3915c9(_0x3da3de[_0x014e('0x18')]['message']);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x481b0d,_0x014e('0x16'));_0x3915c9(_0x3da3de[_0x014e('0x1b')]['message']);}})[_0x014e('0x1c')](function(_0x5647c1){logger[_0x014e('0x18')](_0x014e('0x15'),_0x481b0d,_0x5647c1);_0x18756a(_0x5647c1);});});}function respondWithResult(_0x5e2001,_0x1a21b9){_0x1a21b9=_0x1a21b9||0xc8;return function(_0x2ffc67){if(_0x2ffc67){return _0x5e2001[_0x014e('0x1d')](_0x1a21b9)[_0x014e('0x1e')](_0x2ffc67);}};}function respondWithFilteredResult(_0x1e637e,_0x190913){return function(_0x4e8c2b){if(_0x4e8c2b){var _0x5e75f5=typeof _0x190913[_0x014e('0x1f')]===_0x014e('0x20')&&typeof _0x190913[_0x014e('0x21')]===_0x014e('0x20');var _0x27df93=_0x4e8c2b[_0x014e('0x22')];var _0x4fa966=_0x5e75f5?0x0:_0x190913['offset'];var _0x1d26e3=_0x5e75f5?_0x4e8c2b[_0x014e('0x22')]:_0x190913['offset']+_0x190913[_0x014e('0x21')];var _0x48252b;if(_0x1d26e3>=_0x27df93){_0x1d26e3=_0x27df93;_0x48252b=0xc8;}else{_0x48252b=0xce;}_0x1e637e[_0x014e('0x1d')](_0x48252b);return _0x1e637e[_0x014e('0x23')]('Content-Range',_0x4fa966+'-'+_0x1d26e3+'/'+_0x27df93)['json'](_0x4e8c2b);}return null;};}function saveUpdates(_0x18f383){return function(_0x491ce8){if(_0x491ce8){return _0x491ce8[_0x014e('0x24')](_0x18f383)[_0x014e('0x14')](function(_0x4bc7af){return _0x4bc7af;});}return null;};}function removeEntity(_0xdb2fb9){return function(_0x146c38){if(_0x146c38){return _0x146c38[_0x014e('0x25')]()[_0x014e('0x14')](function(){_0xdb2fb9[_0x014e('0x1d')](0xcc)[_0x014e('0x26')]();});}};}function handleEntityNotFound(_0x392bff){return function(_0x33c805){if(!_0x33c805){_0x392bff[_0x014e('0x27')](0x194);}return _0x33c805;};}function handleError(_0x397496,_0x614fe2){_0x614fe2=_0x614fe2||0x1f4;return function(_0x221721){logger[_0x014e('0x18')](_0x221721[_0x014e('0x28')]);if(_0x221721[_0x014e('0x29')]){delete _0x221721[_0x014e('0x29')];}_0x397496[_0x014e('0x1d')](_0x614fe2)[_0x014e('0x2a')](_0x221721);};}exports[_0x014e('0x2b')]=function(_0x34c899,_0x4090ca){var _0x467d07={},_0x555f41={},_0x53b138={'count':0x0,'rows':[]};var _0x27e493=_['map'](db[_0x014e('0x2c')][_0x014e('0x2d')],function(_0x21b1dc){return{'name':_0x21b1dc[_0x014e('0x2e')],'type':_0x21b1dc[_0x014e('0x2f')][_0x014e('0x30')]};});_0x555f41['model']=_['map'](_0x27e493,_0x014e('0x29'));_0x555f41[_0x014e('0x31')]=_[_0x014e('0x32')](_0x34c899[_0x014e('0x31')]);_0x555f41[_0x014e('0x33')]=_['intersection'](_0x555f41[_0x014e('0x34')],_0x555f41[_0x014e('0x31')]);_0x467d07[_0x014e('0x35')]=_[_0x014e('0x36')](_0x555f41[_0x014e('0x34')],qs['fields'](_0x34c899[_0x014e('0x31')][_0x014e('0x37')]));_0x467d07['attributes']=_0x467d07[_0x014e('0x35')][_0x014e('0x38')]?_0x467d07[_0x014e('0x35')]:_0x555f41[_0x014e('0x34')];if(!_0x34c899['query'][_0x014e('0x39')](_0x014e('0x3a'))){_0x467d07['limit']=qs[_0x014e('0x21')](_0x34c899[_0x014e('0x31')][_0x014e('0x21')]);_0x467d07[_0x014e('0x1f')]=qs['offset'](_0x34c899[_0x014e('0x31')][_0x014e('0x1f')]);}_0x467d07[_0x014e('0x3b')]=qs[_0x014e('0x3c')](_0x34c899[_0x014e('0x31')][_0x014e('0x3c')]);_0x467d07[_0x014e('0x3d')]=qs[_0x014e('0x33')](_[_0x014e('0x3e')](_0x34c899[_0x014e('0x31')],_0x555f41[_0x014e('0x33')]),_0x27e493);if(_0x34c899[_0x014e('0x31')][_0x014e('0x3f')]){_0x467d07[_0x014e('0x3d')]=_[_0x014e('0x40')](_0x467d07['where'],{'$or':_[_0x014e('0x41')](_0x27e493,function(_0x5d5891){if(_0x5d5891[_0x014e('0x2f')]!==_0x014e('0x42')){var _0x5bcdde={};_0x5bcdde[_0x5d5891['name']]={'$like':'%'+_0x34c899[_0x014e('0x31')][_0x014e('0x3f')]+'%'};return _0x5bcdde;}})});}_0x467d07=_[_0x014e('0x40')]({},_0x467d07,_0x34c899[_0x014e('0x43')]);var _0x5a3da7={'where':_0x467d07[_0x014e('0x3d')]};return db[_0x014e('0x2c')]['count'](_0x5a3da7)['then'](function(_0x20e939){_0x53b138[_0x014e('0x22')]=_0x20e939;if(_0x34c899[_0x014e('0x31')]['includeAll']){_0x467d07[_0x014e('0x44')]=[{'all':!![]}];}return db[_0x014e('0x2c')][_0x014e('0x45')](_0x467d07);})[_0x014e('0x14')](function(_0x31cf6c){_0x53b138[_0x014e('0x46')]=_0x31cf6c;return _0x53b138;})[_0x014e('0x14')](respondWithFilteredResult(_0x4090ca,_0x467d07))[_0x014e('0x1c')](handleError(_0x4090ca,null));};exports[_0x014e('0x47')]=function(_0x4ae5f6,_0x571aca){var _0x325fe9={'raw':!![],'where':{'id':_0x4ae5f6['params']['id']}},_0xac32ff={};_0xac32ff['model']=_[_0x014e('0x32')](db[_0x014e('0x2c')][_0x014e('0x2d')]);_0xac32ff['query']=_[_0x014e('0x32')](_0x4ae5f6[_0x014e('0x31')]);_0xac32ff['filters']=_['intersection'](_0xac32ff[_0x014e('0x34')],_0xac32ff[_0x014e('0x31')]);_0x325fe9[_0x014e('0x35')]=_['intersection'](_0xac32ff[_0x014e('0x34')],qs[_0x014e('0x37')](_0x4ae5f6[_0x014e('0x31')][_0x014e('0x37')]));_0x325fe9[_0x014e('0x35')]=_0x325fe9[_0x014e('0x35')]['length']?_0x325fe9[_0x014e('0x35')]:_0xac32ff[_0x014e('0x34')];if(_0x4ae5f6['query'][_0x014e('0x48')]){_0x325fe9[_0x014e('0x44')]=[{'all':!![]}];}_0x325fe9=_['merge']({},_0x325fe9,_0x4ae5f6[_0x014e('0x43')]);return db[_0x014e('0x2c')][_0x014e('0x49')](_0x325fe9)[_0x014e('0x14')](handleEntityNotFound(_0x571aca,null))[_0x014e('0x14')](respondWithResult(_0x571aca,null))['catch'](handleError(_0x571aca,null));};exports['update']=function(_0x18610d,_0x13633e){if(_0x18610d['body']['id']){delete _0x18610d['body']['id'];}return db['MailMessage'][_0x014e('0x49')]({'where':{'id':_0x18610d[_0x014e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x13633e,null))[_0x014e('0x14')](saveUpdates(_0x18610d[_0x014e('0x4b')],null))[_0x014e('0x14')](respondWithResult(_0x13633e,null))[_0x014e('0x1c')](handleError(_0x13633e,null));};exports[_0x014e('0x25')]=function(_0x24d42f,_0xe5c1e3){return db['MailMessage']['find']({'where':{'id':_0x24d42f[_0x014e('0x4a')]['id']}})[_0x014e('0x14')](handleEntityNotFound(_0xe5c1e3,null))[_0x014e('0x14')](removeEntity(_0xe5c1e3,null))['catch'](handleError(_0xe5c1e3,null));};exports[_0x014e('0x4c')]=function(_0x41a79c,_0x3b6a83){return db['MailMessage'][_0x014e('0x4c')]()['then'](respondWithResult(_0x3b6a83,null))[_0x014e('0x1c')](handleError(_0x3b6a83,null));};exports['create']=function(_0x16aed6,_0x292ef4){return db['MailMessage'][_0x014e('0x4d')](_0x16aed6[_0x014e('0x4b')])[_0x014e('0x14')](function(_0x2c6863){if(_0x2c6863){if(_0x2c6863[_0x014e('0x4e')]===_0x014e('0x4f')&&!_0x2c6863[_0x014e('0x50')]){var _0x4a4e31,_0x56de68,_0x7514f;if(_0x16aed6[_0x014e('0x4b')]['to']){_0x56de68=_0x16aed6['body']['to'][_0x014e('0x51')](',')[0x0];}return db[_0x014e('0x52')][_0x014e('0x53')]({'where':{'id':_0x2c6863[_0x014e('0x54')]},'include':[{'model':db[_0x014e('0x55')],'as':_0x014e('0x56'),'include':[{'model':db['CmContact'],'as':_0x014e('0x57'),'where':{'email':_0x56de68},'limit':0x1,'order':[['updatedAt',_0x014e('0x58')]]}]},{'model':db[_0x014e('0x59')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x014e('0x14')](function(_0x474b8b){_0x4a4e31=_0x474b8b;if(!_0x4a4e31||!_0x4a4e31[_0x014e('0x5a')])return;var _0x370a15=_0x4a4e31['getSmtpOptions']();if(_0x16aed6[_0x014e('0x4b')]['attachments']&&_0x16aed6[_0x014e('0x4b')][_0x014e('0x5b')][_0x014e('0x38')]){for(var _0x13d694=0x0;_0x13d694<_0x16aed6[_0x014e('0x4b')][_0x014e('0x5b')]['length'];_0x13d694+=0x1){_0x16aed6['body'][_0x014e('0x5b')][_0x13d694]={'filename':_0x16aed6[_0x014e('0x4b')]['attachments'][_0x13d694][_0x014e('0x29')],'path':path[_0x014e('0x5c')](config['root'],_0x014e('0x5d'),_0x16aed6[_0x014e('0x4b')][_0x014e('0x5b')][_0x13d694]['basename'])};}}_0x7514f={'account':_0x370a15,'message':_0x16aed6[_0x014e('0x4b')]};return;})[_0x014e('0x14')](function(){if(_0x4a4e31['List']){if(_0x4a4e31[_0x014e('0x56')][_0x014e('0x57')][_0x014e('0x38')]){return _0x4a4e31[_0x014e('0x56')]['Contacts'][0x0];}else{return db['CmContact']['create'](_[_0x014e('0x5e')](_0x16aed6['body'],{'firstName':_0x16aed6[_0x014e('0x4b')]['to'],'email':_0x16aed6[_0x014e('0x4b')]['to'],'phone':_0x16aed6['body']['to'],'ListId':_0x4a4e31[_0x014e('0x5f')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x014e('0x14')](function(){if(_0x7514f){return respondWithRpcPromise('SendMail',_0x014e('0x60'),_0x7514f,client9003)[_0x014e('0x14')](function(_0x5830c1){return _0x2c6863['update']({'read':!![],'messageId':_0x5830c1[_0x014e('0x61')],'sentAt':moment()[_0x014e('0x62')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x014e('0x1c')](function(_0x489692){logger[_0x014e('0x18')]('%s',JSON['stringify'](_0x489692));return _0x2c6863;});}return _0x2c6863;});}return _0x2c6863;}})[_0x014e('0x14')](respondWithResult(_0x292ef4,0xc9))['catch'](handleError(_0x292ef4,null));};exports[_0x014e('0x63')]=function(_0x52094d,_0x1dd3d8){var _0x5019d6={'agent':{},'channel':'mail'};if(_0x52094d[_0x014e('0x4b')]['id']){delete _0x52094d[_0x014e('0x4b')]['id'];}_0x52094d['body']['read']=!![];_0x52094d[_0x014e('0x4b')][_0x014e('0x64')]=moment()[_0x014e('0x62')](_0x014e('0x65'));_0x52094d[_0x014e('0x4b')][_0x014e('0x66')]=_0x52094d['body'][_0x014e('0x66')]||_0x52094d['user']['id'];_0x5019d6[_0x014e('0x67')]['id']=_0x52094d[_0x014e('0x4b')]['UserId'];return db[_0x014e('0x2c')][_0x014e('0x49')]({'where':{'id':_0x52094d['params']['id'],'UserId':null}})[_0x014e('0x14')](handleEntityNotFound(_0x1dd3d8,null))[_0x014e('0x14')](saveUpdates(_0x52094d[_0x014e('0x4b')],null))[_0x014e('0x14')](function(_0x3db0a5){if(_0x3db0a5){_0x5019d6[_0x014e('0x1a')]=_0x3db0a5[_0x014e('0x68')]({'plain':!![]});return db['MailInteraction'][_0x014e('0x49')]({'where':{'id':_0x3db0a5[_0x014e('0x69')]}});}return null;})['then'](handleEntityNotFound(_0x1dd3d8,null))[_0x014e('0x14')](function(_0x167154){if(_0x167154){return _0x167154[_0x014e('0x24')]({'UserId':_0x52094d[_0x014e('0x4b')][_0x014e('0x66')],'read1stAt':_[_0x014e('0x6a')](_0x167154['read1stAt'])?moment()[_0x014e('0x62')](_0x014e('0x65')):undefined});}return null;})['then'](function(_0x36e9b8){if(_0x36e9b8){_0x5019d6['interaction']=_0x36e9b8[_0x014e('0x68')]({'plain':!![]});interaction_log[_0x014e('0x6b')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x52094d[_0x014e('0x6c')]['id'],_0x52094d['user']['name'],_0x52094d[_0x014e('0x6c')][_0x014e('0x6d')],_0x5019d6[_0x014e('0x6e')]['id'],_0x52094d[_0x014e('0x4b')]?JSON[_0x014e('0x17')](_0x52094d[_0x014e('0x4b')]):_0x014e('0x6f'));return respondWithRpcPromise(_0x014e('0x70'),_0x014e('0x71'),_0x5019d6);}return null;})[_0x014e('0x14')](function(_0x170ba4){var _0x7d7f06=_0x014e('0x72')+_0x170ba4[_0x014e('0x1a')]['ContactId'];return db[_0x014e('0x73')]['query'](_0x7d7f06,{'type':db['Sequelize'][_0x014e('0x74')][_0x014e('0x75')],'raw':!![]})[_0x014e('0x14')](function(_0x4da58b){return _0x4da58b;});})['then'](function(_0xae7f49){if(_0xae7f49){_0x5019d6[_0x014e('0x1a')][_0x014e('0x76')]=_0xae7f49[0x0];if(!_0x52094d[_0x014e('0x4b')][_0x014e('0x66')])return;return db[_0x014e('0x77')][_0x014e('0x49')]({'where':{'id':_0x52094d[_0x014e('0x4b')][_0x014e('0x66')],'role':'agent'},'attributes':['id',_0x014e('0x29'),_0x014e('0x78'),_0x014e('0x79'),_0x014e('0x7a')],'raw':!![]});}return null;})[_0x014e('0x14')](function(_0x4a0293){if(!_0x4a0293)return null;_0x5019d6[_0x014e('0x1a')][_0x014e('0x67')]=_0x4a0293;return _0x5019d6;})['then'](function(_0x279681){if(_0x279681){if(_0x52094d[_0x014e('0x4b')][_0x014e('0x7b')]){_0x5019d6[_0x014e('0x1a')][_0x014e('0x7c')]=util['format'](_0x014e('0x7d'),_0x52094d[_0x014e('0x6c')][_0x014e('0x29')]);_0x5019d6[_0x014e('0x1a')][_0x014e('0x7e')]=_0x5019d6['channel'];_0x5019d6[_0x014e('0x1a')][_0x014e('0x7f')]=_0x5019d6[_0x014e('0x7e')];_0x5019d6['message'][_0x014e('0x80')]=_0x014e('0x63');_0x5019d6[_0x014e('0x1a')]['body']=htmlToText[_0x014e('0x81')](_0x5019d6[_0x014e('0x1a')]['body']);return respondWithRpcPromise(_0x014e('0x82'),_0x014e('0x82'),{'event':_0x014e('0x83'),'message':_0x5019d6[_0x014e('0x1a')]},client9002)[_0x014e('0x14')](function(){return _0x5019d6;});}return _0x5019d6;}return null;})[_0x014e('0x14')](respondWithResult(_0x1dd3d8,null))[_0x014e('0x1c')](handleError(_0x1dd3d8,null));};exports[_0x014e('0x84')]=function(_0x70904b,_0xdc7786){var _0x1adffa={'agent':{},'channel':'mail'};if(_0x70904b['body']['id']){delete _0x70904b[_0x014e('0x4b')]['id'];}_0x70904b[_0x014e('0x4b')]['UserId']=_0x70904b[_0x014e('0x4b')][_0x014e('0x66')]||_0x70904b[_0x014e('0x6c')]['id'];_0x1adffa[_0x014e('0x67')]['id']=_0x70904b[_0x014e('0x4b')]['UserId'];return db[_0x014e('0x2c')][_0x014e('0x49')]({'where':{'id':_0x70904b[_0x014e('0x4a')]['id'],'UserId':null}})[_0x014e('0x14')](handleEntityNotFound(_0xdc7786,null))[_0x014e('0x14')](function(_0x395a67){if(_0x395a67){_0x1adffa[_0x014e('0x1a')]=_0x395a67[_0x014e('0x68')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x395a67[_0x014e('0x69')]}});}return null;})[_0x014e('0x14')](handleEntityNotFound(_0xdc7786,null))[_0x014e('0x14')](function(_0x1f560d){if(_0x1f560d){_0x1adffa['interaction']=_0x1f560d[_0x014e('0x68')]({'plain':!![]});interaction_log[_0x014e('0x6b')](_0x014e('0x85'),_0x70904b[_0x014e('0x6c')]['id'],_0x70904b['user'][_0x014e('0x29')],_0x70904b[_0x014e('0x6c')][_0x014e('0x6d')],_0x1adffa['interaction']['id'],_0x70904b[_0x014e('0x4b')]?JSON[_0x014e('0x17')](_0x70904b[_0x014e('0x4b')]):_0x014e('0x6f'));return respondWithRpcPromise(_0x014e('0x86'),_0x014e('0x87'),_0x1adffa);}return null;})[_0x014e('0x14')](function(_0x31db07){var _0x3e9934=_0x014e('0x72')+_0x31db07['message'][_0x014e('0x88')];return db[_0x014e('0x73')]['query'](_0x3e9934,{'type':db[_0x014e('0x89')][_0x014e('0x74')]['SELECT'],'raw':!![]})['then'](function(_0x4e8931){return _0x4e8931;});})['then'](function(_0x69e908){if(_0x69e908){_0x1adffa[_0x014e('0x1a')][_0x014e('0x76')]=_0x69e908[0x0];if(!_0x70904b[_0x014e('0x4b')][_0x014e('0x66')])return;return db[_0x014e('0x77')][_0x014e('0x49')]({'where':{'id':_0x70904b['body']['UserId'],'role':_0x014e('0x67')},'attributes':['id',_0x014e('0x29'),_0x014e('0x78'),_0x014e('0x79'),'internal'],'raw':!![]});}return null;})[_0x014e('0x14')](function(_0x3d56f0){if(!_0x3d56f0)return null;_0x1adffa[_0x014e('0x1a')][_0x014e('0x67')]=_0x3d56f0;return _0x1adffa;})[_0x014e('0x14')](function(_0x4a89e7){if(_0x4a89e7){_0x4a89e7[_0x014e('0x1a')][_0x014e('0x7c')]=util[_0x014e('0x62')]('SIP/%s',_0x70904b[_0x014e('0x6c')][_0x014e('0x29')]);_0x4a89e7[_0x014e('0x1a')][_0x014e('0x7e')]=_0x1adffa[_0x014e('0x7e')];_0x4a89e7[_0x014e('0x1a')][_0x014e('0x7f')]=_0x1adffa[_0x014e('0x7e')];_0x4a89e7[_0x014e('0x1a')][_0x014e('0x80')]='reject';_0x4a89e7[_0x014e('0x1a')][_0x014e('0x4b')]=htmlToText[_0x014e('0x81')](_0x1adffa[_0x014e('0x1a')][_0x014e('0x4b')]);respondWithRpcPromise(_0x014e('0x82'),'EventManager',{'event':_0x014e('0x8a'),'message':_0x4a89e7[_0x014e('0x1a')]},client9002);return _0x1adffa;}return null;})[_0x014e('0x14')](respondWithResult(_0xdc7786,null))[_0x014e('0x1c')](handleError(_0xdc7786,null));};exports['download']=function(_0x4bd024,_0x205f3a){var _0x1ef812=moment()[_0x014e('0x8b')]()['toString']();var _0x40e38a=path[_0x014e('0x5c')](config[_0x014e('0x8c')],_0x014e('0x8d'),_0x014e('0x8e'),_0x014e('0x8f'));var _0x704810=path[_0x014e('0x5c')](config[_0x014e('0x8c')],_0x014e('0x8d'),'files',_0x014e('0x5b'));var _0x4bb7f6=util[_0x014e('0x62')]('message-%s.eml',_0x1ef812);return db[_0x014e('0x2c')][_0x014e('0x49')]({'where':{'id':_0x4bd024[_0x014e('0x4a')]['id']},'attributes':['id',_0x014e('0x4b'),'from','to','cc',_0x014e('0x90'),_0x014e('0x91'),_0x014e('0x92')],'include':_0x4bd024[_0x014e('0x31')][_0x014e('0x5b')]?[{'model':db[_0x014e('0x93')],'as':_0x014e('0x94')}]:undefined})[_0x014e('0x14')](handleEntityNotFound(_0x205f3a,null))['then'](function(_0x1478bf){if(_0x1478bf){var _0x350578=_0x1478bf;var _0x36da90={'from':_0x350578[_0x014e('0x95')],'to':_0x350578['to'],'subject':_0x350578[_0x014e('0x91')],'html':htmlEntities['decode'](_0x350578[_0x014e('0x4b')]),'headers':{'Date':moment(_0x350578['createdAt'])[_0x014e('0x62')](_0x014e('0x96'))},'attachments':[]};if(_0x1478bf['cc']){_0x36da90['headers']['Cc']=_0x1478bf['cc'];}if(_0x1478bf[_0x014e('0x90')]){_0x36da90[_0x014e('0x97')][_0x014e('0x98')]=_0x1478bf[_0x014e('0x90')];}return new BPromise(function(_0x2aa2d4,_0x586ae9){if(_0x1478bf[_0x014e('0x94')]){for(var _0x500aba=0x0;_0x500aba<_0x1478bf[_0x014e('0x94')][_0x014e('0x38')];_0x500aba++){var _0xa5902b=_0x1478bf['Attachments'][_0x500aba];var _0x3bce0c=path['join'](_0x704810,_0xa5902b[_0x014e('0x99')]);if(fs['existsSync'](_0x3bce0c)){_0x36da90[_0x014e('0x5b')][_0x014e('0x9a')]({'name':_0xa5902b[_0x014e('0x29')],'contentType':_0xa5902b[_0x014e('0x2f')],'data':fs['readFileSync'](_0x3bce0c)});}}}emlformat[_0x014e('0x9b')](_0x36da90,function(_0x3f98fc,_0x2e17c2){if(_0x3f98fc)return _0x586ae9(_0x3f98fc);fs[_0x014e('0x9c')](path[_0x014e('0x5c')](_0x40e38a,_0x4bb7f6),_0x2e17c2);return _0x2aa2d4(_0x2e17c2);});});}})[_0x014e('0x14')](function(_0x32f394){if(_0x32f394){return _0x205f3a['download'](path[_0x014e('0x5c')](_0x40e38a,_0x4bb7f6),_0x4bb7f6,function(_0x337215){if(!_0x337215)fs[_0x014e('0x9d')](path[_0x014e('0x5c')](_0x40e38a,_0x4bb7f6));});}})[_0x014e('0x1c')](handleError(_0x205f3a,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index fb6f784..db721cc 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 _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 +var _0xe3ec=['remove','emit','hook','exports','events','../../mysqldb','MailMessage','save'];(function(_0x4a7589,_0xd20483){var _0x409969=function(_0x43ab0b){while(--_0x43ab0b){_0x4a7589['push'](_0x4a7589['shift']());}};_0x409969(++_0xd20483);}(_0xe3ec,0x84));var _0xce3e=function(_0x358f56,_0x36c10f){_0x358f56=_0x358f56-0x0;var _0x1e4fbd=_0xe3ec[_0x358f56];return _0x1e4fbd;};'use strict';var EventEmitter=require(_0xce3e('0x0'));var MailMessage=require(_0xce3e('0x1'))['db'][_0xce3e('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xce3e('0x3'),'afterUpdate':'update','afterDestroy':_0xce3e('0x4')};function emitEvent(_0x5c0e90){return function(_0x2a3b23,_0x26102f,_0x289329){MailMessageEvents[_0xce3e('0x5')](_0x5c0e90+':'+_0x2a3b23['id'],_0x2a3b23);MailMessageEvents[_0xce3e('0x5')](_0x5c0e90,_0x2a3b23);_0x289329(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xce3e('0x6')](e,emitEvent(event));}}module[_0xce3e('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index ad9d831..47c7ac3 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 _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 +var _0x9a1e=['utf8mb4','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','exports','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','direction','toLowerCase','out','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch'];(function(_0x380af2,_0x36cf66){var _0x1789dc=function(_0x37b604){while(--_0x37b604){_0x380af2['push'](_0x380af2['shift']());}};_0x1789dc(++_0x36cf66);}(_0x9a1e,0x106));var _0xe9a1=function(_0xcad50,_0x6abe8e){_0xcad50=_0xcad50-0x0;var _0x597cd1=_0x9a1e[_0xcad50];return _0x597cd1;};'use strict';var _=require('lodash');var util=require(_0xe9a1('0x0'));var logger=require(_0xe9a1('0x1'))('api');var moment=require(_0xe9a1('0x2'));var BPromise=require(_0xe9a1('0x3'));var rp=require(_0xe9a1('0x4'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xe9a1('0x5'));var rimraf=require(_0xe9a1('0x6'));var config=require(_0xe9a1('0x7'));var attributes=require(_0xe9a1('0x8'));module[_0xe9a1('0x9')]=function(_0x1ed4b2,_0x12bbf9){return _0x1ed4b2['define']('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xe9a1('0xa'),'fields':['messageId']},{'name':_0xe9a1('0xb'),'fields':[_0xe9a1('0xc'),_0xe9a1('0xd')],'type':_0xe9a1('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x51c331,_0x22d5de,_0x3942e1){if(_0x51c331[_0xe9a1('0xf')]){_0x51c331[_0xe9a1('0xc')]=htmlToText['fromString'](_0x51c331[_0xe9a1('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3942e1(null,_0x22d5de);},'afterCreate':function(_0x5b6c52,_0x2ffca6,_0x3fe9d8){var _0x4c1651=_0x1ed4b2['models'];var _0x1cc45b=_0x5b6c52['get']({'plain':!![]});if(_0x1cc45b[_0xe9a1('0x10')][_0xe9a1('0x11')]()==='in'||_0x1cc45b[_0xe9a1('0x10')]['toLowerCase']()===_0xe9a1('0x12')&&!_0x1cc45b['secret']&&!_[_0xe9a1('0x13')](_0x1cc45b[_0xe9a1('0x14')])){_0x4c1651[_0xe9a1('0x15')][_0xe9a1('0x16')]({'where':{'id':_0x1cc45b[_0xe9a1('0x17')]}})[_0xe9a1('0x18')](function(_0x2a9f14){if(_0x2a9f14){_0x2a9f14[_0xe9a1('0x19')]({'lastMsgAt':_0x1cc45b[_0xe9a1('0x1a')],'lastMsgDirection':_0x1cc45b[_0xe9a1('0x10')][_0xe9a1('0x11')]()});}})[_0xe9a1('0x1b')](function(_0x587024){console['error'](_0x587024);});}_0x3fe9d8();}},'charset':_0xe9a1('0x1c'),'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 5379596..30f7d0f 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 _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 +var _0x8e3f=['redis','localhost','socket.io-emitter','./mailMessage.socket','register','request','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x3f6e26,_0x811a34){var _0x474345=function(_0x4a0cbe){while(--_0x4a0cbe){_0x3f6e26['push'](_0x3f6e26['shift']());}};_0x474345(++_0x811a34);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x8e3f[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var moment=require(_0xf8e3('0x2'));var BPromise=require('bluebird');var rs=require(_0xf8e3('0x3'));var fs=require('fs');var Redis=require(_0xf8e3('0x4'));var db=require(_0xf8e3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8e3('0x6'))(_0xf8e3('0x7'));var config=require('../../config/environment');var jayson=require(_0xf8e3('0x8'));var client=jayson[_0xf8e3('0x9')][_0xf8e3('0xa')]({'port':0x232a});config[_0xf8e3('0xb')]=_['defaults'](config[_0xf8e3('0xb')],{'host':_0xf8e3('0xc'),'port':0x18eb});var socket=require(_0xf8e3('0xd'))(new Redis(config[_0xf8e3('0xb')]));require(_0xf8e3('0xe'))[_0xf8e3('0xf')](socket);function respondWithRpcPromise(_0x299a7e,_0x2a3b59,_0x2d914d){return new BPromise(function(_0x2bc3cd,_0x28f5f0){return client[_0xf8e3('0x10')](_0x299a7e,_0x2d914d)['then'](function(_0xb7d14f){logger[_0xf8e3('0x11')](_0xf8e3('0x12'),_0x2a3b59,'request\x20sent');logger[_0xf8e3('0x13')](_0xf8e3('0x14'),_0x2a3b59,_0xf8e3('0x15'),JSON[_0xf8e3('0x16')](_0xb7d14f));if(_0xb7d14f['error']){if(_0xb7d14f[_0xf8e3('0x17')][_0xf8e3('0x18')]===0x1f4){logger[_0xf8e3('0x17')]('MailMessage,\x20%s,\x20%s',_0x2a3b59,_0xb7d14f[_0xf8e3('0x17')]['message']);return _0x28f5f0(_0xb7d14f[_0xf8e3('0x17')][_0xf8e3('0x19')]);}logger[_0xf8e3('0x17')]('MailMessage,\x20%s,\x20%s',_0x2a3b59,_0xb7d14f['error'][_0xf8e3('0x19')]);return _0x2bc3cd(_0xb7d14f[_0xf8e3('0x17')][_0xf8e3('0x19')]);}else{logger[_0xf8e3('0x11')](_0xf8e3('0x12'),_0x2a3b59,_0xf8e3('0x15'));_0x2bc3cd(_0xb7d14f[_0xf8e3('0x1a')][_0xf8e3('0x19')]);}})[_0xf8e3('0x1b')](function(_0x13fb31){logger['error'](_0xf8e3('0x12'),_0x2a3b59,_0x13fb31);_0x28f5f0(_0x13fb31);});});}exports[_0xf8e3('0x1c')]=function(_0x24e8d6){var _0x31f55d=this;return new Promise(function(_0x3128ad,_0x11c58e){return db[_0xf8e3('0x1d')][_0xf8e3('0x1e')](_0x24e8d6['body'],{'raw':_0x24e8d6[_0xf8e3('0x1f')]?_0x24e8d6[_0xf8e3('0x1f')][_0xf8e3('0x20')]===undefined?!![]:![]:!![]})[_0xf8e3('0x21')](function(_0x4a1e5f){logger[_0xf8e3('0x11')]('CreateMailMessage',_0x24e8d6);logger[_0xf8e3('0x13')](_0xf8e3('0x1c'),_0x24e8d6,JSON[_0xf8e3('0x16')](_0x4a1e5f));_0x3128ad(_0x4a1e5f);})[_0xf8e3('0x1b')](function(_0x1f4b68){logger[_0xf8e3('0x17')]('CreateMailMessage',_0x1f4b68[_0xf8e3('0x19')],_0x24e8d6);_0x11c58e(_0x31f55d[_0xf8e3('0x17')](0x1f4,_0x1f4b68[_0xf8e3('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 1b3b06c..35dd6f8 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 _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 +var _0x67a7=['mailMessage:','./mailMessage.events','remove','emit','removeListener'];(function(_0x49fc59,_0x33d88b){var _0x137573=function(_0x2c9469){while(--_0x2c9469){_0x49fc59['push'](_0x49fc59['shift']());}};_0x137573(++_0x33d88b);}(_0x67a7,0x19b));var _0x767a=function(_0x3dc21f,_0x590c94){_0x3dc21f=_0x3dc21f-0x0;var _0x1b2835=_0x67a7[_0x3dc21f];return _0x1b2835;};'use strict';var MailMessageEvents=require(_0x767a('0x0'));var events=['save',_0x767a('0x1'),'update'];function createListener(_0x4e414c,_0x5cbd65){return function(_0x6b6065){_0x5cbd65[_0x767a('0x2')](_0x4e414c,_0x6b6065);};}function removeListener(_0x21308b,_0x14c394){return function(){MailMessageEvents[_0x767a('0x3')](_0x21308b,_0x14c394);};}exports['register']=function(_0x1451ba){for(var _0x577dd8=0x0,_0x20302f=events['length'];_0x577dd8<_0x20302f;_0x577dd8++){var _0xa3e113=events[_0x577dd8];var _0x145b17=createListener(_0x767a('0x4')+_0xa3e113,_0x1451ba);MailMessageEvents['on'](_0xa3e113,_0x145b17);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 20f0afb..d3f853c 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 _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 +var _0xdb06=['/:id','destroy','removeTeams','removeAgents','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id/members','/:id/teams','/:id/users','post','create','addTeams','addAgents','update','delete'];(function(_0x568a61,_0x2124f8){var _0x334c3b=function(_0x1afc39){while(--_0x1afc39){_0x568a61['push'](_0x568a61['shift']());}};_0x334c3b(++_0x2124f8);}(_0xdb06,0xe5));var _0x6db0=function(_0x553c46,_0x1bcdae){_0x553c46=_0x553c46-0x0;var _0x347e0f=_0xdb06[_0x553c46];return _0x347e0f;};'use strict';var multer=require(_0x6db0('0x0'));var util=require(_0x6db0('0x1'));var path=require(_0x6db0('0x2'));var timeout=require('connect-timeout');var express=require(_0x6db0('0x3'));var router=express['Router']();var fs_extra=require(_0x6db0('0x4'));var auth=require(_0x6db0('0x5'));var interaction=require(_0x6db0('0x6'));var config=require(_0x6db0('0x7'));var controller=require(_0x6db0('0x8'));router[_0x6db0('0x9')]('/',auth[_0x6db0('0xa')](),controller[_0x6db0('0xb')]);router['get'](_0x6db0('0xc'),auth[_0x6db0('0xa')](),controller[_0x6db0('0xd')]);router[_0x6db0('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x6db0('0x9')](_0x6db0('0xe'),auth[_0x6db0('0xa')](),controller['getMembers']);router[_0x6db0('0x9')](_0x6db0('0xf'),auth['isAuthenticated'](),controller['getTeams']);router[_0x6db0('0x9')](_0x6db0('0x10'),auth[_0x6db0('0xa')](),controller['getAgents']);router[_0x6db0('0x11')]('/',auth[_0x6db0('0xa')](),controller[_0x6db0('0x12')]);router[_0x6db0('0x11')](_0x6db0('0xf'),auth['isAuthenticated'](),controller[_0x6db0('0x13')]);router['post'](_0x6db0('0x10'),auth[_0x6db0('0xa')](),controller[_0x6db0('0x14')]);router['put']('/:id',auth[_0x6db0('0xa')](),controller[_0x6db0('0x15')]);router[_0x6db0('0x16')](_0x6db0('0x17'),auth[_0x6db0('0xa')](),controller[_0x6db0('0x18')]);router[_0x6db0('0x16')](_0x6db0('0xf'),auth['isAuthenticated'](),controller[_0x6db0('0x19')]);router[_0x6db0('0x16')]('/:id/users',auth[_0x6db0('0xa')](),controller[_0x6db0('0x1a')]);module[_0x6db0('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 6c9be68..4e27716 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 _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 +var _0x1a26=['sequelize','STRING','ENUM'];(function(_0x37d0bc,_0x109b96){var _0x170e60=function(_0xae2ad){while(--_0xae2ad){_0x37d0bc['push'](_0x37d0bc['shift']());}};_0x170e60(++_0x109b96);}(_0x1a26,0x1d7));var _0x61a2=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x1a26[_0x710815];return _0x5b3b89;};'use strict';var Sequelize=require(_0x61a2('0x0'));module['exports']={'name':{'type':Sequelize[_0x61a2('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x61a2('0x2')]('rrmemory','beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index ed26fa3..eebb415 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 _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 +var _0xbe84=['isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','getAgents','nolimit','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','get','UserProfileResource','error','stack','name','index','map','MailQueue','fieldName','type','key','include','query','catch','show','model','keys','rawAttributes','filters','intersection','fields','attributes','length','includeAll','merge','options','find','create','user','MailQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','describe','getMembers','findOne','params','UserMailQueue','hasOwnProperty','order','sort','where','pick','filter','findAll','User','findAndCountAll','agent','mailPause','createdAt','rows','format','SIP','updatedAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','flatMap','transaction','findOrCreate','forEach','emit','userMailQueue:save','select','field','tq.TeamId','join','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams'];(function(_0x4f3d26,_0x29012e){var _0x52efd9=function(_0x2a91bc){while(--_0x2a91bc){_0x4f3d26['push'](_0x4f3d26['shift']());}};_0x52efd9(++_0x29012e);}(_0xbe84,0x82));var _0x4be8=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xbe84[_0x3b5250];return _0xc844a1;};'use strict';var BPromise=require('bluebird');var util=require(_0x4be8('0x0'));var _=require('lodash');var squel=require(_0x4be8('0x1'));var Redis=require(_0x4be8('0x2'));var qs=require(_0x4be8('0x3'));var logger=require(_0x4be8('0x4'))(_0x4be8('0x5'));var config=require(_0x4be8('0x6'));var db=require(_0x4be8('0x7'))['db'];config[_0x4be8('0x8')]=_[_0x4be8('0x9')](config[_0x4be8('0x8')],{'host':_0x4be8('0xa'),'port':0x18eb});var socket=require(_0x4be8('0xb'))(new Redis(config['redis']));require(_0x4be8('0xc'))[_0x4be8('0xd')](socket);function respondWithStatusCode(_0x45ee79,_0x145e5d){_0x145e5d=_0x145e5d||0xcc;return function(_0x365a6e){if(_0x365a6e){return _0x45ee79[_0x4be8('0xe')](_0x145e5d);}return _0x45ee79[_0x4be8('0xf')](_0x145e5d)[_0x4be8('0x10')]();};}function respondWithResult(_0x4d28c3,_0x3d755e){_0x3d755e=_0x3d755e||0xc8;return function(_0x595495){if(_0x595495){return _0x4d28c3[_0x4be8('0xf')](_0x3d755e)[_0x4be8('0x11')](_0x595495);}};}function respondWithFilteredResult(_0x382e07,_0xbf87ae){return function(_0x449bac){if(_0x449bac){var _0x6fb16f=typeof _0xbf87ae[_0x4be8('0x12')]===_0x4be8('0x13')&&typeof _0xbf87ae[_0x4be8('0x14')]==='undefined';var _0x158cf3=_0x449bac[_0x4be8('0x15')];var _0x192ca4=_0x6fb16f?0x0:_0xbf87ae[_0x4be8('0x12')];var _0xe47276=_0x6fb16f?_0x449bac['count']:_0xbf87ae['offset']+_0xbf87ae[_0x4be8('0x14')];var _0x488a12;if(_0xe47276>=_0x158cf3){_0xe47276=_0x158cf3;_0x488a12=0xc8;}else{_0x488a12=0xce;}_0x382e07[_0x4be8('0xf')](_0x488a12);return _0x382e07[_0x4be8('0x16')](_0x4be8('0x17'),_0x192ca4+'-'+_0xe47276+'/'+_0x158cf3)[_0x4be8('0x11')](_0x449bac);}return null;};}function saveUpdates(_0x47b459){return function(_0x271751){if(_0x271751){return _0x271751['update'](_0x47b459)[_0x4be8('0x18')](function(_0x373ca8){return _0x373ca8;});}return null;};}function removeEntity(_0x5119ab){return function(_0x49effa){if(_0x49effa){return _0x49effa['destroy']()[_0x4be8('0x18')](function(){var _0xa4b9b4=_0x49effa[_0x4be8('0x19')]({'plain':!![]});var _0x5612d3='MailQueues';return db[_0x4be8('0x1a')]['destroy']({'where':{'type':_0x5612d3,'resourceId':_0xa4b9b4['id']}})['then'](function(){return _0x49effa;});})[_0x4be8('0x18')](function(){_0x5119ab[_0x4be8('0xf')](0xcc)[_0x4be8('0x10')]();});}};}function handleEntityNotFound(_0x5b6427){return function(_0x4d7153){if(!_0x4d7153){_0x5b6427[_0x4be8('0xe')](0x194);}return _0x4d7153;};}function handleError(_0x360281,_0x1e7b38){_0x1e7b38=_0x1e7b38||0x1f4;return function(_0x1fbd2e){logger[_0x4be8('0x1b')](_0x1fbd2e[_0x4be8('0x1c')]);if(_0x1fbd2e[_0x4be8('0x1d')]){delete _0x1fbd2e[_0x4be8('0x1d')];}_0x360281[_0x4be8('0xf')](_0x1e7b38)['send'](_0x1fbd2e);};}exports[_0x4be8('0x1e')]=function(_0x15505a,_0x284f96){var _0x36e161={};var _0x16d0a4={'count':0x0,'rows':[]};var _0x550909=_[_0x4be8('0x1f')](db[_0x4be8('0x20')]['rawAttributes'],function(_0x5ab7c7){return{'name':_0x5ab7c7[_0x4be8('0x21')],'type':_0x5ab7c7[_0x4be8('0x22')][_0x4be8('0x23')]};});_0x36e161=qs['getOptions'](_0x550909,_0x15505a);var _0x31a69e={'where':_0x36e161['where']};return db[_0x4be8('0x20')][_0x4be8('0x15')](_0x31a69e)[_0x4be8('0x18')](function(_0x36ee85){_0x16d0a4[_0x4be8('0x15')]=_0x36ee85;_0x36e161['include']=qs[_0x4be8('0x24')](_0x15505a[_0x4be8('0x25')]);return db[_0x4be8('0x20')]['findAll'](_0x36e161);})[_0x4be8('0x18')](function(_0x268806){_0x16d0a4['rows']=_0x268806;return _0x16d0a4;})[_0x4be8('0x18')](respondWithFilteredResult(_0x284f96,_0x36e161))[_0x4be8('0x26')](handleError(_0x284f96,null));};exports[_0x4be8('0x27')]=function(_0x352ec3,_0x431efb){var _0x472aa1={'raw':!![],'where':{'id':_0x352ec3['params']['id']}},_0x3f74db={};_0x3f74db[_0x4be8('0x28')]=_[_0x4be8('0x29')](db[_0x4be8('0x20')][_0x4be8('0x2a')]);_0x3f74db[_0x4be8('0x25')]=_[_0x4be8('0x29')](_0x352ec3[_0x4be8('0x25')]);_0x3f74db[_0x4be8('0x2b')]=_['intersection'](_0x3f74db[_0x4be8('0x28')],_0x3f74db[_0x4be8('0x25')]);_0x472aa1['attributes']=_[_0x4be8('0x2c')](_0x3f74db['model'],qs[_0x4be8('0x2d')](_0x352ec3[_0x4be8('0x25')][_0x4be8('0x2d')]));_0x472aa1['attributes']=_0x472aa1[_0x4be8('0x2e')][_0x4be8('0x2f')]?_0x472aa1[_0x4be8('0x2e')]:_0x3f74db['model'];if(_0x352ec3[_0x4be8('0x25')][_0x4be8('0x30')]){_0x472aa1[_0x4be8('0x24')]=[{'all':!![]}];}_0x472aa1=_[_0x4be8('0x31')]({},_0x472aa1,_0x352ec3[_0x4be8('0x32')]);return db[_0x4be8('0x20')][_0x4be8('0x33')](_0x472aa1)[_0x4be8('0x18')](handleEntityNotFound(_0x431efb,null))[_0x4be8('0x18')](respondWithResult(_0x431efb,null))[_0x4be8('0x26')](handleError(_0x431efb,null));};exports[_0x4be8('0x34')]=function(_0x2f81d0,_0x54cd9a){return db[_0x4be8('0x20')]['create'](_0x2f81d0['body'],{})['then'](function(_0x225258){var _0x366d8d=_0x2f81d0[_0x4be8('0x35')][_0x4be8('0x19')]({'plain':!![]});if(!_0x366d8d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x366d8d['role']===_0x4be8('0x35')){var _0x3d2237=_0x225258['get']({'plain':!![]});var _0x46e38d=_0x4be8('0x36');return db[_0x4be8('0x37')][_0x4be8('0x33')]({'where':{'name':_0x46e38d,'userProfileId':_0x366d8d[_0x4be8('0x38')]},'raw':!![]})[_0x4be8('0x18')](function(_0x6c74ad){if(_0x6c74ad&&_0x6c74ad[_0x4be8('0x39')]===0x0){return db[_0x4be8('0x1a')][_0x4be8('0x34')]({'name':_0x3d2237['name'],'resourceId':_0x3d2237['id'],'type':_0x6c74ad[_0x4be8('0x1d')],'sectionId':_0x6c74ad['id']},{})[_0x4be8('0x18')](function(){return _0x225258;});}else{return _0x225258;}})[_0x4be8('0x26')](function(_0x2da1b0){logger['error'](_0x4be8('0x3a'),_0x2da1b0);throw _0x2da1b0;});}return _0x225258;})[_0x4be8('0x18')](respondWithResult(_0x54cd9a,0xc9))[_0x4be8('0x26')](handleError(_0x54cd9a,null));};exports[_0x4be8('0x3b')]=function(_0x30aaf9,_0x19930f){if(_0x30aaf9['body']['id']){delete _0x30aaf9[_0x4be8('0x3c')]['id'];}return db[_0x4be8('0x20')][_0x4be8('0x33')]({'where':{'id':_0x30aaf9['params']['id']}})[_0x4be8('0x18')](handleEntityNotFound(_0x19930f,null))[_0x4be8('0x18')](saveUpdates(_0x30aaf9['body'],null))['then'](respondWithResult(_0x19930f,null))[_0x4be8('0x26')](handleError(_0x19930f,null));};exports[_0x4be8('0x3d')]=function(_0x4590c1,_0x549e24){return db[_0x4be8('0x20')][_0x4be8('0x33')]({'where':{'id':_0x4590c1['params']['id']}})[_0x4be8('0x18')](handleEntityNotFound(_0x549e24,null))['then'](removeEntity(_0x549e24,null))[_0x4be8('0x26')](handleError(_0x549e24,null));};exports['describe']=function(_0x15e042,_0x35d849){return db[_0x4be8('0x20')][_0x4be8('0x3e')]()[_0x4be8('0x18')](respondWithResult(_0x35d849,null))['catch'](handleError(_0x35d849,null));};exports[_0x4be8('0x3f')]=function(_0x27cd1c,_0x1e8b0d){var _0x1fb781={'raw':!![],'where':{}},_0x2868f6={},_0x3e2bed;return db[_0x4be8('0x20')][_0x4be8('0x40')]({'where':{'id':_0x27cd1c[_0x4be8('0x41')]['id']}})['then'](handleEntityNotFound(_0x1e8b0d,null))[_0x4be8('0x18')](function(_0xba3d0b){if(_0xba3d0b){_0x3e2bed=_0xba3d0b[_0x4be8('0x19')]({'plain':!![]});_0x2868f6['model']=_[_0x4be8('0x29')](db[_0x4be8('0x42')]['rawAttributes']);_0x2868f6['query']=_[_0x4be8('0x29')](_0x27cd1c['query']);_0x2868f6[_0x4be8('0x2b')]=_[_0x4be8('0x2c')](_0x2868f6[_0x4be8('0x28')],_0x2868f6[_0x4be8('0x25')]);_0x1fb781[_0x4be8('0x2e')]=_[_0x4be8('0x2c')](_0x2868f6[_0x4be8('0x28')],qs[_0x4be8('0x2d')](_0x27cd1c[_0x4be8('0x25')]['fields']));_0x1fb781[_0x4be8('0x2e')]=_0x1fb781['attributes'][_0x4be8('0x2f')]?_0x1fb781[_0x4be8('0x2e')]:_0x2868f6[_0x4be8('0x28')];if(!_0x27cd1c[_0x4be8('0x25')][_0x4be8('0x43')]('nolimit')){_0x1fb781['limit']=qs[_0x4be8('0x14')](_0x27cd1c[_0x4be8('0x25')][_0x4be8('0x14')]);_0x1fb781[_0x4be8('0x12')]=qs['offset'](_0x27cd1c[_0x4be8('0x25')][_0x4be8('0x12')]);}_0x1fb781[_0x4be8('0x44')]=qs['sort'](_0x27cd1c[_0x4be8('0x25')][_0x4be8('0x45')]);_0x1fb781[_0x4be8('0x46')]=qs['filters'](_[_0x4be8('0x47')](_0x27cd1c['query'],_0x2868f6[_0x4be8('0x2b')]));_0x1fb781['where']['MailQueueId']=_0xba3d0b['id'];if(_0x27cd1c[_0x4be8('0x25')][_0x4be8('0x48')]){_0x1fb781[_0x4be8('0x46')]=_[_0x4be8('0x31')](_0x1fb781[_0x4be8('0x46')],{'$or':_['map'](_0x1fb781['attributes'],function(_0x46f640){var _0xda2940={};_0xda2940[_0x46f640]={'$like':'%'+_0x27cd1c[_0x4be8('0x25')][_0x4be8('0x48')]+'%'};return _0xda2940;})});}_0x1fb781=_['merge']({},_0x1fb781,_0x27cd1c[_0x4be8('0x32')]);return db[_0x4be8('0x42')][_0x4be8('0x49')](_0x1fb781);}})[_0x4be8('0x18')](function(_0x180c83){if(_0x180c83){return db[_0x4be8('0x4a')][_0x4be8('0x4b')]({'where':{'id':_[_0x4be8('0x1f')](_0x180c83,'UserId'),'role':_0x4be8('0x4c')},'attributes':['id',_0x4be8('0x1d'),_0x4be8('0x4d'),'updatedAt',_0x4be8('0x4e')]});}})['then'](function(_0x193187){if(_0x193187){return{'count':_0x193187[_0x4be8('0x15')],'rows':_[_0x4be8('0x1f')](_0x193187[_0x4be8('0x4f')],function(_0x46806f){return{'membername':_0x46806f[_0x4be8('0x1d')],'UserId':_0x46806f['id'],'queue_name':_0x3e2bed[_0x4be8('0x1d')],'MailQueueId':_0x3e2bed['id'],'interface':util[_0x4be8('0x50')]('%s/%s',_0x4be8('0x51'),_0x46806f[_0x4be8('0x1d')]),'penalty':0x0,'paused':_0x46806f[_0x4be8('0x4d')],'createdAt':_0x46806f['createdAt'],'updatedAt':_0x46806f[_0x4be8('0x52')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4be8('0x18')](respondWithFilteredResult(_0x1e8b0d,_0x1fb781))[_0x4be8('0x26')](handleError(_0x1e8b0d,null));};exports[_0x4be8('0x53')]=function(_0x10bf5b,_0x29f725){var _0x343964={};var _0x487f3d={};var _0x35fc87;var _0x33cd45;return db[_0x4be8('0x20')][_0x4be8('0x40')]({'where':{'id':_0x10bf5b[_0x4be8('0x41')]['id']}})[_0x4be8('0x18')](handleEntityNotFound(_0x29f725,null))[_0x4be8('0x18')](function(_0x36f8d4){if(_0x36f8d4){_0x35fc87=_0x36f8d4;_0x487f3d[_0x4be8('0x28')]=_[_0x4be8('0x29')](db[_0x4be8('0x54')][_0x4be8('0x2a')]);_0x487f3d['query']=_['keys'](_0x10bf5b[_0x4be8('0x25')]);_0x487f3d[_0x4be8('0x2b')]=_['intersection'](_0x487f3d[_0x4be8('0x28')],_0x487f3d[_0x4be8('0x25')]);_0x343964[_0x4be8('0x2e')]=_[_0x4be8('0x2c')](_0x487f3d[_0x4be8('0x28')],qs[_0x4be8('0x2d')](_0x10bf5b[_0x4be8('0x25')][_0x4be8('0x2d')]));_0x343964[_0x4be8('0x2e')]=_0x343964[_0x4be8('0x2e')][_0x4be8('0x2f')]?_0x343964[_0x4be8('0x2e')]:_0x487f3d[_0x4be8('0x28')];_0x343964['order']=qs['sort'](_0x10bf5b[_0x4be8('0x25')]['sort']);_0x343964[_0x4be8('0x46')]=qs[_0x4be8('0x2b')](_[_0x4be8('0x47')](_0x10bf5b[_0x4be8('0x25')],_0x487f3d[_0x4be8('0x2b')]));if(_0x10bf5b[_0x4be8('0x25')][_0x4be8('0x48')]){_0x343964[_0x4be8('0x46')]=_[_0x4be8('0x31')](_0x343964['where'],{'$or':_[_0x4be8('0x1f')](_0x343964[_0x4be8('0x2e')],function(_0x3d55cc){var _0x1a2147={};_0x1a2147[_0x3d55cc]={'$like':'%'+_0x10bf5b[_0x4be8('0x25')][_0x4be8('0x48')]+'%'};return _0x1a2147;})});}_0x343964=_['merge']({},_0x343964,_0x10bf5b[_0x4be8('0x32')]);return _0x35fc87[_0x4be8('0x53')](_0x343964);}})[_0x4be8('0x18')](function(_0x34d3a7){if(_0x34d3a7){_0x33cd45=_0x34d3a7[_0x4be8('0x2f')];if(!_0x10bf5b['query'][_0x4be8('0x43')]('nolimit')){_0x343964[_0x4be8('0x14')]=qs['limit'](_0x10bf5b[_0x4be8('0x25')][_0x4be8('0x14')]);_0x343964[_0x4be8('0x12')]=qs[_0x4be8('0x12')](_0x10bf5b[_0x4be8('0x25')][_0x4be8('0x12')]);}return _0x35fc87[_0x4be8('0x53')](_0x343964);}})[_0x4be8('0x18')](function(_0x3381de){if(_0x3381de){return _0x3381de?{'count':_0x33cd45,'rows':_0x3381de}:null;}})[_0x4be8('0x18')](respondWithResult(_0x29f725,null))[_0x4be8('0x26')](handleError(_0x29f725,null));};exports[_0x4be8('0x55')]=function(_0x506d16,_0x2bbbe0){var _0x2ccd49=_0x506d16[_0x4be8('0x3c')][_0x4be8('0x56')];return db[_0x4be8('0x54')]['findAll']({'where':{'id':_0x2ccd49},'attributes':['id'],'include':[{'model':db[_0x4be8('0x4a')],'as':_0x4be8('0x57'),'attributes':['id','name',_0x4be8('0x58'),_0x4be8('0x59'),'interface'],'raw':!![]}]})[_0x4be8('0x18')](function(_0x15ec86){if(_0x15ec86){var _0x2c103f=_[_0x4be8('0x5a')](_0x15ec86,function(_0x418169){var _0x43d2c1=_0x418169[_0x4be8('0x19')]({'plain':!![]});return _0x43d2c1[_0x4be8('0x57')];});return db['MailQueue']['find']({'where':{'id':_0x506d16[_0x4be8('0x41')]['id']}})[_0x4be8('0x18')](function(_0x8edf7b){return db['sequelize'][_0x4be8('0x5b')](function(_0x55631b){return _0x8edf7b['addTeams'](_0x2ccd49,{'transaction':_0x55631b})[_0x4be8('0x18')](function(){return BPromise['each'](_0x2c103f,function(_0x5811a1){return db[_0x4be8('0x42')][_0x4be8('0x5c')]({'where':{'UserId':_0x5811a1['id'],'MailQueueId':_0x506d16[_0x4be8('0x41')]['id']},'transaction':_0x55631b});});})['then'](function(){_0x2c103f[_0x4be8('0x5d')](function(_0x4c33c1){socket[_0x4be8('0x5e')](_0x4be8('0x5f'),{'UserId':_0x4c33c1['id'],'MailQueueId':_0x8edf7b['id']});});});});});}})['then'](respondWithStatusCode(_0x2bbbe0,null))[_0x4be8('0x26')](handleError(_0x2bbbe0,null));};exports['removeTeams']=function(_0x1b8496,_0x3e4631){return db[_0x4be8('0x54')][_0x4be8('0x49')]({'where':{'id':_0x1b8496[_0x4be8('0x25')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4be8('0x57'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3e4631,null))['then'](function(_0x16432e){var _0x26e61b=_[_0x4be8('0x1f')](_0x16432e,'id');var _0x337219=[];var _0x4619ff=[];var _0x11f97a=squel[_0x4be8('0x60')]();_0x11f97a[_0x4be8('0x61')](_0x4be8('0x62'))['from']('team_has_mail_queues','tq')[_0x4be8('0x63')]('user_has_teams','ut',_0x4be8('0x64'))[_0x4be8('0x46')]('MailQueueId\x20=\x20?',_0x1b8496[_0x4be8('0x41')]['id']);for(var _0x1ca488=0x0;_0x1ca488<_0x16432e[_0x4be8('0x2f')];_0x1ca488+=0x1){let _0x26b264=_0x16432e[_0x1ca488];for(var _0x25a767=0x0;_0x25a767<_0x26b264[_0x4be8('0x57')]['length'];_0x25a767+=0x1){let _0x4d00ae=_0x26b264[_0x4be8('0x57')][_0x25a767];var _0x1c903f=_0x11f97a[_0x4be8('0x65')]();_0x1c903f[_0x4be8('0x46')]('ut.UserId\x20=\x20?',_0x4d00ae['id']);_0x4619ff[_0x4be8('0x66')](db[_0x4be8('0x67')][_0x4be8('0x25')](_0x1c903f['toString'](),{'type':db[_0x4be8('0x67')][_0x4be8('0x68')][_0x4be8('0x69')]})[_0x4be8('0x18')](function(_0x88c8a9){if(_0x88c8a9[_0x4be8('0x2f')]===0x1){return _0x4d00ae['id'];}else{var _0x3de192=_[_0x4be8('0x6a')](_[_0x4be8('0x1f')](_0x88c8a9,_0x4be8('0x6b')),function(_0x21817e){return _[_0x4be8('0x6c')](_0x26e61b,_0x21817e);});if(_0x3de192){return _0x4d00ae['id'];}}}));}}return BPromise[_0x4be8('0x6d')](_0x4619ff)[_0x4be8('0x18')](function(_0x5b3d6c){_0x337219=_(_0x337219)[_0x4be8('0x6e')](_0x5b3d6c)[_0x4be8('0x6f')]()[_0x4be8('0x70')]();return db['MailQueue'][_0x4be8('0x33')]({'where':{'id':_0x1b8496[_0x4be8('0x41')]['id']}})['then'](function(_0x10ccd7){return db[_0x4be8('0x67')][_0x4be8('0x5b')](function(_0x531492){return _0x10ccd7[_0x4be8('0x71')](_0x1b8496['query']['ids'],{'transaction':_0x531492})[_0x4be8('0x18')](function(){if(!_[_0x4be8('0x72')](_0x337219)){return _0x10ccd7[_0x4be8('0x73')](_0x337219,{'transaction':_0x531492});}})[_0x4be8('0x18')](function(){_0x337219['forEach'](function(_0x4b7d0a){socket[_0x4be8('0x5e')](_0x4be8('0x74'),{'UserId':_0x4b7d0a,'MailQueueId':_0x10ccd7['id']});});});});});});})['then'](respondWithStatusCode(_0x3e4631,null))['catch'](handleError(_0x3e4631,null));};exports[_0x4be8('0x75')]=function(_0x21e2b7,_0x55ce26){return db[_0x4be8('0x20')][_0x4be8('0x33')]({'where':{'id':_0x21e2b7['params']['id']}})['then'](handleEntityNotFound(_0x55ce26,null))[_0x4be8('0x18')](function(_0xfc7d94){if(_0xfc7d94){return _0xfc7d94[_0x4be8('0x75')](_0x21e2b7[_0x4be8('0x3c')][_0x4be8('0x56')],_[_0x4be8('0x76')](_0x21e2b7[_0x4be8('0x3c')],['ids','id'])||{})[_0x4be8('0x77')](function(_0x59d6ec){for(var _0x58d790=0x0;_0x58d790<_0x21e2b7['body'][_0x4be8('0x56')]['length'];_0x58d790+=0x1){socket[_0x4be8('0x5e')](_0x4be8('0x5f'),{'UserId':Number(_0x21e2b7['body'][_0x4be8('0x56')][_0x58d790]),'MailQueueId':Number(_0x21e2b7['params']['id'])});}return _0x59d6ec;});}})['then'](respondWithResult(_0x55ce26,null))['catch'](handleError(_0x55ce26,null));};exports[_0x4be8('0x73')]=function(_0x3618a6,_0x54de29){return db['MailQueue']['find']({'where':{'id':_0x3618a6[_0x4be8('0x41')]['id']}})[_0x4be8('0x18')](handleEntityNotFound(_0x54de29,null))['then'](function(_0x61ca6c){if(_0x61ca6c){return _0x61ca6c[_0x4be8('0x73')](_0x3618a6[_0x4be8('0x25')][_0x4be8('0x56')])[_0x4be8('0x18')](function(){if(_['isArray'](_0x3618a6['query'][_0x4be8('0x56')])){for(var _0x5c9e7b=0x0;_0x5c9e7b<_0x3618a6[_0x4be8('0x25')][_0x4be8('0x56')][_0x4be8('0x2f')];_0x5c9e7b+=0x1){socket[_0x4be8('0x5e')](_0x4be8('0x74'),{'UserId':Number(_0x3618a6['query'][_0x4be8('0x56')][_0x5c9e7b]),'MailQueueId':Number(_0x3618a6['params']['id'])});}}else{socket[_0x4be8('0x5e')](_0x4be8('0x74'),{'UserId':Number(_0x3618a6[_0x4be8('0x25')][_0x4be8('0x56')]),'MailQueueId':Number(_0x3618a6[_0x4be8('0x41')]['id'])});}});}})[_0x4be8('0x18')](respondWithStatusCode(_0x54de29,null))[_0x4be8('0x26')](handleError(_0x54de29,null));};exports[_0x4be8('0x78')]=function(_0x3b17a1,_0x26918b){var _0x2a107c={};var _0x369c83={};var _0xd13677;var _0x2f2665;return db[_0x4be8('0x20')]['findOne']({'where':{'id':_0x3b17a1[_0x4be8('0x41')]['id']}})[_0x4be8('0x18')](handleEntityNotFound(_0x26918b,null))['then'](function(_0x4fccc9){if(_0x4fccc9){_0xd13677=_0x4fccc9;_0x369c83['model']=_[_0x4be8('0x29')](db[_0x4be8('0x4a')]['rawAttributes']);_0x369c83[_0x4be8('0x25')]=_['keys'](_0x3b17a1[_0x4be8('0x25')]);_0x369c83[_0x4be8('0x2b')]=_[_0x4be8('0x2c')](_0x369c83['model'],_0x369c83['query']);_0x2a107c[_0x4be8('0x2e')]=_[_0x4be8('0x2c')](_0x369c83[_0x4be8('0x28')],qs['fields'](_0x3b17a1['query'][_0x4be8('0x2d')]));_0x2a107c['attributes']=_0x2a107c[_0x4be8('0x2e')][_0x4be8('0x2f')]?_0x2a107c[_0x4be8('0x2e')]:_0x369c83[_0x4be8('0x28')];_0x2a107c[_0x4be8('0x44')]=qs['sort'](_0x3b17a1['query'][_0x4be8('0x45')]);_0x2a107c[_0x4be8('0x46')]=qs[_0x4be8('0x2b')](_[_0x4be8('0x47')](_0x3b17a1['query'],_0x369c83[_0x4be8('0x2b')]));if(_0x3b17a1[_0x4be8('0x25')]['filter']){_0x2a107c['where']=_[_0x4be8('0x31')](_0x2a107c['where'],{'$or':_[_0x4be8('0x1f')](_0x2a107c[_0x4be8('0x2e')],function(_0x3fffa7){var _0x2ccfcd={};_0x2ccfcd[_0x3fffa7]={'$like':'%'+_0x3b17a1['query'][_0x4be8('0x48')]+'%'};return _0x2ccfcd;})});}_0x2a107c=_['merge']({},_0x2a107c,_0x3b17a1[_0x4be8('0x32')]);return _0xd13677[_0x4be8('0x78')](_0x2a107c);}})[_0x4be8('0x18')](function(_0x51f446){if(_0x51f446){_0x2f2665=_0x51f446[_0x4be8('0x2f')];if(!_0x3b17a1['query'][_0x4be8('0x43')](_0x4be8('0x79'))){_0x2a107c[_0x4be8('0x14')]=qs[_0x4be8('0x14')](_0x3b17a1['query'][_0x4be8('0x14')]);_0x2a107c['offset']=qs['offset'](_0x3b17a1[_0x4be8('0x25')][_0x4be8('0x12')]);}return _0xd13677[_0x4be8('0x78')](_0x2a107c);}})[_0x4be8('0x18')](function(_0x55f1a4){if(_0x55f1a4){return _0x55f1a4?{'count':_0x2f2665,'rows':_0x55f1a4}:null;}})[_0x4be8('0x18')](respondWithResult(_0x26918b,null))['catch'](handleError(_0x26918b,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index a4efe62..2486531 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 _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 +var _0x3b71=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5a73ba,_0x35469b){var _0x7c54ad=function(_0x3146c4){while(--_0x3146c4){_0x5a73ba['push'](_0x5a73ba['shift']());}};_0x7c54ad(++_0x35469b);}(_0x3b71,0x148));var _0x13b7=function(_0x3f4f29,_0x4372a7){_0x3f4f29=_0x3f4f29-0x0;var _0x5ba522=_0x3b71[_0x3f4f29];return _0x5ba522;};'use strict';var EventEmitter=require(_0x13b7('0x0'));var MailQueue=require(_0x13b7('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x13b7('0x2')](0x0);var events={'afterCreate':_0x13b7('0x3'),'afterUpdate':_0x13b7('0x4'),'afterDestroy':_0x13b7('0x5')};function emitEvent(_0x344f20){return function(_0x4c9640,_0x54acce,_0x1398db){MailQueueEvents[_0x13b7('0x6')](_0x344f20+':'+_0x4c9640['id'],_0x4c9640);MailQueueEvents[_0x13b7('0x6')](_0x344f20,_0x4c9640);_0x1398db(null);};}for(var e in events){if(events[_0x13b7('0x7')](e)){var event=events[e];MailQueue[_0x13b7('0x8')](e,emitEvent(event));}}module[_0x13b7('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 6c37559..96528be 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 _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 +var _0x98d2=['moment','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','define','MailQueue','mail_queues','lodash','api'];(function(_0x59d3a1,_0x255155){var _0x587c3=function(_0x548152){while(--_0x548152){_0x59d3a1['push'](_0x59d3a1['shift']());}};_0x587c3(++_0x255155);}(_0x98d2,0x1b6));var _0x298d=function(_0x77773a,_0x5a7026){_0x77773a=_0x77773a-0x0;var _0x1091a2=_0x98d2[_0x77773a];return _0x1091a2;};'use strict';var _=require(_0x298d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x298d('0x1'));var moment=require(_0x298d('0x2'));var BPromise=require('bluebird');var rp=require(_0x298d('0x3'));var fs=require('fs');var path=require(_0x298d('0x4'));var rimraf=require(_0x298d('0x5'));var config=require(_0x298d('0x6'));var attributes=require(_0x298d('0x7'));module['exports']=function(_0x5b2a4b,_0x26a125){return _0x5b2a4b[_0x298d('0x8')](_0x298d('0x9'),attributes,{'tableName':_0x298d('0xa'),'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 70dd5a9..80d5657 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 _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 +var _0x4641=['raw','where','include','map','model','attributes','debug','catch','ShowMailQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./mailQueue.socket','register','then','info','MailQueue,\x20%s,\x20%s','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','GetMailQueue','MailQueue','options'];(function(_0x1477ac,_0x86a86d){var _0x4f0441=function(_0x39d618){while(--_0x39d618){_0x1477ac['push'](_0x1477ac['shift']());}};_0x4f0441(++_0x86a86d);}(_0x4641,0x185));var _0x1464=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x4641[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x1464('0x0'));var moment=require(_0x1464('0x1'));var BPromise=require(_0x1464('0x2'));var rs=require(_0x1464('0x3'));var fs=require('fs');var Redis=require(_0x1464('0x4'));var db=require(_0x1464('0x5'))['db'];var utils=require(_0x1464('0x6'));var logger=require(_0x1464('0x7'))('rpc');var config=require(_0x1464('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1464('0x9')][_0x1464('0xa')]({'port':0x232a});config[_0x1464('0xb')]=_['defaults'](config[_0x1464('0xb')],{'host':_0x1464('0xc'),'port':0x18eb});var socket=require(_0x1464('0xd'))(new Redis(config[_0x1464('0xb')]));require(_0x1464('0xe'))[_0x1464('0xf')](socket);function respondWithRpcPromise(_0x3fd1f8,_0x59dd42,_0x209018){return new BPromise(function(_0x36b90d,_0x590bd9){return client['request'](_0x3fd1f8,_0x209018)[_0x1464('0x10')](function(_0x6ef4ed){logger[_0x1464('0x11')](_0x1464('0x12'),_0x59dd42,'request\x20sent');logger['debug'](_0x1464('0x13'),_0x59dd42,'request\x20sent',JSON[_0x1464('0x14')](_0x6ef4ed));if(_0x6ef4ed[_0x1464('0x15')]){if(_0x6ef4ed[_0x1464('0x15')][_0x1464('0x16')]===0x1f4){logger[_0x1464('0x15')]('MailQueue,\x20%s,\x20%s',_0x59dd42,_0x6ef4ed[_0x1464('0x15')][_0x1464('0x17')]);return _0x590bd9(_0x6ef4ed['error']['message']);}logger[_0x1464('0x15')](_0x1464('0x12'),_0x59dd42,_0x6ef4ed['error']['message']);return _0x36b90d(_0x6ef4ed[_0x1464('0x15')][_0x1464('0x17')]);}else{logger[_0x1464('0x11')](_0x1464('0x12'),_0x59dd42,_0x1464('0x18'));_0x36b90d(_0x6ef4ed[_0x1464('0x19')][_0x1464('0x17')]);}})['catch'](function(_0x1da829){logger['error']('MailQueue,\x20%s,\x20%s',_0x59dd42,_0x1da829);_0x590bd9(_0x1da829);});});}exports[_0x1464('0x1a')]=function(_0x5e3eed){var _0x127d03=this;return new Promise(function(_0x20cd76,_0x5d88a2){return db[_0x1464('0x1b')]['findAll']({'raw':_0x5e3eed[_0x1464('0x1c')]?_0x5e3eed[_0x1464('0x1c')][_0x1464('0x1d')]===undefined?!![]:![]:!![],'where':_0x5e3eed[_0x1464('0x1c')]?_0x5e3eed['options'][_0x1464('0x1e')]||null:null,'attributes':_0x5e3eed[_0x1464('0x1c')]?_0x5e3eed[_0x1464('0x1c')]['attributes']||null:null,'limit':_0x5e3eed[_0x1464('0x1c')]?_0x5e3eed[_0x1464('0x1c')]['limit']||null:null,'include':_0x5e3eed[_0x1464('0x1c')]?_0x5e3eed[_0x1464('0x1c')][_0x1464('0x1f')]?_[_0x1464('0x20')](_0x5e3eed['options'][_0x1464('0x1f')],function(_0x2cc0cc){return{'model':db[_0x2cc0cc[_0x1464('0x21')]],'as':_0x2cc0cc['as'],'attributes':_0x2cc0cc[_0x1464('0x22')],'include':_0x2cc0cc[_0x1464('0x1f')]?_[_0x1464('0x20')](_0x2cc0cc['include'],function(_0x131d5d){return{'model':db[_0x131d5d[_0x1464('0x21')]],'as':_0x131d5d['as'],'attributes':_0x131d5d['attributes'],'include':_0x131d5d[_0x1464('0x1f')]?_[_0x1464('0x20')](_0x131d5d['include'],function(_0x5b42c6){return{'model':db[_0x5b42c6[_0x1464('0x21')]],'as':_0x5b42c6['as'],'attributes':_0x5b42c6[_0x1464('0x22')]};}):[]};}):[]};}):[]:[]})[_0x1464('0x10')](function(_0x54cec9){logger[_0x1464('0x11')](_0x1464('0x1a'),_0x5e3eed);logger[_0x1464('0x23')](_0x1464('0x1a'),_0x5e3eed,JSON[_0x1464('0x14')](_0x54cec9));_0x20cd76(_0x54cec9);})[_0x1464('0x24')](function(_0x19d281){logger[_0x1464('0x15')]('GetMailQueue',_0x19d281[_0x1464('0x17')],_0x5e3eed);_0x5d88a2(_0x127d03['error'](0x1f4,_0x19d281[_0x1464('0x17')]));});});};exports[_0x1464('0x25')]=function(_0x458ce5){var _0x524415=this;return new Promise(function(_0x29ce3e,_0x1fc7a5){return db['MailQueue']['find']({'raw':_0x458ce5[_0x1464('0x1c')]?_0x458ce5['options'][_0x1464('0x1d')]===undefined?!![]:![]:!![],'where':_0x458ce5[_0x1464('0x1c')]?_0x458ce5['options']['where']||null:null,'attributes':_0x458ce5[_0x1464('0x1c')]?_0x458ce5[_0x1464('0x1c')][_0x1464('0x22')]||null:null,'include':_0x458ce5[_0x1464('0x1c')]?_0x458ce5[_0x1464('0x1c')]['include']?_[_0x1464('0x20')](_0x458ce5[_0x1464('0x1c')][_0x1464('0x1f')],function(_0x8e44e1){return{'model':db[_0x8e44e1['model']],'as':_0x8e44e1['as'],'attributes':_0x8e44e1[_0x1464('0x22')],'include':_0x8e44e1['include']?_[_0x1464('0x20')](_0x8e44e1[_0x1464('0x1f')],function(_0x1568ac){return{'model':db[_0x1568ac['model']],'as':_0x1568ac['as'],'attributes':_0x1568ac['attributes'],'include':_0x1568ac['include']?_[_0x1464('0x20')](_0x1568ac[_0x1464('0x1f')],function(_0x4269ce){return{'model':db[_0x4269ce[_0x1464('0x21')]],'as':_0x4269ce['as'],'attributes':_0x4269ce[_0x1464('0x22')]};}):[]};}):[]};}):[]:[]})[_0x1464('0x10')](function(_0x34b9a6){logger[_0x1464('0x11')]('ShowMailQueue',_0x458ce5);logger['debug'](_0x1464('0x25'),_0x458ce5,JSON[_0x1464('0x14')](_0x34b9a6));_0x29ce3e(_0x34b9a6);})[_0x1464('0x24')](function(_0x13c411){logger[_0x1464('0x15')](_0x1464('0x25'),_0x13c411[_0x1464('0x17')],_0x458ce5);_0x1fc7a5(_0x524415[_0x1464('0x15')](0x1f4,_0x13c411[_0x1464('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 24b78a6..adbface 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 _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 +var _0xfde3=['./mailQueue.events','emit','register','mailQueue:'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0xfde3,0xe8));var _0x3fde=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xfde3[_0x17d9e3];return _0x14192d;};'use strict';var MailQueueEvents=require(_0x3fde('0x0'));var events=['save','remove','update'];function createListener(_0x3fbbc1,_0xc35bf2){return function(_0x390554){_0xc35bf2[_0x3fde('0x1')](_0x3fbbc1,_0x390554);};}function removeListener(_0x55e688,_0x288717){return function(){MailQueueEvents['removeListener'](_0x55e688,_0x288717);};}exports[_0x3fde('0x2')]=function(_0xb76889){for(var _0x49ea96=0x0,_0x43c5c2=events['length'];_0x49ea96<_0x43c5c2;_0x49ea96++){var _0x4230fa=events[_0x49ea96];var _0x222b8d=createListener(_0x3fde('0x3')+_0x4230fa,_0xb76889);MailQueueEvents['on'](_0x4230fa,_0x222b8d);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 29e6cf6..26b6907 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 _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 +var _0xd4f1=['../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','index','/describe','describe','/:id','isAuthenticated','create','put','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service'];(function(_0x18b23c,_0x313e80){var _0x52c9e5=function(_0x449a41){while(--_0x449a41){_0x18b23c['push'](_0x18b23c['shift']());}};_0x52c9e5(++_0x313e80);}(_0xd4f1,0x9a));var _0x1d4f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd4f1[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x1d4f('0x0'));var util=require(_0x1d4f('0x1'));var path=require(_0x1d4f('0x2'));var timeout=require('connect-timeout');var express=require(_0x1d4f('0x3'));var router=express['Router']();var fs_extra=require(_0x1d4f('0x4'));var auth=require(_0x1d4f('0x5'));var interaction=require(_0x1d4f('0x6'));var config=require(_0x1d4f('0x7'));var controller=require(_0x1d4f('0x8'));router[_0x1d4f('0x9')]('/',auth['isAuthenticated'](),controller[_0x1d4f('0xa')]);router['get'](_0x1d4f('0xb'),auth['isAuthenticated'](),controller[_0x1d4f('0xc')]);router[_0x1d4f('0x9')](_0x1d4f('0xd'),auth[_0x1d4f('0xe')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x1d4f('0xf')]);router[_0x1d4f('0x10')](_0x1d4f('0xd'),auth[_0x1d4f('0xe')](),controller[_0x1d4f('0x11')]);router[_0x1d4f('0x12')](_0x1d4f('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x1d4f('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 73a41eb..197b55d 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 _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 +var _0x4143=['exports','STRING','DATE','moment'];(function(_0x3e2fcf,_0x579110){var _0x497db7=function(_0x2f713d){while(--_0x2f713d){_0x3e2fcf['push'](_0x3e2fcf['shift']());}};_0x497db7(++_0x579110);}(_0x4143,0x167));var _0x3414=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x4143[_0x24237f];return _0x48298e;};'use strict';var moment=require(_0x3414('0x0'));var Sequelize=require('sequelize');module[_0x3414('0x1')]={'uniqueid':{'type':Sequelize[_0x3414('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3414('0x2')]},'joinAt':{'type':Sequelize[_0x3414('0x3')]},'leaveAt':{'type':Sequelize[_0x3414('0x3')]},'acceptAt':{'type':Sequelize[_0x3414('0x3')]},'exitAt':{'type':Sequelize[_0x3414('0x3')]},'reason':{'type':Sequelize[_0x3414('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index c4590f2..c42e5a1 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 _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 +var _0xeb3b=['destroy','error','stack','name','send','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','MailQueueReport','rawAttributes','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','Content-Range','reject','save','then'];(function(_0x53d5a0,_0xeaccfc){var _0x5836a7=function(_0x361bbf){while(--_0x361bbf){_0x53d5a0['push'](_0x53d5a0['shift']());}};_0x5836a7(++_0xeaccfc);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x2c93e2,_0x4fb5e2){_0x2c93e2=_0x2c93e2-0x0;var _0x57264e=_0xeb3b[_0x2c93e2];return _0x57264e;};'use strict';var emlformat=require(_0xbeb3('0x0'));var rimraf=require(_0xbeb3('0x1'));var zipdir=require(_0xbeb3('0x2'));var jsonpatch=require(_0xbeb3('0x3'));var rp=require(_0xbeb3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbeb3('0x5'));var util=require('util');var path=require(_0xbeb3('0x6'));var sox=require('sox');var csv=require(_0xbeb3('0x7'));var ejs=require(_0xbeb3('0x8'));var fs=require('fs');var fs_extra=require(_0xbeb3('0x9'));var _=require(_0xbeb3('0xa'));var squel=require(_0xbeb3('0xb'));var crypto=require(_0xbeb3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbeb3('0xd'));var toCsv=require(_0xbeb3('0x7'));var querystring=require(_0xbeb3('0xe'));var Papa=require(_0xbeb3('0xf'));var Redis=require(_0xbeb3('0x10'));var authService=require(_0xbeb3('0x11'));var qs=require(_0xbeb3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbeb3('0x13'));var logger=require(_0xbeb3('0x14'))('api');var utils=require(_0xbeb3('0x15'));var config=require(_0xbeb3('0x16'));var licenseUtil=require(_0xbeb3('0x17'));var db=require(_0xbeb3('0x18'))['db'];function respondWithStatusCode(_0x19868e,_0x313296){_0x313296=_0x313296||0xcc;return function(_0x5b9ace){if(_0x5b9ace){return _0x19868e['sendStatus'](_0x313296);}return _0x19868e[_0xbeb3('0x19')](_0x313296)[_0xbeb3('0x1a')]();};}function respondWithResult(_0x5f521b,_0x4dfb28){_0x4dfb28=_0x4dfb28||0xc8;return function(_0xed9879){if(_0xed9879){return _0x5f521b[_0xbeb3('0x19')](_0x4dfb28)[_0xbeb3('0x1b')](_0xed9879);}};}function respondWithFilteredResult(_0x43d58a,_0x26daf2){return function(_0x535836){if(_0x535836){var _0x1aeaee=typeof _0x26daf2['offset']===_0xbeb3('0x1c')&&typeof _0x26daf2['limit']==='undefined';var _0x4f8481=_0x535836[_0xbeb3('0x1d')];var _0x44a4bb=_0x1aeaee?0x0:_0x26daf2[_0xbeb3('0x1e')];var _0x10b15d=_0x1aeaee?_0x535836['count']:_0x26daf2[_0xbeb3('0x1e')]+_0x26daf2[_0xbeb3('0x1f')];var _0xe2cc47;if(_0x10b15d>=_0x4f8481){_0x10b15d=_0x4f8481;_0xe2cc47=0xc8;}else{_0xe2cc47=0xce;}_0x43d58a['status'](_0xe2cc47);return _0x43d58a['set'](_0xbeb3('0x20'),_0x44a4bb+'-'+_0x10b15d+'/'+_0x4f8481)['json'](_0x535836);}return null;};}function patchUpdates(_0x1d917b){return function(_0x50b005){try{jsonpatch['apply'](_0x50b005,_0x1d917b,!![]);}catch(_0xfa2736){return BPromise[_0xbeb3('0x21')](_0xfa2736);}return _0x50b005[_0xbeb3('0x22')]();};}function saveUpdates(_0x4bd89e,_0x301899){return function(_0x18ea0f){if(_0x18ea0f){return _0x18ea0f['update'](_0x4bd89e)[_0xbeb3('0x23')](function(_0x366bdb){return _0x366bdb;});}return null;};}function removeEntity(_0x55a59d,_0xfc384a){return function(_0x278fe4){if(_0x278fe4){return _0x278fe4[_0xbeb3('0x24')]()[_0xbeb3('0x23')](function(){_0x55a59d[_0xbeb3('0x19')](0xcc)[_0xbeb3('0x1a')]();});}};}function handleEntityNotFound(_0x84921a,_0x340581){return function(_0x46fe17){if(!_0x46fe17){_0x84921a['sendStatus'](0x194);}return _0x46fe17;};}function handleError(_0x4e695e,_0x1f36b9){_0x1f36b9=_0x1f36b9||0x1f4;return function(_0x520116){logger[_0xbeb3('0x25')](_0x520116[_0xbeb3('0x26')]);if(_0x520116[_0xbeb3('0x27')]){delete _0x520116[_0xbeb3('0x27')];}_0x4e695e['status'](_0x1f36b9)[_0xbeb3('0x28')](_0x520116);};}exports['index']=function(_0x26cd8f,_0xab301c){var _0x5bd93d={},_0x483198={},_0x9b8f13={'count':0x0,'rows':[]};var _0x585c6f=_['map'](db['MailQueueReport']['rawAttributes'],function(_0xf5dbaf){return{'name':_0xf5dbaf['fieldName'],'type':_0xf5dbaf[_0xbeb3('0x29')][_0xbeb3('0x2a')]};});_0x483198[_0xbeb3('0x2b')]=_[_0xbeb3('0x2c')](_0x585c6f,_0xbeb3('0x27'));_0x483198[_0xbeb3('0x2d')]=_[_0xbeb3('0x2e')](_0x26cd8f[_0xbeb3('0x2d')]);_0x483198[_0xbeb3('0x2f')]=_[_0xbeb3('0x30')](_0x483198['model'],_0x483198[_0xbeb3('0x2d')]);_0x5bd93d[_0xbeb3('0x31')]=_['intersection'](_0x483198[_0xbeb3('0x2b')],qs[_0xbeb3('0x32')](_0x26cd8f[_0xbeb3('0x2d')][_0xbeb3('0x32')]));_0x5bd93d['attributes']=_0x5bd93d[_0xbeb3('0x31')][_0xbeb3('0x33')]?_0x5bd93d[_0xbeb3('0x31')]:_0x483198[_0xbeb3('0x2b')];if(!_0x26cd8f[_0xbeb3('0x2d')][_0xbeb3('0x34')](_0xbeb3('0x35'))){_0x5bd93d[_0xbeb3('0x1f')]=qs[_0xbeb3('0x1f')](_0x26cd8f['query'][_0xbeb3('0x1f')]);_0x5bd93d['offset']=qs[_0xbeb3('0x1e')](_0x26cd8f[_0xbeb3('0x2d')][_0xbeb3('0x1e')]);}_0x5bd93d[_0xbeb3('0x36')]=qs[_0xbeb3('0x37')](_0x26cd8f[_0xbeb3('0x2d')][_0xbeb3('0x37')]);_0x5bd93d[_0xbeb3('0x38')]=qs['filters'](_[_0xbeb3('0x39')](_0x26cd8f['query'],_0x483198['filters']),_0x585c6f);if(_0x26cd8f['query'][_0xbeb3('0x3a')]){_0x5bd93d[_0xbeb3('0x38')]=_[_0xbeb3('0x3b')](_0x5bd93d[_0xbeb3('0x38')],{'$or':_[_0xbeb3('0x2c')](_0x585c6f,function(_0x40f166){if(_0x40f166['type']!==_0xbeb3('0x3c')){var _0x40de8d={};_0x40de8d[_0x40f166[_0xbeb3('0x27')]]={'$like':'%'+_0x26cd8f['query']['filter']+'%'};return _0x40de8d;}})});}_0x5bd93d=_['merge']({},_0x5bd93d,_0x26cd8f[_0xbeb3('0x3d')]);var _0x2a8860={'where':_0x5bd93d[_0xbeb3('0x38')]};return db['MailQueueReport'][_0xbeb3('0x1d')](_0x2a8860)['then'](function(_0x1b6700){_0x9b8f13[_0xbeb3('0x1d')]=_0x1b6700;if(_0x26cd8f[_0xbeb3('0x2d')][_0xbeb3('0x3e')]){_0x5bd93d['include']=[{'all':!![]}];}return db['MailQueueReport'][_0xbeb3('0x3f')](_0x5bd93d);})[_0xbeb3('0x23')](function(_0x3d4262){_0x9b8f13[_0xbeb3('0x40')]=_0x3d4262;return _0x9b8f13;})[_0xbeb3('0x23')](respondWithFilteredResult(_0xab301c,_0x5bd93d))[_0xbeb3('0x41')](handleError(_0xab301c,null));};exports[_0xbeb3('0x42')]=function(_0x4606a6,_0x5758c6){var _0xfcb57f={'raw':!![],'where':{'id':_0x4606a6[_0xbeb3('0x43')]['id']}},_0x39f2d2={};_0x39f2d2[_0xbeb3('0x2b')]=_[_0xbeb3('0x2e')](db[_0xbeb3('0x44')][_0xbeb3('0x45')]);_0x39f2d2['query']=_[_0xbeb3('0x2e')](_0x4606a6[_0xbeb3('0x2d')]);_0x39f2d2[_0xbeb3('0x2f')]=_[_0xbeb3('0x30')](_0x39f2d2[_0xbeb3('0x2b')],_0x39f2d2[_0xbeb3('0x2d')]);_0xfcb57f[_0xbeb3('0x31')]=_[_0xbeb3('0x30')](_0x39f2d2[_0xbeb3('0x2b')],qs[_0xbeb3('0x32')](_0x4606a6[_0xbeb3('0x2d')][_0xbeb3('0x32')]));_0xfcb57f[_0xbeb3('0x31')]=_0xfcb57f['attributes'][_0xbeb3('0x33')]?_0xfcb57f[_0xbeb3('0x31')]:_0x39f2d2[_0xbeb3('0x2b')];if(_0x4606a6['query']['includeAll']){_0xfcb57f[_0xbeb3('0x46')]=[{'all':!![]}];}_0xfcb57f=_[_0xbeb3('0x3b')]({},_0xfcb57f,_0x4606a6[_0xbeb3('0x3d')]);return db[_0xbeb3('0x44')]['find'](_0xfcb57f)[_0xbeb3('0x23')](handleEntityNotFound(_0x5758c6,null))['then'](respondWithResult(_0x5758c6,null))['catch'](handleError(_0x5758c6,null));};exports[_0xbeb3('0x47')]=function(_0x393e60,_0x1ff297){return db[_0xbeb3('0x44')]['create'](_0x393e60[_0xbeb3('0x48')],{})[_0xbeb3('0x23')](respondWithResult(_0x1ff297,0xc9))[_0xbeb3('0x41')](handleError(_0x1ff297,null));};exports['update']=function(_0x3f93ab,_0x58c49f){if(_0x3f93ab['body']['id']){delete _0x3f93ab[_0xbeb3('0x48')]['id'];}return db[_0xbeb3('0x44')][_0xbeb3('0x49')]({'where':{'id':_0x3f93ab['params']['id']}})[_0xbeb3('0x23')](handleEntityNotFound(_0x58c49f,null))[_0xbeb3('0x23')](saveUpdates(_0x3f93ab[_0xbeb3('0x48')],null))['then'](respondWithResult(_0x58c49f,null))[_0xbeb3('0x41')](handleError(_0x58c49f,null));};exports['destroy']=function(_0x39605b,_0x4d8e21){return db[_0xbeb3('0x44')][_0xbeb3('0x49')]({'where':{'id':_0x39605b[_0xbeb3('0x43')]['id']}})[_0xbeb3('0x23')](handleEntityNotFound(_0x4d8e21,null))[_0xbeb3('0x23')](removeEntity(_0x4d8e21,null))[_0xbeb3('0x41')](handleError(_0x4d8e21,null));};exports[_0xbeb3('0x4a')]=function(_0x168434,_0x49fded){return db[_0xbeb3('0x44')][_0xbeb3('0x4a')]()[_0xbeb3('0x23')](respondWithResult(_0x49fded,null))[_0xbeb3('0x41')](handleError(_0x49fded,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index e763176..9d67dc2 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 _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 +var _0xbebd=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','uniqueid','lodash','util'];(function(_0x5b4e7a,_0x2431a5){var _0x406ce6=function(_0x532bca){while(--_0x532bca){_0x5b4e7a['push'](_0x5b4e7a['shift']());}};_0x406ce6(++_0x2431a5);}(_0xbebd,0x1ab));var _0xdbeb=function(_0x555b4c,_0x299303){_0x555b4c=_0x555b4c-0x0;var _0x16d5fc=_0xbebd[_0x555b4c];return _0x16d5fc;};'use strict';var _=require(_0xdbeb('0x0'));var util=require(_0xdbeb('0x1'));var logger=require('../../config/logger')(_0xdbeb('0x2'));var moment=require(_0xdbeb('0x3'));var BPromise=require(_0xdbeb('0x4'));var rp=require(_0xdbeb('0x5'));var fs=require('fs');var path=require(_0xdbeb('0x6'));var rimraf=require(_0xdbeb('0x7'));var config=require(_0xdbeb('0x8'));var attributes=require(_0xdbeb('0x9'));module['exports']=function(_0x463b34,_0x21adb5){return _0x463b34[_0xdbeb('0xa')](_0xdbeb('0xb'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xdbeb('0xc'),'fields':[_0xdbeb('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 f6d3ec8..4d4e1fb 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 _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 +var _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x334701,_0x8e563f){var _0x36fd03=function(_0x103ade){while(--_0x103ade){_0x334701['push'](_0x334701['shift']());}};_0x36fd03(++_0x8e563f);}(_0xadb5,0xad));var _0x5adb=function(_0x5b0444,_0x16eafb){_0x5b0444=_0x5b0444-0x0;var _0x51a305=_0xadb5[_0x5b0444];return _0x51a305;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailQueueReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index ad86aeb..4491108 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 _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 +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1ce3db,_0x17418b){var _0x1416d3=function(_0x14306d){while(--_0x14306d){_0x1ce3db['push'](_0x1ce3db['shift']());}};_0x1416d3(++_0x17418b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1aed80,_0x3ca6f6){_0x1aed80=_0x1aed80-0x0;var _0x43961e=_0xcb91[_0x1aed80];return _0x43961e;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index b1d86fe..1156f9a 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 _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 +var _0x194b=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x5400b,_0x55943a){var _0x36a39b=function(_0x56963c){while(--_0x56963c){_0x5400b['push'](_0x5400b['shift']());}};_0x36a39b(++_0x55943a);}(_0x194b,0x14f));var _0xb194=function(_0x503e79,_0x12f2d5){_0x503e79=_0x503e79-0x0;var _0x509aab=_0x194b[_0x503e79];return _0x509aab;};'use strict';var Sequelize=require(_0xb194('0x0'));module[_0xb194('0x1')]={'description':{'type':Sequelize[_0xb194('0x2')]},'host':{'type':Sequelize[_0xb194('0x2')]},'authentication':{'type':Sequelize[_0xb194('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xb194('0x2')]},'password':{'type':Sequelize[_0xb194('0x2')]},'port':{'type':Sequelize[_0xb194('0x4')]},'tls':{'type':Sequelize[_0xb194('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xb194('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xb194('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xb194('0x2')]},'modernAuthentication':{'type':Sequelize[_0xb194('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 110cdfa..609eb16 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 _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 +var _0x7a53=['mail_servers_in','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define'];(function(_0x37c2ff,_0x5080ba){var _0x23322f=function(_0x3f5f13){while(--_0x3f5f13){_0x37c2ff['push'](_0x37c2ff['shift']());}};_0x23322f(++_0x5080ba);}(_0x7a53,0x169));var _0x37a5=function(_0x2414fa,_0x4697d2){_0x2414fa=_0x2414fa-0x0;var _0x5d4452=_0x7a53[_0x2414fa];return _0x5d4452;};'use strict';var _=require('lodash');var util=require(_0x37a5('0x0'));var logger=require(_0x37a5('0x1'))(_0x37a5('0x2'));var moment=require('moment');var BPromise=require(_0x37a5('0x3'));var rp=require(_0x37a5('0x4'));var fs=require('fs');var path=require(_0x37a5('0x5'));var rimraf=require(_0x37a5('0x6'));var config=require(_0x37a5('0x7'));var attributes=require(_0x37a5('0x8'));module[_0x37a5('0x9')]=function(_0x2f61d8,_0x2dedeb){return _0x2f61d8[_0x37a5('0xa')]('MailServerIn',attributes,{'tableName':_0x37a5('0xb'),'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 2620f45..b52d376 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 _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 +var _0x38e7=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','error','message','catch','GetMailServerIn','MailServerIn','findAll','options','where','attributes','limit','include','map','model','debug','stringify','lodash','util','moment','bluebird','randomstring'];(function(_0x18c7db,_0x2d19f7){var _0x42847d=function(_0x48602d){while(--_0x48602d){_0x18c7db['push'](_0x18c7db['shift']());}};_0x42847d(++_0x2d19f7);}(_0x38e7,0x1eb));var _0x738e=function(_0x15ec4e,_0x40b7e0){_0x15ec4e=_0x15ec4e-0x0;var _0xb5e5dd=_0x38e7[_0x15ec4e];return _0xb5e5dd;};'use strict';var _=require(_0x738e('0x0'));var util=require(_0x738e('0x1'));var moment=require(_0x738e('0x2'));var BPromise=require(_0x738e('0x3'));var rs=require(_0x738e('0x4'));var fs=require('fs');var Redis=require(_0x738e('0x5'));var db=require(_0x738e('0x6'))['db'];var utils=require(_0x738e('0x7'));var logger=require(_0x738e('0x8'))(_0x738e('0x9'));var config=require(_0x738e('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x282b59,_0x35db07,_0x26c0a7){return new BPromise(function(_0x287d50,_0x160926){return client[_0x738e('0xb')](_0x282b59,_0x26c0a7)[_0x738e('0xc')](function(_0x36f796){logger[_0x738e('0xd')](_0x738e('0xe'),_0x35db07,_0x738e('0xf'));logger['debug']('MailServerIn,\x20%s,\x20%s,\x20%s',_0x35db07,_0x738e('0xf'),JSON['stringify'](_0x36f796));if(_0x36f796[_0x738e('0x10')]){if(_0x36f796[_0x738e('0x10')]['code']===0x1f4){logger[_0x738e('0x10')]('MailServerIn,\x20%s,\x20%s',_0x35db07,_0x36f796[_0x738e('0x10')][_0x738e('0x11')]);return _0x160926(_0x36f796[_0x738e('0x10')][_0x738e('0x11')]);}logger[_0x738e('0x10')](_0x738e('0xe'),_0x35db07,_0x36f796['error'][_0x738e('0x11')]);return _0x287d50(_0x36f796[_0x738e('0x10')][_0x738e('0x11')]);}else{logger[_0x738e('0xd')](_0x738e('0xe'),_0x35db07,_0x738e('0xf'));_0x287d50(_0x36f796['result'][_0x738e('0x11')]);}})[_0x738e('0x12')](function(_0x4d0651){logger[_0x738e('0x10')]('MailServerIn,\x20%s,\x20%s',_0x35db07,_0x4d0651);_0x160926(_0x4d0651);});});}exports[_0x738e('0x13')]=function(_0x3add89){var _0x4618a4=this;return new Promise(function(_0x130bc5,_0x2b9eab){return db[_0x738e('0x14')][_0x738e('0x15')]({'raw':_0x3add89['options']?_0x3add89[_0x738e('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3add89[_0x738e('0x16')]?_0x3add89[_0x738e('0x16')][_0x738e('0x17')]||null:null,'attributes':_0x3add89['options']?_0x3add89[_0x738e('0x16')][_0x738e('0x18')]||null:null,'limit':_0x3add89[_0x738e('0x16')]?_0x3add89[_0x738e('0x16')][_0x738e('0x19')]||null:null,'include':_0x3add89[_0x738e('0x16')]?_0x3add89[_0x738e('0x16')][_0x738e('0x1a')]?_[_0x738e('0x1b')](_0x3add89['options'][_0x738e('0x1a')],function(_0x609ed6){return{'model':db[_0x609ed6[_0x738e('0x1c')]],'as':_0x609ed6['as'],'attributes':_0x609ed6['attributes'],'include':_0x609ed6[_0x738e('0x1a')]?_[_0x738e('0x1b')](_0x609ed6['include'],function(_0x275850){return{'model':db[_0x275850['model']],'as':_0x275850['as'],'attributes':_0x275850['attributes'],'include':_0x275850[_0x738e('0x1a')]?_[_0x738e('0x1b')](_0x275850[_0x738e('0x1a')],function(_0x54e0bf){return{'model':db[_0x54e0bf['model']],'as':_0x54e0bf['as'],'attributes':_0x54e0bf[_0x738e('0x18')]};}):[]};}):[]};}):[]:[]})[_0x738e('0xc')](function(_0x3b4a25){logger[_0x738e('0xd')](_0x738e('0x13'),_0x3add89);logger[_0x738e('0x1d')](_0x738e('0x13'),_0x3add89,JSON[_0x738e('0x1e')](_0x3b4a25));_0x130bc5(_0x3b4a25);})[_0x738e('0x12')](function(_0x129fcb){logger[_0x738e('0x10')](_0x738e('0x13'),_0x129fcb[_0x738e('0x11')],_0x3add89);_0x2b9eab(_0x4618a4[_0x738e('0x10')](0x1f4,_0x129fcb[_0x738e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 4c4dc48..dec9a86 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_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 +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(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x7a54,0x106));var _0x47a5=function(_0x808165,_0x5e44b7){_0x808165=_0x808165-0x0;var _0x8387c6=_0x7a54[_0x808165];return _0x8387c6;};'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 b01b0e0..c0daf3b 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 _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 +var _0x373d=['STRING','BOOLEAN','sequelize'];(function(_0x8f270,_0x2f435f){var _0x5446cb=function(_0x6b3be8){while(--_0x6b3be8){_0x8f270['push'](_0x8f270['shift']());}};_0x5446cb(++_0x2f435f);}(_0x373d,0x1e2));var _0xd373=function(_0x17d314,_0x4c6cc8){_0x17d314=_0x17d314-0x0;var _0x58e7d3=_0x373d[_0x17d314];return _0x58e7d3;};'use strict';var Sequelize=require(_0xd373('0x0'));module['exports']={'description':{'type':Sequelize[_0xd373('0x1')]},'host':{'type':Sequelize[_0xd373('0x1')]},'user':{'type':Sequelize[_0xd373('0x1')]},'pass':{'type':Sequelize[_0xd373('0x1')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xd373('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0xd373('0x1')]},'authentication':{'type':Sequelize[_0xd373('0x2')],'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 6bfb227..d61daba 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 _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 +var _0x4e6c=['set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','MailServerOut','include','rows','catch','show','keys','includeAll','options','find','create','body','update','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count'];(function(_0x5f2b0a,_0x2f4569){var _0x4b5157=function(_0x2ea975){while(--_0x2ea975){_0x5f2b0a['push'](_0x5f2b0a['shift']());}};_0x4b5157(++_0x2f4569);}(_0x4e6c,0xc3));var _0xc4e6=function(_0x376fb7,_0x5b0cbe){_0x376fb7=_0x376fb7-0x0;var _0x3bfeb8=_0x4e6c[_0x376fb7];return _0x3bfeb8;};'use strict';var emlformat=require(_0xc4e6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc4e6('0x1'));var jsonpatch=require(_0xc4e6('0x2'));var rp=require(_0xc4e6('0x3'));var moment=require(_0xc4e6('0x4'));var BPromise=require(_0xc4e6('0x5'));var Mustache=require(_0xc4e6('0x6'));var util=require('util');var path=require(_0xc4e6('0x7'));var sox=require(_0xc4e6('0x8'));var csv=require('to-csv');var ejs=require(_0xc4e6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc4e6('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc4e6('0xb'));var deskjs=require(_0xc4e6('0xc'));var toCsv=require(_0xc4e6('0xd'));var querystring=require(_0xc4e6('0xe'));var Papa=require(_0xc4e6('0xf'));var Redis=require(_0xc4e6('0x10'));var authService=require(_0xc4e6('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc4e6('0x12'));var logger=require(_0xc4e6('0x13'))(_0xc4e6('0x14'));var utils=require(_0xc4e6('0x15'));var config=require(_0xc4e6('0x16'));var licenseUtil=require(_0xc4e6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f7320,_0x2dbeda){_0x2dbeda=_0x2dbeda||0xcc;return function(_0x2eb83b){if(_0x2eb83b){return _0x1f7320['sendStatus'](_0x2dbeda);}return _0x1f7320[_0xc4e6('0x18')](_0x2dbeda)[_0xc4e6('0x19')]();};}function respondWithResult(_0x4d4ee1,_0x5282f2){_0x5282f2=_0x5282f2||0xc8;return function(_0x177f28){if(_0x177f28){return _0x4d4ee1[_0xc4e6('0x18')](_0x5282f2)[_0xc4e6('0x1a')](_0x177f28);}};}function respondWithFilteredResult(_0x4c8c68,_0x45dceb){return function(_0x2600be){if(_0x2600be){var _0x41412b=typeof _0x45dceb[_0xc4e6('0x1b')]===_0xc4e6('0x1c')&&typeof _0x45dceb['limit']===_0xc4e6('0x1c');var _0x327747=_0x2600be[_0xc4e6('0x1d')];var _0x7795e5=_0x41412b?0x0:_0x45dceb[_0xc4e6('0x1b')];var _0x490f06=_0x41412b?_0x2600be[_0xc4e6('0x1d')]:_0x45dceb[_0xc4e6('0x1b')]+_0x45dceb['limit'];var _0x5e7678;if(_0x490f06>=_0x327747){_0x490f06=_0x327747;_0x5e7678=0xc8;}else{_0x5e7678=0xce;}_0x4c8c68[_0xc4e6('0x18')](_0x5e7678);return _0x4c8c68[_0xc4e6('0x1e')](_0xc4e6('0x1f'),_0x7795e5+'-'+_0x490f06+'/'+_0x327747)[_0xc4e6('0x1a')](_0x2600be);}return null;};}function patchUpdates(_0x56c732){return function(_0x351d7b){try{jsonpatch['apply'](_0x351d7b,_0x56c732,!![]);}catch(_0x3b6198){return BPromise[_0xc4e6('0x20')](_0x3b6198);}return _0x351d7b[_0xc4e6('0x21')]();};}function saveUpdates(_0x1b3d13,_0x155485){return function(_0x3cebea){if(_0x3cebea){return _0x3cebea['update'](_0x1b3d13)[_0xc4e6('0x22')](function(_0x440e7a){return _0x440e7a;});}return null;};}function removeEntity(_0x2e25b8,_0x21fc0c){return function(_0x587495){if(_0x587495){return _0x587495[_0xc4e6('0x23')]()[_0xc4e6('0x22')](function(){_0x2e25b8[_0xc4e6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39e86b,_0x40a64d){return function(_0x3802ee){if(!_0x3802ee){_0x39e86b['sendStatus'](0x194);}return _0x3802ee;};}function handleError(_0xebae20,_0x460b70){_0x460b70=_0x460b70||0x1f4;return function(_0x2d1f53){logger[_0xc4e6('0x24')](_0x2d1f53[_0xc4e6('0x25')]);if(_0x2d1f53[_0xc4e6('0x26')]){delete _0x2d1f53[_0xc4e6('0x26')];}_0xebae20[_0xc4e6('0x18')](_0x460b70)[_0xc4e6('0x27')](_0x2d1f53);};}exports[_0xc4e6('0x28')]=function(_0x4fb590,_0xe4bf53){var _0x2563c7={},_0x393b6f={},_0x445eda={'count':0x0,'rows':[]};var _0x1559fa=_[_0xc4e6('0x29')](db['MailServerOut'][_0xc4e6('0x2a')],function(_0x15af38){return{'name':_0x15af38[_0xc4e6('0x2b')],'type':_0x15af38[_0xc4e6('0x2c')][_0xc4e6('0x2d')]};});_0x393b6f[_0xc4e6('0x2e')]=_[_0xc4e6('0x29')](_0x1559fa,_0xc4e6('0x26'));_0x393b6f['query']=_['keys'](_0x4fb590[_0xc4e6('0x2f')]);_0x393b6f[_0xc4e6('0x30')]=_[_0xc4e6('0x31')](_0x393b6f[_0xc4e6('0x2e')],_0x393b6f[_0xc4e6('0x2f')]);_0x2563c7[_0xc4e6('0x32')]=_[_0xc4e6('0x31')](_0x393b6f[_0xc4e6('0x2e')],qs[_0xc4e6('0x33')](_0x4fb590[_0xc4e6('0x2f')][_0xc4e6('0x33')]));_0x2563c7[_0xc4e6('0x32')]=_0x2563c7['attributes'][_0xc4e6('0x34')]?_0x2563c7[_0xc4e6('0x32')]:_0x393b6f[_0xc4e6('0x2e')];if(!_0x4fb590[_0xc4e6('0x2f')]['hasOwnProperty'](_0xc4e6('0x35'))){_0x2563c7['limit']=qs['limit'](_0x4fb590[_0xc4e6('0x2f')][_0xc4e6('0x36')]);_0x2563c7['offset']=qs['offset'](_0x4fb590[_0xc4e6('0x2f')][_0xc4e6('0x1b')]);}_0x2563c7[_0xc4e6('0x37')]=qs[_0xc4e6('0x38')](_0x4fb590[_0xc4e6('0x2f')][_0xc4e6('0x38')]);_0x2563c7[_0xc4e6('0x39')]=qs[_0xc4e6('0x30')](_[_0xc4e6('0x3a')](_0x4fb590[_0xc4e6('0x2f')],_0x393b6f[_0xc4e6('0x30')]),_0x1559fa);if(_0x4fb590[_0xc4e6('0x2f')][_0xc4e6('0x3b')]){_0x2563c7[_0xc4e6('0x39')]=_[_0xc4e6('0x3c')](_0x2563c7[_0xc4e6('0x39')],{'$or':_[_0xc4e6('0x29')](_0x1559fa,function(_0x14ea0a){if(_0x14ea0a['type']!==_0xc4e6('0x3d')){var _0x491f8d={};_0x491f8d[_0x14ea0a[_0xc4e6('0x26')]]={'$like':'%'+_0x4fb590[_0xc4e6('0x2f')][_0xc4e6('0x3b')]+'%'};return _0x491f8d;}})});}_0x2563c7=_[_0xc4e6('0x3c')]({},_0x2563c7,_0x4fb590['options']);var _0x928b5f={'where':_0x2563c7[_0xc4e6('0x39')]};return db[_0xc4e6('0x3e')][_0xc4e6('0x1d')](_0x928b5f)[_0xc4e6('0x22')](function(_0x3c3336){_0x445eda['count']=_0x3c3336;if(_0x4fb590[_0xc4e6('0x2f')]['includeAll']){_0x2563c7[_0xc4e6('0x3f')]=[{'all':!![]}];}return db[_0xc4e6('0x3e')]['findAll'](_0x2563c7);})[_0xc4e6('0x22')](function(_0x259c13){_0x445eda[_0xc4e6('0x40')]=_0x259c13;return _0x445eda;})[_0xc4e6('0x22')](respondWithFilteredResult(_0xe4bf53,_0x2563c7))[_0xc4e6('0x41')](handleError(_0xe4bf53,null));};exports[_0xc4e6('0x42')]=function(_0xadde92,_0x59228a){var _0xe801fd={'raw':!![],'where':{'id':_0xadde92['params']['id']}},_0x534ad5={};_0x534ad5[_0xc4e6('0x2e')]=_[_0xc4e6('0x43')](db['MailServerOut'][_0xc4e6('0x2a')]);_0x534ad5[_0xc4e6('0x2f')]=_[_0xc4e6('0x43')](_0xadde92['query']);_0x534ad5[_0xc4e6('0x30')]=_[_0xc4e6('0x31')](_0x534ad5[_0xc4e6('0x2e')],_0x534ad5[_0xc4e6('0x2f')]);_0xe801fd[_0xc4e6('0x32')]=_[_0xc4e6('0x31')](_0x534ad5[_0xc4e6('0x2e')],qs[_0xc4e6('0x33')](_0xadde92[_0xc4e6('0x2f')][_0xc4e6('0x33')]));_0xe801fd[_0xc4e6('0x32')]=_0xe801fd[_0xc4e6('0x32')][_0xc4e6('0x34')]?_0xe801fd[_0xc4e6('0x32')]:_0x534ad5[_0xc4e6('0x2e')];if(_0xadde92['query'][_0xc4e6('0x44')]){_0xe801fd[_0xc4e6('0x3f')]=[{'all':!![]}];}_0xe801fd=_[_0xc4e6('0x3c')]({},_0xe801fd,_0xadde92[_0xc4e6('0x45')]);return db[_0xc4e6('0x3e')][_0xc4e6('0x46')](_0xe801fd)[_0xc4e6('0x22')](handleEntityNotFound(_0x59228a,null))[_0xc4e6('0x22')](respondWithResult(_0x59228a,null))[_0xc4e6('0x41')](handleError(_0x59228a,null));};exports[_0xc4e6('0x47')]=function(_0x100e56,_0x3bede1){return db[_0xc4e6('0x3e')][_0xc4e6('0x47')](_0x100e56[_0xc4e6('0x48')],{})[_0xc4e6('0x22')](respondWithResult(_0x3bede1,0xc9))['catch'](handleError(_0x3bede1,null));};exports[_0xc4e6('0x49')]=function(_0x5aac57,_0x167631){if(_0x5aac57[_0xc4e6('0x48')]['id']){delete _0x5aac57['body']['id'];}return db['MailServerOut']['find']({'where':{'id':_0x5aac57['params']['id']}})[_0xc4e6('0x22')](handleEntityNotFound(_0x167631,null))['then'](saveUpdates(_0x5aac57['body'],null))[_0xc4e6('0x22')](respondWithResult(_0x167631,null))[_0xc4e6('0x41')](handleError(_0x167631,null));};exports[_0xc4e6('0x23')]=function(_0x478b02,_0x575398){return db['MailServerOut'][_0xc4e6('0x46')]({'where':{'id':_0x478b02[_0xc4e6('0x4a')]['id']}})[_0xc4e6('0x22')](handleEntityNotFound(_0x575398,null))[_0xc4e6('0x22')](removeEntity(_0x575398,null))[_0xc4e6('0x41')](handleError(_0x575398,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index e321cfa..9394064 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 _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 +var _0x9076=['mail_servers_out','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailServerOut.attributes','exports','MailServerOut'];(function(_0x53cada,_0x1627bc){var _0x48a99e=function(_0x3a1d0f){while(--_0x3a1d0f){_0x53cada['push'](_0x53cada['shift']());}};_0x48a99e(++_0x1627bc);}(_0x9076,0x1d5));var _0x6907=function(_0x218ab0,_0x165282){_0x218ab0=_0x218ab0-0x0;var _0x27ec8e=_0x9076[_0x218ab0];return _0x27ec8e;};'use strict';var _=require(_0x6907('0x0'));var util=require(_0x6907('0x1'));var logger=require(_0x6907('0x2'))(_0x6907('0x3'));var moment=require(_0x6907('0x4'));var BPromise=require(_0x6907('0x5'));var rp=require(_0x6907('0x6'));var fs=require('fs');var path=require(_0x6907('0x7'));var rimraf=require(_0x6907('0x8'));var config=require('../../config/environment');var attributes=require(_0x6907('0x9'));module[_0x6907('0xa')]=function(_0xb01168,_0x5c8309){return _0xb01168['define'](_0x6907('0xb'),attributes,{'tableName':_0x6907('0xc'),'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 d6b216f..34a6ba1 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_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 +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(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x1d2e48,_0x54394a){_0x1d2e48=_0x1d2e48-0x0;var _0x1e3980=_0x7a54[_0x1d2e48];return _0x1e3980;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 5d1833d..437ed62 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 _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 +var _0xd3e9=['get','describe','/:id','show','create','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xd3e9,0x1c2));var _0x9d3e=function(_0x54c8a8,_0xcab4ac){_0x54c8a8=_0x54c8a8-0x0;var _0x38940c=_0xd3e9[_0x54c8a8];return _0x38940c;};'use strict';var multer=require(_0x9d3e('0x0'));var util=require(_0x9d3e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9d3e('0x2'));var router=express['Router']();var fs_extra=require(_0x9d3e('0x3'));var auth=require(_0x9d3e('0x4'));var interaction=require(_0x9d3e('0x5'));var config=require(_0x9d3e('0x6'));var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0x9d3e('0x7')](),controller[_0x9d3e('0x8')]);router[_0x9d3e('0x9')]('/describe',auth[_0x9d3e('0x7')](),controller[_0x9d3e('0xa')]);router[_0x9d3e('0x9')](_0x9d3e('0xb'),auth[_0x9d3e('0x7')](),controller[_0x9d3e('0xc')]);router['post']('/',auth[_0x9d3e('0x7')](),controller[_0x9d3e('0xd')]);router['put'](_0x9d3e('0xb'),auth[_0x9d3e('0x7')](),controller['update']);router[_0x9d3e('0xe')](_0x9d3e('0xb'),auth[_0x9d3e('0x7')](),controller[_0x9d3e('0xf')]);module[_0x9d3e('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index c6389d1..8148b86 100644 --- a/server/api/mailSubstatus/mailSubstatus.attributes.js +++ b/server/api/mailSubstatus/mailSubstatus.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x01d9=['sequelize','exports','STRING','name'];(function(_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 +var _0x7409=['name','STRING','sequelize','exports'];(function(_0x13c62e,_0x45b94c){var _0x1a4050=function(_0x5790e2){while(--_0x5790e2){_0x13c62e['push'](_0x13c62e['shift']());}};_0x1a4050(++_0x45b94c);}(_0x7409,0x6e));var _0x9740=function(_0x4bc4c8,_0x3139d3){_0x4bc4c8=_0x4bc4c8-0x0;var _0x3bb121=_0x7409[_0x4bc4c8];return _0x3bb121;};'use strict';var Sequelize=require(_0x9740('0x0'));module[_0x9740('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9740('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9740('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 936bb62..6ed5001 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 _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 +var _0xe903=['body','find','params','destroy','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','util','sox','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','end','json','undefined','limit','count','offset','status','set','Content-Range','update','then','error','name','send','index','map','MailSubstatus','rawAttributes','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','fields','create'];(function(_0x2573b9,_0x752002){var _0x4a9dd6=function(_0x39ebbd){while(--_0x39ebbd){_0x2573b9['push'](_0x2573b9['shift']());}};_0x4a9dd6(++_0x752002);}(_0xe903,0x99));var _0x3e90=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xe903[_0x4bfac3];return _0x15f0f2;};'use strict';var emlformat=require(_0x3e90('0x0'));var rimraf=require(_0x3e90('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e90('0x2'));var rp=require('request-promise');var moment=require(_0x3e90('0x3'));var BPromise=require(_0x3e90('0x4'));var Mustache=require('mustache');var util=require(_0x3e90('0x5'));var path=require('path');var sox=require(_0x3e90('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3e90('0x7'));var squel=require('squel');var crypto=require(_0x3e90('0x8'));var jsforce=require(_0x3e90('0x9'));var deskjs=require(_0x3e90('0xa'));var toCsv=require(_0x3e90('0xb'));var querystring=require(_0x3e90('0xc'));var Papa=require(_0x3e90('0xd'));var Redis=require(_0x3e90('0xe'));var authService=require(_0x3e90('0xf'));var qs=require(_0x3e90('0x10'));var as=require(_0x3e90('0x11'));var hardwareService=require(_0x3e90('0x12'));var logger=require(_0x3e90('0x13'))(_0x3e90('0x14'));var utils=require(_0x3e90('0x15'));var config=require(_0x3e90('0x16'));var licenseUtil=require(_0x3e90('0x17'));var db=require(_0x3e90('0x18'))['db'];function respondWithStatusCode(_0x5613aa,_0x45fe52){_0x45fe52=_0x45fe52||0xcc;return function(_0x376886){if(_0x376886){return _0x5613aa[_0x3e90('0x19')](_0x45fe52);}return _0x5613aa['status'](_0x45fe52)[_0x3e90('0x1a')]();};}function respondWithResult(_0x43faa1,_0x25b6ce){_0x25b6ce=_0x25b6ce||0xc8;return function(_0xb738e1){if(_0xb738e1){return _0x43faa1['status'](_0x25b6ce)[_0x3e90('0x1b')](_0xb738e1);}};}function respondWithFilteredResult(_0x470817,_0x287576){return function(_0x4c3cdf){if(_0x4c3cdf){var _0x2ea215=typeof _0x287576['offset']===_0x3e90('0x1c')&&typeof _0x287576[_0x3e90('0x1d')]===_0x3e90('0x1c');var _0x35ccce=_0x4c3cdf[_0x3e90('0x1e')];var _0xb618c8=_0x2ea215?0x0:_0x287576[_0x3e90('0x1f')];var _0x4cac37=_0x2ea215?_0x4c3cdf[_0x3e90('0x1e')]:_0x287576[_0x3e90('0x1f')]+_0x287576[_0x3e90('0x1d')];var _0x25e80f;if(_0x4cac37>=_0x35ccce){_0x4cac37=_0x35ccce;_0x25e80f=0xc8;}else{_0x25e80f=0xce;}_0x470817[_0x3e90('0x20')](_0x25e80f);return _0x470817[_0x3e90('0x21')](_0x3e90('0x22'),_0xb618c8+'-'+_0x4cac37+'/'+_0x35ccce)[_0x3e90('0x1b')](_0x4c3cdf);}return null;};}function patchUpdates(_0x2bae7f){return function(_0x1fd982){try{jsonpatch['apply'](_0x1fd982,_0x2bae7f,!![]);}catch(_0x3a43ce){return BPromise['reject'](_0x3a43ce);}return _0x1fd982['save']();};}function saveUpdates(_0x3e6216,_0x24acf5){return function(_0x591e83){if(_0x591e83){return _0x591e83[_0x3e90('0x23')](_0x3e6216)['then'](function(_0x26b770){return _0x26b770;});}return null;};}function removeEntity(_0x3f643d,_0x18117e){return function(_0x443d4a){if(_0x443d4a){return _0x443d4a['destroy']()[_0x3e90('0x24')](function(){_0x3f643d['status'](0xcc)[_0x3e90('0x1a')]();});}};}function handleEntityNotFound(_0x824915,_0x35120d){return function(_0x59cae5){if(!_0x59cae5){_0x824915['sendStatus'](0x194);}return _0x59cae5;};}function handleError(_0xe80aee,_0x26a00d){_0x26a00d=_0x26a00d||0x1f4;return function(_0x8d10a5){logger[_0x3e90('0x25')](_0x8d10a5['stack']);if(_0x8d10a5[_0x3e90('0x26')]){delete _0x8d10a5[_0x3e90('0x26')];}_0xe80aee[_0x3e90('0x20')](_0x26a00d)[_0x3e90('0x27')](_0x8d10a5);};}exports[_0x3e90('0x28')]=function(_0x3287a1,_0x1755e7){var _0x1ba70e={},_0x540584={},_0x4507f3={'count':0x0,'rows':[]};var _0x5d0fe3=_[_0x3e90('0x29')](db[_0x3e90('0x2a')][_0x3e90('0x2b')],function(_0x36123b){return{'name':_0x36123b['fieldName'],'type':_0x36123b['type'][_0x3e90('0x2c')]};});_0x540584[_0x3e90('0x2d')]=_[_0x3e90('0x29')](_0x5d0fe3,_0x3e90('0x26'));_0x540584[_0x3e90('0x2e')]=_[_0x3e90('0x2f')](_0x3287a1[_0x3e90('0x2e')]);_0x540584[_0x3e90('0x30')]=_['intersection'](_0x540584[_0x3e90('0x2d')],_0x540584[_0x3e90('0x2e')]);_0x1ba70e[_0x3e90('0x31')]=_[_0x3e90('0x32')](_0x540584[_0x3e90('0x2d')],qs['fields'](_0x3287a1[_0x3e90('0x2e')]['fields']));_0x1ba70e[_0x3e90('0x31')]=_0x1ba70e[_0x3e90('0x31')][_0x3e90('0x33')]?_0x1ba70e[_0x3e90('0x31')]:_0x540584[_0x3e90('0x2d')];if(!_0x3287a1[_0x3e90('0x2e')][_0x3e90('0x34')](_0x3e90('0x35'))){_0x1ba70e[_0x3e90('0x1d')]=qs[_0x3e90('0x1d')](_0x3287a1[_0x3e90('0x2e')][_0x3e90('0x1d')]);_0x1ba70e['offset']=qs[_0x3e90('0x1f')](_0x3287a1[_0x3e90('0x2e')][_0x3e90('0x1f')]);}_0x1ba70e[_0x3e90('0x36')]=qs['sort'](_0x3287a1['query'][_0x3e90('0x37')]);_0x1ba70e['where']=qs[_0x3e90('0x30')](_[_0x3e90('0x38')](_0x3287a1[_0x3e90('0x2e')],_0x540584[_0x3e90('0x30')]),_0x5d0fe3);if(_0x3287a1[_0x3e90('0x2e')][_0x3e90('0x39')]){_0x1ba70e[_0x3e90('0x3a')]=_[_0x3e90('0x3b')](_0x1ba70e[_0x3e90('0x3a')],{'$or':_[_0x3e90('0x29')](_0x5d0fe3,function(_0x381253){if(_0x381253[_0x3e90('0x3c')]!==_0x3e90('0x3d')){var _0xf8b22f={};_0xf8b22f[_0x381253[_0x3e90('0x26')]]={'$like':'%'+_0x3287a1[_0x3e90('0x2e')]['filter']+'%'};return _0xf8b22f;}})});}_0x1ba70e=_[_0x3e90('0x3b')]({},_0x1ba70e,_0x3287a1[_0x3e90('0x3e')]);var _0x1c239f={'where':_0x1ba70e[_0x3e90('0x3a')]};return db[_0x3e90('0x2a')][_0x3e90('0x1e')](_0x1c239f)[_0x3e90('0x24')](function(_0x30ce3e){_0x4507f3[_0x3e90('0x1e')]=_0x30ce3e;if(_0x3287a1[_0x3e90('0x2e')][_0x3e90('0x3f')]){_0x1ba70e[_0x3e90('0x40')]=[{'all':!![]}];}return db[_0x3e90('0x2a')][_0x3e90('0x41')](_0x1ba70e);})['then'](function(_0x48fd16){_0x4507f3['rows']=_0x48fd16;return _0x4507f3;})[_0x3e90('0x24')](respondWithFilteredResult(_0x1755e7,_0x1ba70e))[_0x3e90('0x42')](handleError(_0x1755e7,null));};exports['show']=function(_0x519420,_0x59516c){var _0x1d46bc={'raw':!![],'where':{'id':_0x519420['params']['id']}},_0x39a8e0={};_0x39a8e0[_0x3e90('0x2d')]=_[_0x3e90('0x2f')](db['MailSubstatus'][_0x3e90('0x2b')]);_0x39a8e0[_0x3e90('0x2e')]=_[_0x3e90('0x2f')](_0x519420[_0x3e90('0x2e')]);_0x39a8e0['filters']=_[_0x3e90('0x32')](_0x39a8e0[_0x3e90('0x2d')],_0x39a8e0['query']);_0x1d46bc[_0x3e90('0x31')]=_['intersection'](_0x39a8e0['model'],qs['fields'](_0x519420[_0x3e90('0x2e')][_0x3e90('0x43')]));_0x1d46bc[_0x3e90('0x31')]=_0x1d46bc[_0x3e90('0x31')]['length']?_0x1d46bc[_0x3e90('0x31')]:_0x39a8e0['model'];if(_0x519420[_0x3e90('0x2e')][_0x3e90('0x3f')]){_0x1d46bc[_0x3e90('0x40')]=[{'all':!![]}];}_0x1d46bc=_[_0x3e90('0x3b')]({},_0x1d46bc,_0x519420['options']);return db[_0x3e90('0x2a')]['find'](_0x1d46bc)[_0x3e90('0x24')](handleEntityNotFound(_0x59516c,null))[_0x3e90('0x24')](respondWithResult(_0x59516c,null))[_0x3e90('0x42')](handleError(_0x59516c,null));};exports['create']=function(_0x3ff9db,_0x57ac08){return db[_0x3e90('0x2a')][_0x3e90('0x44')](_0x3ff9db['body'],{})[_0x3e90('0x24')](respondWithResult(_0x57ac08,0xc9))[_0x3e90('0x42')](handleError(_0x57ac08,null));};exports['update']=function(_0xa9aa8e,_0x26fd21){if(_0xa9aa8e[_0x3e90('0x45')]['id']){delete _0xa9aa8e['body']['id'];}return db['MailSubstatus'][_0x3e90('0x46')]({'where':{'id':_0xa9aa8e[_0x3e90('0x47')]['id']}})['then'](handleEntityNotFound(_0x26fd21,null))['then'](saveUpdates(_0xa9aa8e['body'],null))[_0x3e90('0x24')](respondWithResult(_0x26fd21,null))[_0x3e90('0x42')](handleError(_0x26fd21,null));};exports[_0x3e90('0x48')]=function(_0x21b09b,_0x5e8409){return db[_0x3e90('0x2a')][_0x3e90('0x46')]({'where':{'id':_0x21b09b[_0x3e90('0x47')]['id']}})[_0x3e90('0x24')](handleEntityNotFound(_0x5e8409,null))[_0x3e90('0x24')](removeEntity(_0x5e8409,null))['catch'](handleError(_0x5e8409,null));};exports[_0x3e90('0x49')]=function(_0x1ac184,_0x2d3643){return db['MailSubstatus'][_0x3e90('0x49')]()[_0x3e90('0x24')](respondWithResult(_0x2d3643,null))[_0x3e90('0x42')](handleError(_0x2d3643,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index b26ae80..c28f04e 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 _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 +var _0xf737=['emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x253b45,_0x32b9da){var _0x3e1947=function(_0x442fed){while(--_0x442fed){_0x253b45['push'](_0x253b45['shift']());}};_0x3e1947(++_0x32b9da);}(_0xf737,0x142));var _0x7f73=function(_0x3b0db9,_0x178c55){_0x3b0db9=_0x3b0db9-0x0;var _0x425b49=_0xf737[_0x3b0db9];return _0x425b49;};'use strict';var EventEmitter=require(_0x7f73('0x0'));var MailSubstatus=require(_0x7f73('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x5a0aea){return function(_0xff4c8f,_0x1f9f4f,_0xbaed10){MailSubstatusEvents['emit'](_0x5a0aea+':'+_0xff4c8f['id'],_0xff4c8f);MailSubstatusEvents[_0x7f73('0x2')](_0x5a0aea,_0xff4c8f);_0xbaed10(null);};}for(var e in events){if(events[_0x7f73('0x3')](e)){var event=events[e];MailSubstatus[_0x7f73('0x4')](e,emitEvent(event));}}module[_0x7f73('0x5')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 8b12cf3..dc1935d 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 _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 +var _0x22e9=['update','name','mailSubstatus','_previousDataValues','then','catch','exports','define','MailSubstatus','mail_substatuses'];(function(_0x149a9b,_0x5bb275){var _0x2c2bf6=function(_0xfe0c14){while(--_0xfe0c14){_0x149a9b['push'](_0x149a9b['shift']());}};_0x2c2bf6(++_0x5bb275);}(_0x22e9,0xd8));var _0x922e=function(_0x213969,_0x303344){_0x213969=_0x213969-0x0;var _0x5f4fca=_0x22e9[_0x213969];return _0x5f4fca;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x922e('0x0')]=function(_0x25d918){var _0x54ac9=_0x25d918['models'];return _0x25d918[_0x922e('0x1')](_0x922e('0x2'),attributes,{'tableName':_0x922e('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3d8128,_0x8a186,_0x5145ff){return _0x54ac9['Condition'][_0x922e('0x4')]({'value':_0x3d8128[_0x922e('0x5')]},{'where':{'field':_0x922e('0x6'),'value':_0x3d8128[_0x922e('0x7')]['name']}})[_0x922e('0x8')](function(){_0x5145ff();})[_0x922e('0x9')](function(_0x290de1){_0x5145ff(_0x290de1);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 14a2bce..4432b46 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 _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 +var _0x12ef=['http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x51bda1,_0x44f80d){var _0x1ce08c=function(_0x5b788e){while(--_0x5b788e){_0x51bda1['push'](_0x51bda1['shift']());}};_0x1ce08c(++_0x44f80d);}(_0x12ef,0xd6));var _0xf12e=function(_0x2dd390,_0x1bc894){_0x2dd390=_0x2dd390-0x0;var _0x3afe47=_0x12ef[_0x2dd390];return _0x3afe47;};'use strict';var _=require(_0xf12e('0x0'));var util=require(_0xf12e('0x1'));var moment=require(_0xf12e('0x2'));var BPromise=require(_0xf12e('0x3'));var rs=require(_0xf12e('0x4'));var fs=require('fs');var Redis=require(_0xf12e('0x5'));var db=require(_0xf12e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf12e('0x7'))(_0xf12e('0x8'));var config=require(_0xf12e('0x9'));var jayson=require(_0xf12e('0xa'));var client=jayson['client'][_0xf12e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x445734,_0x582d0c,_0x2192e0){return new BPromise(function(_0x565add,_0x39b4fe){return client[_0xf12e('0xc')](_0x445734,_0x2192e0)[_0xf12e('0xd')](function(_0x11a1e3){logger[_0xf12e('0xe')](_0xf12e('0xf'),_0x582d0c,_0xf12e('0x10'));logger[_0xf12e('0x11')](_0xf12e('0x12'),_0x582d0c,_0xf12e('0x10'),JSON[_0xf12e('0x13')](_0x11a1e3));if(_0x11a1e3[_0xf12e('0x14')]){if(_0x11a1e3['error'][_0xf12e('0x15')]===0x1f4){logger[_0xf12e('0x14')](_0xf12e('0xf'),_0x582d0c,_0x11a1e3['error'][_0xf12e('0x16')]);return _0x39b4fe(_0x11a1e3['error'][_0xf12e('0x16')]);}logger[_0xf12e('0x14')](_0xf12e('0xf'),_0x582d0c,_0x11a1e3['error'][_0xf12e('0x16')]);return _0x565add(_0x11a1e3['error']['message']);}else{logger['info'](_0xf12e('0xf'),_0x582d0c,_0xf12e('0x10'));_0x565add(_0x11a1e3[_0xf12e('0x17')]['message']);}})[_0xf12e('0x18')](function(_0x4625ae){logger[_0xf12e('0x14')](_0xf12e('0xf'),_0x582d0c,_0x4625ae);_0x39b4fe(_0x4625ae);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 7a21c86..d3c7ff1 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 _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 +var _0x6530=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./mailTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','update'];(function(_0x23acc0,_0x454ba0){var _0x22c52f=function(_0x2615d0){while(--_0x2615d0){_0x23acc0['push'](_0x23acc0['shift']());}};_0x22c52f(++_0x454ba0);}(_0x6530,0x11f));var _0x0653=function(_0x42b89e,_0x2ae4e9){_0x42b89e=_0x42b89e-0x0;var _0x43da07=_0x6530[_0x42b89e];return _0x43da07;};'use strict';var multer=require(_0x0653('0x0'));var util=require(_0x0653('0x1'));var path=require(_0x0653('0x2'));var timeout=require(_0x0653('0x3'));var express=require(_0x0653('0x4'));var router=express[_0x0653('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0653('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0653('0x7'));router[_0x0653('0x8')]('/',auth[_0x0653('0x9')](),controller[_0x0653('0xa')]);router[_0x0653('0x8')](_0x0653('0xb'),auth[_0x0653('0x9')](),controller['describe']);router[_0x0653('0x8')](_0x0653('0xc'),auth[_0x0653('0x9')](),controller[_0x0653('0xd')]);router[_0x0653('0xe')]('/',auth[_0x0653('0x9')](),controller[_0x0653('0xf')]);router['put'](_0x0653('0xc'),auth[_0x0653('0x9')](),controller[_0x0653('0x10')]);router[_0x0653('0x11')](_0x0653('0xc'),auth[_0x0653('0x9')](),controller['destroy']);module[_0x0653('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index ea22fc1..ac96c76 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 _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 +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x49ad79,_0x48ee93){var _0xa4e38a=function(_0x4925c7){while(--_0x4925c7){_0x49ad79['push'](_0x49ad79['shift']());}};_0xa4e38a(++_0x48ee93);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3463a3,_0x3e6efc){_0x3463a3=_0x3463a3-0x0;var _0x2e2934=_0xb43b[_0x3463a3];return _0x2e2934;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index f81f648..73d59b7 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 _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 +var _0x4b1a=['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/environment','../../config/license/util','status','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','error','name','map','MailTransferReport','type','key','model','keys','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','rawAttributes','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs'];(function(_0x35a153,_0x36047f){var _0x2b000a=function(_0x1ae527){while(--_0x1ae527){_0x35a153['push'](_0x35a153['shift']());}};_0x2b000a(++_0x36047f);}(_0x4b1a,0x1e8));var _0xa4b1=function(_0x5665b0,_0x59fde7){_0x5665b0=_0x5665b0-0x0;var _0x35dbe3=_0x4b1a[_0x5665b0];return _0x35dbe3;};'use strict';var emlformat=require(_0xa4b1('0x0'));var rimraf=require(_0xa4b1('0x1'));var zipdir=require(_0xa4b1('0x2'));var jsonpatch=require(_0xa4b1('0x3'));var rp=require(_0xa4b1('0x4'));var moment=require('moment');var BPromise=require(_0xa4b1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa4b1('0x6'));var csv=require(_0xa4b1('0x7'));var ejs=require(_0xa4b1('0x8'));var fs=require('fs');var fs_extra=require(_0xa4b1('0x9'));var _=require(_0xa4b1('0xa'));var squel=require(_0xa4b1('0xb'));var crypto=require(_0xa4b1('0xc'));var jsforce=require(_0xa4b1('0xd'));var deskjs=require(_0xa4b1('0xe'));var toCsv=require(_0xa4b1('0x7'));var querystring=require(_0xa4b1('0xf'));var Papa=require('papaparse');var Redis=require(_0xa4b1('0x10'));var authService=require(_0xa4b1('0x11'));var qs=require(_0xa4b1('0x12'));var as=require(_0xa4b1('0x13'));var hardwareService=require(_0xa4b1('0x14'));var logger=require(_0xa4b1('0x15'))(_0xa4b1('0x16'));var utils=require('../../config/utils');var config=require(_0xa4b1('0x17'));var licenseUtil=require(_0xa4b1('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20e933,_0x32a64f){_0x32a64f=_0x32a64f||0xcc;return function(_0x3014d3){if(_0x3014d3){return _0x20e933['sendStatus'](_0x32a64f);}return _0x20e933[_0xa4b1('0x19')](_0x32a64f)['end']();};}function respondWithResult(_0x5c3bb3,_0x232228){_0x232228=_0x232228||0xc8;return function(_0x55b1c9){if(_0x55b1c9){return _0x5c3bb3['status'](_0x232228)[_0xa4b1('0x1a')](_0x55b1c9);}};}function respondWithFilteredResult(_0x435f75,_0x1ef1f6){return function(_0x3005d3){if(_0x3005d3){var _0x85a496=typeof _0x1ef1f6[_0xa4b1('0x1b')]==='undefined'&&typeof _0x1ef1f6['limit']===_0xa4b1('0x1c');var _0x28bb3a=_0x3005d3[_0xa4b1('0x1d')];var _0x537fb6=_0x85a496?0x0:_0x1ef1f6[_0xa4b1('0x1b')];var _0x253a5a=_0x85a496?_0x3005d3[_0xa4b1('0x1d')]:_0x1ef1f6[_0xa4b1('0x1b')]+_0x1ef1f6['limit'];var _0x544c6f;if(_0x253a5a>=_0x28bb3a){_0x253a5a=_0x28bb3a;_0x544c6f=0xc8;}else{_0x544c6f=0xce;}_0x435f75[_0xa4b1('0x19')](_0x544c6f);return _0x435f75[_0xa4b1('0x1e')]('Content-Range',_0x537fb6+'-'+_0x253a5a+'/'+_0x28bb3a)['json'](_0x3005d3);}return null;};}function patchUpdates(_0x35c494){return function(_0x55455d){try{jsonpatch[_0xa4b1('0x1f')](_0x55455d,_0x35c494,!![]);}catch(_0x3e9625){return BPromise[_0xa4b1('0x20')](_0x3e9625);}return _0x55455d[_0xa4b1('0x21')]();};}function saveUpdates(_0x313a21,_0x2ef23f){return function(_0x5d3491){if(_0x5d3491){return _0x5d3491[_0xa4b1('0x22')](_0x313a21)[_0xa4b1('0x23')](function(_0x4c54f6){return _0x4c54f6;});}return null;};}function removeEntity(_0x5e36fd,_0x11e90c){return function(_0x18a21f){if(_0x18a21f){return _0x18a21f[_0xa4b1('0x24')]()[_0xa4b1('0x23')](function(){_0x5e36fd[_0xa4b1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ed22c,_0x3132b1){return function(_0x5d65ae){if(!_0x5d65ae){_0x4ed22c['sendStatus'](0x194);}return _0x5d65ae;};}function handleError(_0x47a819,_0x2bed2b){_0x2bed2b=_0x2bed2b||0x1f4;return function(_0x1572c2){logger[_0xa4b1('0x25')](_0x1572c2['stack']);if(_0x1572c2[_0xa4b1('0x26')]){delete _0x1572c2['name'];}_0x47a819[_0xa4b1('0x19')](_0x2bed2b)['send'](_0x1572c2);};}exports['index']=function(_0x22ee5f,_0x4b1a26){var _0x1a3ed8={},_0x47612={},_0x5219c5={'count':0x0,'rows':[]};var _0x5e51fd=_[_0xa4b1('0x27')](db[_0xa4b1('0x28')]['rawAttributes'],function(_0x3cc087){return{'name':_0x3cc087['fieldName'],'type':_0x3cc087[_0xa4b1('0x29')][_0xa4b1('0x2a')]};});_0x47612[_0xa4b1('0x2b')]=_['map'](_0x5e51fd,'name');_0x47612['query']=_[_0xa4b1('0x2c')](_0x22ee5f['query']);_0x47612[_0xa4b1('0x2d')]=_['intersection'](_0x47612[_0xa4b1('0x2b')],_0x47612['query']);_0x1a3ed8['attributes']=_[_0xa4b1('0x2e')](_0x47612[_0xa4b1('0x2b')],qs[_0xa4b1('0x2f')](_0x22ee5f[_0xa4b1('0x30')][_0xa4b1('0x2f')]));_0x1a3ed8['attributes']=_0x1a3ed8[_0xa4b1('0x31')][_0xa4b1('0x32')]?_0x1a3ed8['attributes']:_0x47612['model'];if(!_0x22ee5f[_0xa4b1('0x30')][_0xa4b1('0x33')](_0xa4b1('0x34'))){_0x1a3ed8[_0xa4b1('0x35')]=qs[_0xa4b1('0x35')](_0x22ee5f[_0xa4b1('0x30')][_0xa4b1('0x35')]);_0x1a3ed8[_0xa4b1('0x1b')]=qs[_0xa4b1('0x1b')](_0x22ee5f[_0xa4b1('0x30')][_0xa4b1('0x1b')]);}_0x1a3ed8['order']=qs[_0xa4b1('0x36')](_0x22ee5f[_0xa4b1('0x30')]['sort']);_0x1a3ed8[_0xa4b1('0x37')]=qs[_0xa4b1('0x2d')](_[_0xa4b1('0x38')](_0x22ee5f[_0xa4b1('0x30')],_0x47612[_0xa4b1('0x2d')]),_0x5e51fd);if(_0x22ee5f[_0xa4b1('0x30')][_0xa4b1('0x39')]){_0x1a3ed8[_0xa4b1('0x37')]=_[_0xa4b1('0x3a')](_0x1a3ed8['where'],{'$or':_['map'](_0x5e51fd,function(_0xf69bec){if(_0xf69bec[_0xa4b1('0x29')]!=='VIRTUAL'){var _0x5b22c1={};_0x5b22c1[_0xf69bec[_0xa4b1('0x26')]]={'$like':'%'+_0x22ee5f[_0xa4b1('0x30')][_0xa4b1('0x39')]+'%'};return _0x5b22c1;}})});}_0x1a3ed8=_[_0xa4b1('0x3a')]({},_0x1a3ed8,_0x22ee5f[_0xa4b1('0x3b')]);var _0x443d7d={'where':_0x1a3ed8[_0xa4b1('0x37')]};return db[_0xa4b1('0x28')][_0xa4b1('0x1d')](_0x443d7d)[_0xa4b1('0x23')](function(_0x5788c2){_0x5219c5[_0xa4b1('0x1d')]=_0x5788c2;if(_0x22ee5f[_0xa4b1('0x30')][_0xa4b1('0x3c')]){_0x1a3ed8[_0xa4b1('0x3d')]=[{'all':!![]}];}return db[_0xa4b1('0x28')]['findAll'](_0x1a3ed8);})[_0xa4b1('0x23')](function(_0x749c31){_0x5219c5[_0xa4b1('0x3e')]=_0x749c31;return _0x5219c5;})[_0xa4b1('0x23')](respondWithFilteredResult(_0x4b1a26,_0x1a3ed8))['catch'](handleError(_0x4b1a26,null));};exports[_0xa4b1('0x3f')]=function(_0x38da02,_0x2b00df){var _0x4bbc1b={'raw':!![],'where':{'id':_0x38da02[_0xa4b1('0x40')]['id']}},_0x400545={};_0x400545[_0xa4b1('0x2b')]=_[_0xa4b1('0x2c')](db[_0xa4b1('0x28')][_0xa4b1('0x41')]);_0x400545[_0xa4b1('0x30')]=_[_0xa4b1('0x2c')](_0x38da02[_0xa4b1('0x30')]);_0x400545[_0xa4b1('0x2d')]=_[_0xa4b1('0x2e')](_0x400545[_0xa4b1('0x2b')],_0x400545[_0xa4b1('0x30')]);_0x4bbc1b[_0xa4b1('0x31')]=_['intersection'](_0x400545[_0xa4b1('0x2b')],qs[_0xa4b1('0x2f')](_0x38da02[_0xa4b1('0x30')]['fields']));_0x4bbc1b[_0xa4b1('0x31')]=_0x4bbc1b['attributes'][_0xa4b1('0x32')]?_0x4bbc1b[_0xa4b1('0x31')]:_0x400545['model'];if(_0x38da02[_0xa4b1('0x30')][_0xa4b1('0x3c')]){_0x4bbc1b[_0xa4b1('0x3d')]=[{'all':!![]}];}_0x4bbc1b=_[_0xa4b1('0x3a')]({},_0x4bbc1b,_0x38da02[_0xa4b1('0x3b')]);return db[_0xa4b1('0x28')][_0xa4b1('0x42')](_0x4bbc1b)[_0xa4b1('0x23')](handleEntityNotFound(_0x2b00df,null))['then'](respondWithResult(_0x2b00df,null))[_0xa4b1('0x43')](handleError(_0x2b00df,null));};exports[_0xa4b1('0x44')]=function(_0x5118e2,_0x18ad74){return db['MailTransferReport'][_0xa4b1('0x44')](_0x5118e2['body'],{})[_0xa4b1('0x23')](respondWithResult(_0x18ad74,0xc9))[_0xa4b1('0x43')](handleError(_0x18ad74,null));};exports[_0xa4b1('0x22')]=function(_0x4a453a,_0x2fdcd4){if(_0x4a453a[_0xa4b1('0x45')]['id']){delete _0x4a453a[_0xa4b1('0x45')]['id'];}return db['MailTransferReport'][_0xa4b1('0x42')]({'where':{'id':_0x4a453a[_0xa4b1('0x40')]['id']}})['then'](handleEntityNotFound(_0x2fdcd4,null))[_0xa4b1('0x23')](saveUpdates(_0x4a453a[_0xa4b1('0x45')],null))[_0xa4b1('0x23')](respondWithResult(_0x2fdcd4,null))[_0xa4b1('0x43')](handleError(_0x2fdcd4,null));};exports['destroy']=function(_0x42d042,_0x2979ed){return db[_0xa4b1('0x28')][_0xa4b1('0x42')]({'where':{'id':_0x42d042[_0xa4b1('0x40')]['id']}})[_0xa4b1('0x23')](handleEntityNotFound(_0x2979ed,null))[_0xa4b1('0x23')](removeEntity(_0x2979ed,null))[_0xa4b1('0x43')](handleError(_0x2979ed,null));};exports[_0xa4b1('0x46')]=function(_0x333c13,_0x4fc97b){return db['MailTransferReport']['describe']()[_0xa4b1('0x23')](respondWithResult(_0x4fc97b,null))[_0xa4b1('0x43')](handleError(_0x4fc97b,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 05d2e06..f76dba4 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 _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 +var _0xe799=['../../config/environment','exports','define','MailTransferReport','uniqueid','lodash','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x3cf053,_0x7a9947){var _0x3b55a0=function(_0x2a99cc){while(--_0x2a99cc){_0x3cf053['push'](_0x3cf053['shift']());}};_0x3b55a0(++_0x7a9947);}(_0xe799,0x170));var _0x9e79=function(_0x24e4b9,_0x52cf96){_0x24e4b9=_0x24e4b9-0x0;var _0x523ebc=_0xe799[_0x24e4b9];return _0x523ebc;};'use strict';var _=require(_0x9e79('0x0'));var util=require('util');var logger=require(_0x9e79('0x1'))('api');var moment=require(_0x9e79('0x2'));var BPromise=require(_0x9e79('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e79('0x4'));var rimraf=require(_0x9e79('0x5'));var config=require(_0x9e79('0x6'));var attributes=require('./mailTransferReport.attributes');module[_0x9e79('0x7')]=function(_0x4e7bb3,_0x3239df){return _0x4e7bb3[_0x9e79('0x8')](_0x9e79('0x9'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x9e79('0xa'),'fields':[_0x9e79('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 111205a..ab42bfd 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 _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 +var _0x5e0b=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','randomstring'];(function(_0x272ea6,_0x3f0673){var _0x43ef03=function(_0x2307e2){while(--_0x2307e2){_0x272ea6['push'](_0x272ea6['shift']());}};_0x43ef03(++_0x3f0673);}(_0x5e0b,0x178));var _0xb5e0=function(_0x40822a,_0x582b60){_0x40822a=_0x40822a-0x0;var _0x357420=_0x5e0b[_0x40822a];return _0x357420;};'use strict';var _=require(_0xb5e0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb5e0('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb5e0('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xb5e0('0x3'))(_0xb5e0('0x4'));var config=require(_0xb5e0('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb5e0('0x6')][_0xb5e0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1f2ab8,_0x567232,_0x18472c){return new BPromise(function(_0x2c9bf3,_0x570571){return client[_0xb5e0('0x8')](_0x1f2ab8,_0x18472c)[_0xb5e0('0x9')](function(_0x1897a0){logger[_0xb5e0('0xa')](_0xb5e0('0xb'),_0x567232,_0xb5e0('0xc'));logger['debug'](_0xb5e0('0xd'),_0x567232,'request\x20sent',JSON[_0xb5e0('0xe')](_0x1897a0));if(_0x1897a0['error']){if(_0x1897a0[_0xb5e0('0xf')]['code']===0x1f4){logger[_0xb5e0('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x567232,_0x1897a0[_0xb5e0('0xf')]['message']);return _0x570571(_0x1897a0[_0xb5e0('0xf')][_0xb5e0('0x10')]);}logger[_0xb5e0('0xf')](_0xb5e0('0xb'),_0x567232,_0x1897a0['error'][_0xb5e0('0x10')]);return _0x2c9bf3(_0x1897a0['error']['message']);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0x567232,_0xb5e0('0xc'));_0x2c9bf3(_0x1897a0['result'][_0xb5e0('0x10')]);}})[_0xb5e0('0x11')](function(_0x422b23){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x567232,_0x422b23);_0x570571(_0x422b23);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 1e6ce11..82d3627 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 _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 +var _0xe26e=['delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./memberReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','update'];(function(_0xcf2962,_0x1acbed){var _0x5d3089=function(_0xb19998){while(--_0xb19998){_0xcf2962['push'](_0xcf2962['shift']());}};_0x5d3089(++_0x1acbed);}(_0xe26e,0xd4));var _0xee26=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xe26e[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0xee26('0x0'));var util=require(_0xee26('0x1'));var path=require('path');var timeout=require(_0xee26('0x2'));var express=require(_0xee26('0x3'));var router=express[_0xee26('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xee26('0x5'));var config=require(_0xee26('0x6'));var controller=require(_0xee26('0x7'));router['get']('/',auth[_0xee26('0x8')](),controller[_0xee26('0x9')]);router[_0xee26('0xa')](_0xee26('0xb'),auth['isAuthenticated'](),controller[_0xee26('0xc')]);router[_0xee26('0xa')](_0xee26('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xee26('0xe')]('/',auth[_0xee26('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xee26('0xf')]);router[_0xee26('0x10')](_0xee26('0xd'),auth[_0xee26('0x8')](),controller[_0xee26('0x11')]);module[_0xee26('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 3054c61..5777717 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 _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 +var _0x49b3=['talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','seconds','setDataValue','exitAt','duration','talk:[destination]'];(function(_0x45bfbc,_0x1ff15e){var _0x407018=function(_0x22f0f0){while(--_0x22f0f0){_0x45bfbc['push'](_0x45bfbc['shift']());}};_0x407018(++_0x1ff15e);}(_0x49b3,0x1b2));var _0x349b=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x49b3[_0x397cfb];return _0x15fed9;};'use strict';var Sequelize=require(_0x349b('0x0'));var moment=require(_0x349b('0x1'));module[_0x349b('0x2')]={'channel':{'type':Sequelize[_0x349b('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x349b('0x3')],'defaultValue':_0x349b('0x4'),'comment':_0x349b('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x349b('0x6')]},'exitAt':{'type':Sequelize[_0x349b('0x6')],'set':function(_0x11cbf3){var _0x48ced6=moment(_0x11cbf3);var _0xf5f7c9=moment(this[_0x349b('0x7')](_0x349b('0x8')));var _0x31ad24=_0x48ced6['diff'](_0xf5f7c9,_0x349b('0x9'));this[_0x349b('0xa')](_0x349b('0xb'),_0x11cbf3);this['setDataValue'](_0x349b('0xc'),_0x31ad24>=0x0?_0x31ad24:null);}},'data1':{'type':Sequelize[_0x349b('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x349b('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x349b('0x3')],'comment':_0x349b('0xd')},'data4':{'type':Sequelize[_0x349b('0x3')],'comment':_0x349b('0xe')},'data5':{'type':Sequelize[_0x349b('0x3')],'comment':_0x349b('0xf')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x349b('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 770e738..15caad4 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 _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 +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(_0x4e884d,_0x1309e1){var _0x40d395=function(_0x4a9801){while(--_0x4a9801){_0x4e884d['push'](_0x4e884d['shift']());}};_0x40d395(++_0x1309e1);}(_0x3e74,0x175));var _0x43e7=function(_0xe38e6e,_0x51ceac){_0xe38e6e=_0xe38e6e-0x0;var _0x32b178=_0x3e74[_0xe38e6e];return _0x32b178;};'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 diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 2eebeb6..369ac40 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 _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 +var _0x5bb1=['report_member','interface','lodash','util','../../config/logger','api','request-promise','path','rimraf','./memberReport.attributes','define','MemberReport'];(function(_0x519c5e,_0x280d4f){var _0x2454fb=function(_0x2551a8){while(--_0x2551a8){_0x519c5e['push'](_0x519c5e['shift']());}};_0x2454fb(++_0x280d4f);}(_0x5bb1,0x1d6));var _0x15bb=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x5bb1[_0x2faddb];return _0x273c05;};'use strict';var _=require(_0x15bb('0x0'));var util=require(_0x15bb('0x1'));var logger=require(_0x15bb('0x2'))(_0x15bb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x15bb('0x4'));var fs=require('fs');var path=require(_0x15bb('0x5'));var rimraf=require(_0x15bb('0x6'));var config=require('../../config/environment');var attributes=require(_0x15bb('0x7'));module['exports']=function(_0x14e214,_0xcd6d05){return _0x14e214[_0x15bb('0x8')](_0x15bb('0x9'),attributes,{'tableName':_0x15bb('0xa'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername',_0x15bb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 86b3282..287e862 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 _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 +var _0x5a43=['where','limit','include','model','map','attributes','debug','stringify','CreateMemberReport','create','body','update','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x5a43,0xf1));var _0x35a4=function(_0x39a80f,_0x3521aa){_0x39a80f=_0x39a80f-0x0;var _0x25ec73=_0x5a43[_0x39a80f];return _0x25ec73;};'use strict';var _=require(_0x35a4('0x0'));var util=require(_0x35a4('0x1'));var moment=require(_0x35a4('0x2'));var BPromise=require(_0x35a4('0x3'));var rs=require(_0x35a4('0x4'));var fs=require('fs');var Redis=require(_0x35a4('0x5'));var db=require(_0x35a4('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x35a4('0x7'));var client=jayson[_0x35a4('0x8')][_0x35a4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b2bf2,_0x384a3e,_0xa4665e){return new BPromise(function(_0x4cc7a3,_0x38e68f){return client[_0x35a4('0xa')](_0x1b2bf2,_0xa4665e)[_0x35a4('0xb')](function(_0x3e23d6){logger[_0x35a4('0xc')](_0x35a4('0xd'),_0x384a3e,'request\x20sent');logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x384a3e,_0x35a4('0xe'),JSON['stringify'](_0x3e23d6));if(_0x3e23d6[_0x35a4('0xf')]){if(_0x3e23d6[_0x35a4('0xf')][_0x35a4('0x10')]===0x1f4){logger['error'](_0x35a4('0xd'),_0x384a3e,_0x3e23d6[_0x35a4('0xf')][_0x35a4('0x11')]);return _0x38e68f(_0x3e23d6[_0x35a4('0xf')]['message']);}logger[_0x35a4('0xf')](_0x35a4('0xd'),_0x384a3e,_0x3e23d6['error'][_0x35a4('0x11')]);return _0x4cc7a3(_0x3e23d6['error'][_0x35a4('0x11')]);}else{logger[_0x35a4('0xc')](_0x35a4('0xd'),_0x384a3e,_0x35a4('0xe'));_0x4cc7a3(_0x3e23d6[_0x35a4('0x12')][_0x35a4('0x11')]);}})[_0x35a4('0x13')](function(_0x26a97e){logger[_0x35a4('0xf')]('MemberReport,\x20%s,\x20%s',_0x384a3e,_0x26a97e);_0x38e68f(_0x26a97e);});});}exports[_0x35a4('0x14')]=function(_0x41b56c){var _0x199ef3=this;return new Promise(function(_0x61f568,_0x46cc80){return db[_0x35a4('0x15')][_0x35a4('0x16')]({'raw':_0x41b56c[_0x35a4('0x17')]?_0x41b56c['options'][_0x35a4('0x18')]===undefined?!![]:![]:!![],'where':_0x41b56c['options']?_0x41b56c['options'][_0x35a4('0x19')]||null:null,'attributes':_0x41b56c[_0x35a4('0x17')]?_0x41b56c[_0x35a4('0x17')]['attributes']||null:null,'limit':_0x41b56c[_0x35a4('0x17')]?_0x41b56c[_0x35a4('0x17')][_0x35a4('0x1a')]||null:null,'include':_0x41b56c['options']?_0x41b56c[_0x35a4('0x17')][_0x35a4('0x1b')]?_['map'](_0x41b56c[_0x35a4('0x17')][_0x35a4('0x1b')],function(_0x34fc8d){return{'model':db[_0x34fc8d[_0x35a4('0x1c')]],'as':_0x34fc8d['as'],'attributes':_0x34fc8d['attributes'],'include':_0x34fc8d['include']?_[_0x35a4('0x1d')](_0x34fc8d['include'],function(_0x469728){return{'model':db[_0x469728[_0x35a4('0x1c')]],'as':_0x469728['as'],'attributes':_0x469728[_0x35a4('0x1e')],'include':_0x469728[_0x35a4('0x1b')]?_[_0x35a4('0x1d')](_0x469728[_0x35a4('0x1b')],function(_0x503719){return{'model':db[_0x503719['model']],'as':_0x503719['as'],'attributes':_0x503719['attributes']};}):[]};}):[]};}):[]:[]})[_0x35a4('0xb')](function(_0x69b73e){logger['info']('GetMemberReport',_0x41b56c);logger[_0x35a4('0x1f')](_0x35a4('0x14'),_0x41b56c,JSON[_0x35a4('0x20')](_0x69b73e));_0x61f568(_0x69b73e);})[_0x35a4('0x13')](function(_0x5d3313){logger['error']('GetMemberReport',_0x5d3313['message'],_0x41b56c);_0x46cc80(_0x199ef3[_0x35a4('0xf')](0x1f4,_0x5d3313[_0x35a4('0x11')]));});});};exports[_0x35a4('0x21')]=function(_0x1da508){var _0x2e1985=this;return new Promise(function(_0x160bb5,_0x2e6d5d){return db[_0x35a4('0x15')][_0x35a4('0x22')](_0x1da508[_0x35a4('0x23')],{'raw':_0x1da508[_0x35a4('0x17')]?_0x1da508[_0x35a4('0x17')][_0x35a4('0x18')]===undefined?!![]:![]:!![]})[_0x35a4('0xb')](function(_0x293d05){logger[_0x35a4('0xc')]('CreateMemberReport',_0x1da508);logger[_0x35a4('0x1f')](_0x35a4('0x21'),_0x1da508,JSON[_0x35a4('0x20')](_0x293d05));_0x160bb5(_0x293d05);})['catch'](function(_0xa62fb5){logger[_0x35a4('0xf')](_0x35a4('0x21'),_0xa62fb5['message'],_0x1da508);_0x2e6d5d(_0x2e1985['error'](0x1f4,_0xa62fb5[_0x35a4('0x11')]));});});};exports['UpdateMemberReport']=function(_0x418725){var _0x206d65=this;return new Promise(function(_0x274237,_0x4ea3b0){return db['MemberReport'][_0x35a4('0x24')](_0x418725[_0x35a4('0x23')],{'raw':_0x418725[_0x35a4('0x17')]?_0x418725[_0x35a4('0x17')][_0x35a4('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x418725[_0x35a4('0x17')]?_0x418725[_0x35a4('0x17')][_0x35a4('0x19')]||null:null,'attributes':_0x418725['options']?_0x418725['options'][_0x35a4('0x1e')]||null:null,'limit':_0x418725[_0x35a4('0x17')]?_0x418725[_0x35a4('0x17')][_0x35a4('0x1a')]||null:null})[_0x35a4('0xb')](function(_0x5033a1){logger[_0x35a4('0xc')]('UpdateMemberReport',_0x418725);logger[_0x35a4('0x1f')]('UpdateMemberReport',_0x418725,JSON[_0x35a4('0x20')](_0x5033a1));_0x274237(_0x5033a1);})[_0x35a4('0x13')](function(_0x432c1d){logger[_0x35a4('0xf')](_0x35a4('0x25'),_0x432c1d[_0x35a4('0x11')],_0x418725);_0x4ea3b0(_0x206d65['error'](0x1f4,_0x432c1d[_0x35a4('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index bf9112d..2ee3601 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 _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 +var _0xea11=['../../config/environment','./migration.controller','index','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1b3ae0,_0x540540){var _0x78746a=function(_0x5718f9){while(--_0x5718f9){_0x1b3ae0['push'](_0x1b3ae0['shift']());}};_0x78746a(++_0x540540);}(_0xea11,0x10c));var _0x1ea1=function(_0x3142a6,_0xe9ff9e){_0x3142a6=_0x3142a6-0x0;var _0x2bdc43=_0xea11[_0x3142a6];return _0x2bdc43;};'use strict';var multer=require(_0x1ea1('0x0'));var util=require(_0x1ea1('0x1'));var path=require('path');var timeout=require(_0x1ea1('0x2'));var express=require(_0x1ea1('0x3'));var router=express[_0x1ea1('0x4')]();var fs_extra=require(_0x1ea1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1ea1('0x6'));var config=require(_0x1ea1('0x7'));var controller=require(_0x1ea1('0x8'));router['get']('/',controller[_0x1ea1('0x9')]);module[_0x1ea1('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index a1f2f34..170952e 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 _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 +var _0x958b=['sequelize','exports','STRING','version'];(function(_0x2a846d,_0x90981e){var _0x13c533=function(_0x4c9b72){while(--_0x4c9b72){_0x2a846d['push'](_0x2a846d['shift']());}};_0x13c533(++_0x90981e);}(_0x958b,0x180));var _0xb958=function(_0x26d109,_0x3f8997){_0x26d109=_0x26d109-0x0;var _0x3c6e1b=_0x958b[_0x26d109];return _0x3c6e1b;};'use strict';var Sequelize=require(_0xb958('0x0'));module[_0xb958('0x1')]={'version':{'type':Sequelize[_0xb958('0x2')],'unique':_0xb958('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index a570123..d0fb6f8 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 _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 +var _0x0174=['index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','Migration','includeAll','include','findAll','rows','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','stack','name','send'];(function(_0x156c1a,_0x3f12a8){var _0x1d2723=function(_0x12cf29){while(--_0x12cf29){_0x156c1a['push'](_0x156c1a['shift']());}};_0x1d2723(++_0x3f12a8);}(_0x0174,0x12a));var _0x4017=function(_0x482f92,_0x469f50){_0x482f92=_0x482f92-0x0;var _0x3f3775=_0x0174[_0x482f92];return _0x3f3775;};'use strict';var emlformat=require(_0x4017('0x0'));var rimraf=require(_0x4017('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4017('0x2'));var rp=require(_0x4017('0x3'));var moment=require(_0x4017('0x4'));var BPromise=require(_0x4017('0x5'));var Mustache=require(_0x4017('0x6'));var util=require(_0x4017('0x7'));var path=require(_0x4017('0x8'));var sox=require(_0x4017('0x9'));var csv=require(_0x4017('0xa'));var ejs=require(_0x4017('0xb'));var fs=require('fs');var fs_extra=require(_0x4017('0xc'));var _=require(_0x4017('0xd'));var squel=require(_0x4017('0xe'));var crypto=require(_0x4017('0xf'));var jsforce=require(_0x4017('0x10'));var deskjs=require(_0x4017('0x11'));var toCsv=require(_0x4017('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4017('0x12'));var authService=require(_0x4017('0x13'));var qs=require(_0x4017('0x14'));var as=require(_0x4017('0x15'));var hardwareService=require(_0x4017('0x16'));var logger=require(_0x4017('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x4017('0x18'));var licenseUtil=require(_0x4017('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x535fd4,_0x44275f){_0x44275f=_0x44275f||0xcc;return function(_0x2a5ac3){if(_0x2a5ac3){return _0x535fd4[_0x4017('0x1a')](_0x44275f);}return _0x535fd4[_0x4017('0x1b')](_0x44275f)[_0x4017('0x1c')]();};}function respondWithResult(_0x58af97,_0x50a443){_0x50a443=_0x50a443||0xc8;return function(_0x2b1acb){if(_0x2b1acb){return _0x58af97[_0x4017('0x1b')](_0x50a443)[_0x4017('0x1d')](_0x2b1acb);}};}function respondWithFilteredResult(_0x1a9d17,_0xb037b9){return function(_0x53d156){if(_0x53d156){var _0x568611=typeof _0xb037b9[_0x4017('0x1e')]===_0x4017('0x1f')&&typeof _0xb037b9[_0x4017('0x20')]===_0x4017('0x1f');var _0x452b94=_0x53d156[_0x4017('0x21')];var _0x32ad82=_0x568611?0x0:_0xb037b9['offset'];var _0x1a44f9=_0x568611?_0x53d156[_0x4017('0x21')]:_0xb037b9['offset']+_0xb037b9[_0x4017('0x20')];var _0x1da423;if(_0x1a44f9>=_0x452b94){_0x1a44f9=_0x452b94;_0x1da423=0xc8;}else{_0x1da423=0xce;}_0x1a9d17[_0x4017('0x1b')](_0x1da423);return _0x1a9d17[_0x4017('0x22')](_0x4017('0x23'),_0x32ad82+'-'+_0x1a44f9+'/'+_0x452b94)[_0x4017('0x1d')](_0x53d156);}return null;};}function patchUpdates(_0x2336f4){return function(_0x54ae28){try{jsonpatch['apply'](_0x54ae28,_0x2336f4,!![]);}catch(_0x18d940){return BPromise[_0x4017('0x24')](_0x18d940);}return _0x54ae28['save']();};}function saveUpdates(_0x4583f4,_0x1b430e){return function(_0xabb56d){if(_0xabb56d){return _0xabb56d[_0x4017('0x25')](_0x4583f4)['then'](function(_0x41acb6){return _0x41acb6;});}return null;};}function removeEntity(_0x25f8e4,_0x55c15a){return function(_0x1fb893){if(_0x1fb893){return _0x1fb893['destroy']()[_0x4017('0x26')](function(){_0x25f8e4[_0x4017('0x1b')](0xcc)[_0x4017('0x1c')]();});}};}function handleEntityNotFound(_0x3be294,_0x22f3e0){return function(_0x303423){if(!_0x303423){_0x3be294[_0x4017('0x1a')](0x194);}return _0x303423;};}function handleError(_0x38d0d7,_0x436b28){_0x436b28=_0x436b28||0x1f4;return function(_0x3305f6){logger['error'](_0x3305f6[_0x4017('0x27')]);if(_0x3305f6[_0x4017('0x28')]){delete _0x3305f6[_0x4017('0x28')];}_0x38d0d7[_0x4017('0x1b')](_0x436b28)[_0x4017('0x29')](_0x3305f6);};}exports[_0x4017('0x2a')]=function(_0x24e87e,_0x4e8859){var _0x5cb748={},_0x3b5240={},_0x2dcd85={'count':0x0,'rows':[]};var _0x259df0=_[_0x4017('0x2b')](db['Migration'][_0x4017('0x2c')],function(_0x65c4e9){return{'name':_0x65c4e9[_0x4017('0x2d')],'type':_0x65c4e9[_0x4017('0x2e')][_0x4017('0x2f')]};});_0x3b5240['model']=_[_0x4017('0x2b')](_0x259df0,_0x4017('0x28'));_0x3b5240[_0x4017('0x30')]=_['keys'](_0x24e87e[_0x4017('0x30')]);_0x3b5240[_0x4017('0x31')]=_[_0x4017('0x32')](_0x3b5240[_0x4017('0x33')],_0x3b5240[_0x4017('0x30')]);_0x5cb748[_0x4017('0x34')]=_[_0x4017('0x32')](_0x3b5240[_0x4017('0x33')],qs[_0x4017('0x35')](_0x24e87e[_0x4017('0x30')][_0x4017('0x35')]));_0x5cb748[_0x4017('0x34')]=_0x5cb748[_0x4017('0x34')][_0x4017('0x36')]?_0x5cb748[_0x4017('0x34')]:_0x3b5240['model'];if(!_0x24e87e[_0x4017('0x30')]['hasOwnProperty'](_0x4017('0x37'))){_0x5cb748['limit']=qs[_0x4017('0x20')](_0x24e87e[_0x4017('0x30')]['limit']);_0x5cb748[_0x4017('0x1e')]=qs[_0x4017('0x1e')](_0x24e87e[_0x4017('0x30')][_0x4017('0x1e')]);}_0x5cb748['order']=qs[_0x4017('0x38')](_0x24e87e[_0x4017('0x30')][_0x4017('0x38')]);_0x5cb748[_0x4017('0x39')]=qs['filters'](_[_0x4017('0x3a')](_0x24e87e[_0x4017('0x30')],_0x3b5240['filters']),_0x259df0);if(_0x24e87e['query'][_0x4017('0x3b')]){_0x5cb748[_0x4017('0x39')]=_[_0x4017('0x3c')](_0x5cb748[_0x4017('0x39')],{'$or':_[_0x4017('0x2b')](_0x259df0,function(_0x4a9f47){if(_0x4a9f47[_0x4017('0x2e')]!==_0x4017('0x3d')){var _0x368f8b={};_0x368f8b[_0x4a9f47['name']]={'$like':'%'+_0x24e87e['query'][_0x4017('0x3b')]+'%'};return _0x368f8b;}})});}_0x5cb748=_[_0x4017('0x3c')]({},_0x5cb748,_0x24e87e['options']);var _0x12c049={'where':_0x5cb748[_0x4017('0x39')]};return db[_0x4017('0x3e')][_0x4017('0x21')](_0x12c049)[_0x4017('0x26')](function(_0x3220c1){_0x2dcd85[_0x4017('0x21')]=_0x3220c1;if(_0x24e87e[_0x4017('0x30')][_0x4017('0x3f')]){_0x5cb748[_0x4017('0x40')]=[{'all':!![]}];}return db[_0x4017('0x3e')][_0x4017('0x41')](_0x5cb748);})[_0x4017('0x26')](function(_0x1fe17b){_0x2dcd85[_0x4017('0x42')]=_0x1fe17b;return _0x2dcd85;})[_0x4017('0x26')](respondWithFilteredResult(_0x4e8859,_0x5cb748))[_0x4017('0x43')](handleError(_0x4e8859,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index ca60029..659d605 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 _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 +var _0x4731=['migrations','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','Migration'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x4731,0x1bd));var _0x1473=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x4731[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0x1473('0x0'));var util=require(_0x1473('0x1'));var logger=require(_0x1473('0x2'))(_0x1473('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1473('0x4'));var fs=require('fs');var path=require(_0x1473('0x5'));var rimraf=require(_0x1473('0x6'));var config=require(_0x1473('0x7'));var attributes=require(_0x1473('0x8'));module[_0x1473('0x9')]=function(_0x16ef58,_0x43dbc3){return _0x16ef58['define'](_0x1473('0xa'),attributes,{'tableName':_0x1473('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 712d5b3..55c3dfa 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 _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 +var _0x878f=['../../config/logger','rpc','../../config/environment','jayson/promise','request','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5b4ffc,_0x283aa3){var _0x42ba2a=function(_0x85585c){while(--_0x85585c){_0x5b4ffc['push'](_0x5b4ffc['shift']());}};_0x42ba2a(++_0x283aa3);}(_0x878f,0x173));var _0xf878=function(_0xfc0dd6,_0x2feabf){_0xfc0dd6=_0xfc0dd6-0x0;var _0x2f87e1=_0x878f[_0xfc0dd6];return _0x2f87e1;};'use strict';var _=require('lodash');var util=require(_0xf878('0x0'));var moment=require(_0xf878('0x1'));var BPromise=require(_0xf878('0x2'));var rs=require(_0xf878('0x3'));var fs=require('fs');var Redis=require(_0xf878('0x4'));var db=require(_0xf878('0x5'))['db'];var utils=require(_0xf878('0x6'));var logger=require(_0xf878('0x7'))(_0xf878('0x8'));var config=require(_0xf878('0x9'));var jayson=require(_0xf878('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c5f5c,_0x62b420,_0x59e564){return new BPromise(function(_0x52851e,_0x530767){return client[_0xf878('0xb')](_0x3c5f5c,_0x59e564)['then'](function(_0x4a9d79){logger[_0xf878('0xc')](_0xf878('0xd'),_0x62b420,_0xf878('0xe'));logger['debug'](_0xf878('0xf'),_0x62b420,_0xf878('0xe'),JSON['stringify'](_0x4a9d79));if(_0x4a9d79[_0xf878('0x10')]){if(_0x4a9d79['error'][_0xf878('0x11')]===0x1f4){logger[_0xf878('0x10')](_0xf878('0xd'),_0x62b420,_0x4a9d79['error'][_0xf878('0x12')]);return _0x530767(_0x4a9d79[_0xf878('0x10')][_0xf878('0x12')]);}logger['error'](_0xf878('0xd'),_0x62b420,_0x4a9d79[_0xf878('0x10')][_0xf878('0x12')]);return _0x52851e(_0x4a9d79['error']['message']);}else{logger[_0xf878('0xc')](_0xf878('0xd'),_0x62b420,_0xf878('0xe'));_0x52851e(_0x4a9d79[_0xf878('0x13')][_0xf878('0x12')]);}})[_0xf878('0x14')](function(_0x415056){logger[_0xf878('0x10')](_0xf878('0xd'),_0x62b420,_0x415056);_0x530767(_0x415056);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index d35f23b..d88069d 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 _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 +var _0x09d2=['post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0xac0de1,_0x12d3d9){var _0x1c1995=function(_0x3f96e8){while(--_0x3f96e8){_0xac0de1['push'](_0xac0de1['shift']());}};_0x1c1995(++_0x12d3d9);}(_0x09d2,0x1d2));var _0x209d=function(_0x39be46,_0x5d503f){_0x39be46=_0x39be46-0x0;var _0x35f305=_0x09d2[_0x39be46];return _0x35f305;};'use strict';var multer=require(_0x209d('0x0'));var util=require(_0x209d('0x1'));var path=require(_0x209d('0x2'));var timeout=require(_0x209d('0x3'));var express=require(_0x209d('0x4'));var router=express[_0x209d('0x5')]();var fs_extra=require(_0x209d('0x6'));var auth=require(_0x209d('0x7'));var interaction=require(_0x209d('0x8'));var config=require(_0x209d('0x9'));var controller=require('./network.controller');router[_0x209d('0xa')]('/',auth[_0x209d('0xb')](),controller[_0x209d('0xc')]);router[_0x209d('0xa')](_0x209d('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x209d('0xe')]('/',auth[_0x209d('0xb')](),controller[_0x209d('0xf')]);router['put'](_0x209d('0xd'),auth['isAuthenticated'](),controller[_0x209d('0x10')]);router[_0x209d('0x11')](_0x209d('0xd'),auth[_0x209d('0xb')](),controller[_0x209d('0x12')]);module[_0x209d('0x13')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 1c37927..c007c16 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 _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 +var _0xeeb8=['externip','stun','turn','STRING','sequelize','exports','localnet'];(function(_0x1dd28b,_0x37c08c){var _0x2a9a50=function(_0x515581){while(--_0x515581){_0x1dd28b['push'](_0x1dd28b['shift']());}};_0x2a9a50(++_0x37c08c);}(_0xeeb8,0x7b));var _0x8eeb=function(_0x3eec90,_0x3dfafe){_0x3eec90=_0x3eec90-0x0;var _0x3c79b5=_0xeeb8[_0x3eec90];return _0x3c79b5;};'use strict';var Sequelize=require(_0x8eeb('0x0'));module[_0x8eeb('0x1')]={'type':{'type':Sequelize['ENUM'](_0x8eeb('0x2'),_0x8eeb('0x3'),_0x8eeb('0x4'),_0x8eeb('0x5'))},'value':{'type':Sequelize[_0x8eeb('0x6')]},'username':{'type':Sequelize[_0x8eeb('0x6')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 37d4480..73d3654 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 _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 +var _0x02d7=['undefined','count','offset','set','Content-Range','destroy','end','sendStatus','name','send','index','map','Network','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','show','params','options','find','catch','body','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','Reload','create','res_stun_monitor.so','TURN','join','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','update','/etc/asterisk/stun_xcally.conf','util','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','status','json','limit'];(function(_0x334641,_0x34648b){var _0x467db4=function(_0x188cc7){while(--_0x188cc7){_0x334641['push'](_0x334641['shift']());}};_0x467db4(++_0x34648b);}(_0x02d7,0x191));var _0x702d=function(_0x308527,_0x146bed){_0x308527=_0x308527-0x0;var _0x31ad08=_0x02d7[_0x308527];return _0x31ad08;};'use strict';var util=require(_0x702d('0x0'));var path=require('path');var ejs=require(_0x702d('0x1'));var fs=require('fs');var _=require(_0x702d('0x2'));var qs=require(_0x702d('0x3'));var logger=require(_0x702d('0x4'))(_0x702d('0x5'));var config=require(_0x702d('0x6'));var db=require(_0x702d('0x7'))['db'];var jayson=require(_0x702d('0x8'));var client=jayson[_0x702d('0x9')][_0x702d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1bbed5,_0x3d8541,_0x5369a0,_0x1b6240){return new Promise(function(_0x50e8ec,_0x3fb324){var _0x46655f=_0x1b6240||client;return _0x46655f[_0x702d('0xb')](_0x1bbed5,_0x5369a0)[_0x702d('0xc')](function(_0x23ea6f){logger[_0x702d('0xd')](_0x702d('0xe'),_0x3d8541,'request\x20sent');logger[_0x702d('0xf')](_0x702d('0x10'),_0x3d8541,_0x702d('0x11'),JSON['stringify'](_0x23ea6f));if(_0x23ea6f[_0x702d('0x12')]){if(_0x23ea6f[_0x702d('0x12')]['code']===0x1f4){logger[_0x702d('0x12')]('Network,\x20%s,\x20%s',_0x3d8541,_0x23ea6f[_0x702d('0x12')][_0x702d('0x13')]);return _0x3fb324(_0x23ea6f['error'][_0x702d('0x13')]);}logger['error'](_0x702d('0xe'),_0x3d8541,_0x23ea6f[_0x702d('0x12')][_0x702d('0x13')]);return _0x50e8ec(_0x23ea6f[_0x702d('0x12')][_0x702d('0x13')]);}else{logger['info']('Network,\x20%s,\x20%s',_0x3d8541,_0x702d('0x11'));_0x50e8ec(_0x23ea6f[_0x702d('0x14')]['message']);}})['catch'](function(_0x2a2a42){logger[_0x702d('0x12')](_0x702d('0xe'),_0x3d8541,_0x2a2a42);_0x3fb324(_0x2a2a42);});});}function respondWithResult(_0x5ed8b9,_0x1cfec5){_0x1cfec5=_0x1cfec5||0xc8;return function(_0xc871e1){if(_0xc871e1){return _0x5ed8b9[_0x702d('0x15')](_0x1cfec5)[_0x702d('0x16')](_0xc871e1);}};}function respondWithFilteredResult(_0x412bb5,_0x1f8125){return function(_0x58368e){if(_0x58368e){var _0x5cc976=typeof _0x1f8125['offset']==='undefined'&&typeof _0x1f8125[_0x702d('0x17')]===_0x702d('0x18');var _0x1e1762=_0x58368e[_0x702d('0x19')];var _0x11c884=_0x5cc976?0x0:_0x1f8125[_0x702d('0x1a')];var _0x4481de=_0x5cc976?_0x58368e[_0x702d('0x19')]:_0x1f8125[_0x702d('0x1a')]+_0x1f8125[_0x702d('0x17')];var _0x1ece68;if(_0x4481de>=_0x1e1762){_0x4481de=_0x1e1762;_0x1ece68=0xc8;}else{_0x1ece68=0xce;}_0x412bb5['status'](_0x1ece68);return _0x412bb5[_0x702d('0x1b')](_0x702d('0x1c'),_0x11c884+'-'+_0x4481de+'/'+_0x1e1762)[_0x702d('0x16')](_0x58368e);}return null;};}function saveUpdates(_0x495d89){return function(_0x5ca7cc){if(_0x5ca7cc){return _0x5ca7cc['update'](_0x495d89)[_0x702d('0xc')](function(_0x2a9168){return _0x2a9168;});}return null;};}function removeEntity(_0x185ffb){return function(_0x583885){if(_0x583885){return _0x583885[_0x702d('0x1d')]()[_0x702d('0xc')](function(){_0x185ffb[_0x702d('0x15')](0xcc)[_0x702d('0x1e')]();});}};}function handleEntityNotFound(_0x2b50aa){return function(_0x2c377c){if(!_0x2c377c){_0x2b50aa[_0x702d('0x1f')](0x194);}return _0x2c377c;};}function handleError(_0x836cd1,_0x4adc79){_0x4adc79=_0x4adc79||0x1f4;return function(_0x460267){logger[_0x702d('0x12')](_0x460267['stack']);if(_0x460267[_0x702d('0x20')]){delete _0x460267[_0x702d('0x20')];}_0x836cd1['status'](_0x4adc79)[_0x702d('0x21')](_0x460267);};}exports[_0x702d('0x22')]=function(_0x22809b,_0x4de718){var _0x10d169={},_0x50e484={},_0x58624e={'count':0x0,'rows':[]};var _0x529531=_[_0x702d('0x23')](db[_0x702d('0x24')][_0x702d('0x25')],function(_0x4610c8){return{'name':_0x4610c8['fieldName'],'type':_0x4610c8['type']['key']};});_0x50e484['model']=_[_0x702d('0x23')](_0x529531,_0x702d('0x20'));_0x50e484[_0x702d('0x26')]=_[_0x702d('0x27')](_0x22809b[_0x702d('0x26')]);_0x50e484[_0x702d('0x28')]=_[_0x702d('0x29')](_0x50e484[_0x702d('0x2a')],_0x50e484[_0x702d('0x26')]);_0x10d169['attributes']=_[_0x702d('0x29')](_0x50e484[_0x702d('0x2a')],qs[_0x702d('0x2b')](_0x22809b[_0x702d('0x26')][_0x702d('0x2b')]));_0x10d169[_0x702d('0x2c')]=_0x10d169[_0x702d('0x2c')][_0x702d('0x2d')]?_0x10d169[_0x702d('0x2c')]:_0x50e484['model'];if(!_0x22809b['query']['hasOwnProperty'](_0x702d('0x2e'))){_0x10d169[_0x702d('0x17')]=qs['limit'](_0x22809b[_0x702d('0x26')][_0x702d('0x17')]);_0x10d169[_0x702d('0x1a')]=qs[_0x702d('0x1a')](_0x22809b[_0x702d('0x26')][_0x702d('0x1a')]);}_0x10d169[_0x702d('0x2f')]=qs[_0x702d('0x30')](_0x22809b[_0x702d('0x26')]['sort']);_0x10d169[_0x702d('0x31')]=qs[_0x702d('0x28')](_[_0x702d('0x32')](_0x22809b[_0x702d('0x26')],_0x50e484[_0x702d('0x28')]),_0x529531);if(_0x22809b[_0x702d('0x26')][_0x702d('0x33')]){_0x10d169['where']=_[_0x702d('0x34')](_0x10d169[_0x702d('0x31')],{'$or':_[_0x702d('0x23')](_0x529531,function(_0x47ae59){if(_0x47ae59[_0x702d('0x35')]!==_0x702d('0x36')){var _0x26e044={};_0x26e044[_0x47ae59[_0x702d('0x20')]]={'$like':'%'+_0x22809b[_0x702d('0x26')]['filter']+'%'};return _0x26e044;}})});}_0x10d169=_[_0x702d('0x34')]({},_0x10d169,_0x22809b['options']);var _0x4aab70={'where':_0x10d169[_0x702d('0x31')]};return db[_0x702d('0x24')][_0x702d('0x19')](_0x4aab70)[_0x702d('0xc')](function(_0x2b2228){_0x58624e['count']=_0x2b2228;if(_0x22809b[_0x702d('0x26')][_0x702d('0x37')]){_0x10d169[_0x702d('0x38')]=[{'all':!![]}];}return db[_0x702d('0x24')][_0x702d('0x39')](_0x10d169);})[_0x702d('0xc')](function(_0x2cc7c7){_0x58624e['rows']=_0x2cc7c7;return _0x58624e;})['then'](respondWithFilteredResult(_0x4de718,_0x10d169))['catch'](handleError(_0x4de718,null));};exports[_0x702d('0x3a')]=function(_0x505c1c,_0x59c88c){var _0x459b7c={'raw':!![],'where':{'id':_0x505c1c[_0x702d('0x3b')]['id']}},_0x4c401c={};_0x4c401c[_0x702d('0x2a')]=_[_0x702d('0x27')](db['Network'][_0x702d('0x25')]);_0x4c401c['query']=_['keys'](_0x505c1c[_0x702d('0x26')]);_0x4c401c[_0x702d('0x28')]=_[_0x702d('0x29')](_0x4c401c[_0x702d('0x2a')],_0x4c401c[_0x702d('0x26')]);_0x459b7c[_0x702d('0x2c')]=_[_0x702d('0x29')](_0x4c401c[_0x702d('0x2a')],qs[_0x702d('0x2b')](_0x505c1c['query'][_0x702d('0x2b')]));_0x459b7c['attributes']=_0x459b7c[_0x702d('0x2c')][_0x702d('0x2d')]?_0x459b7c['attributes']:_0x4c401c[_0x702d('0x2a')];if(_0x505c1c[_0x702d('0x26')][_0x702d('0x37')]){_0x459b7c['include']=[{'all':!![]}];}_0x459b7c=_[_0x702d('0x34')]({},_0x459b7c,_0x505c1c[_0x702d('0x3c')]);return db['Network'][_0x702d('0x3d')](_0x459b7c)[_0x702d('0xc')](handleEntityNotFound(_0x59c88c,null))[_0x702d('0xc')](respondWithResult(_0x59c88c,null))[_0x702d('0x3e')](handleError(_0x59c88c,null));};exports['create']=function(_0x13bb25,_0x1e6c6e){var _0x1a3903;return db[_0x702d('0x24')]['create'](_0x13bb25[_0x702d('0x3f')],{'raw':!![]})[_0x702d('0xc')](function(_0x31e82c){_0x1a3903=_0x31e82c;return db[_0x702d('0x24')][_0x702d('0x39')]({'where':{'type':_0x13bb25[_0x702d('0x3f')][_0x702d('0x35')]},'raw':!![]});})['then'](function(_0x53aaec){if(_0x1a3903[_0x702d('0x35')][_0x702d('0x40')]()==_0x702d('0x41')){var _0x4e00e8=fs[_0x702d('0x42')](path['join'](config[_0x702d('0x43')],_0x702d('0x44')),_0x702d('0x45'));var _0x107a49=ejs[_0x702d('0x46')](_0x4e00e8,{'networks':_0x53aaec||[]});fs[_0x702d('0x47')]('/etc/asterisk/stun_xcally.conf',_0x107a49);return respondWithRpcPromise(_0x702d('0x48'),_0x702d('0x49'),{'module':_0x702d('0x4a')});}else if(_0x1a3903[_0x702d('0x35')]['toUpperCase']()==_0x702d('0x4b')){var _0x197863=fs['readFileSync'](path[_0x702d('0x4c')](config['root'],_0x702d('0x4d')),_0x702d('0x45'));var _0x3888ce=ejs['render'](_0x197863,{'networks':_0x53aaec||[]});fs[_0x702d('0x47')](_0x702d('0x4e'),_0x3888ce);return respondWithRpcPromise(_0x702d('0x48'),_0x702d('0x49'),{'module':_0x702d('0x4a')});}else{var _0x4840cc=fs[_0x702d('0x42')](path['join'](config[_0x702d('0x43')],'server/files/templates/network.ejs'),_0x702d('0x45'));var _0x4395d0=ejs['render'](_0x4840cc,{'networks':_0x53aaec||[]});fs['writeFileSync'](util[_0x702d('0x4f')](_0x702d('0x50'),_0x13bb25[_0x702d('0x3f')][_0x702d('0x35')][_0x702d('0x51')]()),_0x4395d0);return respondWithRpcPromise('Reload',_0x702d('0x49'),{'module':_0x702d('0x52')});}})[_0x702d('0xc')](function(){return _0x1a3903;})[_0x702d('0xc')](respondWithResult(_0x1e6c6e,0xc9))['catch'](handleError(_0x1e6c6e,null));};exports['update']=function(_0x249cba,_0x26ab2b){var _0x6e96;return db[_0x702d('0x24')][_0x702d('0x3d')]({'where':{'id':_0x249cba['params']['id']}})[_0x702d('0xc')](handleEntityNotFound(_0x26ab2b,null))['then'](saveUpdates(_0x249cba['body'],null))[_0x702d('0xc')](function(_0x3f3023){if(_0x3f3023){_0x6e96=_0x3f3023;return db[_0x702d('0x24')]['findAll']({'where':{'type':_0x6e96[_0x702d('0x35')]},'raw':!![]});}return null;})['then'](function(_0x5ae097){if(_0x6e96['type'][_0x702d('0x40')]()==_0x702d('0x41')){var _0x1c9122=fs['readFileSync'](path[_0x702d('0x4c')](config['root'],_0x702d('0x44')),_0x702d('0x45'));var _0x2bf079=ejs[_0x702d('0x46')](_0x1c9122,{'networks':_0x5ae097||[]});fs[_0x702d('0x47')]('/etc/asterisk/stun_xcally.conf',_0x2bf079);return respondWithRpcPromise(_0x702d('0x48'),'update',{'module':'res_stun_monitor.so'});}else if(_0x6e96[_0x702d('0x35')][_0x702d('0x40')]()==_0x702d('0x4b')){var _0x36b805=fs[_0x702d('0x42')](path[_0x702d('0x4c')](config[_0x702d('0x43')],'server/files/templates/turn_multiple.ejs'),_0x702d('0x45'));var _0x1b8985=ejs[_0x702d('0x46')](_0x36b805,{'networks':_0x5ae097||[]});fs[_0x702d('0x47')]('/etc/asterisk/turn_xcally.conf',_0x1b8985);return respondWithRpcPromise(_0x702d('0x48'),_0x702d('0x53'),{'module':_0x702d('0x4a')});}else{var _0x484dd5=fs[_0x702d('0x42')](path[_0x702d('0x4c')](config[_0x702d('0x43')],'server/files/templates/network.ejs'),_0x702d('0x45'));var _0x503cb1=ejs[_0x702d('0x46')](_0x484dd5,{'networks':_0x5ae097||[]});fs[_0x702d('0x47')](util[_0x702d('0x4f')](_0x702d('0x50'),_0x249cba[_0x702d('0x3f')][_0x702d('0x35')]['toLowerCase']()),_0x503cb1);return respondWithRpcPromise(_0x702d('0x48'),_0x702d('0x53'),{'module':_0x702d('0x52')});}})[_0x702d('0xc')](function(_0x27fc3a){if(_0x27fc3a){return _0x6e96;}return null;})[_0x702d('0xc')](respondWithResult(_0x26ab2b,null))[_0x702d('0x3e')](handleError(_0x26ab2b,null));};exports[_0x702d('0x1d')]=function(_0x5c952d,_0x24fe85){var _0x21064a;return db[_0x702d('0x24')][_0x702d('0x3d')]({'where':{'id':_0x5c952d[_0x702d('0x3b')]['id']}})[_0x702d('0xc')](function(_0xca6294){_0x21064a=_0xca6294;return _0xca6294;})[_0x702d('0xc')](handleEntityNotFound(_0x24fe85,null))[_0x702d('0xc')](removeEntity(_0x24fe85,null))[_0x702d('0xc')](function(){if(_0x21064a){return db['Network'][_0x702d('0x39')]({'where':{'type':_0x21064a[_0x702d('0x35')]},'raw':!![]});}})[_0x702d('0xc')](function(_0x22d47d){if(_0x21064a[_0x702d('0x35')][_0x702d('0x40')]()==_0x702d('0x41')){var _0x36e47b=fs[_0x702d('0x42')](path[_0x702d('0x4c')](config['root'],_0x702d('0x44')),_0x702d('0x45'));var _0x2b563b=ejs[_0x702d('0x46')](_0x36e47b,{'networks':_0x22d47d||[]});fs[_0x702d('0x47')](_0x702d('0x54'),_0x2b563b);return respondWithRpcPromise(_0x702d('0x48'),_0x702d('0x1d'),{'module':_0x702d('0x4a')});}else if(_0x21064a[_0x702d('0x35')][_0x702d('0x40')]()==_0x702d('0x4b')){var _0x2cde74=fs[_0x702d('0x42')](path['join'](config[_0x702d('0x43')],_0x702d('0x4d')),_0x702d('0x45'));var _0x4bfdbb=ejs['render'](_0x2cde74,{'networks':_0x22d47d||[]});fs[_0x702d('0x47')]('/etc/asterisk/turn_xcally.conf',_0x4bfdbb);return respondWithRpcPromise(_0x702d('0x48'),_0x702d('0x1d'),{'module':_0x702d('0x4a')});}else{var _0x2e726f=fs['readFileSync'](path[_0x702d('0x4c')](config[_0x702d('0x43')],'server/files/templates/network.ejs'),_0x702d('0x45'));var _0x1b2eee=ejs[_0x702d('0x46')](_0x2e726f,{'networks':_0x22d47d||[]});fs['writeFileSync'](util[_0x702d('0x4f')](_0x702d('0x50'),_0x21064a[_0x702d('0x35')][_0x702d('0x51')]()),_0x1b2eee);return respondWithRpcPromise('Reload',_0x702d('0x1d'),{'module':_0x702d('0x52')});}})[_0x702d('0x3e')](handleError(_0x24fe85,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index e8bfff6..8ce036f 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 _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 +var _0x0c5d=['api','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','lodash','util'];(function(_0x4692a8,_0x2d4d8d){var _0x2ec246=function(_0x1a373b){while(--_0x1a373b){_0x4692a8['push'](_0x4692a8['shift']());}};_0x2ec246(++_0x2d4d8d);}(_0x0c5d,0x6c));var _0xd0c5=function(_0x48afc7,_0x1a5335){_0x48afc7=_0x48afc7-0x0;var _0x384b5e=_0x0c5d[_0x48afc7];return _0x384b5e;};'use strict';var _=require(_0xd0c5('0x0'));var util=require(_0xd0c5('0x1'));var logger=require('../../config/logger')(_0xd0c5('0x2'));var moment=require('moment');var BPromise=require(_0xd0c5('0x3'));var rp=require(_0xd0c5('0x4'));var fs=require('fs');var path=require(_0xd0c5('0x5'));var rimraf=require(_0xd0c5('0x6'));var config=require(_0xd0c5('0x7'));var attributes=require(_0xd0c5('0x8'));module[_0xd0c5('0x9')]=function(_0x121911,_0x569992){return _0x121911[_0xd0c5('0xa')]('Network',attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index d64ff1e..51fa0d4 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(_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 +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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x21391a,_0x403fb9){_0x21391a=_0x21391a-0x0;var _0x2a27c2=_0x7a54[_0x21391a];return _0x2a27c2;};'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 88d6122..10f70ae 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 _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 +var _0x02ea=['removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','addApplications','addAgents','put','/:id','update','delete','destroy'];(function(_0x3cffde,_0x4b06da){var _0x464490=function(_0x16ce67){while(--_0x16ce67){_0x3cffde['push'](_0x3cffde['shift']());}};_0x464490(++_0x4b06da);}(_0x02ea,0x1cb));var _0xa02e=function(_0x38987f,_0xc79720){_0x38987f=_0x38987f-0x0;var _0x4cb697=_0x02ea[_0x38987f];return _0x4cb697;};'use strict';var multer=require(_0xa02e('0x0'));var util=require(_0xa02e('0x1'));var path=require(_0xa02e('0x2'));var timeout=require(_0xa02e('0x3'));var express=require(_0xa02e('0x4'));var router=express[_0xa02e('0x5')]();var fs_extra=require(_0xa02e('0x6'));var auth=require(_0xa02e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa02e('0x8'));var controller=require('./openchannelAccount.controller');router[_0xa02e('0x9')]('/',auth[_0xa02e('0xa')](),controller[_0xa02e('0xb')]);router[_0xa02e('0x9')]('/describe',auth[_0xa02e('0xa')](),controller['describe']);router['get']('/:id',auth[_0xa02e('0xa')](),controller[_0xa02e('0xc')]);router[_0xa02e('0x9')](_0xa02e('0xd'),auth[_0xa02e('0xa')](),controller['getDispositions']);router[_0xa02e('0x9')](_0xa02e('0xe'),auth[_0xa02e('0xa')](),controller[_0xa02e('0xf')]);router['get']('/:id/applications',auth[_0xa02e('0xa')](),controller[_0xa02e('0x10')]);router['get'](_0xa02e('0x11'),auth[_0xa02e('0xa')](),controller[_0xa02e('0x12')]);router['get'](_0xa02e('0x13'),auth[_0xa02e('0xa')](),controller[_0xa02e('0x14')]);router[_0xa02e('0x15')]('/',auth[_0xa02e('0xa')](),controller[_0xa02e('0x16')]);router[_0xa02e('0x15')](_0xa02e('0xd'),auth['isAuthenticated'](),controller[_0xa02e('0x17')]);router[_0xa02e('0x15')](_0xa02e('0xe'),auth[_0xa02e('0xa')](),controller[_0xa02e('0x18')]);router['post'](_0xa02e('0x19'),controller[_0xa02e('0x1a')]);router[_0xa02e('0x15')](_0xa02e('0x1b'),auth[_0xa02e('0xa')](),controller[_0xa02e('0x1c')]);router[_0xa02e('0x15')](_0xa02e('0x13'),auth[_0xa02e('0xa')](),controller[_0xa02e('0x1d')]);router['post']('/:id/send',auth[_0xa02e('0xa')](),controller['send']);router[_0xa02e('0x1e')](_0xa02e('0x1f'),auth['isAuthenticated'](),controller[_0xa02e('0x20')]);router[_0xa02e('0x21')](_0xa02e('0x1f'),auth[_0xa02e('0xa')](),controller[_0xa02e('0x22')]);router[_0xa02e('0x21')](_0xa02e('0xd'),auth[_0xa02e('0xa')](),controller[_0xa02e('0x23')]);router[_0xa02e('0x21')](_0xa02e('0xe'),auth['isAuthenticated'](),controller[_0xa02e('0x24')]);router[_0xa02e('0x21')]('/:id/users',auth[_0xa02e('0xa')](),controller[_0xa02e('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 6f7c4ee..d8474c6 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 _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 +var _0xcd75=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x3afd24,_0x132824){var _0x488fad=function(_0x39719f){while(--_0x39719f){_0x3afd24['push'](_0x3afd24['shift']());}};_0x488fad(++_0x132824);}(_0xcd75,0x19a));var _0x5cd7=function(_0x5e38d4,_0x5da333){_0x5e38d4=_0x5e38d4-0x0;var _0x4b010f=_0xcd75[_0x5e38d4];return _0x4b010f;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x5cd7('0x0')]={'name':{'type':Sequelize[_0x5cd7('0x1')],'unique':_0x5cd7('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x5cd7('0x1')]},'token':{'type':Sequelize[_0x5cd7('0x1')],'defaultValue':function(){return rs[_0x5cd7('0x3')]();}},'replyUri':{'type':Sequelize[_0x5cd7('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x5cd7('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5cd7('0x4')],'defaultValue':function(){return _0x5cd7('0x5');}},'notificationSound':{'type':Sequelize[_0x5cd7('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5cd7('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5cd7('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5cd7('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x5cd7('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5cd7('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5cd7('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5cd7('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x5cd7('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x5cd7('0x6')],'defaultValue':![],'comment':_0x5cd7('0x9'),'set':function(_0x23ec6){if(!_0x23ec6)this[_0x5cd7('0xa')](_0x5cd7('0xb'),null);this[_0x5cd7('0xa')](_0x5cd7('0xc'),_0x23ec6);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index ef0b1b9..7561830 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 _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 +var _0xaafc=['crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','json','limit','offset','count','apply','reject','save','update','destroy','OpenchannelAccounts','UserProfileResource','end','sendStatus','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','include','findAll','rows','params','includeAll','options','create','body','user','get','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','Sequelize','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','OpenchannelApplication','Applications','applications','list','orderBy','asc','account','defaults','lastName','threadId','OpenchannelInteraction','ContactId','contact','firstName','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','queue','Start','startRouting','EventManager','addApplications','sequelize','transaction','ISOLATION_LEVELS','priority','stack','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','spread','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','push','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','lodash','squel'];(function(_0x5bc105,_0x2ff002){var _0x26468f=function(_0x511642){while(--_0x511642){_0x5bc105['push'](_0x5bc105['shift']());}};_0x26468f(++_0x2ff002);}(_0xaafc,0x176));var _0xcaaf=function(_0xd8abb1,_0x3e2bae){_0xd8abb1=_0xd8abb1-0x0;var _0x5ca637=_0xaafc[_0xd8abb1];return _0x5ca637;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcaaf('0x0'));var zipdir=require(_0xcaaf('0x1'));var jsonpatch=require(_0xcaaf('0x2'));var rp=require(_0xcaaf('0x3'));var moment=require('moment');var BPromise=require(_0xcaaf('0x4'));var Mustache=require(_0xcaaf('0x5'));var util=require('util');var path=require('path');var sox=require(_0xcaaf('0x6'));var csv=require('to-csv');var ejs=require(_0xcaaf('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcaaf('0x8'));var squel=require(_0xcaaf('0x9'));var crypto=require(_0xcaaf('0xa'));var jsforce=require(_0xcaaf('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xcaaf('0xc'));var querystring=require('querystring');var Papa=require(_0xcaaf('0xd'));var Redis=require('ioredis');var authService=require(_0xcaaf('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xcaaf('0xf'));var hardwareService=require(_0xcaaf('0x10'));var logger=require(_0xcaaf('0x11'))(_0xcaaf('0x12'));var utils=require(_0xcaaf('0x13'));var config=require(_0xcaaf('0x14'));var licenseUtil=require(_0xcaaf('0x15'));var db=require(_0xcaaf('0x16'))['db'];config[_0xcaaf('0x17')]=_['defaults'](config[_0xcaaf('0x17')],{'host':_0xcaaf('0x18'),'port':0x18eb});var socket=require(_0xcaaf('0x19'))(new Redis(config[_0xcaaf('0x17')]));require(_0xcaaf('0x1a'))[_0xcaaf('0x1b')](socket);var jayson=require(_0xcaaf('0x1c'));var client=jayson[_0xcaaf('0x1d')][_0xcaaf('0x1e')]({'port':0x232c});var client9002=jayson[_0xcaaf('0x1d')][_0xcaaf('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x552cf1,_0x301344,_0xb8532b,_0x7f23fb){return new BPromise(function(_0x3bb678,_0x3580ac){var _0x360078=_0x7f23fb||client;return _0x360078['request'](_0x552cf1,_0xb8532b)[_0xcaaf('0x1f')](function(_0x10ad54){logger['info'](_0xcaaf('0x20'),_0x301344,_0xcaaf('0x21'));logger[_0xcaaf('0x22')](_0xcaaf('0x23'),_0x301344,_0xcaaf('0x21'),JSON[_0xcaaf('0x24')](_0x10ad54));if(_0x10ad54[_0xcaaf('0x25')]){if(_0x10ad54[_0xcaaf('0x25')][_0xcaaf('0x26')]===0x1f4){logger[_0xcaaf('0x25')](_0xcaaf('0x20'),_0x301344,_0x10ad54['error'][_0xcaaf('0x27')]);return _0x3580ac(_0x10ad54[_0xcaaf('0x25')][_0xcaaf('0x27')]);}logger[_0xcaaf('0x25')](_0xcaaf('0x20'),_0x301344,_0x10ad54[_0xcaaf('0x25')][_0xcaaf('0x27')]);return _0x3bb678(_0x10ad54['error'][_0xcaaf('0x27')]);}else{logger[_0xcaaf('0x28')](_0xcaaf('0x20'),_0x301344,'request\x20sent');_0x3bb678(_0x10ad54[_0xcaaf('0x29')][_0xcaaf('0x27')]);}})[_0xcaaf('0x2a')](function(_0x3dac7d){logger[_0xcaaf('0x25')](_0xcaaf('0x20'),_0x301344,_0x3dac7d);_0x3580ac(_0x3dac7d);});});}function respondWithStatusCode(_0x1cc1fb,_0x4ffbab){_0x4ffbab=_0x4ffbab||0xcc;return function(_0x387319){if(_0x387319){return _0x1cc1fb['sendStatus'](_0x4ffbab);}return _0x1cc1fb['status'](_0x4ffbab)['end']();};}function respondWithResult(_0x30d68a,_0x85b4a){_0x85b4a=_0x85b4a||0xc8;return function(_0x149dbb){if(_0x149dbb){return _0x30d68a[_0xcaaf('0x2b')](_0x85b4a)[_0xcaaf('0x2c')](_0x149dbb);}};}function respondWithFilteredResult(_0x35e500,_0x20be72){return function(_0x34019c){if(_0x34019c){var _0x1523bc=typeof _0x20be72['offset']==='undefined'&&typeof _0x20be72[_0xcaaf('0x2d')]==='undefined';var _0x4429e3=_0x34019c['count'];var _0x343cd5=_0x1523bc?0x0:_0x20be72[_0xcaaf('0x2e')];var _0x2e8530=_0x1523bc?_0x34019c[_0xcaaf('0x2f')]:_0x20be72['offset']+_0x20be72[_0xcaaf('0x2d')];var _0x2d0881;if(_0x2e8530>=_0x4429e3){_0x2e8530=_0x4429e3;_0x2d0881=0xc8;}else{_0x2d0881=0xce;}_0x35e500[_0xcaaf('0x2b')](_0x2d0881);return _0x35e500['set']('Content-Range',_0x343cd5+'-'+_0x2e8530+'/'+_0x4429e3)[_0xcaaf('0x2c')](_0x34019c);}return null;};}function patchUpdates(_0xe1207f){return function(_0x5696e4){try{jsonpatch[_0xcaaf('0x30')](_0x5696e4,_0xe1207f,!![]);}catch(_0x315565){return BPromise[_0xcaaf('0x31')](_0x315565);}return _0x5696e4[_0xcaaf('0x32')]();};}function saveUpdates(_0x427510,_0x3cdf87){return function(_0x19135d){if(_0x19135d){return _0x19135d[_0xcaaf('0x33')](_0x427510)[_0xcaaf('0x1f')](function(_0x4f1eb1){return _0x4f1eb1;});}return null;};}function removeEntity(_0x48b018,_0x318e42){return function(_0x581c02){if(_0x581c02){return _0x581c02[_0xcaaf('0x34')]()[_0xcaaf('0x1f')](function(){var _0x73267e=_0x581c02['get']({'plain':!![]});var _0x5aae88=_0xcaaf('0x35');return db[_0xcaaf('0x36')]['destroy']({'where':{'type':_0x5aae88,'resourceId':_0x73267e['id']}})['then'](function(){return _0x581c02;});})[_0xcaaf('0x1f')](function(){_0x48b018[_0xcaaf('0x2b')](0xcc)[_0xcaaf('0x37')]();});}};}function handleEntityNotFound(_0x5be05f,_0x1000c0){return function(_0x47afbb){if(!_0x47afbb){_0x5be05f[_0xcaaf('0x38')](0x194);}return _0x47afbb;};}function handleError(_0x5bc988,_0x458cd5){_0x458cd5=_0x458cd5||0x1f4;return function(_0x44abfd){logger['error'](_0x44abfd['stack']);if(_0x44abfd[_0xcaaf('0x39')]){delete _0x44abfd[_0xcaaf('0x39')];}_0x5bc988['status'](_0x458cd5)[_0xcaaf('0x3a')](_0x44abfd);};}exports[_0xcaaf('0x3b')]=function(_0x4e91a8,_0x210268){var _0x4d428f={'include':[{'model':db[_0xcaaf('0x3c')],'as':_0xcaaf('0x3d')}]},_0x2ef2e7={},_0x139aa3={'count':0x0,'rows':[]};var _0x136a1f=_[_0xcaaf('0x3e')](db[_0xcaaf('0x3f')][_0xcaaf('0x40')],function(_0x26571b){return{'name':_0x26571b['fieldName'],'type':_0x26571b['type'][_0xcaaf('0x41')]};});_0x2ef2e7['model']=_[_0xcaaf('0x3e')](_0x136a1f,'name');_0x2ef2e7[_0xcaaf('0x42')]=_[_0xcaaf('0x43')](_0x4e91a8[_0xcaaf('0x42')]);_0x2ef2e7[_0xcaaf('0x44')]=_['intersection'](_0x2ef2e7[_0xcaaf('0x45')],_0x2ef2e7[_0xcaaf('0x42')]);_0x4d428f['attributes']=_[_0xcaaf('0x46')](_0x2ef2e7[_0xcaaf('0x45')],qs[_0xcaaf('0x47')](_0x4e91a8[_0xcaaf('0x42')][_0xcaaf('0x47')]));_0x4d428f[_0xcaaf('0x48')]=_0x4d428f[_0xcaaf('0x48')][_0xcaaf('0x49')]?_0x4d428f[_0xcaaf('0x48')]:_0x2ef2e7[_0xcaaf('0x45')];if(!_0x4e91a8[_0xcaaf('0x42')][_0xcaaf('0x4a')](_0xcaaf('0x4b'))){_0x4d428f[_0xcaaf('0x2d')]=qs[_0xcaaf('0x2d')](_0x4e91a8[_0xcaaf('0x42')]['limit']);_0x4d428f['offset']=qs['offset'](_0x4e91a8['query'][_0xcaaf('0x2e')]);}_0x4d428f[_0xcaaf('0x4c')]=qs[_0xcaaf('0x4d')](_0x4e91a8[_0xcaaf('0x42')]['sort']);_0x4d428f['where']=qs['filters'](_[_0xcaaf('0x4e')](_0x4e91a8[_0xcaaf('0x42')],_0x2ef2e7[_0xcaaf('0x44')]),_0x136a1f);if(_0x4e91a8[_0xcaaf('0x42')][_0xcaaf('0x4f')]){_0x4d428f[_0xcaaf('0x50')]=_[_0xcaaf('0x51')](_0x4d428f['where'],{'$or':_[_0xcaaf('0x3e')](_0x136a1f,function(_0x14ecbe){if(_0x14ecbe['type']!=='VIRTUAL'){var _0x5c95ed={};_0x5c95ed[_0x14ecbe[_0xcaaf('0x39')]]={'$like':'%'+_0x4e91a8[_0xcaaf('0x42')]['filter']+'%'};return _0x5c95ed;}})});}_0x4d428f=_[_0xcaaf('0x51')]({},_0x4d428f,_0x4e91a8['options']);var _0x510324={'where':_0x4d428f[_0xcaaf('0x50')]};return db[_0xcaaf('0x3f')][_0xcaaf('0x2f')](_0x510324)[_0xcaaf('0x1f')](function(_0x1e1321){_0x139aa3[_0xcaaf('0x2f')]=_0x1e1321;if(_0x4e91a8[_0xcaaf('0x42')]['includeAll']){_0x4d428f[_0xcaaf('0x52')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0xcaaf('0x53')](_0x4d428f);})[_0xcaaf('0x1f')](function(_0x17676b){_0x139aa3[_0xcaaf('0x54')]=_0x17676b;return _0x139aa3;})['then'](respondWithFilteredResult(_0x210268,_0x4d428f))[_0xcaaf('0x2a')](handleError(_0x210268,null));};exports['show']=function(_0x10e4d6,_0x421da7){var _0x30c4ac={'raw':![],'where':{'id':_0x10e4d6[_0xcaaf('0x55')]['id']},'include':[{'model':db[_0xcaaf('0x3c')],'as':_0xcaaf('0x3d')}]},_0x111270={};_0x111270[_0xcaaf('0x45')]=_['keys'](db[_0xcaaf('0x3f')][_0xcaaf('0x40')]);_0x111270['query']=_[_0xcaaf('0x43')](_0x10e4d6['query']);_0x111270[_0xcaaf('0x44')]=_[_0xcaaf('0x46')](_0x111270['model'],_0x111270[_0xcaaf('0x42')]);_0x30c4ac[_0xcaaf('0x48')]=_['intersection'](_0x111270[_0xcaaf('0x45')],qs['fields'](_0x10e4d6[_0xcaaf('0x42')]['fields']));_0x30c4ac[_0xcaaf('0x48')]=_0x30c4ac[_0xcaaf('0x48')][_0xcaaf('0x49')]?_0x30c4ac[_0xcaaf('0x48')]:_0x111270[_0xcaaf('0x45')];if(_0x10e4d6[_0xcaaf('0x42')][_0xcaaf('0x56')]){_0x30c4ac[_0xcaaf('0x52')]=[{'all':!![]}];}_0x30c4ac=_[_0xcaaf('0x51')]({},_0x30c4ac,_0x10e4d6[_0xcaaf('0x57')]);return db[_0xcaaf('0x3f')]['find'](_0x30c4ac)[_0xcaaf('0x1f')](handleEntityNotFound(_0x421da7,null))[_0xcaaf('0x1f')](respondWithResult(_0x421da7,null))[_0xcaaf('0x2a')](handleError(_0x421da7,null));};exports[_0xcaaf('0x58')]=function(_0x3ca2a5,_0x1771ff){return db[_0xcaaf('0x3f')][_0xcaaf('0x58')](_0x3ca2a5[_0xcaaf('0x59')],{})[_0xcaaf('0x1f')](function(_0x497059){var _0x545ee1=_0x3ca2a5[_0xcaaf('0x5a')][_0xcaaf('0x5b')]({'plain':!![]});if(!_0x545ee1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x545ee1[_0xcaaf('0x5c')]===_0xcaaf('0x5a')){var _0x49d439=_0x497059[_0xcaaf('0x5b')]({'plain':!![]});var _0x46ff21='OpenchannelAccounts';return db[_0xcaaf('0x5d')][_0xcaaf('0x5e')]({'where':{'name':_0x46ff21,'userProfileId':_0x545ee1[_0xcaaf('0x5f')]},'raw':!![]})['then'](function(_0x1d6ed9){if(_0x1d6ed9&&_0x1d6ed9[_0xcaaf('0x60')]===0x0){return db[_0xcaaf('0x36')][_0xcaaf('0x58')]({'name':_0x49d439[_0xcaaf('0x39')],'resourceId':_0x49d439['id'],'type':_0x1d6ed9[_0xcaaf('0x39')],'sectionId':_0x1d6ed9['id']},{})[_0xcaaf('0x1f')](function(){return _0x497059;});}else{return _0x497059;}})['catch'](function(_0x4f5505){logger[_0xcaaf('0x25')](_0xcaaf('0x61'),_0x4f5505);throw _0x4f5505;});}return _0x497059;})[_0xcaaf('0x1f')](respondWithResult(_0x1771ff,0xc9))['catch'](handleError(_0x1771ff,null));};exports[_0xcaaf('0x33')]=function(_0x327470,_0x5c26c6){if(_0x327470[_0xcaaf('0x59')]['id']){delete _0x327470[_0xcaaf('0x59')]['id'];}return db[_0xcaaf('0x3f')][_0xcaaf('0x5e')]({'where':{'id':_0x327470[_0xcaaf('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0xcaaf('0x3d')}]})[_0xcaaf('0x1f')](handleEntityNotFound(_0x5c26c6,null))[_0xcaaf('0x1f')](saveUpdates(_0x327470[_0xcaaf('0x59')],null))[_0xcaaf('0x1f')](respondWithResult(_0x5c26c6,null))[_0xcaaf('0x2a')](handleError(_0x5c26c6,null));};exports[_0xcaaf('0x34')]=function(_0x4fff23,_0xc03f8d){return db['OpenchannelAccount'][_0xcaaf('0x5e')]({'where':{'id':_0x4fff23['params']['id']}})[_0xcaaf('0x1f')](handleEntityNotFound(_0xc03f8d,null))[_0xcaaf('0x1f')](removeEntity(_0xc03f8d,null))[_0xcaaf('0x2a')](handleError(_0xc03f8d,null));};exports[_0xcaaf('0x62')]=function(_0x45b258,_0x231ca0){return db['OpenchannelAccount'][_0xcaaf('0x62')]()[_0xcaaf('0x1f')](respondWithResult(_0x231ca0,null))[_0xcaaf('0x2a')](handleError(_0x231ca0,null));};exports[_0xcaaf('0x63')]=function(_0x1bed8f,_0x18f5b2,_0x630ffd){if(_0x1bed8f[_0xcaaf('0x59')]['id']){delete _0x1bed8f[_0xcaaf('0x59')]['id'];}return db[_0xcaaf('0x3f')]['find']({'where':{'id':_0x1bed8f[_0xcaaf('0x55')]['id']}})['then'](handleEntityNotFound(_0x18f5b2,null))[_0xcaaf('0x1f')](function(_0x31e456){if(_0x31e456){_0x1bed8f[_0xcaaf('0x59')][_0xcaaf('0x64')]=_0x31e456['id'];return db['Disposition'][_0xcaaf('0x58')](_0x1bed8f[_0xcaaf('0x59')]);}})[_0xcaaf('0x1f')](respondWithResult(_0x18f5b2,null))[_0xcaaf('0x2a')](handleError(_0x18f5b2,null));};exports[_0xcaaf('0x65')]=function(_0x4af983,_0x126741,_0x128bf6){var _0x36f486={'raw':![],'where':{}};var _0x392e12={};var _0x11424a={'count':0x0,'rows':[]};return db[_0xcaaf('0x3f')][_0xcaaf('0x66')]({'where':{'id':_0x4af983[_0xcaaf('0x55')]['id']}})['then'](handleEntityNotFound(_0x126741,null))[_0xcaaf('0x1f')](function(_0x51a2e2){if(_0x51a2e2){_0x392e12[_0xcaaf('0x45')]=_[_0xcaaf('0x43')](db[_0xcaaf('0x67')][_0xcaaf('0x40')]);_0x392e12['query']=_[_0xcaaf('0x43')](_0x4af983['query']);_0x392e12[_0xcaaf('0x44')]=_[_0xcaaf('0x46')](_0x392e12[_0xcaaf('0x45')],_0x392e12[_0xcaaf('0x42')]);_0x36f486[_0xcaaf('0x48')]=_['intersection'](_0x392e12['model'],qs[_0xcaaf('0x47')](_0x4af983[_0xcaaf('0x42')][_0xcaaf('0x47')]));_0x36f486[_0xcaaf('0x48')]=_0x36f486[_0xcaaf('0x48')][_0xcaaf('0x49')]?_0x36f486['attributes']:_0x392e12[_0xcaaf('0x45')];if(!_0x4af983[_0xcaaf('0x42')]['hasOwnProperty'](_0xcaaf('0x4b'))){_0x36f486['limit']=qs[_0xcaaf('0x2d')](_0x4af983[_0xcaaf('0x42')]['limit']);_0x36f486['offset']=qs[_0xcaaf('0x2e')](_0x4af983[_0xcaaf('0x42')][_0xcaaf('0x2e')]);}_0x36f486[_0xcaaf('0x4c')]=qs[_0xcaaf('0x4d')](_0x4af983[_0xcaaf('0x42')][_0xcaaf('0x4d')]);_0x36f486[_0xcaaf('0x50')]=qs[_0xcaaf('0x44')](_[_0xcaaf('0x4e')](_0x4af983[_0xcaaf('0x42')],_0x392e12[_0xcaaf('0x44')]));_0x36f486[_0xcaaf('0x50')]['OpenchannelAccountId']=_0x51a2e2['id'];if(_0x4af983[_0xcaaf('0x42')][_0xcaaf('0x4f')]){_0x36f486[_0xcaaf('0x50')]=_[_0xcaaf('0x51')](_0x36f486[_0xcaaf('0x50')],{'$or':_[_0xcaaf('0x3e')](_0x36f486['attributes'],function(_0x529cc9){var _0x297b44={};_0x297b44[_0x529cc9]={'$like':'%'+_0x4af983['query'][_0xcaaf('0x4f')]+'%'};return _0x297b44;})});}_0x36f486=_[_0xcaaf('0x51')]({},_0x36f486,_0x4af983['options']);return db[_0xcaaf('0x67')][_0xcaaf('0x2f')]({'where':_0x36f486['where']})[_0xcaaf('0x1f')](function(_0x3f472c){_0x11424a[_0xcaaf('0x2f')]=_0x3f472c;if(_0x4af983[_0xcaaf('0x42')][_0xcaaf('0x56')]){_0x36f486[_0xcaaf('0x52')]=[{'all':!![]}];}return db[_0xcaaf('0x67')]['findAll'](_0x36f486);})[_0xcaaf('0x1f')](function(_0x45de45){_0x11424a[_0xcaaf('0x54')]=_0x45de45;return _0x11424a;});}})[_0xcaaf('0x1f')](respondWithFilteredResult(_0x126741,_0x36f486))[_0xcaaf('0x2a')](handleError(_0x126741,null));};exports['removeDispositions']=function(_0x21a704,_0x4e32a9,_0x13bf97){return db['OpenchannelAccount'][_0xcaaf('0x5e')]({'where':{'id':_0x21a704['params']['id']}})['then'](handleEntityNotFound(_0x4e32a9,null))[_0xcaaf('0x1f')](function(_0x31113e){if(_0x31113e){return _0x31113e[_0xcaaf('0x68')](_0x21a704[_0xcaaf('0x42')][_0xcaaf('0x69')]);}})['then'](respondWithStatusCode(_0x4e32a9,null))[_0xcaaf('0x2a')](handleError(_0x4e32a9,null));};exports[_0xcaaf('0x6a')]=function(_0x1c75e1,_0x1d19c9,_0x5d358a){if(_0x1c75e1['body']['id']){delete _0x1c75e1['body']['id'];}return db[_0xcaaf('0x3f')][_0xcaaf('0x5e')]({'where':{'id':_0x1c75e1[_0xcaaf('0x55')]['id']}})['then'](handleEntityNotFound(_0x1d19c9,null))[_0xcaaf('0x1f')](function(_0x216853){if(_0x216853){_0x1c75e1['body']['OpenchannelAccountId']=_0x216853['id'];return db[_0xcaaf('0x6b')][_0xcaaf('0x58')](_0x1c75e1['body']);}})['then'](respondWithResult(_0x1d19c9,null))['catch'](handleError(_0x1d19c9,null));};exports[_0xcaaf('0x6c')]=function(_0xf998a0,_0xd7242f,_0x25c427){var _0x1dc3af={'raw':![],'where':{}};var _0x4b6eba={};var _0x496194={'count':0x0,'rows':[]};return db[_0xcaaf('0x3f')][_0xcaaf('0x66')]({'where':{'id':_0xf998a0['params']['id']}})[_0xcaaf('0x1f')](handleEntityNotFound(_0xd7242f,null))[_0xcaaf('0x1f')](function(_0x5e2e3b){if(_0x5e2e3b){_0x4b6eba[_0xcaaf('0x45')]=_[_0xcaaf('0x43')](db[_0xcaaf('0x6b')][_0xcaaf('0x40')]);_0x4b6eba[_0xcaaf('0x42')]=_[_0xcaaf('0x43')](_0xf998a0[_0xcaaf('0x42')]);_0x4b6eba[_0xcaaf('0x44')]=_[_0xcaaf('0x46')](_0x4b6eba[_0xcaaf('0x45')],_0x4b6eba['query']);_0x1dc3af[_0xcaaf('0x48')]=_[_0xcaaf('0x46')](_0x4b6eba[_0xcaaf('0x45')],qs['fields'](_0xf998a0[_0xcaaf('0x42')][_0xcaaf('0x47')]));_0x1dc3af[_0xcaaf('0x48')]=_0x1dc3af[_0xcaaf('0x48')]['length']?_0x1dc3af[_0xcaaf('0x48')]:_0x4b6eba['model'];if(!_0xf998a0['query'][_0xcaaf('0x4a')](_0xcaaf('0x4b'))){_0x1dc3af['limit']=qs[_0xcaaf('0x2d')](_0xf998a0[_0xcaaf('0x42')]['limit']);_0x1dc3af[_0xcaaf('0x2e')]=qs[_0xcaaf('0x2e')](_0xf998a0[_0xcaaf('0x42')]['offset']);}_0x1dc3af[_0xcaaf('0x4c')]=qs[_0xcaaf('0x4d')](_0xf998a0[_0xcaaf('0x42')][_0xcaaf('0x4d')]);_0x1dc3af[_0xcaaf('0x50')]=qs[_0xcaaf('0x44')](_[_0xcaaf('0x4e')](_0xf998a0[_0xcaaf('0x42')],_0x4b6eba[_0xcaaf('0x44')]));_0x1dc3af['where'][_0xcaaf('0x64')]=_0x5e2e3b['id'];if(_0xf998a0[_0xcaaf('0x42')]['filter']){_0x1dc3af['where']=_[_0xcaaf('0x51')](_0x1dc3af[_0xcaaf('0x50')],{'$or':_['map'](_0x1dc3af['attributes'],function(_0x812d19){var _0x36d3a6={};_0x36d3a6[_0x812d19]={'$like':'%'+_0xf998a0[_0xcaaf('0x42')][_0xcaaf('0x4f')]+'%'};return _0x36d3a6;})});}_0x1dc3af=_[_0xcaaf('0x51')]({},_0x1dc3af,_0xf998a0[_0xcaaf('0x57')]);return db[_0xcaaf('0x6b')][_0xcaaf('0x2f')]({'where':_0x1dc3af[_0xcaaf('0x50')]})[_0xcaaf('0x1f')](function(_0x4d5d54){_0x496194[_0xcaaf('0x2f')]=_0x4d5d54;if(_0xf998a0[_0xcaaf('0x42')][_0xcaaf('0x56')]){_0x1dc3af[_0xcaaf('0x52')]=[{'all':!![]}];}return db['CannedAnswer'][_0xcaaf('0x53')](_0x1dc3af);})[_0xcaaf('0x1f')](function(_0x11d5c0){_0x496194[_0xcaaf('0x54')]=_0x11d5c0;return _0x496194;});}})[_0xcaaf('0x1f')](respondWithFilteredResult(_0xd7242f,_0x1dc3af))[_0xcaaf('0x2a')](handleError(_0xd7242f,null));};exports[_0xcaaf('0x6d')]=function(_0x3ba3f7,_0x533b5d,_0x53ca62){return db['OpenchannelAccount'][_0xcaaf('0x5e')]({'where':{'id':_0x3ba3f7['params']['id']}})['then'](handleEntityNotFound(_0x533b5d,null))[_0xcaaf('0x1f')](function(_0x7f35ae){if(_0x7f35ae){return _0x7f35ae[_0xcaaf('0x6d')](_0x3ba3f7[_0xcaaf('0x42')][_0xcaaf('0x69')]);}})[_0xcaaf('0x1f')](respondWithStatusCode(_0x533b5d,null))[_0xcaaf('0x2a')](handleError(_0x533b5d,null));};exports[_0xcaaf('0x6e')]=function(_0x35b672,_0x551704,_0x29180c){var _0x43b83f={'body':_0x35b672['body'],'channel':_0xcaaf('0x6f')};var _0x28d162=[];var _0xe988f4=[];var _0x579117={};var _0x38ee91=![];return db[_0xcaaf('0x70')][_0xcaaf('0x62')]()[_0xcaaf('0x1f')](function(_0x24fafc){if(!_0x24fafc){throw new db['Sequelize'][(_0xcaaf('0x71'))](_0xcaaf('0x72'));}_0x28d162=_[_0xcaaf('0x73')](_[_0xcaaf('0x43')](_0x24fafc),[_0xcaaf('0x74'),_0xcaaf('0x75')]);_0xe988f4=_[_0xcaaf('0x73')](_[_0xcaaf('0x43')](_0x24fafc),[_0xcaaf('0x74'),_0xcaaf('0x75'),_0xcaaf('0x76'),_0xcaaf('0x77')]);if(_0x35b672[_0xcaaf('0x59')]['id']){delete _0x35b672['body']['id'];}if(_['isNil'](_0x35b672['body'][_0xcaaf('0x78')])){throw new db[(_0xcaaf('0x79'))][(_0xcaaf('0x71'))](_0xcaaf('0x7a'));}if(_[_0xcaaf('0x7b')](_0x35b672[_0xcaaf('0x59')][_0xcaaf('0x59')])||_0x35b672[_0xcaaf('0x59')][_0xcaaf('0x59')]===''){throw new db[(_0xcaaf('0x79'))]['ValidationError'](_0xcaaf('0x7c'));}if(_[_0xcaaf('0x7b')](_0x35b672[_0xcaaf('0x59')]['mapKey'])){throw new db[(_0xcaaf('0x79'))]['ValidationError'](_0xcaaf('0x7d')+_0xe988f4);}if(!_['includes'](_0xe988f4,_0x35b672[_0xcaaf('0x59')][_0xcaaf('0x7e')])){throw new db['Sequelize']['ValidationError'](_0xcaaf('0x7f')+_0xe988f4);}_0x579117[_0x35b672[_0xcaaf('0x59')][_0xcaaf('0x7e')]]=_0x35b672['body'][_0xcaaf('0x78')];})[_0xcaaf('0x1f')](function(){return db['OpenchannelAccount'][_0xcaaf('0x5e')]({'where':{'id':_0x35b672[_0xcaaf('0x55')]['id']},'include':[{'model':db['CmList'],'as':_0xcaaf('0x80'),'include':[{'model':db[_0xcaaf('0x70')],'as':_0xcaaf('0x81'),'where':_0x579117,'limit':0x1,'order':[[_0xcaaf('0x75'),_0xcaaf('0x82')]]}]},{'model':db[_0xcaaf('0x83')],'as':_0xcaaf('0x84')}]});})[_0xcaaf('0x1f')](handleEntityNotFound(_0x551704,null))[_0xcaaf('0x1f')](function(_0x51343b){if(_0x51343b&&_0x51343b[_0xcaaf('0x80')]){_0x43b83f['account']=_0x51343b;_0x43b83f[_0xcaaf('0x85')]=_0x51343b['Applications'];_0x43b83f[_0xcaaf('0x86')]=_0x51343b[_0xcaaf('0x80')];_0x43b83f['applications']=_[_0xcaaf('0x87')](_0x43b83f[_0xcaaf('0x85')],['priority'],[_0xcaaf('0x88')]);if(_0x43b83f[_0xcaaf('0x89')]['Applications']){delete _0x43b83f[_0xcaaf('0x89')][_0xcaaf('0x84')];}if(_0x43b83f[_0xcaaf('0x89')]['List']&&_0x43b83f[_0xcaaf('0x89')][_0xcaaf('0x80')]['Contacts'][_0xcaaf('0x49')]){return _0x43b83f[_0xcaaf('0x89')][_0xcaaf('0x80')][_0xcaaf('0x81')][0x0];}var _0x174a32=_[_0xcaaf('0x8a')](_0x35b672[_0xcaaf('0x59')],{'firstName':_0x35b672['body']['from'],'ListId':_0x51343b['ListId']});_0x174a32[_0x35b672[_0xcaaf('0x59')][_0xcaaf('0x7e')]]=_0x35b672['body'][_0xcaaf('0x78')];return db['CmContact'][_0xcaaf('0x58')](_0x174a32,{'fields':_0x28d162,'raw':!![]});}})['then'](handleEntityNotFound(_0x551704,null))[_0xcaaf('0x1f')](function(_0x3907d9){_0x43b83f['contact']=_0x3907d9;if(_0x3907d9){var _0x3ce344={'ContactId':_0x3907d9['id'],'OpenchannelAccountId':_0x35b672[_0xcaaf('0x55')]['id'],'from':(_0x3907d9['firstName']||'')+'\x20'+(_0x3907d9[_0xcaaf('0x8b')]||'')};var _0x27cbc6={'OpenchannelAccountId':_0x35b672[_0xcaaf('0x55')]['id'],'closed':![]};if(_0x35b672[_0xcaaf('0x59')][_0xcaaf('0x8c')]){_0x27cbc6[_0xcaaf('0x8c')]=_0x35b672[_0xcaaf('0x59')][_0xcaaf('0x8c')];return db[_0xcaaf('0x8d')]['find']({'where':_0x27cbc6})[_0xcaaf('0x1f')](function(_0x3742c6){if(_0x3742c6){return[_0x3742c6,![]];}_0x3ce344[_0xcaaf('0x8c')]=_0x35b672[_0xcaaf('0x59')]['threadId'];_0x3ce344['externalUrl']=_0x35b672[_0xcaaf('0x59')]['externalUrl'];return db[_0xcaaf('0x8d')]['create'](_0x3ce344)[_0xcaaf('0x1f')](function(_0x5aa581){return[_0x5aa581,!![]];});});}else{_0x27cbc6[_0xcaaf('0x8c')]=null;}_0x27cbc6[_0xcaaf('0x8e')]=_0x3907d9['id'];return db[_0xcaaf('0x8d')][_0xcaaf('0x5e')]({'where':_0x27cbc6})['then'](function(_0x442204){if(_0x442204){return[_0x442204,![]];}return db['OpenchannelInteraction'][_0xcaaf('0x58')](_0x3ce344)[_0xcaaf('0x1f')](function(_0x573a25){return[_0x573a25,!![]];});});}})['spread'](function(_0x420fbb,_0x2446d2){if(_0x420fbb){_0x38ee91=_0x2446d2;if(!_0x2446d2){var _0x3595a1={'from':(_0x43b83f[_0xcaaf('0x8f')][_0xcaaf('0x90')]||'')+'\x20'+(_0x43b83f[_0xcaaf('0x8f')][_0xcaaf('0x8b')]||'')};if(_0x35b672[_0xcaaf('0x59')][_0xcaaf('0x8c')]&&_0x35b672[_0xcaaf('0x59')][_0xcaaf('0x91')]&&_0x35b672[_0xcaaf('0x59')]['threadId']!=_0x35b672[_0xcaaf('0x59')][_0xcaaf('0x91')]){_0x3595a1[_0xcaaf('0x8c')]=_0x35b672[_0xcaaf('0x59')][_0xcaaf('0x91')];}return _0x420fbb[_0xcaaf('0x33')](_0x3595a1);}else{return _0x420fbb;}}})[_0xcaaf('0x1f')](function(_0x4ce662){_0x43b83f['interaction']=_0x4ce662[_0xcaaf('0x5b')]({'plain':!![]});_0x43b83f[_0xcaaf('0x92')]['created']=_0x38ee91;if(_0x43b83f[_0xcaaf('0x92')][_0xcaaf('0x93')]){if(_0x43b83f[_0xcaaf('0x89')][_0xcaaf('0x94')]){_0x43b83f[_0xcaaf('0x85')]['push']({'id':0x0,'priority':_0x43b83f[_0xcaaf('0x85')][_0xcaaf('0x49')]+0x1,'app':_0xcaaf('0x95'),'appdata':_0xcaaf('0x96'),'interval':_0xcaaf('0x97')});}}return db[_0xcaaf('0x98')]['create']({'body':_0x35b672[_0xcaaf('0x59')][_0xcaaf('0x59')],'OpenchannelAccountId':_0x35b672['params']['id'],'OpenchannelInteractionId':_0x4ce662['id'],'direction':'in','ContactId':_0x43b83f[_0xcaaf('0x8f')]['id'],'AttachmentId':_0x35b672[_0xcaaf('0x59')][_0xcaaf('0x99')]});})[_0xcaaf('0x1f')](function(_0x2d87b1){_0x43b83f[_0xcaaf('0x27')]=_0x2d87b1;if(!_0x43b83f[_0xcaaf('0x92')][_0xcaaf('0x9a')])return;return db[_0xcaaf('0x9b')]['find']({'attributes':['id',_0xcaaf('0x39')],'where':{'id':_0x43b83f[_0xcaaf('0x92')][_0xcaaf('0x9a')]}});})[_0xcaaf('0x1f')](function(_0x121bef){if(_0x121bef){_0x43b83f['applications'][_0xcaaf('0x9c')]({'id':0x0,'priority':0x0,'app':_0xcaaf('0x9d'),'appdata':_0x121bef['name']+','+(_0x43b83f[_0xcaaf('0x89')][_0xcaaf('0x9e')]||0xa),'interval':_0xcaaf('0x97')});}if(!_0x43b83f[_0xcaaf('0x92')][_0xcaaf('0x9f')])return;return db['OpenchannelQueue']['find']({'attributes':['id',_0xcaaf('0x39')],'where':{'id':_0x43b83f['interaction'][_0xcaaf('0x9f')]}});})[_0xcaaf('0x1f')](function(_0x4615c3){if(_0x4615c3){_0x43b83f[_0xcaaf('0x85')][_0xcaaf('0x9c')]({'id':0x0,'priority':0x1,'app':_0xcaaf('0xa0'),'appdata':_0x4615c3[_0xcaaf('0x39')]+','+(_0x43b83f[_0xcaaf('0x89')]['waitForTheAssignedQueue']||0x12c),'interval':_0xcaaf('0x97')});}return respondWithRpcPromise(_0xcaaf('0xa1'),_0xcaaf('0xa2'),_0x43b83f);})[_0xcaaf('0x1f')](function(_0x14bc83){respondWithRpcPromise(_0xcaaf('0xa3'),'EventManager',{'event':_0xcaaf('0x6e'),'message':_0x14bc83},client9002);return _0x14bc83;})['then'](respondWithResult(_0x551704,null))[_0xcaaf('0x2a')](handleError(_0x551704,null));};exports[_0xcaaf('0xa4')]=function(_0x3f5a30,_0x25175a){var _0x1ac238=_0x3f5a30['params']['id'];var _0x4ac839=_0x3f5a30[_0xcaaf('0x59')];var _0x1a18a4=0xc8;var _0x2ecfce=null;return db[_0xcaaf('0xa5')][_0xcaaf('0xa6')]({'isolationLevel':db[_0xcaaf('0xa5')]['Transaction'][_0xcaaf('0xa7')]['READ_COMMITTED']},function(_0x125d45){return db[_0xcaaf('0x3f')][_0xcaaf('0x66')]({'where':{'id':_0x1ac238},'transaction':_0x125d45})['then'](function(_0x196d2b){if(_0x196d2b){return db[_0xcaaf('0x83')][_0xcaaf('0x34')]({'where':{'OpenchannelAccountId':_0x1ac238},'transaction':_0x125d45})[_0xcaaf('0x1f')](function(){var _0x11fb95=_[_0xcaaf('0x3e')](_0x4ac839,function(_0x22dc1e){_0x22dc1e[_0xcaaf('0x64')]=_0x1ac238;return _0x22dc1e;});return db[_0xcaaf('0x83')]['bulkCreate'](_0x11fb95,{'transaction':_0x125d45});});}else{_0x1a18a4=0x194;_0x2ecfce=[];}});})[_0xcaaf('0x1f')](function(){if(_0x1a18a4!==0x194){return db[_0xcaaf('0x83')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x1ac238},'order':_0xcaaf('0xa8')})['then'](function(_0x1da9e3){_0x2ecfce=_0x1da9e3;});}})['catch'](function(_0x5039d1){_0x1a18a4=0x1f4;logger[_0xcaaf('0x25')](_0x5039d1[_0xcaaf('0xa9')]);if(_0x5039d1[_0xcaaf('0x39')]){delete _0x5039d1[_0xcaaf('0x39')];}_0x2ecfce=_0x5039d1;})['finally'](function(){if(_0x2ecfce===null){_0x25175a[_0xcaaf('0x38')](_0x1a18a4);}else{if(_0x1a18a4===0x1f4){_0x25175a[_0xcaaf('0x2b')](_0x1a18a4)[_0xcaaf('0x3a')](_0x2ecfce);}else{_0x25175a['status'](_0x1a18a4)[_0xcaaf('0x2c')](_0x2ecfce);}}});};exports['getApplications']=function(_0x4cb8e8,_0xa7037a,_0x42d82e){var _0x38ad54={};var _0x2e968c={};var _0x2a07b8;var _0xedbac3;return db[_0xcaaf('0x3f')][_0xcaaf('0x66')]({'where':{'id':_0x4cb8e8['params']['id']}})[_0xcaaf('0x1f')](handleEntityNotFound(_0xa7037a,null))[_0xcaaf('0x1f')](function(_0x58055a){if(_0x58055a){_0x2a07b8=_0x58055a;_0x2e968c[_0xcaaf('0x45')]=_['keys'](db[_0xcaaf('0x83')]['rawAttributes']);_0x2e968c[_0xcaaf('0x42')]=_['keys'](_0x4cb8e8[_0xcaaf('0x42')]);_0x2e968c[_0xcaaf('0x44')]=_[_0xcaaf('0x46')](_0x2e968c[_0xcaaf('0x45')],_0x2e968c['query']);_0x38ad54['attributes']=_[_0xcaaf('0x46')](_0x2e968c['model'],qs['fields'](_0x4cb8e8[_0xcaaf('0x42')][_0xcaaf('0x47')]));_0x38ad54[_0xcaaf('0x48')]=_0x38ad54[_0xcaaf('0x48')][_0xcaaf('0x49')]?_0x38ad54[_0xcaaf('0x48')]:_0x2e968c[_0xcaaf('0x45')];_0x38ad54['order']=qs[_0xcaaf('0x4d')](_0x4cb8e8['query'][_0xcaaf('0x4d')]);_0x38ad54[_0xcaaf('0x50')]=qs[_0xcaaf('0x44')](_[_0xcaaf('0x4e')](_0x4cb8e8[_0xcaaf('0x42')],_0x2e968c[_0xcaaf('0x44')]));if(_0x4cb8e8[_0xcaaf('0x42')]['filter']){_0x38ad54[_0xcaaf('0x50')]=_[_0xcaaf('0x51')](_0x38ad54['where'],{'$or':_[_0xcaaf('0x3e')](_0x38ad54[_0xcaaf('0x48')],function(_0x10b64b){var _0x57d0db={};_0x57d0db[_0x10b64b]={'$like':'%'+_0x4cb8e8[_0xcaaf('0x42')][_0xcaaf('0x4f')]+'%'};return _0x57d0db;})});}_0x38ad54=_[_0xcaaf('0x51')]({},_0x38ad54,_0x4cb8e8[_0xcaaf('0x57')]);return _0x2a07b8[_0xcaaf('0xaa')](_0x38ad54);}})[_0xcaaf('0x1f')](function(_0x421c10){if(_0x421c10){_0xedbac3=_0x421c10['length'];if(!_0x4cb8e8[_0xcaaf('0x42')][_0xcaaf('0x4a')]('nolimit')){_0x38ad54['limit']=qs[_0xcaaf('0x2d')](_0x4cb8e8[_0xcaaf('0x42')]['limit']);_0x38ad54[_0xcaaf('0x2e')]=qs[_0xcaaf('0x2e')](_0x4cb8e8['query']['offset']);}return _0x2a07b8['getApplications'](_0x38ad54);}})[_0xcaaf('0x1f')](function(_0x575c99){if(_0x575c99){return _0x575c99?{'count':_0xedbac3,'rows':_0x575c99}:null;}})['then'](respondWithResult(_0xa7037a,null))[_0xcaaf('0x2a')](handleError(_0xa7037a,null));};exports[_0xcaaf('0xab')]=function(_0x6d69c3,_0xc3ee82,_0x5b5ea0){var _0x904289={'raw':![],'where':{}};var _0x1e6954={};var _0x4e4b93={'count':0x0,'rows':[]};return db[_0xcaaf('0x3f')][_0xcaaf('0x66')]({'where':{'id':_0x6d69c3[_0xcaaf('0x55')]['id']}})['then'](handleEntityNotFound(_0xc3ee82,null))['then'](function(_0x4b4ffe){if(_0x4b4ffe){_0x1e6954[_0xcaaf('0x45')]=_[_0xcaaf('0x43')](db[_0xcaaf('0x8d')]['rawAttributes']);_0x1e6954['query']=_['keys'](_0x6d69c3[_0xcaaf('0x42')]);_0x1e6954[_0xcaaf('0x44')]=_[_0xcaaf('0x46')](_0x1e6954['model'],_0x1e6954[_0xcaaf('0x42')]);_0x904289['attributes']=_[_0xcaaf('0x46')](_0x1e6954['model'],qs['fields'](_0x6d69c3[_0xcaaf('0x42')]['fields']));_0x904289[_0xcaaf('0x48')]=_0x904289[_0xcaaf('0x48')][_0xcaaf('0x49')]?_0x904289[_0xcaaf('0x48')]:_0x1e6954['model'];if(!_0x6d69c3[_0xcaaf('0x42')][_0xcaaf('0x4a')](_0xcaaf('0x4b'))){_0x904289[_0xcaaf('0x2d')]=qs[_0xcaaf('0x2d')](_0x6d69c3['query'][_0xcaaf('0x2d')]);_0x904289[_0xcaaf('0x2e')]=qs[_0xcaaf('0x2e')](_0x6d69c3[_0xcaaf('0x42')][_0xcaaf('0x2e')]);}_0x904289[_0xcaaf('0x4c')]=qs[_0xcaaf('0x4d')](_0x6d69c3['query']['sort']);_0x904289['where']=qs[_0xcaaf('0x44')](_[_0xcaaf('0x4e')](_0x6d69c3['query'],_0x1e6954['filters']));_0x904289['where']['OpenchannelAccountId']=_0x4b4ffe['id'];if(_0x6d69c3[_0xcaaf('0x42')]['filter']){_0x904289['where']=_[_0xcaaf('0x51')](_0x904289[_0xcaaf('0x50')],{'$or':_['map'](_0x904289['attributes'],function(_0x383b66){var _0x32db8e={};_0x32db8e[_0x383b66]={'$like':'%'+_0x6d69c3[_0xcaaf('0x42')][_0xcaaf('0x4f')]+'%'};return _0x32db8e;})});}_0x904289=_['merge']({},_0x904289,_0x6d69c3[_0xcaaf('0x57')]);return db[_0xcaaf('0x8d')][_0xcaaf('0x2f')]({'where':_0x904289[_0xcaaf('0x50')]})[_0xcaaf('0x1f')](function(_0x4c32c3){_0x4e4b93[_0xcaaf('0x2f')]=_0x4c32c3;if(_0x6d69c3[_0xcaaf('0x42')][_0xcaaf('0x56')]){_0x904289[_0xcaaf('0x52')]=[{'model':db[_0xcaaf('0x70')],'as':_0xcaaf('0xac'),'required':![]},{'model':db[_0xcaaf('0x9b')],'as':_0xcaaf('0xad'),'attributes':[_0xcaaf('0x39'),_0xcaaf('0xae'),_0xcaaf('0xaf')],'required':![]},{'model':db[_0xcaaf('0xb0')],'as':_0xcaaf('0xb1'),'attributes':['id',_0xcaaf('0x39'),_0xcaaf('0xb2')],'where':_0x6d69c3[_0xcaaf('0x42')]['tag']?{'id':_0x6d69c3[_0xcaaf('0x42')]['tag']}:undefined,'required':_0x6d69c3[_0xcaaf('0x42')][_0xcaaf('0xb3')]?!![]:![]}];}return db[_0xcaaf('0x8d')][_0xcaaf('0x53')](_0x904289);})[_0xcaaf('0x1f')](function(_0x2fcb83){_0x4e4b93[_0xcaaf('0x54')]=_0x2fcb83;return _0x4e4b93;});}})['then'](respondWithFilteredResult(_0xc3ee82,_0x904289))[_0xcaaf('0x2a')](handleError(_0xc3ee82,null));};exports[_0xcaaf('0xb4')]=function(_0x586345,_0x2fdb86,_0x2cf1b9){return db[_0xcaaf('0x3f')]['find']({'where':{'id':_0x586345[_0xcaaf('0x55')]['id']}})[_0xcaaf('0x1f')](handleEntityNotFound(_0x2fdb86,null))[_0xcaaf('0x1f')](function(_0x18d56c){if(_0x18d56c){return _0x18d56c[_0xcaaf('0xb4')](_0x586345[_0xcaaf('0x59')][_0xcaaf('0x69')],_[_0xcaaf('0xb5')](_0x586345['body'],[_0xcaaf('0x69'),'id'])||{})[_0xcaaf('0xb6')](function(_0x17210b){for(var _0x1e479e=0x0;_0x1e479e<_0x586345['body'][_0xcaaf('0x69')]['length'];_0x1e479e+=0x1){socket[_0xcaaf('0xb7')]('userOpenchannelAccount:save',{'UserId':Number(_0x586345[_0xcaaf('0x59')][_0xcaaf('0x69')][_0x1e479e]),'OpenchannelAccountId':Number(_0x586345['params']['id'])});}return _0x17210b;});}})[_0xcaaf('0x1f')](respondWithResult(_0x2fdb86,null))[_0xcaaf('0x2a')](handleError(_0x2fdb86,null));};exports[_0xcaaf('0xb8')]=function(_0x5a6ebe,_0x4c2506,_0x2e6617){return db[_0xcaaf('0x3f')][_0xcaaf('0x5e')]({'where':{'id':_0x5a6ebe[_0xcaaf('0x55')]['id']}})[_0xcaaf('0x1f')](handleEntityNotFound(_0x4c2506,null))[_0xcaaf('0x1f')](function(_0x1a9084){if(_0x1a9084){return _0x1a9084[_0xcaaf('0xb8')](_0x5a6ebe['query'][_0xcaaf('0x69')])['then'](function(){if(_[_0xcaaf('0xb9')](_0x5a6ebe[_0xcaaf('0x42')][_0xcaaf('0x69')])){for(var _0x20ee5a=0x0;_0x20ee5a<_0x5a6ebe[_0xcaaf('0x42')][_0xcaaf('0x69')][_0xcaaf('0x49')];_0x20ee5a+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x5a6ebe[_0xcaaf('0x42')][_0xcaaf('0x69')][_0x20ee5a]),'OpenchannelAccountId':Number(_0x5a6ebe[_0xcaaf('0x55')]['id'])});}}else{socket['emit'](_0xcaaf('0xba'),{'UserId':Number(_0x5a6ebe[_0xcaaf('0x42')]['ids']),'OpenchannelAccountId':Number(_0x5a6ebe[_0xcaaf('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x4c2506,null))[_0xcaaf('0x2a')](handleError(_0x4c2506,null));};exports[_0xcaaf('0xbb')]=function(_0x3c780d,_0x9f09e5,_0x1af10d){var _0x3f4d4c={};var _0x40e8d7={};var _0x23c417;var _0x27df32;return db['OpenchannelAccount'][_0xcaaf('0x66')]({'where':{'id':_0x3c780d[_0xcaaf('0x55')]['id']}})[_0xcaaf('0x1f')](handleEntityNotFound(_0x9f09e5,null))['then'](function(_0x44c20f){if(_0x44c20f){_0x23c417=_0x44c20f;_0x40e8d7[_0xcaaf('0x45')]=_['keys'](db[_0xcaaf('0x9b')][_0xcaaf('0x40')]);_0x40e8d7[_0xcaaf('0x42')]=_[_0xcaaf('0x43')](_0x3c780d[_0xcaaf('0x42')]);_0x40e8d7[_0xcaaf('0x44')]=_['intersection'](_0x40e8d7['model'],_0x40e8d7[_0xcaaf('0x42')]);_0x3f4d4c[_0xcaaf('0x48')]=_['intersection'](_0x40e8d7['model'],qs[_0xcaaf('0x47')](_0x3c780d[_0xcaaf('0x42')]['fields']));_0x3f4d4c['attributes']=_0x3f4d4c['attributes'][_0xcaaf('0x49')]?_0x3f4d4c[_0xcaaf('0x48')]:_0x40e8d7[_0xcaaf('0x45')];_0x3f4d4c[_0xcaaf('0x4c')]=qs[_0xcaaf('0x4d')](_0x3c780d[_0xcaaf('0x42')][_0xcaaf('0x4d')]);_0x3f4d4c[_0xcaaf('0x50')]=qs['filters'](_[_0xcaaf('0x4e')](_0x3c780d[_0xcaaf('0x42')],_0x40e8d7[_0xcaaf('0x44')]));if(_0x3c780d[_0xcaaf('0x42')][_0xcaaf('0x4f')]){_0x3f4d4c[_0xcaaf('0x50')]=_[_0xcaaf('0x51')](_0x3f4d4c[_0xcaaf('0x50')],{'$or':_[_0xcaaf('0x3e')](_0x3f4d4c[_0xcaaf('0x48')],function(_0x5d5ee3){var _0x2332b5={};_0x2332b5[_0x5d5ee3]={'$like':'%'+_0x3c780d[_0xcaaf('0x42')][_0xcaaf('0x4f')]+'%'};return _0x2332b5;})});}_0x3f4d4c=_[_0xcaaf('0x51')]({},_0x3f4d4c,_0x3c780d[_0xcaaf('0x57')]);return _0x23c417[_0xcaaf('0xbb')](_0x3f4d4c);}})[_0xcaaf('0x1f')](function(_0x56abcd){if(_0x56abcd){_0x27df32=_0x56abcd[_0xcaaf('0x49')];if(!_0x3c780d['query'][_0xcaaf('0x4a')](_0xcaaf('0x4b'))){_0x3f4d4c[_0xcaaf('0x2d')]=qs[_0xcaaf('0x2d')](_0x3c780d['query'][_0xcaaf('0x2d')]);_0x3f4d4c['offset']=qs[_0xcaaf('0x2e')](_0x3c780d[_0xcaaf('0x42')][_0xcaaf('0x2e')]);}return _0x23c417['getAgents'](_0x3f4d4c);}})['then'](function(_0x1a067b){if(_0x1a067b){return _0x1a067b?{'count':_0x27df32,'rows':_0x1a067b}:null;}})[_0xcaaf('0x1f')](respondWithResult(_0x9f09e5,null))[_0xcaaf('0x2a')](handleError(_0x9f09e5,null));};exports[_0xcaaf('0x3a')]=function(_0x468565,_0x46d863,_0x2140f4){var _0x210260,_0x27f915,_0x528e60;if(_[_0xcaaf('0x7b')](_0x468565[_0xcaaf('0x59')]['body'])||_0x468565[_0xcaaf('0x59')][_0xcaaf('0x59')]===''){throw new db[(_0xcaaf('0x79'))][(_0xcaaf('0x71'))](_0xcaaf('0x7c'));}if(_[_0xcaaf('0x7b')](_0x468565[_0xcaaf('0x59')]['to'])){}_0x210260=_0x468565[_0xcaaf('0x59')]['to'];return db[_0xcaaf('0x3f')]['findOne']({'where':{'id':_0x468565['params']['id']}})[_0xcaaf('0x1f')](handleEntityNotFound(_0x46d863,null))['then'](function(_0x1b891c){if(_0x1b891c){return db[_0xcaaf('0x3f')][_0xcaaf('0x5e')]({'where':{'id':_0x1b891c['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xcaaf('0x70')],'as':_0xcaaf('0x81'),'where':{[_0x1b891c[_0xcaaf('0x7e')]]:_0x210260},'limit':0x1,'order':[[_0xcaaf('0x75'),_0xcaaf('0x82')]]}]}]})['then'](handleEntityNotFound(_0x46d863,null))[_0xcaaf('0x1f')](function(_0x426271){if(_0x426271&&_0x426271[_0xcaaf('0x80')]){_0x27f915=_0x426271[_0xcaaf('0x5b')]({'plain':!![]});if(_0x27f915[_0xcaaf('0x80')]&&_0x27f915[_0xcaaf('0x80')]['Contacts']['length']){return _0x27f915[_0xcaaf('0x80')][_0xcaaf('0x81')][0x0];}return db[_0xcaaf('0x70')]['create'](_[_0xcaaf('0x8a')](_0x468565[_0xcaaf('0x59')],{'firstName':_0x210260,[_0x426271[_0xcaaf('0x7e')]]:_0x210260,'phone':_0x210260,'ListId':_0x27f915['ListId']}));}})[_0xcaaf('0x1f')](handleEntityNotFound(_0x46d863,null))[_0xcaaf('0x1f')](function(_0x23e686){if(_0x23e686){_0x528e60=_0x23e686;return db['OpenchannelInteraction'][_0xcaaf('0x5e')]({'where':{'ContactId':_0x528e60['id'],'closed':![],'OpenchannelAccountId':_0x27f915['id']}})[_0xcaaf('0x1f')](function(_0x14285c){if(_0x14285c){return[_0x14285c,![]];}return db[_0xcaaf('0x8d')][_0xcaaf('0x58')]({'UserId':_0x468565[_0xcaaf('0x5a')]['id'],'ContactId':_0x528e60['id'],'OpenchannelAccountId':_0x27f915['id'],'lastMsgDirection':_0xcaaf('0xbc'),'firstMsgDirection':_0xcaaf('0xbc'),'Messages':[_[_0xcaaf('0x51')](_0x468565['body'],{'read':![],'body':_0x468565[_0xcaaf('0x59')]['body'],'OpenchannelAccountId':_0x27f915['id'],'UserId':_0x468565[_0xcaaf('0x5a')]['id'],'ContactId':_0x528e60['id']})]},{'include':[{'model':db[_0xcaaf('0x98')],'as':_0xcaaf('0xbd')}]})[_0xcaaf('0x1f')](function(_0x3020b4){return[_0x3020b4,!![]];});});}})[_0xcaaf('0xb6')](function(_0xfe79e0,_0x36e286){if(_0x36e286){return _0xfe79e0;}return db[_0xcaaf('0x98')][_0xcaaf('0x58')](_['merge'](_0x468565[_0xcaaf('0x59')],{'read':![],'body':_0x468565['body'][_0xcaaf('0x59')],'OpenchannelAccountId':_0x27f915['id'],'OpenchannelInteractionId':_0xfe79e0['id'],'UserId':_0x468565[_0xcaaf('0x5a')]['id'],'ContactId':_0x528e60['id']}))[_0xcaaf('0x1f')](function(_0x4a001c){_0xfe79e0['dataValues'][_0xcaaf('0xbd')]=[];_0xfe79e0[_0xcaaf('0xbe')][_0xcaaf('0xbd')][_0xcaaf('0xbf')](_0x4a001c[_0xcaaf('0xbe')]);return _0xfe79e0;});});}})[_0xcaaf('0x1f')](respondWithResult(_0x46d863,null))[_0xcaaf('0x2a')](handleError(_0x46d863,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 59ad51a..91f5c2c 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 _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 +var _0xac4a=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','emit','hook','events'];(function(_0x4e1a67,_0x3782d1){var _0x5ac838=function(_0x4c7da6){while(--_0x4c7da6){_0x4e1a67['push'](_0x4e1a67['shift']());}};_0x5ac838(++_0x3782d1);}(_0xac4a,0x13f));var _0xaac4=function(_0xcf2305,_0x2380e9){_0xcf2305=_0xcf2305-0x0;var _0x5020da=_0xac4a[_0xcf2305];return _0x5020da;};'use strict';var EventEmitter=require(_0xaac4('0x0'));var OpenchannelAccount=require(_0xaac4('0x1'))['db'][_0xaac4('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xaac4('0x3')](0x0);var events={'afterCreate':_0xaac4('0x4'),'afterUpdate':_0xaac4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x58626e){return function(_0x2af0f6,_0x2a5762,_0x32d34c){OpenchannelAccountEvents['emit'](_0x58626e+':'+_0x2af0f6['id'],_0x2af0f6);OpenchannelAccountEvents[_0xaac4('0x6')](_0x58626e,_0x2af0f6);_0x32d34c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xaac4('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 cc5f5ad..54f8e6a 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(_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 +var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x484ded,_0x2a0c92){var _0x4bb2fb=function(_0x3829f3){while(--_0x3829f3){_0x484ded['push'](_0x484ded['shift']());}};_0x4bb2fb(++_0x2a0c92);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 9a90d29..90081f5 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 _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 +var _0x34b7=['redis','defaults','localhost','socket.io-emitter','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x5d860a,_0xe2505b){var _0x2bd13a=function(_0x471d8c){while(--_0x471d8c){_0x5d860a['push'](_0x5d860a['shift']());}};_0x2bd13a(++_0xe2505b);}(_0x34b7,0x196));var _0x734b=function(_0x26e780,_0x5465ba){_0x26e780=_0x26e780-0x0;var _0x2e9594=_0x34b7[_0x26e780];return _0x2e9594;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x734b('0x0'));var BPromise=require(_0x734b('0x1'));var rs=require(_0x734b('0x2'));var fs=require('fs');var Redis=require(_0x734b('0x3'));var db=require(_0x734b('0x4'))['db'];var utils=require(_0x734b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x734b('0x6'));var jayson=require(_0x734b('0x7'));var client=jayson[_0x734b('0x8')][_0x734b('0x9')]({'port':0x232a});config[_0x734b('0xa')]=_[_0x734b('0xb')](config['redis'],{'host':_0x734b('0xc'),'port':0x18eb});var socket=require(_0x734b('0xd'))(new Redis(config['redis']));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x19a88e,_0x598dee,_0x43c5e0){return new BPromise(function(_0x333738,_0x2860a2){return client[_0x734b('0xe')](_0x19a88e,_0x43c5e0)[_0x734b('0xf')](function(_0x16e451){logger[_0x734b('0x10')](_0x734b('0x11'),_0x598dee,_0x734b('0x12'));logger[_0x734b('0x13')](_0x734b('0x14'),_0x598dee,_0x734b('0x12'),JSON[_0x734b('0x15')](_0x16e451));if(_0x16e451[_0x734b('0x16')]){if(_0x16e451['error'][_0x734b('0x17')]===0x1f4){logger[_0x734b('0x16')](_0x734b('0x11'),_0x598dee,_0x16e451[_0x734b('0x16')][_0x734b('0x18')]);return _0x2860a2(_0x16e451[_0x734b('0x16')][_0x734b('0x18')]);}logger[_0x734b('0x16')](_0x734b('0x11'),_0x598dee,_0x16e451[_0x734b('0x16')][_0x734b('0x18')]);return _0x333738(_0x16e451['error'][_0x734b('0x18')]);}else{logger[_0x734b('0x10')](_0x734b('0x11'),_0x598dee,_0x734b('0x12'));_0x333738(_0x16e451['result']['message']);}})[_0x734b('0x19')](function(_0x3033cd){logger[_0x734b('0x16')](_0x734b('0x11'),_0x598dee,_0x3033cd);_0x2860a2(_0x3033cd);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 86e439d..834aa8c 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 _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 +var _0xd5b6=['removeListener','register','length','./openchannelAccount.events','save','remove','update','emit'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd5b6,0x73));var _0x6d5b=function(_0x34de66,_0x2d1467){_0x34de66=_0x34de66-0x0;var _0x34651b=_0xd5b6[_0x34de66];return _0x34651b;};'use strict';var OpenchannelAccountEvents=require(_0x6d5b('0x0'));var events=[_0x6d5b('0x1'),_0x6d5b('0x2'),_0x6d5b('0x3')];function createListener(_0x406106,_0x3d9bc9){return function(_0x162442){_0x3d9bc9[_0x6d5b('0x4')](_0x406106,_0x162442);};}function removeListener(_0x558202,_0x2735ab){return function(){OpenchannelAccountEvents[_0x6d5b('0x5')](_0x558202,_0x2735ab);};}exports[_0x6d5b('0x6')]=function(_0x4935ef){for(var _0x1c2490=0x0,_0x3e722d=events[_0x6d5b('0x7')];_0x1c2490<_0x3e722d;_0x1c2490++){var _0x3cdc91=events[_0x1c2490];var _0x5b57cb=createListener('openchannelAccount:'+_0x3cdc91,_0x4935ef);OpenchannelAccountEvents['on'](_0x3cdc91,_0x5b57cb);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 31289bf..3acabc5 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 _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 +var _0x84c3=['put','delete','destroy','exports','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','index','/:id','show','create'];(function(_0x519f04,_0x241684){var _0x59a907=function(_0x3580d7){while(--_0x3580d7){_0x519f04['push'](_0x519f04['shift']());}};_0x59a907(++_0x241684);}(_0x84c3,0x114));var _0x384c=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x84c3[_0x34843e];return _0x598f7f;};'use strict';var multer=require('multer');var util=require(_0x384c('0x0'));var path=require(_0x384c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x384c('0x2')]();var fs_extra=require(_0x384c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x384c('0x4'));var config=require(_0x384c('0x5'));var controller=require(_0x384c('0x6'));router['get']('/',auth[_0x384c('0x7')](),controller[_0x384c('0x8')]);router['get'](_0x384c('0x9'),auth[_0x384c('0x7')](),controller[_0x384c('0xa')]);router['post']('/',auth[_0x384c('0x7')](),controller[_0x384c('0xb')]);router[_0x384c('0xc')](_0x384c('0x9'),auth[_0x384c('0x7')](),controller['update']);router[_0x384c('0xd')]('/:id',auth[_0x384c('0x7')](),controller[_0x384c('0xe')]);module[_0x384c('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 8c89128..052e435 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 _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 +var _0xa9f0=['exports','STRING','noop','*,*,*,*','sequelize'];(function(_0x5c739f,_0x1b2ed5){var _0x5ea129=function(_0x22dda4){while(--_0x22dda4){_0x5c739f['push'](_0x5c739f['shift']());}};_0x5ea129(++_0x1b2ed5);}(_0xa9f0,0x11c));var _0x0a9f=function(_0x57b374,_0x2414ef){_0x57b374=_0x57b374-0x0;var _0x3fe6cb=_0xa9f0[_0x57b374];return _0x3fe6cb;};'use strict';var Sequelize=require(_0x0a9f('0x0'));module[_0x0a9f('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0a9f('0x2')],'allowNull':![],'defaultValue':_0x0a9f('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x0a9f('0x2')]},'interval':{'type':Sequelize[_0x0a9f('0x2')],'defaultValue':_0x0a9f('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 79db666..b6df33b 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 _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 +var _0x2aed=['type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','keys','find','catch','create','body','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','end','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName'];(function(_0x45ec65,_0x40dac4){var _0x1a5226=function(_0x5cfd99){while(--_0x5cfd99){_0x45ec65['push'](_0x45ec65['shift']());}};_0x1a5226(++_0x40dac4);}(_0x2aed,0x159));var _0xd2ae=function(_0x321b4f,_0x365d79){_0x321b4f=_0x321b4f-0x0;var _0x879912=_0x2aed[_0x321b4f];return _0x879912;};'use strict';var emlformat=require(_0xd2ae('0x0'));var rimraf=require(_0xd2ae('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd2ae('0x2'));var moment=require('moment');var BPromise=require(_0xd2ae('0x3'));var Mustache=require(_0xd2ae('0x4'));var util=require(_0xd2ae('0x5'));var path=require(_0xd2ae('0x6'));var sox=require(_0xd2ae('0x7'));var csv=require(_0xd2ae('0x8'));var ejs=require(_0xd2ae('0x9'));var fs=require('fs');var fs_extra=require(_0xd2ae('0xa'));var _=require('lodash');var squel=require(_0xd2ae('0xb'));var crypto=require(_0xd2ae('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd2ae('0xd'));var toCsv=require(_0xd2ae('0x8'));var querystring=require(_0xd2ae('0xe'));var Papa=require(_0xd2ae('0xf'));var Redis=require(_0xd2ae('0x10'));var authService=require(_0xd2ae('0x11'));var qs=require(_0xd2ae('0x12'));var as=require(_0xd2ae('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd2ae('0x14'))(_0xd2ae('0x15'));var utils=require(_0xd2ae('0x16'));var config=require(_0xd2ae('0x17'));var licenseUtil=require(_0xd2ae('0x18'));var db=require(_0xd2ae('0x19'))['db'];function respondWithStatusCode(_0x1d1539,_0x2729c1){_0x2729c1=_0x2729c1||0xcc;return function(_0x5d04f5){if(_0x5d04f5){return _0x1d1539[_0xd2ae('0x1a')](_0x2729c1);}return _0x1d1539[_0xd2ae('0x1b')](_0x2729c1)['end']();};}function respondWithResult(_0x3c9570,_0x3f9520){_0x3f9520=_0x3f9520||0xc8;return function(_0x32a9bb){if(_0x32a9bb){return _0x3c9570['status'](_0x3f9520)[_0xd2ae('0x1c')](_0x32a9bb);}};}function respondWithFilteredResult(_0x5f15b1,_0x14a621){return function(_0x3ad986){if(_0x3ad986){var _0x4d4242=typeof _0x14a621[_0xd2ae('0x1d')]===_0xd2ae('0x1e')&&typeof _0x14a621[_0xd2ae('0x1f')]===_0xd2ae('0x1e');var _0x58bafc=_0x3ad986[_0xd2ae('0x20')];var _0x5e437f=_0x4d4242?0x0:_0x14a621[_0xd2ae('0x1d')];var _0x302d9f=_0x4d4242?_0x3ad986[_0xd2ae('0x20')]:_0x14a621[_0xd2ae('0x1d')]+_0x14a621[_0xd2ae('0x1f')];var _0x3ccb6c;if(_0x302d9f>=_0x58bafc){_0x302d9f=_0x58bafc;_0x3ccb6c=0xc8;}else{_0x3ccb6c=0xce;}_0x5f15b1[_0xd2ae('0x1b')](_0x3ccb6c);return _0x5f15b1[_0xd2ae('0x21')](_0xd2ae('0x22'),_0x5e437f+'-'+_0x302d9f+'/'+_0x58bafc)[_0xd2ae('0x1c')](_0x3ad986);}return null;};}function patchUpdates(_0x21a06a){return function(_0x5c5349){try{jsonpatch['apply'](_0x5c5349,_0x21a06a,!![]);}catch(_0x3b182c){return BPromise[_0xd2ae('0x23')](_0x3b182c);}return _0x5c5349[_0xd2ae('0x24')]();};}function saveUpdates(_0x551d51,_0x499383){return function(_0x169235){if(_0x169235){return _0x169235[_0xd2ae('0x25')](_0x551d51)['then'](function(_0x1d9dc3){return _0x1d9dc3;});}return null;};}function removeEntity(_0x1dd6b5,_0xa0da8c){return function(_0x221a2c){if(_0x221a2c){return _0x221a2c[_0xd2ae('0x26')]()[_0xd2ae('0x27')](function(){_0x1dd6b5[_0xd2ae('0x1b')](0xcc)[_0xd2ae('0x28')]();});}};}function handleEntityNotFound(_0x4f7463,_0x90b3fc){return function(_0x4ffd35){if(!_0x4ffd35){_0x4f7463['sendStatus'](0x194);}return _0x4ffd35;};}function handleError(_0x56907d,_0x5a9fac){_0x5a9fac=_0x5a9fac||0x1f4;return function(_0x419c61){logger[_0xd2ae('0x29')](_0x419c61[_0xd2ae('0x2a')]);if(_0x419c61[_0xd2ae('0x2b')]){delete _0x419c61[_0xd2ae('0x2b')];}_0x56907d[_0xd2ae('0x1b')](_0x5a9fac)[_0xd2ae('0x2c')](_0x419c61);};}exports[_0xd2ae('0x2d')]=function(_0x38ee86,_0x4b8e92){var _0x58d623={},_0x5e89e6={},_0x50c3cf={'count':0x0,'rows':[]};var _0x393d59=_[_0xd2ae('0x2e')](db[_0xd2ae('0x2f')][_0xd2ae('0x30')],function(_0x384bc3){return{'name':_0x384bc3[_0xd2ae('0x31')],'type':_0x384bc3[_0xd2ae('0x32')][_0xd2ae('0x33')]};});_0x5e89e6[_0xd2ae('0x34')]=_['map'](_0x393d59,_0xd2ae('0x2b'));_0x5e89e6[_0xd2ae('0x35')]=_['keys'](_0x38ee86[_0xd2ae('0x35')]);_0x5e89e6[_0xd2ae('0x36')]=_[_0xd2ae('0x37')](_0x5e89e6['model'],_0x5e89e6[_0xd2ae('0x35')]);_0x58d623[_0xd2ae('0x38')]=_['intersection'](_0x5e89e6[_0xd2ae('0x34')],qs[_0xd2ae('0x39')](_0x38ee86['query'][_0xd2ae('0x39')]));_0x58d623[_0xd2ae('0x38')]=_0x58d623[_0xd2ae('0x38')][_0xd2ae('0x3a')]?_0x58d623[_0xd2ae('0x38')]:_0x5e89e6[_0xd2ae('0x34')];if(!_0x38ee86[_0xd2ae('0x35')][_0xd2ae('0x3b')](_0xd2ae('0x3c'))){_0x58d623[_0xd2ae('0x1f')]=qs['limit'](_0x38ee86[_0xd2ae('0x35')][_0xd2ae('0x1f')]);_0x58d623[_0xd2ae('0x1d')]=qs['offset'](_0x38ee86[_0xd2ae('0x35')][_0xd2ae('0x1d')]);}_0x58d623[_0xd2ae('0x3d')]=qs['sort'](_0x38ee86[_0xd2ae('0x35')][_0xd2ae('0x3e')]);_0x58d623[_0xd2ae('0x3f')]=qs[_0xd2ae('0x36')](_[_0xd2ae('0x40')](_0x38ee86[_0xd2ae('0x35')],_0x5e89e6[_0xd2ae('0x36')]),_0x393d59);if(_0x38ee86[_0xd2ae('0x35')][_0xd2ae('0x41')]){_0x58d623[_0xd2ae('0x3f')]=_[_0xd2ae('0x42')](_0x58d623[_0xd2ae('0x3f')],{'$or':_[_0xd2ae('0x2e')](_0x393d59,function(_0x243a66){if(_0x243a66[_0xd2ae('0x32')]!==_0xd2ae('0x43')){var _0x26c01c={};_0x26c01c[_0x243a66[_0xd2ae('0x2b')]]={'$like':'%'+_0x38ee86[_0xd2ae('0x35')]['filter']+'%'};return _0x26c01c;}})});}_0x58d623=_['merge']({},_0x58d623,_0x38ee86[_0xd2ae('0x44')]);var _0x41769c={'where':_0x58d623['where']};return db[_0xd2ae('0x2f')][_0xd2ae('0x20')](_0x41769c)[_0xd2ae('0x27')](function(_0x58b266){_0x50c3cf['count']=_0x58b266;if(_0x38ee86[_0xd2ae('0x35')][_0xd2ae('0x45')]){_0x58d623[_0xd2ae('0x46')]=[{'all':!![]}];}return db[_0xd2ae('0x2f')][_0xd2ae('0x47')](_0x58d623);})[_0xd2ae('0x27')](function(_0x3a6014){_0x50c3cf['rows']=_0x3a6014;return _0x50c3cf;})[_0xd2ae('0x27')](respondWithFilteredResult(_0x4b8e92,_0x58d623))['catch'](handleError(_0x4b8e92,null));};exports[_0xd2ae('0x48')]=function(_0x5874da,_0x1e8137){var _0x246c29={'raw':!![],'where':{'id':_0x5874da[_0xd2ae('0x49')]['id']}},_0x1e4adc={};_0x1e4adc['model']=_[_0xd2ae('0x4a')](db[_0xd2ae('0x2f')]['rawAttributes']);_0x1e4adc[_0xd2ae('0x35')]=_[_0xd2ae('0x4a')](_0x5874da[_0xd2ae('0x35')]);_0x1e4adc['filters']=_[_0xd2ae('0x37')](_0x1e4adc['model'],_0x1e4adc[_0xd2ae('0x35')]);_0x246c29['attributes']=_['intersection'](_0x1e4adc[_0xd2ae('0x34')],qs[_0xd2ae('0x39')](_0x5874da[_0xd2ae('0x35')]['fields']));_0x246c29[_0xd2ae('0x38')]=_0x246c29[_0xd2ae('0x38')][_0xd2ae('0x3a')]?_0x246c29[_0xd2ae('0x38')]:_0x1e4adc['model'];if(_0x5874da[_0xd2ae('0x35')][_0xd2ae('0x45')]){_0x246c29[_0xd2ae('0x46')]=[{'all':!![]}];}_0x246c29=_[_0xd2ae('0x42')]({},_0x246c29,_0x5874da[_0xd2ae('0x44')]);return db[_0xd2ae('0x2f')][_0xd2ae('0x4b')](_0x246c29)[_0xd2ae('0x27')](handleEntityNotFound(_0x1e8137,null))[_0xd2ae('0x27')](respondWithResult(_0x1e8137,null))[_0xd2ae('0x4c')](handleError(_0x1e8137,null));};exports[_0xd2ae('0x4d')]=function(_0x57627b,_0x2d642f){return db[_0xd2ae('0x2f')][_0xd2ae('0x4d')](_0x57627b[_0xd2ae('0x4e')],{})['then'](respondWithResult(_0x2d642f,0xc9))[_0xd2ae('0x4c')](handleError(_0x2d642f,null));};exports['update']=function(_0x3e07ec,_0x354dcc){if(_0x3e07ec['body']['id']){delete _0x3e07ec[_0xd2ae('0x4e')]['id'];}return db[_0xd2ae('0x2f')][_0xd2ae('0x4b')]({'where':{'id':_0x3e07ec[_0xd2ae('0x49')]['id']}})['then'](handleEntityNotFound(_0x354dcc,null))[_0xd2ae('0x27')](saveUpdates(_0x3e07ec['body'],null))[_0xd2ae('0x27')](respondWithResult(_0x354dcc,null))['catch'](handleError(_0x354dcc,null));};exports[_0xd2ae('0x26')]=function(_0x45a31e,_0xf25444){return db[_0xd2ae('0x2f')][_0xd2ae('0x4b')]({'where':{'id':_0x45a31e[_0xd2ae('0x49')]['id']}})[_0xd2ae('0x27')](handleEntityNotFound(_0xf25444,null))[_0xd2ae('0x27')](removeEntity(_0xf25444,null))[_0xd2ae('0x4c')](handleError(_0xf25444,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 8417079..d9152fd 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 _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 +var _0x37c3=['bluebird','request-promise','path','../../config/environment','./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4_unicode_ci','lodash','util','api'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x37c3,0x171));var _0x337c=function(_0x2f34d2,_0x236793){_0x2f34d2=_0x2f34d2-0x0;var _0x25e904=_0x37c3[_0x2f34d2];return _0x25e904;};'use strict';var _=require(_0x337c('0x0'));var util=require(_0x337c('0x1'));var logger=require('../../config/logger')(_0x337c('0x2'));var moment=require('moment');var BPromise=require(_0x337c('0x3'));var rp=require(_0x337c('0x4'));var fs=require('fs');var path=require(_0x337c('0x5'));var rimraf=require('rimraf');var config=require(_0x337c('0x6'));var attributes=require(_0x337c('0x7'));module[_0x337c('0x8')]=function(_0x258005,_0x287f88){return _0x258005[_0x337c('0x9')]('OpenchannelApplication',attributes,{'tableName':_0x337c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x337c('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 6d2a9b1..cb01ddb 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 _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 +var _0xfd4d=['options','attributes','UpdateOpenchannelApplication','stringify','util','moment','../../mysqldb','../../config/utils','http','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','OpenchannelApplication'];(function(_0x5ad4be,_0x357097){var _0x156465=function(_0x4935ce){while(--_0x4935ce){_0x5ad4be['push'](_0x5ad4be['shift']());}};_0x156465(++_0x357097);}(_0xfd4d,0x1e7));var _0xdfd4=function(_0x198cf7,_0x2e5f91){_0x198cf7=_0x198cf7-0x0;var _0x2e621d=_0xfd4d[_0x198cf7];return _0x2e621d;};'use strict';var _=require('lodash');var util=require(_0xdfd4('0x0'));var moment=require(_0xdfd4('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdfd4('0x2'))['db'];var utils=require(_0xdfd4('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xdfd4('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x3366d3,_0x5af505,_0x439a8a){return new BPromise(function(_0x527424,_0x1b53c7){return client['request'](_0x3366d3,_0x439a8a)[_0xdfd4('0x5')](function(_0x26c5c4){logger[_0xdfd4('0x6')](_0xdfd4('0x7'),_0x5af505,_0xdfd4('0x8'));logger[_0xdfd4('0x9')](_0xdfd4('0xa'),_0x5af505,_0xdfd4('0x8'),JSON['stringify'](_0x26c5c4));if(_0x26c5c4[_0xdfd4('0xb')]){if(_0x26c5c4[_0xdfd4('0xb')][_0xdfd4('0xc')]===0x1f4){logger[_0xdfd4('0xb')]('OpenchannelApplication,\x20%s,\x20%s',_0x5af505,_0x26c5c4[_0xdfd4('0xb')][_0xdfd4('0xd')]);return _0x1b53c7(_0x26c5c4['error']['message']);}logger[_0xdfd4('0xb')](_0xdfd4('0x7'),_0x5af505,_0x26c5c4[_0xdfd4('0xb')][_0xdfd4('0xd')]);return _0x527424(_0x26c5c4['error'][_0xdfd4('0xd')]);}else{logger['info'](_0xdfd4('0x7'),_0x5af505,_0xdfd4('0x8'));_0x527424(_0x26c5c4[_0xdfd4('0xe')][_0xdfd4('0xd')]);}})[_0xdfd4('0xf')](function(_0x313513){logger['error'](_0xdfd4('0x7'),_0x5af505,_0x313513);_0x1b53c7(_0x313513);});});}exports['UpdateOpenchannelApplication']=function(_0x11e595){var _0x3fbaa2=this;return new Promise(function(_0x4cd221,_0x3dd82d){return db[_0xdfd4('0x10')]['update'](_0x11e595['body'],{'raw':_0x11e595[_0xdfd4('0x11')]?_0x11e595['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11e595['options']?_0x11e595['options']['where']||null:null,'attributes':_0x11e595[_0xdfd4('0x11')]?_0x11e595[_0xdfd4('0x11')][_0xdfd4('0x12')]||null:null,'limit':_0x11e595['options']?_0x11e595[_0xdfd4('0x11')]['limit']||null:null})[_0xdfd4('0x5')](function(_0x942aa2){logger['info'](_0xdfd4('0x13'),_0x11e595);logger[_0xdfd4('0x9')](_0xdfd4('0x13'),_0x11e595,JSON[_0xdfd4('0x14')](_0x942aa2));_0x4cd221(_0x942aa2);})[_0xdfd4('0xf')](function(_0x5b5df7){logger['error'](_0xdfd4('0x13'),_0x5b5df7['message'],_0x11e595);_0x3dd82d(_0x3fbaa2[_0xdfd4('0xb')](0x1f4,_0x5b5df7['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 0d5a3fd..80a4b03 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 _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 +var _0xf615=['removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','openchannelinteraction:destroy','destroy'];(function(_0x286bfb,_0x46ac3c){var _0x52b683=function(_0x3e7fb1){while(--_0x3e7fb1){_0x286bfb['push'](_0x286bfb['shift']());}};_0x52b683(++_0x46ac3c);}(_0xf615,0x107));var _0x5f61=function(_0x113e32,_0x5339f0){_0x113e32=_0x113e32-0x0;var _0x4ff939=_0xf615[_0x113e32];return _0x4ff939;};'use strict';var multer=require(_0x5f61('0x0'));var util=require(_0x5f61('0x1'));var path=require(_0x5f61('0x2'));var timeout=require(_0x5f61('0x3'));var express=require('express');var router=express[_0x5f61('0x4')]();var fs_extra=require(_0x5f61('0x5'));var auth=require(_0x5f61('0x6'));var interaction=require(_0x5f61('0x7'));var config=require(_0x5f61('0x8'));var controller=require('./openchannelInteraction.controller');router[_0x5f61('0x9')]('/',auth['isAuthenticated'](),controller[_0x5f61('0xa')]);router[_0x5f61('0x9')]('/describe',auth[_0x5f61('0xb')](),controller[_0x5f61('0xc')]);router[_0x5f61('0x9')](_0x5f61('0xd'),auth[_0x5f61('0xb')](),controller['show']);router[_0x5f61('0x9')]('/:id/messages',auth[_0x5f61('0xb')](),controller['getMessages']);router[_0x5f61('0x9')](_0x5f61('0xe'),auth[_0x5f61('0xb')](),controller[_0x5f61('0xf')]);router[_0x5f61('0x10')]('/',auth[_0x5f61('0xb')](),controller[_0x5f61('0x11')]);router[_0x5f61('0x10')](_0x5f61('0x12'),auth['isAuthenticated'](),controller[_0x5f61('0x13')]);router[_0x5f61('0x10')](_0x5f61('0x14'),auth[_0x5f61('0xb')](),interaction[_0x5f61('0x15')](_0x5f61('0x16'),_0x5f61('0x17')),controller[_0x5f61('0x18')]);router['put'](_0x5f61('0xd'),auth['isAuthenticated'](),interaction['tracked']('openchannel','openchannelinteraction:update'),controller['update']);router['delete'](_0x5f61('0xd'),auth[_0x5f61('0xb')](),interaction['tracked']('openchannel',_0x5f61('0x19')),controller[_0x5f61('0x1a')]);router['delete'](_0x5f61('0x14'),auth[_0x5f61('0xb')](),controller[_0x5f61('0x1b')]);module[_0x5f61('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 1de3956..ef3f6c0 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 _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 +var _0x32d5=['out','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x32d5,0x1aa));var _0x532d=function(_0x540a1a,_0x32fde4){_0x540a1a=_0x540a1a-0x0;var _0xc01a5a=_0x32d5[_0x540a1a];return _0xc01a5a;};'use strict';var Sequelize=require(_0x532d('0x0'));module[_0x532d('0x1')]={'closed':{'type':Sequelize[_0x532d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x532d('0x3')]},'disposition':{'type':Sequelize[_0x532d('0x4')]},'secondDisposition':{'type':Sequelize[_0x532d('0x4')]},'thirdDisposition':{'type':Sequelize[_0x532d('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x532d('0x3')]},'threadId':{'type':Sequelize[_0x532d('0x4')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x532d('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x532d('0x5')]('in',_0x532d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x532d('0x5')]('in',_0x532d('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x532d('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index a1685ce..7ab2a90 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 _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 +var _0x80ff=['get','mkdirSync','fullname','N.A.','closed','closedAt','disposition','threadId','Public','Private','existsSync','createReadStream','basename','out','System','renderFile','views','transcript-','unlinkSync','rimraf','zip-dir','moment','path','ejs','lodash','../../components/parsers/qs','../../components/export/pdf','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','sendStatus','status','end','json','undefined','count','limit','set','Content-Range','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','key','findAll','openchannel','show','query','type','from','params','model','keys','OpenchannelInteraction','intersection','attributes','fields','includeAll','include','options','catch','create','body','find','describe','addMessage','OpenchannelMessage','omit','getMessages','findOne','filters','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','OpenchannelInteractionId','filter','merge','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','ids','spread','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','root','server','files','join','attachments','transcript-%d-%s.zip','push','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner'];(function(_0x317061,_0x75aeae){var _0x57b316=function(_0x3fb33f){while(--_0x3fb33f){_0x317061['push'](_0x317061['shift']());}};_0x57b316(++_0x75aeae);}(_0x80ff,0x93));var _0xf80f=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x80ff[_0x2bf141];return _0x48277b;};'use strict';var rimraf=require(_0xf80f('0x0'));var zipdir=require(_0xf80f('0x1'));var moment=require(_0xf80f('0x2'));var util=require('util');var path=require(_0xf80f('0x3'));var ejs=require(_0xf80f('0x4'));var fs=require('fs');var _=require(_0xf80f('0x5'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0xf80f('0x6'));var pdf=require(_0xf80f('0x7'));var logger=require('../../config/logger')('api');var config=require(_0xf80f('0x8'));var db=require(_0xf80f('0x9'))['db'];config[_0xf80f('0xa')]=_[_0xf80f('0xb')](config[_0xf80f('0xa')],{'host':_0xf80f('0xc'),'port':0x18eb});var socket=require(_0xf80f('0xd'))(new Redis(config[_0xf80f('0xa')]));require(_0xf80f('0xe'))['register'](socket);function respondWithStatusCode(_0x14fbb9,_0x4d60dc){_0x4d60dc=_0x4d60dc||0xcc;return function(_0x14283f){if(_0x14283f){return _0x14fbb9[_0xf80f('0xf')](_0x4d60dc);}return _0x14fbb9[_0xf80f('0x10')](_0x4d60dc)[_0xf80f('0x11')]();};}function respondWithResult(_0x1f656f,_0x4c3e6d){_0x4c3e6d=_0x4c3e6d||0xc8;return function(_0x73137f){if(_0x73137f){return _0x1f656f[_0xf80f('0x10')](_0x4c3e6d)[_0xf80f('0x12')](_0x73137f);}};}function respondWithFilteredResult(_0x5ae65e,_0x476135){return function(_0x569ed9){if(_0x569ed9){var _0x16272f=typeof _0x476135['offset']===_0xf80f('0x13')&&typeof _0x476135['limit']===_0xf80f('0x13');var _0x354d51=_0x569ed9['count'];var _0x29980b=_0x16272f?0x0:_0x476135['offset'];var _0x51ffb7=_0x16272f?_0x569ed9[_0xf80f('0x14')]:_0x476135['offset']+_0x476135[_0xf80f('0x15')];var _0x3611e5;if(_0x51ffb7>=_0x354d51){_0x51ffb7=_0x354d51;_0x3611e5=0xc8;}else{_0x3611e5=0xce;}_0x5ae65e[_0xf80f('0x10')](_0x3611e5);return _0x5ae65e[_0xf80f('0x16')](_0xf80f('0x17'),_0x29980b+'-'+_0x51ffb7+'/'+_0x354d51)[_0xf80f('0x12')](_0x569ed9);}return null;};}function saveUpdates(_0x5891c1){return function(_0x14ab13){if(_0x14ab13){return _0x14ab13[_0xf80f('0x18')](_0x5891c1)[_0xf80f('0x19')](function(_0xcfc844){return _0xcfc844;});}return null;};}function removeEntity(_0x598721){return function(_0x100f6b){if(_0x100f6b){return _0x100f6b[_0xf80f('0x1a')]()[_0xf80f('0x19')](function(){_0x598721[_0xf80f('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32be2e){return function(_0x3a02d3){if(!_0x3a02d3){_0x32be2e[_0xf80f('0xf')](0x194);}return _0x3a02d3;};}function handleError(_0xe19387,_0x374bc8){_0x374bc8=_0x374bc8||0x1f4;return function(_0x3234d2){logger['error'](_0x3234d2[_0xf80f('0x1b')]);if(_0x3234d2[_0xf80f('0x1c')]){delete _0x3234d2[_0xf80f('0x1c')];}_0xe19387[_0xf80f('0x10')](_0x374bc8)[_0xf80f('0x1d')](_0x3234d2);};}exports[_0xf80f('0x1e')]=function(_0x56d8db,_0x3bd009){var _0x15ffea={};var _0x31e343=_['map'](db['OpenchannelInteraction'][_0xf80f('0x1f')],function(_0x1080e8){return{'name':_0x1080e8[_0xf80f('0x20')],'type':_0x1080e8['type'][_0xf80f('0x21')]};});_0x15ffea=qs['getOptions'](_0x31e343,_0x56d8db);return interaction[_0xf80f('0x22')](_0xf80f('0x23'),_0x56d8db['query'],_0x56d8db['user'],_0x15ffea,_0x31e343)['then'](respondWithFilteredResult(_0x3bd009,_0x15ffea))['catch'](handleError(_0x3bd009,null));};exports[_0xf80f('0x24')]=function(_0x25e926,_0x4ead2f){var _0x2cb377={};if(_0x25e926[_0xf80f('0x25')][_0xf80f('0x26')]&&_0x25e926['query'][_0xf80f('0x26')]===_0xf80f('0x27')){_0x2cb377[_0xf80f('0x27')]=_0x25e926[_0xf80f('0x28')]['id'];}else{_0x2cb377['id']=_0x25e926['params']['id'];}var _0x211906={'raw':![],'where':_0x2cb377},_0x57f4f2={};_0x57f4f2[_0xf80f('0x29')]=_[_0xf80f('0x2a')](db[_0xf80f('0x2b')][_0xf80f('0x1f')]);_0x57f4f2[_0xf80f('0x25')]=_[_0xf80f('0x2a')](_0x25e926['query']);_0x57f4f2['filters']=_[_0xf80f('0x2c')](_0x57f4f2['model'],_0x57f4f2[_0xf80f('0x25')]);_0x211906[_0xf80f('0x2d')]=_['intersection'](_0x57f4f2[_0xf80f('0x29')],qs[_0xf80f('0x2e')](_0x25e926[_0xf80f('0x25')][_0xf80f('0x2e')]));_0x211906['attributes']=_0x211906[_0xf80f('0x2d')]['length']?_0x211906['attributes']:_0x57f4f2[_0xf80f('0x29')];if(_0x25e926[_0xf80f('0x25')][_0xf80f('0x2f')]){_0x211906[_0xf80f('0x30')]=[{'all':!![]}];}_0x211906=_['merge']({},_0x211906,_0x25e926[_0xf80f('0x31')]);return db['OpenchannelInteraction']['find'](_0x211906)[_0xf80f('0x19')](handleEntityNotFound(_0x4ead2f,null))[_0xf80f('0x19')](respondWithResult(_0x4ead2f,null))[_0xf80f('0x32')](handleError(_0x4ead2f,null));};exports[_0xf80f('0x33')]=function(_0x46cb00,_0x83c0c){return db['OpenchannelInteraction'][_0xf80f('0x33')](_0x46cb00[_0xf80f('0x34')],{})['then'](respondWithResult(_0x83c0c,0xc9))[_0xf80f('0x32')](handleError(_0x83c0c,null));};exports['update']=function(_0x3aabb7,_0x3bef73){if(_0x3aabb7[_0xf80f('0x34')]['id']){delete _0x3aabb7[_0xf80f('0x34')]['id'];}return db[_0xf80f('0x2b')][_0xf80f('0x35')]({'where':{'id':_0x3aabb7['params']['id']}})[_0xf80f('0x19')](handleEntityNotFound(_0x3bef73,null))[_0xf80f('0x19')](saveUpdates(_0x3aabb7[_0xf80f('0x34')],null))['then'](respondWithResult(_0x3bef73,null))['catch'](handleError(_0x3bef73,null));};exports[_0xf80f('0x1a')]=function(_0xe3b8bf,_0x3757d2){return db[_0xf80f('0x2b')][_0xf80f('0x35')]({'where':{'id':_0xe3b8bf[_0xf80f('0x28')]['id']}})['then'](handleEntityNotFound(_0x3757d2,null))[_0xf80f('0x19')](removeEntity(_0x3757d2,null))['catch'](handleError(_0x3757d2,null));};exports[_0xf80f('0x36')]=function(_0x9aa761,_0x121f0a){return db[_0xf80f('0x2b')][_0xf80f('0x36')]()[_0xf80f('0x19')](respondWithResult(_0x121f0a,null))[_0xf80f('0x32')](handleError(_0x121f0a,null));};exports[_0xf80f('0x37')]=function(_0x2afd79,_0x2d5f47){return db[_0xf80f('0x38')][_0xf80f('0x35')]({'where':{'id':_0x2afd79['params']['id']}})[_0xf80f('0x19')](handleEntityNotFound(_0x2d5f47,null))[_0xf80f('0x19')](function(_0x497864){if(_0x497864){return _0x497864[_0xf80f('0x37')](_0x2afd79[_0xf80f('0x34')]['ids'],_[_0xf80f('0x39')](_0x2afd79[_0xf80f('0x34')],['ids','id'])||{});}})[_0xf80f('0x19')](respondWithResult(_0x2d5f47,null))[_0xf80f('0x32')](handleError(_0x2d5f47,null));};exports[_0xf80f('0x3a')]=function(_0x1c6209,_0xa9931b){var _0x17b484={'raw':![],'where':{}};var _0x24f934={};var _0x53314d={'count':0x0,'rows':[]};return db[_0xf80f('0x2b')][_0xf80f('0x3b')]({'where':{'id':_0x1c6209[_0xf80f('0x28')]['id']}})[_0xf80f('0x19')](handleEntityNotFound(_0xa9931b,null))[_0xf80f('0x19')](function(_0x2d2802){if(_0x2d2802){_0x24f934[_0xf80f('0x29')]=_[_0xf80f('0x2a')](db[_0xf80f('0x38')][_0xf80f('0x1f')]);_0x24f934[_0xf80f('0x25')]=_[_0xf80f('0x2a')](_0x1c6209[_0xf80f('0x25')]);_0x24f934[_0xf80f('0x3c')]=_[_0xf80f('0x2c')](_0x24f934[_0xf80f('0x29')],_0x24f934[_0xf80f('0x25')]);_0x17b484[_0xf80f('0x2d')]=_['intersection'](_0x24f934[_0xf80f('0x29')],qs[_0xf80f('0x2e')](_0x1c6209[_0xf80f('0x25')]['fields']));_0x17b484[_0xf80f('0x2d')]=_0x17b484[_0xf80f('0x2d')][_0xf80f('0x3d')]?_0x17b484[_0xf80f('0x2d')]:_0x24f934['model'];if(!_0x1c6209[_0xf80f('0x25')][_0xf80f('0x3e')](_0xf80f('0x3f'))){_0x17b484[_0xf80f('0x15')]=qs[_0xf80f('0x15')](_0x1c6209[_0xf80f('0x25')][_0xf80f('0x15')]);_0x17b484['offset']=qs[_0xf80f('0x40')](_0x1c6209['query'][_0xf80f('0x40')]);}_0x17b484[_0xf80f('0x41')]=qs[_0xf80f('0x42')](_0x1c6209['query'][_0xf80f('0x42')]);_0x17b484[_0xf80f('0x43')]=qs[_0xf80f('0x3c')](_[_0xf80f('0x44')](_0x1c6209[_0xf80f('0x25')],_0x24f934[_0xf80f('0x3c')]));_0x17b484['where'][_0xf80f('0x45')]=_0x2d2802['id'];if(_0x1c6209[_0xf80f('0x25')][_0xf80f('0x46')]){_0x17b484[_0xf80f('0x43')]=_[_0xf80f('0x47')](_0x17b484[_0xf80f('0x43')],{'$or':_[_0xf80f('0x48')](_0x17b484[_0xf80f('0x2d')],function(_0x50cf04){var _0x413297={};_0x413297[_0x50cf04]={'$like':'%'+_0x1c6209[_0xf80f('0x25')][_0xf80f('0x46')]+'%'};return _0x413297;})});}if(_0x1c6209[_0xf80f('0x25')][_0xf80f('0x49')]){var _0x3ff121=_0x1c6209[_0xf80f('0x25')][_0xf80f('0x49')][_0xf80f('0x4a')](',');var _0x5973a3={};_0x5973a3[_0x3ff121[0x0]]={'$gte':moment(_0x3ff121[0x1])[_0xf80f('0x4b')](_0xf80f('0x4c'))};_0x17b484[_0xf80f('0x43')]=_['merge'](_0x17b484[_0xf80f('0x43')],_0x5973a3);}_0x17b484=_['merge']({},_0x17b484,_0x1c6209[_0xf80f('0x31')]);return db[_0xf80f('0x38')][_0xf80f('0x14')]({'where':_0x17b484[_0xf80f('0x43')]})['then'](function(_0x514e36){_0x53314d[_0xf80f('0x14')]=_0x514e36;if(_0x1c6209[_0xf80f('0x25')][_0xf80f('0x2f')]){_0x17b484[_0xf80f('0x30')]=[{'all':!![]}];}return db[_0xf80f('0x38')][_0xf80f('0x22')](_0x17b484);})[_0xf80f('0x19')](function(_0x11846d){_0x53314d[_0xf80f('0x4d')]=_0x11846d;return _0x53314d;});}})[_0xf80f('0x19')](respondWithFilteredResult(_0xa9931b,_0x17b484))[_0xf80f('0x32')](handleError(_0xa9931b,null));};exports[_0xf80f('0x4e')]=function(_0x35f619,_0x2c11dd){return db[_0xf80f('0x2b')]['find']({'where':{'id':_0x35f619['params']['id']}})[_0xf80f('0x19')](handleEntityNotFound(_0x2c11dd,null))['then'](function(_0x4335fe){if(_0x4335fe){return _0x4335fe[_0xf80f('0x4f')](_0x35f619[_0xf80f('0x34')]['ids'],_[_0xf80f('0x39')](_0x35f619['body'],[_0xf80f('0x50'),'id'])||{})[_0xf80f('0x51')](function(){return db['Tag'][_0xf80f('0x22')]({'attributes':['id',_0xf80f('0x1c'),_0xf80f('0x52')],'where':{'id':_0x35f619[_0xf80f('0x34')][_0xf80f('0x50')]}});})[_0xf80f('0x19')](function(_0x8767b7){socket[_0xf80f('0x53')](_0xf80f('0x54'),{'id':Number(_0x35f619[_0xf80f('0x28')]['id']),'tags':_0x8767b7||[]});return{'id':Number(_0x35f619[_0xf80f('0x28')]['id']),'tags':_0x8767b7||[]};});}})[_0xf80f('0x19')](respondWithResult(_0x2c11dd,null))[_0xf80f('0x32')](handleError(_0x2c11dd,null));};exports[_0xf80f('0x55')]=function(_0x4940eb,_0x4b8a9a){return db['OpenchannelInteraction'][_0xf80f('0x35')]({'where':{'id':_0x4940eb['params']['id']}})[_0xf80f('0x19')](handleEntityNotFound(_0x4b8a9a,null))['then'](function(_0x8be725){if(_0x8be725){return _0x8be725['removeTags'](_0x4940eb['query']['ids']);}})[_0xf80f('0x19')](respondWithStatusCode(_0x4b8a9a,null))['catch'](handleError(_0x4b8a9a,null));};exports[_0xf80f('0x56')]=function(_0x7de9,_0x25f76a){var _0x4f7ae8=moment()[_0xf80f('0x57')]()[_0xf80f('0x58')]();var _0x5de6a4=path['join'](config[_0xf80f('0x59')],_0xf80f('0x5a'),_0xf80f('0x5b'),'tmp');var _0x30af31=path[_0xf80f('0x5c')](config[_0xf80f('0x59')],_0xf80f('0x5a'),_0xf80f('0x5b'),_0xf80f('0x5d'));var _0x27276f=path[_0xf80f('0x5c')](_0x5de6a4,_0x4f7ae8);var _0x186f7f=util[_0xf80f('0x4b')](_0xf80f('0x5e'),_0x7de9[_0xf80f('0x28')]['id'],_0x4f7ae8);var _0x2d5bb7=path[_0xf80f('0x5c')](_0x5de6a4,_0x186f7f);var _0x16fc3d=[];_0x16fc3d['push']({'model':db['User'],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x16fc3d[_0xf80f('0x5f')]({'model':db[_0xf80f('0x60')],'as':_0xf80f('0x61'),'attributes':['id',_0xf80f('0x62'),_0xf80f('0x63')],'raw':!![]});if(_0x7de9[_0xf80f('0x25')][_0xf80f('0x5d')]){_0x16fc3d['push']({'model':db[_0xf80f('0x64')],'as':'Attachment','raw':!![]});}var _0x36ec34=[{'model':db[_0xf80f('0x38')],'as':_0xf80f('0x65'),'attributes':['id',_0xf80f('0x34'),_0xf80f('0x66'),_0xf80f('0x67'),_0xf80f('0x68'),_0xf80f('0x69')],'include':_0x16fc3d}];_0x36ec34[_0xf80f('0x5f')]({'model':db[_0xf80f('0x6a')],'as':_0xf80f('0x6b'),'attributes':['id',_0xf80f('0x1c')]});_0x36ec34[_0xf80f('0x5f')]({'model':db['User'],'as':_0xf80f('0x6c'),'attributes':['id','fullname']});return db[_0xf80f('0x2b')][_0xf80f('0x35')]({'where':{'id':_0x7de9['params']['id']},'include':_0x36ec34})[_0xf80f('0x19')](handleEntityNotFound(_0x25f76a,null))[_0xf80f('0x19')](function(_0x1d7af7){if(_0x1d7af7){var _0x5a6288=_0x1d7af7[_0xf80f('0x6d')]({'plain':!![]});fs[_0xf80f('0x6e')](_0x27276f);var _0x46d6d2={'channel':'Openchannel','account':_0x5a6288[_0xf80f('0x6b')]['name'],'agent':_0x5a6288[_0xf80f('0x6c')]?_0x5a6288[_0xf80f('0x6c')][_0xf80f('0x6f')]:_0xf80f('0x70'),'createdAt':moment(_0x5a6288['createdAt'])[_0xf80f('0x4b')](_0xf80f('0x4c'))[_0xf80f('0x58')](),'closedAt':_0x5a6288[_0xf80f('0x71')]?moment(_0x5a6288[_0xf80f('0x72')])['format'](_0xf80f('0x4c'))[_0xf80f('0x58')]():'','disposition':_0x5a6288[_0xf80f('0x73')],'visibility':_0x5a6288[_0xf80f('0x74')]?_0xf80f('0x75'):_0xf80f('0x76'),'messages':_(_0x5a6288[_0xf80f('0x65')])[_0xf80f('0x46')]({'secret':![]})[_0xf80f('0x48')](function(_0x25491d){if(_0x25491d[_0xf80f('0x64')]){var _0x701e21=path[_0xf80f('0x5c')](_0x30af31,_0x25491d['Attachment']['basename']);if(fs[_0xf80f('0x77')](_0x701e21)){fs[_0xf80f('0x78')](_0x701e21)['pipe'](fs['createWriteStream'](path['join'](_0x27276f,_0x25491d[_0xf80f('0x64')][_0xf80f('0x79')])));}}return{'date':moment(_0x25491d[_0xf80f('0x66')])[_0xf80f('0x4b')](_0xf80f('0x4c'))[_0xf80f('0x58')](),'sender':_0x25491d[_0xf80f('0x67')]===_0xf80f('0x7a')?_0x25491d['User']?_0x25491d['User'][_0xf80f('0x6f')]:_0xf80f('0x7b'):_0x25491d[_0xf80f('0x61')]['firstName']+(_0x25491d['Contact'][_0xf80f('0x63')]?'\x20'+_0x25491d[_0xf80f('0x61')][_0xf80f('0x63')]:''),'body':_0x25491d[_0xf80f('0x64')]?_0x25491d[_0xf80f('0x64')]['basename']:_0x25491d[_0xf80f('0x34')],'direction':_0x25491d[_0xf80f('0x67')]==='out'?'A':'C','secret':_0x25491d[_0xf80f('0x68')],'read':_0x25491d[_0xf80f('0x69')],'attachment':_0x25491d[_0xf80f('0x64')]};})['value']()};return ejs[_0xf80f('0x7c')](path['join'](config[_0xf80f('0x59')],_0xf80f('0x5a'),_0xf80f('0x7d'),'downloadInteraction.ejs'),{'interaction':_0x46d6d2})[_0xf80f('0x19')](function(_0x1587b0){var _0x520011=path[_0xf80f('0x5c')](_0x27276f,_0xf80f('0x7e')+_0x5a6288['id']+'-'+_0x4f7ae8+'.pdf');var _0x46a74b={'path':_0x520011,'channel':'Openchannel','interactionId':_0x5a6288['id']};return pdf['createPdfFromHTML'](_0x1587b0,_0x46a74b);})['then'](function(){return new Promise(function(_0x5daefd,_0x5e03d6){zipdir(_0x27276f,{'saveTo':_0x2d5bb7},function(_0x5e93e6,_0x4e93de){if(_0x5e93e6)return _0x5e03d6(_0x5e93e6);return _0x5daefd(_0x4e93de);});})['then'](function(){return new Promise(function(_0x3fc235,_0x52184a){rimraf(_0x27276f,function(_0x2b7664){if(_0x2b7664)_0x52184a(_0x2b7664);return _0x3fc235();});});})[_0xf80f('0x19')](function(){return _0x25f76a[_0xf80f('0x56')](_0x2d5bb7,_0x186f7f,function(_0x1f97a9){if(_0x1f97a9){logger['error']('Unable\x20to\x20delete\x20zip\x20file',_0x1f97a9);}else{fs[_0xf80f('0x7f')](_0x2d5bb7);}});});});}else{return _0x25f76a[_0xf80f('0xf')](0xc8);}})[_0xf80f('0x32')](handleError(_0x25f76a,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 4800445..7b7ee8f 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 _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 +var _0x975a=['then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','exports','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers'];(function(_0x4a85b8,_0x5cdcfd){var _0x4c6d40=function(_0x344c64){while(--_0x344c64){_0x4a85b8['push'](_0x4a85b8['shift']());}};_0x4c6d40(++_0x5cdcfd);}(_0x975a,0x1f0));var _0xa975=function(_0x4d3a12,_0x4a75f1){_0x4d3a12=_0x4d3a12-0x0;var _0x23aecd=_0x975a[_0x4d3a12];return _0x23aecd;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db'][_0xa975('0x0')];var OpenchannelMessage=require(_0xa975('0x1'))['db'][_0xa975('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xa975('0x3')](0x0);var events={'afterCreate':_0xa975('0x4'),'afterUpdate':_0xa975('0x5'),'afterDestroy':_0xa975('0x6')};function emitEvent(_0x4f3797){return function(_0x17f5e0,_0x508b29,_0x480f70){_0x17f5e0[_0xa975('0x7')]({'attributes':['id'],'raw':!![]})[_0xa975('0x8')](function(_0x2e4254){_0x17f5e0[_0xa975('0x9')](_0xa975('0xa'),_0x2e4254[_0xa975('0xb')](function(_0x58b59b){return{'id':_0x58b59b['id']};}));return OpenchannelMessage[_0xa975('0xc')]({'where':{'OpenchannelInteractionId':_0x17f5e0['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa975('0x8')](function(_0x3014d4){_0x17f5e0['setDataValue']('unreadMessages',_0x3014d4[_0xa975('0xd')]);OpenchannelInteractionEvents[_0xa975('0xe')](_0x4f3797+':'+_0x17f5e0['id'],_0x17f5e0);OpenchannelInteractionEvents[_0xa975('0xe')](_0x4f3797,_0x17f5e0);_0x480f70(null);})[_0xa975('0xf')](_0x480f70(null));};}for(var e in events){if(events[_0xa975('0x10')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0xa975('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 9075bef..7e55239 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 _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 +var _0x8fee=['define','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./openchannelInteraction.attributes','exports'];(function(_0x452f5b,_0x5389d1){var _0x33e5e2=function(_0x34b282){while(--_0x34b282){_0x452f5b['push'](_0x452f5b['shift']());}};_0x33e5e2(++_0x5389d1);}(_0x8fee,0x195));var _0xe8fe=function(_0x173f10,_0x35db61){_0x173f10=_0x173f10-0x0;var _0x53142d=_0x8fee[_0x173f10];return _0x53142d;};'use strict';var _=require(_0xe8fe('0x0'));var util=require(_0xe8fe('0x1'));var logger=require('../../config/logger')(_0xe8fe('0x2'));var moment=require(_0xe8fe('0x3'));var BPromise=require(_0xe8fe('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe8fe('0x5'));var config=require(_0xe8fe('0x6'));var attributes=require(_0xe8fe('0x7'));module[_0xe8fe('0x8')]=function(_0x1fddf6,_0x4d4dab){return _0x1fddf6[_0xe8fe('0x9')](_0xe8fe('0xa'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe8fe('0xb'),'collate':_0xe8fe('0xc'),'hooks':{'beforeUpdate':function(_0x3570a1,_0xa75af6,_0xf16711){if(_0x3570a1[_0xe8fe('0xd')](_0xe8fe('0xe'))){_0x3570a1[_0xe8fe('0xf')]=moment()[_0xe8fe('0x10')](_0xe8fe('0x11'));}_0xf16711(null,_0x3570a1);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index e67413e..d8e577a 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 _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 +var _0xf0b0=['http','redis','socket.io-emitter','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','UpdateOpenchannelInteraction','debug','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x4ea035,_0x5b9512){var _0x37d195=function(_0x5a1f8c){while(--_0x5a1f8c){_0x4ea035['push'](_0x4ea035['shift']());}};_0x37d195(++_0x5b9512);}(_0xf0b0,0x1ba));var _0x0f0b=function(_0x325fc4,_0x43cb59){_0x325fc4=_0x325fc4-0x0;var _0x58c0bb=_0xf0b0[_0x325fc4];return _0x58c0bb;};'use strict';var _=require(_0x0f0b('0x0'));var util=require('util');var moment=require(_0x0f0b('0x1'));var BPromise=require(_0x0f0b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f0b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0f0b('0x4'));var logger=require('../../config/logger')(_0x0f0b('0x5'));var config=require(_0x0f0b('0x6'));var jayson=require(_0x0f0b('0x7'));var client=jayson[_0x0f0b('0x8')][_0x0f0b('0x9')]({'port':0x232a});config[_0x0f0b('0xa')]=_['defaults'](config[_0x0f0b('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0f0b('0xb'))(new Redis(config[_0x0f0b('0xa')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x48f0db,_0x578597,_0x34d699){return new BPromise(function(_0x44cb99,_0x505745){return client[_0x0f0b('0xc')](_0x48f0db,_0x34d699)[_0x0f0b('0xd')](function(_0x2d8e7f){logger[_0x0f0b('0xe')](_0x0f0b('0xf'),_0x578597,_0x0f0b('0x10'));logger['debug'](_0x0f0b('0x11'),_0x578597,_0x0f0b('0x10'),JSON[_0x0f0b('0x12')](_0x2d8e7f));if(_0x2d8e7f[_0x0f0b('0x13')]){if(_0x2d8e7f[_0x0f0b('0x13')][_0x0f0b('0x14')]===0x1f4){logger['error'](_0x0f0b('0xf'),_0x578597,_0x2d8e7f[_0x0f0b('0x13')]['message']);return _0x505745(_0x2d8e7f[_0x0f0b('0x13')][_0x0f0b('0x15')]);}logger['error'](_0x0f0b('0xf'),_0x578597,_0x2d8e7f[_0x0f0b('0x13')][_0x0f0b('0x15')]);return _0x44cb99(_0x2d8e7f[_0x0f0b('0x13')][_0x0f0b('0x15')]);}else{logger[_0x0f0b('0xe')](_0x0f0b('0xf'),_0x578597,_0x0f0b('0x10'));_0x44cb99(_0x2d8e7f[_0x0f0b('0x16')]['message']);}})[_0x0f0b('0x17')](function(_0x2f759f){logger[_0x0f0b('0x13')](_0x0f0b('0xf'),_0x578597,_0x2f759f);_0x505745(_0x2f759f);});});}exports['UpdateOpenchannelInteraction']=function(_0x380c89){var _0x19d065=this;return new Promise(function(_0x4c8769,_0x5263a4){return db[_0x0f0b('0x18')][_0x0f0b('0x19')](_0x380c89[_0x0f0b('0x1a')],{'raw':_0x380c89[_0x0f0b('0x1b')]?_0x380c89['options'][_0x0f0b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x380c89[_0x0f0b('0x1b')]?_0x380c89[_0x0f0b('0x1b')][_0x0f0b('0x1d')]||null:null,'attributes':_0x380c89[_0x0f0b('0x1b')]?_0x380c89[_0x0f0b('0x1b')][_0x0f0b('0x1e')]||null:null,'limit':_0x380c89['options']?_0x380c89[_0x0f0b('0x1b')][_0x0f0b('0x1f')]||null:null})[_0x0f0b('0xd')](function(_0x2fde53){logger[_0x0f0b('0xe')](_0x0f0b('0x20'),_0x380c89);logger[_0x0f0b('0x21')](_0x0f0b('0x20'),_0x380c89,JSON['stringify'](_0x2fde53));_0x4c8769(_0x2fde53);})[_0x0f0b('0x17')](function(_0x46902a){logger[_0x0f0b('0x13')]('UpdateOpenchannelInteraction',_0x46902a[_0x0f0b('0x15')],_0x380c89);_0x5263a4(_0x19d065[_0x0f0b('0x13')](0x1f4,_0x46902a[_0x0f0b('0x15')]));});});};exports[_0x0f0b('0x22')]=function(_0x5e9a3d){return new Promise(function(_0xd24f0,_0x117543){return db[_0x0f0b('0x18')][_0x0f0b('0x23')]({'where':_0x5e9a3d[_0x0f0b('0x1b')]?_0x5e9a3d['options'][_0x0f0b('0x1d')]||null:null})['then'](function(_0x55d14c){if(_0x55d14c){return _0x55d14c[_0x0f0b('0x24')](_0x5e9a3d[_0x0f0b('0x1a')][_0x0f0b('0x25')],_[_0x0f0b('0x26')](_0x5e9a3d[_0x0f0b('0x1a')],[_0x0f0b('0x25'),'id'])||{});}})[_0x0f0b('0x27')](function(_0x236d85){logger['info']('AddTags',_0x5e9a3d);logger['debug']('AddTags',_0x5e9a3d,JSON[_0x0f0b('0x12')](_0x236d85));_0xd24f0(_0x236d85);})[_0x0f0b('0x17')](function(_0x32cc71){logger[_0x0f0b('0x13')](_0x0f0b('0x28'),_0x32cc71[_0x0f0b('0x15')],_0x5e9a3d);_0x117543(_this[_0x0f0b('0x13')](0x1f4,_0x32cc71[_0x0f0b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 6acc797..ad05465 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 _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 +var _0x02ea=['register','length','openchannelInteraction:','./openchannelInteraction.events','remove','update','removeListener'];(function(_0xaf9137,_0x364b8f){var _0x1a6138=function(_0x25ef4d){while(--_0x25ef4d){_0xaf9137['push'](_0xaf9137['shift']());}};_0x1a6138(++_0x364b8f);}(_0x02ea,0x1ed));var _0xa02e=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0x02ea[_0xf51c06];return _0x1d5420;};'use strict';var OpenchannelInteractionEvents=require(_0xa02e('0x0'));var events=['save',_0xa02e('0x1'),_0xa02e('0x2')];function createListener(_0x14aaf5,_0x53c27d){return function(_0x45bdb4){_0x53c27d['emit'](_0x14aaf5,_0x45bdb4);};}function removeListener(_0x1c4358,_0x32d452){return function(){OpenchannelInteractionEvents[_0xa02e('0x3')](_0x1c4358,_0x32d452);};}exports[_0xa02e('0x4')]=function(_0x18a1c0){for(var _0x7dab15=0x0,_0x57a1b9=events[_0xa02e('0x5')];_0x7dab15<_0x57a1b9;_0x7dab15++){var _0x13e6ce=events[_0x7dab15];var _0x2a5257=createListener(_0xa02e('0x6')+_0x13e6ce,_0x18a1c0);OpenchannelInteractionEvents['on'](_0x13e6ce,_0x2a5257);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index a1d682f..212eec1 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_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 +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x9c8c83,_0x16ebdd){var _0x4636ac=function(_0x5bacfc){while(--_0x5bacfc){_0x9c8c83['push'](_0x9c8c83['shift']());}};_0x4636ac(++_0x16ebdd);}(_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('./openchannelMessage.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')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('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 eeeabee..216a1ed 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 _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 +var _0x61d0=['STRING','sequelize','TEXT','medium','BOOLEAN','out'];(function(_0x18c51a,_0x24773c){var _0x4dfd04=function(_0x49834f){while(--_0x49834f){_0x18c51a['push'](_0x18c51a['shift']());}};_0x4dfd04(++_0x24773c);}(_0x61d0,0x187));var _0x061d=function(_0x4ae459,_0x3bf329){_0x4ae459=_0x4ae459-0x0;var _0x51d0c9=_0x61d0[_0x4ae459];return _0x51d0c9;};'use strict';var Sequelize=require(_0x061d('0x0'));module['exports']={'body':{'type':Sequelize[_0x061d('0x1')](_0x061d('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x061d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x061d('0x4')),'defaultValue':_0x061d('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x061d('0x5')]},'providerResponse':{'type':Sequelize[_0x061d('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 9804e17..555c2e6 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 _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 +var _0x7a54=['User','EventManager','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','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','destroy','sendStatus','stack','name','send','index','map','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','OpenchannelMessage','includeAll','include','then','rows','show','keys','length','find','create','update','body','params','describe','openchannel-interactions','accept','openchannel','readAt','format','UserId','user','agent','get','OpenchannelInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','../../config/logger','reject','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','sequelize'];(function(_0x5e358a,_0x22ed70){var _0x52fb8c=function(_0x2319b0){while(--_0x2319b0){_0x5e358a['push'](_0x5e358a['shift']());}};_0x52fb8c(++_0x22ed70);}(_0x7a54,0x106));var _0x47a5=function(_0x3a9311,_0x3a8925){_0x3a9311=_0x3a9311-0x0;var _0x2d1fd6=_0x7a54[_0x3a9311];return _0x2d1fd6;};'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'];config[_0x47a5('0x16')]=_[_0x47a5('0x17')](config['redis'],{'host':_0x47a5('0x18'),'port':0x18eb});var socket=require(_0x47a5('0x19'))(new Redis(config[_0x47a5('0x16')]));require(_0x47a5('0x1a'))[_0x47a5('0x1b')](socket);var jayson=require(_0x47a5('0x1c'));var client=jayson[_0x47a5('0x1d')][_0x47a5('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x47a5('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x11faf5,_0x3b001e,_0x2a2cbb,_0x1ef44c){return new BPromise(function(_0x574af6,_0x549de3){var _0x138bc0=_0x1ef44c||client;return _0x138bc0['request'](_0x11faf5,_0x2a2cbb)['then'](function(_0x423a81){logger[_0x47a5('0x1f')](_0x47a5('0x20'),_0x3b001e,_0x47a5('0x21'));logger[_0x47a5('0x22')](_0x47a5('0x23'),_0x3b001e,_0x47a5('0x21'),JSON[_0x47a5('0x24')](_0x423a81));if(_0x423a81[_0x47a5('0x25')]){if(_0x423a81['error'][_0x47a5('0x26')]===0x1f4){logger[_0x47a5('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x3b001e,_0x423a81[_0x47a5('0x25')][_0x47a5('0x27')]);return _0x549de3(_0x423a81[_0x47a5('0x25')]['message']);}logger[_0x47a5('0x25')](_0x47a5('0x20'),_0x3b001e,_0x423a81[_0x47a5('0x25')][_0x47a5('0x27')]);return _0x574af6(_0x423a81['error'][_0x47a5('0x27')]);}else{logger[_0x47a5('0x1f')]('OpenchannelMessage,\x20%s,\x20%s',_0x3b001e,_0x47a5('0x21'));_0x574af6(_0x423a81[_0x47a5('0x28')][_0x47a5('0x27')]);}})[_0x47a5('0x29')](function(_0x3abd6a){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x3b001e,_0x3abd6a);_0x549de3(_0x3abd6a);});});}function respondWithStatusCode(_0x136745,_0x5686db){_0x5686db=_0x5686db||0xcc;return function(_0x1ea9c8){if(_0x1ea9c8){return _0x136745['sendStatus'](_0x5686db);}return _0x136745[_0x47a5('0x2a')](_0x5686db)[_0x47a5('0x2b')]();};}function respondWithResult(_0x36ad34,_0x1dac65){_0x1dac65=_0x1dac65||0xc8;return function(_0x21f296){if(_0x21f296){return _0x36ad34[_0x47a5('0x2a')](_0x1dac65)[_0x47a5('0x2c')](_0x21f296);}};}function respondWithFilteredResult(_0x136b14,_0x16631f){return function(_0x361bfa){if(_0x361bfa){var _0x1127f8=typeof _0x16631f[_0x47a5('0x2d')]===_0x47a5('0x2e')&&typeof _0x16631f['limit']===_0x47a5('0x2e');var _0x51833b=_0x361bfa[_0x47a5('0x2f')];var _0x9ac908=_0x1127f8?0x0:_0x16631f[_0x47a5('0x2d')];var _0x4d6b57=_0x1127f8?_0x361bfa[_0x47a5('0x2f')]:_0x16631f[_0x47a5('0x2d')]+_0x16631f[_0x47a5('0x30')];var _0x1f1c68;if(_0x4d6b57>=_0x51833b){_0x4d6b57=_0x51833b;_0x1f1c68=0xc8;}else{_0x1f1c68=0xce;}_0x136b14['status'](_0x1f1c68);return _0x136b14['set'](_0x47a5('0x31'),_0x9ac908+'-'+_0x4d6b57+'/'+_0x51833b)[_0x47a5('0x2c')](_0x361bfa);}return null;};}function patchUpdates(_0x5bd7eb){return function(_0x4e1006){try{jsonpatch[_0x47a5('0x32')](_0x4e1006,_0x5bd7eb,!![]);}catch(_0x51544e){return BPromise['reject'](_0x51544e);}return _0x4e1006[_0x47a5('0x33')]();};}function saveUpdates(_0x53119b,_0x122ed6){return function(_0xd972c){if(_0xd972c){return _0xd972c['update'](_0x53119b)['then'](function(_0x274e34){return _0x274e34;});}return null;};}function removeEntity(_0x5910bb,_0x403028){return function(_0x87e4c9){if(_0x87e4c9){return _0x87e4c9[_0x47a5('0x34')]()['then'](function(){_0x5910bb[_0x47a5('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53c754,_0x65542e){return function(_0x5a8a7c){if(!_0x5a8a7c){_0x53c754[_0x47a5('0x35')](0x194);}return _0x5a8a7c;};}function handleError(_0x5ef577,_0x21ad34){_0x21ad34=_0x21ad34||0x1f4;return function(_0x3534cb){logger[_0x47a5('0x25')](_0x3534cb[_0x47a5('0x36')]);if(_0x3534cb[_0x47a5('0x37')]){delete _0x3534cb[_0x47a5('0x37')];}_0x5ef577[_0x47a5('0x2a')](_0x21ad34)[_0x47a5('0x38')](_0x3534cb);};}exports[_0x47a5('0x39')]=function(_0x4caed5,_0x396a9a){var _0x10f136={},_0x511c06={},_0x2c50d6={'count':0x0,'rows':[]};var _0x2bf53d=_[_0x47a5('0x3a')](db['OpenchannelMessage'][_0x47a5('0x3b')],function(_0x10f660){return{'name':_0x10f660['fieldName'],'type':_0x10f660[_0x47a5('0x3c')][_0x47a5('0x3d')]};});_0x511c06['model']=_['map'](_0x2bf53d,'name');_0x511c06[_0x47a5('0x3e')]=_['keys'](_0x4caed5[_0x47a5('0x3e')]);_0x511c06[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x511c06[_0x47a5('0x41')],_0x511c06[_0x47a5('0x3e')]);_0x10f136[_0x47a5('0x42')]=_[_0x47a5('0x40')](_0x511c06[_0x47a5('0x41')],qs[_0x47a5('0x43')](_0x4caed5[_0x47a5('0x3e')][_0x47a5('0x43')]));_0x10f136[_0x47a5('0x42')]=_0x10f136[_0x47a5('0x42')]['length']?_0x10f136[_0x47a5('0x42')]:_0x511c06[_0x47a5('0x41')];if(!_0x4caed5[_0x47a5('0x3e')][_0x47a5('0x44')]('nolimit')){_0x10f136[_0x47a5('0x30')]=qs['limit'](_0x4caed5['query']['limit']);_0x10f136['offset']=qs[_0x47a5('0x2d')](_0x4caed5['query'][_0x47a5('0x2d')]);}_0x10f136[_0x47a5('0x45')]=qs[_0x47a5('0x46')](_0x4caed5['query'][_0x47a5('0x46')]);_0x10f136[_0x47a5('0x47')]=qs['filters'](_['pick'](_0x4caed5[_0x47a5('0x3e')],_0x511c06['filters']),_0x2bf53d);if(_0x4caed5[_0x47a5('0x3e')][_0x47a5('0x48')]){_0x10f136[_0x47a5('0x47')]=_[_0x47a5('0x49')](_0x10f136[_0x47a5('0x47')],{'$or':_[_0x47a5('0x3a')](_0x2bf53d,function(_0x434227){if(_0x434227[_0x47a5('0x3c')]!==_0x47a5('0x4a')){var _0x162fa0={};_0x162fa0[_0x434227[_0x47a5('0x37')]]={'$like':'%'+_0x4caed5[_0x47a5('0x3e')][_0x47a5('0x48')]+'%'};return _0x162fa0;}})});}_0x10f136=_[_0x47a5('0x49')]({},_0x10f136,_0x4caed5[_0x47a5('0x4b')]);var _0x3a2b38={'where':_0x10f136['where']};return db[_0x47a5('0x4c')][_0x47a5('0x2f')](_0x3a2b38)['then'](function(_0x52b3a8){_0x2c50d6[_0x47a5('0x2f')]=_0x52b3a8;if(_0x4caed5['query'][_0x47a5('0x4d')]){_0x10f136[_0x47a5('0x4e')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x10f136);})[_0x47a5('0x4f')](function(_0x52d409){_0x2c50d6[_0x47a5('0x50')]=_0x52d409;return _0x2c50d6;})[_0x47a5('0x4f')](respondWithFilteredResult(_0x396a9a,_0x10f136))[_0x47a5('0x29')](handleError(_0x396a9a,null));};exports[_0x47a5('0x51')]=function(_0x44fe8a,_0x26acd2){var _0x238ebb={'raw':!![],'where':{'id':_0x44fe8a['params']['id']}},_0x53e994={};_0x53e994[_0x47a5('0x41')]=_[_0x47a5('0x52')](db[_0x47a5('0x4c')][_0x47a5('0x3b')]);_0x53e994[_0x47a5('0x3e')]=_[_0x47a5('0x52')](_0x44fe8a[_0x47a5('0x3e')]);_0x53e994['filters']=_[_0x47a5('0x40')](_0x53e994[_0x47a5('0x41')],_0x53e994[_0x47a5('0x3e')]);_0x238ebb['attributes']=_[_0x47a5('0x40')](_0x53e994['model'],qs[_0x47a5('0x43')](_0x44fe8a[_0x47a5('0x3e')][_0x47a5('0x43')]));_0x238ebb[_0x47a5('0x42')]=_0x238ebb['attributes'][_0x47a5('0x53')]?_0x238ebb[_0x47a5('0x42')]:_0x53e994[_0x47a5('0x41')];if(_0x44fe8a[_0x47a5('0x3e')][_0x47a5('0x4d')]){_0x238ebb[_0x47a5('0x4e')]=[{'all':!![]}];}_0x238ebb=_[_0x47a5('0x49')]({},_0x238ebb,_0x44fe8a['options']);return db[_0x47a5('0x4c')][_0x47a5('0x54')](_0x238ebb)[_0x47a5('0x4f')](handleEntityNotFound(_0x26acd2,null))[_0x47a5('0x4f')](respondWithResult(_0x26acd2,null))[_0x47a5('0x29')](handleError(_0x26acd2,null));};exports[_0x47a5('0x55')]=function(_0x572233,_0x1ad6a9){return db[_0x47a5('0x4c')][_0x47a5('0x55')](_0x572233['body'],{})[_0x47a5('0x4f')](respondWithResult(_0x1ad6a9,0xc9))[_0x47a5('0x29')](handleError(_0x1ad6a9,null));};exports[_0x47a5('0x56')]=function(_0x5d8d4a,_0x57641e){if(_0x5d8d4a[_0x47a5('0x57')]['id']){delete _0x5d8d4a[_0x47a5('0x57')]['id'];}return db['OpenchannelMessage']['find']({'where':{'id':_0x5d8d4a[_0x47a5('0x58')]['id']}})['then'](handleEntityNotFound(_0x57641e,null))[_0x47a5('0x4f')](saveUpdates(_0x5d8d4a['body'],null))['then'](respondWithResult(_0x57641e,null))[_0x47a5('0x29')](handleError(_0x57641e,null));};exports[_0x47a5('0x34')]=function(_0x53eedf,_0x1b958b){return db[_0x47a5('0x4c')]['find']({'where':{'id':_0x53eedf['params']['id']}})[_0x47a5('0x4f')](handleEntityNotFound(_0x1b958b,null))[_0x47a5('0x4f')](removeEntity(_0x1b958b,null))[_0x47a5('0x29')](handleError(_0x1b958b,null));};exports[_0x47a5('0x59')]=function(_0x5996c4,_0x199621){return db[_0x47a5('0x4c')][_0x47a5('0x59')]()['then'](respondWithResult(_0x199621,null))[_0x47a5('0x29')](handleError(_0x199621,null));};var interaction_log=require('../../config/logger')(_0x47a5('0x5a'));exports[_0x47a5('0x5b')]=function(_0x943a15,_0x1c485b,_0x3603b7){var _0x4966af={'agent':{},'channel':_0x47a5('0x5c')};if(_0x943a15['body']['id']){delete _0x943a15['body']['id'];}_0x943a15['body']['read']=!![];_0x943a15[_0x47a5('0x57')][_0x47a5('0x5d')]=moment()[_0x47a5('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x943a15['body'][_0x47a5('0x5f')]=_0x943a15[_0x47a5('0x57')][_0x47a5('0x5f')]||_0x943a15[_0x47a5('0x60')]['id'];_0x4966af[_0x47a5('0x61')]['id']=_0x943a15['body'][_0x47a5('0x5f')];return db['OpenchannelMessage'][_0x47a5('0x54')]({'where':{'id':_0x943a15[_0x47a5('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1c485b,null))[_0x47a5('0x4f')](saveUpdates(_0x943a15[_0x47a5('0x57')],null))[_0x47a5('0x4f')](function(_0x3e8274){if(_0x3e8274){_0x4966af[_0x47a5('0x27')]=_0x3e8274[_0x47a5('0x62')]({'plain':!![]});return db[_0x47a5('0x63')][_0x47a5('0x54')]({'where':{'id':_0x3e8274['OpenchannelInteractionId']}});}return null;})[_0x47a5('0x4f')](handleEntityNotFound(_0x1c485b,null))[_0x47a5('0x4f')](function(_0x3c75c6){if(_0x3c75c6){return _0x3c75c6[_0x47a5('0x56')]({'UserId':_0x943a15[_0x47a5('0x57')]['UserId'],'read1stAt':_[_0x47a5('0x64')](_0x3c75c6[_0x47a5('0x65')])?moment()[_0x47a5('0x5e')](_0x47a5('0x66')):undefined});}return null;})[_0x47a5('0x4f')](function(_0x168329){if(_0x168329){_0x4966af[_0x47a5('0x67')]=_0x168329[_0x47a5('0x62')]({'plain':!![]});interaction_log[_0x47a5('0x1f')](_0x47a5('0x68'),_0x943a15[_0x47a5('0x60')]['id'],_0x943a15[_0x47a5('0x60')][_0x47a5('0x37')],_0x943a15[_0x47a5('0x60')][_0x47a5('0x69')],_0x4966af['interaction']['id'],_0x943a15[_0x47a5('0x57')]?JSON[_0x47a5('0x24')](_0x943a15[_0x47a5('0x57')]):'null');return respondWithRpcPromise(_0x47a5('0x6a'),_0x47a5('0x6b'),_0x4966af);}return null;})[_0x47a5('0x4f')](function(_0x26f1ac){var _0x5d9822=_0x47a5('0x6c')+_0x26f1ac['message'][_0x47a5('0x6d')];return db['sequelize'][_0x47a5('0x3e')](_0x5d9822,{'type':db['Sequelize'][_0x47a5('0x6e')][_0x47a5('0x6f')],'raw':!![]})[_0x47a5('0x4f')](function(_0x58473b){return _0x58473b;});})['then'](function(_0x4b8084){if(_0x4b8084){_0x4966af[_0x47a5('0x27')][_0x47a5('0x70')]=_0x4b8084[0x0];if(!_0x943a15[_0x47a5('0x57')][_0x47a5('0x5f')])return;return db['User'][_0x47a5('0x54')]({'where':{'id':_0x943a15[_0x47a5('0x57')][_0x47a5('0x5f')],'role':_0x47a5('0x61')},'attributes':['id',_0x47a5('0x37'),_0x47a5('0x71'),_0x47a5('0x72'),_0x47a5('0x73')],'raw':!![]});}return null;})[_0x47a5('0x4f')](function(_0xc69a68){if(!_0xc69a68)return null;_0x4966af[_0x47a5('0x27')][_0x47a5('0x61')]=_0xc69a68;return _0x4966af;})['then'](function(_0x1e3212){if(_0x1e3212){if(_0x943a15['body'][_0x47a5('0x74')]){_0x4966af[_0x47a5('0x27')][_0x47a5('0x75')]=util[_0x47a5('0x5e')](_0x47a5('0x76'),_0x943a15[_0x47a5('0x60')][_0x47a5('0x37')]);_0x4966af[_0x47a5('0x27')][_0x47a5('0x77')]=_0x4966af[_0x47a5('0x77')];_0x4966af[_0x47a5('0x27')][_0x47a5('0x78')]=_0x4966af[_0x47a5('0x77')];_0x4966af[_0x47a5('0x27')][_0x47a5('0x79')]='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x4966af[_0x47a5('0x27')]},client9002)[_0x47a5('0x4f')](function(){return _0x4966af;});}return _0x4966af;}return null;})['then'](respondWithResult(_0x1c485b,null))[_0x47a5('0x29')](handleError(_0x1c485b,null));};var interaction_log=require(_0x47a5('0x7a'))(_0x47a5('0x5a'));exports[_0x47a5('0x7b')]=function(_0x3cd335,_0x930d25,_0x218dfa){var _0x1c7302={'agent':{},'channel':_0x47a5('0x5c')};if(_0x3cd335[_0x47a5('0x57')]['id']){delete _0x3cd335[_0x47a5('0x57')]['id'];}_0x3cd335['body'][_0x47a5('0x5f')]=_0x3cd335[_0x47a5('0x57')][_0x47a5('0x5f')]||_0x3cd335['user']['id'];_0x1c7302[_0x47a5('0x61')]['id']=_0x3cd335[_0x47a5('0x57')][_0x47a5('0x5f')];return db['OpenchannelMessage'][_0x47a5('0x54')]({'where':{'id':_0x3cd335['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x930d25,null))[_0x47a5('0x4f')](function(_0x292d9c){if(_0x292d9c){_0x1c7302[_0x47a5('0x27')]=_0x292d9c[_0x47a5('0x62')]({'plain':!![]});return db[_0x47a5('0x63')][_0x47a5('0x54')]({'where':{'id':_0x292d9c['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x930d25,null))[_0x47a5('0x4f')](function(_0x4f2361){if(_0x4f2361){_0x1c7302[_0x47a5('0x67')]=_0x4f2361[_0x47a5('0x62')]({'plain':!![]});interaction_log[_0x47a5('0x1f')](_0x47a5('0x7c'),_0x3cd335['user']['id'],_0x3cd335[_0x47a5('0x60')]['name'],_0x3cd335['user'][_0x47a5('0x69')],_0x1c7302[_0x47a5('0x67')]['id'],_0x3cd335['body']?JSON[_0x47a5('0x24')](_0x3cd335[_0x47a5('0x57')]):_0x47a5('0x7d'));return respondWithRpcPromise('RejectMessage',_0x47a5('0x7e'),_0x1c7302);}return null;})['then'](function(_0x2307da){var _0x219beb=_0x47a5('0x6c')+_0x2307da['message'][_0x47a5('0x6d')];return db[_0x47a5('0x7f')][_0x47a5('0x3e')](_0x219beb,{'type':db['Sequelize'][_0x47a5('0x6e')]['SELECT'],'raw':!![]})[_0x47a5('0x4f')](function(_0x491bb4){return _0x491bb4;});})[_0x47a5('0x4f')](function(_0x20d8bd){if(_0x20d8bd){_0x1c7302[_0x47a5('0x27')][_0x47a5('0x70')]=_0x20d8bd[0x0];if(!_0x3cd335['body'][_0x47a5('0x5f')])return;return db[_0x47a5('0x80')][_0x47a5('0x54')]({'where':{'id':_0x3cd335[_0x47a5('0x57')][_0x47a5('0x5f')],'role':'agent'},'attributes':['id','name',_0x47a5('0x71'),'email',_0x47a5('0x73')],'raw':!![]});}return null;})[_0x47a5('0x4f')](function(_0x216402){if(!_0x216402)return null;_0x1c7302['message'][_0x47a5('0x61')]=_0x216402;return _0x1c7302;})[_0x47a5('0x4f')](function(_0x565fbe){if(_0x565fbe){_0x565fbe[_0x47a5('0x27')][_0x47a5('0x75')]=util[_0x47a5('0x5e')](_0x47a5('0x76'),_0x3cd335['user']['name']);_0x565fbe[_0x47a5('0x27')][_0x47a5('0x77')]=_0x1c7302['channel'];_0x565fbe[_0x47a5('0x27')][_0x47a5('0x78')]=_0x1c7302['channel'];_0x565fbe[_0x47a5('0x27')][_0x47a5('0x79')]=_0x47a5('0x7b');respondWithRpcPromise('EventManager',_0x47a5('0x81'),{'event':'rejectmessage','message':_0x565fbe[_0x47a5('0x27')]},client9002);return _0x1c7302;}return null;})['then'](respondWithResult(_0x930d25,null))[_0x47a5('0x29')](handleError(_0x930d25,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index fc660da..16a3a4f 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 _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 +var _0x1346=['hasOwnProperty','hook','exports','events','OpenchannelMessage','setMaxListeners','save','update','remove','emit'];(function(_0x222111,_0x408476){var _0x51106f=function(_0x5b4b02){while(--_0x5b4b02){_0x222111['push'](_0x222111['shift']());}};_0x51106f(++_0x408476);}(_0x1346,0xad));var _0x6134=function(_0x36713f,_0x1e9949){_0x36713f=_0x36713f-0x0;var _0x3e5ffe=_0x1346[_0x36713f];return _0x3e5ffe;};'use strict';var EventEmitter=require(_0x6134('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x6134('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x6134('0x2')](0x0);var events={'afterCreate':_0x6134('0x3'),'afterUpdate':_0x6134('0x4'),'afterDestroy':_0x6134('0x5')};function emitEvent(_0x4d0488){return function(_0x5caa26,_0x30c095,_0x87866d){OpenchannelMessageEvents[_0x6134('0x6')](_0x4d0488+':'+_0x5caa26['id'],_0x5caa26);OpenchannelMessageEvents['emit'](_0x4d0488,_0x5caa26);_0x87866d(null);};}for(var e in events){if(events[_0x6134('0x7')](e)){var event=events[e];OpenchannelMessage[_0x6134('0x8')](e,emitEvent(event));}}module[_0x6134('0x9')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 8fd0d13..b8cb0a1 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 _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 +var _0xb7d4=['isNil','findOne','OpenchannelInteractionId','then','update','catch','error','secret','CmContact','describe','OpenchannelAccount','find','OpenchannelInteraction','Interactions','Contact','keys','replyUri','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','GET','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4_unicode_ci','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','out'];(function(_0x5efc71,_0x44d64a){var _0x1e2cf9=function(_0xe13238){while(--_0xe13238){_0x5efc71['push'](_0x5efc71['shift']());}};_0x1e2cf9(++_0x44d64a);}(_0xb7d4,0xde));var _0x4b7d=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xb7d4[_0x1d24eb];return _0x1dc576;};'use strict';var _=require('lodash');var util=require(_0x4b7d('0x0'));var logger=require(_0x4b7d('0x1'))(_0x4b7d('0x2'));var moment=require(_0x4b7d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4b7d('0x4'));var rimraf=require(_0x4b7d('0x5'));var config=require(_0x4b7d('0x6'));var attributes=require(_0x4b7d('0x7'));module['exports']=function(_0x6507d,_0x2168da){return _0x6507d[_0x4b7d('0x8')](_0x4b7d('0x9'),attributes,{'tableName':_0x4b7d('0xa'),'paranoid':![],'indexes':[{'name':_0x4b7d('0xb'),'fields':[_0x4b7d('0xc')],'type':_0x4b7d('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x219b02,_0x94a5bf,_0x3c0717){var _0x537606=_0x6507d['models'];var _0x2b5522=_0x219b02[_0x4b7d('0xe')]({'plain':!![]});if(_0x2b5522[_0x4b7d('0xf')]['toLowerCase']()==='in'||_0x2b5522[_0x4b7d('0xf')][_0x4b7d('0x10')]()===_0x4b7d('0x11')&&!_0x2b5522['secret']&&!_[_0x4b7d('0x12')](_0x2b5522['UserId'])){_0x537606['OpenchannelInteraction'][_0x4b7d('0x13')]({'where':{'id':_0x2b5522[_0x4b7d('0x14')]}})[_0x4b7d('0x15')](function(_0x513640){if(_0x513640){_0x513640[_0x4b7d('0x16')]({'lastMsgAt':_0x2b5522['createdAt'],'lastMsgDirection':_0x2b5522[_0x4b7d('0xf')][_0x4b7d('0x10')]()});}})[_0x4b7d('0x17')](function(_0x2c7e9e){console[_0x4b7d('0x18')](_0x2c7e9e);});}if(_0x2b5522[_0x4b7d('0xf')]===_0x4b7d('0x11')&&!_0x2b5522[_0x4b7d('0x19')]){var _0xf38f07;_0x537606[_0x4b7d('0x1a')][_0x4b7d('0x1b')]()[_0x4b7d('0x15')](function(_0x143dad){return _0x537606[_0x4b7d('0x1c')][_0x4b7d('0x1d')]({'where':{'id':_0x2b5522['OpenchannelAccountId']},'include':[{'model':_0x537606[_0x4b7d('0x1e')],'as':_0x4b7d('0x1f'),'where':{'id':_0x2b5522[_0x4b7d('0x14')]},'limit':0x1,'include':[{'model':_0x537606['CmContact'],'as':_0x4b7d('0x20'),'attributes':_[_0x4b7d('0x21')](_0x143dad)}]}]});})[_0x4b7d('0x15')](function(_0x362541){_0xf38f07=_0x362541[_0x4b7d('0xe')]({'plain':!![]});if(_0xf38f07&&_0xf38f07[_0x4b7d('0x22')]){logger[_0x4b7d('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x4b7d('0x24'),util[_0x4b7d('0x25')](_0x4b7d('0x26'),_0x2b5522['id'],_0xf38f07[_0x4b7d('0x22')]));if(_0xf38f07[_0x4b7d('0x1f')]&&_0xf38f07[_0x4b7d('0x1f')][_0x4b7d('0x27')]){_0x2b5522[_0x4b7d('0x28')]=_['omit'](_0xf38f07[_0x4b7d('0x1f')][0x0],_0x4b7d('0x20'));_0x2b5522['Contact']=_0xf38f07['Interactions'][0x0][_0x4b7d('0x20')];}var _0x94a5bf={'method':'POST','uri':encodeURI(_0xf38f07[_0x4b7d('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x94a5bf['method']){case _0x4b7d('0x29'):_0x94a5bf['qs']=_0x2b5522;break;case'POST':_0x94a5bf[_0x4b7d('0xc')]=_0x2b5522;break;}return rp(_0x94a5bf)[_0x4b7d('0x15')](function(_0x207b3f){logger[_0x4b7d('0x23')](_0x4b7d('0x2a'),_0x4b7d('0x24'),util[_0x4b7d('0x25')](_0x4b7d('0x2b'),_0x2b5522['id'],_0xf38f07[_0x4b7d('0x22')]));if(_0x207b3f['body'][_0x4b7d('0x2c')]&&_0x207b3f[_0x4b7d('0xc')][_0x4b7d('0x2c')]!=_0x2b5522[_0x4b7d('0x28')][_0x4b7d('0x2c')]){return _0x537606[_0x4b7d('0x1e')][_0x4b7d('0x16')]({'threadId':_0x207b3f[_0x4b7d('0xc')][_0x4b7d('0x2c')]},{'where':{'id':_0x2b5522[_0x4b7d('0x28')]['id']}});}else{return;}})[_0x4b7d('0x15')](function(){return _0x219b02[_0x4b7d('0x16')]({'read':!![]});})[_0x4b7d('0x17')](function(_0x502835){logger[_0x4b7d('0x18')](_0x4b7d('0x2a'),'afterCreate',util[_0x4b7d('0x2d')](_0x502835,{'showHidden':![],'depth':null}));_0x3c0717();});}else{_0x3c0717();}})[_0x4b7d('0x2e')](function(){_0x3c0717();});}else{_0x3c0717();}}},'charset':'utf8mb4','collate':_0x4b7d('0x2f')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 510ca0d..35ba705 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 _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 +var _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x5714e2,_0x1cd5fa){var _0x215fdc=function(_0x2cc3ab){while(--_0x2cc3ab){_0x5714e2['push'](_0x5714e2['shift']());}};_0x215fdc(++_0x1cd5fa);}(_0x2ef3,0xba));var _0x32ef=function(_0x3be0c6,_0x3abeb9){_0x3be0c6=_0x3be0c6-0x0;var _0x586476=_0x2ef3[_0x3be0c6];return _0x586476;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index a9f6952..7fea125 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 _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 +var _0xde4e=['update','emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events','save'];(function(_0x3fdf47,_0x4c03a1){var _0x409a13=function(_0xbfa315){while(--_0xbfa315){_0x3fdf47['push'](_0x3fdf47['shift']());}};_0x409a13(++_0x4c03a1);}(_0xde4e,0x18e));var _0xede4=function(_0xe21c76,_0x342419){_0xe21c76=_0xe21c76-0x0;var _0x4ac159=_0xde4e[_0xe21c76];return _0x4ac159;};'use strict';var OpenchannelMessageEvents=require(_0xede4('0x0'));var events=[_0xede4('0x1'),'remove',_0xede4('0x2')];function createListener(_0x30eebc,_0x64ee1b){return function(_0x255044){_0x64ee1b[_0xede4('0x3')](_0x30eebc,_0x255044);};}function removeListener(_0x43e5d6,_0x3d42c7){return function(){OpenchannelMessageEvents[_0xede4('0x4')](_0x43e5d6,_0x3d42c7);};}exports[_0xede4('0x5')]=function(_0x4bec4f){for(var _0x39065d=0x0,_0x2c2bdf=events[_0xede4('0x6')];_0x39065d<_0x2c2bdf;_0x39065d++){var _0x387be8=events[_0x39065d];var _0x22b2e6=createListener(_0xede4('0x7')+_0x387be8,_0x4bec4f);OpenchannelMessageEvents['on'](_0x387be8,_0x22b2e6);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 43c753e..4e16126 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 _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 +var _0x28e1=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','/:id','isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','update','delete','destroy','removeTeams','exports'];(function(_0x237eb2,_0x48ed97){var _0x44cf6a=function(_0x44c170){while(--_0x44c170){_0x237eb2['push'](_0x237eb2['shift']());}};_0x44cf6a(++_0x48ed97);}(_0x28e1,0xf0));var _0x128e=function(_0x4a5755,_0x25a4f2){_0x4a5755=_0x4a5755-0x0;var _0x7b8985=_0x28e1[_0x4a5755];return _0x7b8985;};'use strict';var multer=require(_0x128e('0x0'));var util=require(_0x128e('0x1'));var path=require(_0x128e('0x2'));var timeout=require(_0x128e('0x3'));var express=require(_0x128e('0x4'));var router=express[_0x128e('0x5')]();var fs_extra=require(_0x128e('0x6'));var auth=require(_0x128e('0x7'));var interaction=require(_0x128e('0x8'));var config=require(_0x128e('0x9'));var controller=require('./openchannelQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x128e('0xa')]);router[_0x128e('0xb')](_0x128e('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x128e('0xb')](_0x128e('0xd'),auth[_0x128e('0xe')](),controller[_0x128e('0xf')]);router['get'](_0x128e('0x10'),auth[_0x128e('0xe')](),controller[_0x128e('0x11')]);router['get'](_0x128e('0x12'),auth['isAuthenticated'](),controller[_0x128e('0x13')]);router['get']('/:id/users',auth[_0x128e('0xe')](),controller[_0x128e('0x14')]);router[_0x128e('0x15')]('/',auth[_0x128e('0xe')](),controller[_0x128e('0x16')]);router[_0x128e('0x15')](_0x128e('0x12'),auth[_0x128e('0xe')](),controller[_0x128e('0x17')]);router[_0x128e('0x15')](_0x128e('0x18'),auth[_0x128e('0xe')](),controller['addAgents']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x128e('0x19')]);router[_0x128e('0x1a')](_0x128e('0xd'),auth['isAuthenticated'](),controller[_0x128e('0x1b')]);router[_0x128e('0x1a')](_0x128e('0x12'),auth[_0x128e('0xe')](),controller[_0x128e('0x1c')]);router[_0x128e('0x1a')](_0x128e('0x18'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x128e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 45be471..f7395cc 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 _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 +var _0x3373=['exports','STRING','INTEGER','ENUM','rrmemory','roundrobin'];(function(_0x33244d,_0x91dbef){var _0x2fe218=function(_0xf75e12){while(--_0xf75e12){_0x33244d['push'](_0x33244d['shift']());}};_0x2fe218(++_0x91dbef);}(_0x3373,0x1e0));var _0x3337=function(_0x4aa12a,_0x3702b3){_0x4aa12a=_0x4aa12a-0x0;var _0xdd0fed=_0x3373[_0x4aa12a];return _0xdd0fed;};'use strict';var Sequelize=require('sequelize');module[_0x3337('0x0')]={'name':{'type':Sequelize[_0x3337('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x3337('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3337('0x3')](_0x3337('0x4'),'beepall',_0x3337('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index dda8a79..44cb1e1 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 _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 +var _0x1a37=['createdAt','format','%s/%s','SIP','openchannelPause','getTeams','Team','addTeams','ids','Agents','flatMap','sequelize','transaction','each','forEach','emit','userOpenchannelQueue:save','removeTeams','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','addAgents','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','bluebird','util','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','update','then','UserProfileResource','destroy','error','stack','name','index','map','OpenchannelQueue','rawAttributes','fieldName','type','getOptions','where','include','query','rows','catch','show','params','model','keys','filters','intersection','attributes','length','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','describe','getMembers','findOne','UserOpenchannelQueue','fields','hasOwnProperty','nolimit','order','sort','pick','OpenchannelQueueId','filter','options','findAll','User','findAndCountAll','UserId','updatedAt'];(function(_0x9ff51,_0x4c951f){var _0x31959b=function(_0x350371){while(--_0x350371){_0x9ff51['push'](_0x9ff51['shift']());}};_0x31959b(++_0x4c951f);}(_0x1a37,0x184));var _0x71a3=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x1a37[_0x18ab2a];return _0x16dcee;};'use strict';var BPromise=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var _=require('lodash');var squel=require('squel');var Redis=require(_0x71a3('0x2'));var qs=require(_0x71a3('0x3'));var logger=require(_0x71a3('0x4'))(_0x71a3('0x5'));var config=require(_0x71a3('0x6'));var db=require(_0x71a3('0x7'))['db'];config[_0x71a3('0x8')]=_['defaults'](config['redis'],{'host':_0x71a3('0x9'),'port':0x18eb});var socket=require(_0x71a3('0xa'))(new Redis(config[_0x71a3('0x8')]));require(_0x71a3('0xb'))[_0x71a3('0xc')](socket);function respondWithStatusCode(_0x10a19d,_0xe2d6cb){_0xe2d6cb=_0xe2d6cb||0xcc;return function(_0xd939f0){if(_0xd939f0){return _0x10a19d[_0x71a3('0xd')](_0xe2d6cb);}return _0x10a19d[_0x71a3('0xe')](_0xe2d6cb)[_0x71a3('0xf')]();};}function respondWithResult(_0x284589,_0x1dbf95){_0x1dbf95=_0x1dbf95||0xc8;return function(_0x9e768d){if(_0x9e768d){return _0x284589['status'](_0x1dbf95)[_0x71a3('0x10')](_0x9e768d);}};}function respondWithFilteredResult(_0x500de5,_0x34e35f){return function(_0x30030d){if(_0x30030d){var _0x342081=typeof _0x34e35f['offset']===_0x71a3('0x11')&&typeof _0x34e35f['limit']==='undefined';var _0x165a1b=_0x30030d[_0x71a3('0x12')];var _0x40f286=_0x342081?0x0:_0x34e35f[_0x71a3('0x13')];var _0x259d6d=_0x342081?_0x30030d[_0x71a3('0x12')]:_0x34e35f[_0x71a3('0x13')]+_0x34e35f[_0x71a3('0x14')];var _0x54eb07;if(_0x259d6d>=_0x165a1b){_0x259d6d=_0x165a1b;_0x54eb07=0xc8;}else{_0x54eb07=0xce;}_0x500de5[_0x71a3('0xe')](_0x54eb07);return _0x500de5['set']('Content-Range',_0x40f286+'-'+_0x259d6d+'/'+_0x165a1b)[_0x71a3('0x10')](_0x30030d);}return null;};}function saveUpdates(_0x55e31e){return function(_0x5105ef){if(_0x5105ef){return _0x5105ef[_0x71a3('0x15')](_0x55e31e)[_0x71a3('0x16')](function(_0xb7b79a){return _0xb7b79a;});}return null;};}function removeEntity(_0xe61774){return function(_0x43c5f1){if(_0x43c5f1){return _0x43c5f1['destroy']()[_0x71a3('0x16')](function(){var _0x6f0326=_0x43c5f1['get']({'plain':!![]});var _0x4f81ea='OpenchannelQueues';return db[_0x71a3('0x17')][_0x71a3('0x18')]({'where':{'type':_0x4f81ea,'resourceId':_0x6f0326['id']}})[_0x71a3('0x16')](function(){return _0x43c5f1;});})[_0x71a3('0x16')](function(){_0xe61774['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e80be){return function(_0xa278c){if(!_0xa278c){_0x3e80be[_0x71a3('0xd')](0x194);}return _0xa278c;};}function handleError(_0x15e1c7,_0xe85ae0){_0xe85ae0=_0xe85ae0||0x1f4;return function(_0x4171a4){logger[_0x71a3('0x19')](_0x4171a4[_0x71a3('0x1a')]);if(_0x4171a4[_0x71a3('0x1b')]){delete _0x4171a4[_0x71a3('0x1b')];}_0x15e1c7[_0x71a3('0xe')](_0xe85ae0)['send'](_0x4171a4);};}exports[_0x71a3('0x1c')]=function(_0x50b9ca,_0x408b5a){var _0x2db0f4={};var _0x24e405={'count':0x0,'rows':[]};var _0x814c31=_[_0x71a3('0x1d')](db[_0x71a3('0x1e')][_0x71a3('0x1f')],function(_0x33eb2e){return{'name':_0x33eb2e[_0x71a3('0x20')],'type':_0x33eb2e[_0x71a3('0x21')]['key']};});_0x2db0f4=qs[_0x71a3('0x22')](_0x814c31,_0x50b9ca);var _0xb11800={'where':_0x2db0f4[_0x71a3('0x23')]};return db[_0x71a3('0x1e')][_0x71a3('0x12')](_0xb11800)[_0x71a3('0x16')](function(_0x39c867){_0x24e405['count']=_0x39c867;_0x2db0f4[_0x71a3('0x24')]=qs['include'](_0x50b9ca[_0x71a3('0x25')]);return db[_0x71a3('0x1e')]['findAll'](_0x2db0f4);})['then'](function(_0x27ecc1){_0x24e405[_0x71a3('0x26')]=_0x27ecc1;return _0x24e405;})[_0x71a3('0x16')](respondWithFilteredResult(_0x408b5a,_0x2db0f4))[_0x71a3('0x27')](handleError(_0x408b5a,null));};exports[_0x71a3('0x28')]=function(_0x1cb5d5,_0x32094b){var _0x1edfa9={'raw':!![],'where':{'id':_0x1cb5d5[_0x71a3('0x29')]['id']}},_0x290c83={};_0x290c83[_0x71a3('0x2a')]=_['keys'](db[_0x71a3('0x1e')][_0x71a3('0x1f')]);_0x290c83['query']=_[_0x71a3('0x2b')](_0x1cb5d5['query']);_0x290c83[_0x71a3('0x2c')]=_[_0x71a3('0x2d')](_0x290c83['model'],_0x290c83[_0x71a3('0x25')]);_0x1edfa9[_0x71a3('0x2e')]=_['intersection'](_0x290c83[_0x71a3('0x2a')],qs['fields'](_0x1cb5d5[_0x71a3('0x25')]['fields']));_0x1edfa9['attributes']=_0x1edfa9[_0x71a3('0x2e')][_0x71a3('0x2f')]?_0x1edfa9[_0x71a3('0x2e')]:_0x290c83[_0x71a3('0x2a')];if(_0x1cb5d5['query']['includeAll']){_0x1edfa9[_0x71a3('0x24')]=[{'all':!![]}];}_0x1edfa9=_[_0x71a3('0x30')]({},_0x1edfa9,_0x1cb5d5['options']);return db['OpenchannelQueue'][_0x71a3('0x31')](_0x1edfa9)[_0x71a3('0x16')](handleEntityNotFound(_0x32094b,null))[_0x71a3('0x16')](respondWithResult(_0x32094b,null))[_0x71a3('0x27')](handleError(_0x32094b,null));};exports[_0x71a3('0x32')]=function(_0x3ff2e6,_0x4308fe){return db['OpenchannelQueue']['create'](_0x3ff2e6[_0x71a3('0x33')],{})[_0x71a3('0x16')](function(_0x2d4831){var _0x181fe3=_0x3ff2e6[_0x71a3('0x34')][_0x71a3('0x35')]({'plain':!![]});if(!_0x181fe3)throw new Error(_0x71a3('0x36'));if(_0x181fe3[_0x71a3('0x37')]===_0x71a3('0x34')){var _0x176f59=_0x2d4831['get']({'plain':!![]});var _0x362003='OpenchannelQueues';return db[_0x71a3('0x38')][_0x71a3('0x31')]({'where':{'name':_0x362003,'userProfileId':_0x181fe3[_0x71a3('0x39')]},'raw':!![]})[_0x71a3('0x16')](function(_0x522664){if(_0x522664&&_0x522664['autoAssociation']===0x0){return db['UserProfileResource'][_0x71a3('0x32')]({'name':_0x176f59[_0x71a3('0x1b')],'resourceId':_0x176f59['id'],'type':_0x522664[_0x71a3('0x1b')],'sectionId':_0x522664['id']},{})[_0x71a3('0x16')](function(){return _0x2d4831;});}else{return _0x2d4831;}})[_0x71a3('0x27')](function(_0x19d3f6){logger[_0x71a3('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19d3f6);throw _0x19d3f6;});}return _0x2d4831;})[_0x71a3('0x16')](respondWithResult(_0x4308fe,0xc9))[_0x71a3('0x27')](handleError(_0x4308fe,null));};exports[_0x71a3('0x15')]=function(_0x3f67e4,_0x48af57){if(_0x3f67e4['body']['id']){delete _0x3f67e4[_0x71a3('0x33')]['id'];}return db['OpenchannelQueue'][_0x71a3('0x31')]({'where':{'id':_0x3f67e4['params']['id']}})[_0x71a3('0x16')](handleEntityNotFound(_0x48af57,null))[_0x71a3('0x16')](saveUpdates(_0x3f67e4['body'],null))[_0x71a3('0x16')](respondWithResult(_0x48af57,null))[_0x71a3('0x27')](handleError(_0x48af57,null));};exports['destroy']=function(_0x5e9a35,_0x1b6601){return db[_0x71a3('0x1e')][_0x71a3('0x31')]({'where':{'id':_0x5e9a35[_0x71a3('0x29')]['id']}})['then'](handleEntityNotFound(_0x1b6601,null))[_0x71a3('0x16')](removeEntity(_0x1b6601,null))[_0x71a3('0x27')](handleError(_0x1b6601,null));};exports[_0x71a3('0x3a')]=function(_0x3ed03f,_0x239c43){return db['OpenchannelQueue'][_0x71a3('0x3a')]()[_0x71a3('0x16')](respondWithResult(_0x239c43,null))[_0x71a3('0x27')](handleError(_0x239c43,null));};exports[_0x71a3('0x3b')]=function(_0x1a2d95,_0x598739){var _0x48949a={'raw':!![],'where':{}},_0x1d579e={},_0x141291;return db[_0x71a3('0x1e')][_0x71a3('0x3c')]({'where':{'id':_0x1a2d95[_0x71a3('0x29')]['id']}})['then'](handleEntityNotFound(_0x598739,null))['then'](function(_0x97d164){if(_0x97d164){_0x141291=_0x97d164[_0x71a3('0x35')]({'plain':!![]});_0x1d579e['model']=_[_0x71a3('0x2b')](db[_0x71a3('0x3d')]['rawAttributes']);_0x1d579e['query']=_['keys'](_0x1a2d95[_0x71a3('0x25')]);_0x1d579e[_0x71a3('0x2c')]=_[_0x71a3('0x2d')](_0x1d579e['model'],_0x1d579e[_0x71a3('0x25')]);_0x48949a[_0x71a3('0x2e')]=_[_0x71a3('0x2d')](_0x1d579e['model'],qs[_0x71a3('0x3e')](_0x1a2d95[_0x71a3('0x25')]['fields']));_0x48949a[_0x71a3('0x2e')]=_0x48949a['attributes']['length']?_0x48949a[_0x71a3('0x2e')]:_0x1d579e[_0x71a3('0x2a')];if(!_0x1a2d95[_0x71a3('0x25')][_0x71a3('0x3f')](_0x71a3('0x40'))){_0x48949a[_0x71a3('0x14')]=qs[_0x71a3('0x14')](_0x1a2d95[_0x71a3('0x25')][_0x71a3('0x14')]);_0x48949a['offset']=qs[_0x71a3('0x13')](_0x1a2d95[_0x71a3('0x25')][_0x71a3('0x13')]);}_0x48949a[_0x71a3('0x41')]=qs[_0x71a3('0x42')](_0x1a2d95['query']['sort']);_0x48949a[_0x71a3('0x23')]=qs[_0x71a3('0x2c')](_[_0x71a3('0x43')](_0x1a2d95[_0x71a3('0x25')],_0x1d579e[_0x71a3('0x2c')]));_0x48949a[_0x71a3('0x23')][_0x71a3('0x44')]=_0x97d164['id'];if(_0x1a2d95['query'][_0x71a3('0x45')]){_0x48949a[_0x71a3('0x23')]=_[_0x71a3('0x30')](_0x48949a[_0x71a3('0x23')],{'$or':_[_0x71a3('0x1d')](_0x48949a['attributes'],function(_0x139fd7){var _0x3be82c={};_0x3be82c[_0x139fd7]={'$like':'%'+_0x1a2d95[_0x71a3('0x25')][_0x71a3('0x45')]+'%'};return _0x3be82c;})});}_0x48949a=_[_0x71a3('0x30')]({},_0x48949a,_0x1a2d95[_0x71a3('0x46')]);return db[_0x71a3('0x3d')][_0x71a3('0x47')](_0x48949a);}})[_0x71a3('0x16')](function(_0x174ae3){if(_0x174ae3){return db[_0x71a3('0x48')][_0x71a3('0x49')]({'where':{'id':_[_0x71a3('0x1d')](_0x174ae3,_0x71a3('0x4a')),'role':'agent'},'attributes':['id',_0x71a3('0x1b'),'openchannelPause',_0x71a3('0x4b'),_0x71a3('0x4c')]});}})['then'](function(_0x48de7f){if(_0x48de7f){return{'count':_0x48de7f[_0x71a3('0x12')],'rows':_['map'](_0x48de7f[_0x71a3('0x26')],function(_0x44e189){return{'membername':_0x44e189['name'],'UserId':_0x44e189['id'],'queue_name':_0x141291[_0x71a3('0x1b')],'OpenchannelQueueId':_0x141291['id'],'interface':util[_0x71a3('0x4d')](_0x71a3('0x4e'),_0x71a3('0x4f'),_0x44e189[_0x71a3('0x1b')]),'penalty':0x0,'paused':_0x44e189[_0x71a3('0x50')],'createdAt':_0x44e189[_0x71a3('0x4c')],'updatedAt':_0x44e189[_0x71a3('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x598739,_0x48949a))[_0x71a3('0x27')](handleError(_0x598739,null));};exports[_0x71a3('0x51')]=function(_0x5efc4c,_0x5320ac){var _0x52036e={};var _0x43b73f={};var _0x26753c;var _0xaa9c80;return db[_0x71a3('0x1e')][_0x71a3('0x3c')]({'where':{'id':_0x5efc4c[_0x71a3('0x29')]['id']}})[_0x71a3('0x16')](handleEntityNotFound(_0x5320ac,null))[_0x71a3('0x16')](function(_0x100166){if(_0x100166){_0x26753c=_0x100166;_0x43b73f[_0x71a3('0x2a')]=_['keys'](db[_0x71a3('0x52')][_0x71a3('0x1f')]);_0x43b73f[_0x71a3('0x25')]=_[_0x71a3('0x2b')](_0x5efc4c['query']);_0x43b73f['filters']=_['intersection'](_0x43b73f[_0x71a3('0x2a')],_0x43b73f[_0x71a3('0x25')]);_0x52036e[_0x71a3('0x2e')]=_['intersection'](_0x43b73f[_0x71a3('0x2a')],qs[_0x71a3('0x3e')](_0x5efc4c[_0x71a3('0x25')][_0x71a3('0x3e')]));_0x52036e[_0x71a3('0x2e')]=_0x52036e['attributes']['length']?_0x52036e[_0x71a3('0x2e')]:_0x43b73f[_0x71a3('0x2a')];_0x52036e['order']=qs[_0x71a3('0x42')](_0x5efc4c[_0x71a3('0x25')][_0x71a3('0x42')]);_0x52036e['where']=qs['filters'](_[_0x71a3('0x43')](_0x5efc4c[_0x71a3('0x25')],_0x43b73f[_0x71a3('0x2c')]));if(_0x5efc4c[_0x71a3('0x25')][_0x71a3('0x45')]){_0x52036e[_0x71a3('0x23')]=_[_0x71a3('0x30')](_0x52036e[_0x71a3('0x23')],{'$or':_[_0x71a3('0x1d')](_0x52036e[_0x71a3('0x2e')],function(_0x266c5a){var _0x582a78={};_0x582a78[_0x266c5a]={'$like':'%'+_0x5efc4c[_0x71a3('0x25')]['filter']+'%'};return _0x582a78;})});}_0x52036e=_['merge']({},_0x52036e,_0x5efc4c[_0x71a3('0x46')]);return _0x26753c[_0x71a3('0x51')](_0x52036e);}})[_0x71a3('0x16')](function(_0x253957){if(_0x253957){_0xaa9c80=_0x253957[_0x71a3('0x2f')];if(!_0x5efc4c[_0x71a3('0x25')][_0x71a3('0x3f')](_0x71a3('0x40'))){_0x52036e[_0x71a3('0x14')]=qs['limit'](_0x5efc4c[_0x71a3('0x25')][_0x71a3('0x14')]);_0x52036e[_0x71a3('0x13')]=qs[_0x71a3('0x13')](_0x5efc4c[_0x71a3('0x25')][_0x71a3('0x13')]);}return _0x26753c[_0x71a3('0x51')](_0x52036e);}})[_0x71a3('0x16')](function(_0x4a75dd){if(_0x4a75dd){return _0x4a75dd?{'count':_0xaa9c80,'rows':_0x4a75dd}:null;}})['then'](respondWithResult(_0x5320ac,null))[_0x71a3('0x27')](handleError(_0x5320ac,null));};exports[_0x71a3('0x53')]=function(_0x2606e7,_0x757634){var _0x5c98d6=_0x2606e7[_0x71a3('0x33')][_0x71a3('0x54')];return db[_0x71a3('0x52')][_0x71a3('0x47')]({'where':{'id':_0x5c98d6},'attributes':['id'],'include':[{'model':db[_0x71a3('0x48')],'as':_0x71a3('0x55'),'attributes':['id',_0x71a3('0x1b'),'online','voicePause','interface'],'raw':!![]}]})['then'](function(_0xe93409){if(_0xe93409){var _0x355014=_[_0x71a3('0x56')](_0xe93409,function(_0x280984){var _0x165ab6=_0x280984[_0x71a3('0x35')]({'plain':!![]});return _0x165ab6[_0x71a3('0x55')];});return db['OpenchannelQueue'][_0x71a3('0x31')]({'where':{'id':_0x2606e7[_0x71a3('0x29')]['id']}})[_0x71a3('0x16')](function(_0x46f0e8){return db[_0x71a3('0x57')][_0x71a3('0x58')](function(_0x255220){return _0x46f0e8[_0x71a3('0x53')](_0x5c98d6,{'transaction':_0x255220})[_0x71a3('0x16')](function(){return BPromise[_0x71a3('0x59')](_0x355014,function(_0x77417f){return db[_0x71a3('0x3d')]['findOrCreate']({'where':{'UserId':_0x77417f['id'],'OpenchannelQueueId':_0x2606e7['params']['id']},'transaction':_0x255220});});})[_0x71a3('0x16')](function(){_0x355014[_0x71a3('0x5a')](function(_0xa39936){socket[_0x71a3('0x5b')](_0x71a3('0x5c'),{'UserId':_0xa39936['id'],'OpenchannelQueueId':_0x46f0e8['id']});});});});});}})[_0x71a3('0x16')](respondWithStatusCode(_0x757634,null))[_0x71a3('0x27')](handleError(_0x757634,null));};exports[_0x71a3('0x5d')]=function(_0x1569d3,_0x14d7d1){return db[_0x71a3('0x52')][_0x71a3('0x47')]({'where':{'id':_0x1569d3[_0x71a3('0x25')]['ids']},'attributes':['id'],'include':[{'model':db[_0x71a3('0x48')],'as':_0x71a3('0x55'),'attributes':['id'],'raw':!![]}]})[_0x71a3('0x16')](handleEntityNotFound(_0x14d7d1,null))[_0x71a3('0x16')](function(_0x2f49cd){var _0x55bfce=_[_0x71a3('0x1d')](_0x2f49cd,'id');var _0x48fcd5=[];var _0x4735d3=[];var _0x3f2933=squel['select']();_0x3f2933['field']('tq.TeamId')['from']('team_has_openchannel_queues','tq')['join'](_0x71a3('0x5e'),'ut',_0x71a3('0x5f'))[_0x71a3('0x23')]('OpenchannelQueueId\x20=\x20?',_0x1569d3[_0x71a3('0x29')]['id']);for(var _0x3651ce=0x0;_0x3651ce<_0x2f49cd[_0x71a3('0x2f')];_0x3651ce+=0x1){let _0x4fdfc7=_0x2f49cd[_0x3651ce];for(var _0x32621a=0x0;_0x32621a<_0x4fdfc7[_0x71a3('0x55')][_0x71a3('0x2f')];_0x32621a+=0x1){let _0x164382=_0x4fdfc7[_0x71a3('0x55')][_0x32621a];var _0x2d3a62=_0x3f2933[_0x71a3('0x60')]();_0x2d3a62['where'](_0x71a3('0x61'),_0x164382['id']);_0x4735d3[_0x71a3('0x62')](db[_0x71a3('0x57')][_0x71a3('0x25')](_0x2d3a62[_0x71a3('0x63')](),{'type':db['sequelize'][_0x71a3('0x64')][_0x71a3('0x65')]})['then'](function(_0x3d257d){if(_0x3d257d[_0x71a3('0x2f')]===0x1){return _0x164382['id'];}else{var _0xeb802e=_[_0x71a3('0x66')](_[_0x71a3('0x1d')](_0x3d257d,_0x71a3('0x67')),function(_0x4f2bac){return _[_0x71a3('0x68')](_0x55bfce,_0x4f2bac);});if(_0xeb802e){return _0x164382['id'];}}}));}}return BPromise[_0x71a3('0x69')](_0x4735d3)[_0x71a3('0x16')](function(_0x2d9a9a){_0x48fcd5=_(_0x48fcd5)[_0x71a3('0x6a')](_0x2d9a9a)[_0x71a3('0x6b')]()[_0x71a3('0x6c')]();return db[_0x71a3('0x1e')][_0x71a3('0x31')]({'where':{'id':_0x1569d3['params']['id']}})['then'](function(_0x349276){return db['sequelize']['transaction'](function(_0x4bf3b5){return _0x349276[_0x71a3('0x5d')](_0x1569d3['query']['ids'],{'transaction':_0x4bf3b5})[_0x71a3('0x16')](function(){if(!_['isEmpty'](_0x48fcd5)){return _0x349276[_0x71a3('0x6d')](_0x48fcd5,{'transaction':_0x4bf3b5});}})[_0x71a3('0x16')](function(){_0x48fcd5[_0x71a3('0x5a')](function(_0x132d2b){socket[_0x71a3('0x5b')]('userOpenchannelQueue:remove',{'UserId':_0x132d2b,'OpenchannelQueueId':_0x349276['id']});});});});});});})[_0x71a3('0x16')](respondWithStatusCode(_0x14d7d1,null))['catch'](handleError(_0x14d7d1,null));};exports[_0x71a3('0x6e')]=function(_0x33fa4b,_0x4c1600){return db[_0x71a3('0x1e')][_0x71a3('0x31')]({'where':{'id':_0x33fa4b['params']['id']}})['then'](handleEntityNotFound(_0x4c1600,null))[_0x71a3('0x16')](function(_0x2016a8){if(_0x2016a8){return _0x2016a8['addAgents'](_0x33fa4b[_0x71a3('0x33')][_0x71a3('0x54')],_[_0x71a3('0x6f')](_0x33fa4b[_0x71a3('0x33')],[_0x71a3('0x54'),'id'])||{})[_0x71a3('0x70')](function(_0x3a801d){for(var _0x54b229=0x0;_0x54b229<_0x33fa4b['body'][_0x71a3('0x54')][_0x71a3('0x2f')];_0x54b229+=0x1){socket[_0x71a3('0x5b')](_0x71a3('0x5c'),{'UserId':Number(_0x33fa4b[_0x71a3('0x33')][_0x71a3('0x54')][_0x54b229]),'OpenchannelQueueId':Number(_0x33fa4b[_0x71a3('0x29')]['id'])});}return _0x3a801d;});}})[_0x71a3('0x16')](respondWithResult(_0x4c1600,null))[_0x71a3('0x27')](handleError(_0x4c1600,null));};exports[_0x71a3('0x6d')]=function(_0x15a5a0,_0x23f073){return db['OpenchannelQueue'][_0x71a3('0x31')]({'where':{'id':_0x15a5a0[_0x71a3('0x29')]['id']}})[_0x71a3('0x16')](handleEntityNotFound(_0x23f073,null))[_0x71a3('0x16')](function(_0x413e27){if(_0x413e27){return _0x413e27[_0x71a3('0x6d')](_0x15a5a0[_0x71a3('0x25')][_0x71a3('0x54')])[_0x71a3('0x16')](function(){if(_[_0x71a3('0x71')](_0x15a5a0[_0x71a3('0x25')][_0x71a3('0x54')])){for(var _0x58af34=0x0;_0x58af34<_0x15a5a0[_0x71a3('0x25')]['ids']['length'];_0x58af34+=0x1){socket[_0x71a3('0x5b')](_0x71a3('0x72'),{'UserId':Number(_0x15a5a0[_0x71a3('0x25')][_0x71a3('0x54')][_0x58af34]),'OpenchannelQueueId':Number(_0x15a5a0['params']['id'])});}}else{socket[_0x71a3('0x5b')](_0x71a3('0x72'),{'UserId':Number(_0x15a5a0['query'][_0x71a3('0x54')]),'OpenchannelQueueId':Number(_0x15a5a0[_0x71a3('0x29')]['id'])});}});}})[_0x71a3('0x16')](respondWithStatusCode(_0x23f073,null))[_0x71a3('0x27')](handleError(_0x23f073,null));};exports[_0x71a3('0x73')]=function(_0x2d87d7,_0x4db34d){var _0x331b8d={};var _0x4af2e0={};var _0x323600;var _0x5b12a3;return db['OpenchannelQueue'][_0x71a3('0x3c')]({'where':{'id':_0x2d87d7[_0x71a3('0x29')]['id']}})[_0x71a3('0x16')](handleEntityNotFound(_0x4db34d,null))['then'](function(_0x46d48a){if(_0x46d48a){_0x323600=_0x46d48a;_0x4af2e0[_0x71a3('0x2a')]=_['keys'](db['User'][_0x71a3('0x1f')]);_0x4af2e0['query']=_[_0x71a3('0x2b')](_0x2d87d7[_0x71a3('0x25')]);_0x4af2e0['filters']=_[_0x71a3('0x2d')](_0x4af2e0['model'],_0x4af2e0[_0x71a3('0x25')]);_0x331b8d[_0x71a3('0x2e')]=_[_0x71a3('0x2d')](_0x4af2e0[_0x71a3('0x2a')],qs['fields'](_0x2d87d7[_0x71a3('0x25')][_0x71a3('0x3e')]));_0x331b8d[_0x71a3('0x2e')]=_0x331b8d['attributes']['length']?_0x331b8d[_0x71a3('0x2e')]:_0x4af2e0[_0x71a3('0x2a')];_0x331b8d[_0x71a3('0x41')]=qs[_0x71a3('0x42')](_0x2d87d7[_0x71a3('0x25')][_0x71a3('0x42')]);_0x331b8d[_0x71a3('0x23')]=qs[_0x71a3('0x2c')](_[_0x71a3('0x43')](_0x2d87d7['query'],_0x4af2e0[_0x71a3('0x2c')]));if(_0x2d87d7['query']['filter']){_0x331b8d[_0x71a3('0x23')]=_[_0x71a3('0x30')](_0x331b8d[_0x71a3('0x23')],{'$or':_[_0x71a3('0x1d')](_0x331b8d['attributes'],function(_0x58455d){var _0x4f1024={};_0x4f1024[_0x58455d]={'$like':'%'+_0x2d87d7[_0x71a3('0x25')][_0x71a3('0x45')]+'%'};return _0x4f1024;})});}_0x331b8d=_['merge']({},_0x331b8d,_0x2d87d7[_0x71a3('0x46')]);return _0x323600[_0x71a3('0x73')](_0x331b8d);}})[_0x71a3('0x16')](function(_0x57c0bb){if(_0x57c0bb){_0x5b12a3=_0x57c0bb['length'];if(!_0x2d87d7['query'][_0x71a3('0x3f')](_0x71a3('0x40'))){_0x331b8d['limit']=qs[_0x71a3('0x14')](_0x2d87d7['query']['limit']);_0x331b8d['offset']=qs['offset'](_0x2d87d7['query'][_0x71a3('0x13')]);}return _0x323600[_0x71a3('0x73')](_0x331b8d);}})['then'](function(_0x4f0943){if(_0x4f0943){return _0x4f0943?{'count':_0x5b12a3,'rows':_0x4f0943}:null;}})[_0x71a3('0x16')](respondWithResult(_0x4db34d,null))[_0x71a3('0x27')](handleError(_0x4db34d,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 0ec2d98..923fc6d 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 _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 +var _0x9a4d=['exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x2437bc,_0x2ebfa1){var _0x3e603c=function(_0x86c58b){while(--_0x86c58b){_0x2437bc['push'](_0x2437bc['shift']());}};_0x3e603c(++_0x2ebfa1);}(_0x9a4d,0x65));var _0xd9a4=function(_0x5aafed,_0x525e53){_0x5aafed=_0x5aafed-0x0;var _0x5e4005=_0x9a4d[_0x5aafed];return _0x5e4005;};'use strict';var EventEmitter=require(_0xd9a4('0x0'));var OpenchannelQueue=require(_0xd9a4('0x1'))['db'][_0xd9a4('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xd9a4('0x3')](0x0);var events={'afterCreate':_0xd9a4('0x4'),'afterUpdate':_0xd9a4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x133ded){return function(_0x2ad167,_0x35f295,_0x40931a){OpenchannelQueueEvents['emit'](_0x133ded+':'+_0x2ad167['id'],_0x2ad167);OpenchannelQueueEvents[_0xd9a4('0x6')](_0x133ded,_0x2ad167);_0x40931a(null);};}for(var e in events){if(events[_0xd9a4('0x7')](e)){var event=events[e];OpenchannelQueue[_0xd9a4('0x8')](e,emitEvent(event));}}module[_0xd9a4('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 9134c36..32155d7 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 _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 +var _0xb570=['rimraf','../../config/environment','./openchannelQueue.attributes','define','OpenchannelQueue','lodash','util','api','moment','bluebird','request-promise'];(function(_0x35e003,_0x21f047){var _0x2d7382=function(_0x47790d){while(--_0x47790d){_0x35e003['push'](_0x35e003['shift']());}};_0x2d7382(++_0x21f047);}(_0xb570,0x19c));var _0x0b57=function(_0x1c0711,_0x56a619){_0x1c0711=_0x1c0711-0x0;var _0x377178=_0xb570[_0x1c0711];return _0x377178;};'use strict';var _=require(_0x0b57('0x0'));var util=require(_0x0b57('0x1'));var logger=require('../../config/logger')(_0x0b57('0x2'));var moment=require(_0x0b57('0x3'));var BPromise=require(_0x0b57('0x4'));var rp=require(_0x0b57('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0b57('0x6'));var config=require(_0x0b57('0x7'));var attributes=require(_0x0b57('0x8'));module['exports']=function(_0x1f0b22,_0x16ed4b){return _0x1f0b22[_0x0b57('0x9')](_0x0b57('0xa'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index da443b1..c390ec1 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 _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 +var _0xf951=['include','map','model','stringify','ShowOpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes'];(function(_0x3ceb63,_0x22332c){var _0x4102ae=function(_0x547e3f){while(--_0x547e3f){_0x3ceb63['push'](_0x3ceb63['shift']());}};_0x4102ae(++_0x22332c);}(_0xf951,0x1a0));var _0x1f95=function(_0x2e0854,_0x52544a){_0x2e0854=_0x2e0854-0x0;var _0x4d0ff9=_0xf951[_0x2e0854];return _0x4d0ff9;};'use strict';var _=require(_0x1f95('0x0'));var util=require(_0x1f95('0x1'));var moment=require(_0x1f95('0x2'));var BPromise=require(_0x1f95('0x3'));var rs=require(_0x1f95('0x4'));var fs=require('fs');var Redis=require(_0x1f95('0x5'));var db=require(_0x1f95('0x6'))['db'];var utils=require(_0x1f95('0x7'));var logger=require('../../config/logger')(_0x1f95('0x8'));var config=require(_0x1f95('0x9'));var jayson=require(_0x1f95('0xa'));var client=jayson[_0x1f95('0xb')]['http']({'port':0x232a});config[_0x1f95('0xc')]=_[_0x1f95('0xd')](config[_0x1f95('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x1f95('0xe'))(new Redis(config[_0x1f95('0xc')]));require(_0x1f95('0xf'))[_0x1f95('0x10')](socket);function respondWithRpcPromise(_0x3b600f,_0x55c2a8,_0x4e62f6){return new BPromise(function(_0x2efb3f,_0x583820){return client[_0x1f95('0x11')](_0x3b600f,_0x4e62f6)[_0x1f95('0x12')](function(_0x57e02c){logger[_0x1f95('0x13')](_0x1f95('0x14'),_0x55c2a8,'request\x20sent');logger[_0x1f95('0x15')](_0x1f95('0x16'),_0x55c2a8,_0x1f95('0x17'),JSON['stringify'](_0x57e02c));if(_0x57e02c[_0x1f95('0x18')]){if(_0x57e02c[_0x1f95('0x18')]['code']===0x1f4){logger[_0x1f95('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x55c2a8,_0x57e02c[_0x1f95('0x18')]['message']);return _0x583820(_0x57e02c[_0x1f95('0x18')][_0x1f95('0x19')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x55c2a8,_0x57e02c['error'][_0x1f95('0x19')]);return _0x2efb3f(_0x57e02c[_0x1f95('0x18')][_0x1f95('0x19')]);}else{logger['info'](_0x1f95('0x14'),_0x55c2a8,_0x1f95('0x17'));_0x2efb3f(_0x57e02c[_0x1f95('0x1a')][_0x1f95('0x19')]);}})[_0x1f95('0x1b')](function(_0x22e894){logger[_0x1f95('0x18')](_0x1f95('0x14'),_0x55c2a8,_0x22e894);_0x583820(_0x22e894);});});}exports[_0x1f95('0x1c')]=function(_0x55c670){var _0x1b36e8=this;return new Promise(function(_0x35e45d,_0x534b85){return db[_0x1f95('0x1d')][_0x1f95('0x1e')]({'raw':_0x55c670[_0x1f95('0x1f')]?_0x55c670[_0x1f95('0x1f')][_0x1f95('0x20')]===undefined?!![]:![]:!![],'where':_0x55c670[_0x1f95('0x1f')]?_0x55c670[_0x1f95('0x1f')][_0x1f95('0x21')]||null:null,'attributes':_0x55c670[_0x1f95('0x1f')]?_0x55c670['options'][_0x1f95('0x22')]||null:null,'limit':_0x55c670[_0x1f95('0x1f')]?_0x55c670[_0x1f95('0x1f')]['limit']||null:null,'include':_0x55c670[_0x1f95('0x1f')]?_0x55c670[_0x1f95('0x1f')][_0x1f95('0x23')]?_[_0x1f95('0x24')](_0x55c670[_0x1f95('0x1f')]['include'],function(_0x591c0a){return{'model':db[_0x591c0a[_0x1f95('0x25')]],'as':_0x591c0a['as'],'attributes':_0x591c0a[_0x1f95('0x22')],'include':_0x591c0a[_0x1f95('0x23')]?_[_0x1f95('0x24')](_0x591c0a[_0x1f95('0x23')],function(_0x35d317){return{'model':db[_0x35d317[_0x1f95('0x25')]],'as':_0x35d317['as'],'attributes':_0x35d317[_0x1f95('0x22')],'include':_0x35d317[_0x1f95('0x23')]?_[_0x1f95('0x24')](_0x35d317[_0x1f95('0x23')],function(_0x1f3f65){return{'model':db[_0x1f3f65[_0x1f95('0x25')]],'as':_0x1f3f65['as'],'attributes':_0x1f3f65[_0x1f95('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x55c3c3){logger[_0x1f95('0x13')]('GetOpenchannelQueue',_0x55c670);logger[_0x1f95('0x15')](_0x1f95('0x1c'),_0x55c670,JSON[_0x1f95('0x26')](_0x55c3c3));_0x35e45d(_0x55c3c3);})[_0x1f95('0x1b')](function(_0x4243a6){logger[_0x1f95('0x18')](_0x1f95('0x1c'),_0x4243a6[_0x1f95('0x19')],_0x55c670);_0x534b85(_0x1b36e8['error'](0x1f4,_0x4243a6[_0x1f95('0x19')]));});});};exports[_0x1f95('0x27')]=function(_0x5b007b){var _0x1c29fa=this;return new Promise(function(_0x493e3c,_0x5b73e6){return db['OpenchannelQueue'][_0x1f95('0x28')]({'raw':_0x5b007b['options']?_0x5b007b[_0x1f95('0x1f')][_0x1f95('0x20')]===undefined?!![]:![]:!![],'where':_0x5b007b['options']?_0x5b007b['options'][_0x1f95('0x21')]||null:null,'attributes':_0x5b007b[_0x1f95('0x1f')]?_0x5b007b[_0x1f95('0x1f')][_0x1f95('0x22')]||null:null,'include':_0x5b007b[_0x1f95('0x1f')]?_0x5b007b[_0x1f95('0x1f')][_0x1f95('0x23')]?_['map'](_0x5b007b[_0x1f95('0x1f')][_0x1f95('0x23')],function(_0x550934){return{'model':db[_0x550934['model']],'as':_0x550934['as'],'attributes':_0x550934[_0x1f95('0x22')],'include':_0x550934[_0x1f95('0x23')]?_['map'](_0x550934[_0x1f95('0x23')],function(_0x4ee8d0){return{'model':db[_0x4ee8d0[_0x1f95('0x25')]],'as':_0x4ee8d0['as'],'attributes':_0x4ee8d0[_0x1f95('0x22')],'include':_0x4ee8d0[_0x1f95('0x23')]?_[_0x1f95('0x24')](_0x4ee8d0[_0x1f95('0x23')],function(_0x4097c6){return{'model':db[_0x4097c6[_0x1f95('0x25')]],'as':_0x4097c6['as'],'attributes':_0x4097c6[_0x1f95('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x863aaa){logger[_0x1f95('0x13')](_0x1f95('0x27'),_0x5b007b);logger['debug']('ShowOpenchannelQueue',_0x5b007b,JSON[_0x1f95('0x26')](_0x863aaa));_0x493e3c(_0x863aaa);})[_0x1f95('0x1b')](function(_0x59e3ea){logger['error'](_0x1f95('0x27'),_0x59e3ea[_0x1f95('0x19')],_0x5b007b);_0x5b73e6(_0x1c29fa[_0x1f95('0x18')](0x1f4,_0x59e3ea[_0x1f95('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 16a5030..1c56298 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 _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 +var _0xa57c=['./openchannelQueue.events','save','remove','register','length','openchannelQueue:'];(function(_0x899a89,_0x2722b0){var _0x9b2b94=function(_0x302290){while(--_0x302290){_0x899a89['push'](_0x899a89['shift']());}};_0x9b2b94(++_0x2722b0);}(_0xa57c,0x150));var _0xca57=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xa57c[_0x1cc8fe];return _0x230054;};'use strict';var OpenchannelQueueEvents=require(_0xca57('0x0'));var events=[_0xca57('0x1'),_0xca57('0x2'),'update'];function createListener(_0x4b1a1e,_0x3bcdaa){return function(_0xfcea){_0x3bcdaa['emit'](_0x4b1a1e,_0xfcea);};}function removeListener(_0x144bac,_0x8dc7d){return function(){OpenchannelQueueEvents['removeListener'](_0x144bac,_0x8dc7d);};}exports[_0xca57('0x3')]=function(_0x55c08e){for(var _0x1921df=0x0,_0x3d0f12=events[_0xca57('0x4')];_0x1921df<_0x3d0f12;_0x1921df++){var _0x5859c6=events[_0x1921df];var _0x2bef4a=createListener(_0xca57('0x5')+_0x5859c6,_0x55c08e);OpenchannelQueueEvents['on'](_0x5859c6,_0x2bef4a);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index db50b46..a4dce97 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 _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 +var _0x7d9e=['index','/describe','describe','get','/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated'];(function(_0xb69d21,_0x439c03){var _0x57660c=function(_0x314207){while(--_0x314207){_0xb69d21['push'](_0xb69d21['shift']());}};_0x57660c(++_0x439c03);}(_0x7d9e,0x17c));var _0xe7d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d9e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe7d9('0x0'));var util=require(_0xe7d9('0x1'));var path=require('path');var timeout=require(_0xe7d9('0x2'));var express=require(_0xe7d9('0x3'));var router=express[_0xe7d9('0x4')]();var fs_extra=require(_0xe7d9('0x5'));var auth=require(_0xe7d9('0x6'));var interaction=require(_0xe7d9('0x7'));var config=require(_0xe7d9('0x8'));var controller=require(_0xe7d9('0x9'));router['get']('/',auth[_0xe7d9('0xa')](),controller[_0xe7d9('0xb')]);router['get'](_0xe7d9('0xc'),auth[_0xe7d9('0xa')](),controller[_0xe7d9('0xd')]);router[_0xe7d9('0xe')](_0xe7d9('0xf'),auth[_0xe7d9('0xa')](),controller[_0xe7d9('0x10')]);router[_0xe7d9('0x11')]('/',auth[_0xe7d9('0xa')](),controller[_0xe7d9('0x12')]);router[_0xe7d9('0x13')](_0xe7d9('0xf'),auth[_0xe7d9('0xa')](),controller[_0xe7d9('0x14')]);router[_0xe7d9('0x15')](_0xe7d9('0xf'),auth[_0xe7d9('0xa')](),controller['destroy']);module[_0xe7d9('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index d3eae7a..4087213 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 _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 +var _0x67de=['STRING','DATE','moment','sequelize','exports'];(function(_0x2af11a,_0x443532){var _0x40d52e=function(_0xcfe7b2){while(--_0xcfe7b2){_0x2af11a['push'](_0x2af11a['shift']());}};_0x40d52e(++_0x443532);}(_0x67de,0x1ba));var _0xe67d=function(_0x33ede3,_0x4113ad){_0x33ede3=_0x33ede3-0x0;var _0x494bf7=_0x67de[_0x33ede3];return _0x494bf7;};'use strict';var moment=require(_0xe67d('0x0'));var Sequelize=require(_0xe67d('0x1'));module[_0xe67d('0x2')]={'uniqueid':{'type':Sequelize[_0xe67d('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xe67d('0x3')]},'joinAt':{'type':Sequelize[_0xe67d('0x4')]},'leaveAt':{'type':Sequelize[_0xe67d('0x4')]},'acceptAt':{'type':Sequelize[_0xe67d('0x4')]},'exitAt':{'type':Sequelize[_0xe67d('0x4')]},'reason':{'type':Sequelize[_0xe67d('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 62114bf..b42a67d 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 _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 +var _0x0deb=['key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','limit','undefined','count','offset','status','set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','OpenchannelQueueReport','rawAttributes','fieldName','type'];(function(_0x2f399b,_0x32f990){var _0x5eabc0=function(_0x25d0c4){while(--_0x25d0c4){_0x2f399b['push'](_0x2f399b['shift']());}};_0x5eabc0(++_0x32f990);}(_0x0deb,0x6e));var _0xb0de=function(_0x2890a9,_0x2c64be){_0x2890a9=_0x2890a9-0x0;var _0xbfe8ba=_0x0deb[_0x2890a9];return _0xbfe8ba;};'use strict';var emlformat=require(_0xb0de('0x0'));var rimraf=require(_0xb0de('0x1'));var zipdir=require(_0xb0de('0x2'));var jsonpatch=require(_0xb0de('0x3'));var rp=require(_0xb0de('0x4'));var moment=require('moment');var BPromise=require(_0xb0de('0x5'));var Mustache=require(_0xb0de('0x6'));var util=require(_0xb0de('0x7'));var path=require('path');var sox=require(_0xb0de('0x8'));var csv=require('to-csv');var ejs=require(_0xb0de('0x9'));var fs=require('fs');var fs_extra=require(_0xb0de('0xa'));var _=require(_0xb0de('0xb'));var squel=require(_0xb0de('0xc'));var crypto=require(_0xb0de('0xd'));var jsforce=require(_0xb0de('0xe'));var deskjs=require(_0xb0de('0xf'));var toCsv=require(_0xb0de('0x10'));var querystring=require(_0xb0de('0x11'));var Papa=require(_0xb0de('0x12'));var Redis=require(_0xb0de('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xb0de('0x14'));var as=require(_0xb0de('0x15'));var hardwareService=require(_0xb0de('0x16'));var logger=require(_0xb0de('0x17'))(_0xb0de('0x18'));var utils=require(_0xb0de('0x19'));var config=require(_0xb0de('0x1a'));var licenseUtil=require(_0xb0de('0x1b'));var db=require(_0xb0de('0x1c'))['db'];function respondWithStatusCode(_0x2625c8,_0x55893f){_0x55893f=_0x55893f||0xcc;return function(_0x391431){if(_0x391431){return _0x2625c8[_0xb0de('0x1d')](_0x55893f);}return _0x2625c8['status'](_0x55893f)['end']();};}function respondWithResult(_0x5b840f,_0x215659){_0x215659=_0x215659||0xc8;return function(_0x566758){if(_0x566758){return _0x5b840f['status'](_0x215659)['json'](_0x566758);}};}function respondWithFilteredResult(_0x130fc4,_0x427ec5){return function(_0x283a95){if(_0x283a95){var _0x46ae80=typeof _0x427ec5['offset']==='undefined'&&typeof _0x427ec5[_0xb0de('0x1e')]===_0xb0de('0x1f');var _0x56b31a=_0x283a95[_0xb0de('0x20')];var _0x2fe75f=_0x46ae80?0x0:_0x427ec5[_0xb0de('0x21')];var _0x3d6765=_0x46ae80?_0x283a95['count']:_0x427ec5['offset']+_0x427ec5[_0xb0de('0x1e')];var _0x15dfe3;if(_0x3d6765>=_0x56b31a){_0x3d6765=_0x56b31a;_0x15dfe3=0xc8;}else{_0x15dfe3=0xce;}_0x130fc4[_0xb0de('0x22')](_0x15dfe3);return _0x130fc4[_0xb0de('0x23')](_0xb0de('0x24'),_0x2fe75f+'-'+_0x3d6765+'/'+_0x56b31a)[_0xb0de('0x25')](_0x283a95);}return null;};}function patchUpdates(_0x16e1a9){return function(_0x4e1196){try{jsonpatch[_0xb0de('0x26')](_0x4e1196,_0x16e1a9,!![]);}catch(_0x29ac76){return BPromise[_0xb0de('0x27')](_0x29ac76);}return _0x4e1196[_0xb0de('0x28')]();};}function saveUpdates(_0x30bc80,_0x2bfb32){return function(_0x37b975){if(_0x37b975){return _0x37b975[_0xb0de('0x29')](_0x30bc80)['then'](function(_0x4c0d0f){return _0x4c0d0f;});}return null;};}function removeEntity(_0x26aa65,_0x42ae1d){return function(_0x2aea83){if(_0x2aea83){return _0x2aea83[_0xb0de('0x2a')]()[_0xb0de('0x2b')](function(){_0x26aa65[_0xb0de('0x22')](0xcc)[_0xb0de('0x2c')]();});}};}function handleEntityNotFound(_0x2edda4,_0x4a63c6){return function(_0x6d5f1b){if(!_0x6d5f1b){_0x2edda4[_0xb0de('0x1d')](0x194);}return _0x6d5f1b;};}function handleError(_0x5e3385,_0x4d6619){_0x4d6619=_0x4d6619||0x1f4;return function(_0x212b1f){logger[_0xb0de('0x2d')](_0x212b1f[_0xb0de('0x2e')]);if(_0x212b1f[_0xb0de('0x2f')]){delete _0x212b1f[_0xb0de('0x2f')];}_0x5e3385[_0xb0de('0x22')](_0x4d6619)[_0xb0de('0x30')](_0x212b1f);};}exports[_0xb0de('0x31')]=function(_0x57d3b4,_0x459257){var _0x41b40b={},_0x412a07={},_0x32e5fd={'count':0x0,'rows':[]};var _0x4d94ae=_['map'](db[_0xb0de('0x32')][_0xb0de('0x33')],function(_0x4c9f95){return{'name':_0x4c9f95[_0xb0de('0x34')],'type':_0x4c9f95[_0xb0de('0x35')][_0xb0de('0x36')]};});_0x412a07[_0xb0de('0x37')]=_[_0xb0de('0x38')](_0x4d94ae,_0xb0de('0x2f'));_0x412a07[_0xb0de('0x39')]=_[_0xb0de('0x3a')](_0x57d3b4[_0xb0de('0x39')]);_0x412a07[_0xb0de('0x3b')]=_[_0xb0de('0x3c')](_0x412a07[_0xb0de('0x37')],_0x412a07[_0xb0de('0x39')]);_0x41b40b[_0xb0de('0x3d')]=_[_0xb0de('0x3c')](_0x412a07[_0xb0de('0x37')],qs[_0xb0de('0x3e')](_0x57d3b4[_0xb0de('0x39')][_0xb0de('0x3e')]));_0x41b40b[_0xb0de('0x3d')]=_0x41b40b[_0xb0de('0x3d')][_0xb0de('0x3f')]?_0x41b40b['attributes']:_0x412a07['model'];if(!_0x57d3b4[_0xb0de('0x39')][_0xb0de('0x40')](_0xb0de('0x41'))){_0x41b40b[_0xb0de('0x1e')]=qs[_0xb0de('0x1e')](_0x57d3b4['query'][_0xb0de('0x1e')]);_0x41b40b[_0xb0de('0x21')]=qs[_0xb0de('0x21')](_0x57d3b4['query'][_0xb0de('0x21')]);}_0x41b40b['order']=qs[_0xb0de('0x42')](_0x57d3b4[_0xb0de('0x39')][_0xb0de('0x42')]);_0x41b40b[_0xb0de('0x43')]=qs[_0xb0de('0x3b')](_['pick'](_0x57d3b4[_0xb0de('0x39')],_0x412a07[_0xb0de('0x3b')]),_0x4d94ae);if(_0x57d3b4[_0xb0de('0x39')][_0xb0de('0x44')]){_0x41b40b[_0xb0de('0x43')]=_['merge'](_0x41b40b[_0xb0de('0x43')],{'$or':_[_0xb0de('0x38')](_0x4d94ae,function(_0x1edc22){if(_0x1edc22[_0xb0de('0x35')]!==_0xb0de('0x45')){var _0x4716a1={};_0x4716a1[_0x1edc22[_0xb0de('0x2f')]]={'$like':'%'+_0x57d3b4[_0xb0de('0x39')]['filter']+'%'};return _0x4716a1;}})});}_0x41b40b=_['merge']({},_0x41b40b,_0x57d3b4[_0xb0de('0x46')]);var _0x2e9ff1={'where':_0x41b40b[_0xb0de('0x43')]};return db[_0xb0de('0x32')]['count'](_0x2e9ff1)[_0xb0de('0x2b')](function(_0x18c0fc){_0x32e5fd['count']=_0x18c0fc;if(_0x57d3b4[_0xb0de('0x39')][_0xb0de('0x47')]){_0x41b40b[_0xb0de('0x48')]=[{'all':!![]}];}return db[_0xb0de('0x32')][_0xb0de('0x49')](_0x41b40b);})[_0xb0de('0x2b')](function(_0x56a02a){_0x32e5fd[_0xb0de('0x4a')]=_0x56a02a;return _0x32e5fd;})['then'](respondWithFilteredResult(_0x459257,_0x41b40b))[_0xb0de('0x4b')](handleError(_0x459257,null));};exports[_0xb0de('0x4c')]=function(_0x4b1b25,_0x3f594a){var _0x424acf={'raw':!![],'where':{'id':_0x4b1b25[_0xb0de('0x4d')]['id']}},_0x303b5c={};_0x303b5c[_0xb0de('0x37')]=_[_0xb0de('0x3a')](db[_0xb0de('0x32')][_0xb0de('0x33')]);_0x303b5c[_0xb0de('0x39')]=_[_0xb0de('0x3a')](_0x4b1b25[_0xb0de('0x39')]);_0x303b5c[_0xb0de('0x3b')]=_[_0xb0de('0x3c')](_0x303b5c[_0xb0de('0x37')],_0x303b5c['query']);_0x424acf[_0xb0de('0x3d')]=_[_0xb0de('0x3c')](_0x303b5c[_0xb0de('0x37')],qs['fields'](_0x4b1b25['query'][_0xb0de('0x3e')]));_0x424acf[_0xb0de('0x3d')]=_0x424acf[_0xb0de('0x3d')][_0xb0de('0x3f')]?_0x424acf[_0xb0de('0x3d')]:_0x303b5c[_0xb0de('0x37')];if(_0x4b1b25[_0xb0de('0x39')][_0xb0de('0x47')]){_0x424acf[_0xb0de('0x48')]=[{'all':!![]}];}_0x424acf=_['merge']({},_0x424acf,_0x4b1b25['options']);return db[_0xb0de('0x32')]['find'](_0x424acf)[_0xb0de('0x2b')](handleEntityNotFound(_0x3f594a,null))[_0xb0de('0x2b')](respondWithResult(_0x3f594a,null))['catch'](handleError(_0x3f594a,null));};exports[_0xb0de('0x4e')]=function(_0x311e8d,_0x55d438){return db[_0xb0de('0x32')]['create'](_0x311e8d[_0xb0de('0x4f')],{})[_0xb0de('0x2b')](respondWithResult(_0x55d438,0xc9))[_0xb0de('0x4b')](handleError(_0x55d438,null));};exports[_0xb0de('0x29')]=function(_0xf0b5c5,_0x427efa){if(_0xf0b5c5['body']['id']){delete _0xf0b5c5['body']['id'];}return db[_0xb0de('0x32')][_0xb0de('0x50')]({'where':{'id':_0xf0b5c5[_0xb0de('0x4d')]['id']}})['then'](handleEntityNotFound(_0x427efa,null))[_0xb0de('0x2b')](saveUpdates(_0xf0b5c5[_0xb0de('0x4f')],null))[_0xb0de('0x2b')](respondWithResult(_0x427efa,null))[_0xb0de('0x4b')](handleError(_0x427efa,null));};exports[_0xb0de('0x2a')]=function(_0x38bd77,_0x213159){return db[_0xb0de('0x32')][_0xb0de('0x50')]({'where':{'id':_0x38bd77['params']['id']}})['then'](handleEntityNotFound(_0x213159,null))[_0xb0de('0x2b')](removeEntity(_0x213159,null))[_0xb0de('0x4b')](handleError(_0x213159,null));};exports[_0xb0de('0x51')]=function(_0x3d9da8,_0x2716db){return db[_0xb0de('0x32')][_0xb0de('0x51')]()[_0xb0de('0x2b')](respondWithResult(_0x2716db,null))['catch'](handleError(_0x2716db,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index c8eb46c..cdd0c41 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_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 +var _0x2ef3=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelQueueReport.attributes','exports'];(function(_0x4defd6,_0x37bbd3){var _0x4c9276=function(_0x1d7a3d){while(--_0x1d7a3d){_0x4defd6['push'](_0x4defd6['shift']());}};_0x4c9276(++_0x37bbd3);}(_0x2ef3,0xba));var _0x32ef=function(_0x2675a8,_0x53756a){_0x2675a8=_0x2675a8-0x0;var _0x15d1cc=_0x2ef3[_0x2675a8];return _0x15d1cc;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 334a3b6..22913c5 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 _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 +var _0xbaf0=['UpdateOpenchannelQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','raw','update','options','where','attributes','limit'];(function(_0x3c5f8d,_0x39891f){var _0x3b7beb=function(_0x44d6c9){while(--_0x44d6c9){_0x3c5f8d['push'](_0x3c5f8d['shift']());}};_0x3b7beb(++_0x39891f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')](_0x53c338[_0x0baf('0x19')],{'raw':_0x53c338['options']?_0x53c338['options'][_0x0baf('0x1a')]===undefined?!![]:![]:!![]})[_0x0baf('0xc')](function(_0x32e839){logger[_0x0baf('0xd')](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x32e839));_0xfbecec(_0x32e839);})[_0x0baf('0x15')](function(_0x15a2c3){logger['error'](_0x0baf('0x16'),_0x15a2c3['message'],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x15a2c3['message']));});});};exports['UpdateOpenchannelQueueReport']=function(_0x2ef0aa){var _0x48a0e9=this;return new Promise(function(_0x4be1b9,_0x47c4b){return db[_0x0baf('0x17')][_0x0baf('0x1b')](_0x2ef0aa[_0x0baf('0x19')],{'raw':_0x2ef0aa[_0x0baf('0x1c')]?_0x2ef0aa['options'][_0x0baf('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ef0aa[_0x0baf('0x1c')]?_0x2ef0aa[_0x0baf('0x1c')][_0x0baf('0x1d')]||null:null,'attributes':_0x2ef0aa[_0x0baf('0x1c')]?_0x2ef0aa[_0x0baf('0x1c')][_0x0baf('0x1e')]||null:null,'limit':_0x2ef0aa['options']?_0x2ef0aa[_0x0baf('0x1c')][_0x0baf('0x1f')]||null:null})[_0x0baf('0xc')](function(_0x265915){logger['info'](_0x0baf('0x20'),_0x2ef0aa);logger[_0x0baf('0x10')]('UpdateOpenchannelQueueReport',_0x2ef0aa,JSON[_0x0baf('0x12')](_0x265915));_0x4be1b9(_0x265915);})[_0x0baf('0x15')](function(_0x478ce8){logger[_0x0baf('0x13')](_0x0baf('0x20'),_0x478ce8[_0x0baf('0x14')],_0x2ef0aa);_0x47c4b(_0x48a0e9[_0x0baf('0x13')](0x1f4,_0x478ce8['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 99facb9..0451a6e 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 _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 +var _0x181c=['/:id','show','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x181c,0x14b));var _0xc181=function(_0x4f08dd,_0x3784ec){_0x4f08dd=_0x4f08dd-0x0;var _0x3017ee=_0x181c[_0x4f08dd];return _0x3017ee;};'use strict';var multer=require('multer');var util=require(_0xc181('0x0'));var path=require(_0xc181('0x1'));var timeout=require(_0xc181('0x2'));var express=require(_0xc181('0x3'));var router=express[_0xc181('0x4')]();var fs_extra=require(_0xc181('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc181('0x6'));var config=require(_0xc181('0x7'));var controller=require('./openchannelTransferReport.controller');router[_0xc181('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc181('0x8')](_0xc181('0x9'),auth[_0xc181('0xa')](),controller['describe']);router[_0xc181('0x8')](_0xc181('0xb'),auth[_0xc181('0xa')](),controller[_0xc181('0xc')]);router['post']('/',auth[_0xc181('0xa')](),controller[_0xc181('0xd')]);router[_0xc181('0xe')](_0xc181('0xb'),auth['isAuthenticated'](),controller[_0xc181('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc181('0x10')]);module[_0xc181('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 567b749..80c0cb0 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 _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 +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x28e71a,_0x4405bd){var _0x268fed=function(_0x404197){while(--_0x404197){_0x28e71a['push'](_0x28e71a['shift']());}};_0x268fed(++_0x4405bd);}(_0x008c,0x188));var _0xc008=function(_0x12a04a,_0x4e3d1a){_0x12a04a=_0x12a04a-0x0;var _0x6d5409=_0x008c[_0x12a04a];return _0x6d5409;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index e71bb3a..73c44e6 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 _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 +var _0xddb2=['include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xddb2,0x190));var _0x2ddb=function(_0x2429c6,_0x3e607b){_0x2429c6=_0x2429c6-0x0;var _0x252d79=_0xddb2[_0x2429c6];return _0x252d79;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2ddb('0x0'));var zipdir=require(_0x2ddb('0x1'));var jsonpatch=require(_0x2ddb('0x2'));var rp=require('request-promise');var moment=require(_0x2ddb('0x3'));var BPromise=require(_0x2ddb('0x4'));var Mustache=require('mustache');var util=require(_0x2ddb('0x5'));var path=require(_0x2ddb('0x6'));var sox=require(_0x2ddb('0x7'));var csv=require(_0x2ddb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2ddb('0x9'));var _=require(_0x2ddb('0xa'));var squel=require(_0x2ddb('0xb'));var crypto=require(_0x2ddb('0xc'));var jsforce=require(_0x2ddb('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2ddb('0xe'));var Papa=require(_0x2ddb('0xf'));var Redis=require(_0x2ddb('0x10'));var authService=require(_0x2ddb('0x11'));var qs=require(_0x2ddb('0x12'));var as=require(_0x2ddb('0x13'));var hardwareService=require(_0x2ddb('0x14'));var logger=require(_0x2ddb('0x15'))(_0x2ddb('0x16'));var utils=require(_0x2ddb('0x17'));var config=require(_0x2ddb('0x18'));var licenseUtil=require(_0x2ddb('0x19'));var db=require(_0x2ddb('0x1a'))['db'];function respondWithStatusCode(_0x5e066a,_0x32cef0){_0x32cef0=_0x32cef0||0xcc;return function(_0x13c014){if(_0x13c014){return _0x5e066a['sendStatus'](_0x32cef0);}return _0x5e066a[_0x2ddb('0x1b')](_0x32cef0)['end']();};}function respondWithResult(_0x402ae5,_0x5afee9){_0x5afee9=_0x5afee9||0xc8;return function(_0x36fc1c){if(_0x36fc1c){return _0x402ae5[_0x2ddb('0x1b')](_0x5afee9)[_0x2ddb('0x1c')](_0x36fc1c);}};}function respondWithFilteredResult(_0x383d16,_0x5acb75){return function(_0x2258ed){if(_0x2258ed){var _0x4cff59=typeof _0x5acb75[_0x2ddb('0x1d')]===_0x2ddb('0x1e')&&typeof _0x5acb75[_0x2ddb('0x1f')]===_0x2ddb('0x1e');var _0x1a83ea=_0x2258ed['count'];var _0x4ec53d=_0x4cff59?0x0:_0x5acb75[_0x2ddb('0x1d')];var _0x3bc394=_0x4cff59?_0x2258ed[_0x2ddb('0x20')]:_0x5acb75['offset']+_0x5acb75[_0x2ddb('0x1f')];var _0x392765;if(_0x3bc394>=_0x1a83ea){_0x3bc394=_0x1a83ea;_0x392765=0xc8;}else{_0x392765=0xce;}_0x383d16['status'](_0x392765);return _0x383d16[_0x2ddb('0x21')](_0x2ddb('0x22'),_0x4ec53d+'-'+_0x3bc394+'/'+_0x1a83ea)[_0x2ddb('0x1c')](_0x2258ed);}return null;};}function patchUpdates(_0x426032){return function(_0x475bf4){try{jsonpatch[_0x2ddb('0x23')](_0x475bf4,_0x426032,!![]);}catch(_0x82c179){return BPromise[_0x2ddb('0x24')](_0x82c179);}return _0x475bf4[_0x2ddb('0x25')]();};}function saveUpdates(_0x1d8aec,_0x25a7eb){return function(_0x2fdaab){if(_0x2fdaab){return _0x2fdaab[_0x2ddb('0x26')](_0x1d8aec)[_0x2ddb('0x27')](function(_0x40f45b){return _0x40f45b;});}return null;};}function removeEntity(_0x51c419,_0x935545){return function(_0x57bcc3){if(_0x57bcc3){return _0x57bcc3[_0x2ddb('0x28')]()[_0x2ddb('0x27')](function(){_0x51c419['status'](0xcc)[_0x2ddb('0x29')]();});}};}function handleEntityNotFound(_0x4b6ce9,_0x3f5f95){return function(_0x59a84f){if(!_0x59a84f){_0x4b6ce9[_0x2ddb('0x2a')](0x194);}return _0x59a84f;};}function handleError(_0x2d708d,_0x44390e){_0x44390e=_0x44390e||0x1f4;return function(_0x4e64ee){logger['error'](_0x4e64ee[_0x2ddb('0x2b')]);if(_0x4e64ee[_0x2ddb('0x2c')]){delete _0x4e64ee['name'];}_0x2d708d[_0x2ddb('0x1b')](_0x44390e)[_0x2ddb('0x2d')](_0x4e64ee);};}exports['index']=function(_0x151237,_0x4df0df){var _0x30dfdd={},_0x489e8e={},_0x7ace7={'count':0x0,'rows':[]};var _0x1f16a3=_[_0x2ddb('0x2e')](db[_0x2ddb('0x2f')][_0x2ddb('0x30')],function(_0x27e4a2){return{'name':_0x27e4a2[_0x2ddb('0x31')],'type':_0x27e4a2[_0x2ddb('0x32')][_0x2ddb('0x33')]};});_0x489e8e[_0x2ddb('0x34')]=_[_0x2ddb('0x2e')](_0x1f16a3,'name');_0x489e8e[_0x2ddb('0x35')]=_[_0x2ddb('0x36')](_0x151237[_0x2ddb('0x35')]);_0x489e8e[_0x2ddb('0x37')]=_['intersection'](_0x489e8e[_0x2ddb('0x34')],_0x489e8e[_0x2ddb('0x35')]);_0x30dfdd['attributes']=_[_0x2ddb('0x38')](_0x489e8e[_0x2ddb('0x34')],qs[_0x2ddb('0x39')](_0x151237[_0x2ddb('0x35')][_0x2ddb('0x39')]));_0x30dfdd[_0x2ddb('0x3a')]=_0x30dfdd[_0x2ddb('0x3a')][_0x2ddb('0x3b')]?_0x30dfdd[_0x2ddb('0x3a')]:_0x489e8e[_0x2ddb('0x34')];if(!_0x151237[_0x2ddb('0x35')][_0x2ddb('0x3c')]('nolimit')){_0x30dfdd[_0x2ddb('0x1f')]=qs['limit'](_0x151237[_0x2ddb('0x35')][_0x2ddb('0x1f')]);_0x30dfdd['offset']=qs[_0x2ddb('0x1d')](_0x151237[_0x2ddb('0x35')][_0x2ddb('0x1d')]);}_0x30dfdd[_0x2ddb('0x3d')]=qs[_0x2ddb('0x3e')](_0x151237[_0x2ddb('0x35')][_0x2ddb('0x3e')]);_0x30dfdd[_0x2ddb('0x3f')]=qs['filters'](_['pick'](_0x151237[_0x2ddb('0x35')],_0x489e8e['filters']),_0x1f16a3);if(_0x151237[_0x2ddb('0x35')]['filter']){_0x30dfdd['where']=_[_0x2ddb('0x40')](_0x30dfdd[_0x2ddb('0x3f')],{'$or':_[_0x2ddb('0x2e')](_0x1f16a3,function(_0x9edc63){if(_0x9edc63[_0x2ddb('0x32')]!==_0x2ddb('0x41')){var _0x19cff3={};_0x19cff3[_0x9edc63[_0x2ddb('0x2c')]]={'$like':'%'+_0x151237[_0x2ddb('0x35')][_0x2ddb('0x42')]+'%'};return _0x19cff3;}})});}_0x30dfdd=_[_0x2ddb('0x40')]({},_0x30dfdd,_0x151237[_0x2ddb('0x43')]);var _0x5900f6={'where':_0x30dfdd[_0x2ddb('0x3f')]};return db[_0x2ddb('0x2f')][_0x2ddb('0x20')](_0x5900f6)[_0x2ddb('0x27')](function(_0x6f8a20){_0x7ace7[_0x2ddb('0x20')]=_0x6f8a20;if(_0x151237[_0x2ddb('0x35')][_0x2ddb('0x44')]){_0x30dfdd['include']=[{'all':!![]}];}return db[_0x2ddb('0x2f')][_0x2ddb('0x45')](_0x30dfdd);})[_0x2ddb('0x27')](function(_0x6a8585){_0x7ace7[_0x2ddb('0x46')]=_0x6a8585;return _0x7ace7;})[_0x2ddb('0x27')](respondWithFilteredResult(_0x4df0df,_0x30dfdd))[_0x2ddb('0x47')](handleError(_0x4df0df,null));};exports[_0x2ddb('0x48')]=function(_0x427882,_0x1f35c5){var _0x16ff61={'raw':!![],'where':{'id':_0x427882[_0x2ddb('0x49')]['id']}},_0x10e4d5={};_0x10e4d5[_0x2ddb('0x34')]=_[_0x2ddb('0x36')](db[_0x2ddb('0x2f')][_0x2ddb('0x30')]);_0x10e4d5[_0x2ddb('0x35')]=_[_0x2ddb('0x36')](_0x427882[_0x2ddb('0x35')]);_0x10e4d5['filters']=_[_0x2ddb('0x38')](_0x10e4d5[_0x2ddb('0x34')],_0x10e4d5[_0x2ddb('0x35')]);_0x16ff61['attributes']=_[_0x2ddb('0x38')](_0x10e4d5[_0x2ddb('0x34')],qs[_0x2ddb('0x39')](_0x427882[_0x2ddb('0x35')][_0x2ddb('0x39')]));_0x16ff61[_0x2ddb('0x3a')]=_0x16ff61['attributes']['length']?_0x16ff61[_0x2ddb('0x3a')]:_0x10e4d5['model'];if(_0x427882[_0x2ddb('0x35')][_0x2ddb('0x44')]){_0x16ff61[_0x2ddb('0x4a')]=[{'all':!![]}];}_0x16ff61=_[_0x2ddb('0x40')]({},_0x16ff61,_0x427882[_0x2ddb('0x43')]);return db['OpenchannelTransferReport'][_0x2ddb('0x4b')](_0x16ff61)[_0x2ddb('0x27')](handleEntityNotFound(_0x1f35c5,null))['then'](respondWithResult(_0x1f35c5,null))[_0x2ddb('0x47')](handleError(_0x1f35c5,null));};exports[_0x2ddb('0x4c')]=function(_0x190b6b,_0x5d2f1d){return db[_0x2ddb('0x2f')][_0x2ddb('0x4c')](_0x190b6b[_0x2ddb('0x4d')],{})[_0x2ddb('0x27')](respondWithResult(_0x5d2f1d,0xc9))[_0x2ddb('0x47')](handleError(_0x5d2f1d,null));};exports[_0x2ddb('0x26')]=function(_0x5e673c,_0xc545fd){if(_0x5e673c[_0x2ddb('0x4d')]['id']){delete _0x5e673c[_0x2ddb('0x4d')]['id'];}return db['OpenchannelTransferReport'][_0x2ddb('0x4b')]({'where':{'id':_0x5e673c['params']['id']}})[_0x2ddb('0x27')](handleEntityNotFound(_0xc545fd,null))[_0x2ddb('0x27')](saveUpdates(_0x5e673c[_0x2ddb('0x4d')],null))['then'](respondWithResult(_0xc545fd,null))['catch'](handleError(_0xc545fd,null));};exports[_0x2ddb('0x28')]=function(_0xd7fa16,_0x5b3794){return db[_0x2ddb('0x2f')][_0x2ddb('0x4b')]({'where':{'id':_0xd7fa16['params']['id']}})[_0x2ddb('0x27')](handleEntityNotFound(_0x5b3794,null))[_0x2ddb('0x27')](removeEntity(_0x5b3794,null))[_0x2ddb('0x47')](handleError(_0x5b3794,null));};exports[_0x2ddb('0x4e')]=function(_0x2a68ac,_0x39fa06){return db['OpenchannelTransferReport'][_0x2ddb('0x4e')]()['then'](respondWithResult(_0x39fa06,null))[_0x2ddb('0x47')](handleError(_0x39fa06,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 9a31afd..a665d23 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 _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 +var _0x5681=['exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelTransferReport.attributes'];(function(_0x485ef2,_0x14ca2e){var _0x53ab53=function(_0xcf1785){while(--_0xcf1785){_0x485ef2['push'](_0x485ef2['shift']());}};_0x53ab53(++_0x14ca2e);}(_0x5681,0xbb));var _0x1568=function(_0x253e5d,_0x451f92){_0x253e5d=_0x253e5d-0x0;var _0x1349a9=_0x5681[_0x253e5d];return _0x1349a9;};'use strict';var _=require(_0x1568('0x0'));var util=require(_0x1568('0x1'));var logger=require('../../config/logger')(_0x1568('0x2'));var moment=require(_0x1568('0x3'));var BPromise=require(_0x1568('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1568('0x5'));var rimraf=require(_0x1568('0x6'));var config=require(_0x1568('0x7'));var attributes=require(_0x1568('0x8'));module[_0x1568('0x9')]=function(_0x51acb0,_0xcd662e){return _0x51acb0[_0x1568('0xa')](_0x1568('0xb'),attributes,{'tableName':_0x1568('0xc'),'paranoid':![],'indexes':[{'name':_0x1568('0xd'),'fields':[_0x1568('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 0703e10..3f893ed 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 _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 +var _0xb38e=['OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2f9e3a,_0x5689d4){var _0x55a591=function(_0x2d2524){while(--_0x2d2524){_0x2f9e3a['push'](_0x2f9e3a['shift']());}};_0x55a591(++_0x5689d4);}(_0xb38e,0xa7));var _0xeb38=function(_0x5987e3,_0x511e26){_0x5987e3=_0x5987e3-0x0;var _0x4fc458=_0xb38e[_0x5987e3];return _0x4fc458;};'use strict';var _=require(_0xeb38('0x0'));var util=require(_0xeb38('0x1'));var moment=require(_0xeb38('0x2'));var BPromise=require(_0xeb38('0x3'));var rs=require(_0xeb38('0x4'));var fs=require('fs');var Redis=require(_0xeb38('0x5'));var db=require(_0xeb38('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xeb38('0x7'))(_0xeb38('0x8'));var config=require('../../config/environment');var jayson=require(_0xeb38('0x9'));var client=jayson[_0xeb38('0xa')][_0xeb38('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31db8c,_0x4cfa4d,_0x3003aa){return new BPromise(function(_0x196580,_0x3b2df7){return client[_0xeb38('0xc')](_0x31db8c,_0x3003aa)['then'](function(_0x2b0c8b){logger[_0xeb38('0xd')](_0xeb38('0xe'),_0x4cfa4d,_0xeb38('0xf'));logger[_0xeb38('0x10')](_0xeb38('0x11'),_0x4cfa4d,_0xeb38('0xf'),JSON['stringify'](_0x2b0c8b));if(_0x2b0c8b[_0xeb38('0x12')]){if(_0x2b0c8b['error'][_0xeb38('0x13')]===0x1f4){logger[_0xeb38('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4cfa4d,_0x2b0c8b[_0xeb38('0x12')][_0xeb38('0x14')]);return _0x3b2df7(_0x2b0c8b[_0xeb38('0x12')][_0xeb38('0x14')]);}logger[_0xeb38('0x12')](_0xeb38('0xe'),_0x4cfa4d,_0x2b0c8b['error'][_0xeb38('0x14')]);return _0x196580(_0x2b0c8b[_0xeb38('0x12')][_0xeb38('0x14')]);}else{logger[_0xeb38('0xd')](_0xeb38('0xe'),_0x4cfa4d,_0xeb38('0xf'));_0x196580(_0x2b0c8b[_0xeb38('0x15')]['message']);}})[_0xeb38('0x16')](function(_0x980c8){logger[_0xeb38('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4cfa4d,_0x980c8);_0x3b2df7(_0x980c8);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 7dfe9cd..0dee6be 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 _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 +var _0x1827=['../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x342927,_0x4abe14){var _0x8ab3a7=function(_0x3b72ed){while(--_0x3b72ed){_0x342927['push'](_0x342927['shift']());}};_0x8ab3a7(++_0x4abe14);}(_0x1827,0x1dc));var _0x7182=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x1827[_0x543084];return _0x306a57;};'use strict';var multer=require('multer');var util=require(_0x7182('0x0'));var path=require(_0x7182('0x1'));var timeout=require(_0x7182('0x2'));var express=require(_0x7182('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7182('0x4'));var interaction=require(_0x7182('0x5'));var config=require(_0x7182('0x6'));var controller=require(_0x7182('0x7'));router[_0x7182('0x8')]('/',auth[_0x7182('0x9')](),controller[_0x7182('0xa')]);router[_0x7182('0x8')](_0x7182('0xb'),auth[_0x7182('0x9')](),controller['show']);router['post']('/',auth[_0x7182('0x9')](),controller['create']);router['put']('/:id',auth[_0x7182('0x9')](),controller['update']);router[_0x7182('0xc')](_0x7182('0xb'),auth[_0x7182('0x9')](),controller[_0x7182('0xd')]);module[_0x7182('0xe')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 1c6c189..949796f 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 _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 +var _0xce71=['STRING','sequelize','exports','name'];(function(_0xad2f25,_0x5d0f1e){var _0x9a937e=function(_0x1e78ac){while(--_0x1e78ac){_0xad2f25['push'](_0xad2f25['shift']());}};_0x9a937e(++_0x5d0f1e);}(_0xce71,0x79));var _0x1ce7=function(_0xd3917d,_0x732781){_0xd3917d=_0xd3917d-0x0;var _0x35aa9d=_0xce71[_0xd3917d];return _0x35aa9d;};'use strict';var Sequelize=require(_0x1ce7('0x0'));module[_0x1ce7('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1ce7('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x1ce7('0x3')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index f8a4376..451dc95 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 _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 +var _0x86cc=['Content-Range','apply','save','update','then','destroy','get','Pauses','UserProfileResource','end','sendStatus','error','name','send','index','map','Pause','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count'];(function(_0x272ea6,_0x3f0673){var _0x43ef03=function(_0x2307e2){while(--_0x2307e2){_0x272ea6['push'](_0x272ea6['shift']());}};_0x43ef03(++_0x3f0673);}(_0x86cc,0x1e3));var _0xc86c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x86cc[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc86c('0x0'));var zipdir=require(_0xc86c('0x1'));var jsonpatch=require(_0xc86c('0x2'));var rp=require('request-promise');var moment=require(_0xc86c('0x3'));var BPromise=require(_0xc86c('0x4'));var Mustache=require(_0xc86c('0x5'));var util=require(_0xc86c('0x6'));var path=require(_0xc86c('0x7'));var sox=require(_0xc86c('0x8'));var csv=require(_0xc86c('0x9'));var ejs=require(_0xc86c('0xa'));var fs=require('fs');var fs_extra=require(_0xc86c('0xb'));var _=require(_0xc86c('0xc'));var squel=require(_0xc86c('0xd'));var crypto=require(_0xc86c('0xe'));var jsforce=require(_0xc86c('0xf'));var deskjs=require(_0xc86c('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc86c('0x11'));var Papa=require(_0xc86c('0x12'));var Redis=require(_0xc86c('0x13'));var authService=require(_0xc86c('0x14'));var qs=require(_0xc86c('0x15'));var as=require(_0xc86c('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc86c('0x17'))(_0xc86c('0x18'));var utils=require('../../config/utils');var config=require(_0xc86c('0x19'));var licenseUtil=require(_0xc86c('0x1a'));var db=require(_0xc86c('0x1b'))['db'];function respondWithStatusCode(_0x20dc87,_0x1b912c){_0x1b912c=_0x1b912c||0xcc;return function(_0x53297e){if(_0x53297e){return _0x20dc87['sendStatus'](_0x1b912c);}return _0x20dc87[_0xc86c('0x1c')](_0x1b912c)['end']();};}function respondWithResult(_0x5343c3,_0x27a45b){_0x27a45b=_0x27a45b||0xc8;return function(_0x2c95e5){if(_0x2c95e5){return _0x5343c3[_0xc86c('0x1c')](_0x27a45b)[_0xc86c('0x1d')](_0x2c95e5);}};}function respondWithFilteredResult(_0x25355e,_0x1adbda){return function(_0x5ce0cf){if(_0x5ce0cf){var _0x3a69a3=typeof _0x1adbda[_0xc86c('0x1e')]===_0xc86c('0x1f')&&typeof _0x1adbda['limit']===_0xc86c('0x1f');var _0x2bbf31=_0x5ce0cf[_0xc86c('0x20')];var _0x5eef77=_0x3a69a3?0x0:_0x1adbda['offset'];var _0x169abd=_0x3a69a3?_0x5ce0cf[_0xc86c('0x20')]:_0x1adbda[_0xc86c('0x1e')]+_0x1adbda['limit'];var _0xad8bbc;if(_0x169abd>=_0x2bbf31){_0x169abd=_0x2bbf31;_0xad8bbc=0xc8;}else{_0xad8bbc=0xce;}_0x25355e[_0xc86c('0x1c')](_0xad8bbc);return _0x25355e['set'](_0xc86c('0x21'),_0x5eef77+'-'+_0x169abd+'/'+_0x2bbf31)['json'](_0x5ce0cf);}return null;};}function patchUpdates(_0x211581){return function(_0x175b9e){try{jsonpatch[_0xc86c('0x22')](_0x175b9e,_0x211581,!![]);}catch(_0x1aeddf){return BPromise['reject'](_0x1aeddf);}return _0x175b9e[_0xc86c('0x23')]();};}function saveUpdates(_0x1fd495,_0xf48fac){return function(_0x144d56){if(_0x144d56){return _0x144d56[_0xc86c('0x24')](_0x1fd495)[_0xc86c('0x25')](function(_0x7c83ed){return _0x7c83ed;});}return null;};}function removeEntity(_0xf1fed4,_0x5736f1){return function(_0x458d42){if(_0x458d42){return _0x458d42[_0xc86c('0x26')]()[_0xc86c('0x25')](function(){var _0x5d06d5=_0x458d42[_0xc86c('0x27')]({'plain':!![]});var _0x1d2bf7=_0xc86c('0x28');return db[_0xc86c('0x29')][_0xc86c('0x26')]({'where':{'type':_0x1d2bf7,'resourceId':_0x5d06d5['id']}})[_0xc86c('0x25')](function(){return _0x458d42;});})[_0xc86c('0x25')](function(){_0xf1fed4[_0xc86c('0x1c')](0xcc)[_0xc86c('0x2a')]();});}};}function handleEntityNotFound(_0x351c77,_0x1bba1d){return function(_0x3d62a1){if(!_0x3d62a1){_0x351c77[_0xc86c('0x2b')](0x194);}return _0x3d62a1;};}function handleError(_0x2e46d5,_0xb99e7){_0xb99e7=_0xb99e7||0x1f4;return function(_0x3ea184){logger[_0xc86c('0x2c')](_0x3ea184['stack']);if(_0x3ea184[_0xc86c('0x2d')]){delete _0x3ea184['name'];}_0x2e46d5[_0xc86c('0x1c')](_0xb99e7)[_0xc86c('0x2e')](_0x3ea184);};}exports[_0xc86c('0x2f')]=function(_0x3a5ebe,_0x50e9ff){var _0x454e22={},_0x3dc5e9={},_0x87b7b8={'count':0x0,'rows':[]};var _0x14da1d=_[_0xc86c('0x30')](db[_0xc86c('0x31')]['rawAttributes'],function(_0x54bf52){return{'name':_0x54bf52[_0xc86c('0x32')],'type':_0x54bf52[_0xc86c('0x33')][_0xc86c('0x34')]};});_0x3dc5e9['model']=_[_0xc86c('0x30')](_0x14da1d,'name');_0x3dc5e9['query']=_[_0xc86c('0x35')](_0x3a5ebe[_0xc86c('0x36')]);_0x3dc5e9[_0xc86c('0x37')]=_[_0xc86c('0x38')](_0x3dc5e9['model'],_0x3dc5e9[_0xc86c('0x36')]);_0x454e22[_0xc86c('0x39')]=_[_0xc86c('0x38')](_0x3dc5e9[_0xc86c('0x3a')],qs[_0xc86c('0x3b')](_0x3a5ebe[_0xc86c('0x36')][_0xc86c('0x3b')]));_0x454e22[_0xc86c('0x39')]=_0x454e22[_0xc86c('0x39')]['length']?_0x454e22[_0xc86c('0x39')]:_0x3dc5e9[_0xc86c('0x3a')];if(!_0x3a5ebe['query'][_0xc86c('0x3c')]('nolimit')){_0x454e22['limit']=qs['limit'](_0x3a5ebe[_0xc86c('0x36')][_0xc86c('0x3d')]);_0x454e22['offset']=qs[_0xc86c('0x1e')](_0x3a5ebe[_0xc86c('0x36')][_0xc86c('0x1e')]);}_0x454e22[_0xc86c('0x3e')]=qs[_0xc86c('0x3f')](_0x3a5ebe[_0xc86c('0x36')][_0xc86c('0x3f')]);_0x454e22[_0xc86c('0x40')]=qs['filters'](_[_0xc86c('0x41')](_0x3a5ebe[_0xc86c('0x36')],_0x3dc5e9[_0xc86c('0x37')]),_0x14da1d);if(_0x3a5ebe[_0xc86c('0x36')]['filter']){_0x454e22[_0xc86c('0x40')]=_[_0xc86c('0x42')](_0x454e22[_0xc86c('0x40')],{'$or':_[_0xc86c('0x30')](_0x14da1d,function(_0x16d2ff){if(_0x16d2ff[_0xc86c('0x33')]!==_0xc86c('0x43')){var _0x1b512a={};_0x1b512a[_0x16d2ff[_0xc86c('0x2d')]]={'$like':'%'+_0x3a5ebe[_0xc86c('0x36')][_0xc86c('0x44')]+'%'};return _0x1b512a;}})});}_0x454e22=_['merge']({},_0x454e22,_0x3a5ebe[_0xc86c('0x45')]);var _0x3a761b={'where':_0x454e22[_0xc86c('0x40')]};return db[_0xc86c('0x31')][_0xc86c('0x20')](_0x3a761b)['then'](function(_0x2f1780){_0x87b7b8[_0xc86c('0x20')]=_0x2f1780;if(_0x3a5ebe['query'][_0xc86c('0x46')]){_0x454e22['include']=[{'all':!![]}];}return db[_0xc86c('0x31')][_0xc86c('0x47')](_0x454e22);})[_0xc86c('0x25')](function(_0x219528){_0x87b7b8[_0xc86c('0x48')]=_0x219528;return _0x87b7b8;})[_0xc86c('0x25')](respondWithFilteredResult(_0x50e9ff,_0x454e22))[_0xc86c('0x49')](handleError(_0x50e9ff,null));};exports['show']=function(_0x6aea45,_0x259457){var _0x45e1c3={'raw':!![],'where':{'id':_0x6aea45[_0xc86c('0x4a')]['id']}},_0x3323cc={};_0x3323cc[_0xc86c('0x3a')]=_['keys'](db[_0xc86c('0x31')][_0xc86c('0x4b')]);_0x3323cc[_0xc86c('0x36')]=_[_0xc86c('0x35')](_0x6aea45[_0xc86c('0x36')]);_0x3323cc[_0xc86c('0x37')]=_[_0xc86c('0x38')](_0x3323cc['model'],_0x3323cc[_0xc86c('0x36')]);_0x45e1c3[_0xc86c('0x39')]=_['intersection'](_0x3323cc[_0xc86c('0x3a')],qs['fields'](_0x6aea45[_0xc86c('0x36')][_0xc86c('0x3b')]));_0x45e1c3['attributes']=_0x45e1c3['attributes'][_0xc86c('0x4c')]?_0x45e1c3[_0xc86c('0x39')]:_0x3323cc[_0xc86c('0x3a')];if(_0x6aea45[_0xc86c('0x36')][_0xc86c('0x46')]){_0x45e1c3['include']=[{'all':!![]}];}_0x45e1c3=_['merge']({},_0x45e1c3,_0x6aea45['options']);return db[_0xc86c('0x31')][_0xc86c('0x4d')](_0x45e1c3)[_0xc86c('0x25')](handleEntityNotFound(_0x259457,null))[_0xc86c('0x25')](respondWithResult(_0x259457,null))['catch'](handleError(_0x259457,null));};exports[_0xc86c('0x4e')]=function(_0x520631,_0x8c3867){return db[_0xc86c('0x31')][_0xc86c('0x4e')](_0x520631[_0xc86c('0x4f')],{})['then'](function(_0x370d1f){var _0x133b2a=_0x520631[_0xc86c('0x50')][_0xc86c('0x27')]({'plain':!![]});if(!_0x133b2a)throw new Error(_0xc86c('0x51'));if(_0x133b2a[_0xc86c('0x52')]===_0xc86c('0x50')){var _0x4def1b=_0x370d1f['get']({'plain':!![]});var _0x1bbe2b=_0xc86c('0x28');return db[_0xc86c('0x53')]['find']({'where':{'name':_0x1bbe2b,'userProfileId':_0x133b2a['userProfileId']},'raw':!![]})['then'](function(_0x393781){if(_0x393781&&_0x393781[_0xc86c('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x4def1b[_0xc86c('0x2d')],'resourceId':_0x4def1b['id'],'type':_0x393781[_0xc86c('0x2d')],'sectionId':_0x393781['id']},{})[_0xc86c('0x25')](function(){return _0x370d1f;});}else{return _0x370d1f;}})[_0xc86c('0x49')](function(_0x18cbc2){logger[_0xc86c('0x2c')](_0xc86c('0x55'),_0x18cbc2);throw _0x18cbc2;});}return _0x370d1f;})[_0xc86c('0x25')](respondWithResult(_0x8c3867,0xc9))['catch'](handleError(_0x8c3867,null));};exports[_0xc86c('0x24')]=function(_0x2d0727,_0x314b08){if(_0x2d0727[_0xc86c('0x4f')]['id']){delete _0x2d0727[_0xc86c('0x4f')]['id'];}return db[_0xc86c('0x31')][_0xc86c('0x4d')]({'where':{'id':_0x2d0727[_0xc86c('0x4a')]['id']}})[_0xc86c('0x25')](handleEntityNotFound(_0x314b08,null))['then'](saveUpdates(_0x2d0727[_0xc86c('0x4f')],null))[_0xc86c('0x25')](respondWithResult(_0x314b08,null))[_0xc86c('0x49')](handleError(_0x314b08,null));};exports[_0xc86c('0x26')]=function(_0x15a562,_0x1f0b6f){return db[_0xc86c('0x31')]['find']({'where':{'id':_0x15a562[_0xc86c('0x4a')]['id']}})[_0xc86c('0x25')](handleEntityNotFound(_0x1f0b6f,null))[_0xc86c('0x25')](removeEntity(_0x1f0b6f,null))[_0xc86c('0x49')](handleError(_0x1f0b6f,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index c1fdd57..7681114 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ef6=['exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes'];(function(_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 +var _0x326f=['tools_pauses','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x5abbed,_0x5c89e8){var _0xf6cf68=function(_0x31687e){while(--_0x31687e){_0x5abbed['push'](_0x5abbed['shift']());}};_0xf6cf68(++_0x5c89e8);}(_0x326f,0xd1));var _0xf326=function(_0x43192d,_0x5f0dfe){_0x43192d=_0x43192d-0x0;var _0x36e38b=_0x326f[_0x43192d];return _0x36e38b;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index e6eb94c..1d32bf3 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(_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 +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(_0x476b2e,_0x20e50a){var _0x15356d=function(_0x57fffc){while(--_0x57fffc){_0x476b2e['push'](_0x476b2e['shift']());}};_0x15356d(++_0x20e50a);}(_0xb10b,0x12a));var _0xbb10=function(_0xc37c8,_0x182df1){_0xc37c8=_0xc37c8-0x0;var _0x77188f=_0xb10b[_0xc37c8];return _0x77188f;};'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 ed0bc8c..8e28ea6 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 _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 +var _0xac9d=['put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','root','server/files/plugins','originalname','replace','format','%s-%s%s','extname','post','single','file','upload'];(function(_0x212fcc,_0x1a8867){var _0x4d8190=function(_0x347f7b){while(--_0x347f7b){_0x212fcc['push'](_0x212fcc['shift']());}};_0x4d8190(++_0x1a8867);}(_0xac9d,0x14d));var _0xdac9=function(_0x35f58d,_0x56c821){_0x35f58d=_0x35f58d-0x0;var _0xbca79b=_0xac9d[_0x35f58d];return _0xbca79b;};'use strict';var multer=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var path=require(_0xdac9('0x2'));var timeout=require(_0xdac9('0x3'));var express=require(_0xdac9('0x4'));var router=express[_0xdac9('0x5')]();var fs_extra=require(_0xdac9('0x6'));var auth=require(_0xdac9('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xdac9('0x8'));var controller=require('./plugin.controller');router[_0xdac9('0x9')]('/',auth[_0xdac9('0xa')](),controller[_0xdac9('0xb')]);router[_0xdac9('0x9')](_0xdac9('0xc'),controller[_0xdac9('0xd')]);router['get'](_0xdac9('0xe'),auth['isAuthenticated'](),controller[_0xdac9('0xf')]);router[_0xdac9('0x9')](_0xdac9('0x10'),auth[_0xdac9('0xa')](),controller[_0xdac9('0x11')]);var upload=multer({'storage':multer[_0xdac9('0x12')]({'destination':function(_0x255627,_0x1b604a,_0xbb5615){_0xbb5615(null,path['join'](config[_0xdac9('0x13')],_0xdac9('0x14')));},'filename':function(_0x5a9bde,_0x3d8e97,_0xeddbc1){_0x3d8e97[_0xdac9('0x15')]=_0x3d8e97['originalname'][_0xdac9('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xeddbc1(null,util[_0xdac9('0x17')](_0xdac9('0x18'),path['basename'](_0x3d8e97['originalname'],path[_0xdac9('0x19')](_0x3d8e97[_0xdac9('0x15')])),Date['now'](),path[_0xdac9('0x19')](_0x3d8e97[_0xdac9('0x15')])));}})});router[_0xdac9('0x1a')]('/',upload[_0xdac9('0x1b')](_0xdac9('0x1c')),controller[_0xdac9('0x1d')]);router[_0xdac9('0x1a')](_0xdac9('0xc'),controller['webhookPost']);router[_0xdac9('0x1e')](_0xdac9('0xe'),auth['isAuthenticated'](),controller[_0xdac9('0x1f')]);router[_0xdac9('0x20')](_0xdac9('0xe'),auth[_0xdac9('0xa')](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 27df6fc..23d3878 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 _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 +var _0x85e2=['html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','ENUM'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x85e2,0xfa));var _0x285e=function(_0x1dc0fd,_0x427879){_0x1dc0fd=_0x1dc0fd-0x0;var _0x5ea65e=_0x85e2[_0x1dc0fd];return _0x5ea65e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x285e('0x0')]},'type':{'type':Sequelize[_0x285e('0x1')](_0x285e('0x2'),_0x285e('0x3'))},'description':{'type':Sequelize[_0x285e('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x285e('0x0')],'comment':_0x285e('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x285e('0x6')},'sidebar':{'type':Sequelize['ENUM'](_0x285e('0x7'),_0x285e('0x8'),_0x285e('0x9'),_0x285e('0xa')),'defaultValue':_0x285e('0x9'),'comment':_0x285e('0xb')},'icon':{'type':Sequelize[_0x285e('0x0')]},'adminUrl':{'type':Sequelize[_0x285e('0x0')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x285e('0x0')]},'scriptPath':{'type':Sequelize[_0x285e('0x0')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 625b7b1..7c58f2c 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 _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 +var _0x0e4f=['then','get','error','stack','send','Plugin','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','show','params','find','catch','download','path','server/files/plugins','%s.zip','zip','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','root','dirname','join','basename','attachments/**/*','finalize','existsSync','Error','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','manifest.json','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','agent','Invalid\x20manifest:\x20no\x20view\x20specified','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','version','html','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptName','admin','test','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Plugins','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','update','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','encoding','method','format','%s%s','headers','content-length','content-type','endsWith','statusCode','resolve','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','offset','undefined','limit','set','save','destroy'];(function(_0x4f4d9c,_0x471842){var _0x13b013=function(_0x404b31){while(--_0x404b31){_0x4f4d9c['push'](_0x4f4d9c['shift']());}};_0x13b013(++_0x471842);}(_0x0e4f,0x121));var _0xf0e4=function(_0x304557,_0x336ce1){_0x304557=_0x304557-0x0;var _0x345c0c=_0x0e4f[_0x304557];return _0x345c0c;};'use strict';var emlformat=require(_0xf0e4('0x0'));var rimraf=require(_0xf0e4('0x1'));var zipdir=require(_0xf0e4('0x2'));var jsonpatch=require(_0xf0e4('0x3'));var rp=require(_0xf0e4('0x4'));var moment=require(_0xf0e4('0x5'));var BPromise=require(_0xf0e4('0x6'));var Mustache=require(_0xf0e4('0x7'));var util=require(_0xf0e4('0x8'));var path=require('path');var sox=require(_0xf0e4('0x9'));var csv=require(_0xf0e4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf0e4('0xb'));var _=require(_0xf0e4('0xc'));var squel=require(_0xf0e4('0xd'));var crypto=require(_0xf0e4('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf0e4('0xf'));var toCsv=require(_0xf0e4('0xa'));var querystring=require(_0xf0e4('0x10'));var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require(_0xf0e4('0x1'));var archiver=require('archiver');var Redis=require('ioredis');var authService=require(_0xf0e4('0x11'));var qs=require(_0xf0e4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0e4('0x13'));var logger=require(_0xf0e4('0x14'))(_0xf0e4('0x15'));var utils=require(_0xf0e4('0x16'));var config=require(_0xf0e4('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf0e4('0x18'))['db'];config['redis']=_['defaults'](config[_0xf0e4('0x19')],{'host':_0xf0e4('0x1a'),'port':0x18eb});var socket=require(_0xf0e4('0x1b'))(new Redis(config[_0xf0e4('0x19')]));require(_0xf0e4('0x1c'))[_0xf0e4('0x1d')](socket);function respondWithStatusCode(_0x390a40,_0x4373e4){_0x4373e4=_0x4373e4||0xcc;return function(_0x2fe125){if(_0x2fe125){return _0x390a40[_0xf0e4('0x1e')](_0x4373e4);}return _0x390a40[_0xf0e4('0x1f')](_0x4373e4)['end']();};}function respondWithResult(_0x14112b,_0x462355){_0x462355=_0x462355||0xc8;return function(_0x3319c2){if(_0x3319c2){return _0x14112b[_0xf0e4('0x1f')](_0x462355)[_0xf0e4('0x20')](_0x3319c2);}};}function respondWithFilteredResult(_0x57a3c6,_0x5d557a){return function(_0x1a0ad6){if(_0x1a0ad6){var _0x37ea7b=typeof _0x5d557a[_0xf0e4('0x21')]===_0xf0e4('0x22')&&typeof _0x5d557a[_0xf0e4('0x23')]===_0xf0e4('0x22');var _0x58a719=_0x1a0ad6['count'];var _0x59d4c8=_0x37ea7b?0x0:_0x5d557a[_0xf0e4('0x21')];var _0x16b0b5=_0x37ea7b?_0x1a0ad6['count']:_0x5d557a[_0xf0e4('0x21')]+_0x5d557a['limit'];var _0x246e4c;if(_0x16b0b5>=_0x58a719){_0x16b0b5=_0x58a719;_0x246e4c=0xc8;}else{_0x246e4c=0xce;}_0x57a3c6['status'](_0x246e4c);return _0x57a3c6[_0xf0e4('0x24')]('Content-Range',_0x59d4c8+'-'+_0x16b0b5+'/'+_0x58a719)[_0xf0e4('0x20')](_0x1a0ad6);}return null;};}function patchUpdates(_0x2a7436){return function(_0x1fb38d){try{jsonpatch['apply'](_0x1fb38d,_0x2a7436,!![]);}catch(_0x24f092){return BPromise['reject'](_0x24f092);}return _0x1fb38d[_0xf0e4('0x25')]();};}function saveUpdates(_0x1419e4,_0x1e2448){return function(_0x5597d9){if(_0x5597d9){return _0x5597d9['update'](_0x1419e4)['then'](function(_0xb00f64){return _0xb00f64;});}return null;};}function removeEntity(_0x211ea3,_0x4448d2){return function(_0x33c50b){if(_0x33c50b){return _0x33c50b[_0xf0e4('0x26')]()[_0xf0e4('0x27')](function(){var _0x47496c=_0x33c50b[_0xf0e4('0x28')]({'plain':!![]});var _0x4ec295='Plugins';return db['UserProfileResource'][_0xf0e4('0x26')]({'where':{'type':_0x4ec295,'resourceId':_0x47496c['id']}})['then'](function(){return _0x33c50b;});})[_0xf0e4('0x27')](function(){_0x211ea3[_0xf0e4('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b678a,_0x2be1fa){return function(_0x5a4659){if(!_0x5a4659){_0x2b678a['sendStatus'](0x194);}return _0x5a4659;};}function handleError(_0x3e5128,_0x5c92d2){_0x5c92d2=_0x5c92d2||0x1f4;return function(_0x4a39c4){logger[_0xf0e4('0x29')](_0x4a39c4[_0xf0e4('0x2a')]);if(_0x4a39c4['name']){delete _0x4a39c4['name'];}_0x3e5128[_0xf0e4('0x1f')](_0x5c92d2)[_0xf0e4('0x2b')](_0x4a39c4);};}exports['index']=function(_0x2e7134,_0x4cbbb5){var _0x5d37db={},_0x260a80={},_0x17f21b={'count':0x0,'rows':[]};var _0x4eb337=_['map'](db[_0xf0e4('0x2c')][_0xf0e4('0x2d')],function(_0x36a1f5){return{'name':_0x36a1f5[_0xf0e4('0x2e')],'type':_0x36a1f5[_0xf0e4('0x2f')][_0xf0e4('0x30')]};});_0x260a80[_0xf0e4('0x31')]=_[_0xf0e4('0x32')](_0x4eb337,_0xf0e4('0x33'));_0x260a80[_0xf0e4('0x34')]=_[_0xf0e4('0x35')](_0x2e7134[_0xf0e4('0x34')]);_0x260a80[_0xf0e4('0x36')]=_[_0xf0e4('0x37')](_0x260a80[_0xf0e4('0x31')],_0x260a80[_0xf0e4('0x34')]);_0x5d37db[_0xf0e4('0x38')]=_['intersection'](_0x260a80[_0xf0e4('0x31')],qs[_0xf0e4('0x39')](_0x2e7134[_0xf0e4('0x34')]['fields']));_0x5d37db[_0xf0e4('0x38')]=_0x5d37db['attributes'][_0xf0e4('0x3a')]?_0x5d37db['attributes']:_0x260a80[_0xf0e4('0x31')];if(!_0x2e7134['query'][_0xf0e4('0x3b')](_0xf0e4('0x3c'))){_0x5d37db[_0xf0e4('0x23')]=qs[_0xf0e4('0x23')](_0x2e7134['query'][_0xf0e4('0x23')]);_0x5d37db['offset']=qs[_0xf0e4('0x21')](_0x2e7134[_0xf0e4('0x34')][_0xf0e4('0x21')]);}_0x5d37db['order']=qs['sort'](_0x2e7134[_0xf0e4('0x34')][_0xf0e4('0x3d')]);_0x5d37db[_0xf0e4('0x3e')]=qs[_0xf0e4('0x36')](_[_0xf0e4('0x3f')](_0x2e7134[_0xf0e4('0x34')],_0x260a80[_0xf0e4('0x36')]),_0x4eb337);if(_0x2e7134[_0xf0e4('0x34')][_0xf0e4('0x40')]){_0x5d37db[_0xf0e4('0x3e')]=_[_0xf0e4('0x41')](_0x5d37db[_0xf0e4('0x3e')],{'$or':_['map'](_0x4eb337,function(_0x4af84f){if(_0x4af84f[_0xf0e4('0x2f')]!==_0xf0e4('0x42')){var _0xae07d5={};_0xae07d5[_0x4af84f[_0xf0e4('0x33')]]={'$like':'%'+_0x2e7134[_0xf0e4('0x34')][_0xf0e4('0x40')]+'%'};return _0xae07d5;}})});}_0x5d37db=_[_0xf0e4('0x41')]({},_0x5d37db,_0x2e7134['options']);var _0x559a98={'where':_0x5d37db[_0xf0e4('0x3e')]};return db['Plugin']['count'](_0x559a98)['then'](function(_0x248ecd){_0x17f21b[_0xf0e4('0x43')]=_0x248ecd;if(_0x2e7134['query'][_0xf0e4('0x44')]){_0x5d37db[_0xf0e4('0x45')]=[{'all':!![]}];}return db[_0xf0e4('0x2c')][_0xf0e4('0x46')](_0x5d37db);})['then'](function(_0x52ff1a){_0x17f21b[_0xf0e4('0x47')]=_0x52ff1a;return _0x17f21b;})[_0xf0e4('0x27')](respondWithFilteredResult(_0x4cbbb5,_0x5d37db))['catch'](handleError(_0x4cbbb5,null));};exports[_0xf0e4('0x48')]=function(_0x2c70be,_0x5207d4){var _0x3079ba={'raw':!![],'where':{'id':_0x2c70be[_0xf0e4('0x49')]['id']}},_0x93866={};_0x93866[_0xf0e4('0x31')]=_[_0xf0e4('0x35')](db[_0xf0e4('0x2c')]['rawAttributes']);_0x93866[_0xf0e4('0x34')]=_[_0xf0e4('0x35')](_0x2c70be['query']);_0x93866['filters']=_[_0xf0e4('0x37')](_0x93866[_0xf0e4('0x31')],_0x93866[_0xf0e4('0x34')]);_0x3079ba[_0xf0e4('0x38')]=_['intersection'](_0x93866[_0xf0e4('0x31')],qs[_0xf0e4('0x39')](_0x2c70be['query'][_0xf0e4('0x39')]));_0x3079ba[_0xf0e4('0x38')]=_0x3079ba['attributes'][_0xf0e4('0x3a')]?_0x3079ba[_0xf0e4('0x38')]:_0x93866[_0xf0e4('0x31')];if(_0x2c70be[_0xf0e4('0x34')][_0xf0e4('0x44')]){_0x3079ba['include']=[{'all':!![]}];}_0x3079ba=_[_0xf0e4('0x41')]({},_0x3079ba,_0x2c70be['options']);return db[_0xf0e4('0x2c')][_0xf0e4('0x4a')](_0x3079ba)[_0xf0e4('0x27')](handleEntityNotFound(_0x5207d4,null))[_0xf0e4('0x27')](respondWithResult(_0x5207d4,null))[_0xf0e4('0x4b')](handleError(_0x5207d4,null));};exports[_0xf0e4('0x4c')]=function(_0xf520ac,_0xff5d25,_0x482ffc){return db[_0xf0e4('0x2c')][_0xf0e4('0x4a')]({'where':{'id':_0xf520ac[_0xf0e4('0x49')]['id']},'attributes':[_0xf0e4('0x33'),_0xf0e4('0x4d')],'raw':!![]})[_0xf0e4('0x27')](handleEntityNotFound(_0xff5d25,null))['then'](function(_0x220415){if(_0x220415){var _0x3ef775=path['join'](config['root'],_0xf0e4('0x4e'),util['format'](_0xf0e4('0x4f'),path['basename'](_0x220415[_0xf0e4('0x4d')])));var _0x183163=fs['createWriteStream'](_0x3ef775);var _0x9a9cc5=archiver(_0xf0e4('0x50'),{'zlib':{'level':0x9}});_0x9a9cc5['on']('warning',function(_0x31d22e){if(_0x31d22e[_0xf0e4('0x51')]===_0xf0e4('0x52')){logger[_0xf0e4('0x29')](_0x31d22e);}else{throw new db[(_0xf0e4('0x53'))]['Error'](_0xf0e4('0x54'));}});_0x9a9cc5['on'](_0xf0e4('0x29'),function(_0x50f7a5){throw new db['Sequelize']['Error'](_0xf0e4('0x54'));});_0x9a9cc5['pipe'](_0x183163);_0x9a9cc5[_0xf0e4('0x55')](_0xf0e4('0x56'),{'cwd':path['join'](config[_0xf0e4('0x57')],_0xf0e4('0x4e'),path[_0xf0e4('0x58')](_0x220415['path'])),'ignore':[path[_0xf0e4('0x59')](path[_0xf0e4('0x5a')](_0x220415[_0xf0e4('0x4d')]),'node_modules/**/*'),path[_0xf0e4('0x59')](path['basename'](_0x220415[_0xf0e4('0x4d')]),_0xf0e4('0x5b'))],'nodir':!![]})[_0xf0e4('0x5c')]();_0x183163['on']('close',function(){if(!fs[_0xf0e4('0x5d')](_0x3ef775)){throw new db['Sequelize'][(_0xf0e4('0x5e'))]('Plugin\x20not\x20found');}return _0xff5d25[_0xf0e4('0x4c')](_0x3ef775,util['format'](_0xf0e4('0x4f'),path[_0xf0e4('0x5a')](_0x220415[_0xf0e4('0x4d')])),function(_0x201a9b){if(_0x201a9b){throw new db['Sequelize']['Error'](_0xf0e4('0x5f'));}fs['unlinkSync'](_0x3ef775);logger[_0xf0e4('0x60')](_0xf0e4('0x61'));logger[_0xf0e4('0x60')](_0xf0e4('0x62'));});});}return null;})[_0xf0e4('0x4b')](handleError(_0xff5d25,null));};exports[_0xf0e4('0x63')]=function(_0xd7cd1b,_0x2ac995,_0x54160f){var _0x41b364=path[_0xf0e4('0x5a')](_0xd7cd1b[_0xf0e4('0x64')][_0xf0e4('0x65')],path[_0xf0e4('0x66')](_0xd7cd1b[_0xf0e4('0x64')][_0xf0e4('0x65')]));var _0x4c1871=path[_0xf0e4('0x59')](config[_0xf0e4('0x57')],'server/files/plugins',_0xd7cd1b[_0xf0e4('0x64')][_0xf0e4('0x65')]);var _0x434eb3=path[_0xf0e4('0x59')](config[_0xf0e4('0x57')],'server/files/plugins',_0x41b364);logger[_0xf0e4('0x60')]('Plugin\x20upload\x20filepath:\x20%s',_0x4c1871);logger['info'](_0xf0e4('0x67'),_0x434eb3);try{fs[_0xf0e4('0x68')](_0x4c1871,parseInt(_0xf0e4('0x69'),0x8));extract(_0x4c1871,{'dir':_0x434eb3},function(_0x9425ae){if(_0x9425ae){logger[_0xf0e4('0x29')](_0x9425ae);handleError(_0x9425ae,!![]);};var _0x96ddd7=fs[_0xf0e4('0x6a')](_0x434eb3);if(_0x96ddd7['length']>0x1){removeReferences(_0x4c1871,_0x434eb3);logger[_0xf0e4('0x29')](_0xf0e4('0x6b'));return _0x54160f(new Error(_0xf0e4('0x6b')));}var _0x3d19b1=fs[_0xf0e4('0x6c')](path['join'](_0x434eb3,_0x96ddd7[0x0]));if(_0x3d19b1['isFile']()){removeReferences(_0x4c1871,_0x434eb3);logger['error'](_0xf0e4('0x6b'));return _0x54160f(new Error(_0xf0e4('0x6b')));}if(_0x3d19b1['isDirectory']()){var _0x31a5fc=fs['readdirSync'](path[_0xf0e4('0x59')](_0x434eb3,_0x96ddd7[0x0]));if(_0x31a5fc['length']===0x0){removeReferences(_0x4c1871,_0x434eb3);logger[_0xf0e4('0x29')](_0xf0e4('0x6b'));return _0x54160f(new Error(_0xf0e4('0x6b')));}var _0x433120=_0x31a5fc['some'](function(_0x27f233){return _0x27f233===_0xf0e4('0x6d');});if(!_0x433120){return _0x54160f(new Error('Plugin\x20manifest\x20missing'));}var _0x3d752c=fs[_0xf0e4('0x6e')](path['join'](_0x434eb3,_0x96ddd7[0x0],_0xf0e4('0x6d')));var _0x1517fd=JSON[_0xf0e4('0x6f')](_0x3d752c);if(_0xf0e4('0x22')==typeof _0x1517fd[_0xf0e4('0x33')]){return _0x54160f(new Error(_0xf0e4('0x70')));}if(_0xf0e4('0x22')==typeof _0x1517fd[_0xf0e4('0x2f')]){return _0x54160f(new Error(_0xf0e4('0x71')));}if(_0xf0e4('0x22')==typeof _0x1517fd['version']){return _0x54160f(new Error(_0xf0e4('0x72')));}if('undefined'==typeof _0x1517fd[_0xf0e4('0x73')]){return _0x54160f(new Error(_0xf0e4('0x74')));}if(_0x1517fd[_0xf0e4('0x2f')]==='html'){if(_0xf0e4('0x22')==typeof _0x1517fd[_0xf0e4('0x73')][_0xf0e4('0x75')]){return _0x54160f(new Error(_0xf0e4('0x76')));}if(_0xf0e4('0x22')==typeof _0x1517fd[_0xf0e4('0x73')][_0xf0e4('0x75')]['admin']&&'undefined'==typeof _0x1517fd['parameters'][_0xf0e4('0x75')][_0xf0e4('0x77')]){return _0x54160f(new Error(_0xf0e4('0x78')));}}else if(_0x1517fd[_0xf0e4('0x2f')]==='script'){if(_0xf0e4('0x22')==typeof _0x1517fd[_0xf0e4('0x73')]['scriptName']){return _0x54160f(new Error(_0xf0e4('0x79')));}if(_0xf0e4('0x22')==typeof _0x1517fd[_0xf0e4('0x73')][_0xf0e4('0x7a')]){return _0x54160f(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x54160f(new Error(_0xf0e4('0x7b')));}var _0x4c7ca7=_0x1517fd[_0xf0e4('0x33')];var _0x3c6122=_0x1517fd[_0xf0e4('0x7c')];var _0x8bfaef=_0x1517fd[_0xf0e4('0x2f')];var _0x323965=_0x1517fd[_0xf0e4('0x7d')]?_0x1517fd[_0xf0e4('0x7d')]:'always';var _0x3b3e3c=_0x1517fd['icon']?_0x1517fd[_0xf0e4('0x7e')]:_0xf0e4('0x7f');var _0x42f035='';var _0x33b7e4='';var _0xad9bbd='';var _0x4f09cb='';var _0xacb638=_0x1517fd[_0xf0e4('0x80')];if(_0x8bfaef===_0xf0e4('0x81')){if(_0xf0e4('0x22')!=typeof _0x1517fd[_0xf0e4('0x73')]['views']['admin']){var _0x282175=_0x1517fd[_0xf0e4('0x73')][_0xf0e4('0x75')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x282175)){_0x42f035=path[_0xf0e4('0x59')](_0xf0e4('0x82'),_0x41b364,_0x96ddd7[0x0],_0x282175);}else{_0x42f035=_0x282175;}}else{logger[_0xf0e4('0x60')](_0xf0e4('0x83'));}if(_0xf0e4('0x22')!=typeof _0x1517fd[_0xf0e4('0x73')]['views'][_0xf0e4('0x77')]){var _0x414af3=_0x1517fd[_0xf0e4('0x73')][_0xf0e4('0x75')][_0xf0e4('0x77')];if(!/^(f|ht)tps?:\/\//i['test'](_0x414af3)){_0x33b7e4=path[_0xf0e4('0x59')](_0xf0e4('0x82'),_0x41b364,_0x96ddd7[0x0],_0x414af3);}else{_0x33b7e4=_0x414af3;}}else{logger[_0xf0e4('0x60')](_0xf0e4('0x84'));}}else if(_0x8bfaef==='script'){_0xad9bbd=_0x1517fd[_0xf0e4('0x73')][_0xf0e4('0x85')];_0x4f09cb=_0x1517fd[_0xf0e4('0x73')][_0xf0e4('0x7a')];if('undefined'!=typeof _0x1517fd['parameters']['views']){if(_0xf0e4('0x22')!=typeof _0x1517fd['parameters'][_0xf0e4('0x75')]['admin']){var _0x282175=_0x1517fd['parameters'][_0xf0e4('0x75')][_0xf0e4('0x86')];if(!/^(f|ht)tps?:\/\//i[_0xf0e4('0x87')](_0x282175)){_0x42f035=path['join'](_0xf0e4('0x82'),_0x41b364,_0x96ddd7[0x0],_0x282175);}else{_0x42f035=_0x282175;}}if(_0xf0e4('0x22')!=typeof _0x1517fd[_0xf0e4('0x73')][_0xf0e4('0x75')][_0xf0e4('0x77')]){var _0x414af3=_0x1517fd[_0xf0e4('0x73')][_0xf0e4('0x75')][_0xf0e4('0x77')];if(!/^(f|ht)tps?:\/\//i['test'](_0x414af3)){_0x33b7e4=path[_0xf0e4('0x59')](_0xf0e4('0x82'),_0x41b364,_0x96ddd7[0x0],_0x414af3);}else{_0x33b7e4=_0x414af3;}}}}var _0x402456={'name':_0x4c7ca7,'description':_0x3c6122,'path':path[_0xf0e4('0x59')](_0x41b364,_0x96ddd7[0x0]),'type':_0x8bfaef,'sidebar':_0x323965,'icon':_0x3b3e3c,'adminUrl':_0x42f035,'agentUrl':_0x33b7e4,'scriptName':_0xad9bbd,'scriptPath':_0x4f09cb,'version':_0xacb638};removeReferences(_0x4c1871,null);return db[_0xf0e4('0x2c')]['create'](_0x402456)[_0xf0e4('0x27')](function(_0x4968f8){var _0x23fe4f={'role':_0xd7cd1b[_0xf0e4('0x88')]['role'],'userProfileId':_0xd7cd1b[_0xf0e4('0x88')][_0xf0e4('0x89')]};if(!_0x23fe4f)throw new Error(_0xf0e4('0x8a'));if(_0x23fe4f[_0xf0e4('0x8b')]===_0xf0e4('0x8c')){var _0x132919=_0x4968f8[_0xf0e4('0x28')]({'plain':!![]});return db['UserProfileSection'][_0xf0e4('0x4a')]({'where':{'name':_0xf0e4('0x8d'),'userProfileId':_0x23fe4f[_0xf0e4('0x89')]},'raw':!![]})['then'](function(_0x3450bc){if(_0x3450bc&&_0x3450bc[_0xf0e4('0x8e')]===0x0){return db['UserProfileResource'][_0xf0e4('0x8f')]({'name':_0x132919[_0xf0e4('0x33')],'resourceId':_0x132919['id'],'type':_0x3450bc['name'],'sectionId':_0x3450bc['id']},{})['then'](function(){return _0x4968f8;});}else{return _0x4968f8;}})['catch'](function(_0x2441f3){logger[_0xf0e4('0x29')](_0xf0e4('0x90'),_0x2441f3);throw _0x2441f3;});}return _0x4968f8;})[_0xf0e4('0x27')](respondWithResult(_0x2ac995,null))[_0xf0e4('0x4b')](handleError(_0x2ac995,null));}});}catch(_0x221e1e){_0x2ac995[_0xf0e4('0x1f')](0x1f4)['send'](_0x221e1e);}};function removeReferences(_0x461a7a,_0x248a84){try{if(_0x461a7a){fs[_0xf0e4('0x91')](_0x461a7a);logger[_0xf0e4('0x60')](_0xf0e4('0x92'));}if(_0x248a84){rimraf(_0x248a84,function(){});logger[_0xf0e4('0x60')]('Extracted\x20folder\x20removed');}}catch(_0xbe6330){logger[_0xf0e4('0x29')](_0xbe6330);}}exports[_0xf0e4('0x93')]=function(_0x567649,_0x55fcdd,_0x493e39){return db[_0xf0e4('0x2c')]['find']({'where':{'id':_0x567649[_0xf0e4('0x49')]['id']}})[_0xf0e4('0x27')](handleEntityNotFound(_0x55fcdd,null))['then'](saveUpdates(_0x567649['body'],null))[_0xf0e4('0x27')](respondWithResult(_0x55fcdd,null))[_0xf0e4('0x4b')](handleError(_0x55fcdd,null));};exports[_0xf0e4('0x94')]=function(_0x9d727f,_0xfcddad,_0x5e6b05){return db[_0xf0e4('0x2c')][_0xf0e4('0x4a')]({'where':{'id':_0x9d727f[_0xf0e4('0x49')]['id']}})[_0xf0e4('0x27')](function(_0x5cc8a3){if(_0x5cc8a3){return _0x5cc8a3[_0xf0e4('0x26')]();}})[_0xf0e4('0x27')](function(_0x3d05eb){rimraf(path[_0xf0e4('0x59')](config[_0xf0e4('0x57')],'server/files/plugins',path[_0xf0e4('0x58')](_0x3d05eb['path'])),function(){});return _0x3d05eb;})['then'](handleEntityNotFound(_0xfcddad,null))[_0xf0e4('0x27')](respondWithStatusCode(_0xfcddad,null))['catch'](handleError(_0xfcddad,null));};exports[_0xf0e4('0x95')]=function(_0x126c19,_0x22417e,_0x1a01f5){return BPromise['resolve']()['then'](function(){if(!_0x126c19[_0xf0e4('0x34')][_0xf0e4('0x4d')]){throw new Error(_0xf0e4('0x96'));}if(!_0x126c19[_0xf0e4('0x34')]['port']){throw new Error(_0xf0e4('0x97'));}var _0x101288=_0x126c19['query'][_0xf0e4('0x98')]?_0x126c19[_0xf0e4('0x34')]['hostname']+':'+_0x126c19[_0xf0e4('0x34')]['port']:'http://localhost:'+_0x126c19['query'][_0xf0e4('0x99')];var _0x463d48=_0x126c19['query'][_0xf0e4('0x20')]?_0x126c19[_0xf0e4('0x34')][_0xf0e4('0x20')]:!![];var _0x5d7483=_0x126c19['query'][_0xf0e4('0x9a')]?_0x126c19['query'][_0xf0e4('0x9a')]:null;var _0x4d15e8={'method':_0x126c19[_0xf0e4('0x9b')],'uri':util[_0xf0e4('0x9c')](_0xf0e4('0x9d'),_0x101288,_0x126c19[_0xf0e4('0x34')][_0xf0e4('0x4d')]),'json':_0x463d48,'resolveWithFullResponse':!![],'encoding':_0x5d7483,'qs':_0x126c19['query']};if(_0x126c19[_0xf0e4('0x9e')]){_0x4d15e8[_0xf0e4('0x9e')]=_0x126c19[_0xf0e4('0x9e')];if(_0x4d15e8[_0xf0e4('0x9e')][_0xf0e4('0x9f')]){delete _0x4d15e8[_0xf0e4('0x9e')][_0xf0e4('0x9f')];}}if(_0x4d15e8[_0xf0e4('0x9e')][_0xf0e4('0xa0')]){delete _0x4d15e8[_0xf0e4('0x9e')][_0xf0e4('0xa0')];}return rp(_0x4d15e8);})['then'](function(_0x5ea22b){if(_0x5ea22b){_0x22417e[_0xf0e4('0x24')](_0x5ea22b[_0xf0e4('0x9e')]);logger[_0xf0e4('0x60')](_0x5ea22b[_0xf0e4('0x88')]);if(_[_0xf0e4('0xa1')](_0x126c19[_0xf0e4('0x34')][_0xf0e4('0x4d')],_0xf0e4('0x4c'))&&_0x5ea22b[_0xf0e4('0xa2')]==0x1f4){return _0x22417e[_0xf0e4('0x1e')](_0x5ea22b[_0xf0e4('0xa2')]);}else{return _0x22417e[_0xf0e4('0x1f')](_0x5ea22b[_0xf0e4('0xa2')])[_0xf0e4('0x2b')](_0x5ea22b[_0xf0e4('0x88')]);}}else{return _0x22417e[_0xf0e4('0x1e')](0xc8);}})['catch'](handleError(_0x22417e,null));};exports['webhookPost']=function(_0x41d516,_0x203481,_0x4c7a9f){return BPromise[_0xf0e4('0xa3')]()[_0xf0e4('0x27')](function(){if(!_0x41d516['query']['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x41d516[_0xf0e4('0x34')][_0xf0e4('0x99')]){throw new Error(_0xf0e4('0x97'));}var _0x4dfd97=_0x41d516['query']['hostname']?_0x41d516[_0xf0e4('0x34')]['hostname']+':'+_0x41d516['query'][_0xf0e4('0x99')]:'http://localhost:'+_0x41d516[_0xf0e4('0x34')]['port'];var _0x19553c=_0x41d516[_0xf0e4('0x34')]['json']?_0x41d516[_0xf0e4('0x34')][_0xf0e4('0x20')]:!![];var _0x5200ba=_0x41d516[_0xf0e4('0x34')][_0xf0e4('0x9a')]?_0x41d516[_0xf0e4('0x34')][_0xf0e4('0x9a')]:null;var _0x40e348={'method':_0x41d516[_0xf0e4('0x9b')],'uri':util[_0xf0e4('0x9c')](_0xf0e4('0x9d'),_0x4dfd97,_0x41d516['query'][_0xf0e4('0x4d')]),'json':_0x19553c,'resolveWithFullResponse':!![],'encoding':_0x5200ba,'body':_0x41d516[_0xf0e4('0x88')]};if(_0x41d516[_0xf0e4('0x9e')]){_0x40e348['headers']=_0x41d516['headers'];if(_0x40e348[_0xf0e4('0x9e')][_0xf0e4('0x9f')]){delete _0x40e348[_0xf0e4('0x9e')][_0xf0e4('0x9f')];}}if(_0x40e348[_0xf0e4('0x9e')][_0xf0e4('0xa0')]){delete _0x40e348[_0xf0e4('0x9e')][_0xf0e4('0xa0')];}return rp(_0x40e348);})[_0xf0e4('0x27')](function(_0x50489e){if(_0x50489e){_0x203481['set'](_0x50489e[_0xf0e4('0x9e')]);logger[_0xf0e4('0x60')](_0x50489e['body']);return _0x203481['status'](_0x50489e['statusCode'])[_0xf0e4('0x2b')](_0x50489e[_0xf0e4('0x88')]);}else{return _0x203481['sendStatus'](0xc8);}})[_0xf0e4('0x4b')](handleError(_0x203481,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index e5824a4..391db6d 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 _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 +var _0x3831=['update','remove','hook','events','Plugin','setMaxListeners','save'];(function(_0x33c70e,_0xd8cb0b){var _0x5a33e5=function(_0x3b7f9d){while(--_0x3b7f9d){_0x33c70e['push'](_0x33c70e['shift']());}};_0x5a33e5(++_0xd8cb0b);}(_0x3831,0x14c));var _0x1383=function(_0x2bcddb,_0x3eaf37){_0x2bcddb=_0x2bcddb-0x0;var _0x12a9e8=_0x3831[_0x2bcddb];return _0x12a9e8;};'use strict';var EventEmitter=require(_0x1383('0x0'));var Plugin=require('../../mysqldb')['db'][_0x1383('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x1383('0x2')](0x0);var events={'afterCreate':_0x1383('0x3'),'afterUpdate':_0x1383('0x4'),'afterDestroy':_0x1383('0x5')};function emitEvent(_0x580d3d){return function(_0x2fdf72,_0x573874,_0x21ea2c){PluginEvents['emit'](_0x580d3d+':'+_0x2fdf72['id'],_0x2fdf72);PluginEvents['emit'](_0x580d3d,_0x2fdf72);_0x21ea2c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x1383('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 b010e75..adb2047 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 _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 +var _0x5f7b=['../../config/environment','exports','define','Plugin','plugins','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3a2118,_0x31fc3c){var _0x1d181d=function(_0x26a734){while(--_0x26a734){_0x3a2118['push'](_0x3a2118['shift']());}};_0x1d181d(++_0x31fc3c);}(_0x5f7b,0x19c));var _0xb5f7=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x5f7b[_0x263a74];return _0x2aa86c;};'use strict';var _=require('lodash');var util=require(_0xb5f7('0x0'));var logger=require(_0xb5f7('0x1'))(_0xb5f7('0x2'));var moment=require(_0xb5f7('0x3'));var BPromise=require(_0xb5f7('0x4'));var rp=require(_0xb5f7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb5f7('0x6'));var attributes=require('./plugin.attributes');module[_0xb5f7('0x7')]=function(_0x4166ca,_0x532b67){return _0x4166ca[_0xb5f7('0x8')](_0xb5f7('0x9'),attributes,{'tableName':_0xb5f7('0xa'),'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 35ad6e9..318f9d7 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 _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 +var _0x1637=['Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Plugin','body','options','raw','CreatePlugin','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','localhost','socket.io-emitter','./plugin.socket','request','then','info','Plugin,\x20%s,\x20%s','debug'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x1637,0x14c));var _0x7163=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x1637[_0x3e44fa];return _0x2a0aba;};'use strict';var _=require(_0x7163('0x0'));var util=require(_0x7163('0x1'));var moment=require('moment');var BPromise=require(_0x7163('0x2'));var rs=require(_0x7163('0x3'));var fs=require('fs');var Redis=require(_0x7163('0x4'));var db=require(_0x7163('0x5'))['db'];var utils=require(_0x7163('0x6'));var logger=require(_0x7163('0x7'))('rpc');var config=require(_0x7163('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7163('0x9')][_0x7163('0xa')]({'port':0x232a});config['redis']=_[_0x7163('0xb')](config['redis'],{'host':_0x7163('0xc'),'port':0x18eb});var socket=require(_0x7163('0xd'))(new Redis(config['redis']));require(_0x7163('0xe'))['register'](socket);function respondWithRpcPromise(_0x2663ae,_0x138837,_0x34f914){return new BPromise(function(_0x4dadba,_0xd15c80){return client[_0x7163('0xf')](_0x2663ae,_0x34f914)[_0x7163('0x10')](function(_0x5bd85a){logger[_0x7163('0x11')](_0x7163('0x12'),_0x138837,'request\x20sent');logger[_0x7163('0x13')](_0x7163('0x14'),_0x138837,'request\x20sent',JSON[_0x7163('0x15')](_0x5bd85a));if(_0x5bd85a[_0x7163('0x16')]){if(_0x5bd85a['error'][_0x7163('0x17')]===0x1f4){logger[_0x7163('0x16')]('Plugin,\x20%s,\x20%s',_0x138837,_0x5bd85a['error'][_0x7163('0x18')]);return _0xd15c80(_0x5bd85a[_0x7163('0x16')][_0x7163('0x18')]);}logger[_0x7163('0x16')](_0x7163('0x12'),_0x138837,_0x5bd85a[_0x7163('0x16')][_0x7163('0x18')]);return _0x4dadba(_0x5bd85a[_0x7163('0x16')][_0x7163('0x18')]);}else{logger[_0x7163('0x11')](_0x7163('0x12'),_0x138837,'request\x20sent');_0x4dadba(_0x5bd85a[_0x7163('0x19')]['message']);}})[_0x7163('0x1a')](function(_0x3cdffa){logger[_0x7163('0x16')](_0x7163('0x12'),_0x138837,_0x3cdffa);_0xd15c80(_0x3cdffa);});});}exports['CreatePlugin']=function(_0x49eeee){var _0x5143b2=this;return new Promise(function(_0x211476,_0x5dc832){return db[_0x7163('0x1b')]['create'](_0x49eeee[_0x7163('0x1c')],{'raw':_0x49eeee[_0x7163('0x1d')]?_0x49eeee['options'][_0x7163('0x1e')]===undefined?!![]:![]:!![]})[_0x7163('0x10')](function(_0x40c6f4){logger[_0x7163('0x11')](_0x7163('0x1f'),_0x49eeee);logger[_0x7163('0x13')](_0x7163('0x1f'),_0x49eeee,JSON['stringify'](_0x40c6f4));_0x211476(_0x40c6f4);})[_0x7163('0x1a')](function(_0x1901b7){logger[_0x7163('0x16')](_0x7163('0x1f'),_0x1901b7[_0x7163('0x18')],_0x49eeee);_0x5dc832(_0x5143b2[_0x7163('0x16')](0x1f4,_0x1901b7[_0x7163('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 3296b6d..23efa44 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 _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 +var _0x5679=['register','length','plugin:','./plugin.events','remove','update','emit','removeListener'];(function(_0x37a9fc,_0x2cecb2){var _0x4b2049=function(_0x14340d){while(--_0x14340d){_0x37a9fc['push'](_0x37a9fc['shift']());}};_0x4b2049(++_0x2cecb2);}(_0x5679,0xeb));var _0x9567=function(_0x27ed42,_0x2e5246){_0x27ed42=_0x27ed42-0x0;var _0x105321=_0x5679[_0x27ed42];return _0x105321;};'use strict';var PluginEvents=require(_0x9567('0x0'));var events=['save',_0x9567('0x1'),_0x9567('0x2')];function createListener(_0x528bc5,_0x50085f){return function(_0x7c71cb){_0x50085f[_0x9567('0x3')](_0x528bc5,_0x7c71cb);};}function removeListener(_0x143ddf,_0xb0d5ab){return function(){PluginEvents[_0x9567('0x4')](_0x143ddf,_0xb0d5ab);};}exports[_0x9567('0x5')]=function(_0x17f460){for(var _0x3fc9f6=0x0,_0x5d4c1d=events[_0x9567('0x6')];_0x3fc9f6<_0x5d4c1d;_0x3fc9f6++){var _0xe9d49b=events[_0x3fc9f6];var _0x48221f=createListener(_0x9567('0x7')+_0xe9d49b,_0x17f460);PluginEvents['on'](_0xe9d49b,_0x48221f);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 17aad0d..4ca4310 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(_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 +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x3130e,_0x443313){var _0x2dd444=function(_0x58e7b9){while(--_0x58e7b9){_0x3130e['push'](_0x3130e['shift']());}};_0x2dd444(++_0x443313);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 4babdf4..567f25b 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 _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 +var _0xaa88=['../../config/pm2','../../config/logger','api','child_process','exec','bluebird','status','json','error','stack','name','send','info','list','express','motion2','length','then','catch','show','describe','create','body','script','join','../../files/plugins','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','params','Unknown\x20status','destroy','delete','Unknown\x20id','lodash'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xaa88,0x137));var _0x8aa8=function(_0xea343d,_0x311197){_0xea343d=_0xea343d-0x0;var _0x2c6e9c=_0xaa88[_0xea343d];return _0x2c6e9c;};'use strict';var _=require(_0x8aa8('0x0'));var pm2=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var path=require('path');var exec=require(_0x8aa8('0x4'))[_0x8aa8('0x5')];var BPromise=require(_0x8aa8('0x6'));function handleEntityNotFound(_0x3b2c88,_0x3e3b70){return function(_0x350e8b){if(!_0x350e8b){_0x3b2c88['sendStatus'](0x194);;}return _0x350e8b;};}function respondWithResult(_0x5bda0d,_0x460042){_0x460042=_0x460042||0xc8;return function(_0x5264ff){if(_0x5264ff){return _0x5bda0d[_0x8aa8('0x7')](_0x460042)[_0x8aa8('0x8')](_0x5264ff);}return null;};}function handleError(_0x27c08d,_0x40826f){_0x40826f=_0x40826f||0x1f4;return function(_0x4adfb9){logger[_0x8aa8('0x9')](_0x4adfb9[_0x8aa8('0xa')]);if(_0x4adfb9[_0x8aa8('0xb')]){delete _0x4adfb9['name'];}_0x27c08d[_0x8aa8('0x7')](_0x40826f)[_0x8aa8('0xc')](_0x4adfb9);};}function execChildProcess(){return new BPromise(function(_0x357e05,_0x33cc5c){exec('npm\x20install',function(_0x3f8100,_0x30c114,_0x50787d){logger[_0x8aa8('0xd')](_0x30c114);logger[_0x8aa8('0xd')](_0x50787d);if(_0x3f8100){logger[_0x8aa8('0x9')](_0x3f8100);return _0x33cc5c(_0x3f8100);}return _0x357e05(_0x30c114);});});}exports['index']=function(_0x3b9f74,_0x179e33){return pm2[_0x8aa8('0xe')]()['then'](function(_0x391642){if(_0x391642){var _0x4af534=_['reject'](_0x391642,function(_0x433e95){return _0x433e95[_0x8aa8('0xb')]===_0x8aa8('0xf')||_0x433e95[_0x8aa8('0xb')]===_0x8aa8('0x10');});return{'rows':_0x4af534,'count':_0x4af534[_0x8aa8('0x11')]};}return null;})[_0x8aa8('0x12')](respondWithResult(_0x179e33,null))[_0x8aa8('0x13')](handleError(_0x179e33,null));};exports[_0x8aa8('0x14')]=function(_0x4e8ce3,_0x4843f5){return pm2[_0x8aa8('0x15')](_0x4e8ce3['params']['id'])['then'](respondWithResult(_0x4843f5,null))[_0x8aa8('0x12')](handleEntityNotFound(_0x4843f5,null))['catch'](handleError(_0x4843f5,null));};exports[_0x8aa8('0x16')]=function(_0x41092b,_0x2a9f56){if(_0x41092b[_0x8aa8('0x17')]['name']&&_0x41092b[_0x8aa8('0x17')][_0x8aa8('0x18')]){var _0x2825fd=path[_0x8aa8('0x19')](__dirname,_0x8aa8('0x1a'),_0x41092b[_0x8aa8('0x17')]['script']);var _0x26cf63=process['cwd']();process[_0x8aa8('0x1b')](path['dirname'](_0x2825fd));return execChildProcess()[_0x8aa8('0x12')](function(_0x557e4e){process[_0x8aa8('0x1b')](_0x26cf63);return pm2[_0x8aa8('0x1c')]({'name':_0x41092b[_0x8aa8('0x17')]['name'],'script':_0x2825fd});})[_0x8aa8('0x12')](function(_0xe978ab){pm2[_0x8aa8('0x1d')]();return _0xe978ab[0x0];})['then'](respondWithResult(_0x2a9f56,0xc9))['catch'](handleError(_0x2a9f56,null));}else{return _0x2a9f56[_0x8aa8('0x7')](0x1f4)[_0x8aa8('0xc')]({'message':_0x8aa8('0x1e')});}};exports[_0x8aa8('0x1f')]=function(_0x24143e,_0x4a8212){if(_0x24143e[_0x8aa8('0x17')]['id']){delete _0x24143e['body']['id'];}var _0x2a0ff2={'online':_0x8aa8('0x20'),'stopped':_0x8aa8('0x21')};if(_0x2a0ff2['hasOwnProperty'](_0x24143e['body'][_0x8aa8('0x7')])){return pm2[_0x2a0ff2[_0x24143e['body'][_0x8aa8('0x7')]]](_0x24143e[_0x8aa8('0x22')]['id'])[_0x8aa8('0x12')](respondWithResult(_0x4a8212,0xc8))[_0x8aa8('0x13')](handleError(_0x4a8212,null));}else{return _0x4a8212[_0x8aa8('0x7')](0x1f4)['send']({'message':_0x8aa8('0x23')});}};exports[_0x8aa8('0x24')]=function(_0x4b67f5,_0x99f74e){if(_0x4b67f5[_0x8aa8('0x17')]['id']){delete _0x4b67f5[_0x8aa8('0x17')]['id'];}if(_0x4b67f5['params']['id']){return pm2[_0x8aa8('0x25')](_0x4b67f5[_0x8aa8('0x22')]['id'])[_0x8aa8('0x12')](function(_0x423b02){pm2[_0x8aa8('0x1d')]();return _0x423b02[0x0];})[_0x8aa8('0x12')](respondWithResult(_0x99f74e,null))[_0x8aa8('0x13')](handleError(_0x99f74e,null));}else{return _0x99f74e[_0x8aa8('0x7')](0x1f4)[_0x8aa8('0xc')]({'message':_0x8aa8('0x26')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 17a4bb6..01bae5c 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 _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 +var _0x5943=['express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents','/queues','getQueues'];(function(_0x1e71b7,_0x74a443){var _0x42c3a0=function(_0x30050f){while(--_0x30050f){_0x1e71b7['push'](_0x1e71b7['shift']());}};_0x42c3a0(++_0x74a443);}(_0x5943,0x1a4));var _0x3594=function(_0x482560,_0x3e5ef2){_0x482560=_0x482560-0x0;var _0x2cceec=_0x5943[_0x482560];return _0x2cceec;};'use strict';var express=require(_0x3594('0x0'));var router=express[_0x3594('0x1')]();var auth=require(_0x3594('0x2'));var controller=require(_0x3594('0x3'));router[_0x3594('0x4')](_0x3594('0x5'),auth[_0x3594('0x6')](),controller[_0x3594('0x7')]);router[_0x3594('0x4')](_0x3594('0x8'),auth[_0x3594('0x6')](),controller[_0x3594('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 5de1159..699c50e 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(_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 +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(_0x4f23fe,_0x7e5e84){var _0x549f0b=function(_0x192ff0){while(--_0x192ff0){_0x4f23fe['push'](_0x4f23fe['shift']());}};_0x549f0b(++_0x7e5e84);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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 8df2173..86428fe 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_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 +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x172fe1,_0x202c8d){var _0x20ec49=function(_0x514e7c){while(--_0x514e7c){_0x172fe1['push'](_0x172fe1['shift']());}};_0x20ec49(++_0x202c8d);}(_0x70e0,0x17b));var _0x070e=function(_0x8f2c35,_0xe1cdc0){_0x8f2c35=_0x8f2c35-0x0;var _0x3bbf24=_0x70e0[_0x8f2c35];return _0x3bbf24;};'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 2441da6..dadbeab 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 _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 +var _0xbd51=['sequelize','INTEGER','STRING','DATE'];(function(_0x23fdcd,_0x4760a4){var _0x413768=function(_0x2e1f37){while(--_0x2e1f37){_0x23fdcd['push'](_0x23fdcd['shift']());}};_0x413768(++_0x4760a4);}(_0xbd51,0x1a8));var _0x1bd5=function(_0xb0cd52,_0x2dbe27){_0xb0cd52=_0xb0cd52-0x0;var _0x535f8e=_0xbd51[_0xb0cd52];return _0x535f8e;};'use strict';var Sequelize=require(_0x1bd5('0x0'));module['exports']={'state':{'type':Sequelize[_0x1bd5('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x1bd5('0x2')]},'scheduledat':{'type':Sequelize[_0x1bd5('0x3')]},'uniqueid':{'type':Sequelize[_0x1bd5('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x1bd5('0x2')]},'membername':{'type':Sequelize[_0x1bd5('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 823066f..3497711 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 _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 +var _0x0771=['exports','define','ReportAgentPreview','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./reportAgentPreview.attributes'];(function(_0x4a71c3,_0x2e8608){var _0x250a7d=function(_0x376ef0){while(--_0x376ef0){_0x4a71c3['push'](_0x4a71c3['shift']());}};_0x250a7d(++_0x2e8608);}(_0x0771,0x18f));var _0x1077=function(_0xdae8e6,_0x34854a){_0xdae8e6=_0xdae8e6-0x0;var _0x24c7a7=_0x0771[_0xdae8e6];return _0x24c7a7;};'use strict';var _=require('lodash');var util=require(_0x1077('0x0'));var logger=require(_0x1077('0x1'))(_0x1077('0x2'));var moment=require(_0x1077('0x3'));var BPromise=require(_0x1077('0x4'));var rp=require(_0x1077('0x5'));var fs=require('fs');var path=require(_0x1077('0x6'));var rimraf=require('rimraf');var config=require(_0x1077('0x7'));var attributes=require(_0x1077('0x8'));module[_0x1077('0x9')]=function(_0x32d80c,_0x5772db){return _0x32d80c[_0x1077('0xa')](_0x1077('0xb'),attributes,{'tableName':'report_agent_preview','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 f8b0253..2fe71de 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 _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 +var _0x8a9c=['raw','CreateReportAgentPreview','stringify','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','error','message','info','ReportAgentPreview,\x20%s,\x20%s','ReportAgentPreview','create','body','options'];(function(_0x2c1fe6,_0x3cc587){var _0x1cc691=function(_0x365965){while(--_0x365965){_0x2c1fe6['push'](_0x2c1fe6['shift']());}};_0x1cc691(++_0x3cc587);}(_0x8a9c,0x12d));var _0xc8a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a9c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc8a9('0x0'));var util=require(_0xc8a9('0x1'));var moment=require(_0xc8a9('0x2'));var BPromise=require(_0xc8a9('0x3'));var rs=require(_0xc8a9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc8a9('0x5'))['db'];var utils=require(_0xc8a9('0x6'));var logger=require('../../config/logger')(_0xc8a9('0x7'));var config=require(_0xc8a9('0x8'));var jayson=require(_0xc8a9('0x9'));var client=jayson['client'][_0xc8a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3dc31c,_0x1d49c8,_0x4520a2){return new BPromise(function(_0x2928f3,_0x241eae){return client[_0xc8a9('0xb')](_0x3dc31c,_0x4520a2)[_0xc8a9('0xc')](function(_0xb079ad){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x1d49c8,_0xc8a9('0xd'));logger[_0xc8a9('0xe')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x1d49c8,_0xc8a9('0xd'),JSON['stringify'](_0xb079ad));if(_0xb079ad[_0xc8a9('0xf')]){if(_0xb079ad[_0xc8a9('0xf')]['code']===0x1f4){logger[_0xc8a9('0xf')]('ReportAgentPreview,\x20%s,\x20%s',_0x1d49c8,_0xb079ad[_0xc8a9('0xf')][_0xc8a9('0x10')]);return _0x241eae(_0xb079ad[_0xc8a9('0xf')][_0xc8a9('0x10')]);}logger[_0xc8a9('0xf')]('ReportAgentPreview,\x20%s,\x20%s',_0x1d49c8,_0xb079ad['error'][_0xc8a9('0x10')]);return _0x2928f3(_0xb079ad['error'][_0xc8a9('0x10')]);}else{logger[_0xc8a9('0x11')](_0xc8a9('0x12'),_0x1d49c8,_0xc8a9('0xd'));_0x2928f3(_0xb079ad['result']['message']);}})['catch'](function(_0x4d03fe){logger[_0xc8a9('0xf')](_0xc8a9('0x12'),_0x1d49c8,_0x4d03fe);_0x241eae(_0x4d03fe);});});}exports['CreateReportAgentPreview']=function(_0x43f403){var _0x2d894e=this;return new Promise(function(_0x35bd4a,_0x20b70d){return db[_0xc8a9('0x13')][_0xc8a9('0x14')](_0x43f403[_0xc8a9('0x15')],{'raw':_0x43f403[_0xc8a9('0x16')]?_0x43f403['options'][_0xc8a9('0x17')]===undefined?!![]:![]:!![]})[_0xc8a9('0xc')](function(_0x44886a){logger[_0xc8a9('0x11')](_0xc8a9('0x18'),_0x43f403);logger[_0xc8a9('0xe')](_0xc8a9('0x18'),_0x43f403,JSON[_0xc8a9('0x19')](_0x44886a));_0x35bd4a(_0x44886a);})[_0xc8a9('0x1a')](function(_0x4d1e06){logger[_0xc8a9('0xf')](_0xc8a9('0x18'),_0x4d1e06[_0xc8a9('0x10')],_0x43f403);_0x20b70d(_0x2d894e['error'](0x1f4,_0x4d1e06[_0xc8a9('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index c27ab85..52fcb40 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 _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 +var _0x7b6b=['multer','path','express','../../components/auth/service','./rpc.controller','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','put','/outbound','outbound','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports'];(function(_0x2cdb45,_0x44c4c0){var _0x5910e4=function(_0x1f5d96){while(--_0x1f5d96){_0x2cdb45['push'](_0x2cdb45['shift']());}};_0x5910e4(++_0x44c4c0);}(_0x7b6b,0x105));var _0xb7b6=function(_0x55de06,_0x2cb79a){_0x55de06=_0x55de06-0x0;var _0x2dfb4a=_0x7b6b[_0x55de06];return _0x2dfb4a;};'use strict';var multer=require(_0xb7b6('0x0'));var util=require('util');var path=require(_0xb7b6('0x1'));var express=require(_0xb7b6('0x2'));var router=express['Router']();var auth=require(_0xb7b6('0x3'));var controller=require(_0xb7b6('0x4'));router[_0xb7b6('0x5')](_0xb7b6('0x6'),auth['isAuthenticated'](),controller[_0xb7b6('0x7')]);router[_0xb7b6('0x5')](_0xb7b6('0x8'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0xa')]);router['get'](_0xb7b6('0xb'),auth['isAuthenticated'](),controller[_0xb7b6('0xc')]);router[_0xb7b6('0x5')]('/voice/queues',auth[_0xb7b6('0x9')](),controller[_0xb7b6('0xd')]);router[_0xb7b6('0x5')]('/chat/queues',auth[_0xb7b6('0x9')](),controller[_0xb7b6('0xe')]);router[_0xb7b6('0x5')](_0xb7b6('0xf'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x10')]);router['get'](_0xb7b6('0x11'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x12')]);router[_0xb7b6('0x5')](_0xb7b6('0x13'),auth['isAuthenticated'](),controller[_0xb7b6('0x14')]);router[_0xb7b6('0x5')](_0xb7b6('0x15'),auth[_0xb7b6('0x9')](),controller['smsQueues']);router[_0xb7b6('0x5')](_0xb7b6('0x16'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x17')]);router['get']('/fax/queues',auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x18')]);router[_0xb7b6('0x5')](_0xb7b6('0x19'),auth['isAuthenticated'](),controller[_0xb7b6('0x1a')]);router[_0xb7b6('0x5')]('/voice/queues/channels',auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x1b')]);router[_0xb7b6('0x5')](_0xb7b6('0x1c'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x1d')]);router[_0xb7b6('0x5')](_0xb7b6('0x1e'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x1f')]);router['get'](_0xb7b6('0x20'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x21')]);router['get'](_0xb7b6('0x22'),auth[_0xb7b6('0x9')](),controller['showVoiceQueues']);router[_0xb7b6('0x23')](_0xb7b6('0x22'),auth['isAuthenticated'](),controller['updateVoiceQueue']);router['get'](_0xb7b6('0x24'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x25')]);router[_0xb7b6('0x5')]('/outbound/channels',auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x26')]);router[_0xb7b6('0x5')](_0xb7b6('0x27'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x28')]);router[_0xb7b6('0x23')](_0xb7b6('0x29'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x2a')]);router[_0xb7b6('0x5')]('/telephones',auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x2b')]);router[_0xb7b6('0x5')](_0xb7b6('0x2c'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x2d')]);router[_0xb7b6('0x5')](_0xb7b6('0x2e'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x2f')]);router['get'](_0xb7b6('0x30'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x31')]);router['get']('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xb7b6('0x32')]);router[_0xb7b6('0x5')](_0xb7b6('0x33'),auth['isAuthenticated'](),controller[_0xb7b6('0x34')]);router[_0xb7b6('0x5')](_0xb7b6('0x35'),auth[_0xb7b6('0x9')](),controller['openchannelQueuesWaitingInteractions']);router['get'](_0xb7b6('0x36'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x37')]);router['get'](_0xb7b6('0x38'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x39')]);router[_0xb7b6('0x5')](_0xb7b6('0x3a'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x3b')]);router[_0xb7b6('0x5')](_0xb7b6('0x3c'),auth[_0xb7b6('0x9')](),controller['faxQueuesWaitingInteractions']);router[_0xb7b6('0x3d')](_0xb7b6('0x3e'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x3f')](_0xb7b6('0x40')));router[_0xb7b6('0x5')](_0xb7b6('0x41'),auth['isAuthenticated'](),controller[_0xb7b6('0x42')]);router[_0xb7b6('0x3d')](_0xb7b6('0x43'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x3f')]('chat'));router[_0xb7b6('0x5')](_0xb7b6('0x44'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x45')]);router[_0xb7b6('0x3d')](_0xb7b6('0x46'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x3f')](_0xb7b6('0x47')));router['get'](_0xb7b6('0x48'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x49')]);router[_0xb7b6('0x3d')](_0xb7b6('0x4a'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x3f')](_0xb7b6('0x4b')));router[_0xb7b6('0x5')](_0xb7b6('0x4c'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x4d')]);router[_0xb7b6('0x3d')](_0xb7b6('0x4e'),auth[_0xb7b6('0x9')](),controller['queueNotify'](_0xb7b6('0x4f')));router[_0xb7b6('0x3d')]('/whatsapp/queues/:id/notify',auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x3f')](_0xb7b6('0x50')));router[_0xb7b6('0x5')]('/sms/queues/:id',auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x51')]);router[_0xb7b6('0x5')](_0xb7b6('0x52'),auth['isAuthenticated'](),controller[_0xb7b6('0x53')]);router['post'](_0xb7b6('0x54'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x55')]);module[_0xb7b6('0x56')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index bff7ca4..6759db6 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 _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 +var _0x6940=['send','isNil','find','voiceChannels','VoiceChannels','query','catch','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','then','voiceQueues','VoiceQueues','updateVoiceQueue','body','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','interaction','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','SIP/%s','agent','internal','telephones','Telephones','trunks','Trunks','campaigns','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showWhatsappQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','rows','filter','map','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','update','queue','MessageId','From','QueueId','TransferReport','create','queueTransferTimeout','*,*,*,*','Channel\x20field\x20is\x20mandatory','channel','User','Agent\x20not\x20found','InteractionId','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','../../config/logger','jayson/promise','client','http','request','error','code','message','result','status','sendStatus','name'];(function(_0x5223f0,_0x12c73c){var _0x55dd06=function(_0x4f8b1b){while(--_0x4f8b1b){_0x5223f0['push'](_0x5223f0['shift']());}};_0x55dd06(++_0x12c73c);}(_0x6940,0xe4));var _0x0694=function(_0x1db042,_0x497a84){_0x1db042=_0x1db042-0x0;var _0xa2f486=_0x6940[_0x1db042];return _0xa2f486;};'use strict';var BPromise=require(_0x0694('0x0'));var moment=require('moment');var _=require(_0x0694('0x1'));var util=require(_0x0694('0x2'));var db=require(_0x0694('0x3'))['db'];var logger=require(_0x0694('0x4'))('api');var jayson=require(_0x0694('0x5'));var amiClient=jayson[_0x0694('0x6')]['http']({'port':0x232a});var mailClient=jayson[_0x0694('0x6')][_0x0694('0x7')]({'port':0x232b});var routingClient=jayson[_0x0694('0x6')][_0x0694('0x7')]({'port':0x232c});function respondWithRpcPromise(_0xdf0cf2,_0x104b0d,_0x2fedcd){return new BPromise(function(_0x11de59,_0x45df54){var _0x6a129e=_0x2fedcd?_0x2fedcd:amiClient;return _0x6a129e[_0x0694('0x8')](_0xdf0cf2,_0x104b0d)['then'](function(_0x3f9a77){if(_0x3f9a77[_0x0694('0x9')]){if(_0x3f9a77['error'][_0x0694('0xa')]===0x1f4){return _0x45df54(_0x3f9a77[_0x0694('0x9')][_0x0694('0xb')]);}return _0x11de59(_0x3f9a77[_0x0694('0x9')][_0x0694('0xb')]);}else{_0x11de59(_0x3f9a77[_0x0694('0xc')]);}})['catch'](function(_0x58449a){_0x45df54(_0x58449a);});});}function respondWithResult(_0x3f8441,_0x3888ae){_0x3888ae=_0x3888ae||0xc8;return function(_0x43f5e0){if(_0x43f5e0){return _0x3f8441[_0x0694('0xd')](_0x3888ae)['json'](_0x43f5e0);}return _0x3f8441[_0x0694('0xe')](0x194);};}function handleError(_0x43fc6a,_0x533c05){_0x533c05=_0x533c05||0x1f4;return function(_0x461ff1){logger[_0x0694('0x9')](_0x461ff1['stack']);if(_0x461ff1[_0x0694('0xf')]){delete _0x461ff1[_0x0694('0xf')];}_0x43fc6a[_0x0694('0xd')](_0x533c05)[_0x0694('0x10')](_0x461ff1);};}function findById(_0x336b5e){return function(_0x4ac5df){if(!_['isNil'](_0x336b5e)&&!_[_0x0694('0x11')](_0x4ac5df)&&!_[_0x0694('0x11')](_0x4ac5df['rows'])){return _[_0x0694('0x12')](_0x4ac5df['rows'],function(_0x56fec8){return _0x56fec8['id']==_0x336b5e;});}return null;};}exports[_0x0694('0x13')]=function(_0x33211b,_0x2b5111){return respondWithRpcPromise(_0x0694('0x14'),_0x33211b[_0x0694('0x15')])['then'](respondWithResult(_0x2b5111,null))[_0x0694('0x16')](handleError(_0x2b5111,null));};exports['voiceChannelMixMonitor']=function(_0x245752,_0x203c6e){return respondWithRpcPromise(_0x0694('0x17'),_[_0x0694('0x18')](_0x245752['query'],_0x245752[_0x0694('0x19')]))['then'](respondWithResult(_0x203c6e,null))['catch'](handleError(_0x203c6e,null));};exports[_0x0694('0x1a')]=function(_0x1ef495,_0x2edff2){return respondWithRpcPromise(_0x0694('0x1b'),_['merge'](_0x1ef495[_0x0694('0x15')],_0x1ef495[_0x0694('0x19')]))[_0x0694('0x1c')](respondWithResult(_0x2edff2,null))[_0x0694('0x16')](handleError(_0x2edff2,null));};exports[_0x0694('0x1d')]=function(_0x944c5,_0x3072fd){return respondWithRpcPromise(_0x0694('0x1e'),_0x944c5[_0x0694('0x15')])[_0x0694('0x1c')](respondWithResult(_0x3072fd,null))[_0x0694('0x16')](handleError(_0x3072fd,null));};exports['showVoiceQueues']=function(_0x465717,_0x1046b8){return respondWithRpcPromise('VoiceQueues',_0x465717[_0x0694('0x15')])['then'](findById(_0x465717[_0x0694('0x19')]['id']))['then'](respondWithResult(_0x1046b8,null))['catch'](handleError(_0x1046b8,null));};exports[_0x0694('0x1f')]=function(_0x5250c9,_0x5675be){return respondWithRpcPromise('UpdateVoiceQueue',_[_0x0694('0x18')](_0x5250c9[_0x0694('0x20')],_0x5250c9[_0x0694('0x19')]))[_0x0694('0x1c')](respondWithResult(_0x5675be,null))[_0x0694('0x16')](handleError(_0x5675be,null));};exports['voiceQueuesPreview']=function(_0x2596e7,_0x3c43ac){return respondWithRpcPromise(_0x0694('0x21'),_[_0x0694('0x18')](_0x2596e7['query'],_0x2596e7['params']))[_0x0694('0x1c')](respondWithResult(_0x3c43ac,null))[_0x0694('0x16')](handleError(_0x3c43ac,null));};exports[_0x0694('0x22')]=function(_0x24b33e,_0x4f3274){return respondWithRpcPromise(_0x0694('0x23'),_0x24b33e[_0x0694('0x15')])['then'](respondWithResult(_0x4f3274,null))['catch'](handleError(_0x4f3274,null));};exports['voiceQueuesChannel']=function(_0x1077b1,_0x1414ec){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0694('0x18')](_0x1077b1[_0x0694('0x15')],_0x1077b1[_0x0694('0x19')]))['then'](respondWithResult(_0x1414ec,null))['catch'](handleError(_0x1414ec,null));};exports['voiceQueuesChannelHangup']=function(_0x41238c,_0x7b6e9){return respondWithRpcPromise(_0x0694('0x24'),_[_0x0694('0x18')](_0x41238c[_0x0694('0x15')],_0x41238c['params']))[_0x0694('0x1c')](respondWithResult(_0x7b6e9,null))[_0x0694('0x16')](handleError(_0x7b6e9,null));};exports[_0x0694('0x25')]=function(_0x4327a5,_0x4b8ebb){return respondWithRpcPromise(_0x0694('0x26'),_['merge'](_0x4327a5[_0x0694('0x15')],_0x4327a5['params']))[_0x0694('0x1c')](respondWithResult(_0x4b8ebb,null))[_0x0694('0x16')](handleError(_0x4b8ebb,null));};exports['outbound']=function(_0x2f75cd,_0x54db68){return respondWithRpcPromise(_0x0694('0x27'),_0x2f75cd['query'])['then'](respondWithResult(_0x54db68,null))[_0x0694('0x16')](handleError(_0x54db68,null));};exports[_0x0694('0x28')]=function(_0x5d2552,_0x344608){return respondWithRpcPromise(_0x0694('0x29'),_0x5d2552['query'])[_0x0694('0x1c')](respondWithResult(_0x344608,null))['catch'](handleError(_0x344608,null));};exports[_0x0694('0x2a')]=function(_0x4e053f,_0x5f0cd0){var _0x30e183;return respondWithRpcPromise('Agents',_0x4e053f[_0x0694('0x15')])[_0x0694('0x1c')](function(_0x3d8e6e){_0x30e183=_0x3d8e6e;return respondWithRpcPromise(_0x0694('0x2b'),_0x4e053f[_0x0694('0x15')],routingClient);})[_0x0694('0x1c')](function(_0x78e849){return _[_0x0694('0x18')]({},_0x78e849,_0x30e183);})[_0x0694('0x1c')](respondWithResult(_0x5f0cd0,null))['catch'](handleError(_0x5f0cd0,null));};exports[_0x0694('0x2c')]=function(_0x537d7d,_0x5befcd){if(_0x537d7d[_0x0694('0x20')]&&_0x537d7d[_0x0694('0x20')]['interaction']&&_0x537d7d[_0x0694('0x2d')]&&_0x537d7d[_0x0694('0x2d')][_0x0694('0xf')]){for(var _0x32e8de in _0x537d7d[_0x0694('0x20')][_0x0694('0x2e')]){if(_0x537d7d[_0x0694('0x20')]['interaction']['hasOwnProperty'](_0x32e8de)){db[_0x0694('0x2f')][_0x0694('0x30')]({'where':{'channel':_0x32e8de,'membername':_0x537d7d['user']['name'],'type':_0x0694('0x31'),'exitAt':null,'uniqueid':_0x537d7d['body']['interaction'][_0x32e8de]&&_0x537d7d[_0x0694('0x20')]['interaction'][_0x32e8de][_0x0694('0x32')]?{'$notIn':_0x537d7d[_0x0694('0x20')][_0x0694('0x2e')][_0x32e8de]}:{'$ne':null}}})[_0x0694('0x1c')](function(_0x2e2a65){var _0x4b6136=moment()[_0x0694('0x33')](_0x0694('0x34'));for(var _0xbce758=0x0,_0x41e84b=_0x2e2a65[_0x0694('0x32')];_0xbce758<_0x41e84b;_0xbce758+=0x1){_0x2e2a65[_0xbce758][_0x0694('0x35')]({'exitAt':_0x4b6136});}});for(var _0x9d70e7=0x0;_0x9d70e7<_0x537d7d[_0x0694('0x20')][_0x0694('0x2e')][_0x32e8de]['length'];_0x9d70e7+=0x1){db[_0x0694('0x2f')][_0x0694('0x36')]({'where':{'channel':_0x32e8de,'membername':_0x537d7d[_0x0694('0x2d')][_0x0694('0xf')],'type':'INTERACTION','uniqueid':_0x537d7d['body'][_0x0694('0x2e')][_0x32e8de][_0x9d70e7],'exitAt':null},'defaults':{'channel':_0x32e8de,'membername':_0x537d7d['user'][_0x0694('0xf')],'interface':_[_0x0694('0x11')](_0x537d7d[_0x0694('0x2d')]['interface'])?util[_0x0694('0x33')](_0x0694('0x37'),_0x537d7d[_0x0694('0x2d')][_0x0694('0xf')]):_0x537d7d[_0x0694('0x2d')]['interface'],'type':_0x0694('0x31'),'enterAt':moment()[_0x0694('0x33')](_0x0694('0x34')),'role':_0x0694('0x38'),'internal':_0x537d7d[_0x0694('0x2d')][_0x0694('0x39')],'uniqueid':_0x537d7d[_0x0694('0x20')][_0x0694('0x2e')][_0x32e8de][_0x9d70e7]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x537d7d[_0x0694('0x19')]['id'],'capacity':_0x537d7d[_0x0694('0x20')]['capacity']},routingClient)[_0x0694('0x1c')](respondWithResult(_0x5befcd,null))[_0x0694('0x16')](handleError(_0x5befcd,null));};exports[_0x0694('0x3a')]=function(_0x5e445e,_0x5857c0){return respondWithRpcPromise(_0x0694('0x3b'),_0x5e445e[_0x0694('0x15')])[_0x0694('0x1c')](respondWithResult(_0x5857c0,null))[_0x0694('0x16')](handleError(_0x5857c0,null));};exports[_0x0694('0x3c')]=function(_0x2c3628,_0x8cb397){return respondWithRpcPromise(_0x0694('0x3d'),_0x2c3628[_0x0694('0x15')])[_0x0694('0x1c')](respondWithResult(_0x8cb397,null))[_0x0694('0x16')](handleError(_0x8cb397,null));};exports[_0x0694('0x3e')]=function(_0x307786,_0x2af378){return respondWithRpcPromise('Campaigns',_0x307786[_0x0694('0x15')])[_0x0694('0x1c')](respondWithResult(_0x2af378,null))[_0x0694('0x16')](handleError(_0x2af378,null));};exports['chatQueues']=function(_0x34e254,_0x250f30){return respondWithRpcPromise(_0x0694('0x3f'),_0x34e254[_0x0694('0x15')],routingClient)[_0x0694('0x1c')](respondWithResult(_0x250f30,null))[_0x0694('0x16')](handleError(_0x250f30,null));};exports[_0x0694('0x40')]=function(_0x3169ea,_0x1e123e){return respondWithRpcPromise(_0x0694('0x3f'),_0x3169ea[_0x0694('0x15')],routingClient)['then'](findById(_0x3169ea[_0x0694('0x19')]['id']))[_0x0694('0x1c')](respondWithResult(_0x1e123e,null))[_0x0694('0x16')](handleError(_0x1e123e,null));};exports['mailQueues']=function(_0x5d1fda,_0x5aaf50){return respondWithRpcPromise(_0x0694('0x41'),_0x5d1fda[_0x0694('0x15')],routingClient)[_0x0694('0x1c')](respondWithResult(_0x5aaf50,null))[_0x0694('0x16')](handleError(_0x5aaf50,null));};exports[_0x0694('0x42')]=function(_0xf20409,_0x4c7bff){return respondWithRpcPromise('MailQueues',_0xf20409[_0x0694('0x15')],routingClient)[_0x0694('0x1c')](findById(_0xf20409[_0x0694('0x19')]['id']))['then'](respondWithResult(_0x4c7bff,null))[_0x0694('0x16')](handleError(_0x4c7bff,null));};exports[_0x0694('0x43')]=function(_0x320ae3,_0x40a45f){return respondWithRpcPromise(_0x0694('0x44'),_0x320ae3[_0x0694('0x15')],mailClient)['then'](respondWithResult(_0x40a45f,null))[_0x0694('0x16')](handleError(_0x40a45f,null));};exports[_0x0694('0x45')]=function(_0x4e17df,_0x4b33b1){return respondWithRpcPromise('OpenchannelQueues',_0x4e17df['query'],routingClient)[_0x0694('0x1c')](respondWithResult(_0x4b33b1,null))['catch'](handleError(_0x4b33b1,null));};exports[_0x0694('0x46')]=function(_0x1dfb58,_0x5b3b69){return respondWithRpcPromise('OpenchannelQueues',_0x1dfb58[_0x0694('0x15')],routingClient)[_0x0694('0x1c')](findById(_0x1dfb58[_0x0694('0x19')]['id']))[_0x0694('0x1c')](respondWithResult(_0x5b3b69,null))[_0x0694('0x16')](handleError(_0x5b3b69,null));};exports[_0x0694('0x47')]=function(_0x2e2380,_0x5c310d){return respondWithRpcPromise(_0x0694('0x48'),_0x2e2380[_0x0694('0x15')],routingClient)[_0x0694('0x1c')](respondWithResult(_0x5c310d,null))[_0x0694('0x16')](handleError(_0x5c310d,null));};exports['showSmsQueues']=function(_0x39481a,_0x27a8bf){return respondWithRpcPromise(_0x0694('0x48'),_0x39481a[_0x0694('0x15')],routingClient)[_0x0694('0x1c')](findById(_0x39481a[_0x0694('0x19')]['id']))[_0x0694('0x1c')](respondWithResult(_0x27a8bf,null))['catch'](handleError(_0x27a8bf,null));};exports['whatsappQueues']=function(_0x20975b,_0x2f57ec){return respondWithRpcPromise('WhatsappQueues',_0x20975b[_0x0694('0x15')],routingClient)['then'](respondWithResult(_0x2f57ec,null))[_0x0694('0x16')](handleError(_0x2f57ec,null));};exports[_0x0694('0x49')]=function(_0x395bd7,_0x33b3aa){return respondWithRpcPromise('WhatsappQueues',_0x395bd7[_0x0694('0x15')],routingClient)['then'](findById(_0x395bd7[_0x0694('0x19')]['id']))[_0x0694('0x1c')](respondWithResult(_0x33b3aa,null))[_0x0694('0x16')](handleError(_0x33b3aa,null));};exports['faxQueues']=function(_0x210ae8,_0x416b30){return respondWithRpcPromise('FaxQueues',_0x210ae8[_0x0694('0x15')],routingClient)[_0x0694('0x1c')](respondWithResult(_0x416b30,null))[_0x0694('0x16')](handleError(_0x416b30,null));};exports['showFaxQueues']=function(_0x355148,_0x15883d){return respondWithRpcPromise(_0x0694('0x4a'),_0x355148['query'],routingClient)[_0x0694('0x1c')](findById(_0x355148[_0x0694('0x19')]['id']))[_0x0694('0x1c')](respondWithResult(_0x15883d,null))[_0x0694('0x16')](handleError(_0x15883d,null));};exports[_0x0694('0x4b')]=function(_0x9c1272,_0x3ff258){return respondWithRpcPromise('FaxAccounts',_0x9c1272[_0x0694('0x15')])[_0x0694('0x1c')](respondWithResult(_0x3ff258,null))[_0x0694('0x16')](handleError(_0x3ff258,null));};exports[_0x0694('0x4c')]=function(_0x2b50e9,_0x565d4d){return respondWithRpcPromise(_0x0694('0x4d'),_0x2b50e9[_0x0694('0x15')],routingClient)['then'](respondWithResult(_0x565d4d,null))['catch'](handleError(_0x565d4d,null));};exports[_0x0694('0x4e')]=function(_0x21d5f6,_0x32282e){return respondWithRpcPromise(_0x0694('0x4f'),_0x21d5f6[_0x0694('0x15')],routingClient)[_0x0694('0x1c')](respondWithResult(_0x32282e,null))['catch'](handleError(_0x32282e,null));};exports[_0x0694('0x50')]=function(_0x456b8d,_0x1f728b){return respondWithRpcPromise(_0x0694('0x51'),_0x456b8d[_0x0694('0x15')],routingClient)[_0x0694('0x1c')](respondWithResult(_0x1f728b,null))[_0x0694('0x16')](handleError(_0x1f728b,null));};exports[_0x0694('0x52')]=function(_0x444355,_0x597955){return respondWithRpcPromise(_0x0694('0x51'),_0x444355[_0x0694('0x15')],routingClient)[_0x0694('0x1c')](function(_0x257fd2){if(_0x444355[_0x0694('0x15')][_0x0694('0x53')]!==undefined){var _0x79d00e=_(_0x257fd2[_0x0694('0x54')])[_0x0694('0x55')]([_0x444355[_0x0694('0x15')]['type'],_0x444355[_0x0694('0x19')]['id']])[_0x0694('0x56')](_0x0694('0x57'))[_0x0694('0x58')]()[_0x0694('0x59')]();return _0x257fd2[_0x0694('0x54')]['filter'](function(_0x199c47){return _0x79d00e[_0x0694('0x5a')](_0x199c47[_0x0694('0x57')])>-0x1;});}else{return _0x257fd2[_0x0694('0x54')][_0x0694('0x55')](function(_0x57cbb1){return _0x57cbb1['queue_id']===parseInt(_0x444355[_0x0694('0x19')]['id']);});}})[_0x0694('0x1c')](respondWithResult(_0x597955,null))[_0x0694('0x16')](handleError(_0x597955,null));};exports[_0x0694('0x5b')]=function(_0x4ed7c4,_0x48f923){return respondWithRpcPromise(_0x0694('0x5c'),_0x4ed7c4[_0x0694('0x15')],routingClient)[_0x0694('0x1c')](respondWithResult(_0x48f923,null))[_0x0694('0x16')](handleError(_0x48f923,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x13d8a3,_0x39a561){return respondWithRpcPromise(_0x0694('0x5d'),_0x13d8a3[_0x0694('0x15')],routingClient)['then'](respondWithResult(_0x39a561,null))[_0x0694('0x16')](handleError(_0x39a561,null));};exports[_0x0694('0x5e')]=function(_0x5c53bd,_0x31d14c){return respondWithRpcPromise(_0x0694('0x5f'),_0x5c53bd[_0x0694('0x15')],routingClient)[_0x0694('0x1c')](respondWithResult(_0x31d14c,null))['catch'](handleError(_0x31d14c,null));};exports[_0x0694('0x60')]=function(_0x413ed7){return function(_0x34cdf8,_0x1c12f4){var _0x36dd1e,_0x461a6d;var _0x120001=_[_0x0694('0x61')](_0x413ed7);var _0x3f43ce=_0x413ed7===_0x0694('0x62')?_0x0694('0x63'):'Account';return db[_0x120001+_0x0694('0x64')][_0x0694('0x65')]({'raw':!![],'where':{'id':_0x34cdf8[_0x0694('0x19')]['id']}})[_0x0694('0x1c')](function(_0x3b50f3){if(_['isNil'](_0x3b50f3)){throw new Error(_0x120001+_0x0694('0x66'));}_0x36dd1e=_0x3b50f3;return db[_0x120001+_0x0694('0x67')]['findOne']({'where':{'id':_0x34cdf8[_0x0694('0x20')][_0x0694('0x68')]},'include':[{'model':db[_0x120001+_0x0694('0x69')],'as':_0x0694('0x69')},{'model':db[_0x120001+_0x3f43ce],'as':_0x0694('0x6a')}]});})['then'](function(_0x4f8d66){if(_[_0x0694('0x11')](_0x4f8d66)){throw new Error(_0x120001+'\x20Message\x20not\x20found');}_0x461a6d=_0x4f8d66;return _0x4f8d66[_0x0694('0x6b')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0694('0x1c')](function(){var _0x128640={'uniqueid':_0x413ed7+'.'+_0x461a6d['id']+'.'+_0x461a6d['Interaction']['id'],'FromUserId':_0x34cdf8[_0x0694('0x2d')]['id'],'type':_0x0694('0x6c')};_0x128640[_0x120001+_0x0694('0x6d')]=_0x461a6d['id'];_0x128640[_0x120001+'InteractionId']=_0x461a6d['Interaction']['id'];_0x128640[_0x0694('0x6e')+_0x120001+_0x3f43ce+'Id']=_0x461a6d['Account']['id'];_0x128640['To'+_0x120001+_0x0694('0x6f')]=_0x36dd1e['id'];return db[_0x120001+_0x0694('0x70')][_0x0694('0x71')](_0x128640);})[_0x0694('0x1c')](function(){return respondWithRpcPromise('Start',{'channel':_0x413ed7,'interaction':_0x461a6d['Interaction'],'message':_0x461a6d,'account':_0x461a6d['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x0694('0x6c'),'appdata':_0x36dd1e[_0x0694('0xf')]+','+(_0x461a6d[_0x0694('0x6a')][_0x0694('0x72')]||0x12c),'interval':_0x0694('0x73')}]},routingClient);})[_0x0694('0x1c')](respondWithResult(_0x1c12f4,null))['catch'](handleError(_0x1c12f4,null));};};exports['agentNotify']=function(_0x25245b,_0x1969dc){var _0x421b4e,_0x5d5733;if(_['isNil'](_0x25245b[_0x0694('0x20')]['channel'])){throw new Error(_0x0694('0x74'));}var _0x21a424=_0x25245b['body'][_0x0694('0x75')];var _0x448c72=_[_0x0694('0x61')](_0x21a424);var _0x5110b2=_0x21a424===_0x0694('0x62')?_0x0694('0x63'):_0x0694('0x6a');return db[_0x0694('0x76')]['findOne']({'raw':!![],'where':{'id':_0x25245b[_0x0694('0x19')]['id'],'role':'agent'}})[_0x0694('0x1c')](function(_0x111022){if(_[_0x0694('0x11')](_0x111022)){throw new Error(_0x0694('0x77'));}_0x421b4e=_0x111022;return db[_0x448c72+_0x0694('0x67')]['findOne']({'where':{'id':_0x25245b['body'][_0x0694('0x68')]},'include':[{'model':db[_0x448c72+'Interaction'],'as':'Interaction'},{'model':db[_0x448c72+_0x5110b2],'as':'Account'}]});})[_0x0694('0x1c')](function(_0x3f13a8){if(_[_0x0694('0x11')](_0x3f13a8)){throw new Error(_0x448c72+'\x20Message\x20not\x20found');}_0x5d5733=_0x3f13a8;return _0x3f13a8[_0x0694('0x6b')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x41d8a0={'uniqueid':_0x21a424+'.'+_0x5d5733['id']+'.'+_0x5d5733[_0x0694('0x69')]['id'],'FromUserId':_0x25245b[_0x0694('0x2d')]['id'],'type':'agent','ToUserId':_0x421b4e['id']};_0x41d8a0[_0x448c72+'MessageId']=_0x5d5733['id'];_0x41d8a0[_0x448c72+_0x0694('0x78')]=_0x5d5733['Interaction']['id'];_0x41d8a0[_0x0694('0x6e')+_0x448c72+_0x5110b2+'Id']=_0x5d5733['Account']['id'];return db[_0x448c72+_0x0694('0x70')][_0x0694('0x71')](_0x41d8a0);})[_0x0694('0x1c')](function(){return respondWithRpcPromise('Start',{'channel':_0x21a424,'interaction':_0x5d5733[_0x0694('0x69')],'message':_0x5d5733,'account':_0x5d5733['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x421b4e[_0x0694('0xf')]+','+(_0x5d5733[_0x0694('0x6a')][_0x0694('0x79')]||0x12c),'interval':_0x0694('0x73')}]},routingClient);})[_0x0694('0x1c')](respondWithResult(_0x1969dc,null))[_0x0694('0x16')](handleError(_0x1969dc,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 229eb83..6ff1876 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 _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 +var _0x688b=['index','/:id','/:id/run','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated'];(function(_0x1c3370,_0xf617e8){var _0xa9b358=function(_0x39cb44){while(--_0x39cb44){_0x1c3370['push'](_0x1c3370['shift']());}};_0xa9b358(++_0xf617e8);}(_0x688b,0x95));var _0xb688=function(_0x10d34b,_0x4fef76){_0x10d34b=_0x10d34b-0x0;var _0x92b0bf=_0x688b[_0x10d34b];return _0x92b0bf;};'use strict';var multer=require(_0xb688('0x0'));var util=require(_0xb688('0x1'));var path=require(_0xb688('0x2'));var timeout=require(_0xb688('0x3'));var express=require('express');var router=express[_0xb688('0x4')]();var fs_extra=require(_0xb688('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb688('0x6'));var config=require(_0xb688('0x7'));var controller=require(_0xb688('0x8'));router[_0xb688('0x9')]('/',auth[_0xb688('0xa')](),controller[_0xb688('0xb')]);router[_0xb688('0x9')](_0xb688('0xc'),auth[_0xb688('0xa')](),controller['show']);router[_0xb688('0x9')](_0xb688('0xd'),auth[_0xb688('0xa')](),controller['run']);router[_0xb688('0xe')]('/',auth[_0xb688('0xa')](),controller[_0xb688('0xf')]);router[_0xb688('0x10')]('/:id',auth[_0xb688('0xa')](),controller[_0xb688('0x11')]);router[_0xb688('0x12')]('/:id',auth[_0xb688('0xa')](),controller[_0xb688('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index e1a3744..2e98f55 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 _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 +var _0xecff=['DATE','INTEGER','ENUM','years','quarters','months','days','hours','minutes','csv','pdf','default','custom','TEXT','sequelize','STRING','BOOLEAN'];(function(_0x19b773,_0x3de260){var _0x822fcc=function(_0x3e4f38){while(--_0x3e4f38){_0x19b773['push'](_0x19b773['shift']());}};_0x822fcc(++_0x3de260);}(_0xecff,0xc9));var _0xfecf=function(_0xe43203,_0x3747b0){_0xe43203=_0xe43203-0x0;var _0x2eac57=_0xecff[_0xe43203];return _0x2eac57;};'use strict';var Sequelize=require(_0xfecf('0x0'));module['exports']={'name':{'type':Sequelize[_0xfecf('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xfecf('0x1')]},'active':{'type':Sequelize[_0xfecf('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xfecf('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0xfecf('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xfecf('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xfecf('0x5')](_0xfecf('0x6'),_0xfecf('0x7'),_0xfecf('0x8'),'weeks',_0xfecf('0x9'),_0xfecf('0xa'),_0xfecf('0xb')),'allowNull':![],'defaultValue':_0xfecf('0x9')},'output':{'type':Sequelize[_0xfecf('0x5')](_0xfecf('0xc'),_0xfecf('0xd'),'xlsx'),'allowNull':![],'defaultValue':_0xfecf('0xc')},'type':{'type':Sequelize[_0xfecf('0x5')]('custom',_0xfecf('0xe')),'allowNull':![],'defaultValue':_0xfecf('0xf')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xfecf('0x1')]},'cc':{'type':Sequelize[_0xfecf('0x10')]},'bcc':{'type':Sequelize[_0xfecf('0x10')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index a1662f7..f220e8f 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 _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 +var _0xa087=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','run','../../config/schedule','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','Content-Range','reject','save','update','then','get','Scheduler','UserProfileResource','destroy','error','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','Schedule','rows','catch','show','params','length','find'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa087,0x156));var _0x7a08=function(_0x2bf1ed,_0x5213e3){_0x2bf1ed=_0x2bf1ed-0x0;var _0x13b3a3=_0xa087[_0x2bf1ed];return _0x13b3a3;};'use strict';var emlformat=require(_0x7a08('0x0'));var rimraf=require(_0x7a08('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7a08('0x2'));var rp=require(_0x7a08('0x3'));var moment=require(_0x7a08('0x4'));var BPromise=require(_0x7a08('0x5'));var Mustache=require(_0x7a08('0x6'));var util=require('util');var path=require(_0x7a08('0x7'));var sox=require('sox');var csv=require(_0x7a08('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7a08('0x9'));var _=require(_0x7a08('0xa'));var squel=require('squel');var crypto=require(_0x7a08('0xb'));var jsforce=require(_0x7a08('0xc'));var deskjs=require(_0x7a08('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7a08('0xe'));var Papa=require(_0x7a08('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7a08('0x10'));var as=require(_0x7a08('0x11'));var hardwareService=require(_0x7a08('0x12'));var logger=require(_0x7a08('0x13'))(_0x7a08('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7a08('0x15'));var db=require(_0x7a08('0x16'))['db'];function respondWithStatusCode(_0x1d1310,_0x5db8f5){_0x5db8f5=_0x5db8f5||0xcc;return function(_0x116b76){if(_0x116b76){return _0x1d1310[_0x7a08('0x17')](_0x5db8f5);}return _0x1d1310[_0x7a08('0x18')](_0x5db8f5)[_0x7a08('0x19')]();};}function respondWithResult(_0x25dc70,_0x24b908){_0x24b908=_0x24b908||0xc8;return function(_0x1dc8cc){if(_0x1dc8cc){return _0x25dc70['status'](_0x24b908)[_0x7a08('0x1a')](_0x1dc8cc);}};}function respondWithFilteredResult(_0x8ac134,_0x4aac8f){return function(_0x164a4f){if(_0x164a4f){var _0x2c9692=typeof _0x4aac8f[_0x7a08('0x1b')]==='undefined'&&typeof _0x4aac8f[_0x7a08('0x1c')]===_0x7a08('0x1d');var _0x2ad0c8=_0x164a4f['count'];var _0x5bf784=_0x2c9692?0x0:_0x4aac8f[_0x7a08('0x1b')];var _0x16e62d=_0x2c9692?_0x164a4f['count']:_0x4aac8f[_0x7a08('0x1b')]+_0x4aac8f[_0x7a08('0x1c')];var _0x65f5aa;if(_0x16e62d>=_0x2ad0c8){_0x16e62d=_0x2ad0c8;_0x65f5aa=0xc8;}else{_0x65f5aa=0xce;}_0x8ac134[_0x7a08('0x18')](_0x65f5aa);return _0x8ac134['set'](_0x7a08('0x1e'),_0x5bf784+'-'+_0x16e62d+'/'+_0x2ad0c8)[_0x7a08('0x1a')](_0x164a4f);}return null;};}function patchUpdates(_0x28055a){return function(_0x5c079d){try{jsonpatch['apply'](_0x5c079d,_0x28055a,!![]);}catch(_0x89a51e){return BPromise[_0x7a08('0x1f')](_0x89a51e);}return _0x5c079d[_0x7a08('0x20')]();};}function saveUpdates(_0x49c16e,_0x4a1cbf){return function(_0x12ba68){if(_0x12ba68){return _0x12ba68[_0x7a08('0x21')](_0x49c16e)[_0x7a08('0x22')](function(_0x540778){return _0x540778;});}return null;};}function removeEntity(_0x483278,_0x5e9343){return function(_0x3dae81){if(_0x3dae81){return _0x3dae81['destroy']()[_0x7a08('0x22')](function(){var _0x18245b=_0x3dae81[_0x7a08('0x23')]({'plain':!![]});var _0x3c10bd=_0x7a08('0x24');return db[_0x7a08('0x25')][_0x7a08('0x26')]({'where':{'type':_0x3c10bd,'resourceId':_0x18245b['id']}})[_0x7a08('0x22')](function(){return _0x3dae81;});})[_0x7a08('0x22')](function(){_0x483278[_0x7a08('0x18')](0xcc)[_0x7a08('0x19')]();});}};}function handleEntityNotFound(_0x51e199,_0x5bdfea){return function(_0x275740){if(!_0x275740){_0x51e199['sendStatus'](0x194);}return _0x275740;};}function handleError(_0x4b8b9f,_0x24d31e){_0x24d31e=_0x24d31e||0x1f4;return function(_0x17ce75){logger[_0x7a08('0x27')](_0x17ce75['stack']);if(_0x17ce75[_0x7a08('0x28')]){delete _0x17ce75[_0x7a08('0x28')];}_0x4b8b9f['status'](_0x24d31e)[_0x7a08('0x29')](_0x17ce75);};}exports['index']=function(_0xc7647c,_0x161c0f){var _0x4b35ba={},_0x3f5908={},_0x6123f6={'count':0x0,'rows':[]};var _0x12907f=_[_0x7a08('0x2a')](db['Schedule'][_0x7a08('0x2b')],function(_0x278912){return{'name':_0x278912[_0x7a08('0x2c')],'type':_0x278912[_0x7a08('0x2d')][_0x7a08('0x2e')]};});_0x3f5908[_0x7a08('0x2f')]=_[_0x7a08('0x2a')](_0x12907f,_0x7a08('0x28'));_0x3f5908['query']=_[_0x7a08('0x30')](_0xc7647c[_0x7a08('0x31')]);_0x3f5908[_0x7a08('0x32')]=_[_0x7a08('0x33')](_0x3f5908[_0x7a08('0x2f')],_0x3f5908[_0x7a08('0x31')]);_0x4b35ba[_0x7a08('0x34')]=_[_0x7a08('0x33')](_0x3f5908['model'],qs[_0x7a08('0x35')](_0xc7647c['query'][_0x7a08('0x35')]));_0x4b35ba[_0x7a08('0x34')]=_0x4b35ba[_0x7a08('0x34')]['length']?_0x4b35ba['attributes']:_0x3f5908[_0x7a08('0x2f')];if(!_0xc7647c[_0x7a08('0x31')][_0x7a08('0x36')](_0x7a08('0x37'))){_0x4b35ba[_0x7a08('0x1c')]=qs[_0x7a08('0x1c')](_0xc7647c['query'][_0x7a08('0x1c')]);_0x4b35ba[_0x7a08('0x1b')]=qs[_0x7a08('0x1b')](_0xc7647c[_0x7a08('0x31')][_0x7a08('0x1b')]);}_0x4b35ba[_0x7a08('0x38')]=qs[_0x7a08('0x39')](_0xc7647c[_0x7a08('0x31')][_0x7a08('0x39')]);_0x4b35ba['where']=qs[_0x7a08('0x32')](_[_0x7a08('0x3a')](_0xc7647c[_0x7a08('0x31')],_0x3f5908[_0x7a08('0x32')]),_0x12907f);if(_0xc7647c['query']['filter']){_0x4b35ba[_0x7a08('0x3b')]=_['merge'](_0x4b35ba[_0x7a08('0x3b')],{'$or':_[_0x7a08('0x2a')](_0x12907f,function(_0x162fb7){if(_0x162fb7[_0x7a08('0x2d')]!==_0x7a08('0x3c')){var _0xf2bf28={};_0xf2bf28[_0x162fb7['name']]={'$like':'%'+_0xc7647c[_0x7a08('0x31')][_0x7a08('0x3d')]+'%'};return _0xf2bf28;}})});}_0x4b35ba=_[_0x7a08('0x3e')]({},_0x4b35ba,_0xc7647c[_0x7a08('0x3f')]);var _0xf98fe0={'where':_0x4b35ba[_0x7a08('0x3b')]};return db['Schedule']['count'](_0xf98fe0)[_0x7a08('0x22')](function(_0x2be5bf){_0x6123f6['count']=_0x2be5bf;if(_0xc7647c[_0x7a08('0x31')][_0x7a08('0x40')]){_0x4b35ba[_0x7a08('0x41')]=[{'all':!![]}];}return db[_0x7a08('0x42')]['findAll'](_0x4b35ba);})[_0x7a08('0x22')](function(_0x2c6aed){_0x6123f6[_0x7a08('0x43')]=_0x2c6aed;return _0x6123f6;})[_0x7a08('0x22')](respondWithFilteredResult(_0x161c0f,_0x4b35ba))[_0x7a08('0x44')](handleError(_0x161c0f,null));};exports[_0x7a08('0x45')]=function(_0x38b084,_0x108dcb){var _0x5ee8f4={'raw':![],'where':{'id':_0x38b084[_0x7a08('0x46')]['id']}},_0x513bb0={};_0x513bb0[_0x7a08('0x2f')]=_[_0x7a08('0x30')](db[_0x7a08('0x42')][_0x7a08('0x2b')]);_0x513bb0[_0x7a08('0x31')]=_[_0x7a08('0x30')](_0x38b084[_0x7a08('0x31')]);_0x513bb0[_0x7a08('0x32')]=_[_0x7a08('0x33')](_0x513bb0[_0x7a08('0x2f')],_0x513bb0[_0x7a08('0x31')]);_0x5ee8f4[_0x7a08('0x34')]=_['intersection'](_0x513bb0[_0x7a08('0x2f')],qs[_0x7a08('0x35')](_0x38b084[_0x7a08('0x31')][_0x7a08('0x35')]));_0x5ee8f4[_0x7a08('0x34')]=_0x5ee8f4[_0x7a08('0x34')][_0x7a08('0x47')]?_0x5ee8f4[_0x7a08('0x34')]:_0x513bb0[_0x7a08('0x2f')];if(_0x38b084['query']['includeAll']){_0x5ee8f4[_0x7a08('0x41')]=[{'all':!![]}];}_0x5ee8f4=_[_0x7a08('0x3e')]({},_0x5ee8f4,_0x38b084['options']);return db['Schedule'][_0x7a08('0x48')](_0x5ee8f4)[_0x7a08('0x22')](handleEntityNotFound(_0x108dcb,null))[_0x7a08('0x22')](respondWithResult(_0x108dcb,null))[_0x7a08('0x44')](handleError(_0x108dcb,null));};exports[_0x7a08('0x49')]=function(_0xca6aad,_0x3ec605){return db[_0x7a08('0x42')][_0x7a08('0x49')](_0xca6aad[_0x7a08('0x4a')],{})[_0x7a08('0x22')](function(_0x11cba6){var _0x53a2a7=_0xca6aad[_0x7a08('0x4b')][_0x7a08('0x23')]({'plain':!![]});if(!_0x53a2a7)throw new Error(_0x7a08('0x4c'));if(_0x53a2a7[_0x7a08('0x4d')]==='user'){var _0x290229=_0x11cba6[_0x7a08('0x23')]({'plain':!![]});var _0x26c56b=_0x7a08('0x24');return db[_0x7a08('0x4e')][_0x7a08('0x48')]({'where':{'name':_0x26c56b,'userProfileId':_0x53a2a7[_0x7a08('0x4f')]},'raw':!![]})[_0x7a08('0x22')](function(_0x3824f1){if(_0x3824f1&&_0x3824f1[_0x7a08('0x50')]===0x0){return db[_0x7a08('0x25')][_0x7a08('0x49')]({'name':_0x290229[_0x7a08('0x28')],'resourceId':_0x290229['id'],'type':_0x3824f1[_0x7a08('0x28')],'sectionId':_0x3824f1['id']},{})['then'](function(){return _0x11cba6;});}else{return _0x11cba6;}})[_0x7a08('0x44')](function(_0x3f836d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f836d);throw _0x3f836d;});}return _0x11cba6;})[_0x7a08('0x22')](respondWithResult(_0x3ec605,0xc9))['catch'](handleError(_0x3ec605,null));};exports[_0x7a08('0x21')]=function(_0x332831,_0x45228e){if(_0x332831[_0x7a08('0x4a')]['id']){delete _0x332831[_0x7a08('0x4a')]['id'];}return db[_0x7a08('0x42')][_0x7a08('0x48')]({'where':{'id':_0x332831['params']['id']}})[_0x7a08('0x22')](handleEntityNotFound(_0x45228e,null))[_0x7a08('0x22')](saveUpdates(_0x332831[_0x7a08('0x4a')],null))[_0x7a08('0x22')](respondWithResult(_0x45228e,null))[_0x7a08('0x44')](handleError(_0x45228e,null));};exports[_0x7a08('0x26')]=function(_0x1af824,_0x8f4970){return db[_0x7a08('0x42')]['find']({'where':{'id':_0x1af824[_0x7a08('0x46')]['id']}})['then'](handleEntityNotFound(_0x8f4970,null))[_0x7a08('0x22')](removeEntity(_0x8f4970,null))[_0x7a08('0x44')](handleError(_0x8f4970,null));};exports[_0x7a08('0x51')]=function(_0x56ee10,_0x2dfd37,_0x382ef8){var _0x17436d=require(_0x7a08('0x52'));return db[_0x7a08('0x42')][_0x7a08('0x48')]({'where':{'id':_0x56ee10[_0x7a08('0x46')]['id']},'raw':!![]})[_0x7a08('0x22')](handleEntityNotFound(_0x2dfd37,null))[_0x7a08('0x22')](function(){_0x17436d[_0x7a08('0x51')](_0x56ee10['params']['id']);})['then'](respondWithStatusCode(_0x2dfd37,null))['catch'](handleError(_0x2dfd37,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 0a25c07..66eabbe 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 _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 +var _0xd707=['bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xd707,0x163));var _0x7d70=function(_0x244682,_0x4b174e){_0x244682=_0x244682-0x0;var _0x41dfc3=_0xd707[_0x244682];return _0x41dfc3;};'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(_0x7d70('0x8'));var config=require(_0x7d70('0x9'));var attributes=require(_0x7d70('0xa'));module[_0x7d70('0xb')]=function(_0x4b0770,_0x526488){return _0x4b0770[_0x7d70('0xc')](_0x7d70('0xd'),attributes,{'tableName':_0x7d70('0xe'),'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 e207039..ede6978 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 _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 +var _0x0615=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','bluebird','randomstring'];(function(_0x3efe87,_0x35ad48){var _0x56a4cc=function(_0x47869e){while(--_0x47869e){_0x3efe87['push'](_0x3efe87['shift']());}};_0x56a4cc(++_0x35ad48);}(_0x0615,0x189));var _0x5061=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0615[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x5061('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5061('0x1'));var rs=require(_0x5061('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5061('0x3'))['db'];var utils=require(_0x5061('0x4'));var logger=require(_0x5061('0x5'))(_0x5061('0x6'));var config=require(_0x5061('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5061('0x8')][_0x5061('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x319263,_0x36ea29,_0x31dab1){return new BPromise(function(_0x1912ae,_0x369cf5){return client[_0x5061('0xa')](_0x319263,_0x31dab1)[_0x5061('0xb')](function(_0x5501b2){logger['info'](_0x5061('0xc'),_0x36ea29,_0x5061('0xd'));logger[_0x5061('0xe')](_0x5061('0xf'),_0x36ea29,'request\x20sent',JSON['stringify'](_0x5501b2));if(_0x5501b2['error']){if(_0x5501b2[_0x5061('0x10')][_0x5061('0x11')]===0x1f4){logger['error'](_0x5061('0xc'),_0x36ea29,_0x5501b2[_0x5061('0x10')]['message']);return _0x369cf5(_0x5501b2[_0x5061('0x10')]['message']);}logger[_0x5061('0x10')]('Schedule,\x20%s,\x20%s',_0x36ea29,_0x5501b2[_0x5061('0x10')]['message']);return _0x1912ae(_0x5501b2[_0x5061('0x10')][_0x5061('0x12')]);}else{logger[_0x5061('0x13')](_0x5061('0xc'),_0x36ea29,_0x5061('0xd'));_0x1912ae(_0x5501b2[_0x5061('0x14')][_0x5061('0x12')]);}})[_0x5061('0x15')](function(_0x441c81){logger[_0x5061('0x10')]('Schedule,\x20%s,\x20%s',_0x36ea29,_0x441c81);_0x369cf5(_0x441c81);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 0eede4f..dc945d7 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 _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 +var _0x4bdd=['isAuthenticated','index','/describe','/:id','show','download','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get'];(function(_0x4ab84b,_0x503754){var _0x2eac97=function(_0x34c5f4){while(--_0x34c5f4){_0x4ab84b['push'](_0x4ab84b['shift']());}};_0x2eac97(++_0x503754);}(_0x4bdd,0x68));var _0xd4bd=function(_0x9a7281,_0x1558fe){_0x9a7281=_0x9a7281-0x0;var _0x3510e6=_0x4bdd[_0x9a7281];return _0x3510e6;};'use strict';var multer=require('multer');var util=require(_0xd4bd('0x0'));var path=require(_0xd4bd('0x1'));var timeout=require(_0xd4bd('0x2'));var express=require(_0xd4bd('0x3'));var router=express[_0xd4bd('0x4')]();var fs_extra=require(_0xd4bd('0x5'));var auth=require(_0xd4bd('0x6'));var interaction=require(_0xd4bd('0x7'));var config=require(_0xd4bd('0x8'));var controller=require(_0xd4bd('0x9'));router[_0xd4bd('0xa')]('/',auth[_0xd4bd('0xb')](),controller[_0xd4bd('0xc')]);router[_0xd4bd('0xa')](_0xd4bd('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xd4bd('0xa')](_0xd4bd('0xe'),auth['isAuthenticated'](),controller[_0xd4bd('0xf')]);router[_0xd4bd('0xa')]('/:id/download',auth[_0xd4bd('0xb')](),controller[_0xd4bd('0x10')]);router[_0xd4bd('0x11')]('/',auth[_0xd4bd('0xb')](),controller['create']);router[_0xd4bd('0x12')](_0xd4bd('0xe'),auth['isAuthenticated'](),controller[_0xd4bd('0x13')]);router[_0xd4bd('0x14')]('/:id',auth[_0xd4bd('0xb')](),controller[_0xd4bd('0x15')]);module[_0xd4bd('0x16')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 4baf754..8599f9c 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 _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 +var _0xab75=['startedAt','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','updatedAt','sequelize','moment','path','VIRTUAL','getDataValue','value','STRING','replace','setDataValue','INTEGER','subtract','closedAt','duration'];(function(_0x480f4a,_0x2ea3f8){var _0xdccb7d=function(_0x151258){while(--_0x151258){_0x480f4a['push'](_0x480f4a['shift']());}};_0xdccb7d(++_0x2ea3f8);}(_0xab75,0x11f));var _0x5ab7=function(_0x5a092d,_0x282356){_0x5a092d=_0x5a092d-0x0;var _0x2f38da=_0xab75[_0x5a092d];return _0x2f38da;};'use strict';var Sequelize=require(_0x5ab7('0x0'));var moment=require(_0x5ab7('0x1'));var path=require(_0x5ab7('0x2'));var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0x5ab7('0x3')],'get':function(){return this[_0x5ab7('0x4')](_0x5ab7('0x5'))?path['extname'](this[_0x5ab7('0x4')](_0x5ab7('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x5ab7('0x6')]},'channel':{'type':Sequelize[_0x5ab7('0x6')]},'value':{'type':Sequelize[_0x5ab7('0x6')],'set':function(_0x32b338){var _0x229f83=_0x32b338[_0x5ab7('0x7')](/\\/g,'/');this[_0x5ab7('0x8')](_0x5ab7('0x5'),_0x229f83);}},'rating':{'type':Sequelize[_0x5ab7('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x216796){this[_0x5ab7('0x8')]('startedAt',moment()[_0x5ab7('0xa')](_0x216796,'ms'));this[_0x5ab7('0x8')](_0x5ab7('0xb'),moment());this[_0x5ab7('0x8')](_0x5ab7('0xc'),_0x216796);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x5ab7('0xd')))[_0x5ab7('0xe')](_0x5ab7('0xf'))[_0x5ab7('0x10')]();}},'closedAt':{'type':Sequelize[_0x5ab7('0x11')],'get':function(){return moment(this[_0x5ab7('0x4')](_0x5ab7('0xb')))[_0x5ab7('0xe')](_0x5ab7('0xf'))[_0x5ab7('0x10')]();}},'createdAt':{'type':Sequelize[_0x5ab7('0x11')],'get':function(){return moment(this['getDataValue'](_0x5ab7('0x12')))[_0x5ab7('0xe')](_0x5ab7('0xf'))[_0x5ab7('0x10')]();}},'updatedAt':{'type':Sequelize[_0x5ab7('0x11')],'get':function(){return moment(this[_0x5ab7('0x4')](_0x5ab7('0x13')))[_0x5ab7('0xe')](_0x5ab7('0xf'))[_0x5ab7('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 63ca809..2953f68 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 _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 +var _0xa41a=['unlink','message','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','save','update','destroy','then','error','stack','name','index','map','rawAttributes','type','key','differenceBy','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','ScreenRecording','includeAll','findAll','rows','params','include','find','catch','create','body','createdAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','secrets','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname'];(function(_0x2479f5,_0x290689){var _0x5af45f=function(_0x421d69){while(--_0x421d69){_0x2479f5['push'](_0x2479f5['shift']());}};_0x5af45f(++_0x290689);}(_0xa41a,0x6b));var _0xaa41=function(_0x12a815,_0x1b6944){_0x12a815=_0x12a815-0x0;var _0x18897c=_0xa41a[_0x12a815];return _0x18897c;};'use strict';var emlformat=require(_0xaa41('0x0'));var rimraf=require(_0xaa41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa41('0x2'));var rp=require(_0xaa41('0x3'));var moment=require(_0xaa41('0x4'));var BPromise=require(_0xaa41('0x5'));var Mustache=require(_0xaa41('0x6'));var util=require(_0xaa41('0x7'));var path=require(_0xaa41('0x8'));var sox=require(_0xaa41('0x9'));var csv=require('to-csv');var ejs=require(_0xaa41('0xa'));var fs=require('fs');var fs_extra=require(_0xaa41('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa41('0xc'));var jsforce=require(_0xaa41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa41('0xe'));var querystring=require(_0xaa41('0xf'));var Papa=require(_0xaa41('0x10'));var Redis=require(_0xaa41('0x11'));var authService=require(_0xaa41('0x12'));var qs=require(_0xaa41('0x13'));var as=require(_0xaa41('0x14'));var hardwareService=require(_0xaa41('0x15'));var logger=require(_0xaa41('0x16'))('api');var utils=require(_0xaa41('0x17'));var config=require(_0xaa41('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d0a54,_0x518b5b){_0x518b5b=_0x518b5b||0xcc;return function(_0x19bd69){if(_0x19bd69){return _0x1d0a54[_0xaa41('0x19')](_0x518b5b);}return _0x1d0a54[_0xaa41('0x1a')](_0x518b5b)[_0xaa41('0x1b')]();};}function respondWithResult(_0x6f9ade,_0x4eaf81){_0x4eaf81=_0x4eaf81||0xc8;return function(_0x1e9d7f){if(_0x1e9d7f){return _0x6f9ade[_0xaa41('0x1a')](_0x4eaf81)[_0xaa41('0x1c')](_0x1e9d7f);}};}function respondWithFilteredResult(_0x1ef7d9,_0x2a6988){return function(_0x2005ae){if(_0x2005ae){var _0x1e1e02=typeof _0x2a6988['offset']===_0xaa41('0x1d')&&typeof _0x2a6988[_0xaa41('0x1e')]===_0xaa41('0x1d');var _0x391b01=_0x2005ae[_0xaa41('0x1f')];var _0xd20ddf=_0x1e1e02?0x0:_0x2a6988[_0xaa41('0x20')];var _0x46e6d3=_0x1e1e02?_0x2005ae[_0xaa41('0x1f')]:_0x2a6988['offset']+_0x2a6988['limit'];var _0x1f502a;if(_0x46e6d3>=_0x391b01){_0x46e6d3=_0x391b01;_0x1f502a=0xc8;}else{_0x1f502a=0xce;}_0x1ef7d9[_0xaa41('0x1a')](_0x1f502a);return _0x1ef7d9[_0xaa41('0x21')]('Content-Range',_0xd20ddf+'-'+_0x46e6d3+'/'+_0x391b01)[_0xaa41('0x1c')](_0x2005ae);}return null;};}function patchUpdates(_0x1f692b){return function(_0x4e768e){try{jsonpatch['apply'](_0x4e768e,_0x1f692b,!![]);}catch(_0x1b1910){return BPromise['reject'](_0x1b1910);}return _0x4e768e[_0xaa41('0x22')]();};}function saveUpdates(_0x209c83,_0x3e2175){return function(_0x1f27f3){if(_0x1f27f3){return _0x1f27f3[_0xaa41('0x23')](_0x209c83)['then'](function(_0x43c430){return _0x43c430;});}return null;};}function removeEntity(_0x43a85c,_0x448a21){return function(_0x21f596){if(_0x21f596){return _0x21f596[_0xaa41('0x24')]()[_0xaa41('0x25')](function(){_0x43a85c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16aec5,_0x527cac){return function(_0x493a10){if(!_0x493a10){_0x16aec5[_0xaa41('0x19')](0x194);}return _0x493a10;};}function handleError(_0x59707f,_0x536bed){_0x536bed=_0x536bed||0x1f4;return function(_0x2d0ac0){logger[_0xaa41('0x26')](_0x2d0ac0[_0xaa41('0x27')]);if(_0x2d0ac0[_0xaa41('0x28')]){delete _0x2d0ac0[_0xaa41('0x28')];}_0x59707f[_0xaa41('0x1a')](_0x536bed)['send'](_0x2d0ac0);};}exports[_0xaa41('0x29')]=function(_0x1f0275,_0x63c18c){var _0x9a16e3={},_0x1d8c2b={},_0x4466a3={'count':0x0,'rows':[]};var _0x30f88e=_[_0xaa41('0x2a')](db['ScreenRecording'][_0xaa41('0x2b')],function(_0x48b48b){return{'name':_0x48b48b['fieldName'],'type':_0x48b48b[_0xaa41('0x2c')][_0xaa41('0x2d')]};});_0x1d8c2b['model']=_[_0xaa41('0x2e')](_[_0xaa41('0x2a')](_0x30f88e,'name'),['format']);_0x1d8c2b['query']=_[_0xaa41('0x2f')](_0x1f0275[_0xaa41('0x30')]);_0x1d8c2b[_0xaa41('0x31')]=_[_0xaa41('0x32')](_0x1d8c2b['model'],_0x1d8c2b[_0xaa41('0x30')]);_0x9a16e3[_0xaa41('0x33')]=_[_0xaa41('0x32')](_0x1d8c2b['model'],qs[_0xaa41('0x34')](_0x1f0275[_0xaa41('0x30')][_0xaa41('0x34')]));_0x9a16e3['attributes']=_0x9a16e3[_0xaa41('0x33')][_0xaa41('0x35')]?_0x9a16e3['attributes']:_0x1d8c2b[_0xaa41('0x36')];if(!_0x1f0275[_0xaa41('0x30')][_0xaa41('0x37')]('nolimit')){_0x9a16e3[_0xaa41('0x1e')]=qs['limit'](_0x1f0275[_0xaa41('0x30')][_0xaa41('0x1e')]);_0x9a16e3[_0xaa41('0x20')]=qs['offset'](_0x1f0275['query']['offset']);}_0x9a16e3[_0xaa41('0x38')]=qs[_0xaa41('0x39')](_0x1f0275[_0xaa41('0x30')][_0xaa41('0x39')]);_0x9a16e3['where']=qs['filters'](_[_0xaa41('0x3a')](_0x1f0275[_0xaa41('0x30')],_0x1d8c2b[_0xaa41('0x31')]),_0x30f88e);if(_0x1f0275[_0xaa41('0x30')][_0xaa41('0x3b')]){_0x9a16e3[_0xaa41('0x3c')]=_[_0xaa41('0x3d')](_0x9a16e3['where'],{'$or':_[_0xaa41('0x2a')](_0x30f88e,function(_0x5cf689){if(_0x5cf689[_0xaa41('0x2c')]!==_0xaa41('0x3e')){var _0x57f1bf={};_0x57f1bf[_0x5cf689['name']]={'$like':'%'+_0x1f0275[_0xaa41('0x30')][_0xaa41('0x3b')]+'%'};return _0x57f1bf;}})});}_0x9a16e3=_['merge']({},_0x9a16e3,_0x1f0275[_0xaa41('0x3f')]);var _0x563687={'where':_0x9a16e3[_0xaa41('0x3c')]};return db[_0xaa41('0x40')][_0xaa41('0x1f')](_0x563687)[_0xaa41('0x25')](function(_0x3e6cac){_0x4466a3[_0xaa41('0x1f')]=_0x3e6cac;if(_0x1f0275[_0xaa41('0x30')][_0xaa41('0x41')]){_0x9a16e3['include']=[{'all':!![]}];}return db[_0xaa41('0x40')][_0xaa41('0x42')](_0x9a16e3);})[_0xaa41('0x25')](function(_0x398c35){_0x4466a3[_0xaa41('0x43')]=_0x398c35;return _0x4466a3;})[_0xaa41('0x25')](respondWithFilteredResult(_0x63c18c,_0x9a16e3))['catch'](handleError(_0x63c18c,null));};exports['show']=function(_0x87e2f4,_0x4f9086){var _0x1ed366={'raw':![],'where':{'id':_0x87e2f4[_0xaa41('0x44')]['id']}},_0x215896={};_0x215896[_0xaa41('0x36')]=_[_0xaa41('0x2f')](db[_0xaa41('0x40')][_0xaa41('0x2b')]);_0x215896['query']=_[_0xaa41('0x2f')](_0x87e2f4['query']);_0x215896['filters']=_[_0xaa41('0x32')](_0x215896['model'],_0x215896['query']);_0x1ed366['attributes']=_[_0xaa41('0x32')](_0x215896['model'],qs[_0xaa41('0x34')](_0x87e2f4[_0xaa41('0x30')]['fields']));_0x1ed366['attributes']=_0x1ed366[_0xaa41('0x33')][_0xaa41('0x35')]?_0x1ed366[_0xaa41('0x33')]:_0x215896[_0xaa41('0x36')];if(_0x87e2f4[_0xaa41('0x30')][_0xaa41('0x41')]){_0x1ed366[_0xaa41('0x45')]=[{'all':!![]}];}_0x1ed366=_[_0xaa41('0x3d')]({},_0x1ed366,_0x87e2f4[_0xaa41('0x3f')]);return db['ScreenRecording'][_0xaa41('0x46')](_0x1ed366)[_0xaa41('0x25')](handleEntityNotFound(_0x4f9086,null))[_0xaa41('0x25')](respondWithResult(_0x4f9086,null))[_0xaa41('0x47')](handleError(_0x4f9086,null));};exports[_0xaa41('0x48')]=function(_0x1d6112,_0x538b12){return db[_0xaa41('0x40')][_0xaa41('0x48')](_0x1d6112[_0xaa41('0x49')],{})[_0xaa41('0x25')](respondWithResult(_0x538b12,0xc9))['catch'](handleError(_0x538b12,null));};exports[_0xaa41('0x23')]=function(_0x5787f3,_0x49fedd){if(_0x5787f3[_0xaa41('0x49')]['id']){delete _0x5787f3[_0xaa41('0x49')]['id'];}delete _0x5787f3[_0xaa41('0x49')]['duration'];delete _0x5787f3[_0xaa41('0x49')][_0xaa41('0x4a')];delete _0x5787f3[_0xaa41('0x49')]['closedAt'];delete _0x5787f3[_0xaa41('0x49')][_0xaa41('0x4b')];return db[_0xaa41('0x40')][_0xaa41('0x46')]({'where':{'id':_0x5787f3[_0xaa41('0x44')]['id']}})[_0xaa41('0x25')](handleEntityNotFound(_0x49fedd,null))[_0xaa41('0x25')](saveUpdates(_0x5787f3[_0xaa41('0x49')],null))['then'](respondWithResult(_0x49fedd,null))[_0xaa41('0x47')](handleError(_0x49fedd,null));};exports['describe']=function(_0x5ae65e,_0x1bdcd6){return db[_0xaa41('0x40')][_0xaa41('0x4c')]()[_0xaa41('0x25')](respondWithResult(_0x1bdcd6,null))[_0xaa41('0x47')](handleError(_0x1bdcd6,null));};exports[_0xaa41('0x4d')]=function(_0x48c4c7,_0x3c5082,_0x519e39){var _0xecb54=require(_0xaa41('0x4e'));var _0x1d518f=![];var _0x4f9e92={};if(_0x48c4c7[_0xaa41('0x30')][_0xaa41('0x2c')]&&_0x48c4c7['query'][_0xaa41('0x2c')]===_0xaa41('0x4f')){_0x4f9e92[_0xaa41('0x4f')]=_0x48c4c7['params']['id'];}else{_0x4f9e92['id']=_0x48c4c7[_0xaa41('0x44')]['id'];}return db[_0xaa41('0x40')]['find']({'where':_0x4f9e92,'attributes':['id','value'],'raw':!![]})[_0xaa41('0x25')](handleEntityNotFound(_0x3c5082,null))[_0xaa41('0x25')](function(_0x3a29d2){if(_0x3a29d2){var _0x4d20c6=path[_0xaa41('0x50')](config[_0xaa41('0x51')],_0xaa41('0x52'),_0x3a29d2[_0xaa41('0x4b')]);var _0x2abb78=util['format'](_0xaa41('0x53'),_0x4d20c6);if(fs['existsSync'](_0x2abb78)){_0x1d518f=!![];return _0xecb54['decryptFile'](_0x2abb78,_0x4d20c6,config[_0xaa41('0x54')]['recording'])[_0xaa41('0x25')](function(){return _0x3a29d2;});}return _0x3a29d2;}})[_0xaa41('0x25')](function(_0x169ddf){if(_0x169ddf){var _0x5e83e1=path[_0xaa41('0x50')](config[_0xaa41('0x51')],_0xaa41('0x52'),_0x169ddf[_0xaa41('0x4b')]);if(!fs[_0xaa41('0x55')](_0x5e83e1)){throw new db[(_0xaa41('0x56'))][(_0xaa41('0x57'))](_0xaa41('0x58'));}if(_0x169ddf[_0xaa41('0x59')]){return _0x3c5082['download'](_0x5e83e1,_0x169ddf[_0xaa41('0x59')]+path[_0xaa41('0x5a')](_0x5e83e1),function(){if(_0x1d518f){fs[_0xaa41('0x5b')](_0x5e83e1);}});}else{return _0x3c5082['download'](_0x5e83e1,function(_0x3fe47a){if(_0x1d518f){fs[_0xaa41('0x5b')](_0x5e83e1);}});}}})[_0xaa41('0x47')](function(_0x134579){if(_0x134579[_0xaa41('0x5c')]===_0xaa41('0x58')){_0x3c5082[_0xaa41('0x1a')](0x194)['send']('Not\x20found');}else{return handleError(_0x3c5082,null);}});};exports['destroy']=function(_0x540325,_0x4ec357){return db['ScreenRecording'][_0xaa41('0x46')]({'where':{'id':_0x540325['params']['id']}})['then'](function(_0x24c6f3){if(_[_0xaa41('0x5d')](_0x24c6f3)){throw new ReferenceError(_0xaa41('0x5e'));}return _0x24c6f3;})[_0xaa41('0x25')](function(_0x5cabc4){var _0x244d41=path[_0xaa41('0x50')](config[_0xaa41('0x51')],_0xaa41('0x52'),_0x5cabc4[_0xaa41('0x4b')]);logger[_0xaa41('0x5f')](_0xaa41('0x60'),_0x244d41);if(!_[_0xaa41('0x5d')](_0x5cabc4[_0xaa41('0x4b')])&&fs['existsSync'](_0x244d41)){logger[_0xaa41('0x5f')](_0xaa41('0x61')+_0x244d41+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x244d41);}_0x244d41=_0x244d41+'.cypher';if(!_[_0xaa41('0x5d')](_0x5cabc4['value'])&&fs[_0xaa41('0x55')](_0x244d41)){logger['info'](_0xaa41('0x61')+_0x244d41+_0xaa41('0x62'));fs['unlinkSync'](_0x244d41);}return _0x5cabc4;})[_0xaa41('0x25')](function(_0x33efc5){if(!_0x33efc5)throw new InternalError();return _0x33efc5[_0xaa41('0x24')]();})[_0xaa41('0x25')](function(){_0x4ec357['status'](0xcc)['end']();})[_0xaa41('0x47')](handleError(_0x4ec357,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index df2e849..5597d67 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 _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 +var _0xc2ec=['bluebird','request-promise','path','rimraf','./screenRecording.attributes','exports','define','screen_recordings','interactionid','util','../../config/logger','api','moment'];(function(_0x596975,_0x11f585){var _0x6fdd51=function(_0x57fdcb){while(--_0x57fdcb){_0x596975['push'](_0x596975['shift']());}};_0x6fdd51(++_0x11f585);}(_0xc2ec,0x10d));var _0xcc2e=function(_0xc9ea96,_0x48963a){_0xc9ea96=_0xc9ea96-0x0;var _0x201c20=_0xc2ec[_0xc9ea96];return _0x201c20;};'use strict';var _=require('lodash');var util=require(_0xcc2e('0x0'));var logger=require(_0xcc2e('0x1'))(_0xcc2e('0x2'));var moment=require(_0xcc2e('0x3'));var BPromise=require(_0xcc2e('0x4'));var rp=require(_0xcc2e('0x5'));var fs=require('fs');var path=require(_0xcc2e('0x6'));var rimraf=require(_0xcc2e('0x7'));var config=require('../../config/environment');var attributes=require(_0xcc2e('0x8'));module[_0xcc2e('0x9')]=function(_0x366943,_0x4490f3){return _0x366943[_0xcc2e('0xa')]('ScreenRecording',attributes,{'tableName':_0xcc2e('0xb'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xcc2e('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 74251a4..f0a9d69 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 _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 +var _0x3a20=['../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis'];(function(_0xb2d229,_0x5ba299){var _0xc342d6=function(_0xafe3bc){while(--_0xafe3bc){_0xb2d229['push'](_0xb2d229['shift']());}};_0xc342d6(++_0x5ba299);}(_0x3a20,0x13b));var _0x03a2=function(_0x934528,_0x116b76){_0x934528=_0x934528-0x0;var _0x3eca3f=_0x3a20[_0x934528];return _0x3eca3f;};'use strict';var _=require('lodash');var util=require(_0x03a2('0x0'));var moment=require(_0x03a2('0x1'));var BPromise=require(_0x03a2('0x2'));var rs=require(_0x03a2('0x3'));var fs=require('fs');var Redis=require(_0x03a2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x03a2('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x03a2('0x6'));var jayson=require(_0x03a2('0x7'));var client=jayson[_0x03a2('0x8')][_0x03a2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13c8be,_0x4e1b4e,_0x2f4c27){return new BPromise(function(_0xda8986,_0x4eeb2f){return client[_0x03a2('0xa')](_0x13c8be,_0x2f4c27)[_0x03a2('0xb')](function(_0x320975){logger[_0x03a2('0xc')](_0x03a2('0xd'),_0x4e1b4e,_0x03a2('0xe'));logger[_0x03a2('0xf')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x4e1b4e,_0x03a2('0xe'),JSON[_0x03a2('0x10')](_0x320975));if(_0x320975[_0x03a2('0x11')]){if(_0x320975[_0x03a2('0x11')][_0x03a2('0x12')]===0x1f4){logger[_0x03a2('0x11')](_0x03a2('0xd'),_0x4e1b4e,_0x320975[_0x03a2('0x11')][_0x03a2('0x13')]);return _0x4eeb2f(_0x320975[_0x03a2('0x11')][_0x03a2('0x13')]);}logger[_0x03a2('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x4e1b4e,_0x320975[_0x03a2('0x11')]['message']);return _0xda8986(_0x320975[_0x03a2('0x11')][_0x03a2('0x13')]);}else{logger[_0x03a2('0xc')](_0x03a2('0xd'),_0x4e1b4e,_0x03a2('0xe'));_0xda8986(_0x320975['result'][_0x03a2('0x13')]);}})['catch'](function(_0xcbacca){logger[_0x03a2('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x4e1b4e,_0xcbacca);_0x4eeb2f(_0xcbacca);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index a336b84..f0f1d47 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 _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 +var _0xdb4f=['%s%s','logologin','addLogoLogin','single','favicon','addFavicon','put','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/now','getDate','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','join','root','server/files/images/logos/','format','logo','extname','originalname','post','file','addLogo'];(function(_0x55032d,_0x18d06c){var _0xa349da=function(_0x5c9e90){while(--_0x5c9e90){_0x55032d['push'](_0x55032d['shift']());}};_0xa349da(++_0x18d06c);}(_0xdb4f,0x159));var _0xfdb4=function(_0x2f7c40,_0xb36203){_0x2f7c40=_0x2f7c40-0x0;var _0x57a4a5=_0xdb4f[_0x2f7c40];return _0x57a4a5;};'use strict';var multer=require(_0xfdb4('0x0'));var util=require(_0xfdb4('0x1'));var path=require('path');var timeout=require(_0xfdb4('0x2'));var express=require(_0xfdb4('0x3'));var router=express[_0xfdb4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfdb4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfdb4('0x6'));var controller=require('./setting.controller');router[_0xfdb4('0x7')]('/',auth[_0xfdb4('0x8')](),controller[_0xfdb4('0x9')]);router['get'](_0xfdb4('0xa'),controller[_0xfdb4('0xb')]);router[_0xfdb4('0x7')](_0xfdb4('0xc'),controller['show']);router[_0xfdb4('0x7')](_0xfdb4('0xd'),controller[_0xfdb4('0xe')]);router[_0xfdb4('0x7')](_0xfdb4('0xf'),controller[_0xfdb4('0x10')]);router[_0xfdb4('0x7')](_0xfdb4('0x11'),controller[_0xfdb4('0x12')]);router[_0xfdb4('0x7')](_0xfdb4('0x13'),controller[_0xfdb4('0x14')]);router['get'](_0xfdb4('0x15'),controller['getFavicon']);var upload=multer({'storage':multer[_0xfdb4('0x16')]({'destination':function(_0x1bcfd3,_0x23080c,_0xc2efc5){_0xc2efc5(null,path[_0xfdb4('0x17')](config[_0xfdb4('0x18')],_0xfdb4('0x19')));},'filename':function(_0x2d0c1d,_0x486599,_0xd48158){_0xd48158(null,util[_0xfdb4('0x1a')]('%s%s',_0xfdb4('0x1b'),path[_0xfdb4('0x1c')](_0x486599[_0xfdb4('0x1d')])));}})});router[_0xfdb4('0x1e')](_0xfdb4('0xd'),upload['single'](_0xfdb4('0x1f')),controller[_0xfdb4('0x20')]);var upload=multer({'storage':multer[_0xfdb4('0x16')]({'destination':function(_0x26094f,_0x324f38,_0x4669ac){_0x4669ac(null,path['join'](config[_0xfdb4('0x18')],_0xfdb4('0x19')));},'filename':function(_0x556e3c,_0x4dd700,_0x343203){_0x343203(null,util[_0xfdb4('0x1a')](_0xfdb4('0x21'),_0xfdb4('0x22'),path[_0xfdb4('0x1c')](_0x4dd700[_0xfdb4('0x1d')])));}})});router[_0xfdb4('0x1e')](_0xfdb4('0xf'),upload['single'](_0xfdb4('0x1f')),controller[_0xfdb4('0x23')]);var upload=multer({'storage':multer[_0xfdb4('0x16')]({'destination':function(_0x15980a,_0x102114,_0x1f625a){_0x1f625a(null,path[_0xfdb4('0x17')](config[_0xfdb4('0x18')],_0xfdb4('0x19')));},'filename':function(_0x185166,_0x512047,_0x2c63be){_0x2c63be(null,util['format']('%s%s','preferred',path[_0xfdb4('0x1c')](_0x512047[_0xfdb4('0x1d')])));}})});router[_0xfdb4('0x1e')](_0xfdb4('0x13'),upload[_0xfdb4('0x24')]('file'),controller['addPreferred']);var upload=multer({'storage':multer[_0xfdb4('0x16')]({'destination':function(_0x3d1f1e,_0x4bd31a,_0x2a1a46){_0x2a1a46(null,path[_0xfdb4('0x17')](config['root'],'server/files/images/logos/'));},'filename':function(_0x5beb35,_0x36b5d1,_0x48bb9f){_0x48bb9f(null,util[_0xfdb4('0x1a')](_0xfdb4('0x21'),_0xfdb4('0x25'),path[_0xfdb4('0x1c')](_0x36b5d1[_0xfdb4('0x1d')])));}})});router[_0xfdb4('0x1e')](_0xfdb4('0x15'),upload['single']('file'),controller[_0xfdb4('0x26')]);router[_0xfdb4('0x27')](_0xfdb4('0xc'),auth[_0xfdb4('0x8')](),controller[_0xfdb4('0x28')]);module[_0xfdb4('0x29')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index ec27a33..fff5e16 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(_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 +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x41601c,_0x168fcf){var _0x2c3d23=function(_0x32393f){while(--_0x32393f){_0x41601c['push'](_0x41601c['shift']());}};_0x2c3d23(++_0x168fcf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 e8246e8..d4f35f4 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 _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 +var _0xc560=['favicon','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','zip-dir','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','then','info','Setting,\x20%s,\x20%s','debug','stringify','error','message','result','catch','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','Setting','findAll','rows','show','params','length','body','find','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','getLicense','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','toLower','join','root','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','server/files/images/logos','default','securePassword'];(function(_0x47a385,_0x5d8781){var _0x31abb9=function(_0x210f7a){while(--_0x210f7a){_0x47a385['push'](_0x47a385['shift']());}};_0x31abb9(++_0x5d8781);}(_0xc560,0x82));var _0x0c56=function(_0x22a3c4,_0x2f2160){_0x22a3c4=_0x22a3c4-0x0;var _0x2488e4=_0xc560[_0x22a3c4];return _0x2488e4;};'use strict';var emlformat=require(_0x0c56('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0c56('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0c56('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0c56('0x3'));var util=require(_0x0c56('0x4'));var path=require(_0x0c56('0x5'));var sox=require(_0x0c56('0x6'));var csv=require('to-csv');var ejs=require(_0x0c56('0x7'));var fs=require('fs');var fs_extra=require(_0x0c56('0x8'));var _=require(_0x0c56('0x9'));var squel=require(_0x0c56('0xa'));var crypto=require('crypto');var jsforce=require(_0x0c56('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0c56('0xc'));var querystring=require(_0x0c56('0xd'));var Papa=require(_0x0c56('0xe'));var Redis=require('ioredis');var authService=require(_0x0c56('0xf'));var qs=require(_0x0c56('0x10'));var as=require(_0x0c56('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c56('0x12'))(_0x0c56('0x13'));var utils=require(_0x0c56('0x14'));var config=require(_0x0c56('0x15'));var licenseUtil=require(_0x0c56('0x16'));var db=require(_0x0c56('0x17'))['db'];var jayson=require(_0x0c56('0x18'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2eab48,_0x3220b1,_0x367417,_0x1bc521){return new BPromise(function(_0x2b220b,_0xdc4827){var _0x57e26b=_0x1bc521||client;return _0x57e26b[_0x0c56('0x19')](_0x2eab48,_0x367417)[_0x0c56('0x1a')](function(_0x218fd7){logger[_0x0c56('0x1b')](_0x0c56('0x1c'),_0x3220b1,'request\x20sent');logger[_0x0c56('0x1d')]('Setting,\x20%s,\x20%s,\x20%s',_0x3220b1,'request\x20sent',JSON[_0x0c56('0x1e')](_0x218fd7));if(_0x218fd7['error']){if(_0x218fd7[_0x0c56('0x1f')]['code']===0x1f4){logger['error'](_0x0c56('0x1c'),_0x3220b1,_0x218fd7[_0x0c56('0x1f')][_0x0c56('0x20')]);return _0xdc4827(_0x218fd7[_0x0c56('0x1f')][_0x0c56('0x20')]);}logger[_0x0c56('0x1f')](_0x0c56('0x1c'),_0x3220b1,_0x218fd7[_0x0c56('0x1f')][_0x0c56('0x20')]);return _0x2b220b(_0x218fd7[_0x0c56('0x1f')][_0x0c56('0x20')]);}else{logger[_0x0c56('0x1b')]('Setting,\x20%s,\x20%s',_0x3220b1,'request\x20sent');_0x2b220b(_0x218fd7[_0x0c56('0x21')][_0x0c56('0x20')]);}})[_0x0c56('0x22')](function(_0x12f7a0){logger[_0x0c56('0x1f')]('Setting,\x20%s,\x20%s',_0x3220b1,_0x12f7a0);_0xdc4827(_0x12f7a0);});});}function respondWithStatusCode(_0x39cac2,_0x1b6812){_0x1b6812=_0x1b6812||0xcc;return function(_0x448bad){if(_0x448bad){return _0x39cac2[_0x0c56('0x23')](_0x1b6812);}return _0x39cac2[_0x0c56('0x24')](_0x1b6812)['end']();};}function respondWithResult(_0x2b0c65,_0x58e79d){_0x58e79d=_0x58e79d||0xc8;return function(_0x2b2b07){if(_0x2b2b07){return _0x2b0c65['status'](_0x58e79d)[_0x0c56('0x25')](_0x2b2b07);}};}function respondWithFilteredResult(_0x1f2b4a,_0x885e5c){return function(_0x44d985){if(_0x44d985){var _0x47491=typeof _0x885e5c['offset']===_0x0c56('0x26')&&typeof _0x885e5c['limit']===_0x0c56('0x26');var _0x3a8f23=_0x44d985['count'];var _0x23fd09=_0x47491?0x0:_0x885e5c['offset'];var _0x6acf19=_0x47491?_0x44d985[_0x0c56('0x27')]:_0x885e5c[_0x0c56('0x28')]+_0x885e5c[_0x0c56('0x29')];var _0x3917fb;if(_0x6acf19>=_0x3a8f23){_0x6acf19=_0x3a8f23;_0x3917fb=0xc8;}else{_0x3917fb=0xce;}_0x1f2b4a[_0x0c56('0x24')](_0x3917fb);return _0x1f2b4a[_0x0c56('0x2a')](_0x0c56('0x2b'),_0x23fd09+'-'+_0x6acf19+'/'+_0x3a8f23)['json'](_0x44d985);}return null;};}function patchUpdates(_0x1b3262){return function(_0x10930f){try{jsonpatch['apply'](_0x10930f,_0x1b3262,!![]);}catch(_0x1599b0){return BPromise[_0x0c56('0x2c')](_0x1599b0);}return _0x10930f[_0x0c56('0x2d')]();};}function saveUpdates(_0xa4a241,_0x5c5a41){return function(_0x130278){if(_0x130278){return _0x130278[_0x0c56('0x2e')](_0xa4a241)['then'](function(_0x33b1ca){return _0x33b1ca;});}return null;};}function removeEntity(_0x58ea9e,_0x1fb4c8){return function(_0x199625){if(_0x199625){return _0x199625[_0x0c56('0x2f')]()[_0x0c56('0x1a')](function(){_0x58ea9e[_0x0c56('0x24')](0xcc)[_0x0c56('0x30')]();});}};}function handleEntityNotFound(_0x5a445e,_0x426eb3){return function(_0x24472a){if(!_0x24472a){_0x5a445e['sendStatus'](0x194);}return _0x24472a;};}function handleError(_0x30dd0d,_0xf6c157){_0xf6c157=_0xf6c157||0x1f4;return function(_0x32e3d1){logger[_0x0c56('0x1f')](_0x32e3d1[_0x0c56('0x31')]);if(_0x32e3d1[_0x0c56('0x32')]){delete _0x32e3d1[_0x0c56('0x32')];}_0x30dd0d[_0x0c56('0x24')](_0xf6c157)[_0x0c56('0x33')](_0x32e3d1);};}exports[_0x0c56('0x34')]=function(_0x12aca5,_0x54e7dc){var _0x4a11b6={},_0xf573fe={},_0xa2181c={'count':0x0,'rows':[]};var _0x16fc6f=_[_0x0c56('0x35')](db['Setting'][_0x0c56('0x36')],function(_0x5036ef){return{'name':_0x5036ef[_0x0c56('0x37')],'type':_0x5036ef['type']['key']};});_0xf573fe[_0x0c56('0x38')]=_[_0x0c56('0x35')](_0x16fc6f,'name');_0xf573fe['query']=_[_0x0c56('0x39')](_0x12aca5['query']);_0xf573fe[_0x0c56('0x3a')]=_[_0x0c56('0x3b')](_0xf573fe[_0x0c56('0x38')],_0xf573fe[_0x0c56('0x3c')]);_0x4a11b6[_0x0c56('0x3d')]=_[_0x0c56('0x3b')](_0xf573fe[_0x0c56('0x38')],qs['fields'](_0x12aca5[_0x0c56('0x3c')][_0x0c56('0x3e')]));_0x4a11b6[_0x0c56('0x3d')]=_0x4a11b6['attributes']['length']?_0x4a11b6[_0x0c56('0x3d')]:_0xf573fe[_0x0c56('0x38')];if(!_0x12aca5[_0x0c56('0x3c')][_0x0c56('0x3f')](_0x0c56('0x40'))){_0x4a11b6['limit']=qs[_0x0c56('0x29')](_0x12aca5[_0x0c56('0x3c')]['limit']);_0x4a11b6['offset']=qs[_0x0c56('0x28')](_0x12aca5[_0x0c56('0x3c')]['offset']);}_0x4a11b6[_0x0c56('0x41')]=qs[_0x0c56('0x42')](_0x12aca5[_0x0c56('0x3c')]['sort']);_0x4a11b6[_0x0c56('0x43')]=qs['filters'](_[_0x0c56('0x44')](_0x12aca5['query'],_0xf573fe[_0x0c56('0x3a')]),_0x16fc6f);if(_0x12aca5[_0x0c56('0x3c')][_0x0c56('0x45')]){_0x4a11b6[_0x0c56('0x43')]=_[_0x0c56('0x46')](_0x4a11b6[_0x0c56('0x43')],{'$or':_[_0x0c56('0x35')](_0x16fc6f,function(_0x3015db){if(_0x3015db[_0x0c56('0x47')]!==_0x0c56('0x48')){var _0x12ae86={};_0x12ae86[_0x3015db[_0x0c56('0x32')]]={'$like':'%'+_0x12aca5[_0x0c56('0x3c')][_0x0c56('0x45')]+'%'};return _0x12ae86;}})});}_0x4a11b6=_[_0x0c56('0x46')]({},_0x4a11b6,_0x12aca5[_0x0c56('0x49')]);var _0x5dd815={'where':_0x4a11b6['where']};return db['Setting'][_0x0c56('0x27')](_0x5dd815)[_0x0c56('0x1a')](function(_0x4e1ff6){_0xa2181c[_0x0c56('0x27')]=_0x4e1ff6;if(_0x12aca5['query'][_0x0c56('0x4a')]){_0x4a11b6['include']=[{'all':!![]}];}return db[_0x0c56('0x4b')][_0x0c56('0x4c')](_0x4a11b6);})[_0x0c56('0x1a')](function(_0x447723){_0xa2181c[_0x0c56('0x4d')]=_0x447723;return _0xa2181c;})['then'](respondWithFilteredResult(_0x54e7dc,_0x4a11b6))[_0x0c56('0x22')](handleError(_0x54e7dc,null));};exports[_0x0c56('0x4e')]=function(_0x4bb3ab,_0x496400){var _0x46a62a={'raw':![],'where':{'id':_0x4bb3ab[_0x0c56('0x4f')]['id']}},_0xbcddc2={};_0xbcddc2[_0x0c56('0x38')]=_[_0x0c56('0x39')](db[_0x0c56('0x4b')][_0x0c56('0x36')]);_0xbcddc2[_0x0c56('0x3c')]=_['keys'](_0x4bb3ab[_0x0c56('0x3c')]);_0xbcddc2['filters']=_[_0x0c56('0x3b')](_0xbcddc2[_0x0c56('0x38')],_0xbcddc2[_0x0c56('0x3c')]);_0x46a62a[_0x0c56('0x3d')]=_[_0x0c56('0x3b')](_0xbcddc2['model'],qs[_0x0c56('0x3e')](_0x4bb3ab[_0x0c56('0x3c')]['fields']));_0x46a62a[_0x0c56('0x3d')]=_0x46a62a['attributes'][_0x0c56('0x50')]?_0x46a62a['attributes']:_0xbcddc2[_0x0c56('0x38')];if(_0x4bb3ab[_0x0c56('0x3c')][_0x0c56('0x4a')]){_0x46a62a['include']=[{'all':!![]}];}_0x46a62a=_['merge']({},_0x46a62a,_0x4bb3ab['options']);return db[_0x0c56('0x4b')]['find'](_0x46a62a)['then'](handleEntityNotFound(_0x496400,null))['then'](respondWithResult(_0x496400,null))[_0x0c56('0x22')](handleError(_0x496400,null));};exports['update']=function(_0x26e4e0,_0x1f7711){if(_0x26e4e0['body']['id']){delete _0x26e4e0[_0x0c56('0x51')]['id'];}return db[_0x0c56('0x4b')][_0x0c56('0x52')]({'where':{'id':_0x26e4e0[_0x0c56('0x4f')]['id']}})[_0x0c56('0x1a')](handleEntityNotFound(_0x1f7711,null))[_0x0c56('0x1a')](saveUpdates(_0x26e4e0[_0x0c56('0x51')],null))[_0x0c56('0x1a')](respondWithResult(_0x1f7711,null))[_0x0c56('0x22')](handleError(_0x1f7711,null));};exports[_0x0c56('0x53')]=function(_0x1cda0f,_0x1ba609,_0x39f4d8){if(_0x1cda0f[_0x0c56('0x54')]&&_0x1cda0f[_0x0c56('0x54')][_0x0c56('0x55')]){_0x1cda0f[_0x0c56('0x51')][_0x0c56('0x56')]=_0x1cda0f['file'][_0x0c56('0x55')];}return db[_0x0c56('0x4b')][_0x0c56('0x52')]({'where':{'id':_0x1cda0f[_0x0c56('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1ba609,null))[_0x0c56('0x1a')](saveUpdates(_0x1cda0f[_0x0c56('0x51')],null))[_0x0c56('0x1a')](respondWithResult(_0x1ba609,null))[_0x0c56('0x22')](handleError(_0x1ba609,null));};exports[_0x0c56('0x57')]=function(_0x59c0f4,_0x410fb9,_0x17e459){if(_0x59c0f4[_0x0c56('0x54')]&&_0x59c0f4[_0x0c56('0x54')][_0x0c56('0x55')]){_0x59c0f4[_0x0c56('0x51')][_0x0c56('0x58')]=_0x59c0f4[_0x0c56('0x54')][_0x0c56('0x55')];}return db['Setting'][_0x0c56('0x52')]({'where':{'id':_0x59c0f4[_0x0c56('0x4f')]['id']}})[_0x0c56('0x1a')](handleEntityNotFound(_0x410fb9,null))[_0x0c56('0x1a')](saveUpdates(_0x59c0f4[_0x0c56('0x51')],null))[_0x0c56('0x1a')](respondWithResult(_0x410fb9,null))[_0x0c56('0x22')](handleError(_0x410fb9,null));};var utilLicense=require(_0x0c56('0x16'));exports[_0x0c56('0x59')]=function(_0xfd18eb,_0x53d562,_0xc2e38e){var _0x3d58da='server/files/images/logos';var _0x36c4b1={'custom':![]};return utilLicense[_0x0c56('0x5a')]()[_0x0c56('0x1a')](function(_0x20cc0e){if(_0x20cc0e){_0x36c4b1=_0x20cc0e;}return db[_0x0c56('0x4b')][_0x0c56('0x52')]({'where':{'id':_0xfd18eb[_0x0c56('0x4f')]['id']},'attributes':['logo',_0x0c56('0x58'),_0x0c56('0x5b'),'favicon',_0x0c56('0x5c'),_0x0c56('0x5d'),_0x0c56('0x5e'),_0x0c56('0x5f')],'raw':!![]});})[_0x0c56('0x1a')](handleEntityNotFound(_0x53d562,null))['then'](function(_0x2f2e43){if(_0x2f2e43){var _0x460d21=_0x2f2e43[_0x0c56('0x56')]&&fs[_0x0c56('0x60')](path['join'](config['root'],_0x3d58da,_[_0x0c56('0x61')](_0x2f2e43[_0x0c56('0x56')])))?path[_0x0c56('0x62')](config['root'],_0x3d58da,_[_0x0c56('0x61')](_0x2f2e43[_0x0c56('0x56')])):path[_0x0c56('0x62')](config[_0x0c56('0x63')],_0x3d58da,_[_0x0c56('0x61')]('default_logo.svg'));var _0x3810ce='default'+_[_0x0c56('0x64')]('logo');if(_0x2f2e43[_0x3810ce]||!_0x36c4b1[_0x0c56('0x65')]){_0x460d21=path[_0x0c56('0x62')](config[_0x0c56('0x63')],_0x3d58da,_['toLower']('default_logo.svg'));}if(!fs[_0x0c56('0x60')](_0x460d21)){throw new db[(_0x0c56('0x66'))][(_0x0c56('0x67'))](_[_0x0c56('0x64')](_0x0c56('0x56'))+_0x0c56('0x68'));}return _0x53d562[_0x0c56('0x69')](_0x460d21);}})['catch'](handleError(_0x53d562,null));};var utilLicense=require(_0x0c56('0x16'));exports[_0x0c56('0x6a')]=function(_0x18b6df,_0x43656a,_0x5e92e4){var _0x520263=_0x0c56('0x6b');var _0x23368d={'custom':![]};return utilLicense[_0x0c56('0x5a')]()[_0x0c56('0x1a')](function(_0x255c49){if(_0x255c49){_0x23368d=_0x255c49;}return db[_0x0c56('0x4b')][_0x0c56('0x52')]({'where':{'id':_0x18b6df[_0x0c56('0x4f')]['id']},'attributes':[_0x0c56('0x56'),_0x0c56('0x58'),_0x0c56('0x5b'),'favicon',_0x0c56('0x5c'),_0x0c56('0x5d'),_0x0c56('0x5e'),_0x0c56('0x5f')],'raw':!![]});})[_0x0c56('0x1a')](handleEntityNotFound(_0x43656a,null))[_0x0c56('0x1a')](function(_0xb3f2af){if(_0xb3f2af){var _0x189933=_0xb3f2af['loginLogo']&&fs[_0x0c56('0x60')](path['join'](config[_0x0c56('0x63')],_0x520263,_[_0x0c56('0x61')](_0xb3f2af['loginLogo'])))?path[_0x0c56('0x62')](config[_0x0c56('0x63')],_0x520263,_[_0x0c56('0x61')](_0xb3f2af[_0x0c56('0x58')])):path[_0x0c56('0x62')](config['root'],_0x520263,_['toLower']('default_loginLogo.svg'));var _0x57f818=_0x0c56('0x6c')+_[_0x0c56('0x64')](_0x0c56('0x58'));if(_0xb3f2af[_0x57f818]||!_0x23368d[_0x0c56('0x65')]){_0x189933=path[_0x0c56('0x62')](config[_0x0c56('0x63')],_0x520263,_[_0x0c56('0x61')]('default_loginLogo.svg'));}if(!fs[_0x0c56('0x60')](_0x189933)){throw new db[(_0x0c56('0x66'))]['ValidationError'](_[_0x0c56('0x64')]('loginLogo')+'\x20not\x20found');}return _0x43656a[_0x0c56('0x69')](_0x189933);}})['catch'](handleError(_0x43656a,null));};exports['gdpr']=function(_0x76dd5a,_0x7ece5d){return db['Setting']['find']({'where':{'id':_0x76dd5a[_0x0c56('0x4f')]['id']},'attributes':[_0x0c56('0x6d')]})[_0x0c56('0x1a')](respondWithResult(_0x7ece5d,null))[_0x0c56('0x22')](handleError(_0x7ece5d,null));};exports['addPreferred']=function(_0x2d2629,_0x594fc9,_0x3e43fc){if(_0x2d2629['file']&&_0x2d2629[_0x0c56('0x54')][_0x0c56('0x55')]){_0x2d2629[_0x0c56('0x51')][_0x0c56('0x5b')]=_0x2d2629[_0x0c56('0x54')][_0x0c56('0x55')];}return db['Setting'][_0x0c56('0x52')]({'where':{'id':_0x2d2629['params']['id']}})[_0x0c56('0x1a')](handleEntityNotFound(_0x594fc9,null))['then'](saveUpdates(_0x2d2629[_0x0c56('0x51')],null))[_0x0c56('0x1a')](respondWithResult(_0x594fc9,null))[_0x0c56('0x22')](handleError(_0x594fc9,null));};var utilLicense=require(_0x0c56('0x16'));exports['getPreferred']=function(_0x4d24d7,_0x42ffcd,_0x17889a){var _0x4469f8='server/files/images/logos';var _0x451914={'custom':![]};return utilLicense[_0x0c56('0x5a')]()[_0x0c56('0x1a')](function(_0x759e49){if(_0x759e49){_0x451914=_0x759e49;}return db[_0x0c56('0x4b')][_0x0c56('0x52')]({'where':{'id':_0x4d24d7[_0x0c56('0x4f')]['id']},'attributes':[_0x0c56('0x56'),'loginLogo',_0x0c56('0x5b'),_0x0c56('0x6e'),'defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x42ffcd,null))[_0x0c56('0x1a')](function(_0x3a2514){if(_0x3a2514){var _0x45b70f=_0x3a2514[_0x0c56('0x5b')]&&fs[_0x0c56('0x60')](path[_0x0c56('0x62')](config['root'],_0x4469f8,_['toLower'](_0x3a2514[_0x0c56('0x5b')])))?path[_0x0c56('0x62')](config['root'],_0x4469f8,_[_0x0c56('0x61')](_0x3a2514[_0x0c56('0x5b')])):path[_0x0c56('0x62')](config['root'],_0x4469f8,_[_0x0c56('0x61')](_0x0c56('0x6f')));var _0x48a412=_0x0c56('0x6c')+_[_0x0c56('0x64')]('preferred');if(_0x3a2514[_0x48a412]||!_0x451914['custom']||!_0x451914[_0x0c56('0x5b')]){_0x45b70f=path[_0x0c56('0x62')](config[_0x0c56('0x63')],_0x4469f8,_[_0x0c56('0x61')](_0x0c56('0x6f')));}if(!fs[_0x0c56('0x60')](_0x45b70f)){throw new db['Sequelize'][(_0x0c56('0x67'))](_[_0x0c56('0x64')](_0x0c56('0x5b'))+'\x20not\x20found');}return _0x42ffcd[_0x0c56('0x69')](_0x45b70f);}})['catch'](handleError(_0x42ffcd,null));};exports[_0x0c56('0x70')]=function(_0x18c0db,_0x4e1a9e,_0x22cb46){if(_0x18c0db[_0x0c56('0x54')]&&_0x18c0db['file'][_0x0c56('0x55')]){_0x18c0db['body'][_0x0c56('0x6e')]=_0x18c0db[_0x0c56('0x54')][_0x0c56('0x55')];}return db[_0x0c56('0x4b')][_0x0c56('0x52')]({'where':{'id':_0x18c0db[_0x0c56('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4e1a9e,null))[_0x0c56('0x1a')](saveUpdates(_0x18c0db[_0x0c56('0x51')],null))[_0x0c56('0x1a')](respondWithResult(_0x4e1a9e,null))[_0x0c56('0x22')](handleError(_0x4e1a9e,null));};var utilLicense=require(_0x0c56('0x16'));exports[_0x0c56('0x71')]=function(_0x4348cd,_0x5ea823,_0x4b2bba){var _0x2a4995=_0x0c56('0x6b');var _0x30c73a={'custom':![]};return utilLicense[_0x0c56('0x5a')]()['then'](function(_0x44829b){if(_0x44829b){_0x30c73a=_0x44829b;}return db[_0x0c56('0x4b')]['find']({'where':{'id':_0x4348cd['params']['id']},'attributes':['logo',_0x0c56('0x58'),_0x0c56('0x5b'),'favicon','defaultLogo',_0x0c56('0x5d'),_0x0c56('0x5e'),_0x0c56('0x5f')],'raw':!![]});})[_0x0c56('0x1a')](handleEntityNotFound(_0x5ea823,null))['then'](function(_0x30b9a1){if(_0x30b9a1){var _0x2830f8=_0x30b9a1[_0x0c56('0x6e')]&&fs[_0x0c56('0x60')](path[_0x0c56('0x62')](config[_0x0c56('0x63')],_0x2a4995,_['toLower'](_0x30b9a1['favicon'])))?path['join'](config['root'],_0x2a4995,_[_0x0c56('0x61')](_0x30b9a1[_0x0c56('0x6e')])):path[_0x0c56('0x62')](config[_0x0c56('0x63')],_0x2a4995,_[_0x0c56('0x61')](_0x0c56('0x72')));var _0x3e7daa=_0x0c56('0x6c')+_[_0x0c56('0x64')](_0x0c56('0x6e'));if(_0x30b9a1[_0x3e7daa]||!_0x30c73a[_0x0c56('0x65')]){_0x2830f8=path[_0x0c56('0x62')](config[_0x0c56('0x63')],_0x2a4995,_[_0x0c56('0x61')]('default_favicon.ico'));}if(!fs[_0x0c56('0x60')](_0x2830f8)){throw new db[(_0x0c56('0x66'))][(_0x0c56('0x67'))](_[_0x0c56('0x64')](_0x0c56('0x6e'))+'\x20not\x20found');}return _0x5ea823[_0x0c56('0x69')](_0x2830f8);}})[_0x0c56('0x22')](handleError(_0x5ea823,null));};exports[_0x0c56('0x73')]=function(_0x54cbc2,_0x9f3306){var _0x5df555={'offset':moment()[_0x0c56('0x74')]()};_0x5df555[_0x0c56('0x75')]=moment()[_0x0c56('0x74')](_0x5df555[_0x0c56('0x28')])[_0x0c56('0x76')](_0x0c56('0x77'));return _0x9f3306[_0x0c56('0x24')](0xc8)[_0x0c56('0x33')](_0x5df555);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 560db13..7344f90 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(_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 +var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0x3e74,0x175));var _0x43e7=function(_0x590d82,_0x4beac2){_0x590d82=_0x590d82-0x0;var _0x4fa214=_0x3e74[_0x590d82];return _0x4fa214;};'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 diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 4eac0c4..dcf7bce 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 _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 +var _0xd632=['request','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','Setting,\x20%s,\x20%s','message','catch','ShowSetting','Setting','find','options','raw','where','attributes','include','map','model','stringify','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x37a79c,_0x2b19f0){var _0x561d89=function(_0x19bee3){while(--_0x19bee3){_0x37a79c['push'](_0x37a79c['shift']());}};_0x561d89(++_0x2b19f0);}(_0xd632,0xd5));var _0x2d63=function(_0x35116d,_0x30c8c7){_0x35116d=_0x35116d-0x0;var _0x16b2ab=_0xd632[_0x35116d];return _0x16b2ab;};'use strict';var _=require(_0x2d63('0x0'));var util=require(_0x2d63('0x1'));var moment=require(_0x2d63('0x2'));var BPromise=require(_0x2d63('0x3'));var rs=require(_0x2d63('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2d63('0x5'));var logger=require(_0x2d63('0x6'))('rpc');var config=require(_0x2d63('0x7'));var jayson=require(_0x2d63('0x8'));var client=jayson[_0x2d63('0x9')][_0x2d63('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52c2c9,_0x17f0ab,_0x224664){return new BPromise(function(_0x295af4,_0x4f841b){return client[_0x2d63('0xb')](_0x52c2c9,_0x224664)['then'](function(_0x52ba0d){logger[_0x2d63('0xc')]('Setting,\x20%s,\x20%s',_0x17f0ab,_0x2d63('0xd'));logger[_0x2d63('0xe')](_0x2d63('0xf'),_0x17f0ab,_0x2d63('0xd'),JSON['stringify'](_0x52ba0d));if(_0x52ba0d[_0x2d63('0x10')]){if(_0x52ba0d['error'][_0x2d63('0x11')]===0x1f4){logger[_0x2d63('0x10')](_0x2d63('0x12'),_0x17f0ab,_0x52ba0d[_0x2d63('0x10')][_0x2d63('0x13')]);return _0x4f841b(_0x52ba0d['error'][_0x2d63('0x13')]);}logger[_0x2d63('0x10')]('Setting,\x20%s,\x20%s',_0x17f0ab,_0x52ba0d[_0x2d63('0x10')]['message']);return _0x295af4(_0x52ba0d[_0x2d63('0x10')]['message']);}else{logger[_0x2d63('0xc')](_0x2d63('0x12'),_0x17f0ab,_0x2d63('0xd'));_0x295af4(_0x52ba0d['result'][_0x2d63('0x13')]);}})[_0x2d63('0x14')](function(_0x4065b5){logger['error'](_0x2d63('0x12'),_0x17f0ab,_0x4065b5);_0x4f841b(_0x4065b5);});});}exports[_0x2d63('0x15')]=function(_0x363803){var _0x2db3c2=this;return new Promise(function(_0x52648d,_0x34b42d){return db[_0x2d63('0x16')][_0x2d63('0x17')]({'raw':_0x363803[_0x2d63('0x18')]?_0x363803['options'][_0x2d63('0x19')]===undefined?!![]:![]:!![],'where':_0x363803[_0x2d63('0x18')]?_0x363803[_0x2d63('0x18')][_0x2d63('0x1a')]||null:null,'attributes':_0x363803[_0x2d63('0x18')]?_0x363803[_0x2d63('0x18')][_0x2d63('0x1b')]||null:null,'include':_0x363803['options']?_0x363803[_0x2d63('0x18')][_0x2d63('0x1c')]?_[_0x2d63('0x1d')](_0x363803['options'][_0x2d63('0x1c')],function(_0x13c858){return{'model':db[_0x13c858[_0x2d63('0x1e')]],'as':_0x13c858['as'],'attributes':_0x13c858[_0x2d63('0x1b')],'include':_0x13c858[_0x2d63('0x1c')]?_[_0x2d63('0x1d')](_0x13c858['include'],function(_0x1c2009){return{'model':db[_0x1c2009[_0x2d63('0x1e')]],'as':_0x1c2009['as'],'attributes':_0x1c2009[_0x2d63('0x1b')],'include':_0x1c2009[_0x2d63('0x1c')]?_[_0x2d63('0x1d')](_0x1c2009[_0x2d63('0x1c')],function(_0x5d4f96){return{'model':db[_0x5d4f96[_0x2d63('0x1e')]],'as':_0x5d4f96['as'],'attributes':_0x5d4f96[_0x2d63('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa86127){logger[_0x2d63('0xc')](_0x2d63('0x15'),_0x363803);logger['debug'](_0x2d63('0x15'),_0x363803,JSON[_0x2d63('0x1f')](_0xa86127));_0x52648d(_0xa86127);})['catch'](function(_0x2a5324){logger['error']('ShowSetting',_0x2a5324[_0x2d63('0x13')],_0x363803);_0x34b42d(_0x2db3c2['error'](0x1f4,_0x2a5324[_0x2d63('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index be727e2..c7c5ed6 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_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 +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(_0x5777ca,_0x236c53){var _0x2c0fa7=function(_0x2ad1e7){while(--_0x2ad1e7){_0x5777ca['push'](_0x5777ca['shift']());}};_0x2c0fa7(++_0x236c53);}(_0x7a54,0x106));var _0x47a5=function(_0x388724,_0x337cb5){_0x388724=_0x388724-0x0;var _0x3957e1=_0x7a54[_0x388724];return _0x3957e1;};'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 23c048b..21135c1 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 _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 +var _0xf18b=['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','sequelize','randomstring','exports','STRING','name','generate','twilio','skebby','clicksend','plivo','bandwidth','csc','intelepeer','TEXT'];(function(_0x4713c2,_0x43d974){var _0x3b1705=function(_0x2475da){while(--_0x2475da){_0x4713c2['push'](_0x4713c2['shift']());}};_0x3b1705(++_0x43d974);}(_0xf18b,0x10a));var _0xbf18=function(_0x17967d,_0x48634f){_0x17967d=_0x17967d-0x0;var _0x32576b=_0xf18b[_0x17967d];return _0x32576b;};'use strict';var Sequelize=require(_0xbf18('0x0'));var rs=require(_0xbf18('0x1'));module[_0xbf18('0x2')]={'name':{'type':Sequelize[_0xbf18('0x3')],'unique':_0xbf18('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xbf18('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xbf18('0x3')],'defaultValue':function(){return rs[_0xbf18('0x5')]();}},'phone':{'type':Sequelize[_0xbf18('0x3')]},'type':{'type':Sequelize['ENUM'](_0xbf18('0x6'),_0xbf18('0x7'),'connectel',_0xbf18('0x8'),_0xbf18('0x9'),'clickatell',_0xbf18('0xa'),_0xbf18('0xb'),'infobip',_0xbf18('0xc'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xbf18('0x3')]},'authToken':{'type':Sequelize[_0xbf18('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xbf18('0x3')]},'password':{'type':Sequelize[_0xbf18('0x3')]},'apiKey':{'type':Sequelize[_0xbf18('0x3')]},'applicationId':{'type':Sequelize[_0xbf18('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xbf18('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xbf18('0x3')]},'notificationTemplate':{'type':Sequelize[_0xbf18('0xd')],'defaultValue':function(){return _0xbf18('0xe');}},'notificationSound':{'type':Sequelize[_0xbf18('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbf18('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbf18('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbf18('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbf18('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbf18('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbf18('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xbf18('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbf18('0x10')],'comment':_0xbf18('0x11')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2542bb){if(!_0x2542bb)this[_0xbf18('0x12')](_0xbf18('0x13'),null);this[_0xbf18('0x12')]('mandatoryDisposition',_0x2542bb);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index f9c9d5f..b8df976 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 _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 +var _0xc7c7=['SmsApplication','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','SmsInteraction','List','Contacts','out','SmsMessage','dataValues','Messages','push','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','message_id','status_code','groupName','DELIVERED','clickatell','redif','inspect','infobip','RECEIVED_BY_RECIPIENT','message-delivered','intelepeer','statusGet','state','message-id','csc','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','index','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','SmsAccounts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','SmsAccountId','getDispositions','findOne','Disposition','nolimit','removeDispositions','ids','getAnswers','findAll','removeAnswers','notify','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','messageId','MessageSid','skebby','connectel','clicksend','Text','MessageUUID','results','originatingAddress','bandwidth','text','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','DESC','omit','spread','interaction','autoclose','close','unmanaged','*,*,*,*','created','ContactId','User','UserId','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','waitForTheAssignedQueue','Start','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','send','\x0a','addApplications','sequelize','transaction','Transaction','READ_COMMITTED'];(function(_0x486195,_0x457be4){var _0x2115e6=function(_0x3c90e4){while(--_0x3c90e4){_0x486195['push'](_0x486195['shift']());}};_0x2115e6(++_0x457be4);}(_0xc7c7,0x1e8));var _0x7c7c=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xc7c7[_0x257642];return _0x3d813b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c7c('0x0'));var zipdir=require(_0x7c7c('0x1'));var jsonpatch=require(_0x7c7c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7c7c('0x3'));var Mustache=require(_0x7c7c('0x4'));var util=require(_0x7c7c('0x5'));var path=require(_0x7c7c('0x6'));var sox=require(_0x7c7c('0x7'));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(_0x7c7c('0x8'));var jsforce=require(_0x7c7c('0x9'));var deskjs=require(_0x7c7c('0xa'));var toCsv=require('to-csv');var querystring=require(_0x7c7c('0xb'));var Papa=require(_0x7c7c('0xc'));var Redis=require('ioredis');var authService=require(_0x7c7c('0xd'));var qs=require(_0x7c7c('0xe'));var as=require(_0x7c7c('0xf'));var hardwareService=require(_0x7c7c('0x10'));var logger=require(_0x7c7c('0x11'))(_0x7c7c('0x12'));var utils=require('../../config/utils');var config=require(_0x7c7c('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x7c7c('0x14'))['db'];config['redis']=_[_0x7c7c('0x15')](config['redis'],{'host':_0x7c7c('0x16'),'port':0x18eb});var socket=require(_0x7c7c('0x17'))(new Redis(config['redis']));require(_0x7c7c('0x18'))[_0x7c7c('0x19')](socket);var jayson=require(_0x7c7c('0x1a'));var client=jayson[_0x7c7c('0x1b')][_0x7c7c('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x1e1c59,_0x25892c,_0x47c42b,_0x4b9076){return new BPromise(function(_0x288a8f,_0x2ac54e){var _0x3df1d3=_0x4b9076||client;return _0x3df1d3['request'](_0x1e1c59,_0x47c42b)['then'](function(_0x121c30){logger[_0x7c7c('0x1d')](_0x7c7c('0x1e'),_0x25892c,_0x7c7c('0x1f'));logger['debug'](_0x7c7c('0x20'),_0x25892c,_0x7c7c('0x1f'),JSON['stringify'](_0x121c30));if(_0x121c30[_0x7c7c('0x21')]){if(_0x121c30[_0x7c7c('0x21')][_0x7c7c('0x22')]===0x1f4){logger[_0x7c7c('0x21')](_0x7c7c('0x1e'),_0x25892c,_0x121c30[_0x7c7c('0x21')][_0x7c7c('0x23')]);return _0x2ac54e(_0x121c30['error'][_0x7c7c('0x23')]);}logger[_0x7c7c('0x21')](_0x7c7c('0x1e'),_0x25892c,_0x121c30[_0x7c7c('0x21')][_0x7c7c('0x23')]);return _0x288a8f(_0x121c30['error'][_0x7c7c('0x23')]);}else{logger[_0x7c7c('0x1d')](_0x7c7c('0x1e'),_0x25892c,_0x7c7c('0x1f'));_0x288a8f(_0x121c30[_0x7c7c('0x24')][_0x7c7c('0x23')]);}})[_0x7c7c('0x25')](function(_0x48ea75){logger[_0x7c7c('0x21')](_0x7c7c('0x1e'),_0x25892c,_0x48ea75);_0x2ac54e(_0x48ea75);});});}function respondWithStatusCode(_0x206b5c,_0x2d7172){_0x2d7172=_0x2d7172||0xcc;return function(_0x160fc4){if(_0x160fc4){return _0x206b5c[_0x7c7c('0x26')](_0x2d7172);}return _0x206b5c[_0x7c7c('0x27')](_0x2d7172)[_0x7c7c('0x28')]();};}function respondWithResult(_0x20392a,_0x562e1e){_0x562e1e=_0x562e1e||0xc8;return function(_0x19c619){if(_0x19c619){return _0x20392a['status'](_0x562e1e)['json'](_0x19c619);}};}function respondWithFilteredResult(_0x480441,_0x3a4573){return function(_0x3416ec){if(_0x3416ec){var _0x53f3c6=typeof _0x3a4573[_0x7c7c('0x29')]===_0x7c7c('0x2a')&&typeof _0x3a4573['limit']===_0x7c7c('0x2a');var _0x4426ac=_0x3416ec[_0x7c7c('0x2b')];var _0x502b5a=_0x53f3c6?0x0:_0x3a4573[_0x7c7c('0x29')];var _0x44f7ed=_0x53f3c6?_0x3416ec[_0x7c7c('0x2b')]:_0x3a4573['offset']+_0x3a4573['limit'];var _0x138617;if(_0x44f7ed>=_0x4426ac){_0x44f7ed=_0x4426ac;_0x138617=0xc8;}else{_0x138617=0xce;}_0x480441[_0x7c7c('0x27')](_0x138617);return _0x480441[_0x7c7c('0x2c')](_0x7c7c('0x2d'),_0x502b5a+'-'+_0x44f7ed+'/'+_0x4426ac)[_0x7c7c('0x2e')](_0x3416ec);}return null;};}function patchUpdates(_0xff8fb2){return function(_0x15c7a7){try{jsonpatch[_0x7c7c('0x2f')](_0x15c7a7,_0xff8fb2,!![]);}catch(_0x597e3c){return BPromise[_0x7c7c('0x30')](_0x597e3c);}return _0x15c7a7[_0x7c7c('0x31')]();};}function saveUpdates(_0x308630,_0xce1df9){return function(_0x418142){if(_0x418142){return _0x418142[_0x7c7c('0x32')](_0x308630)[_0x7c7c('0x33')](function(_0x67dd9f){return _0x67dd9f;});}return null;};}function removeEntity(_0x3296f7,_0x47b4ce){return function(_0x3220f2){if(_0x3220f2){return _0x3220f2[_0x7c7c('0x34')]()['then'](function(){var _0x10857c=_0x3220f2['get']({'plain':!![]});var _0x2c57a4='SmsAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x2c57a4,'resourceId':_0x10857c['id']}})[_0x7c7c('0x33')](function(){return _0x3220f2;});})[_0x7c7c('0x33')](function(){_0x3296f7[_0x7c7c('0x27')](0xcc)[_0x7c7c('0x28')]();});}};}function handleEntityNotFound(_0x784d7f,_0x10f374){return function(_0xc962b2){if(!_0xc962b2){_0x784d7f[_0x7c7c('0x26')](0x194);}return _0xc962b2;};}function handleError(_0x385c7d,_0x57670f){_0x57670f=_0x57670f||0x1f4;return function(_0x206693){logger[_0x7c7c('0x21')](_0x206693[_0x7c7c('0x35')]);if(_0x206693[_0x7c7c('0x36')]){delete _0x206693['name'];}_0x385c7d[_0x7c7c('0x27')](_0x57670f)['send'](_0x206693);};}exports[_0x7c7c('0x37')]=function(_0x25b48a,_0x3b5fde){var _0x1d3122={'include':[{'model':db[_0x7c7c('0x38')],'as':_0x7c7c('0x39')}]},_0x1812cb={},_0x1afa10={'count':0x0,'rows':[]};var _0x29af3d=_['map'](db[_0x7c7c('0x3a')][_0x7c7c('0x3b')],function(_0x562c99){return{'name':_0x562c99['fieldName'],'type':_0x562c99[_0x7c7c('0x3c')][_0x7c7c('0x3d')]};});_0x1812cb[_0x7c7c('0x3e')]=_[_0x7c7c('0x3f')](_0x29af3d,_0x7c7c('0x36'));_0x1812cb['query']=_[_0x7c7c('0x40')](_0x25b48a[_0x7c7c('0x41')]);_0x1812cb[_0x7c7c('0x42')]=_['intersection'](_0x1812cb[_0x7c7c('0x3e')],_0x1812cb[_0x7c7c('0x41')]);_0x1d3122['attributes']=_[_0x7c7c('0x43')](_0x1812cb[_0x7c7c('0x3e')],qs['fields'](_0x25b48a['query'][_0x7c7c('0x44')]));_0x1d3122[_0x7c7c('0x45')]=_0x1d3122[_0x7c7c('0x45')][_0x7c7c('0x46')]?_0x1d3122[_0x7c7c('0x45')]:_0x1812cb['model'];if(!_0x25b48a['query'][_0x7c7c('0x47')]('nolimit')){_0x1d3122[_0x7c7c('0x48')]=qs[_0x7c7c('0x48')](_0x25b48a[_0x7c7c('0x41')][_0x7c7c('0x48')]);_0x1d3122['offset']=qs[_0x7c7c('0x29')](_0x25b48a[_0x7c7c('0x41')]['offset']);}_0x1d3122[_0x7c7c('0x49')]=qs['sort'](_0x25b48a[_0x7c7c('0x41')][_0x7c7c('0x4a')]);_0x1d3122[_0x7c7c('0x4b')]=qs['filters'](_[_0x7c7c('0x4c')](_0x25b48a['query'],_0x1812cb[_0x7c7c('0x42')]),_0x29af3d);if(_0x25b48a[_0x7c7c('0x41')][_0x7c7c('0x4d')]){_0x1d3122['where']=_[_0x7c7c('0x4e')](_0x1d3122[_0x7c7c('0x4b')],{'$or':_[_0x7c7c('0x3f')](_0x29af3d,function(_0x1e6957){if(_0x1e6957[_0x7c7c('0x3c')]!=='VIRTUAL'){var _0x2cb1e7={};_0x2cb1e7[_0x1e6957[_0x7c7c('0x36')]]={'$like':'%'+_0x25b48a[_0x7c7c('0x41')][_0x7c7c('0x4d')]+'%'};return _0x2cb1e7;}})});}_0x1d3122=_[_0x7c7c('0x4e')]({},_0x1d3122,_0x25b48a[_0x7c7c('0x4f')]);var _0x13eb59={'where':_0x1d3122['where']};return db[_0x7c7c('0x3a')]['count'](_0x13eb59)[_0x7c7c('0x33')](function(_0x48165a){_0x1afa10['count']=_0x48165a;if(_0x25b48a['query'][_0x7c7c('0x50')]){_0x1d3122[_0x7c7c('0x51')]=[{'all':!![]}];}return db[_0x7c7c('0x3a')]['findAll'](_0x1d3122);})['then'](function(_0x1dbb73){_0x1afa10[_0x7c7c('0x52')]=_0x1dbb73;return _0x1afa10;})[_0x7c7c('0x33')](respondWithFilteredResult(_0x3b5fde,_0x1d3122))['catch'](handleError(_0x3b5fde,null));};exports[_0x7c7c('0x53')]=function(_0x75f229,_0x587141){var _0x13dc80={'raw':![],'where':{'id':_0x75f229['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x424e00={};_0x424e00[_0x7c7c('0x3e')]=_['keys'](db['SmsAccount'][_0x7c7c('0x3b')]);_0x424e00['query']=_[_0x7c7c('0x40')](_0x75f229[_0x7c7c('0x41')]);_0x424e00[_0x7c7c('0x42')]=_['intersection'](_0x424e00['model'],_0x424e00[_0x7c7c('0x41')]);_0x13dc80[_0x7c7c('0x45')]=_[_0x7c7c('0x43')](_0x424e00[_0x7c7c('0x3e')],qs[_0x7c7c('0x44')](_0x75f229[_0x7c7c('0x41')][_0x7c7c('0x44')]));_0x13dc80[_0x7c7c('0x45')]=_0x13dc80[_0x7c7c('0x45')]['length']?_0x13dc80[_0x7c7c('0x45')]:_0x424e00[_0x7c7c('0x3e')];if(_0x75f229[_0x7c7c('0x41')]['includeAll']){_0x13dc80[_0x7c7c('0x51')]=[{'all':!![]}];}_0x13dc80=_[_0x7c7c('0x4e')]({},_0x13dc80,_0x75f229[_0x7c7c('0x4f')]);return db['SmsAccount'][_0x7c7c('0x54')](_0x13dc80)[_0x7c7c('0x33')](handleEntityNotFound(_0x587141,null))[_0x7c7c('0x33')](respondWithResult(_0x587141,null))[_0x7c7c('0x25')](handleError(_0x587141,null));};exports[_0x7c7c('0x55')]=function(_0x542455,_0x21eac5){return db[_0x7c7c('0x3a')][_0x7c7c('0x55')](_0x542455[_0x7c7c('0x56')],{})[_0x7c7c('0x33')](function(_0x56ec3b){var _0x31aff0=_0x542455['user']['get']({'plain':!![]});if(!_0x31aff0)throw new Error(_0x7c7c('0x57'));if(_0x31aff0['role']===_0x7c7c('0x58')){var _0x13d023=_0x56ec3b[_0x7c7c('0x59')]({'plain':!![]});var _0x5eb23c=_0x7c7c('0x5a');return db['UserProfileSection'][_0x7c7c('0x54')]({'where':{'name':_0x5eb23c,'userProfileId':_0x31aff0[_0x7c7c('0x5b')]},'raw':!![]})[_0x7c7c('0x33')](function(_0x5b2f33){if(_0x5b2f33&&_0x5b2f33[_0x7c7c('0x5c')]===0x0){return db[_0x7c7c('0x5d')][_0x7c7c('0x55')]({'name':_0x13d023[_0x7c7c('0x36')],'resourceId':_0x13d023['id'],'type':_0x5b2f33[_0x7c7c('0x36')],'sectionId':_0x5b2f33['id']},{})[_0x7c7c('0x33')](function(){return _0x56ec3b;});}else{return _0x56ec3b;}})['catch'](function(_0xb95294){logger[_0x7c7c('0x21')](_0x7c7c('0x5e'),_0xb95294);throw _0xb95294;});}return _0x56ec3b;})[_0x7c7c('0x33')](respondWithResult(_0x21eac5,0xc9))['catch'](handleError(_0x21eac5,null));};exports[_0x7c7c('0x32')]=function(_0x154493,_0x58887e){if(_0x154493['body']['id']){delete _0x154493['body']['id'];}return db['SmsAccount'][_0x7c7c('0x54')]({'where':{'id':_0x154493[_0x7c7c('0x5f')]['id']},'include':[{'model':db[_0x7c7c('0x38')],'as':_0x7c7c('0x39')}]})[_0x7c7c('0x33')](handleEntityNotFound(_0x58887e,null))[_0x7c7c('0x33')](saveUpdates(_0x154493[_0x7c7c('0x56')],null))[_0x7c7c('0x33')](respondWithResult(_0x58887e,null))[_0x7c7c('0x25')](handleError(_0x58887e,null));};exports[_0x7c7c('0x34')]=function(_0x371ad8,_0x4f1723){return db[_0x7c7c('0x3a')]['find']({'where':{'id':_0x371ad8[_0x7c7c('0x5f')]['id']}})[_0x7c7c('0x33')](handleEntityNotFound(_0x4f1723,null))[_0x7c7c('0x33')](removeEntity(_0x4f1723,null))[_0x7c7c('0x25')](handleError(_0x4f1723,null));};exports[_0x7c7c('0x60')]=function(_0x43d496,_0x1f1daa){return db[_0x7c7c('0x3a')][_0x7c7c('0x60')]()[_0x7c7c('0x33')](respondWithResult(_0x1f1daa,null))[_0x7c7c('0x25')](handleError(_0x1f1daa,null));};exports[_0x7c7c('0x61')]=function(_0x53a039,_0x3b8f24,_0x3d7a09){if(_0x53a039['body']['id']){delete _0x53a039['body']['id'];}return db[_0x7c7c('0x3a')][_0x7c7c('0x54')]({'where':{'id':_0x53a039[_0x7c7c('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3b8f24,null))['then'](function(_0x28f1db){if(_0x28f1db){_0x53a039[_0x7c7c('0x56')][_0x7c7c('0x62')]=_0x28f1db['id'];return db['Disposition'][_0x7c7c('0x55')](_0x53a039[_0x7c7c('0x56')]);}})['then'](respondWithResult(_0x3b8f24,null))['catch'](handleError(_0x3b8f24,null));};exports[_0x7c7c('0x63')]=function(_0x41b615,_0x323f27,_0xca5997){var _0x225dd4={'raw':![],'where':{}};var _0x383fcd={};var _0x47551b={'count':0x0,'rows':[]};return db[_0x7c7c('0x3a')][_0x7c7c('0x64')]({'where':{'id':_0x41b615[_0x7c7c('0x5f')]['id']}})[_0x7c7c('0x33')](handleEntityNotFound(_0x323f27,null))[_0x7c7c('0x33')](function(_0x161a4d){if(_0x161a4d){_0x383fcd[_0x7c7c('0x3e')]=_[_0x7c7c('0x40')](db[_0x7c7c('0x65')][_0x7c7c('0x3b')]);_0x383fcd[_0x7c7c('0x41')]=_[_0x7c7c('0x40')](_0x41b615[_0x7c7c('0x41')]);_0x383fcd[_0x7c7c('0x42')]=_[_0x7c7c('0x43')](_0x383fcd[_0x7c7c('0x3e')],_0x383fcd[_0x7c7c('0x41')]);_0x225dd4[_0x7c7c('0x45')]=_[_0x7c7c('0x43')](_0x383fcd['model'],qs[_0x7c7c('0x44')](_0x41b615[_0x7c7c('0x41')][_0x7c7c('0x44')]));_0x225dd4['attributes']=_0x225dd4['attributes'][_0x7c7c('0x46')]?_0x225dd4['attributes']:_0x383fcd['model'];if(!_0x41b615[_0x7c7c('0x41')]['hasOwnProperty'](_0x7c7c('0x66'))){_0x225dd4[_0x7c7c('0x48')]=qs[_0x7c7c('0x48')](_0x41b615[_0x7c7c('0x41')][_0x7c7c('0x48')]);_0x225dd4[_0x7c7c('0x29')]=qs[_0x7c7c('0x29')](_0x41b615[_0x7c7c('0x41')][_0x7c7c('0x29')]);}_0x225dd4['order']=qs[_0x7c7c('0x4a')](_0x41b615[_0x7c7c('0x41')][_0x7c7c('0x4a')]);_0x225dd4[_0x7c7c('0x4b')]=qs[_0x7c7c('0x42')](_[_0x7c7c('0x4c')](_0x41b615[_0x7c7c('0x41')],_0x383fcd['filters']));_0x225dd4[_0x7c7c('0x4b')][_0x7c7c('0x62')]=_0x161a4d['id'];if(_0x41b615['query']['filter']){_0x225dd4[_0x7c7c('0x4b')]=_[_0x7c7c('0x4e')](_0x225dd4['where'],{'$or':_[_0x7c7c('0x3f')](_0x225dd4[_0x7c7c('0x45')],function(_0x22bf72){var _0x3e8c3f={};_0x3e8c3f[_0x22bf72]={'$like':'%'+_0x41b615[_0x7c7c('0x41')][_0x7c7c('0x4d')]+'%'};return _0x3e8c3f;})});}_0x225dd4=_[_0x7c7c('0x4e')]({},_0x225dd4,_0x41b615[_0x7c7c('0x4f')]);return db[_0x7c7c('0x65')]['count']({'where':_0x225dd4[_0x7c7c('0x4b')]})[_0x7c7c('0x33')](function(_0x4f60d0){_0x47551b[_0x7c7c('0x2b')]=_0x4f60d0;if(_0x41b615['query']['includeAll']){_0x225dd4[_0x7c7c('0x51')]=[{'all':!![]}];}return db[_0x7c7c('0x65')]['findAll'](_0x225dd4);})[_0x7c7c('0x33')](function(_0x503887){_0x47551b[_0x7c7c('0x52')]=_0x503887;return _0x47551b;});}})[_0x7c7c('0x33')](respondWithFilteredResult(_0x323f27,_0x225dd4))[_0x7c7c('0x25')](handleError(_0x323f27,null));};exports[_0x7c7c('0x67')]=function(_0x2862cc,_0x1ff8f4,_0x2d415c){return db[_0x7c7c('0x3a')]['find']({'where':{'id':_0x2862cc[_0x7c7c('0x5f')]['id']}})[_0x7c7c('0x33')](handleEntityNotFound(_0x1ff8f4,null))['then'](function(_0x39f765){if(_0x39f765){return _0x39f765['removeDispositions'](_0x2862cc['query'][_0x7c7c('0x68')]);}})[_0x7c7c('0x33')](respondWithStatusCode(_0x1ff8f4,null))['catch'](handleError(_0x1ff8f4,null));};exports['addAnswer']=function(_0x5971ef,_0x46700a,_0x188a51){if(_0x5971ef[_0x7c7c('0x56')]['id']){delete _0x5971ef[_0x7c7c('0x56')]['id'];}return db['SmsAccount'][_0x7c7c('0x54')]({'where':{'id':_0x5971ef[_0x7c7c('0x5f')]['id']}})['then'](handleEntityNotFound(_0x46700a,null))[_0x7c7c('0x33')](function(_0x35f5d0){if(_0x35f5d0){_0x5971ef[_0x7c7c('0x56')][_0x7c7c('0x62')]=_0x35f5d0['id'];return db['CannedAnswer'][_0x7c7c('0x55')](_0x5971ef['body']);}})[_0x7c7c('0x33')](respondWithResult(_0x46700a,null))[_0x7c7c('0x25')](handleError(_0x46700a,null));};exports[_0x7c7c('0x69')]=function(_0x14997b,_0x2c44b8,_0x329949){var _0x37e64e={'raw':![],'where':{}};var _0x5a091a={};var _0x5e7aae={'count':0x0,'rows':[]};return db[_0x7c7c('0x3a')]['findOne']({'where':{'id':_0x14997b[_0x7c7c('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2c44b8,null))[_0x7c7c('0x33')](function(_0x5ba979){if(_0x5ba979){_0x5a091a[_0x7c7c('0x3e')]=_[_0x7c7c('0x40')](db['CannedAnswer']['rawAttributes']);_0x5a091a[_0x7c7c('0x41')]=_[_0x7c7c('0x40')](_0x14997b[_0x7c7c('0x41')]);_0x5a091a[_0x7c7c('0x42')]=_[_0x7c7c('0x43')](_0x5a091a[_0x7c7c('0x3e')],_0x5a091a[_0x7c7c('0x41')]);_0x37e64e[_0x7c7c('0x45')]=_[_0x7c7c('0x43')](_0x5a091a[_0x7c7c('0x3e')],qs[_0x7c7c('0x44')](_0x14997b['query']['fields']));_0x37e64e[_0x7c7c('0x45')]=_0x37e64e[_0x7c7c('0x45')]['length']?_0x37e64e[_0x7c7c('0x45')]:_0x5a091a[_0x7c7c('0x3e')];if(!_0x14997b[_0x7c7c('0x41')][_0x7c7c('0x47')](_0x7c7c('0x66'))){_0x37e64e[_0x7c7c('0x48')]=qs[_0x7c7c('0x48')](_0x14997b[_0x7c7c('0x41')]['limit']);_0x37e64e[_0x7c7c('0x29')]=qs['offset'](_0x14997b['query'][_0x7c7c('0x29')]);}_0x37e64e['order']=qs[_0x7c7c('0x4a')](_0x14997b['query'][_0x7c7c('0x4a')]);_0x37e64e[_0x7c7c('0x4b')]=qs[_0x7c7c('0x42')](_[_0x7c7c('0x4c')](_0x14997b[_0x7c7c('0x41')],_0x5a091a[_0x7c7c('0x42')]));_0x37e64e['where'][_0x7c7c('0x62')]=_0x5ba979['id'];if(_0x14997b[_0x7c7c('0x41')][_0x7c7c('0x4d')]){_0x37e64e[_0x7c7c('0x4b')]=_['merge'](_0x37e64e[_0x7c7c('0x4b')],{'$or':_[_0x7c7c('0x3f')](_0x37e64e[_0x7c7c('0x45')],function(_0x281115){var _0x45ee06={};_0x45ee06[_0x281115]={'$like':'%'+_0x14997b[_0x7c7c('0x41')][_0x7c7c('0x4d')]+'%'};return _0x45ee06;})});}_0x37e64e=_[_0x7c7c('0x4e')]({},_0x37e64e,_0x14997b[_0x7c7c('0x4f')]);return db['CannedAnswer'][_0x7c7c('0x2b')]({'where':_0x37e64e[_0x7c7c('0x4b')]})[_0x7c7c('0x33')](function(_0x4d58b6){_0x5e7aae['count']=_0x4d58b6;if(_0x14997b[_0x7c7c('0x41')]['includeAll']){_0x37e64e[_0x7c7c('0x51')]=[{'all':!![]}];}return db['CannedAnswer'][_0x7c7c('0x6a')](_0x37e64e);})[_0x7c7c('0x33')](function(_0x1bee60){_0x5e7aae[_0x7c7c('0x52')]=_0x1bee60;return _0x5e7aae;});}})[_0x7c7c('0x33')](respondWithFilteredResult(_0x2c44b8,_0x37e64e))['catch'](handleError(_0x2c44b8,null));};exports[_0x7c7c('0x6b')]=function(_0x3d6881,_0x16fb09,_0x49563f){return db['SmsAccount'][_0x7c7c('0x54')]({'where':{'id':_0x3d6881['params']['id']}})[_0x7c7c('0x33')](handleEntityNotFound(_0x16fb09,null))[_0x7c7c('0x33')](function(_0x26626d){if(_0x26626d){return _0x26626d[_0x7c7c('0x6b')](_0x3d6881[_0x7c7c('0x41')][_0x7c7c('0x68')]);}})[_0x7c7c('0x33')](respondWithStatusCode(_0x16fb09,null))['catch'](handleError(_0x16fb09,null));};exports[_0x7c7c('0x6c')]=function(_0x5f32d5,_0x3f38f6,_0x4d1697){var _0x1fe00e={'channel':'sms'};var _0x1745bd=[];var _0x2fb2b9=[];var _0x3d9647={};return db['SmsAccount'][_0x7c7c('0x54')]({'where':{'id':_0x5f32d5[_0x7c7c('0x5f')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x7c7c('0x6d')}]})[_0x7c7c('0x33')](handleEntityNotFound(_0x3f38f6,null))[_0x7c7c('0x33')](function(_0x985740){_0x1fe00e[_0x7c7c('0x6e')]=_0x985740;_0x1fe00e[_0x7c7c('0x6f')]=_[_0x7c7c('0x70')](_0x985740[_0x7c7c('0x6d')],[_0x7c7c('0x71')],[_0x7c7c('0x72')]);if(_0x1fe00e['account'][_0x7c7c('0x6d')]){delete _0x1fe00e[_0x7c7c('0x6e')][_0x7c7c('0x6d')];}return db[_0x7c7c('0x73')][_0x7c7c('0x60')]();})['then'](function(_0x55aed9){if(!_0x55aed9){throw new db[(_0x7c7c('0x74'))][(_0x7c7c('0x75'))](_0x7c7c('0x76'));}_0x1745bd=_[_0x7c7c('0x77')](_[_0x7c7c('0x40')](_0x55aed9),[_0x7c7c('0x78'),_0x7c7c('0x79')]);_0x2fb2b9=_[_0x7c7c('0x77')](_[_0x7c7c('0x40')](_0x55aed9),[_0x7c7c('0x78'),'updatedAt',_0x7c7c('0x7a'),_0x7c7c('0x7b')]);_0x1fe00e[_0x7c7c('0x56')]={'mapKey':_0x7c7c('0x7c')};if(_0x1fe00e['account'][_0x7c7c('0x3c')]){switch(_0x1fe00e['account'][_0x7c7c('0x3c')]){case _0x7c7c('0x7d'):_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x7e')]=_0x5f32d5[_0x7c7c('0x56')][_0x7c7c('0x7f')];_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x56')]=_0x5f32d5[_0x7c7c('0x56')]['Body'];_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x80')]=_0x5f32d5[_0x7c7c('0x56')][_0x7c7c('0x81')];break;case _0x7c7c('0x82'):_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x7e')]='+'+_0x5f32d5[_0x7c7c('0x56')]['sender'];_0x1fe00e['body'][_0x7c7c('0x56')]=_0x5f32d5[_0x7c7c('0x56')]['text'];break;case _0x7c7c('0x83'):_0x1fe00e['body'][_0x7c7c('0x7e')]=_0x5f32d5['body'][_0x7c7c('0x7e')];_0x1fe00e['body']['body']=_0x5f32d5[_0x7c7c('0x56')][_0x7c7c('0x23')];break;case _0x7c7c('0x84'):_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x7e')]=_0x5f32d5[_0x7c7c('0x56')][_0x7c7c('0x7e')];_0x1fe00e[_0x7c7c('0x56')]['body']=_0x5f32d5[_0x7c7c('0x56')][_0x7c7c('0x56')];_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x80')]=_0x5f32d5[_0x7c7c('0x56')]['message_id'];break;case'plivo':_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x7e')]=_0x5f32d5[_0x7c7c('0x56')][_0x7c7c('0x7f')];_0x1fe00e[_0x7c7c('0x56')]['body']=_0x5f32d5[_0x7c7c('0x56')][_0x7c7c('0x85')];_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x80')]=_0x5f32d5['body'][_0x7c7c('0x86')];break;case'infobip':_0x1fe00e['body'][_0x7c7c('0x7e')]='+'+_0x5f32d5['body'][_0x7c7c('0x87')][0x0]['from'];_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x56')]=_0x5f32d5[_0x7c7c('0x56')][_0x7c7c('0x87')][0x0]['text'];_0x1fe00e['body'][_0x7c7c('0x80')]=_0x5f32d5[_0x7c7c('0x56')][_0x7c7c('0x87')][0x0][_0x7c7c('0x80')];break;case'csc':_0x1fe00e[_0x7c7c('0x56')]['from']=_0x5f32d5[_0x7c7c('0x56')][_0x7c7c('0x88')];_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x56')]=_0x5f32d5['body']['segmentedMessage'][_0x7c7c('0x23')];break;case'clickatell':_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x7e')]=_0x5f32d5[_0x7c7c('0x56')]['fromNumber'];_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x56')]=_0x5f32d5[_0x7c7c('0x56')]['text'];_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x80')]=_0x5f32d5[_0x7c7c('0x56')]['replyMessageId'];break;case _0x7c7c('0x89'):_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x80')]=_0x5f32d5['body'][0x0]['message']['id'];_0x1fe00e[_0x7c7c('0x56')]['from']=_0x5f32d5[_0x7c7c('0x56')][0x0][_0x7c7c('0x23')][_0x7c7c('0x7e')];_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x56')]=_0x5f32d5[_0x7c7c('0x56')][0x0]['message'][_0x7c7c('0x8a')];break;case'intelepeer':_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x7e')]=_0x5f32d5['body']['from'];_0x1fe00e['body'][_0x7c7c('0x56')]=_0x5f32d5[_0x7c7c('0x56')]['message'];_0x1fe00e['body']['messageId']=_0x5f32d5['body']['refid'];break;}}if(_0x1fe00e[_0x7c7c('0x56')]['id']){delete _0x1fe00e[_0x7c7c('0x56')]['id'];}if(_[_0x7c7c('0x8b')](_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x7e')])){throw new db[(_0x7c7c('0x74'))][(_0x7c7c('0x75'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x1fe00e['body'][_0x7c7c('0x56')])||_0x1fe00e[_0x7c7c('0x56')]['body']===''){throw new db[(_0x7c7c('0x74'))][(_0x7c7c('0x75'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7c7c('0x8b')](_0x1fe00e['body']['mapKey'])){throw new db['Sequelize'][(_0x7c7c('0x75'))](_0x7c7c('0x8c')+_0x2fb2b9);}if(!_['includes'](_0x2fb2b9,_0x1fe00e['body'][_0x7c7c('0x8d')])){throw new db[(_0x7c7c('0x74'))][(_0x7c7c('0x75'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2fb2b9);}_0x3d9647[_0x1fe00e['body'][_0x7c7c('0x8d')]]=_0x1fe00e['body'][_0x7c7c('0x7e')];return db[_0x7c7c('0x8e')][_0x7c7c('0x54')]({'where':{'id':_0x1fe00e[_0x7c7c('0x6e')][_0x7c7c('0x7b')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x3d9647,'limit':0x1,'order':[[_0x7c7c('0x79'),_0x7c7c('0x8f')]]}]});})[_0x7c7c('0x33')](handleEntityNotFound(_0x3f38f6,null))[_0x7c7c('0x33')](function(_0x4f8365){if(_0x4f8365){_0x1fe00e['list']=_[_0x7c7c('0x90')](_0x4f8365,['Contacts']);if(_0x4f8365['Contacts'][_0x7c7c('0x46')]){return _0x4f8365['Contacts'][0x0];}var _0x48187f=_[_0x7c7c('0x15')](_0x1fe00e['body'],{'firstName':_0x1fe00e['body'][_0x7c7c('0x7e')],'ListId':_0x4f8365['id']});_0x48187f[_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x8d')]]=_0x1fe00e[_0x7c7c('0x56')]['from'];return db['CmContact']['create'](_0x48187f,{'fields':_0x1745bd,'raw':!![]});}})[_0x7c7c('0x33')](handleEntityNotFound(_0x3f38f6,null))[_0x7c7c('0x33')](function(_0x879bf6){if(_0x879bf6){_0x1fe00e['contact']=_0x879bf6;var _0x44ad1b={'ContactId':_0x879bf6['id'],'phone':_0x1fe00e[_0x7c7c('0x56')]['from'],'SmsAccountId':_0x5f32d5['params']['id']};var _0x5f28ad={'ContactId':_0x879bf6['id'],'SmsAccountId':_0x5f32d5['params']['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x5f28ad})['then'](function(_0x4d6b1c){if(_0x4d6b1c){return[_0x4d6b1c,![]];}return db['SmsInteraction']['create'](_0x44ad1b)[_0x7c7c('0x33')](function(_0x1d1bae){return[_0x1d1bae,!![]];});});}})[_0x7c7c('0x91')](function(_0xf9822f,_0x198338){_0x1fe00e['interaction']=_0xf9822f[_0x7c7c('0x59')]({'plain':!![]});_0x1fe00e[_0x7c7c('0x92')]['created']=![];if(_0x198338){if(_0x1fe00e[_0x7c7c('0x6e')][_0x7c7c('0x93')]){_0x1fe00e[_0x7c7c('0x6f')]['push']({'id':0x0,'priority':_0x1fe00e[_0x7c7c('0x6f')][_0x7c7c('0x46')]+0x1,'app':_0x7c7c('0x94'),'appdata':_0x7c7c('0x95'),'interval':_0x7c7c('0x96')});}_0x1fe00e['interaction'][_0x7c7c('0x97')]=!![];}return db['SmsMessage'][_0x7c7c('0x55')]({'phone':_0x1fe00e[_0x7c7c('0x56')][_0x7c7c('0x7e')],'messageId':_0x1fe00e[_0x7c7c('0x56')]['messageId'],'body':_0x1fe00e['body'][_0x7c7c('0x56')],'SmsAccountId':_0x5f32d5[_0x7c7c('0x5f')]['id'],'SmsInteractionId':_0xf9822f['id'],'direction':'in','ContactId':_0xf9822f[_0x7c7c('0x98')],'AttachmentId':_0x1fe00e[_0x7c7c('0x56')]['AttachmentId']});})[_0x7c7c('0x33')](function(_0xea7758){_0x1fe00e['message']=_0xea7758;if(!_0x1fe00e['interaction']['UserId'])return;return db[_0x7c7c('0x99')][_0x7c7c('0x54')]({'attributes':['id',_0x7c7c('0x36')],'where':{'id':_0x1fe00e[_0x7c7c('0x92')][_0x7c7c('0x9a')]}});})[_0x7c7c('0x33')](function(_0x572048){if(_0x572048){_0x1fe00e[_0x7c7c('0x6f')][_0x7c7c('0x9b')]({'id':0x0,'priority':0x0,'app':_0x7c7c('0x9c'),'appdata':_0x572048['name']+','+(_0x1fe00e['account'][_0x7c7c('0x9d')]||0xa),'interval':'*,*,*,*'});}if(!_0x1fe00e[_0x7c7c('0x92')][_0x7c7c('0x9e')])return;return db[_0x7c7c('0x9f')][_0x7c7c('0x54')]({'attributes':['id','name'],'where':{'id':_0x1fe00e['interaction'][_0x7c7c('0x9e')]}});})['then'](function(_0xa54b3e){if(_0xa54b3e){_0x1fe00e['applications'][_0x7c7c('0x9b')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0xa54b3e[_0x7c7c('0x36')]+','+(_0x1fe00e[_0x7c7c('0x6e')][_0x7c7c('0xa0')]||0x12c),'interval':_0x7c7c('0x96')});}return respondWithRpcPromise(_0x7c7c('0xa1'),'startRouting',_0x1fe00e);})[_0x7c7c('0x33')](function(_0x41c7ec){if(_0x41c7ec){var _0x2a0931=0xc8;var _0x1d9506=_0x7c7c('0xa2');logger[_0x7c7c('0x1d')](_0x7c7c('0x20'),_0x1d9506,_0x2a0931,_0x7c7c('0xa3'));logger['debug'](_0x7c7c('0xa4'),_0x1d9506,_0x2a0931,_0x7c7c('0xa3'),JSON[_0x7c7c('0xa5')](_0x41c7ec));if(_0x1fe00e[_0x7c7c('0x6e')][_0x7c7c('0x3c')]===_0x7c7c('0x7d')){return _0x3f38f6[_0x7c7c('0x27')](_0x2a0931)['set'](_0x7c7c('0xa6'),_0x7c7c('0xa7'))[_0x7c7c('0xa8')](_0x7c7c('0xa9'));}else{return _0x3f38f6[_0x7c7c('0x27')](_0x2a0931)[_0x7c7c('0x2e')](_0x41c7ec);}}})[_0x7c7c('0x25')](handleError(_0x3f38f6,null));};exports[_0x7c7c('0xaa')]=function(_0x1d21f4,_0x1631aa){var _0x581cec=_0x1d21f4[_0x7c7c('0x5f')]['id'];var _0x4354af=_0x1d21f4[_0x7c7c('0x56')];var _0x24e160=0xc8;var _0x22f21b=null;return db[_0x7c7c('0xab')][_0x7c7c('0xac')]({'isolationLevel':db[_0x7c7c('0xab')][_0x7c7c('0xad')]['ISOLATION_LEVELS'][_0x7c7c('0xae')]},function(_0x39791d){return db[_0x7c7c('0x3a')][_0x7c7c('0x64')]({'where':{'id':_0x581cec},'transaction':_0x39791d})[_0x7c7c('0x33')](function(_0x38687a){if(_0x38687a){return db[_0x7c7c('0xaf')][_0x7c7c('0x34')]({'where':{'SmsAccountId':_0x581cec},'transaction':_0x39791d})[_0x7c7c('0x33')](function(){var _0x3e521f=_[_0x7c7c('0x3f')](_0x4354af,function(_0x23c127){_0x23c127[_0x7c7c('0x62')]=_0x581cec;return _0x23c127;});return db[_0x7c7c('0xaf')][_0x7c7c('0xb0')](_0x3e521f,{'transaction':_0x39791d});});}else{_0x24e160=0x194;_0x22f21b=[];}});})['then'](function(){if(_0x24e160!==0x194){return db[_0x7c7c('0xaf')][_0x7c7c('0xb1')]({'where':{'SmsAccountId':_0x581cec},'order':_0x7c7c('0x71')})[_0x7c7c('0x33')](function(_0x50e31c){_0x22f21b=_0x50e31c;});}})[_0x7c7c('0x25')](function(_0x365ed3){_0x24e160=0x1f4;logger[_0x7c7c('0x21')](_0x365ed3[_0x7c7c('0x35')]);if(_0x365ed3[_0x7c7c('0x36')]){delete _0x365ed3[_0x7c7c('0x36')];}_0x22f21b=_0x365ed3;})['finally'](function(){if(_0x22f21b===null){_0x1631aa[_0x7c7c('0x26')](_0x24e160);}else{if(_0x24e160===0x1f4){_0x1631aa[_0x7c7c('0x27')](_0x24e160)['send'](_0x22f21b);}else{_0x1631aa['status'](_0x24e160)['json'](_0x22f21b);}}});};exports[_0x7c7c('0xb2')]=function(_0x3ac3e2,_0x59018a,_0x1c5d96){var _0x3e43ea={};var _0xdf1452={};var _0x5bb65f;var _0x39952f;return db[_0x7c7c('0x3a')][_0x7c7c('0x64')]({'where':{'id':_0x3ac3e2[_0x7c7c('0x5f')]['id']}})[_0x7c7c('0x33')](handleEntityNotFound(_0x59018a,null))[_0x7c7c('0x33')](function(_0x232d4a){if(_0x232d4a){_0x5bb65f=_0x232d4a;_0xdf1452['model']=_[_0x7c7c('0x40')](db[_0x7c7c('0xaf')][_0x7c7c('0x3b')]);_0xdf1452[_0x7c7c('0x41')]=_[_0x7c7c('0x40')](_0x3ac3e2[_0x7c7c('0x41')]);_0xdf1452['filters']=_[_0x7c7c('0x43')](_0xdf1452[_0x7c7c('0x3e')],_0xdf1452[_0x7c7c('0x41')]);_0x3e43ea[_0x7c7c('0x45')]=_[_0x7c7c('0x43')](_0xdf1452['model'],qs[_0x7c7c('0x44')](_0x3ac3e2['query'][_0x7c7c('0x44')]));_0x3e43ea[_0x7c7c('0x45')]=_0x3e43ea['attributes']['length']?_0x3e43ea['attributes']:_0xdf1452[_0x7c7c('0x3e')];_0x3e43ea[_0x7c7c('0x49')]=qs[_0x7c7c('0x4a')](_0x3ac3e2['query'][_0x7c7c('0x4a')]);_0x3e43ea[_0x7c7c('0x4b')]=qs[_0x7c7c('0x42')](_[_0x7c7c('0x4c')](_0x3ac3e2['query'],_0xdf1452[_0x7c7c('0x42')]));if(_0x3ac3e2[_0x7c7c('0x41')][_0x7c7c('0x4d')]){_0x3e43ea[_0x7c7c('0x4b')]=_[_0x7c7c('0x4e')](_0x3e43ea[_0x7c7c('0x4b')],{'$or':_[_0x7c7c('0x3f')](_0x3e43ea[_0x7c7c('0x45')],function(_0x4ee8a4){var _0x5c5757={};_0x5c5757[_0x4ee8a4]={'$like':'%'+_0x3ac3e2[_0x7c7c('0x41')]['filter']+'%'};return _0x5c5757;})});}_0x3e43ea=_[_0x7c7c('0x4e')]({},_0x3e43ea,_0x3ac3e2[_0x7c7c('0x4f')]);return _0x5bb65f[_0x7c7c('0xb2')](_0x3e43ea);}})[_0x7c7c('0x33')](function(_0x174950){if(_0x174950){_0x39952f=_0x174950[_0x7c7c('0x46')];if(!_0x3ac3e2[_0x7c7c('0x41')][_0x7c7c('0x47')]('nolimit')){_0x3e43ea[_0x7c7c('0x48')]=qs['limit'](_0x3ac3e2[_0x7c7c('0x41')][_0x7c7c('0x48')]);_0x3e43ea[_0x7c7c('0x29')]=qs[_0x7c7c('0x29')](_0x3ac3e2['query'][_0x7c7c('0x29')]);}return _0x5bb65f[_0x7c7c('0xb2')](_0x3e43ea);}})[_0x7c7c('0x33')](function(_0x40e3f1){if(_0x40e3f1){return _0x40e3f1?{'count':_0x39952f,'rows':_0x40e3f1}:null;}})[_0x7c7c('0x33')](respondWithResult(_0x59018a,null))[_0x7c7c('0x25')](handleError(_0x59018a,null));};exports[_0x7c7c('0xb3')]=function(_0x1ec7df,_0xb0202d,_0x265f63){var _0x3daad5={'raw':![],'where':{}};var _0x417604={};var _0x301ca2={'count':0x0,'rows':[]};return db[_0x7c7c('0x3a')]['findOne']({'where':{'id':_0x1ec7df[_0x7c7c('0x5f')]['id']}})[_0x7c7c('0x33')](handleEntityNotFound(_0xb0202d,null))[_0x7c7c('0x33')](function(_0x548b7e){if(_0x548b7e){_0x417604[_0x7c7c('0x3e')]=_['keys'](db['SmsInteraction'][_0x7c7c('0x3b')]);_0x417604[_0x7c7c('0x41')]=_[_0x7c7c('0x40')](_0x1ec7df[_0x7c7c('0x41')]);_0x417604['filters']=_[_0x7c7c('0x43')](_0x417604['model'],_0x417604[_0x7c7c('0x41')]);_0x3daad5[_0x7c7c('0x45')]=_[_0x7c7c('0x43')](_0x417604['model'],qs[_0x7c7c('0x44')](_0x1ec7df[_0x7c7c('0x41')]['fields']));_0x3daad5[_0x7c7c('0x45')]=_0x3daad5[_0x7c7c('0x45')][_0x7c7c('0x46')]?_0x3daad5['attributes']:_0x417604['model'];if(!_0x1ec7df[_0x7c7c('0x41')][_0x7c7c('0x47')]('nolimit')){_0x3daad5[_0x7c7c('0x48')]=qs[_0x7c7c('0x48')](_0x1ec7df['query'][_0x7c7c('0x48')]);_0x3daad5[_0x7c7c('0x29')]=qs[_0x7c7c('0x29')](_0x1ec7df['query'][_0x7c7c('0x29')]);}_0x3daad5[_0x7c7c('0x49')]=qs[_0x7c7c('0x4a')](_0x1ec7df['query'][_0x7c7c('0x4a')]);_0x3daad5[_0x7c7c('0x4b')]=qs[_0x7c7c('0x42')](_[_0x7c7c('0x4c')](_0x1ec7df[_0x7c7c('0x41')],_0x417604['filters']));_0x3daad5[_0x7c7c('0x4b')][_0x7c7c('0x62')]=_0x548b7e['id'];if(_0x1ec7df[_0x7c7c('0x41')][_0x7c7c('0x4d')]){_0x3daad5[_0x7c7c('0x4b')]=_[_0x7c7c('0x4e')](_0x3daad5['where'],{'$or':_[_0x7c7c('0x3f')](_0x3daad5['attributes'],function(_0x1a3048){var _0x1689c9={};_0x1689c9[_0x1a3048]={'$like':'%'+_0x1ec7df[_0x7c7c('0x41')][_0x7c7c('0x4d')]+'%'};return _0x1689c9;})});}_0x3daad5=_['merge']({},_0x3daad5,_0x1ec7df['options']);return db['SmsInteraction'][_0x7c7c('0x2b')]({'where':_0x3daad5[_0x7c7c('0x4b')]})['then'](function(_0x5a3370){_0x301ca2['count']=_0x5a3370;if(_0x1ec7df['query']['includeAll']){_0x3daad5[_0x7c7c('0x51')]=[{'model':db[_0x7c7c('0x73')],'as':_0x7c7c('0xb4'),'required':![]},{'model':db[_0x7c7c('0x99')],'as':_0x7c7c('0xb5'),'attributes':[_0x7c7c('0x36'),_0x7c7c('0xb6'),_0x7c7c('0xb7')],'required':![]},{'model':db[_0x7c7c('0xb8')],'as':_0x7c7c('0xb9'),'attributes':['id',_0x7c7c('0x36'),'color'],'where':_0x1ec7df[_0x7c7c('0x41')][_0x7c7c('0xba')]?{'id':_0x1ec7df[_0x7c7c('0x41')][_0x7c7c('0xba')]}:undefined,'required':_0x1ec7df[_0x7c7c('0x41')][_0x7c7c('0xba')]?!![]:![]}];}return db[_0x7c7c('0xbb')][_0x7c7c('0x6a')](_0x3daad5);})[_0x7c7c('0x33')](function(_0x2248c7){_0x301ca2[_0x7c7c('0x52')]=_0x2248c7;return _0x301ca2;});}})['then'](respondWithFilteredResult(_0xb0202d,_0x3daad5))[_0x7c7c('0x25')](handleError(_0xb0202d,null));};exports[_0x7c7c('0xa8')]=function(_0x1e7670,_0x492e7a,_0xe46881){var _0x203661,_0x306e93,_0x3eba24;if(_[_0x7c7c('0x8b')](_0x1e7670[_0x7c7c('0x56')][_0x7c7c('0x56')])||_0x1e7670[_0x7c7c('0x56')]['body']===''){throw new db['Sequelize'][(_0x7c7c('0x75'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7c7c('0x8b')](_0x1e7670[_0x7c7c('0x56')]['to'])){throw new db[(_0x7c7c('0x74'))]['ValidationError']('to\x20is\x20mandatory');}_0x203661=_0x1e7670[_0x7c7c('0x56')]['to'];return db[_0x7c7c('0x3a')][_0x7c7c('0x54')]({'where':{'id':_0x1e7670[_0x7c7c('0x5f')]['id']},'include':[{'model':db[_0x7c7c('0x8e')],'as':_0x7c7c('0xbc'),'include':[{'model':db[_0x7c7c('0x73')],'as':_0x7c7c('0xbd'),'where':{'mobile':_0x203661},'limit':0x1,'order':[[_0x7c7c('0x79'),_0x7c7c('0x8f')]]}]}]})['then'](handleEntityNotFound(_0x492e7a,null))[_0x7c7c('0x33')](function(_0x388aa5){if(_0x388aa5&&_0x388aa5[_0x7c7c('0xbc')]){_0x306e93=_0x388aa5[_0x7c7c('0x59')]({'plain':!![]});if(_0x306e93[_0x7c7c('0xbc')]&&_0x306e93[_0x7c7c('0xbc')][_0x7c7c('0xbd')][_0x7c7c('0x46')]){return _0x306e93[_0x7c7c('0xbc')]['Contacts'][0x0];}return db[_0x7c7c('0x73')][_0x7c7c('0x55')](_[_0x7c7c('0x15')](_0x1e7670[_0x7c7c('0x56')],{'firstName':_0x203661,'mobile':_0x203661,'phone':_0x203661,'ListId':_0x306e93[_0x7c7c('0x7b')]}));}})[_0x7c7c('0x33')](handleEntityNotFound(_0x492e7a,null))[_0x7c7c('0x33')](function(_0x584e18){if(_0x584e18){_0x3eba24=_0x584e18;return db[_0x7c7c('0xbb')][_0x7c7c('0x54')]({'where':{'ContactId':_0x3eba24['id'],'closed':![],'SmsAccountId':_0x306e93['id']}})[_0x7c7c('0x33')](function(_0x11a550){if(_0x11a550){return[_0x11a550,![]];}return db['SmsInteraction'][_0x7c7c('0x55')]({'UserId':_0x1e7670[_0x7c7c('0x58')]['id'],'ContactId':_0x3eba24['id'],'SmsAccountId':_0x306e93['id'],'phone':_0x203661,'firstMsgDirection':_0x7c7c('0xbe'),'Messages':[_['merge'](_0x1e7670[_0x7c7c('0x56')],{'read':![],'body':_0x1e7670['body'][_0x7c7c('0x56')],'phone':_0x203661,'SmsAccountId':_0x306e93['id'],'UserId':_0x1e7670[_0x7c7c('0x58')]['id'],'ContactId':_0x3eba24['id']})]},{'include':[{'model':db[_0x7c7c('0xbf')],'as':'Messages'}]})[_0x7c7c('0x33')](function(_0x499fa4){return[_0x499fa4,!![]];});});}})[_0x7c7c('0x91')](function(_0x27239c,_0xe46dde){if(_0xe46dde){return _0x27239c;}return db[_0x7c7c('0xbf')][_0x7c7c('0x55')](_[_0x7c7c('0x4e')](_0x1e7670[_0x7c7c('0x56')],{'read':![],'body':_0x1e7670[_0x7c7c('0x56')][_0x7c7c('0x56')],'phone':_0x203661,'SmsAccountId':_0x306e93['id'],'SmsInteractionId':_0x27239c['id'],'UserId':_0x1e7670[_0x7c7c('0x58')]['id'],'ContactId':_0x3eba24['id']}))[_0x7c7c('0x33')](function(_0x308026){_0x27239c[_0x7c7c('0xc0')][_0x7c7c('0xc1')]=[];_0x27239c[_0x7c7c('0xc0')][_0x7c7c('0xc1')][_0x7c7c('0xc2')](_0x308026[_0x7c7c('0xc0')]);return _0x27239c;});})['then'](respondWithResult(_0x492e7a,null))[_0x7c7c('0x25')](handleError(_0x492e7a,null));};exports[_0x7c7c('0x27')]=function(_0xd442a9,_0x35abe2,_0x41525a){if(_0xd442a9[_0x7c7c('0x56')]['id']){delete _0xd442a9[_0x7c7c('0x56')]['id'];}var _0x495e78,_0xecb2da,_0x3bb6b5;return db[_0x7c7c('0x3a')][_0x7c7c('0x54')]({'where':{'id':_0xd442a9[_0x7c7c('0x5f')]['id']}})[_0x7c7c('0x33')](handleEntityNotFound(_0x35abe2,null))[_0x7c7c('0x33')](function(_0x5bc224){if(_0x5bc224){_0x3bb6b5=_0x5bc224;logger['debug'](_0x7c7c('0x20'),_0x7c7c('0x27'),_0x7c7c('0xc3'),_0x5bc224[_0x7c7c('0x3c')],util['inspect'](_0xd442a9[_0x7c7c('0x56')],{'showHidden':![],'depth':null}));switch(_0x5bc224[_0x7c7c('0x3c')]){case'skebby':if(_0xd442a9['body']['skebby_dispatch_id']&&_0xd442a9[_0x7c7c('0x56')][_0x7c7c('0x27')]){_0xecb2da=_0xd442a9[_0x7c7c('0x56')][_0x7c7c('0x27')];return db['SmsMessage'][_0x7c7c('0x54')]({'where':{'messageId':_0xd442a9[_0x7c7c('0x56')][_0x7c7c('0xc4')]}});}break;case _0x7c7c('0x83'):if(_0xd442a9['body'][_0x7c7c('0xc5')]&&_0xd442a9['body']['statusInt']){_0xecb2da=_0xd442a9[_0x7c7c('0x56')][_0x7c7c('0xc6')];return db[_0x7c7c('0xbf')][_0x7c7c('0x54')]({'where':{'messageId':_0xd442a9['body']['requestid']}});}break;case'clicksend':if(_0xd442a9['body'][_0x7c7c('0xc7')]&&_0xd442a9[_0x7c7c('0x56')]['status_code']){_0xecb2da=_0xd442a9[_0x7c7c('0x56')][_0x7c7c('0xc8')];return db['SmsMessage'][_0x7c7c('0x54')]({'where':{'messageId':_0xd442a9[_0x7c7c('0x56')][_0x7c7c('0xc7')]}});}break;case'infobip':var _0x2f4115=_0xd442a9[_0x7c7c('0x56')][_0x7c7c('0x87')][0x0];if(_0x2f4115['messageId']&&_0x2f4115[_0x7c7c('0x27')][_0x7c7c('0xc9')]===_0x7c7c('0xca')){_0xecb2da=_0x2f4115[_0x7c7c('0x27')][_0x7c7c('0xc9')];return db[_0x7c7c('0xbf')][_0x7c7c('0x54')]({'where':{'messageId':_0x2f4115[_0x7c7c('0x80')]}});}break;case _0x7c7c('0xcb'):if(_0xd442a9['body']['messageId']&&_0xd442a9['body']['status']){_0xecb2da=_0xd442a9[_0x7c7c('0x56')][_0x7c7c('0x27')];return db[_0x7c7c('0xbf')][_0x7c7c('0x54')]({'where':{'messageId':_0xd442a9[_0x7c7c('0x56')][_0x7c7c('0x80')]}});}break;case _0x7c7c('0x89'):if(_0xd442a9[_0x7c7c('0x56')][0x0][_0x7c7c('0x23')]['id']){_0xecb2da=_0xd442a9['body'][0x0][_0x7c7c('0x3c')];return db[_0x7c7c('0xbf')][_0x7c7c('0x54')]({'where':{'messageId':_0xd442a9[_0x7c7c('0x56')][0x0][_0x7c7c('0x23')]['id']}});}break;case'intelepeer':if(_0xd442a9['body'][_0x7c7c('0xcc')]&&_0xd442a9[_0x7c7c('0x56')][_0x7c7c('0x27')]){_0xecb2da=_0xd442a9[_0x7c7c('0x56')]['status'];return db[_0x7c7c('0xbf')][_0x7c7c('0x54')]({'where':{'messageId':_0xd442a9['body'][_0x7c7c('0xcc')]}});}break;}}})[_0x7c7c('0x33')](handleEntityNotFound(_0x35abe2,null))['then'](function(_0x151482){if(_0x151482){_0x495e78=_0x151482;switch(_0x3bb6b5[_0x7c7c('0x3c')]){case _0x7c7c('0x82'):if(_0xecb2da===_0x7c7c('0xca')){return _0x495e78[_0x7c7c('0x32')]({'read':!![]});}else{logger[_0x7c7c('0x21')](_0x7c7c('0x20'),_0x7c7c('0x27'),_0x7c7c('0x82'),util[_0x7c7c('0xcd')](_0xd442a9[_0x7c7c('0x56')],{'showHidden':![],'depth':null}));}break;case _0x7c7c('0x83'):if(_0xecb2da==='1'){return _0x495e78['update']({'read':!![]});}else{logger['error'](_0x7c7c('0x20'),_0x7c7c('0x27'),_0x7c7c('0x82'),util[_0x7c7c('0xcd')](_0xd442a9['body'],{'showHidden':![],'depth':null}));}break;case _0x7c7c('0x84'):if(!_0xd442a9[_0x7c7c('0x56')]['error_code']&&_0xecb2da>=0xc8&&_0xecb2da<=0xce){return _0x495e78['update']({'read':!![]});}else{logger[_0x7c7c('0x21')](_0x7c7c('0x20'),_0x7c7c('0x27'),_0x7c7c('0x84'),util[_0x7c7c('0xcd')](_0xd442a9[_0x7c7c('0x56')],{'showHidden':![],'depth':null}));}break;case _0x7c7c('0xce'):var _0x59b95f=_0xd442a9[_0x7c7c('0x56')][_0x7c7c('0x87')][0x0];if(_0x59b95f['status']['groupName']==='DELIVERED'){return _0x495e78[_0x7c7c('0x32')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7c7c('0x27'),_0x7c7c('0xce'),util[_0x7c7c('0xcd')](_0xd442a9[_0x7c7c('0x56')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0xecb2da=='DELIVERED_TO_GATEWAY'||_0xecb2da==_0x7c7c('0xcf')){return _0x495e78[_0x7c7c('0x32')]({'read':!![]});}else{logger[_0x7c7c('0x21')](_0x7c7c('0x20'),_0x7c7c('0x27'),_0x7c7c('0xcb'),util[_0x7c7c('0xcd')](_0xd442a9['body'],{'showHidden':![],'depth':null}));}break;case _0x7c7c('0x89'):if(_0xecb2da==_0x7c7c('0xd0')){return _0x495e78[_0x7c7c('0x32')]({'read':!![]});}else{logger[_0x7c7c('0x21')](_0x7c7c('0x20'),_0x7c7c('0x27'),'bandwidth',util[_0x7c7c('0xcd')](_0xd442a9['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0xecb2da==='DELIVRD'||_0xecb2da==='ACCEPTD'){return _0x495e78[_0x7c7c('0x32')]({'read':!![]});}else{logger[_0x7c7c('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7c7c('0x27'),_0x7c7c('0xd1'),util[_0x7c7c('0xcd')](_0xd442a9[_0x7c7c('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x495e78;}})['then'](respondWithResult(_0x35abe2,null))[_0x7c7c('0x25')](handleError(_0x35abe2,null));};exports[_0x7c7c('0xd2')]=function(_0x4fdee9,_0x18a671,_0x36dcdd){var _0x3167f2,_0x15144f,_0x4baffe;return db[_0x7c7c('0x3a')][_0x7c7c('0x54')]({'where':{'id':_0x4fdee9[_0x7c7c('0x5f')]['id']}})[_0x7c7c('0x33')](handleEntityNotFound(_0x18a671,null))['then'](function(_0x8c8aee){if(_0x8c8aee){_0x4baffe=_0x8c8aee;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x7c7c('0xc3'),_0x8c8aee['type'],util[_0x7c7c('0xcd')](_0x4fdee9[_0x7c7c('0x41')],{'showHidden':![],'depth':null}));switch(_0x8c8aee['type']){case'csc':if(_0x4fdee9['query']['message-id']&&_0x4fdee9[_0x7c7c('0x41')][_0x7c7c('0xd3')]){_0x15144f=_0x4fdee9[_0x7c7c('0x41')][_0x7c7c('0xd3')];return db[_0x7c7c('0xbf')][_0x7c7c('0x54')]({'where':{'messageId':_0x4fdee9['query'][_0x7c7c('0xd4')]}});}break;}}})[_0x7c7c('0x33')](handleEntityNotFound(_0x18a671,null))[_0x7c7c('0x33')](function(_0x284d08){if(_0x284d08){_0x3167f2=_0x284d08;switch(_0x4baffe['type']){case _0x7c7c('0xd5'):if(_0x15144f==='2'||_0x15144f==='6'){return _0x3167f2[_0x7c7c('0x32')]({'read':!![]});}else{logger['error'](_0x7c7c('0x20'),_0x7c7c('0x27'),_0x7c7c('0xd5'),util[_0x7c7c('0xcd')](_0x4fdee9[_0x7c7c('0x41')],{'showHidden':![],'depth':null}));};break;}return _0x3167f2;}})[_0x7c7c('0x33')](respondWithResult(_0x18a671,null))[_0x7c7c('0x25')](handleError(_0x18a671,null));};exports[_0x7c7c('0xd6')]=function(_0x160529,_0xb10d75,_0x2cf453){return db[_0x7c7c('0x3a')]['find']({'where':{'id':_0x160529[_0x7c7c('0x5f')]['id']}})['then'](handleEntityNotFound(_0xb10d75,null))[_0x7c7c('0x33')](function(_0x24cf40){if(_0x24cf40){return _0x24cf40['addAgents'](_0x160529[_0x7c7c('0x56')][_0x7c7c('0x68')],_['omit'](_0x160529['body'],[_0x7c7c('0x68'),'id'])||{})[_0x7c7c('0x91')](function(_0x466dd7){for(var _0x506229=0x0;_0x506229<_0x160529[_0x7c7c('0x56')][_0x7c7c('0x68')][_0x7c7c('0x46')];_0x506229+=0x1){socket[_0x7c7c('0xd7')](_0x7c7c('0xd8'),{'UserId':Number(_0x160529[_0x7c7c('0x56')][_0x7c7c('0x68')][_0x506229]),'SmsAccountId':Number(_0x160529['params']['id'])});}return _0x466dd7;});}})[_0x7c7c('0x33')](respondWithResult(_0xb10d75,null))[_0x7c7c('0x25')](handleError(_0xb10d75,null));};exports[_0x7c7c('0xd9')]=function(_0x2aea3f,_0x5e71bf,_0xe36efb){return db[_0x7c7c('0x3a')][_0x7c7c('0x54')]({'where':{'id':_0x2aea3f[_0x7c7c('0x5f')]['id']}})[_0x7c7c('0x33')](handleEntityNotFound(_0x5e71bf,null))['then'](function(_0x28d598){if(_0x28d598){return _0x28d598[_0x7c7c('0xd9')](_0x2aea3f['query']['ids'])[_0x7c7c('0x33')](function(){if(_[_0x7c7c('0xda')](_0x2aea3f[_0x7c7c('0x41')][_0x7c7c('0x68')])){for(var _0x4d5cfd=0x0;_0x4d5cfd<_0x2aea3f['query'][_0x7c7c('0x68')][_0x7c7c('0x46')];_0x4d5cfd+=0x1){socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x2aea3f[_0x7c7c('0x41')]['ids'][_0x4d5cfd]),'SmsAccountId':Number(_0x2aea3f[_0x7c7c('0x5f')]['id'])});}}else{socket['emit'](_0x7c7c('0xdb'),{'UserId':Number(_0x2aea3f['query'][_0x7c7c('0x68')]),'SmsAccountId':Number(_0x2aea3f[_0x7c7c('0x5f')]['id'])});}});}})[_0x7c7c('0x33')](respondWithStatusCode(_0x5e71bf,null))['catch'](handleError(_0x5e71bf,null));};exports[_0x7c7c('0xdc')]=function(_0x18d1c5,_0x2257fc,_0x337e24){var _0x39021b={};var _0x33c3fd={};var _0xa20686;var _0x56e7c4;return db[_0x7c7c('0x3a')][_0x7c7c('0x64')]({'where':{'id':_0x18d1c5[_0x7c7c('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2257fc,null))[_0x7c7c('0x33')](function(_0x52dbf3){if(_0x52dbf3){_0xa20686=_0x52dbf3;_0x33c3fd['model']=_['keys'](db[_0x7c7c('0x99')][_0x7c7c('0x3b')]);_0x33c3fd[_0x7c7c('0x41')]=_['keys'](_0x18d1c5[_0x7c7c('0x41')]);_0x33c3fd[_0x7c7c('0x42')]=_[_0x7c7c('0x43')](_0x33c3fd[_0x7c7c('0x3e')],_0x33c3fd[_0x7c7c('0x41')]);_0x39021b[_0x7c7c('0x45')]=_[_0x7c7c('0x43')](_0x33c3fd[_0x7c7c('0x3e')],qs[_0x7c7c('0x44')](_0x18d1c5[_0x7c7c('0x41')][_0x7c7c('0x44')]));_0x39021b[_0x7c7c('0x45')]=_0x39021b['attributes']['length']?_0x39021b[_0x7c7c('0x45')]:_0x33c3fd['model'];_0x39021b[_0x7c7c('0x49')]=qs['sort'](_0x18d1c5[_0x7c7c('0x41')][_0x7c7c('0x4a')]);_0x39021b['where']=qs[_0x7c7c('0x42')](_[_0x7c7c('0x4c')](_0x18d1c5[_0x7c7c('0x41')],_0x33c3fd[_0x7c7c('0x42')]));if(_0x18d1c5['query'][_0x7c7c('0x4d')]){_0x39021b[_0x7c7c('0x4b')]=_[_0x7c7c('0x4e')](_0x39021b['where'],{'$or':_['map'](_0x39021b[_0x7c7c('0x45')],function(_0x3dfc66){var _0x2b4341={};_0x2b4341[_0x3dfc66]={'$like':'%'+_0x18d1c5[_0x7c7c('0x41')][_0x7c7c('0x4d')]+'%'};return _0x2b4341;})});}_0x39021b=_['merge']({},_0x39021b,_0x18d1c5[_0x7c7c('0x4f')]);return _0xa20686[_0x7c7c('0xdc')](_0x39021b);}})[_0x7c7c('0x33')](function(_0x18156f){if(_0x18156f){_0x56e7c4=_0x18156f[_0x7c7c('0x46')];if(!_0x18d1c5[_0x7c7c('0x41')][_0x7c7c('0x47')](_0x7c7c('0x66'))){_0x39021b[_0x7c7c('0x48')]=qs[_0x7c7c('0x48')](_0x18d1c5[_0x7c7c('0x41')]['limit']);_0x39021b[_0x7c7c('0x29')]=qs[_0x7c7c('0x29')](_0x18d1c5[_0x7c7c('0x41')][_0x7c7c('0x29')]);}return _0xa20686[_0x7c7c('0xdc')](_0x39021b);}})[_0x7c7c('0x33')](function(_0x413358){if(_0x413358){return _0x413358?{'count':_0x56e7c4,'rows':_0x413358}:null;}})[_0x7c7c('0x33')](respondWithResult(_0x2257fc,null))[_0x7c7c('0x25')](handleError(_0x2257fc,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 5910c7d..392189f 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 _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 +var _0xed24=['../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x1266a7,_0x70b96f){var _0x4fe162=function(_0x11a093){while(--_0x11a093){_0x1266a7['push'](_0x1266a7['shift']());}};_0x4fe162(++_0x70b96f);}(_0xed24,0xe0));var _0x4ed2=function(_0x15a89a,_0xa19b4b){_0x15a89a=_0x15a89a-0x0;var _0x17766e=_0xed24[_0x15a89a];return _0x17766e;};'use strict';var EventEmitter=require(_0x4ed2('0x0'));var SmsAccount=require(_0x4ed2('0x1'))['db'][_0x4ed2('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x4ed2('0x3')](0x0);var events={'afterCreate':_0x4ed2('0x4'),'afterUpdate':_0x4ed2('0x5'),'afterDestroy':_0x4ed2('0x6')};function emitEvent(_0x5e0922){return function(_0x1f3232,_0x188271,_0x54f415){SmsAccountEvents[_0x4ed2('0x7')](_0x5e0922+':'+_0x1f3232['id'],_0x1f3232);SmsAccountEvents[_0x4ed2('0x7')](_0x5e0922,_0x1f3232);_0x54f415(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x4ed2('0x8')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 1b9d13b..6e6629e 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 _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 +var _0x0771=['moment','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','sms_accounts','lodash','util','../../config/logger','api'];(function(_0x1b2971,_0x320699){var _0x41fc8a=function(_0x4c3ce1){while(--_0x4c3ce1){_0x1b2971['push'](_0x1b2971['shift']());}};_0x41fc8a(++_0x320699);}(_0x0771,0x1b6));var _0x1077=function(_0x233811,_0x1283e9){_0x233811=_0x233811-0x0;var _0x292f41=_0x0771[_0x233811];return _0x292f41;};'use strict';var _=require(_0x1077('0x0'));var util=require(_0x1077('0x1'));var logger=require(_0x1077('0x2'))(_0x1077('0x3'));var moment=require(_0x1077('0x4'));var BPromise=require('bluebird');var rp=require(_0x1077('0x5'));var fs=require('fs');var path=require(_0x1077('0x6'));var rimraf=require(_0x1077('0x7'));var config=require(_0x1077('0x8'));var attributes=require(_0x1077('0x9'));module[_0x1077('0xa')]=function(_0x367d59,_0x525cb9){return _0x367d59[_0x1077('0xb')]('SmsAccount',attributes,{'tableName':_0x1077('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 ba17368..56bcfd0 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 _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 +var _0x0896=['../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0896,0x172));var _0x6089=function(_0x23f6bb,_0x20edd8){_0x23f6bb=_0x23f6bb-0x0;var _0x2c57d1=_0x0896[_0x23f6bb];return _0x2c57d1;};'use strict';var _=require(_0x6089('0x0'));var util=require(_0x6089('0x1'));var moment=require(_0x6089('0x2'));var BPromise=require(_0x6089('0x3'));var rs=require(_0x6089('0x4'));var fs=require('fs');var Redis=require(_0x6089('0x5'));var db=require(_0x6089('0x6'))['db'];var utils=require(_0x6089('0x7'));var logger=require(_0x6089('0x8'))(_0x6089('0x9'));var config=require(_0x6089('0xa'));var jayson=require(_0x6089('0xb'));var client=jayson['client'][_0x6089('0xc')]({'port':0x232a});config['redis']=_[_0x6089('0xd')](config['redis'],{'host':_0x6089('0xe'),'port':0x18eb});var socket=require(_0x6089('0xf'))(new Redis(config[_0x6089('0x10')]));require('./smsAccount.socket')[_0x6089('0x11')](socket);function respondWithRpcPromise(_0x57c2ef,_0x26c995,_0x1cb9fb){return new BPromise(function(_0x42c211,_0x1c5a11){return client[_0x6089('0x12')](_0x57c2ef,_0x1cb9fb)[_0x6089('0x13')](function(_0x5947e2){logger[_0x6089('0x14')](_0x6089('0x15'),_0x26c995,_0x6089('0x16'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x26c995,_0x6089('0x16'),JSON[_0x6089('0x17')](_0x5947e2));if(_0x5947e2[_0x6089('0x18')]){if(_0x5947e2[_0x6089('0x18')][_0x6089('0x19')]===0x1f4){logger[_0x6089('0x18')](_0x6089('0x15'),_0x26c995,_0x5947e2[_0x6089('0x18')][_0x6089('0x1a')]);return _0x1c5a11(_0x5947e2[_0x6089('0x18')]['message']);}logger[_0x6089('0x18')](_0x6089('0x15'),_0x26c995,_0x5947e2['error'][_0x6089('0x1a')]);return _0x42c211(_0x5947e2[_0x6089('0x18')][_0x6089('0x1a')]);}else{logger['info'](_0x6089('0x15'),_0x26c995,'request\x20sent');_0x42c211(_0x5947e2['result']['message']);}})['catch'](function(_0x215651){logger[_0x6089('0x18')]('SmsAccount,\x20%s,\x20%s',_0x26c995,_0x215651);_0x1c5a11(_0x215651);});});}exports[_0x6089('0x1b')]=function(_0x3765b5){var _0x36d5b1=this;return new Promise(function(_0x31b7cf,_0x23ae0b){return db[_0x6089('0x1c')][_0x6089('0x1d')]({'raw':_0x3765b5[_0x6089('0x1e')]?_0x3765b5[_0x6089('0x1e')][_0x6089('0x1f')]===undefined?!![]:![]:!![],'where':_0x3765b5[_0x6089('0x1e')]?_0x3765b5[_0x6089('0x1e')][_0x6089('0x20')]||null:null,'attributes':_0x3765b5['options']?_0x3765b5[_0x6089('0x1e')][_0x6089('0x21')]||null:null,'include':_0x3765b5[_0x6089('0x1e')]?_0x3765b5[_0x6089('0x1e')][_0x6089('0x22')]?_[_0x6089('0x23')](_0x3765b5[_0x6089('0x1e')]['include'],function(_0x490ede){return{'model':db[_0x490ede['model']],'as':_0x490ede['as'],'attributes':_0x490ede[_0x6089('0x21')],'include':_0x490ede[_0x6089('0x22')]?_[_0x6089('0x23')](_0x490ede[_0x6089('0x22')],function(_0x27bbb7){return{'model':db[_0x27bbb7[_0x6089('0x24')]],'as':_0x27bbb7['as'],'attributes':_0x27bbb7[_0x6089('0x21')],'include':_0x27bbb7['include']?_['map'](_0x27bbb7[_0x6089('0x22')],function(_0x31829c){return{'model':db[_0x31829c[_0x6089('0x24')]],'as':_0x31829c['as'],'attributes':_0x31829c[_0x6089('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56f324){logger[_0x6089('0x14')](_0x6089('0x1b'),_0x3765b5);logger[_0x6089('0x25')](_0x6089('0x1b'),_0x3765b5,JSON[_0x6089('0x17')](_0x56f324));_0x31b7cf(_0x56f324);})['catch'](function(_0x5dcdcc){logger['error'](_0x6089('0x1b'),_0x5dcdcc[_0x6089('0x1a')],_0x3765b5);_0x23ae0b(_0x36d5b1[_0x6089('0x18')](0x1f4,_0x5dcdcc[_0x6089('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 10bea4c..85a91d1 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(_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 +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 e7f7752..551a404 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_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 +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(_0xdcbb99,_0x5af4ca){var _0x55ca74=function(_0x2662a3){while(--_0x2662a3){_0xdcbb99['push'](_0xdcbb99['shift']());}};_0x55ca74(++_0x5af4ca);}(_0x34e8,0x12c));var _0x834e=function(_0x420a60,_0x27ff8e){_0x420a60=_0x420a60-0x0;var _0x564bd1=_0x34e8[_0x420a60];return _0x564bd1;};'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 c79cf70..2c8e00b 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 _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 +var _0xe857=['TEXT','sequelize','exports','INTEGER','STRING'];(function(_0xaac148,_0x460bf9){var _0x2315a2=function(_0x3a466f){while(--_0x3a466f){_0xaac148['push'](_0xaac148['shift']());}};_0x2315a2(++_0x460bf9);}(_0xe857,0x79));var _0x7e85=function(_0x1e40cb,_0x114707){_0x1e40cb=_0x1e40cb-0x0;var _0x2fb0ba=_0xe857[_0x1e40cb];return _0x2fb0ba;};'use strict';var Sequelize=require(_0x7e85('0x0'));module[_0x7e85('0x1')]={'priority':{'type':Sequelize[_0x7e85('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7e85('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7e85('0x4')]()},'description':{'type':Sequelize[_0x7e85('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 1185b3e..0ea5666 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 _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 +var _0xe6b1=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','sendStatus','error','stack','name','send','map','SmsApplication','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','create','update','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse'];(function(_0x3a64f1,_0x4ed202){var _0xb794e0=function(_0x228352){while(--_0x228352){_0x3a64f1['push'](_0x3a64f1['shift']());}};_0xb794e0(++_0x4ed202);}(_0xe6b1,0x88));var _0x1e6b=function(_0x378e57,_0x5a6b98){_0x378e57=_0x378e57-0x0;var _0x337857=_0xe6b1[_0x378e57];return _0x337857;};'use strict';var emlformat=require(_0x1e6b('0x0'));var rimraf=require(_0x1e6b('0x1'));var zipdir=require(_0x1e6b('0x2'));var jsonpatch=require(_0x1e6b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1e6b('0x4'));var Mustache=require(_0x1e6b('0x5'));var util=require(_0x1e6b('0x6'));var path=require(_0x1e6b('0x7'));var sox=require(_0x1e6b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1e6b('0x9'));var squel=require(_0x1e6b('0xa'));var crypto=require(_0x1e6b('0xb'));var jsforce=require(_0x1e6b('0xc'));var deskjs=require(_0x1e6b('0xd'));var toCsv=require(_0x1e6b('0xe'));var querystring=require('querystring');var Papa=require(_0x1e6b('0xf'));var Redis=require(_0x1e6b('0x10'));var authService=require(_0x1e6b('0x11'));var qs=require(_0x1e6b('0x12'));var as=require(_0x1e6b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1e6b('0x14'));var utils=require(_0x1e6b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1e6b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x108713,_0x4a0a99){_0x4a0a99=_0x4a0a99||0xcc;return function(_0x31cda1){if(_0x31cda1){return _0x108713['sendStatus'](_0x4a0a99);}return _0x108713['status'](_0x4a0a99)[_0x1e6b('0x17')]();};}function respondWithResult(_0x594a83,_0x91199d){_0x91199d=_0x91199d||0xc8;return function(_0x175aa0){if(_0x175aa0){return _0x594a83[_0x1e6b('0x18')](_0x91199d)['json'](_0x175aa0);}};}function respondWithFilteredResult(_0xe07884,_0x189964){return function(_0xe5db34){if(_0xe5db34){var _0x59f319=typeof _0x189964[_0x1e6b('0x19')]===_0x1e6b('0x1a')&&typeof _0x189964[_0x1e6b('0x1b')]===_0x1e6b('0x1a');var _0x366140=_0xe5db34[_0x1e6b('0x1c')];var _0x25828b=_0x59f319?0x0:_0x189964['offset'];var _0x4fbe00=_0x59f319?_0xe5db34[_0x1e6b('0x1c')]:_0x189964[_0x1e6b('0x19')]+_0x189964[_0x1e6b('0x1b')];var _0x3e6565;if(_0x4fbe00>=_0x366140){_0x4fbe00=_0x366140;_0x3e6565=0xc8;}else{_0x3e6565=0xce;}_0xe07884[_0x1e6b('0x18')](_0x3e6565);return _0xe07884[_0x1e6b('0x1d')](_0x1e6b('0x1e'),_0x25828b+'-'+_0x4fbe00+'/'+_0x366140)[_0x1e6b('0x1f')](_0xe5db34);}return null;};}function patchUpdates(_0x3f252a){return function(_0x424066){try{jsonpatch[_0x1e6b('0x20')](_0x424066,_0x3f252a,!![]);}catch(_0x66b55e){return BPromise[_0x1e6b('0x21')](_0x66b55e);}return _0x424066[_0x1e6b('0x22')]();};}function saveUpdates(_0x496eab,_0x2dc430){return function(_0x1466df){if(_0x1466df){return _0x1466df['update'](_0x496eab)[_0x1e6b('0x23')](function(_0x5691cf){return _0x5691cf;});}return null;};}function removeEntity(_0x4521f5,_0x35f043){return function(_0x30a51a){if(_0x30a51a){return _0x30a51a['destroy']()[_0x1e6b('0x23')](function(){_0x4521f5[_0x1e6b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe23fce,_0x2821df){return function(_0x4d74f7){if(!_0x4d74f7){_0xe23fce[_0x1e6b('0x24')](0x194);}return _0x4d74f7;};}function handleError(_0xb8e992,_0x465c7f){_0x465c7f=_0x465c7f||0x1f4;return function(_0x23b8b5){logger[_0x1e6b('0x25')](_0x23b8b5[_0x1e6b('0x26')]);if(_0x23b8b5[_0x1e6b('0x27')]){delete _0x23b8b5[_0x1e6b('0x27')];}_0xb8e992[_0x1e6b('0x18')](_0x465c7f)[_0x1e6b('0x28')](_0x23b8b5);};}exports['index']=function(_0x19adf7,_0x25370b){var _0xf3ab01={},_0x54c7f5={},_0x1e1714={'count':0x0,'rows':[]};var _0x488827=_[_0x1e6b('0x29')](db[_0x1e6b('0x2a')][_0x1e6b('0x2b')],function(_0x17a16c){return{'name':_0x17a16c[_0x1e6b('0x2c')],'type':_0x17a16c['type'][_0x1e6b('0x2d')]};});_0x54c7f5[_0x1e6b('0x2e')]=_[_0x1e6b('0x29')](_0x488827,'name');_0x54c7f5[_0x1e6b('0x2f')]=_[_0x1e6b('0x30')](_0x19adf7[_0x1e6b('0x2f')]);_0x54c7f5[_0x1e6b('0x31')]=_[_0x1e6b('0x32')](_0x54c7f5[_0x1e6b('0x2e')],_0x54c7f5[_0x1e6b('0x2f')]);_0xf3ab01['attributes']=_[_0x1e6b('0x32')](_0x54c7f5[_0x1e6b('0x2e')],qs[_0x1e6b('0x33')](_0x19adf7['query'][_0x1e6b('0x33')]));_0xf3ab01[_0x1e6b('0x34')]=_0xf3ab01[_0x1e6b('0x34')]['length']?_0xf3ab01['attributes']:_0x54c7f5[_0x1e6b('0x2e')];if(!_0x19adf7[_0x1e6b('0x2f')][_0x1e6b('0x35')](_0x1e6b('0x36'))){_0xf3ab01['limit']=qs[_0x1e6b('0x1b')](_0x19adf7[_0x1e6b('0x2f')][_0x1e6b('0x1b')]);_0xf3ab01[_0x1e6b('0x19')]=qs['offset'](_0x19adf7[_0x1e6b('0x2f')][_0x1e6b('0x19')]);}_0xf3ab01['order']=qs[_0x1e6b('0x37')](_0x19adf7[_0x1e6b('0x2f')][_0x1e6b('0x37')]);_0xf3ab01['where']=qs[_0x1e6b('0x31')](_[_0x1e6b('0x38')](_0x19adf7[_0x1e6b('0x2f')],_0x54c7f5[_0x1e6b('0x31')]),_0x488827);if(_0x19adf7['query'][_0x1e6b('0x39')]){_0xf3ab01[_0x1e6b('0x3a')]=_['merge'](_0xf3ab01[_0x1e6b('0x3a')],{'$or':_[_0x1e6b('0x29')](_0x488827,function(_0x49c36a){if(_0x49c36a[_0x1e6b('0x3b')]!==_0x1e6b('0x3c')){var _0x2fdbb6={};_0x2fdbb6[_0x49c36a[_0x1e6b('0x27')]]={'$like':'%'+_0x19adf7['query']['filter']+'%'};return _0x2fdbb6;}})});}_0xf3ab01=_[_0x1e6b('0x3d')]({},_0xf3ab01,_0x19adf7[_0x1e6b('0x3e')]);var _0x2502c9={'where':_0xf3ab01[_0x1e6b('0x3a')]};return db[_0x1e6b('0x2a')][_0x1e6b('0x1c')](_0x2502c9)[_0x1e6b('0x23')](function(_0xc1fc96){_0x1e1714['count']=_0xc1fc96;if(_0x19adf7['query'][_0x1e6b('0x3f')]){_0xf3ab01[_0x1e6b('0x40')]=[{'all':!![]}];}return db[_0x1e6b('0x2a')][_0x1e6b('0x41')](_0xf3ab01);})[_0x1e6b('0x23')](function(_0x179449){_0x1e1714[_0x1e6b('0x42')]=_0x179449;return _0x1e1714;})[_0x1e6b('0x23')](respondWithFilteredResult(_0x25370b,_0xf3ab01))[_0x1e6b('0x43')](handleError(_0x25370b,null));};exports[_0x1e6b('0x44')]=function(_0x3c835a,_0x596188){var _0x46b3d4={'raw':!![],'where':{'id':_0x3c835a[_0x1e6b('0x45')]['id']}},_0x3c8a6c={};_0x3c8a6c['model']=_['keys'](db[_0x1e6b('0x2a')][_0x1e6b('0x2b')]);_0x3c8a6c[_0x1e6b('0x2f')]=_[_0x1e6b('0x30')](_0x3c835a['query']);_0x3c8a6c[_0x1e6b('0x31')]=_[_0x1e6b('0x32')](_0x3c8a6c['model'],_0x3c8a6c[_0x1e6b('0x2f')]);_0x46b3d4[_0x1e6b('0x34')]=_['intersection'](_0x3c8a6c[_0x1e6b('0x2e')],qs[_0x1e6b('0x33')](_0x3c835a[_0x1e6b('0x2f')][_0x1e6b('0x33')]));_0x46b3d4[_0x1e6b('0x34')]=_0x46b3d4['attributes'][_0x1e6b('0x46')]?_0x46b3d4[_0x1e6b('0x34')]:_0x3c8a6c[_0x1e6b('0x2e')];if(_0x3c835a[_0x1e6b('0x2f')][_0x1e6b('0x3f')]){_0x46b3d4[_0x1e6b('0x40')]=[{'all':!![]}];}_0x46b3d4=_['merge']({},_0x46b3d4,_0x3c835a['options']);return db['SmsApplication']['find'](_0x46b3d4)[_0x1e6b('0x23')](handleEntityNotFound(_0x596188,null))[_0x1e6b('0x23')](respondWithResult(_0x596188,null))[_0x1e6b('0x43')](handleError(_0x596188,null));};exports[_0x1e6b('0x47')]=function(_0x5a7890,_0x41b940){return db[_0x1e6b('0x2a')][_0x1e6b('0x47')](_0x5a7890['body'],{})['then'](respondWithResult(_0x41b940,0xc9))[_0x1e6b('0x43')](handleError(_0x41b940,null));};exports[_0x1e6b('0x48')]=function(_0x50fa9d,_0x53a15a){if(_0x50fa9d[_0x1e6b('0x49')]['id']){delete _0x50fa9d[_0x1e6b('0x49')]['id'];}return db['SmsApplication'][_0x1e6b('0x4a')]({'where':{'id':_0x50fa9d[_0x1e6b('0x45')]['id']}})[_0x1e6b('0x23')](handleEntityNotFound(_0x53a15a,null))[_0x1e6b('0x23')](saveUpdates(_0x50fa9d['body'],null))[_0x1e6b('0x23')](respondWithResult(_0x53a15a,null))['catch'](handleError(_0x53a15a,null));};exports[_0x1e6b('0x4b')]=function(_0x3b3775,_0x33d7ac){return db[_0x1e6b('0x2a')][_0x1e6b('0x4a')]({'where':{'id':_0x3b3775[_0x1e6b('0x45')]['id']}})[_0x1e6b('0x23')](handleEntityNotFound(_0x33d7ac,null))[_0x1e6b('0x23')](removeEntity(_0x33d7ac,null))[_0x1e6b('0x43')](handleError(_0x33d7ac,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 63fac9d..464e3f2 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 _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 +var _0x1f1c=['utf8mb4','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','SmsApplication','sms_applications'];(function(_0x33af1b,_0x318b5c){var _0x5d481f=function(_0x6e362){while(--_0x6e362){_0x33af1b['push'](_0x33af1b['shift']());}};_0x5d481f(++_0x318b5c);}(_0x1f1c,0x1ed));var _0xc1f1=function(_0x3862e5,_0x2e56bf){_0x3862e5=_0x3862e5-0x0;var _0x31fe64=_0x1f1c[_0x3862e5];return _0x31fe64;};'use strict';var _=require('lodash');var util=require(_0xc1f1('0x0'));var logger=require('../../config/logger')(_0xc1f1('0x1'));var moment=require(_0xc1f1('0x2'));var BPromise=require(_0xc1f1('0x3'));var rp=require(_0xc1f1('0x4'));var fs=require('fs');var path=require(_0xc1f1('0x5'));var rimraf=require('rimraf');var config=require(_0xc1f1('0x6'));var attributes=require('./smsApplication.attributes');module[_0xc1f1('0x7')]=function(_0x4902a8,_0x77601){return _0x4902a8[_0xc1f1('0x8')](_0xc1f1('0x9'),attributes,{'tableName':_0xc1f1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc1f1('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index ec00a26..8730ec0 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 _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 +var _0x4123=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment'];(function(_0x31771a,_0x42fb1b){var _0x718b39=function(_0x1548a4){while(--_0x1548a4){_0x31771a['push'](_0x31771a['shift']());}};_0x718b39(++_0x42fb1b);}(_0x4123,0x87));var _0x3412=function(_0x19584e,_0x528482){_0x19584e=_0x19584e-0x0;var _0x5725b0=_0x4123[_0x19584e];return _0x5725b0;};'use strict';var _=require(_0x3412('0x0'));var util=require(_0x3412('0x1'));var moment=require(_0x3412('0x2'));var BPromise=require(_0x3412('0x3'));var rs=require(_0x3412('0x4'));var fs=require('fs');var Redis=require(_0x3412('0x5'));var db=require(_0x3412('0x6'))['db'];var utils=require(_0x3412('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x3412('0x8'));var jayson=require(_0x3412('0x9'));var client=jayson['client'][_0x3412('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c6b42,_0x30d18b,_0x43f43c){return new BPromise(function(_0x40c825,_0x2617a6){return client['request'](_0x2c6b42,_0x43f43c)[_0x3412('0xb')](function(_0x2517b0){logger[_0x3412('0xc')](_0x3412('0xd'),_0x30d18b,_0x3412('0xe'));logger[_0x3412('0xf')](_0x3412('0x10'),_0x30d18b,_0x3412('0xe'),JSON[_0x3412('0x11')](_0x2517b0));if(_0x2517b0['error']){if(_0x2517b0['error'][_0x3412('0x12')]===0x1f4){logger[_0x3412('0x13')](_0x3412('0xd'),_0x30d18b,_0x2517b0['error']['message']);return _0x2617a6(_0x2517b0['error'][_0x3412('0x14')]);}logger[_0x3412('0x13')](_0x3412('0xd'),_0x30d18b,_0x2517b0[_0x3412('0x13')][_0x3412('0x14')]);return _0x40c825(_0x2517b0[_0x3412('0x13')][_0x3412('0x14')]);}else{logger[_0x3412('0xc')](_0x3412('0xd'),_0x30d18b,_0x3412('0xe'));_0x40c825(_0x2517b0[_0x3412('0x15')][_0x3412('0x14')]);}})[_0x3412('0x16')](function(_0x854010){logger['error'](_0x3412('0xd'),_0x30d18b,_0x854010);_0x2617a6(_0x854010);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 2be0547..9adcce3 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 _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 +var _0xefda=['../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','/describe','isAuthenticated','/:id','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','sms','addTags','put','smsinteraction:update','update','smsinteraction:destroy','destroy','removeTags','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0xae1fe4,_0x4b0378){var _0x34bed6=function(_0x44a3bc){while(--_0x44a3bc){_0xae1fe4['push'](_0xae1fe4['shift']());}};_0x34bed6(++_0x4b0378);}(_0xefda,0x96));var _0xaefd=function(_0x2eb39f,_0x17c21e){_0x2eb39f=_0x2eb39f-0x0;var _0x4e0c45=_0xefda[_0x2eb39f];return _0x4e0c45;};'use strict';var multer=require(_0xaefd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaefd('0x1'));var express=require(_0xaefd('0x2'));var router=express['Router']();var fs_extra=require(_0xaefd('0x3'));var auth=require(_0xaefd('0x4'));var interaction=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var controller=require(_0xaefd('0x7'));router[_0xaefd('0x8')]('/',auth['isAuthenticated'](),controller[_0xaefd('0x9')]);router[_0xaefd('0x8')](_0xaefd('0xa'),auth[_0xaefd('0xb')](),controller['describe']);router[_0xaefd('0x8')](_0xaefd('0xc'),auth[_0xaefd('0xb')](),controller['show']);router['get']('/:id/messages',auth[_0xaefd('0xb')](),controller[_0xaefd('0xd')]);router[_0xaefd('0x8')](_0xaefd('0xe'),auth[_0xaefd('0xb')](),controller[_0xaefd('0xf')]);router[_0xaefd('0x10')]('/',auth[_0xaefd('0xb')](),controller[_0xaefd('0x11')]);router[_0xaefd('0x10')](_0xaefd('0x12'),auth['isAuthenticated'](),controller[_0xaefd('0x13')]);router['post'](_0xaefd('0x14'),auth[_0xaefd('0xb')](),interaction[_0xaefd('0x15')](_0xaefd('0x16'),'smsinteraction:addtags'),controller[_0xaefd('0x17')]);router[_0xaefd('0x18')](_0xaefd('0xc'),auth[_0xaefd('0xb')](),interaction[_0xaefd('0x15')](_0xaefd('0x16'),_0xaefd('0x19')),controller[_0xaefd('0x1a')]);router['delete'](_0xaefd('0xc'),auth[_0xaefd('0xb')](),interaction[_0xaefd('0x15')](_0xaefd('0x16'),_0xaefd('0x1b')),controller[_0xaefd('0x1c')]);router['delete'](_0xaefd('0x14'),auth[_0xaefd('0xb')](),controller[_0xaefd('0x1d')]);module[_0xaefd('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index bbba4e4..2baee15 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 _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 +var _0x50a8=['STRING','ENUM','out','INTEGER','moment','BOOLEAN','DATE'];(function(_0x1c9e37,_0x20d9a1){var _0x197736=function(_0x45b6d4){while(--_0x45b6d4){_0x1c9e37['push'](_0x1c9e37['shift']());}};_0x197736(++_0x20d9a1);}(_0x50a8,0x193));var _0x850a=function(_0xf237f7,_0xb11ac){_0xf237f7=_0xf237f7-0x0;var _0x2c183b=_0x50a8[_0xf237f7];return _0x2c183b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x850a('0x0'));module['exports']={'closed':{'type':Sequelize[_0x850a('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x850a('0x2')]},'disposition':{'type':Sequelize[_0x850a('0x3')]},'secondDisposition':{'type':Sequelize[_0x850a('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x850a('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x850a('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x850a('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x850a('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x850a('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x850a('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 69b78c9..9bd3ab8 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 _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 +var _0x9dd1=['unlinkSync','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','catch','show','params','model','intersection','attributes','fields','includeAll','include','merge','options','create','body','find','describe','SmsMessage','addMessage','omit','getMessages','keys','length','nolimit','order','sort','where','filters','pick','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','ids','spread','color','emit','removeTags','toString','join','files','tmp','transcript-%d-%s.zip','User','push','CmContact','Contact','firstName','lastName','Messages','createdAt','read','SmsAccount','Account','fullname','Owner','N.A.','closed','closedAt','disposition','direction','System','secret','server','views','.pdf','createPdfFromHTML','err'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0x9dd1,0x160));var _0x19dd=function(_0x595013,_0x65a215){_0x595013=_0x595013-0x0;var _0x2a29e3=_0x9dd1[_0x595013];return _0x2a29e3;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x19dd('0x0'));var moment=require(_0x19dd('0x1'));var BPromise=require(_0x19dd('0x2'));var util=require(_0x19dd('0x3'));var path=require(_0x19dd('0x4'));var ejs=require(_0x19dd('0x5'));var fs=require('fs');var _=require(_0x19dd('0x6'));var Redis=require(_0x19dd('0x7'));var interaction=require(_0x19dd('0x8'));var qs=require(_0x19dd('0x9'));var pdf=require(_0x19dd('0xa'));var logger=require('../../config/logger')('api');var config=require(_0x19dd('0xb'));var db=require(_0x19dd('0xc'))['db'];config[_0x19dd('0xd')]=_[_0x19dd('0xe')](config[_0x19dd('0xd')],{'host':_0x19dd('0xf'),'port':0x18eb});var socket=require(_0x19dd('0x10'))(new Redis(config[_0x19dd('0xd')]));require(_0x19dd('0x11'))[_0x19dd('0x12')](socket);function respondWithStatusCode(_0x4fc12a,_0x5eb94b){_0x5eb94b=_0x5eb94b||0xcc;return function(_0x4b1d9d){if(_0x4b1d9d){return _0x4fc12a[_0x19dd('0x13')](_0x5eb94b);}return _0x4fc12a[_0x19dd('0x14')](_0x5eb94b)[_0x19dd('0x15')]();};}function respondWithResult(_0x183687,_0xe3de71){_0xe3de71=_0xe3de71||0xc8;return function(_0x588453){if(_0x588453){return _0x183687['status'](_0xe3de71)[_0x19dd('0x16')](_0x588453);}};}function respondWithFilteredResult(_0x33c379,_0x1928aa){return function(_0x2809b4){if(_0x2809b4){var _0x356c4d=typeof _0x1928aa[_0x19dd('0x17')]===_0x19dd('0x18')&&typeof _0x1928aa[_0x19dd('0x19')]===_0x19dd('0x18');var _0x259b74=_0x2809b4['count'];var _0x54d9a4=_0x356c4d?0x0:_0x1928aa['offset'];var _0x11e164=_0x356c4d?_0x2809b4[_0x19dd('0x1a')]:_0x1928aa[_0x19dd('0x17')]+_0x1928aa[_0x19dd('0x19')];var _0x5b1f01;if(_0x11e164>=_0x259b74){_0x11e164=_0x259b74;_0x5b1f01=0xc8;}else{_0x5b1f01=0xce;}_0x33c379[_0x19dd('0x14')](_0x5b1f01);return _0x33c379[_0x19dd('0x1b')](_0x19dd('0x1c'),_0x54d9a4+'-'+_0x11e164+'/'+_0x259b74)['json'](_0x2809b4);}return null;};}function saveUpdates(_0x1239b7){return function(_0x5699a1){if(_0x5699a1){return _0x5699a1[_0x19dd('0x1d')](_0x1239b7)[_0x19dd('0x1e')](function(_0x3ea7bb){return _0x3ea7bb;});}return null;};}function removeEntity(_0x40bc61){return function(_0x4517ca){if(_0x4517ca){return _0x4517ca[_0x19dd('0x1f')]()[_0x19dd('0x1e')](function(){_0x40bc61[_0x19dd('0x14')](0xcc)[_0x19dd('0x15')]();});}};}function handleEntityNotFound(_0x2b91cd){return function(_0x28587b){if(!_0x28587b){_0x2b91cd[_0x19dd('0x13')](0x194);}return _0x28587b;};}function handleError(_0x266aa3,_0x26f863){_0x26f863=_0x26f863||0x1f4;return function(_0x125c47){logger[_0x19dd('0x20')](_0x125c47[_0x19dd('0x21')]);if(_0x125c47[_0x19dd('0x22')]){delete _0x125c47[_0x19dd('0x22')];}_0x266aa3[_0x19dd('0x14')](_0x26f863)[_0x19dd('0x23')](_0x125c47);};}exports[_0x19dd('0x24')]=function(_0x42d3d5,_0x4d19c4){var _0x212277={};var _0xd0b053=_['map'](db[_0x19dd('0x25')][_0x19dd('0x26')],function(_0x5aa815){return{'name':_0x5aa815[_0x19dd('0x27')],'type':_0x5aa815[_0x19dd('0x28')][_0x19dd('0x29')]};});_0x212277=qs[_0x19dd('0x2a')](_0xd0b053,_0x42d3d5);return interaction[_0x19dd('0x2b')](_0x19dd('0x2c'),_0x42d3d5[_0x19dd('0x2d')],_0x42d3d5['user'],_0x212277,_0xd0b053)['then'](respondWithFilteredResult(_0x4d19c4,_0x212277))[_0x19dd('0x2e')](handleError(_0x4d19c4,null));};exports[_0x19dd('0x2f')]=function(_0xa232c9,_0x18b534){var _0x43d35b={'raw':![],'where':{'id':_0xa232c9[_0x19dd('0x30')]['id']}},_0xcd4106={};_0xcd4106[_0x19dd('0x31')]=_['keys'](db[_0x19dd('0x25')]['rawAttributes']);_0xcd4106[_0x19dd('0x2d')]=_['keys'](_0xa232c9[_0x19dd('0x2d')]);_0xcd4106['filters']=_[_0x19dd('0x32')](_0xcd4106['model'],_0xcd4106['query']);_0x43d35b[_0x19dd('0x33')]=_[_0x19dd('0x32')](_0xcd4106[_0x19dd('0x31')],qs['fields'](_0xa232c9[_0x19dd('0x2d')][_0x19dd('0x34')]));_0x43d35b[_0x19dd('0x33')]=_0x43d35b[_0x19dd('0x33')]['length']?_0x43d35b[_0x19dd('0x33')]:_0xcd4106[_0x19dd('0x31')];if(_0xa232c9[_0x19dd('0x2d')][_0x19dd('0x35')]){_0x43d35b[_0x19dd('0x36')]=[{'all':!![]}];}_0x43d35b=_[_0x19dd('0x37')]({},_0x43d35b,_0xa232c9[_0x19dd('0x38')]);return db[_0x19dd('0x25')]['find'](_0x43d35b)[_0x19dd('0x1e')](handleEntityNotFound(_0x18b534,null))[_0x19dd('0x1e')](respondWithResult(_0x18b534,null))['catch'](handleError(_0x18b534,null));};exports['create']=function(_0x5ebfa1,_0x401d0a){return db['SmsInteraction'][_0x19dd('0x39')](_0x5ebfa1['body'],{})['then'](respondWithResult(_0x401d0a,0xc9))[_0x19dd('0x2e')](handleError(_0x401d0a,null));};exports[_0x19dd('0x1d')]=function(_0x31ee95,_0x327bb9){if(_0x31ee95[_0x19dd('0x3a')]['id']){delete _0x31ee95['body']['id'];}return db[_0x19dd('0x25')]['find']({'where':{'id':_0x31ee95[_0x19dd('0x30')]['id']}})['then'](handleEntityNotFound(_0x327bb9,null))[_0x19dd('0x1e')](saveUpdates(_0x31ee95[_0x19dd('0x3a')],null))[_0x19dd('0x1e')](respondWithResult(_0x327bb9,null))['catch'](handleError(_0x327bb9,null));};exports[_0x19dd('0x1f')]=function(_0x1f6e00,_0xaf0c68){return db['SmsInteraction'][_0x19dd('0x3b')]({'where':{'id':_0x1f6e00[_0x19dd('0x30')]['id']}})[_0x19dd('0x1e')](handleEntityNotFound(_0xaf0c68,null))['then'](removeEntity(_0xaf0c68,null))[_0x19dd('0x2e')](handleError(_0xaf0c68,null));};exports[_0x19dd('0x3c')]=function(_0x1afb3d,_0x4c3569){return db[_0x19dd('0x25')][_0x19dd('0x3c')]()[_0x19dd('0x1e')](respondWithResult(_0x4c3569,null))['catch'](handleError(_0x4c3569,null));};exports['addMessage']=function(_0x5e262b,_0x31e504){return db[_0x19dd('0x3d')][_0x19dd('0x3b')]({'where':{'id':_0x5e262b[_0x19dd('0x30')]['id']}})[_0x19dd('0x1e')](handleEntityNotFound(_0x31e504,null))[_0x19dd('0x1e')](function(_0x4fe311){if(_0x4fe311){return _0x4fe311[_0x19dd('0x3e')](_0x5e262b[_0x19dd('0x3a')]['ids'],_[_0x19dd('0x3f')](_0x5e262b[_0x19dd('0x3a')],['ids','id'])||{});}})[_0x19dd('0x1e')](respondWithResult(_0x31e504,null))[_0x19dd('0x2e')](handleError(_0x31e504,null));};exports[_0x19dd('0x40')]=function(_0x4dced4,_0x3e691f){var _0x205873={'raw':![],'where':{}};var _0x104a8e={};var _0x2a19ca={'count':0x0,'rows':[]};return db[_0x19dd('0x25')]['findOne']({'where':{'id':_0x4dced4['params']['id']}})[_0x19dd('0x1e')](handleEntityNotFound(_0x3e691f,null))['then'](function(_0x50e4ed){if(_0x50e4ed){_0x104a8e[_0x19dd('0x31')]=_[_0x19dd('0x41')](db['SmsMessage'][_0x19dd('0x26')]);_0x104a8e['query']=_[_0x19dd('0x41')](_0x4dced4[_0x19dd('0x2d')]);_0x104a8e['filters']=_['intersection'](_0x104a8e[_0x19dd('0x31')],_0x104a8e[_0x19dd('0x2d')]);_0x205873[_0x19dd('0x33')]=_['intersection'](_0x104a8e['model'],qs[_0x19dd('0x34')](_0x4dced4[_0x19dd('0x2d')][_0x19dd('0x34')]));_0x205873['attributes']=_0x205873['attributes'][_0x19dd('0x42')]?_0x205873[_0x19dd('0x33')]:_0x104a8e[_0x19dd('0x31')];if(!_0x4dced4[_0x19dd('0x2d')]['hasOwnProperty'](_0x19dd('0x43'))){_0x205873[_0x19dd('0x19')]=qs['limit'](_0x4dced4[_0x19dd('0x2d')]['limit']);_0x205873[_0x19dd('0x17')]=qs[_0x19dd('0x17')](_0x4dced4[_0x19dd('0x2d')]['offset']);}_0x205873[_0x19dd('0x44')]=qs[_0x19dd('0x45')](_0x4dced4[_0x19dd('0x2d')][_0x19dd('0x45')]);_0x205873[_0x19dd('0x46')]=qs[_0x19dd('0x47')](_[_0x19dd('0x48')](_0x4dced4[_0x19dd('0x2d')],_0x104a8e[_0x19dd('0x47')]));_0x205873[_0x19dd('0x46')][_0x19dd('0x49')]=_0x50e4ed['id'];if(_0x4dced4[_0x19dd('0x2d')][_0x19dd('0x4a')]){_0x205873['where']=_[_0x19dd('0x37')](_0x205873[_0x19dd('0x46')],{'$or':_['map'](_0x205873['attributes'],function(_0x4a4f65){var _0x4a97f5={};_0x4a97f5[_0x4a4f65]={'$like':'%'+_0x4dced4['query'][_0x19dd('0x4a')]+'%'};return _0x4a97f5;})});}if(_0x4dced4[_0x19dd('0x2d')][_0x19dd('0x4b')]){var _0x4dbeba=_0x4dced4[_0x19dd('0x2d')][_0x19dd('0x4b')][_0x19dd('0x4c')](',');var _0x200ea7={};_0x200ea7[_0x4dbeba[0x0]]={'$gte':moment(_0x4dbeba[0x1])[_0x19dd('0x4d')](_0x19dd('0x4e'))};_0x205873[_0x19dd('0x46')]=_[_0x19dd('0x37')](_0x205873[_0x19dd('0x46')],_0x200ea7);}_0x205873=_['merge']({},_0x205873,_0x4dced4[_0x19dd('0x38')]);return db[_0x19dd('0x3d')]['count']({'where':_0x205873['where']})[_0x19dd('0x1e')](function(_0x4cbadd){_0x2a19ca[_0x19dd('0x1a')]=_0x4cbadd;if(_0x4dced4[_0x19dd('0x2d')][_0x19dd('0x35')]){_0x205873['include']=[{'all':!![]}];}return db['SmsMessage'][_0x19dd('0x2b')](_0x205873);})[_0x19dd('0x1e')](function(_0x473922){_0x2a19ca[_0x19dd('0x4f')]=_0x473922;return _0x2a19ca;});}})[_0x19dd('0x1e')](respondWithFilteredResult(_0x3e691f,_0x205873))[_0x19dd('0x2e')](handleError(_0x3e691f,null));};exports[_0x19dd('0x50')]=function(_0x9b2c08,_0x1c265b){return db['SmsInteraction']['find']({'where':{'id':_0x9b2c08[_0x19dd('0x30')]['id']}})['then'](handleEntityNotFound(_0x1c265b,null))[_0x19dd('0x1e')](function(_0x5a0047){if(_0x5a0047){return _0x5a0047['setTags'](_0x9b2c08[_0x19dd('0x3a')]['ids'],_[_0x19dd('0x3f')](_0x9b2c08[_0x19dd('0x3a')],[_0x19dd('0x51'),'id'])||{})[_0x19dd('0x52')](function(){return db['Tag'][_0x19dd('0x2b')]({'attributes':['id',_0x19dd('0x22'),_0x19dd('0x53')],'where':{'id':_0x9b2c08[_0x19dd('0x3a')][_0x19dd('0x51')]}});})[_0x19dd('0x1e')](function(_0x3618ff){socket[_0x19dd('0x54')]('smsInteractionTags:save',{'id':Number(_0x9b2c08[_0x19dd('0x30')]['id']),'tags':_0x3618ff||[]});return{'id':Number(_0x9b2c08[_0x19dd('0x30')]['id']),'tags':_0x3618ff||[]};});}})[_0x19dd('0x1e')](respondWithResult(_0x1c265b,null))[_0x19dd('0x2e')](handleError(_0x1c265b,null));};exports[_0x19dd('0x55')]=function(_0x12df6d,_0x5e066a){return db['SmsInteraction'][_0x19dd('0x3b')]({'where':{'id':_0x12df6d[_0x19dd('0x30')]['id']}})[_0x19dd('0x1e')](handleEntityNotFound(_0x5e066a,null))[_0x19dd('0x1e')](function(_0x28c6fd){if(_0x28c6fd){return _0x28c6fd[_0x19dd('0x55')](_0x12df6d[_0x19dd('0x2d')][_0x19dd('0x51')]);}})[_0x19dd('0x1e')](respondWithStatusCode(_0x5e066a,null))['catch'](handleError(_0x5e066a,null));};exports['download']=function(_0xda5773,_0xf1c61f){var _0x40e850=moment()['unix']()[_0x19dd('0x56')]();var _0x3b965e=path[_0x19dd('0x57')](config['root'],'server',_0x19dd('0x58'),_0x19dd('0x59'));var _0x1678fd=path[_0x19dd('0x57')](_0x3b965e,_0x40e850);var _0x4d134d=util[_0x19dd('0x4d')](_0x19dd('0x5a'),_0xda5773[_0x19dd('0x30')]['id'],_0x40e850);var _0x5e9630=path['join'](_0x3b965e,_0x4d134d);var _0x47c204=[];_0x47c204['push']({'model':db[_0x19dd('0x5b')],'as':_0x19dd('0x5b'),'attributes':['id','fullname'],'raw':!![]});_0x47c204[_0x19dd('0x5c')]({'model':db[_0x19dd('0x5d')],'as':_0x19dd('0x5e'),'attributes':['id',_0x19dd('0x5f'),_0x19dd('0x60')],'raw':!![]});var _0x3933f1=[{'model':db['SmsMessage'],'as':_0x19dd('0x61'),'attributes':['id','body',_0x19dd('0x62'),'direction','secret',_0x19dd('0x63')],'include':_0x47c204}];_0x3933f1[_0x19dd('0x5c')]({'model':db[_0x19dd('0x64')],'as':_0x19dd('0x65'),'attributes':['id','name']});_0x3933f1['push']({'model':db[_0x19dd('0x5b')],'as':'Owner','attributes':['id',_0x19dd('0x66')]});return db[_0x19dd('0x25')][_0x19dd('0x3b')]({'where':{'id':_0xda5773[_0x19dd('0x30')]['id']},'include':_0x3933f1})['then'](handleEntityNotFound(_0xf1c61f,null))[_0x19dd('0x1e')](function(_0x627648){if(_0x627648){var _0x5c86c9=_0x627648['get']({'plain':!![]});fs['mkdirSync'](_0x1678fd);var _0x51e1bd={'channel':'Sms','account':_0x5c86c9[_0x19dd('0x65')][_0x19dd('0x22')],'agent':_0x5c86c9[_0x19dd('0x67')]?_0x5c86c9[_0x19dd('0x67')]['fullname']:_0x19dd('0x68'),'createdAt':moment(_0x5c86c9[_0x19dd('0x62')])['format'](_0x19dd('0x4e'))[_0x19dd('0x56')](),'closedAt':_0x5c86c9[_0x19dd('0x69')]?moment(_0x5c86c9[_0x19dd('0x6a')])[_0x19dd('0x4d')](_0x19dd('0x4e'))[_0x19dd('0x56')]():'','disposition':_0x5c86c9[_0x19dd('0x6b')],'messages':_(_0x5c86c9['Messages'])[_0x19dd('0x4a')]({'secret':![]})['map'](function(_0x3aa158){return{'date':moment(_0x3aa158['createdAt'])[_0x19dd('0x4d')](_0x19dd('0x4e'))[_0x19dd('0x56')](),'sender':_0x3aa158[_0x19dd('0x6c')]==='out'?_0x3aa158[_0x19dd('0x5b')]?_0x3aa158[_0x19dd('0x5b')][_0x19dd('0x66')]:_0x19dd('0x6d'):_0x3aa158[_0x19dd('0x5e')][_0x19dd('0x5f')]+(_0x3aa158['Contact'][_0x19dd('0x60')]?'\x20'+_0x3aa158[_0x19dd('0x5e')][_0x19dd('0x60')]:''),'body':_0x3aa158[_0x19dd('0x3a')],'direction':_0x3aa158[_0x19dd('0x6c')]==='out'?'A':'C','secret':_0x3aa158[_0x19dd('0x6e')],'read':_0x3aa158[_0x19dd('0x63')]};})['value']()};return ejs['renderFile'](path[_0x19dd('0x57')](config['root'],_0x19dd('0x6f'),_0x19dd('0x70'),'downloadInteraction.ejs'),{'interaction':_0x51e1bd})[_0x19dd('0x1e')](function(_0x873654){var _0x24c9f7=path[_0x19dd('0x57')](_0x1678fd,'transcript-'+_0x5c86c9['id']+'-'+_0x40e850+_0x19dd('0x71'));var _0x9b0013={'path':_0x24c9f7,'channel':'Sms','interactionId':_0x5c86c9['id']};return pdf[_0x19dd('0x72')](_0x873654,_0x9b0013);})[_0x19dd('0x1e')](function(){return new BPromise(function(_0x4fd088,_0x4e0c35){zipdir(_0x1678fd,{'saveTo':_0x5e9630},function(_0x19b8a4,_0x70bf39){if(_0x19b8a4)return _0x4e0c35(_0x19b8a4);return _0x4fd088(_0x70bf39);});})[_0x19dd('0x1e')](function(){return new BPromise(function(_0x132e35,_0x422ab3){rimraf(_0x1678fd,function(_0x2f3ecc){if(_0x2f3ecc)_0x422ab3(_0x2f3ecc);return _0x132e35();});});})[_0x19dd('0x1e')](function(){return _0xf1c61f['download'](_0x5e9630,_0x4d134d,function(_0x2b5f1b){if(_0x2b5f1b){console['log'](_0x19dd('0x73'),_0x2b5f1b);}else{fs[_0x19dd('0x74')](_0x5e9630);}});});});}else{return _0xf1c61f[_0x19dd('0x13')](0xc8);}})[_0x19dd('0x2e')](handleError(_0xf1c61f,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index a278c2f..5d57897 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 _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 +var _0x5c3c=['events','../../mysqldb','SmsInteraction','setMaxListeners','save','update','remove','getUsers','Users','map','findAll','then','setDataValue','unreadMessages','emit','catch','hook','exports'];(function(_0x94ccd8,_0x2f5a34){var _0x2df4ef=function(_0x58ded5){while(--_0x58ded5){_0x94ccd8['push'](_0x94ccd8['shift']());}};_0x2df4ef(++_0x2f5a34);}(_0x5c3c,0x132));var _0xc5c3=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x5c3c[_0x34bf97];return _0x292719;};'use strict';var EventEmitter=require(_0xc5c3('0x0'));var SmsInteraction=require(_0xc5c3('0x1'))['db'][_0xc5c3('0x2')];var SmsMessage=require(_0xc5c3('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc5c3('0x3')](0x0);var events={'afterCreate':_0xc5c3('0x4'),'afterUpdate':_0xc5c3('0x5'),'afterDestroy':_0xc5c3('0x6')};function emitEvent(_0x2535e0){return function(_0x36525d,_0xe85098,_0x23a6b5){_0x36525d[_0xc5c3('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4b8404){_0x36525d['setDataValue'](_0xc5c3('0x8'),_0x4b8404[_0xc5c3('0x9')](function(_0x593b35){return{'id':_0x593b35['id']};}));return SmsMessage[_0xc5c3('0xa')]({'where':{'SmsInteractionId':_0x36525d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc5c3('0xb')](function(_0x52f3eb){_0x36525d[_0xc5c3('0xc')](_0xc5c3('0xd'),_0x52f3eb['length']);SmsInteractionEvents[_0xc5c3('0xe')](_0x2535e0+':'+_0x36525d['id'],_0x36525d);SmsInteractionEvents[_0xc5c3('0xe')](_0x2535e0,_0x36525d);_0x23a6b5(null);})[_0xc5c3('0xf')](_0x23a6b5(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xc5c3('0x10')](e,emitEvent(event));}}module[_0xc5c3('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 5fbdd87..0fbd7a0 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 _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 +var _0xa66a=['rimraf','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x178ca4,_0x5aaa16){var _0x57f6a8=function(_0x237032){while(--_0x237032){_0x178ca4['push'](_0x178ca4['shift']());}};_0x57f6a8(++_0x5aaa16);}(_0xa66a,0x1b3));var _0xaa66=function(_0x4ecb45,_0x443e31){_0x4ecb45=_0x4ecb45-0x0;var _0x513d1b=_0xa66a[_0x4ecb45];return _0x513d1b;};'use strict';var _=require('lodash');var util=require(_0xaa66('0x0'));var logger=require(_0xaa66('0x1'))(_0xaa66('0x2'));var moment=require(_0xaa66('0x3'));var BPromise=require(_0xaa66('0x4'));var rp=require(_0xaa66('0x5'));var fs=require('fs');var path=require(_0xaa66('0x6'));var rimraf=require(_0xaa66('0x7'));var config=require(_0xaa66('0x8'));var attributes=require(_0xaa66('0x9'));module[_0xaa66('0xa')]=function(_0x1205c1,_0x4efdd7){return _0x1205c1['define'](_0xaa66('0xb'),attributes,{'tableName':_0xaa66('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x16b8f1,_0x2d1837,_0x41da11){if(_0x16b8f1[_0xaa66('0xd')]('closed')){_0x16b8f1[_0xaa66('0xe')]=moment()[_0xaa66('0xf')](_0xaa66('0x10'));}_0x41da11(null,_0x16b8f1);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index df917e2..2a0adfd 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 _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 +var _0x2025=['ids','omit','spread','AddTags','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','SmsInteraction,\x20%s,\x20%s','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','update','body','options','where','attributes','info','debug','UpdateSmsInteraction','AddTagsToSmsInteraction','SmsInteraction','then'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x2025,0x155));var _0x5202=function(_0x21e11f,_0x591e71){_0x21e11f=_0x21e11f-0x0;var _0x4e9da1=_0x2025[_0x21e11f];return _0x4e9da1;};'use strict';var _=require(_0x5202('0x0'));var util=require(_0x5202('0x1'));var moment=require(_0x5202('0x2'));var BPromise=require(_0x5202('0x3'));var rs=require(_0x5202('0x4'));var fs=require('fs');var Redis=require(_0x5202('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5202('0x6'));var logger=require(_0x5202('0x7'))(_0x5202('0x8'));var config=require('../../config/environment');var jayson=require(_0x5202('0x9'));var client=jayson[_0x5202('0xa')][_0x5202('0xb')]({'port':0x232a});config[_0x5202('0xc')]=_[_0x5202('0xd')](config[_0x5202('0xc')],{'host':_0x5202('0xe'),'port':0x18eb});var socket=require(_0x5202('0xf'))(new Redis(config['redis']));require(_0x5202('0x10'))[_0x5202('0x11')](socket);function respondWithRpcPromise(_0x336fcf,_0x12a4e5,_0x466800){return new BPromise(function(_0x30e51d,_0x4a3e87){return client[_0x5202('0x12')](_0x336fcf,_0x466800)['then'](function(_0x954515){logger['info'](_0x5202('0x13'),_0x12a4e5,'request\x20sent');logger['debug'](_0x5202('0x14'),_0x12a4e5,_0x5202('0x15'),JSON[_0x5202('0x16')](_0x954515));if(_0x954515[_0x5202('0x17')]){if(_0x954515[_0x5202('0x17')][_0x5202('0x18')]===0x1f4){logger[_0x5202('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x12a4e5,_0x954515[_0x5202('0x17')]['message']);return _0x4a3e87(_0x954515[_0x5202('0x17')][_0x5202('0x19')]);}logger[_0x5202('0x17')](_0x5202('0x13'),_0x12a4e5,_0x954515[_0x5202('0x17')]['message']);return _0x30e51d(_0x954515[_0x5202('0x17')][_0x5202('0x19')]);}else{logger['info'](_0x5202('0x13'),_0x12a4e5,_0x5202('0x15'));_0x30e51d(_0x954515['result'][_0x5202('0x19')]);}})['catch'](function(_0x30cb62){logger[_0x5202('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x12a4e5,_0x30cb62);_0x4a3e87(_0x30cb62);});});}exports['UpdateSmsInteraction']=function(_0x293028){var _0x4e89f8=this;return new Promise(function(_0x38f455,_0x219cff){return db['SmsInteraction'][_0x5202('0x1a')](_0x293028[_0x5202('0x1b')],{'raw':_0x293028['options']?_0x293028[_0x5202('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x293028['options']?_0x293028[_0x5202('0x1c')][_0x5202('0x1d')]||null:null,'attributes':_0x293028[_0x5202('0x1c')]?_0x293028[_0x5202('0x1c')][_0x5202('0x1e')]||null:null,'limit':_0x293028[_0x5202('0x1c')]?_0x293028[_0x5202('0x1c')]['limit']||null:null})['then'](function(_0x2553ab){logger[_0x5202('0x1f')]('UpdateSmsInteraction',_0x293028);logger[_0x5202('0x20')](_0x5202('0x21'),_0x293028,JSON[_0x5202('0x16')](_0x2553ab));_0x38f455(_0x2553ab);})['catch'](function(_0x10e0ab){logger['error'](_0x5202('0x21'),_0x10e0ab[_0x5202('0x19')],_0x293028);_0x219cff(_0x4e89f8[_0x5202('0x17')](0x1f4,_0x10e0ab[_0x5202('0x19')]));});});};exports[_0x5202('0x22')]=function(_0x8f219a){return new Promise(function(_0x1f1c95,_0x5c295d){return db[_0x5202('0x23')]['find']({'where':_0x8f219a[_0x5202('0x1c')]?_0x8f219a[_0x5202('0x1c')][_0x5202('0x1d')]||null:null})[_0x5202('0x24')](function(_0x210811){if(_0x210811){return _0x210811['addTags'](_0x8f219a[_0x5202('0x1b')][_0x5202('0x25')],_[_0x5202('0x26')](_0x8f219a[_0x5202('0x1b')],[_0x5202('0x25'),'id'])||{});}})[_0x5202('0x27')](function(_0x2a8395){logger[_0x5202('0x1f')]('AddTags',_0x8f219a);logger[_0x5202('0x20')](_0x5202('0x28'),_0x8f219a,JSON[_0x5202('0x16')](_0x2a8395));_0x1f1c95(_0x2a8395);})[_0x5202('0x29')](function(_0x3ce2c9){logger[_0x5202('0x17')](_0x5202('0x28'),_0x3ce2c9[_0x5202('0x19')],_0x8f219a);_0x5c295d(_this[_0x5202('0x17')](0x1f4,_0x3ce2c9[_0x5202('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index a2417be..f1fe025 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 _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 +var _0xc2f1=['smsInteraction:','./smsInteraction.events','save','update','emit','removeListener','register'];(function(_0x2c6484,_0x4fe72c){var _0x3b9d94=function(_0x3d8bd4){while(--_0x3d8bd4){_0x2c6484['push'](_0x2c6484['shift']());}};_0x3b9d94(++_0x4fe72c);}(_0xc2f1,0x8d));var _0x1c2f=function(_0x1441d9,_0x1e7a04){_0x1441d9=_0x1441d9-0x0;var _0x1b712d=_0xc2f1[_0x1441d9];return _0x1b712d;};'use strict';var SmsInteractionEvents=require(_0x1c2f('0x0'));var events=[_0x1c2f('0x1'),'remove',_0x1c2f('0x2')];function createListener(_0x41a172,_0x20c88c){return function(_0x4eccfd){_0x20c88c[_0x1c2f('0x3')](_0x41a172,_0x4eccfd);};}function removeListener(_0x20c970,_0x518cb2){return function(){SmsInteractionEvents[_0x1c2f('0x4')](_0x20c970,_0x518cb2);};}exports[_0x1c2f('0x5')]=function(_0x56357e){for(var _0x3a8e1c=0x0,_0x57015c=events['length'];_0x3a8e1c<_0x57015c;_0x3a8e1c++){var _0x165de6=events[_0x3a8e1c];var _0x506b04=createListener(_0x1c2f('0x6')+_0x165de6,_0x56357e);SmsInteractionEvents['on'](_0x165de6,_0x506b04);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index cd5dd04..217d4e4 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 _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 +var _0xa515=['accept','reject','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','post','tracked','sms','smsmessage:create','create','/:id/status','put','/:id','update','/:id/accept'];(function(_0x3a2005,_0x11d3bc){var _0x393aeb=function(_0x80eb9){while(--_0x80eb9){_0x3a2005['push'](_0x3a2005['shift']());}};_0x393aeb(++_0x11d3bc);}(_0xa515,0x108));var _0x5a51=function(_0x4beb54,_0x5cd337){_0x4beb54=_0x4beb54-0x0;var _0x3f7fde=_0xa515[_0x4beb54];return _0x3f7fde;};'use strict';var multer=require(_0x5a51('0x0'));var util=require(_0x5a51('0x1'));var path=require(_0x5a51('0x2'));var timeout=require(_0x5a51('0x3'));var express=require('express');var router=express[_0x5a51('0x4')]();var fs_extra=require(_0x5a51('0x5'));var auth=require(_0x5a51('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5a51('0x7'));var controller=require('./smsMessage.controller');router[_0x5a51('0x8')]('/',auth['isAuthenticated'](),controller[_0x5a51('0x9')]);router['get'](_0x5a51('0xa'),auth[_0x5a51('0xb')](),controller['describe']);router[_0x5a51('0x8')]('/:id',auth[_0x5a51('0xb')](),controller['show']);router[_0x5a51('0xc')]('/',auth[_0x5a51('0xb')](),interaction[_0x5a51('0xd')](_0x5a51('0xe'),_0x5a51('0xf')),controller[_0x5a51('0x10')]);router[_0x5a51('0xc')](_0x5a51('0x11'),controller['status']);router[_0x5a51('0x12')](_0x5a51('0x13'),auth[_0x5a51('0xb')](),controller[_0x5a51('0x14')]);router[_0x5a51('0x12')](_0x5a51('0x15'),auth['isAuthenticated'](),controller[_0x5a51('0x16')]);router[_0x5a51('0x12')]('/:id/reject',auth[_0x5a51('0xb')](),controller[_0x5a51('0x17')]);router[_0x5a51('0x18')](_0x5a51('0x13'),auth[_0x5a51('0xb')](),controller['destroy']);module[_0x5a51('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index cc9977f..7cf0fd0 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 _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 +var _0x2cbe=['STRING','DATE','exports','TEXT','medium','BOOLEAN'];(function(_0x42d306,_0x26e098){var _0x2abdaf=function(_0xee2032){while(--_0xee2032){_0x42d306['push'](_0x42d306['shift']());}};_0x2abdaf(++_0x26e098);}(_0x2cbe,0x110));var _0xe2cb=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x2cbe[_0xea8947];return _0x2455e9;};'use strict';var Sequelize=require('sequelize');module[_0xe2cb('0x0')]={'body':{'type':Sequelize[_0xe2cb('0x1')](_0xe2cb('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xe2cb('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xe2cb('0x4')](0xbe)},'phone':{'type':Sequelize[_0xe2cb('0x4')]},'readAt':{'type':Sequelize[_0xe2cb('0x5')]},'secret':{'type':Sequelize[_0xe2cb('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xe2cb('0x4')]},'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 36cc04f..edaca21 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 _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 +var _0x8ac5=['./smsMessage.socket','register','client','http','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','limit','count','set','then','destroy','stack','name','send','index','SmsMessage','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','body','update','find','describe','../../config/logger','accept','read','format','UserId','user','agent','get','SmsInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','internal','manual','interface','SIP/%s','event','EventManager','sms','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','fullname','email','channel','motionChannel','reject','rejectmessage','SmsAccount','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','delivered','Status','plivio','infobip','results','DELIVERED','SmsAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter'];(function(_0x23d24f,_0x1e0b12){var _0x45b301=function(_0x12ac9d){while(--_0x12ac9d){_0x23d24f['push'](_0x23d24f['shift']());}};_0x45b301(++_0x1e0b12);}(_0x8ac5,0x105));var _0x58ac=function(_0x258feb,_0x59e01f){_0x258feb=_0x258feb-0x0;var _0x40fc52=_0x8ac5[_0x258feb];return _0x40fc52;};'use strict';var emlformat=require(_0x58ac('0x0'));var rimraf=require(_0x58ac('0x1'));var zipdir=require(_0x58ac('0x2'));var jsonpatch=require(_0x58ac('0x3'));var rp=require(_0x58ac('0x4'));var moment=require(_0x58ac('0x5'));var BPromise=require(_0x58ac('0x6'));var Mustache=require(_0x58ac('0x7'));var util=require(_0x58ac('0x8'));var path=require(_0x58ac('0x9'));var sox=require('sox');var csv=require(_0x58ac('0xa'));var ejs=require(_0x58ac('0xb'));var fs=require('fs');var fs_extra=require(_0x58ac('0xc'));var _=require(_0x58ac('0xd'));var squel=require(_0x58ac('0xe'));var crypto=require(_0x58ac('0xf'));var jsforce=require(_0x58ac('0x10'));var deskjs=require(_0x58ac('0x11'));var toCsv=require(_0x58ac('0xa'));var querystring=require(_0x58ac('0x12'));var Papa=require(_0x58ac('0x13'));var Redis=require(_0x58ac('0x14'));var authService=require(_0x58ac('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x58ac('0x16'));var hardwareService=require(_0x58ac('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x58ac('0x18'));var config=require(_0x58ac('0x19'));var licenseUtil=require(_0x58ac('0x1a'));var db=require(_0x58ac('0x1b'))['db'];config[_0x58ac('0x1c')]=_['defaults'](config[_0x58ac('0x1c')],{'host':_0x58ac('0x1d'),'port':0x18eb});var socket=require(_0x58ac('0x1e'))(new Redis(config[_0x58ac('0x1c')]));require(_0x58ac('0x1f'))[_0x58ac('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0x58ac('0x21')][_0x58ac('0x22')]({'port':0x232c});var client9002=jayson[_0x58ac('0x21')][_0x58ac('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x370baa,_0x442f2a,_0x8939b1,_0x10c16c){return new BPromise(function(_0x1a9aa1,_0x52cede){var _0x5bb92f=_0x10c16c||client;return _0x5bb92f[_0x58ac('0x23')](_0x370baa,_0x8939b1)['then'](function(_0x2bffd6){logger[_0x58ac('0x24')](_0x58ac('0x25'),_0x442f2a,_0x58ac('0x26'));logger[_0x58ac('0x27')](_0x58ac('0x28'),_0x442f2a,_0x58ac('0x26'),JSON[_0x58ac('0x29')](_0x2bffd6));if(_0x2bffd6[_0x58ac('0x2a')]){if(_0x2bffd6[_0x58ac('0x2a')][_0x58ac('0x2b')]===0x1f4){logger[_0x58ac('0x2a')](_0x58ac('0x25'),_0x442f2a,_0x2bffd6['error'][_0x58ac('0x2c')]);return _0x52cede(_0x2bffd6[_0x58ac('0x2a')][_0x58ac('0x2c')]);}logger[_0x58ac('0x2a')](_0x58ac('0x25'),_0x442f2a,_0x2bffd6[_0x58ac('0x2a')]['message']);return _0x1a9aa1(_0x2bffd6[_0x58ac('0x2a')]['message']);}else{logger[_0x58ac('0x24')]('SmsMessage,\x20%s,\x20%s',_0x442f2a,_0x58ac('0x26'));_0x1a9aa1(_0x2bffd6[_0x58ac('0x2d')]['message']);}})[_0x58ac('0x2e')](function(_0x12c766){logger[_0x58ac('0x2a')](_0x58ac('0x25'),_0x442f2a,_0x12c766);_0x52cede(_0x12c766);});});}function respondWithStatusCode(_0x48dd57,_0x4e169d){_0x4e169d=_0x4e169d||0xcc;return function(_0x59ac25){if(_0x59ac25){return _0x48dd57[_0x58ac('0x2f')](_0x4e169d);}return _0x48dd57['status'](_0x4e169d)[_0x58ac('0x30')]();};}function respondWithResult(_0x466d3f,_0xc581f8){_0xc581f8=_0xc581f8||0xc8;return function(_0x5d359a){if(_0x5d359a){return _0x466d3f[_0x58ac('0x31')](_0xc581f8)[_0x58ac('0x32')](_0x5d359a);}};}function respondWithFilteredResult(_0x3adb8d,_0x36ad82){return function(_0x129fe1){if(_0x129fe1){var _0xad5e8d=typeof _0x36ad82[_0x58ac('0x33')]==='undefined'&&typeof _0x36ad82[_0x58ac('0x34')]==='undefined';var _0x3db01c=_0x129fe1[_0x58ac('0x35')];var _0x45e2b1=_0xad5e8d?0x0:_0x36ad82[_0x58ac('0x33')];var _0x40b11e=_0xad5e8d?_0x129fe1['count']:_0x36ad82[_0x58ac('0x33')]+_0x36ad82[_0x58ac('0x34')];var _0x11a6a5;if(_0x40b11e>=_0x3db01c){_0x40b11e=_0x3db01c;_0x11a6a5=0xc8;}else{_0x11a6a5=0xce;}_0x3adb8d[_0x58ac('0x31')](_0x11a6a5);return _0x3adb8d[_0x58ac('0x36')]('Content-Range',_0x45e2b1+'-'+_0x40b11e+'/'+_0x3db01c)[_0x58ac('0x32')](_0x129fe1);}return null;};}function patchUpdates(_0x58f8df){return function(_0x300ab2){try{jsonpatch['apply'](_0x300ab2,_0x58f8df,!![]);}catch(_0xd8f04f){return BPromise['reject'](_0xd8f04f);}return _0x300ab2['save']();};}function saveUpdates(_0x1a7182,_0x2526ef){return function(_0x383e7b){if(_0x383e7b){return _0x383e7b['update'](_0x1a7182)[_0x58ac('0x37')](function(_0x5888c2){return _0x5888c2;});}return null;};}function removeEntity(_0x3245f4,_0x2cc1ea){return function(_0x285dd1){if(_0x285dd1){return _0x285dd1[_0x58ac('0x38')]()[_0x58ac('0x37')](function(){_0x3245f4[_0x58ac('0x31')](0xcc)[_0x58ac('0x30')]();});}};}function handleEntityNotFound(_0x589ff1,_0x4d1099){return function(_0x23b150){if(!_0x23b150){_0x589ff1[_0x58ac('0x2f')](0x194);}return _0x23b150;};}function handleError(_0x13c09a,_0x49d9ed){_0x49d9ed=_0x49d9ed||0x1f4;return function(_0x2f743d){logger['error'](_0x2f743d[_0x58ac('0x39')]);if(_0x2f743d['name']){delete _0x2f743d[_0x58ac('0x3a')];}_0x13c09a[_0x58ac('0x31')](_0x49d9ed)[_0x58ac('0x3b')](_0x2f743d);};}exports[_0x58ac('0x3c')]=function(_0x37437a,_0x11b46f){var _0x204f97={},_0x47e497={},_0xc3c7f7={'count':0x0,'rows':[]};var _0x2105d7=_['map'](db[_0x58ac('0x3d')][_0x58ac('0x3e')],function(_0x4c264c){return{'name':_0x4c264c[_0x58ac('0x3f')],'type':_0x4c264c[_0x58ac('0x40')]['key']};});_0x47e497[_0x58ac('0x41')]=_[_0x58ac('0x42')](_0x2105d7,_0x58ac('0x3a'));_0x47e497[_0x58ac('0x43')]=_[_0x58ac('0x44')](_0x37437a[_0x58ac('0x43')]);_0x47e497[_0x58ac('0x45')]=_[_0x58ac('0x46')](_0x47e497[_0x58ac('0x41')],_0x47e497[_0x58ac('0x43')]);_0x204f97[_0x58ac('0x47')]=_['intersection'](_0x47e497[_0x58ac('0x41')],qs[_0x58ac('0x48')](_0x37437a[_0x58ac('0x43')]['fields']));_0x204f97[_0x58ac('0x47')]=_0x204f97['attributes']['length']?_0x204f97[_0x58ac('0x47')]:_0x47e497[_0x58ac('0x41')];if(!_0x37437a[_0x58ac('0x43')][_0x58ac('0x49')](_0x58ac('0x4a'))){_0x204f97[_0x58ac('0x34')]=qs[_0x58ac('0x34')](_0x37437a['query'][_0x58ac('0x34')]);_0x204f97[_0x58ac('0x33')]=qs[_0x58ac('0x33')](_0x37437a['query']['offset']);}_0x204f97['order']=qs['sort'](_0x37437a[_0x58ac('0x43')][_0x58ac('0x4b')]);_0x204f97[_0x58ac('0x4c')]=qs['filters'](_['pick'](_0x37437a[_0x58ac('0x43')],_0x47e497[_0x58ac('0x45')]),_0x2105d7);if(_0x37437a[_0x58ac('0x43')][_0x58ac('0x4d')]){_0x204f97[_0x58ac('0x4c')]=_[_0x58ac('0x4e')](_0x204f97[_0x58ac('0x4c')],{'$or':_[_0x58ac('0x42')](_0x2105d7,function(_0x26a42b){if(_0x26a42b['type']!==_0x58ac('0x4f')){var _0x47ff55={};_0x47ff55[_0x26a42b[_0x58ac('0x3a')]]={'$like':'%'+_0x37437a[_0x58ac('0x43')][_0x58ac('0x4d')]+'%'};return _0x47ff55;}})});}_0x204f97=_['merge']({},_0x204f97,_0x37437a[_0x58ac('0x50')]);var _0x45d5bc={'where':_0x204f97[_0x58ac('0x4c')]};return db[_0x58ac('0x3d')][_0x58ac('0x35')](_0x45d5bc)[_0x58ac('0x37')](function(_0x4afa81){_0xc3c7f7[_0x58ac('0x35')]=_0x4afa81;if(_0x37437a[_0x58ac('0x43')][_0x58ac('0x51')]){_0x204f97[_0x58ac('0x52')]=[{'all':!![]}];}return db['SmsMessage'][_0x58ac('0x53')](_0x204f97);})[_0x58ac('0x37')](function(_0x3a2875){_0xc3c7f7[_0x58ac('0x54')]=_0x3a2875;return _0xc3c7f7;})[_0x58ac('0x37')](respondWithFilteredResult(_0x11b46f,_0x204f97))[_0x58ac('0x2e')](handleError(_0x11b46f,null));};exports[_0x58ac('0x55')]=function(_0x3fe6d4,_0x3591c8){var _0x1bf571={'raw':!![],'where':{'id':_0x3fe6d4[_0x58ac('0x56')]['id']}},_0x3f482e={};_0x3f482e[_0x58ac('0x41')]=_[_0x58ac('0x44')](db[_0x58ac('0x3d')][_0x58ac('0x3e')]);_0x3f482e['query']=_[_0x58ac('0x44')](_0x3fe6d4[_0x58ac('0x43')]);_0x3f482e[_0x58ac('0x45')]=_['intersection'](_0x3f482e[_0x58ac('0x41')],_0x3f482e[_0x58ac('0x43')]);_0x1bf571[_0x58ac('0x47')]=_['intersection'](_0x3f482e[_0x58ac('0x41')],qs[_0x58ac('0x48')](_0x3fe6d4['query'][_0x58ac('0x48')]));_0x1bf571['attributes']=_0x1bf571[_0x58ac('0x47')]['length']?_0x1bf571[_0x58ac('0x47')]:_0x3f482e['model'];if(_0x3fe6d4[_0x58ac('0x43')][_0x58ac('0x51')]){_0x1bf571[_0x58ac('0x52')]=[{'all':!![]}];}_0x1bf571=_[_0x58ac('0x4e')]({},_0x1bf571,_0x3fe6d4['options']);return db[_0x58ac('0x3d')]['find'](_0x1bf571)[_0x58ac('0x37')](handleEntityNotFound(_0x3591c8,null))[_0x58ac('0x37')](respondWithResult(_0x3591c8,null))[_0x58ac('0x2e')](handleError(_0x3591c8,null));};exports[_0x58ac('0x57')]=function(_0xa73d8d,_0x7957fd){return db[_0x58ac('0x3d')]['create'](_0xa73d8d[_0x58ac('0x58')],{})['then'](respondWithResult(_0x7957fd,0xc9))[_0x58ac('0x2e')](handleError(_0x7957fd,null));};exports[_0x58ac('0x59')]=function(_0x517307,_0xf4364f){if(_0x517307[_0x58ac('0x58')]['id']){delete _0x517307[_0x58ac('0x58')]['id'];}return db[_0x58ac('0x3d')][_0x58ac('0x5a')]({'where':{'id':_0x517307['params']['id']}})['then'](handleEntityNotFound(_0xf4364f,null))['then'](saveUpdates(_0x517307[_0x58ac('0x58')],null))[_0x58ac('0x37')](respondWithResult(_0xf4364f,null))[_0x58ac('0x2e')](handleError(_0xf4364f,null));};exports['destroy']=function(_0x1c484f,_0x290225){return db['SmsMessage'][_0x58ac('0x5a')]({'where':{'id':_0x1c484f[_0x58ac('0x56')]['id']}})[_0x58ac('0x37')](handleEntityNotFound(_0x290225,null))[_0x58ac('0x37')](removeEntity(_0x290225,null))[_0x58ac('0x2e')](handleError(_0x290225,null));};exports[_0x58ac('0x5b')]=function(_0x6bbfe8,_0x3f716d){return db['SmsMessage'][_0x58ac('0x5b')]()[_0x58ac('0x37')](respondWithResult(_0x3f716d,null))[_0x58ac('0x2e')](handleError(_0x3f716d,null));};var interaction_log=require(_0x58ac('0x5c'))('sms-interactions');exports[_0x58ac('0x5d')]=function(_0x2b8117,_0x3deb1b,_0x5d84a0){var _0x43d41d={'agent':{},'channel':'sms'};if(_0x2b8117[_0x58ac('0x58')]['id']){delete _0x2b8117['body']['id'];}_0x2b8117[_0x58ac('0x58')][_0x58ac('0x5e')]=!![];_0x2b8117[_0x58ac('0x58')]['readAt']=moment()[_0x58ac('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x2b8117[_0x58ac('0x58')]['UserId']=_0x2b8117[_0x58ac('0x58')][_0x58ac('0x60')]||_0x2b8117[_0x58ac('0x61')]['id'];_0x43d41d[_0x58ac('0x62')]['id']=_0x2b8117['body'][_0x58ac('0x60')];return db[_0x58ac('0x3d')]['find']({'where':{'id':_0x2b8117['params']['id'],'UserId':null}})[_0x58ac('0x37')](handleEntityNotFound(_0x3deb1b,null))[_0x58ac('0x37')](saveUpdates(_0x2b8117['body'],null))[_0x58ac('0x37')](function(_0x44d4fd){if(_0x44d4fd){_0x43d41d[_0x58ac('0x2c')]=_0x44d4fd[_0x58ac('0x63')]({'plain':!![]});return db[_0x58ac('0x64')][_0x58ac('0x5a')]({'where':{'id':_0x44d4fd['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x3deb1b,null))['then'](function(_0x2bff96){if(_0x2bff96){return _0x2bff96[_0x58ac('0x59')]({'UserId':_0x2b8117['body'][_0x58ac('0x60')],'read1stAt':_[_0x58ac('0x65')](_0x2bff96[_0x58ac('0x66')])?moment()[_0x58ac('0x5f')](_0x58ac('0x67')):undefined});}return null;})[_0x58ac('0x37')](function(_0x2adc57){if(_0x2adc57){_0x43d41d[_0x58ac('0x68')]=_0x2adc57[_0x58ac('0x63')]({'plain':!![]});interaction_log[_0x58ac('0x24')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2b8117['user']['id'],_0x2b8117['user']['name'],_0x2b8117[_0x58ac('0x61')]['role'],_0x43d41d[_0x58ac('0x68')]['id'],_0x2b8117[_0x58ac('0x58')]?JSON['stringify'](_0x2b8117[_0x58ac('0x58')]):_0x58ac('0x69'));return respondWithRpcPromise(_0x58ac('0x6a'),_0x58ac('0x6b'),_0x43d41d);}return null;})[_0x58ac('0x37')](function(_0x23b569){var _0x24e052=_0x58ac('0x6c')+_0x23b569[_0x58ac('0x2c')][_0x58ac('0x6d')];return db[_0x58ac('0x6e')][_0x58ac('0x43')](_0x24e052,{'type':db['Sequelize'][_0x58ac('0x6f')][_0x58ac('0x70')],'raw':!![]})['then'](function(_0x5165bd){return _0x5165bd;});})['then'](function(_0x54ce46){if(_0x54ce46){_0x43d41d[_0x58ac('0x2c')][_0x58ac('0x71')]=_0x54ce46[0x0];if(!_0x2b8117[_0x58ac('0x58')][_0x58ac('0x60')])return;return db[_0x58ac('0x72')][_0x58ac('0x5a')]({'where':{'id':_0x2b8117['body']['UserId'],'role':'agent'},'attributes':['id',_0x58ac('0x3a'),'fullname','email',_0x58ac('0x73')],'raw':!![]});}return null;})['then'](function(_0x4db3af){if(!_0x4db3af)return null;_0x43d41d[_0x58ac('0x2c')][_0x58ac('0x62')]=_0x4db3af;return _0x43d41d;})['then'](function(_0xd892f8){if(_0xd892f8){if(_0x2b8117[_0x58ac('0x58')][_0x58ac('0x74')]){_0x43d41d[_0x58ac('0x2c')][_0x58ac('0x75')]=util['format'](_0x58ac('0x76'),_0x2b8117[_0x58ac('0x61')][_0x58ac('0x3a')]);_0x43d41d[_0x58ac('0x2c')]['channel']=_0x43d41d['channel'];_0x43d41d['message']['motionChannel']=_0x43d41d['channel'];_0x43d41d[_0x58ac('0x2c')][_0x58ac('0x77')]=_0x58ac('0x5d');return respondWithRpcPromise(_0x58ac('0x78'),'EventManager',{'event':'acceptmessage','message':_0x43d41d[_0x58ac('0x2c')]},client9002)[_0x58ac('0x37')](function(){return _0x43d41d;});}return _0x43d41d;}return null;})[_0x58ac('0x37')](respondWithResult(_0x3deb1b,null))[_0x58ac('0x2e')](handleError(_0x3deb1b,null));};var interaction_log=require(_0x58ac('0x5c'))('sms-interactions');exports['reject']=function(_0x4c16a2,_0x57f7ca,_0x1d33d1){var _0x2b90bf={'agent':{},'channel':_0x58ac('0x79')};if(_0x4c16a2[_0x58ac('0x58')]['id']){delete _0x4c16a2[_0x58ac('0x58')]['id'];}_0x4c16a2[_0x58ac('0x58')][_0x58ac('0x60')]=_0x4c16a2[_0x58ac('0x58')][_0x58ac('0x60')]||_0x4c16a2[_0x58ac('0x61')]['id'];_0x2b90bf[_0x58ac('0x62')]['id']=_0x4c16a2[_0x58ac('0x58')][_0x58ac('0x60')];return db[_0x58ac('0x3d')][_0x58ac('0x5a')]({'where':{'id':_0x4c16a2[_0x58ac('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x57f7ca,null))['then'](function(_0x3f30af){if(_0x3f30af){_0x2b90bf['message']=_0x3f30af[_0x58ac('0x63')]({'plain':!![]});return db['SmsInteraction'][_0x58ac('0x5a')]({'where':{'id':_0x3f30af[_0x58ac('0x7a')]}});}return null;})['then'](handleEntityNotFound(_0x57f7ca,null))[_0x58ac('0x37')](function(_0x282c03){if(_0x282c03){_0x2b90bf[_0x58ac('0x68')]=_0x282c03['get']({'plain':!![]});interaction_log[_0x58ac('0x24')](_0x58ac('0x7b'),_0x4c16a2['user']['id'],_0x4c16a2[_0x58ac('0x61')]['name'],_0x4c16a2[_0x58ac('0x61')][_0x58ac('0x7c')],_0x2b90bf[_0x58ac('0x68')]['id'],_0x4c16a2[_0x58ac('0x58')]?JSON[_0x58ac('0x29')](_0x4c16a2['body']):_0x58ac('0x69'));return respondWithRpcPromise('RejectMessage',_0x58ac('0x7d'),_0x2b90bf);}return null;})[_0x58ac('0x37')](function(_0x20e290){var _0x44b7f6=_0x58ac('0x6c')+_0x20e290[_0x58ac('0x2c')][_0x58ac('0x6d')];return db[_0x58ac('0x6e')]['query'](_0x44b7f6,{'type':db['Sequelize']['QueryTypes'][_0x58ac('0x70')],'raw':!![]})[_0x58ac('0x37')](function(_0x2e4c36){return _0x2e4c36;});})[_0x58ac('0x37')](function(_0x224580){if(_0x224580){_0x2b90bf[_0x58ac('0x2c')]['contact']=_0x224580[0x0];if(!_0x4c16a2[_0x58ac('0x58')]['UserId'])return;return db[_0x58ac('0x72')]['find']({'where':{'id':_0x4c16a2[_0x58ac('0x58')][_0x58ac('0x60')],'role':'agent'},'attributes':['id',_0x58ac('0x3a'),_0x58ac('0x7e'),_0x58ac('0x7f'),'internal'],'raw':!![]});}return null;})[_0x58ac('0x37')](function(_0x12fd23){if(!_0x12fd23)return null;_0x2b90bf[_0x58ac('0x2c')]['agent']=_0x12fd23;return _0x2b90bf;})[_0x58ac('0x37')](function(_0xf1a462){if(_0xf1a462){_0xf1a462['message'][_0x58ac('0x75')]=util[_0x58ac('0x5f')](_0x58ac('0x76'),_0x4c16a2['user'][_0x58ac('0x3a')]);_0xf1a462[_0x58ac('0x2c')]['channel']=_0x2b90bf[_0x58ac('0x80')];_0xf1a462[_0x58ac('0x2c')][_0x58ac('0x81')]=_0x2b90bf[_0x58ac('0x80')];_0xf1a462['message'][_0x58ac('0x77')]=_0x58ac('0x82');respondWithRpcPromise(_0x58ac('0x78'),'EventManager',{'event':_0x58ac('0x83'),'message':_0xf1a462[_0x58ac('0x2c')]},client9002);return _0x2b90bf;}return null;})[_0x58ac('0x37')](respondWithResult(_0x57f7ca,null))[_0x58ac('0x2e')](handleError(_0x57f7ca,null));};exports[_0x58ac('0x31')]=function(_0x289264,_0x428613,_0x562a5d){if(_0x289264[_0x58ac('0x58')]['id']){delete _0x289264[_0x58ac('0x58')]['id'];}var _0x40f014;return db[_0x58ac('0x3d')][_0x58ac('0x5a')]({'where':{'id':_0x289264[_0x58ac('0x56')]['id']}})[_0x58ac('0x37')](handleEntityNotFound(_0x428613,null))['then'](function(_0x431f81){if(_0x431f81){_0x40f014=_0x431f81;return db[_0x58ac('0x84')][_0x58ac('0x5a')]({'where':{'id':_0x431f81['SmsAccountId']}});}})[_0x58ac('0x37')](handleEntityNotFound(_0x428613,null))[_0x58ac('0x37')](function(_0x29154f){if(_0x29154f){logger[_0x58ac('0x27')](_0x58ac('0x28'),_0x58ac('0x31'),'received\x20delivery\x20report\x20from',_0x29154f[_0x58ac('0x40')],util[_0x58ac('0x85')](_0x289264[_0x58ac('0x58')],{'showHidden':![],'depth':null}));switch(_0x29154f[_0x58ac('0x40')]){case _0x58ac('0x86'):if(_0x289264[_0x58ac('0x58')][_0x58ac('0x87')]&&_0x289264[_0x58ac('0x58')][_0x58ac('0x87')]===_0x40f014[_0x58ac('0x88')]){return _0x40f014[_0x58ac('0x59')]({'read':!![]});}else{logger[_0x58ac('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x58ac('0x31'),'twilio',util[_0x58ac('0x85')](_0x289264[_0x58ac('0x58')],{'showHidden':![],'depth':null}));}break;case _0x58ac('0x89'):if(_0x289264['body'][_0x58ac('0x8a')]&&_0x289264['body'][_0x58ac('0x8a')]===_0x40f014['messageId']&&_['indexOf'](['sent',_0x58ac('0x8b')],_0x289264['body'][_0x58ac('0x8c')])>=0x0){return _0x40f014[_0x58ac('0x59')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x58ac('0x31'),_0x58ac('0x8d'),util[_0x58ac('0x85')](_0x289264[_0x58ac('0x58')],{'showHidden':![],'depth':null}));}break;case _0x58ac('0x8e'):var _0x389ed6=_0x289264[_0x58ac('0x58')][_0x58ac('0x8f')][0x0];if(_0x389ed6[_0x58ac('0x31')]['groupName']===_0x58ac('0x90')){return _0x40f014['update']({'read':!![]});}else{logger[_0x58ac('0x2a')](_0x58ac('0x91'),_0x58ac('0x31'),'infobip',util[_0x58ac('0x85')](_0x289264[_0x58ac('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x40f014;}})[_0x58ac('0x37')](respondWithResult(_0x428613,null))[_0x58ac('0x2e')](handleError(_0x428613,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index fab1a76..c913d8e 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 _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 +var _0x2891=['events','../../mysqldb','SmsMessage','setMaxListeners','emit','hasOwnProperty','hook','exports'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x2891,0x128));var _0x1289=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2891[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x1289('0x0'));var SmsMessage=require(_0x1289('0x1'))['db'][_0x1289('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x1289('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc6a3d){return function(_0x42ec3b,_0x1a4e3e,_0x1c06ac){SmsMessageEvents[_0x1289('0x4')](_0xc6a3d+':'+_0x42ec3b['id'],_0x42ec3b);SmsMessageEvents[_0x1289('0x4')](_0xc6a3d,_0x42ec3b);_0x1c06ac(null);};}for(var e in events){if(events[_0x1289('0x5')](e)){var event=events[e];SmsMessage[_0x1289('0x6')](e,emitEvent(event));}}module[_0x1289('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 20bd71a..d61e6f2 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 _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 +var _0x5e65=['FULLTEXT','models','direction','toLowerCase','out','UserId','isNil','SmsInteractionId','SmsInteraction','findOne','update','createdAt','error','secret','SmsAccount','find','SmsAccountId','then','type','twilio','accountSid','authToken','phone','messages','/api/sms/messages/','token','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','&password=','GET','split','sms','POST','user_key','total_sent','internal_order_id','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','clicksend','xCALLY\x20Motion','format','%s:%s','toString','base64','http_code','data','queued_count','head','clickSend','plivo','authId','/status?token=','Basic\x20%s','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','remote','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','sort','length','createHash','md5','digest','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','clickatell','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','Bearer\x20','refid','status','message','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body'];(function(_0x3c0c92,_0x267969){var _0xe3859b=function(_0x4d38f2){while(--_0x4d38f2){_0x3c0c92['push'](_0x3c0c92['shift']());}};_0xe3859b(++_0x267969);}(_0x5e65,0x6c));var _0x55e6=function(_0x2bb423,_0x7e7cf5){_0x2bb423=_0x2bb423-0x0;var _0x1679ca=_0x5e65[_0x2bb423];return _0x1679ca;};'use strict';var _=require(_0x55e6('0x0'));var util=require(_0x55e6('0x1'));var logger=require(_0x55e6('0x2'))(_0x55e6('0x3'));var moment=require('moment');var BPromise=require(_0x55e6('0x4'));var rp=require(_0x55e6('0x5'));var fs=require('fs');var path=require(_0x55e6('0x6'));var rimraf=require('rimraf');var config=require(_0x55e6('0x7'));var attributes=require(_0x55e6('0x8'));module[_0x55e6('0x9')]=function(_0x18ed76,_0x163cd6){return _0x18ed76[_0x55e6('0xa')](_0x55e6('0xb'),attributes,{'tableName':_0x55e6('0xc'),'paranoid':![],'indexes':[{'name':_0x55e6('0xd'),'fields':[_0x55e6('0xd')]},{'name':_0x55e6('0xe'),'fields':[_0x55e6('0xf')],'type':_0x55e6('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a449b,_0x126e50,_0x1e3ab2){var _0x38d462=_0x18ed76[_0x55e6('0x11')];var _0x144acd=_0x5a449b['get']({'plain':!![]});if(_0x144acd[_0x55e6('0x12')][_0x55e6('0x13')]()==='in'||_0x144acd[_0x55e6('0x12')][_0x55e6('0x13')]()===_0x55e6('0x14')&&!_0x144acd['secret']&&!_['isNil'](_0x144acd[_0x55e6('0x15')])&&!_[_0x55e6('0x16')](_0x144acd[_0x55e6('0x17')])){_0x38d462[_0x55e6('0x18')][_0x55e6('0x19')]({'where':{'id':_0x144acd[_0x55e6('0x17')]}})['then'](function(_0x23f2fc){if(_0x23f2fc){_0x23f2fc[_0x55e6('0x1a')]({'lastMsgAt':_0x144acd[_0x55e6('0x1b')],'lastMsgDirection':_0x144acd[_0x55e6('0x12')][_0x55e6('0x13')]()});}})['catch'](function(_0x2d57ee){console[_0x55e6('0x1c')](_0x2d57ee);});}if(_0x144acd[_0x55e6('0x12')]===_0x55e6('0x14')&&!_0x144acd[_0x55e6('0x1d')]){var _0x1d3826;_0x38d462[_0x55e6('0x1e')][_0x55e6('0x1f')]({'where':{'id':_0x144acd[_0x55e6('0x20')]},'raw':!![]})[_0x55e6('0x21')](function(_0x4183f8){_0x1d3826=_0x4183f8;if(_0x1d3826&&_0x1d3826[_0x55e6('0x22')]){switch(_0x1d3826['type']){case _0x55e6('0x23'):var _0x1a75de=require(_0x55e6('0x23'));if(_0x1d3826[_0x55e6('0x24')]&&_0x1d3826[_0x55e6('0x25')]&&_0x1d3826[_0x55e6('0x26')]){var _0x1e1d9f=new _0x1a75de(_0x1d3826[_0x55e6('0x24')],_0x1d3826['authToken']);_0x1e1d9f[_0x55e6('0x27')]['create']({'body':_0x144acd[_0x55e6('0xf')],'to':_0x144acd[_0x55e6('0x26')],'from':_0x1d3826['phone'],'statusCallback':_0x1d3826['remote']+_0x55e6('0x28')+_0x144acd['id']+'/status?token='+_0x1d3826[_0x55e6('0x29')]})['then'](function(_0x416af6){if(_0x416af6[_0x55e6('0x2a')]){return _0x5a449b[_0x55e6('0x1a')]({'messageId':_0x416af6[_0x55e6('0x2a')]});}})[_0x55e6('0x2b')](function(_0x22afc8){logger[_0x55e6('0x1c')](_0x55e6('0x2c'),_0x55e6('0x2d'),_0x55e6('0x23'),util[_0x55e6('0x2e')](_0x22afc8,{'showHidden':![],'depth':null}));});}else{logger[_0x55e6('0x1c')](_0x55e6('0x2c'),'afterCreate','twilio',_0x55e6('0x2f'));}break;case _0x55e6('0x30'):var _0x512afb=_0x55e6('0x31');if(_0x1d3826['username']&&_0x1d3826[_0x55e6('0x32')]){var _0x1153bf={'recipient':[_0x144acd[_0x55e6('0x26')]],'message':_0x144acd['body'],'message_type':_0x1d3826['smsMethod']};if(_0x1d3826[_0x55e6('0x33')]&&_0x1d3826[_0x55e6('0x33')]!=='SI'){_0x1153bf[_0x55e6('0x34')]=_0x1d3826[_0x55e6('0x26')];}var _0x32cb2d={'url':_0x512afb+_0x55e6('0x35')+_0x1d3826[_0x55e6('0x36')]+_0x55e6('0x37')+_0x1d3826[_0x55e6('0x32')],'method':_0x55e6('0x38')};rp(_0x32cb2d)['then'](function(_0x118c0e){var _0x168b82=_0x118c0e[_0x55e6('0x39')](';');var _0xab289={'user_key':_0x168b82[0x0],'session_key':_0x168b82[0x1]};_0x32cb2d={'url':_0x512afb+_0x55e6('0x3a'),'method':_0x55e6('0x3b'),'headers':{'user_key':_0xab289[_0x55e6('0x3c')],'Session_key':_0xab289['session_key']},'json':!![],'body':_0x1153bf};return rp(_0x32cb2d);})[_0x55e6('0x21')](function(_0xbf83a1){if(_0xbf83a1[_0x55e6('0x3d')]>=0x1){var _0x4c5fe3={'messageId':_0xbf83a1[_0x55e6('0x3e')]};if(_0x1d3826['smsMethod']!=='GP'||!_0x1d3826['deliveryReport']){_0x4c5fe3[_0x55e6('0x3f')]=!![];}return _0x5a449b['update'](_0x4c5fe3);}else{return logger[_0x55e6('0x1c')](_0x55e6('0x2c'),_0x55e6('0x2d'),_0x55e6('0x30'),util[_0x55e6('0x2e')](_0xbf83a1,{'showHidden':![],'depth':null}));}})[_0x55e6('0x2b')](function(_0x2ec450){return logger[_0x55e6('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x55e6('0x2d'),'skebby',util[_0x55e6('0x2e')](_0x2ec450,{'showHidden':![],'depth':null}));});}else{logger[_0x55e6('0x1c')](_0x55e6('0x2c'),_0x55e6('0x2d'),_0x55e6('0x30'),_0x55e6('0x40'));}break;case _0x55e6('0x41'):if(_0x1d3826[_0x55e6('0x25')]){var _0x119e4f={'recipient':_0x144acd['phone'],'message':_0x144acd['body'],'sender':_0x1d3826[_0x55e6('0x42')]||_0x1d3826['phone'],'authorization':_0x1d3826[_0x55e6('0x25')]};var _0x126e50={'method':_0x55e6('0x3b'),'uri':_0x55e6('0x43'),'body':_0x119e4f,'json':!![]};rp(_0x126e50)[_0x55e6('0x21')](function(_0x25baac){var _0x3339ff={'messageId':_0x25baac[_0x55e6('0x44')]};if(!_0x1d3826[_0x55e6('0x45')]){_0x3339ff[_0x55e6('0x3f')]=!![];}return _0x5a449b['update'](_0x3339ff);})['catch'](function(_0x18bd02){logger[_0x55e6('0x1c')](_0x55e6('0x2c'),_0x55e6('0x2d'),'connectel',util['inspect'](_0x18bd02,{'showHidden':![],'depth':null}));});}else{logger[_0x55e6('0x1c')](_0x55e6('0x2c'),_0x55e6('0x2d'),'connectel','Missing\x20parameters:\x20authToken');}break;case _0x55e6('0x46'):if(_0x1d3826['username']&&_0x1d3826[_0x55e6('0x32')]){var _0x119e4f={'messages':[{'source':_0x55e6('0x47'),'to':_0x144acd[_0x55e6('0x26')],'body':_0x144acd[_0x55e6('0xf')],'from':_0x1d3826[_0x55e6('0x42')]||_0x1d3826[_0x55e6('0x26')]}]};var _0x59a7e3=util[_0x55e6('0x48')](_0x55e6('0x49'),_0x1d3826['username'],_0x1d3826[_0x55e6('0x32')]);var _0x126e50={'method':_0x55e6('0x3b'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x119e4f,'headers':{'Authorization':util[_0x55e6('0x48')]('Basic\x20%s',new Buffer(_0x59a7e3)[_0x55e6('0x4a')](_0x55e6('0x4b')))},'json':!![]};rp(_0x126e50)[_0x55e6('0x21')](function(_0x117b6e){if(_0x117b6e[_0x55e6('0x4c')]>=0xc8&&_0x117b6e['http_code']<=0xce){if(_0x117b6e[_0x55e6('0x4d')]&&_0x117b6e[_0x55e6('0x4d')][_0x55e6('0x4e')]>0x0){var _0x3f44a3=_[_0x55e6('0x4f')](_0x117b6e[_0x55e6('0x4d')][_0x55e6('0x27')]);var _0x13dc65={'messageId':_0x3f44a3['message_id']};if(!_0x1d3826[_0x55e6('0x45')]){_0x13dc65[_0x55e6('0x3f')]=!![];}return _0x5a449b[_0x55e6('0x1a')](_0x13dc65);}else{logger[_0x55e6('0x1c')](_0x55e6('0x2c'),_0x55e6('0x2d'),_0x55e6('0x50'),util['inspect'](_0x117b6e,{'showHidden':![],'depth':null}));}}else{logger[_0x55e6('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x55e6('0x50'),util[_0x55e6('0x2e')](_0x117b6e,{'showHidden':![],'depth':null}));}})[_0x55e6('0x2b')](function(_0xee9ed2){logger[_0x55e6('0x1c')](_0x55e6('0x2c'),_0x55e6('0x2d'),_0x55e6('0x50'),util[_0x55e6('0x2e')](_0xee9ed2,{'showHidden':![],'depth':null}));});}else{logger[_0x55e6('0x1c')](_0x55e6('0x2c'),_0x55e6('0x2d'),_0x55e6('0x50'),_0x55e6('0x40'));}break;case _0x55e6('0x51'):if(_0x1d3826[_0x55e6('0x52')]&&_0x1d3826[_0x55e6('0x25')]){var _0x119e4f={'dst':_0x144acd['phone'],'text':_0x144acd[_0x55e6('0xf')],'src':_0x1d3826[_0x55e6('0x42')]||_0x1d3826[_0x55e6('0x26')],'url':_0x1d3826['remote']+'/api/sms/messages/'+_0x144acd['id']+_0x55e6('0x53')+_0x1d3826[_0x55e6('0x29')]};var _0x59a7e3=util[_0x55e6('0x48')](_0x55e6('0x49'),_0x1d3826[_0x55e6('0x52')],_0x1d3826[_0x55e6('0x25')]);var _0x126e50={'method':_0x55e6('0x3b'),'uri':util[_0x55e6('0x48')]('https://api.plivo.com/v1/Account/%s/Message/',_0x1d3826[_0x55e6('0x52')]),'body':_0x119e4f,'headers':{'Authorization':util[_0x55e6('0x48')](_0x55e6('0x54'),new Buffer(_0x59a7e3)[_0x55e6('0x4a')](_0x55e6('0x4b')))},'json':!![]};rp(_0x126e50)['then'](function(_0x104860){var _0x24ffbb={'messageId':_0x104860[_0x55e6('0x55')][0x0]};return _0x5a449b[_0x55e6('0x1a')](_0x24ffbb);})[_0x55e6('0x2b')](function(_0x4fc2cf){logger['error'](_0x55e6('0x2c'),_0x55e6('0x2d'),_0x55e6('0x51'),util[_0x55e6('0x2e')](_0x4fc2cf,{'showHidden':![],'depth':null}));});}else{logger[_0x55e6('0x1c')](_0x55e6('0x2c'),_0x55e6('0x2d'),_0x55e6('0x51'),_0x55e6('0x56'));}break;case _0x55e6('0x57'):if(_0x1d3826[_0x55e6('0x36')]&&_0x1d3826['password']){if(_0x1d3826[_0x55e6('0x58')]){var _0x6b2657={'method':_0x55e6('0x3b'),'uri':_0x1d3826['baseUrl']+'/auth/1/session','body':{'username':_0x1d3826[_0x55e6('0x36')],'password':_0x1d3826[_0x55e6('0x32')]},'json':!![]};return rp(_0x6b2657)[_0x55e6('0x21')](function(_0x19a54d){var _0x1b41f2={'method':'POST','uri':_0x1d3826[_0x55e6('0x58')]+_0x55e6('0x59'),'body':{'messages':[{'from':_0x1d3826[_0x55e6('0x26')],'destinations':[{'to':_0x144acd[_0x55e6('0x26')]}],'text':_0x144acd[_0x55e6('0xf')],'notifyUrl':_0x1d3826[_0x55e6('0x5a')]+_0x55e6('0x28')+_0x144acd['id']+_0x55e6('0x53')+_0x1d3826[_0x55e6('0x29')],'notifyContentType':_0x55e6('0x5b'),'callbackData':_0x1d3826[_0x55e6('0x26')]+';'+_0x144acd[_0x55e6('0xf')]}]},'headers':{'Authorization':_0x55e6('0x5c')+_0x19a54d['token']},'json':!![]};return rp(_0x1b41f2)[_0x55e6('0x21')](function(_0x45da89){if(_0x45da89[_0x55e6('0x27')]){var _0x23c41f={'messageId':_0x45da89[_0x55e6('0x27')][0x0][_0x55e6('0xd')]};if(!_0x1d3826[_0x55e6('0x45')]){_0x23c41f['read']=!![];}return _0x5a449b[_0x55e6('0x1a')](_0x23c41f);}else{return logger[_0x55e6('0x1c')](_0x55e6('0x2c'),_0x55e6('0x2d'),_0x55e6('0x57'),util[_0x55e6('0x2e')](_0x45da89,{'showHidden':![],'depth':null}));}});})[_0x55e6('0x2b')](function(_0x164d90){return logger['error'](_0x55e6('0x2c'),_0x55e6('0x2d'),_0x55e6('0x57'),util[_0x55e6('0x2e')](_0x164d90,{'showHidden':![],'depth':null}));});}else{logger[_0x55e6('0x1c')](_0x55e6('0x2c'),'afterCreate',_0x55e6('0x57'),_0x55e6('0x5d'));}}else{logger[_0x55e6('0x1c')](_0x55e6('0x2c'),_0x55e6('0x2d'),_0x55e6('0x57'),_0x55e6('0x40'));}break;case _0x55e6('0x5e'):var _0x457d18=require(_0x55e6('0x5f'));if(_0x1d3826[_0x55e6('0x60')]){var _0xa364d3={};_0xa364d3[_0x55e6('0x61')]=_0x1d3826[_0x55e6('0x36')];_0xa364d3[_0x55e6('0x26')]=_0x144acd[_0x55e6('0x26')];_0xa364d3[_0x55e6('0x34')]=_0x1d3826[_0x55e6('0x26')];_0xa364d3[_0x55e6('0x62')]=_0x144acd[_0x55e6('0xf')];_0xa364d3[_0x55e6('0x63')]=+new Date();var _0x10adfe='';var _0x41a6e8='';var _0x1ef238=Object[_0x55e6('0x64')](_0xa364d3);_0x1ef238[_0x55e6('0x65')]();for(var _0x4944a4=0x0;_0x4944a4<_0x1ef238[_0x55e6('0x66')];_0x4944a4++){if(_0x10adfe!=''){_0x10adfe+='&';}_0x10adfe+=_0x1ef238[_0x4944a4]+'='+encodeURIComponent(_0xa364d3[_0x1ef238[_0x4944a4]]);_0x41a6e8+=_0xa364d3[_0x1ef238[_0x4944a4]];}_0x41a6e8+=_0x1d3826[_0x55e6('0x60')];_0x41a6e8=_0x457d18[_0x55e6('0x67')](_0x55e6('0x68'))[_0x55e6('0x1a')](_0x41a6e8)[_0x55e6('0x69')]('hex');if(_0x10adfe!==''){_0x10adfe+='&';}_0x10adfe+=_0x55e6('0x6a')+_0x41a6e8;var _0x32cb2d={'method':_0x55e6('0x38'),'uri':_0x1d3826[_0x55e6('0x58')]+_0x55e6('0x6b')+_0x10adfe,'json':!![]};return rp(_0x32cb2d)[_0x55e6('0x21')](function(_0x196cbd){var _0x5cddff=Object[_0x55e6('0x64')](_0x196cbd);if(_0x196cbd[_0x5cddff[0x0]][_0x55e6('0x1c')]&&parseInt(_0x196cbd[_0x5cddff[0x0]][_0x55e6('0x1c')])===0x0){var _0x425d9f={'messageId':_0x196cbd[_0x5cddff[0x0]][_0x55e6('0x6c')]};if(!_0x1d3826[_0x55e6('0x45')]){_0x425d9f['read']=!![];}return _0x5a449b[_0x55e6('0x1a')](_0x425d9f);}else{return logger[_0x55e6('0x1c')](_0x55e6('0x2c'),_0x55e6('0x2d'),_0x55e6('0x5e'),util['inspect'](_0x196cbd[_0x55e6('0x1c')],{'showHidden':![],'depth':null}));}})[_0x55e6('0x2b')](function(_0x6027ac){return logger[_0x55e6('0x1c')](_0x55e6('0x2c'),'afterCreate',_0x55e6('0x5e'),util[_0x55e6('0x2e')](_0x6027ac,{'showHidden':![],'depth':null}));});}else{logger[_0x55e6('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x55e6('0x2d'),_0x55e6('0x5e'),_0x55e6('0x6d'));}break;case'clickatell':if(_0x1d3826[_0x55e6('0x60')]){var _0x5b0983={'method':_0x55e6('0x3b'),'uri':_0x55e6('0x6e'),'headers':{'Authorization':_0x1d3826[_0x55e6('0x60')]},'body':{'content':_0x144acd[_0x55e6('0xf')],'to':[_0x144acd['phone']],'from':_0x1d3826[_0x55e6('0x26')],'binary':![],'clientMessageId':_0x55e6('0x6f'),'charset':'UTF-8'},'json':!![]};rp(_0x5b0983)['then'](function(_0x463599){if(!_0x463599[_0x55e6('0x1c')]){var _0x46333a={'messageId':_0x463599[_0x55e6('0x27')][0x0]['apiMessageId']};if(!_0x1d3826[_0x55e6('0x45')]){_0x46333a['read']=!![];}return _0x5a449b['update'](_0x46333a);}else{return logger[_0x55e6('0x1c')](_0x55e6('0x2c'),_0x55e6('0x2d'),_0x55e6('0x70'),util[_0x55e6('0x2e')](_0x463599['error'],{'showHidden':![],'depth':null}));}})[_0x55e6('0x2b')](function(_0x4d966e){return logger[_0x55e6('0x1c')](_0x55e6('0x2c'),'afterCreate',_0x55e6('0x70'),util[_0x55e6('0x2e')](_0x4d966e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x55e6('0x2c'),_0x55e6('0x2d'),_0x55e6('0x70'),_0x55e6('0x6d'));}break;case'bandwidth':if(_0x1d3826[_0x55e6('0x36')]&&_0x1d3826[_0x55e6('0x32')]){var _0x59a7e3=util['format'](_0x55e6('0x49'),_0x1d3826['username'],_0x1d3826[_0x55e6('0x32')]);var _0x126e50={'method':_0x55e6('0x3b'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x1d3826['accountId']+'/messages','body':{'to':[_0x144acd[_0x55e6('0x26')]],'text':_0x144acd[_0x55e6('0xf')],'from':_0x1d3826[_0x55e6('0x26')],'applicationId':_0x1d3826['applicationId']},'headers':{'Authorization':util[_0x55e6('0x48')](_0x55e6('0x54'),new Buffer(_0x59a7e3)[_0x55e6('0x4a')](_0x55e6('0x4b')))},'json':!![]};rp(_0x126e50)['then'](function(_0x3865f9){if(_0x3865f9['id']){var _0x554395={'messageId':_0x3865f9['id']};return _0x5a449b[_0x55e6('0x1a')](_0x554395);}else{logger[_0x55e6('0x1c')](_0x55e6('0x2c'),_0x55e6('0x2d'),_0x55e6('0x71'),util[_0x55e6('0x2e')](_0x3865f9,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3278c0){logger[_0x55e6('0x1c')](_0x55e6('0x2c'),'afterCreate','bandwidth',util['inspect'](_0x3278c0,{'showHidden':![],'depth':null}));});}else{logger[_0x55e6('0x1c')](_0x55e6('0x2c'),'afterCreate',_0x55e6('0x71'),_0x55e6('0x40'));}break;case _0x55e6('0x72'):if(_0x1d3826['apiKey']){var _0x9311d2={};var _0x32cb2d={'method':_0x55e6('0x3b'),'uri':_0x55e6('0x73'),'headers':{'Authorization':'Bearer\x20'+_0x1d3826[_0x55e6('0x60')],'Content-Type':_0x55e6('0x5b')},'body':{'from':_0x1d3826['phone'],'to':_0x144acd[_0x55e6('0x26')],'text':_0x144acd[_0x55e6('0xf')]},'json':!![]};return rp(_0x32cb2d)[_0x55e6('0x21')](function(_0x14a061){if(_0x14a061[_0x55e6('0x74')]==0xca){_0x9311d2['message']=_0x14a061;var _0x1c9390={'method':_0x55e6('0x3b'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x55e6('0x75')+_0x1d3826[_0x55e6('0x60')],'Content-Type':'application/json'},'body':{'refid':_0x9311d2['message'][_0x55e6('0x76')]},'json':!![]};return rp(_0x1c9390)['then'](function(_0x53cb45){_0x9311d2[_0x55e6('0x77')]=_0x53cb45;var _0x536eea={'messageId':_0x9311d2[_0x55e6('0x78')]['refid'],'read':!![]};return _0x5a449b['update'](_0x536eea);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x55e6('0x2d'),_0x55e6('0x72'),util[_0x55e6('0x2e')](_0x14a061,{'showHidden':![],'depth':null}));}})[_0x55e6('0x2b')](function(_0x2b3d81){return logger[_0x55e6('0x1c')](_0x55e6('0x2c'),_0x55e6('0x2d'),'intelepeer',util['inspect'](_0x2b3d81,{'showHidden':![],'depth':null}));});}else{return logger[_0x55e6('0x1c')](_0x55e6('0x2c'),_0x55e6('0x2d'),_0x55e6('0x72'),_0x55e6('0x79'));}break;}}})[_0x55e6('0x7a')](function(){_0x1e3ab2();});}else{_0x1e3ab2();}}},'charset':_0x55e6('0x7b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index faa3e22..7f3cde6 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 _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 +var _0xfb04=['localhost','socket.io-emitter','./smsMessage.socket','request','then','info','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults'];(function(_0x34d13a,_0x243b6a){var _0x2ba327=function(_0x39aec5){while(--_0x39aec5){_0x34d13a['push'](_0x34d13a['shift']());}};_0x2ba327(++_0x243b6a);}(_0xfb04,0x1e3));var _0x4fb0=function(_0x2b9b2f,_0x5b25e1){_0x2b9b2f=_0x2b9b2f-0x0;var _0xec0af7=_0xfb04[_0x2b9b2f];return _0xec0af7;};'use strict';var _=require('lodash');var util=require(_0x4fb0('0x0'));var moment=require(_0x4fb0('0x1'));var BPromise=require(_0x4fb0('0x2'));var rs=require(_0x4fb0('0x3'));var fs=require('fs');var Redis=require(_0x4fb0('0x4'));var db=require(_0x4fb0('0x5'))['db'];var utils=require(_0x4fb0('0x6'));var logger=require(_0x4fb0('0x7'))(_0x4fb0('0x8'));var config=require(_0x4fb0('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x4fb0('0xa')]=_[_0x4fb0('0xb')](config['redis'],{'host':_0x4fb0('0xc'),'port':0x18eb});var socket=require(_0x4fb0('0xd'))(new Redis(config[_0x4fb0('0xa')]));require(_0x4fb0('0xe'))['register'](socket);function respondWithRpcPromise(_0xaca17f,_0x5b22e0,_0x2dbe5f){return new BPromise(function(_0x387c69,_0x518a4c){return client[_0x4fb0('0xf')](_0xaca17f,_0x2dbe5f)[_0x4fb0('0x10')](function(_0x1e8084){logger[_0x4fb0('0x11')]('SmsMessage,\x20%s,\x20%s',_0x5b22e0,'request\x20sent');logger[_0x4fb0('0x12')](_0x4fb0('0x13'),_0x5b22e0,_0x4fb0('0x14'),JSON['stringify'](_0x1e8084));if(_0x1e8084[_0x4fb0('0x15')]){if(_0x1e8084['error'][_0x4fb0('0x16')]===0x1f4){logger['error'](_0x4fb0('0x17'),_0x5b22e0,_0x1e8084['error']['message']);return _0x518a4c(_0x1e8084[_0x4fb0('0x15')][_0x4fb0('0x18')]);}logger[_0x4fb0('0x15')](_0x4fb0('0x17'),_0x5b22e0,_0x1e8084[_0x4fb0('0x15')]['message']);return _0x387c69(_0x1e8084[_0x4fb0('0x15')][_0x4fb0('0x18')]);}else{logger[_0x4fb0('0x11')]('SmsMessage,\x20%s,\x20%s',_0x5b22e0,_0x4fb0('0x14'));_0x387c69(_0x1e8084[_0x4fb0('0x19')]['message']);}})[_0x4fb0('0x1a')](function(_0x2869ab){logger[_0x4fb0('0x15')](_0x4fb0('0x17'),_0x5b22e0,_0x2869ab);_0x518a4c(_0x2869ab);});});}exports[_0x4fb0('0x1b')]=function(_0x417372){var _0x36a720=this;return new Promise(function(_0x3d098a,_0x2bbdf7){return db[_0x4fb0('0x1c')][_0x4fb0('0x1d')](_0x417372[_0x4fb0('0x1e')],{'raw':_0x417372[_0x4fb0('0x1f')]?_0x417372[_0x4fb0('0x1f')][_0x4fb0('0x20')]===undefined?!![]:![]:!![]})[_0x4fb0('0x10')](function(_0x141a50){logger[_0x4fb0('0x11')]('CreateSmsMessage',_0x417372);logger[_0x4fb0('0x12')](_0x4fb0('0x1b'),_0x417372,JSON['stringify'](_0x141a50));_0x3d098a(_0x141a50);})['catch'](function(_0x4b80e2){logger[_0x4fb0('0x15')]('CreateSmsMessage',_0x4b80e2[_0x4fb0('0x18')],_0x417372);_0x2bbdf7(_0x36a720['error'](0x1f4,_0x4b80e2[_0x4fb0('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index e88a047..5f64a11 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 _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 +var _0x41d2=['smsMessage:','./smsMessage.events','remove','emit','removeListener','register','length'];(function(_0x3b700,_0x470f32){var _0x38ebf2=function(_0x2f2ac8){while(--_0x2f2ac8){_0x3b700['push'](_0x3b700['shift']());}};_0x38ebf2(++_0x470f32);}(_0x41d2,0x119));var _0x241d=function(_0x120376,_0x571898){_0x120376=_0x120376-0x0;var _0x28c529=_0x41d2[_0x120376];return _0x28c529;};'use strict';var SmsMessageEvents=require(_0x241d('0x0'));var events=['save',_0x241d('0x1'),'update'];function createListener(_0xcf2641,_0x2b301c){return function(_0x4eeba2){_0x2b301c[_0x241d('0x2')](_0xcf2641,_0x4eeba2);};}function removeListener(_0x2e2c7b,_0x34b222){return function(){SmsMessageEvents[_0x241d('0x3')](_0x2e2c7b,_0x34b222);};}exports[_0x241d('0x4')]=function(_0x12c23e){for(var _0x284c09=0x0,_0x49a0c9=events[_0x241d('0x5')];_0x284c09<_0x49a0c9;_0x284c09++){var _0x4c6bfa=events[_0x284c09];var _0x2c9489=createListener(_0x241d('0x6')+_0x4c6bfa,_0x12c23e);SmsMessageEvents['on'](_0x4c6bfa,_0x2c9489);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index d313c04..5d37261 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 _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 +var _0x4c87=['post','create','addTeams','/:id/users','addAgents','destroy','delete','removeTeams','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents'];(function(_0x310e70,_0x567a29){var _0x6af6da=function(_0x110eee){while(--_0x110eee){_0x310e70['push'](_0x310e70['shift']());}};_0x6af6da(++_0x567a29);}(_0x4c87,0x15e));var _0x74c8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4c87[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x74c8('0x0'));var path=require(_0x74c8('0x1'));var timeout=require(_0x74c8('0x2'));var express=require(_0x74c8('0x3'));var router=express[_0x74c8('0x4')]();var fs_extra=require(_0x74c8('0x5'));var auth=require(_0x74c8('0x6'));var interaction=require(_0x74c8('0x7'));var config=require(_0x74c8('0x8'));var controller=require(_0x74c8('0x9'));router[_0x74c8('0xa')]('/',auth[_0x74c8('0xb')](),controller[_0x74c8('0xc')]);router[_0x74c8('0xa')](_0x74c8('0xd'),auth[_0x74c8('0xb')](),controller[_0x74c8('0xe')]);router[_0x74c8('0xa')](_0x74c8('0xf'),auth[_0x74c8('0xb')](),controller[_0x74c8('0x10')]);router['get'](_0x74c8('0x11'),auth[_0x74c8('0xb')](),controller[_0x74c8('0x12')]);router['get'](_0x74c8('0x13'),auth[_0x74c8('0xb')](),controller[_0x74c8('0x14')]);router['get']('/:id/users',auth[_0x74c8('0xb')](),controller[_0x74c8('0x15')]);router[_0x74c8('0x16')]('/',auth[_0x74c8('0xb')](),controller[_0x74c8('0x17')]);router[_0x74c8('0x16')](_0x74c8('0x13'),auth[_0x74c8('0xb')](),controller[_0x74c8('0x18')]);router['post'](_0x74c8('0x19'),auth[_0x74c8('0xb')](),controller[_0x74c8('0x1a')]);router['put'](_0x74c8('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x74c8('0xf'),auth['isAuthenticated'](),controller[_0x74c8('0x1b')]);router[_0x74c8('0x1c')]('/:id/teams',auth[_0x74c8('0xb')](),controller[_0x74c8('0x1d')]);router[_0x74c8('0x1c')](_0x74c8('0x19'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x74c8('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index bf1d057..309abdc 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 _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 +var _0x9272=['beepall','roundrobin','sequelize','exports','STRING','INTEGER','rrmemory'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x9272,0x1c9));var _0x2927=function(_0x15972e,_0x269a49){_0x15972e=_0x15972e-0x0;var _0x5b2ead=_0x9272[_0x15972e];return _0x5b2ead;};'use strict';var Sequelize=require(_0x2927('0x0'));module[_0x2927('0x1')]={'name':{'type':Sequelize[_0x2927('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x2927('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x2927('0x4'),_0x2927('0x5'),_0x2927('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 62d5bc1..e987f0c 100644 --- a/server/api/smsQueue/smsQueue.controller.js +++ b/server/api/smsQueue/smsQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['intersection','attributes','model','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','update','describe','getMembers','findOne','UserSmsQueue','filters','hasOwnProperty','order','sort','pick','SmsQueueId','filter','User','findAndCountAll','agent','updatedAt','createdAt','SIP','getTeams','Team','nolimit','addTeams','ids','online','voicePause','flatMap','each','findOrCreate','removeTeams','Agents','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','toString','QueryTypes','TeamId','union','compact','value','transaction','isEmpty','emit','addAgents','spread','userSmsQueue:save','removeAgents','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','then','destroy','get','SmsQueues','UserProfileResource','name','map','SmsQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys'];(function(_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 +var _0x5f66=['show','params','model','keys','intersection','attributes','fields','includeAll','merge','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','rawAttributes','filters','hasOwnProperty','order','sort','pick','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','length','filter','nolimit','ids','Team','Agents','interface','flatMap','sequelize','transaction','addTeams','forEach','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','includes','all','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','isArray','findOne','getAgents','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','./smsQueue.socket','register','end','json','offset','limit','undefined','count','status','update','then','UserProfileResource','destroy','sendStatus','stack','name','send','index','fieldName','key','getOptions','where','SmsQueue','include','query','findAll','catch'];(function(_0x209803,_0x205d7e){var _0x53ef29=function(_0x1dc858){while(--_0x1dc858){_0x209803['push'](_0x209803['shift']());}};_0x53ef29(++_0x205d7e);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'use strict';var BPromise=require('bluebird');var util=require(_0x65f6('0x0'));var _=require('lodash');var squel=require(_0x65f6('0x1'));var Redis=require(_0x65f6('0x2'));var qs=require(_0x65f6('0x3'));var logger=require(_0x65f6('0x4'))(_0x65f6('0x5'));var config=require('../../config/environment');var db=require(_0x65f6('0x6'))['db'];config['redis']=_[_0x65f6('0x7')](config[_0x65f6('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x65f6('0x8')]));require(_0x65f6('0x9'))[_0x65f6('0xa')](socket);function respondWithStatusCode(_0x8f6451,_0xc44c70){_0xc44c70=_0xc44c70||0xcc;return function(_0x14f4c7){if(_0x14f4c7){return _0x8f6451['sendStatus'](_0xc44c70);}return _0x8f6451['status'](_0xc44c70)[_0x65f6('0xb')]();};}function respondWithResult(_0x2f6d5b,_0x264647){_0x264647=_0x264647||0xc8;return function(_0x25c416){if(_0x25c416){return _0x2f6d5b['status'](_0x264647)[_0x65f6('0xc')](_0x25c416);}};}function respondWithFilteredResult(_0x571436,_0x497cf3){return function(_0x2d2dfa){if(_0x2d2dfa){var _0x576875=typeof _0x497cf3[_0x65f6('0xd')]==='undefined'&&typeof _0x497cf3[_0x65f6('0xe')]===_0x65f6('0xf');var _0x2c4ee5=_0x2d2dfa[_0x65f6('0x10')];var _0x369f96=_0x576875?0x0:_0x497cf3[_0x65f6('0xd')];var _0x44144b=_0x576875?_0x2d2dfa[_0x65f6('0x10')]:_0x497cf3[_0x65f6('0xd')]+_0x497cf3[_0x65f6('0xe')];var _0x59154e;if(_0x44144b>=_0x2c4ee5){_0x44144b=_0x2c4ee5;_0x59154e=0xc8;}else{_0x59154e=0xce;}_0x571436[_0x65f6('0x11')](_0x59154e);return _0x571436['set']('Content-Range',_0x369f96+'-'+_0x44144b+'/'+_0x2c4ee5)[_0x65f6('0xc')](_0x2d2dfa);}return null;};}function saveUpdates(_0x5c69f8){return function(_0x37330d){if(_0x37330d){return _0x37330d[_0x65f6('0x12')](_0x5c69f8)[_0x65f6('0x13')](function(_0x1f974c){return _0x1f974c;});}return null;};}function removeEntity(_0xc8660c){return function(_0x18380e){if(_0x18380e){return _0x18380e['destroy']()['then'](function(){var _0x2d538c=_0x18380e['get']({'plain':!![]});var _0x4c81f3='SmsQueues';return db[_0x65f6('0x14')][_0x65f6('0x15')]({'where':{'type':_0x4c81f3,'resourceId':_0x2d538c['id']}})['then'](function(){return _0x18380e;});})[_0x65f6('0x13')](function(){_0xc8660c[_0x65f6('0x11')](0xcc)[_0x65f6('0xb')]();});}};}function handleEntityNotFound(_0x3876ed){return function(_0x219ab2){if(!_0x219ab2){_0x3876ed[_0x65f6('0x16')](0x194);}return _0x219ab2;};}function handleError(_0x581374,_0x197a49){_0x197a49=_0x197a49||0x1f4;return function(_0x4bb39e){logger['error'](_0x4bb39e[_0x65f6('0x17')]);if(_0x4bb39e[_0x65f6('0x18')]){delete _0x4bb39e['name'];}_0x581374[_0x65f6('0x11')](_0x197a49)[_0x65f6('0x19')](_0x4bb39e);};}exports[_0x65f6('0x1a')]=function(_0x2774a1,_0x4f5a69){var _0x9d7bb0={};var _0x59ea32={'count':0x0,'rows':[]};var _0x20a161=_['map'](db['SmsQueue']['rawAttributes'],function(_0x29abdb){return{'name':_0x29abdb[_0x65f6('0x1b')],'type':_0x29abdb['type'][_0x65f6('0x1c')]};});_0x9d7bb0=qs[_0x65f6('0x1d')](_0x20a161,_0x2774a1);var _0x52277c={'where':_0x9d7bb0[_0x65f6('0x1e')]};return db[_0x65f6('0x1f')][_0x65f6('0x10')](_0x52277c)['then'](function(_0x4ac04b){_0x59ea32['count']=_0x4ac04b;_0x9d7bb0[_0x65f6('0x20')]=qs[_0x65f6('0x20')](_0x2774a1[_0x65f6('0x21')]);return db[_0x65f6('0x1f')][_0x65f6('0x22')](_0x9d7bb0);})[_0x65f6('0x13')](function(_0x144e55){_0x59ea32['rows']=_0x144e55;return _0x59ea32;})['then'](respondWithFilteredResult(_0x4f5a69,_0x9d7bb0))[_0x65f6('0x23')](handleError(_0x4f5a69,null));};exports[_0x65f6('0x24')]=function(_0x5878bc,_0x4e50c0){var _0x10b368={'raw':!![],'where':{'id':_0x5878bc[_0x65f6('0x25')]['id']}},_0x1ce43c={};_0x1ce43c[_0x65f6('0x26')]=_[_0x65f6('0x27')](db[_0x65f6('0x1f')]['rawAttributes']);_0x1ce43c[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x5878bc[_0x65f6('0x21')]);_0x1ce43c['filters']=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],_0x1ce43c[_0x65f6('0x21')]);_0x10b368[_0x65f6('0x29')]=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],qs['fields'](_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x10b368['attributes']=_0x10b368[_0x65f6('0x29')]['length']?_0x10b368[_0x65f6('0x29')]:_0x1ce43c['model'];if(_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2b')]){_0x10b368['include']=[{'all':!![]}];}_0x10b368=_[_0x65f6('0x2c')]({},_0x10b368,_0x5878bc[_0x65f6('0x2d')]);return db[_0x65f6('0x1f')]['find'](_0x10b368)['then'](handleEntityNotFound(_0x4e50c0,null))[_0x65f6('0x13')](respondWithResult(_0x4e50c0,null))['catch'](handleError(_0x4e50c0,null));};exports[_0x65f6('0x2e')]=function(_0x4e6653,_0x22d760){return db[_0x65f6('0x1f')]['create'](_0x4e6653[_0x65f6('0x2f')],{})['then'](function(_0x5edd04){var _0x71b16b=_0x4e6653[_0x65f6('0x30')][_0x65f6('0x31')]({'plain':!![]});if(!_0x71b16b)throw new Error(_0x65f6('0x32'));if(_0x71b16b[_0x65f6('0x33')]===_0x65f6('0x30')){var _0x1a55da=_0x5edd04[_0x65f6('0x31')]({'plain':!![]});var _0x4f933b=_0x65f6('0x34');return db['UserProfileSection'][_0x65f6('0x35')]({'where':{'name':_0x4f933b,'userProfileId':_0x71b16b[_0x65f6('0x36')]},'raw':!![]})[_0x65f6('0x13')](function(_0x2ea7f7){if(_0x2ea7f7&&_0x2ea7f7['autoAssociation']===0x0){return db[_0x65f6('0x14')][_0x65f6('0x2e')]({'name':_0x1a55da[_0x65f6('0x18')],'resourceId':_0x1a55da['id'],'type':_0x2ea7f7[_0x65f6('0x18')],'sectionId':_0x2ea7f7['id']},{})[_0x65f6('0x13')](function(){return _0x5edd04;});}else{return _0x5edd04;}})[_0x65f6('0x23')](function(_0xed4c96){logger[_0x65f6('0x37')](_0x65f6('0x38'),_0xed4c96);throw _0xed4c96;});}return _0x5edd04;})['then'](respondWithResult(_0x22d760,0xc9))[_0x65f6('0x23')](handleError(_0x22d760,null));};exports[_0x65f6('0x12')]=function(_0x377ae5,_0x181798){if(_0x377ae5[_0x65f6('0x2f')]['id']){delete _0x377ae5[_0x65f6('0x2f')]['id'];}return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x377ae5[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x181798,null))[_0x65f6('0x13')](saveUpdates(_0x377ae5[_0x65f6('0x2f')],null))[_0x65f6('0x13')](respondWithResult(_0x181798,null))[_0x65f6('0x23')](handleError(_0x181798,null));};exports[_0x65f6('0x15')]=function(_0x2cb38d,_0x5119ee){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x2cb38d[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x5119ee,null))['then'](removeEntity(_0x5119ee,null))[_0x65f6('0x23')](handleError(_0x5119ee,null));};exports[_0x65f6('0x39')]=function(_0x2b01eb,_0x5e69b4){return db[_0x65f6('0x1f')][_0x65f6('0x39')]()[_0x65f6('0x13')](respondWithResult(_0x5e69b4,null))[_0x65f6('0x23')](handleError(_0x5e69b4,null));};exports['getMembers']=function(_0x2ec114,_0x512527){var _0x3f1baa={'raw':!![],'where':{}},_0x6968b={},_0x577c93;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x2ec114[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x512527,null))[_0x65f6('0x13')](function(_0xc0db01){if(_0xc0db01){_0x577c93=_0xc0db01[_0x65f6('0x31')]({'plain':!![]});_0x6968b[_0x65f6('0x26')]=_['keys'](db['UserSmsQueue'][_0x65f6('0x3a')]);_0x6968b[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x2ec114[_0x65f6('0x21')]);_0x6968b[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x6968b[_0x65f6('0x26')],_0x6968b[_0x65f6('0x21')]);_0x3f1baa[_0x65f6('0x29')]=_['intersection'](_0x6968b[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x2ec114[_0x65f6('0x21')]['fields']));_0x3f1baa[_0x65f6('0x29')]=_0x3f1baa[_0x65f6('0x29')]['length']?_0x3f1baa[_0x65f6('0x29')]:_0x6968b[_0x65f6('0x26')];if(!_0x2ec114['query'][_0x65f6('0x3c')]('nolimit')){_0x3f1baa[_0x65f6('0xe')]=qs[_0x65f6('0xe')](_0x2ec114[_0x65f6('0x21')]['limit']);_0x3f1baa[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x2ec114['query'][_0x65f6('0xd')]);}_0x3f1baa[_0x65f6('0x3d')]=qs['sort'](_0x2ec114[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x3f1baa[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x2ec114[_0x65f6('0x21')],_0x6968b[_0x65f6('0x3b')]));_0x3f1baa[_0x65f6('0x1e')]['SmsQueueId']=_0xc0db01['id'];if(_0x2ec114['query']['filter']){_0x3f1baa[_0x65f6('0x1e')]=_[_0x65f6('0x2c')](_0x3f1baa[_0x65f6('0x1e')],{'$or':_[_0x65f6('0x40')](_0x3f1baa['attributes'],function(_0x183c08){var _0x2032b9={};_0x2032b9[_0x183c08]={'$like':'%'+_0x2ec114[_0x65f6('0x21')]['filter']+'%'};return _0x2032b9;})});}_0x3f1baa=_[_0x65f6('0x2c')]({},_0x3f1baa,_0x2ec114[_0x65f6('0x2d')]);return db[_0x65f6('0x41')]['findAll'](_0x3f1baa);}})['then'](function(_0x1d337d){if(_0x1d337d){return db[_0x65f6('0x42')][_0x65f6('0x43')]({'where':{'id':_[_0x65f6('0x40')](_0x1d337d,_0x65f6('0x44')),'role':_0x65f6('0x45')},'attributes':['id',_0x65f6('0x18'),_0x65f6('0x46'),_0x65f6('0x47'),_0x65f6('0x48')]});}})[_0x65f6('0x13')](function(_0x141fcc){if(_0x141fcc){return{'count':_0x141fcc[_0x65f6('0x10')],'rows':_[_0x65f6('0x40')](_0x141fcc['rows'],function(_0x47610a){return{'membername':_0x47610a[_0x65f6('0x18')],'UserId':_0x47610a['id'],'queue_name':_0x577c93[_0x65f6('0x18')],'SmsQueueId':_0x577c93['id'],'interface':util['format'](_0x65f6('0x49'),_0x65f6('0x4a'),_0x47610a[_0x65f6('0x18')]),'penalty':0x0,'paused':_0x47610a[_0x65f6('0x46')],'createdAt':_0x47610a['createdAt'],'updatedAt':_0x47610a[_0x65f6('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x65f6('0x13')](respondWithFilteredResult(_0x512527,_0x3f1baa))[_0x65f6('0x23')](handleError(_0x512527,null));};exports[_0x65f6('0x4b')]=function(_0x553ff0,_0x2923ff){var _0x2fc20f={};var _0x5c55e4={};var _0x28682b;var _0x26481e;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x553ff0[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x2923ff,null))[_0x65f6('0x13')](function(_0x3c23e3){if(_0x3c23e3){_0x28682b=_0x3c23e3;_0x5c55e4[_0x65f6('0x26')]=_[_0x65f6('0x27')](db['Team']['rawAttributes']);_0x5c55e4['query']=_[_0x65f6('0x27')](_0x553ff0[_0x65f6('0x21')]);_0x5c55e4[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],_0x5c55e4[_0x65f6('0x21')]);_0x2fc20f['attributes']=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],qs['fields'](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x2fc20f[_0x65f6('0x29')]=_0x2fc20f['attributes'][_0x65f6('0x4c')]?_0x2fc20f[_0x65f6('0x29')]:_0x5c55e4['model'];_0x2fc20f[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x2fc20f[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x553ff0['query'],_0x5c55e4['filters']));if(_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x2fc20f['where']=_[_0x65f6('0x2c')](_0x2fc20f['where'],{'$or':_[_0x65f6('0x40')](_0x2fc20f['attributes'],function(_0x440df1){var _0xdc8989={};_0xdc8989[_0x440df1]={'$like':'%'+_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0xdc8989;})});}_0x2fc20f=_[_0x65f6('0x2c')]({},_0x2fc20f,_0x553ff0[_0x65f6('0x2d')]);return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})[_0x65f6('0x13')](function(_0x2405a7){if(_0x2405a7){_0x26481e=_0x2405a7['length'];if(!_0x553ff0['query'][_0x65f6('0x3c')](_0x65f6('0x4e'))){_0x2fc20f[_0x65f6('0xe')]=qs['limit'](_0x553ff0['query'][_0x65f6('0xe')]);_0x2fc20f[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0xd')]);}return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})['then'](function(_0x4f42ae){if(_0x4f42ae){return _0x4f42ae?{'count':_0x26481e,'rows':_0x4f42ae}:null;}})[_0x65f6('0x13')](respondWithResult(_0x2923ff,null))[_0x65f6('0x23')](handleError(_0x2923ff,null));};exports['addTeams']=function(_0x219bf8,_0x4a8b60){var _0x254e9f=_0x219bf8[_0x65f6('0x2f')][_0x65f6('0x4f')];return db[_0x65f6('0x50')]['findAll']({'where':{'id':_0x254e9f},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id',_0x65f6('0x18'),'online','voicePause',_0x65f6('0x52')],'raw':!![]}]})['then'](function(_0x305967){if(_0x305967){var _0xf6de=_[_0x65f6('0x53')](_0x305967,function(_0x354b90){var _0x512776=_0x354b90['get']({'plain':!![]});return _0x512776['Agents'];});return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x219bf8[_0x65f6('0x25')]['id']}})['then'](function(_0x46cbde){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x49cee2){return _0x46cbde[_0x65f6('0x56')](_0x254e9f,{'transaction':_0x49cee2})[_0x65f6('0x13')](function(){return BPromise['each'](_0xf6de,function(_0x758e80){return db[_0x65f6('0x41')]['findOrCreate']({'where':{'UserId':_0x758e80['id'],'SmsQueueId':_0x219bf8[_0x65f6('0x25')]['id']},'transaction':_0x49cee2});});})['then'](function(){_0xf6de[_0x65f6('0x57')](function(_0x55ea91){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':_0x55ea91['id'],'SmsQueueId':_0x46cbde['id']});});});});});}})['then'](respondWithStatusCode(_0x4a8b60,null))[_0x65f6('0x23')](handleError(_0x4a8b60,null));};exports[_0x65f6('0x5a')]=function(_0x2a700b,_0x299b85){return db[_0x65f6('0x50')][_0x65f6('0x22')]({'where':{'id':_0x2a700b[_0x65f6('0x21')][_0x65f6('0x4f')]},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id'],'raw':!![]}]})[_0x65f6('0x13')](handleEntityNotFound(_0x299b85,null))['then'](function(_0x10a661){var _0x1cf1bd=_[_0x65f6('0x40')](_0x10a661,'id');var _0x219e42=[];var _0x5694f9=[];var _0x453080=squel[_0x65f6('0x5b')]();_0x453080['field'](_0x65f6('0x5c'))['from'](_0x65f6('0x5d'),'tq')['join'](_0x65f6('0x5e'),'ut',_0x65f6('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x2a700b[_0x65f6('0x25')]['id']);for(var _0x413c21=0x0;_0x413c21<_0x10a661['length'];_0x413c21+=0x1){let _0x2d86c8=_0x10a661[_0x413c21];for(var _0x3b3bd5=0x0;_0x3b3bd5<_0x2d86c8[_0x65f6('0x51')]['length'];_0x3b3bd5+=0x1){let _0x1348ec=_0x2d86c8[_0x65f6('0x51')][_0x3b3bd5];var _0x5889dc=_0x453080[_0x65f6('0x60')]();_0x5889dc['where'](_0x65f6('0x61'),_0x1348ec['id']);_0x5694f9['push'](db['sequelize'][_0x65f6('0x21')](_0x5889dc[_0x65f6('0x62')](),{'type':db[_0x65f6('0x54')][_0x65f6('0x63')][_0x65f6('0x64')]})[_0x65f6('0x13')](function(_0x1ac46f){if(_0x1ac46f[_0x65f6('0x4c')]===0x1){return _0x1348ec['id'];}else{var _0x4d66fe=_['every'](_[_0x65f6('0x40')](_0x1ac46f,'TeamId'),function(_0x1ee28a){return _[_0x65f6('0x65')](_0x1cf1bd,_0x1ee28a);});if(_0x4d66fe){return _0x1348ec['id'];}}}));}}return BPromise[_0x65f6('0x66')](_0x5694f9)[_0x65f6('0x13')](function(_0x43127b){_0x219e42=_(_0x219e42)['union'](_0x43127b)[_0x65f6('0x67')]()[_0x65f6('0x68')]();return db[_0x65f6('0x1f')]['find']({'where':{'id':_0x2a700b[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](function(_0x4254c2){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x16bf93){return _0x4254c2['removeTeams'](_0x2a700b['query'][_0x65f6('0x4f')],{'transaction':_0x16bf93})[_0x65f6('0x13')](function(){if(!_[_0x65f6('0x69')](_0x219e42)){return _0x4254c2[_0x65f6('0x6a')](_0x219e42,{'transaction':_0x16bf93});}})['then'](function(){_0x219e42['forEach'](function(_0x336076){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':_0x336076,'SmsQueueId':_0x4254c2['id']});});});});});});})[_0x65f6('0x13')](respondWithStatusCode(_0x299b85,null))[_0x65f6('0x23')](handleError(_0x299b85,null));};exports[_0x65f6('0x6c')]=function(_0x5daaf4,_0x4d607a){return db['SmsQueue'][_0x65f6('0x35')]({'where':{'id':_0x5daaf4[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x4d607a,null))[_0x65f6('0x13')](function(_0x53b11c){if(_0x53b11c){return _0x53b11c['addAgents'](_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')],_['omit'](_0x5daaf4[_0x65f6('0x2f')],['ids','id'])||{})[_0x65f6('0x6d')](function(_0x4f3ef8){for(var _0x3a30ed=0x0;_0x3a30ed<_0x5daaf4[_0x65f6('0x2f')]['ids'][_0x65f6('0x4c')];_0x3a30ed+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':Number(_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')][_0x3a30ed]),'SmsQueueId':Number(_0x5daaf4[_0x65f6('0x25')]['id'])});}return _0x4f3ef8;});}})['then'](respondWithResult(_0x4d607a,null))[_0x65f6('0x23')](handleError(_0x4d607a,null));};exports['removeAgents']=function(_0x24495c,_0x56336a){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x24495c[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x56336a,null))['then'](function(_0x2b6f98){if(_0x2b6f98){return _0x2b6f98[_0x65f6('0x6a')](_0x24495c[_0x65f6('0x21')]['ids'])['then'](function(){if(_[_0x65f6('0x6e')](_0x24495c[_0x65f6('0x21')]['ids'])){for(var _0x180cde=0x0;_0x180cde<_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]['length'];_0x180cde+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':Number(_0x24495c['query'][_0x65f6('0x4f')][_0x180cde]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}}else{socket[_0x65f6('0x58')]('userSmsQueue:remove',{'UserId':Number(_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}});}})['then'](respondWithStatusCode(_0x56336a,null))[_0x65f6('0x23')](handleError(_0x56336a,null));};exports['getAgents']=function(_0x1beaa7,_0x87a9e4){var _0x31ec61={};var _0x22be6e={};var _0x29b2de;var _0x430fb8;return db['SmsQueue'][_0x65f6('0x6f')]({'where':{'id':_0x1beaa7[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x87a9e4,null))[_0x65f6('0x13')](function(_0x207d15){if(_0x207d15){_0x29b2de=_0x207d15;_0x22be6e['model']=_['keys'](db['User'][_0x65f6('0x3a')]);_0x22be6e[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x1beaa7['query']);_0x22be6e[_0x65f6('0x3b')]=_['intersection'](_0x22be6e['model'],_0x22be6e[_0x65f6('0x21')]);_0x31ec61[_0x65f6('0x29')]=_['intersection'](_0x22be6e[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x31ec61[_0x65f6('0x29')]=_0x31ec61[_0x65f6('0x29')][_0x65f6('0x4c')]?_0x31ec61[_0x65f6('0x29')]:_0x22be6e[_0x65f6('0x26')];_0x31ec61[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x1beaa7[_0x65f6('0x21')]['sort']);_0x31ec61[_0x65f6('0x1e')]=qs['filters'](_['pick'](_0x1beaa7[_0x65f6('0x21')],_0x22be6e[_0x65f6('0x3b')]));if(_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x31ec61['where']=_[_0x65f6('0x2c')](_0x31ec61['where'],{'$or':_['map'](_0x31ec61[_0x65f6('0x29')],function(_0x99fe6e){var _0x1a7e52={};_0x1a7e52[_0x99fe6e]={'$like':'%'+_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0x1a7e52;})});}_0x31ec61=_[_0x65f6('0x2c')]({},_0x31ec61,_0x1beaa7['options']);return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})['then'](function(_0x1ef2a0){if(_0x1ef2a0){_0x430fb8=_0x1ef2a0[_0x65f6('0x4c')];if(!_0x1beaa7[_0x65f6('0x21')]['hasOwnProperty'](_0x65f6('0x4e'))){_0x31ec61['limit']=qs['limit'](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0xe')]);_0x31ec61[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x1beaa7[_0x65f6('0x21')]['offset']);}return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})[_0x65f6('0x13')](function(_0x3bebe3){if(_0x3bebe3){return _0x3bebe3?{'count':_0x430fb8,'rows':_0x3bebe3}:null;}})[_0x65f6('0x13')](respondWithResult(_0x87a9e4,null))['catch'](handleError(_0x87a9e4,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 5fc025f..ff7db0b 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 _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 +var _0x8ace=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0xc9873a,_0x5efdcb){var _0x2f7d84=function(_0xf6e70){while(--_0xf6e70){_0xc9873a['push'](_0xc9873a['shift']());}};_0x2f7d84(++_0x5efdcb);}(_0x8ace,0x1db));var _0xe8ac=function(_0x366ce0,_0x4c3fad){_0x366ce0=_0x366ce0-0x0;var _0x5ae1c0=_0x8ace[_0x366ce0];return _0x5ae1c0;};'use strict';var EventEmitter=require(_0xe8ac('0x0'));var SmsQueue=require(_0xe8ac('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xe8ac('0x2')](0x0);var events={'afterCreate':_0xe8ac('0x3'),'afterUpdate':_0xe8ac('0x4'),'afterDestroy':_0xe8ac('0x5')};function emitEvent(_0x3be3e8){return function(_0x3990f1,_0x18ff24,_0x248776){SmsQueueEvents[_0xe8ac('0x6')](_0x3be3e8+':'+_0x3990f1['id'],_0x3990f1);SmsQueueEvents[_0xe8ac('0x6')](_0x3be3e8,_0x3990f1);_0x248776(null);};}for(var e in events){if(events[_0xe8ac('0x7')](e)){var event=events[e];SmsQueue[_0xe8ac('0x8')](e,emitEvent(event));}}module[_0xe8ac('0x9')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 84b4061..0fd09fa 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 _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 +var _0x15f4=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash'];(function(_0x50ec10,_0x69f761){var _0x9faa7f=function(_0x34b2c9){while(--_0x34b2c9){_0x50ec10['push'](_0x50ec10['shift']());}};_0x9faa7f(++_0x69f761);}(_0x15f4,0x197));var _0x415f=function(_0xa0090,_0x4802a5){_0xa0090=_0xa0090-0x0;var _0x37e155=_0x15f4[_0xa0090];return _0x37e155;};'use strict';var _=require(_0x415f('0x0'));var util=require('util');var logger=require(_0x415f('0x1'))(_0x415f('0x2'));var moment=require('moment');var BPromise=require(_0x415f('0x3'));var rp=require(_0x415f('0x4'));var fs=require('fs');var path=require(_0x415f('0x5'));var rimraf=require('rimraf');var config=require(_0x415f('0x6'));var attributes=require(_0x415f('0x7'));module[_0x415f('0x8')]=function(_0x300779,_0x3c040a){return _0x300779[_0x415f('0x9')](_0x415f('0xa'),attributes,{'tableName':_0x415f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 29de415..a45ce4d 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 _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 +var _0x906e=['stringify','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','info','SmsQueue,\x20%s,\x20%s','debug','error','code','message','request\x20sent','catch','SmsQueue','findAll','options','raw','where','attributes','limit','include','model','map','then','GetSmsQueue','ShowSmsQueue','find'];(function(_0x2caeae,_0x1c0bc8){var _0x12bcd6=function(_0x408a5f){while(--_0x408a5f){_0x2caeae['push'](_0x2caeae['shift']());}};_0x12bcd6(++_0x1c0bc8);}(_0x906e,0x119));var _0xe906=function(_0x45ad09,_0x521ab1){_0x45ad09=_0x45ad09-0x0;var _0x2084fd=_0x906e[_0x45ad09];return _0x2084fd;};'use strict';var _=require(_0xe906('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe906('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe906('0x2'));var db=require(_0xe906('0x3'))['db'];var utils=require(_0xe906('0x4'));var logger=require(_0xe906('0x5'))(_0xe906('0x6'));var config=require('../../config/environment');var jayson=require(_0xe906('0x7'));var client=jayson[_0xe906('0x8')][_0xe906('0x9')]({'port':0x232a});config[_0xe906('0xa')]=_[_0xe906('0xb')](config[_0xe906('0xa')],{'host':_0xe906('0xc'),'port':0x18eb});var socket=require(_0xe906('0xd'))(new Redis(config[_0xe906('0xa')]));require(_0xe906('0xe'))[_0xe906('0xf')](socket);function respondWithRpcPromise(_0x535d07,_0x2b4e67,_0x34b66e){return new BPromise(function(_0x18bf6b,_0x2e2c78){return client[_0xe906('0x10')](_0x535d07,_0x34b66e)['then'](function(_0x59fe4e){logger[_0xe906('0x11')](_0xe906('0x12'),_0x2b4e67,'request\x20sent');logger[_0xe906('0x13')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x2b4e67,'request\x20sent',JSON['stringify'](_0x59fe4e));if(_0x59fe4e['error']){if(_0x59fe4e[_0xe906('0x14')][_0xe906('0x15')]===0x1f4){logger['error']('SmsQueue,\x20%s,\x20%s',_0x2b4e67,_0x59fe4e[_0xe906('0x14')][_0xe906('0x16')]);return _0x2e2c78(_0x59fe4e[_0xe906('0x14')]['message']);}logger[_0xe906('0x14')]('SmsQueue,\x20%s,\x20%s',_0x2b4e67,_0x59fe4e[_0xe906('0x14')][_0xe906('0x16')]);return _0x18bf6b(_0x59fe4e['error'][_0xe906('0x16')]);}else{logger[_0xe906('0x11')](_0xe906('0x12'),_0x2b4e67,_0xe906('0x17'));_0x18bf6b(_0x59fe4e['result'][_0xe906('0x16')]);}})[_0xe906('0x18')](function(_0x1ccda0){logger[_0xe906('0x14')]('SmsQueue,\x20%s,\x20%s',_0x2b4e67,_0x1ccda0);_0x2e2c78(_0x1ccda0);});});}exports['GetSmsQueue']=function(_0x3c49f1){var _0x4e5d34=this;return new Promise(function(_0x3eae3b,_0x5505d6){return db[_0xe906('0x19')][_0xe906('0x1a')]({'raw':_0x3c49f1['options']?_0x3c49f1[_0xe906('0x1b')][_0xe906('0x1c')]===undefined?!![]:![]:!![],'where':_0x3c49f1['options']?_0x3c49f1[_0xe906('0x1b')][_0xe906('0x1d')]||null:null,'attributes':_0x3c49f1[_0xe906('0x1b')]?_0x3c49f1[_0xe906('0x1b')][_0xe906('0x1e')]||null:null,'limit':_0x3c49f1['options']?_0x3c49f1[_0xe906('0x1b')][_0xe906('0x1f')]||null:null,'include':_0x3c49f1['options']?_0x3c49f1[_0xe906('0x1b')][_0xe906('0x20')]?_['map'](_0x3c49f1[_0xe906('0x1b')][_0xe906('0x20')],function(_0xd2691b){return{'model':db[_0xd2691b[_0xe906('0x21')]],'as':_0xd2691b['as'],'attributes':_0xd2691b[_0xe906('0x1e')],'include':_0xd2691b['include']?_[_0xe906('0x22')](_0xd2691b[_0xe906('0x20')],function(_0x4f4e3a){return{'model':db[_0x4f4e3a[_0xe906('0x21')]],'as':_0x4f4e3a['as'],'attributes':_0x4f4e3a[_0xe906('0x1e')],'include':_0x4f4e3a['include']?_[_0xe906('0x22')](_0x4f4e3a['include'],function(_0x378af3){return{'model':db[_0x378af3[_0xe906('0x21')]],'as':_0x378af3['as'],'attributes':_0x378af3['attributes']};}):[]};}):[]};}):[]:[]})[_0xe906('0x23')](function(_0x40fd45){logger[_0xe906('0x11')](_0xe906('0x24'),_0x3c49f1);logger['debug'](_0xe906('0x24'),_0x3c49f1,JSON['stringify'](_0x40fd45));_0x3eae3b(_0x40fd45);})[_0xe906('0x18')](function(_0x1acf31){logger['error'](_0xe906('0x24'),_0x1acf31[_0xe906('0x16')],_0x3c49f1);_0x5505d6(_0x4e5d34[_0xe906('0x14')](0x1f4,_0x1acf31[_0xe906('0x16')]));});});};exports[_0xe906('0x25')]=function(_0x18c7bb){var _0xe29e48=this;return new Promise(function(_0x2602d0,_0xcef0fd){return db[_0xe906('0x19')][_0xe906('0x26')]({'raw':_0x18c7bb[_0xe906('0x1b')]?_0x18c7bb['options'][_0xe906('0x1c')]===undefined?!![]:![]:!![],'where':_0x18c7bb[_0xe906('0x1b')]?_0x18c7bb[_0xe906('0x1b')][_0xe906('0x1d')]||null:null,'attributes':_0x18c7bb[_0xe906('0x1b')]?_0x18c7bb['options'][_0xe906('0x1e')]||null:null,'include':_0x18c7bb[_0xe906('0x1b')]?_0x18c7bb[_0xe906('0x1b')][_0xe906('0x20')]?_['map'](_0x18c7bb['options'][_0xe906('0x20')],function(_0x648c90){return{'model':db[_0x648c90[_0xe906('0x21')]],'as':_0x648c90['as'],'attributes':_0x648c90[_0xe906('0x1e')],'include':_0x648c90[_0xe906('0x20')]?_['map'](_0x648c90[_0xe906('0x20')],function(_0x377101){return{'model':db[_0x377101[_0xe906('0x21')]],'as':_0x377101['as'],'attributes':_0x377101[_0xe906('0x1e')],'include':_0x377101['include']?_[_0xe906('0x22')](_0x377101[_0xe906('0x20')],function(_0x379525){return{'model':db[_0x379525[_0xe906('0x21')]],'as':_0x379525['as'],'attributes':_0x379525[_0xe906('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe906('0x23')](function(_0x2f4c6c){logger[_0xe906('0x11')](_0xe906('0x25'),_0x18c7bb);logger[_0xe906('0x13')](_0xe906('0x25'),_0x18c7bb,JSON[_0xe906('0x27')](_0x2f4c6c));_0x2602d0(_0x2f4c6c);})[_0xe906('0x18')](function(_0x43f056){logger[_0xe906('0x14')](_0xe906('0x25'),_0x43f056[_0xe906('0x16')],_0x18c7bb);_0xcef0fd(_0xe29e48[_0xe906('0x14')](0x1f4,_0x43f056[_0xe906('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index fdfe50d..793155d 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 _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 +var _0x8e43=['length','smsQueue:','save','remove','update','emit','removeListener','register'];(function(_0x22bf47,_0x5b3cfd){var _0x63e280=function(_0x1bb6d6){while(--_0x1bb6d6){_0x22bf47['push'](_0x22bf47['shift']());}};_0x63e280(++_0x5b3cfd);}(_0x8e43,0x9a));var _0x38e4=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x8e43[_0x1589dd];return _0x1bddd1;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x38e4('0x0'),_0x38e4('0x1'),_0x38e4('0x2')];function createListener(_0x47f4d2,_0x4dbcbf){return function(_0x190e55){_0x4dbcbf[_0x38e4('0x3')](_0x47f4d2,_0x190e55);};}function removeListener(_0x284ef7,_0x29ae6e){return function(){SmsQueueEvents[_0x38e4('0x4')](_0x284ef7,_0x29ae6e);};}exports[_0x38e4('0x5')]=function(_0x3a5df3){for(var _0xcb358a=0x0,_0x250e6b=events[_0x38e4('0x6')];_0xcb358a<_0x250e6b;_0xcb358a++){var _0x360f13=events[_0xcb358a];var _0x2c10ae=createListener(_0x38e4('0x7')+_0x360f13,_0x3a5df3);SmsQueueEvents['on'](_0x360f13,_0x2c10ae);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index f808178..0fb7660 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 _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 +var _0xd8af=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','update','delete','exports','multer','util','path'];(function(_0x425e0c,_0x99e535){var _0x2bd841=function(_0x3a6715){while(--_0x3a6715){_0x425e0c['push'](_0x425e0c['shift']());}};_0x2bd841(++_0x99e535);}(_0xd8af,0x18d));var _0xfd8a=function(_0x4c18c6,_0x3790e3){_0x4c18c6=_0x4c18c6-0x0;var _0x20a09c=_0xd8af[_0x4c18c6];return _0x20a09c;};'use strict';var multer=require(_0xfd8a('0x0'));var util=require(_0xfd8a('0x1'));var path=require(_0xfd8a('0x2'));var timeout=require(_0xfd8a('0x3'));var express=require(_0xfd8a('0x4'));var router=express['Router']();var fs_extra=require(_0xfd8a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfd8a('0x6'));var config=require(_0xfd8a('0x7'));var controller=require(_0xfd8a('0x8'));router['get']('/',auth[_0xfd8a('0x9')](),controller['index']);router[_0xfd8a('0xa')](_0xfd8a('0xb'),auth[_0xfd8a('0x9')](),controller[_0xfd8a('0xc')]);router['get'](_0xfd8a('0xd'),auth[_0xfd8a('0x9')](),controller[_0xfd8a('0xe')]);router[_0xfd8a('0xf')]('/',auth[_0xfd8a('0x9')](),controller[_0xfd8a('0x10')]);router['put']('/:id',auth[_0xfd8a('0x9')](),controller[_0xfd8a('0x11')]);router[_0xfd8a('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xfd8a('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 84ff07d..6907337 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 _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 +var _0x0af7=['exports','STRING','DATE','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0af7,0x17b));var _0x70af=function(_0x3bd387,_0x56c2a9){_0x3bd387=_0x3bd387-0x0;var _0x3d5b2f=_0x0af7[_0x3bd387];return _0x3d5b2f;};'use strict';var moment=require(_0x70af('0x0'));var Sequelize=require('sequelize');module[_0x70af('0x1')]={'uniqueid':{'type':Sequelize[_0x70af('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x70af('0x2')]},'joinAt':{'type':Sequelize[_0x70af('0x3')]},'leaveAt':{'type':Sequelize[_0x70af('0x3')]},'acceptAt':{'type':Sequelize[_0x70af('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x70af('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 0454313..8b68f8a 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 _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 +var _0xbe2f=['apply','reject','save','update','then','destroy','error','stack','name','send','index','SmsQueueReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','type','VIRTUAL','filter','includeAll','include','rows','params','options','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset'];(function(_0x543743,_0x24f0f3){var _0xe8bf81=function(_0x2a6206){while(--_0x2a6206){_0x543743['push'](_0x543743['shift']());}};_0xe8bf81(++_0x24f0f3);}(_0xbe2f,0x73));var _0xfbe2=function(_0x347813,_0xbc3d14){_0x347813=_0x347813-0x0;var _0x474565=_0xbe2f[_0x347813];return _0x474565;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfbe2('0x0'));var zipdir=require(_0xfbe2('0x1'));var jsonpatch=require(_0xfbe2('0x2'));var rp=require('request-promise');var moment=require(_0xfbe2('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xfbe2('0x4'));var sox=require(_0xfbe2('0x5'));var csv=require(_0xfbe2('0x6'));var ejs=require(_0xfbe2('0x7'));var fs=require('fs');var fs_extra=require(_0xfbe2('0x8'));var _=require(_0xfbe2('0x9'));var squel=require(_0xfbe2('0xa'));var crypto=require(_0xfbe2('0xb'));var jsforce=require(_0xfbe2('0xc'));var deskjs=require(_0xfbe2('0xd'));var toCsv=require(_0xfbe2('0x6'));var querystring=require('querystring');var Papa=require(_0xfbe2('0xe'));var Redis=require('ioredis');var authService=require(_0xfbe2('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfbe2('0x10'));var hardwareService=require(_0xfbe2('0x11'));var logger=require('../../config/logger')(_0xfbe2('0x12'));var utils=require(_0xfbe2('0x13'));var config=require(_0xfbe2('0x14'));var licenseUtil=require(_0xfbe2('0x15'));var db=require(_0xfbe2('0x16'))['db'];function respondWithStatusCode(_0x3dda35,_0x22b193){_0x22b193=_0x22b193||0xcc;return function(_0x1b2b6c){if(_0x1b2b6c){return _0x3dda35[_0xfbe2('0x17')](_0x22b193);}return _0x3dda35[_0xfbe2('0x18')](_0x22b193)[_0xfbe2('0x19')]();};}function respondWithResult(_0x1b2f95,_0x1e5feb){_0x1e5feb=_0x1e5feb||0xc8;return function(_0x158aac){if(_0x158aac){return _0x1b2f95[_0xfbe2('0x18')](_0x1e5feb)[_0xfbe2('0x1a')](_0x158aac);}};}function respondWithFilteredResult(_0x444660,_0x1f5483){return function(_0x4d6e7f){if(_0x4d6e7f){var _0x4679e1=typeof _0x1f5483['offset']===_0xfbe2('0x1b')&&typeof _0x1f5483[_0xfbe2('0x1c')]===_0xfbe2('0x1b');var _0x2153df=_0x4d6e7f[_0xfbe2('0x1d')];var _0x45b52e=_0x4679e1?0x0:_0x1f5483[_0xfbe2('0x1e')];var _0x4daeb4=_0x4679e1?_0x4d6e7f[_0xfbe2('0x1d')]:_0x1f5483[_0xfbe2('0x1e')]+_0x1f5483[_0xfbe2('0x1c')];var _0x4fdece;if(_0x4daeb4>=_0x2153df){_0x4daeb4=_0x2153df;_0x4fdece=0xc8;}else{_0x4fdece=0xce;}_0x444660['status'](_0x4fdece);return _0x444660['set']('Content-Range',_0x45b52e+'-'+_0x4daeb4+'/'+_0x2153df)[_0xfbe2('0x1a')](_0x4d6e7f);}return null;};}function patchUpdates(_0x45c60a){return function(_0x3f8991){try{jsonpatch[_0xfbe2('0x1f')](_0x3f8991,_0x45c60a,!![]);}catch(_0x477fd4){return BPromise[_0xfbe2('0x20')](_0x477fd4);}return _0x3f8991[_0xfbe2('0x21')]();};}function saveUpdates(_0xed65f3,_0x562e9d){return function(_0x3f232b){if(_0x3f232b){return _0x3f232b[_0xfbe2('0x22')](_0xed65f3)[_0xfbe2('0x23')](function(_0x28a95a){return _0x28a95a;});}return null;};}function removeEntity(_0x125ab5,_0x15fac8){return function(_0x541787){if(_0x541787){return _0x541787[_0xfbe2('0x24')]()[_0xfbe2('0x23')](function(){_0x125ab5[_0xfbe2('0x18')](0xcc)[_0xfbe2('0x19')]();});}};}function handleEntityNotFound(_0x50d9ef,_0x2c304f){return function(_0x2e6c1c){if(!_0x2e6c1c){_0x50d9ef[_0xfbe2('0x17')](0x194);}return _0x2e6c1c;};}function handleError(_0x341e26,_0x288f88){_0x288f88=_0x288f88||0x1f4;return function(_0x49758d){logger[_0xfbe2('0x25')](_0x49758d[_0xfbe2('0x26')]);if(_0x49758d[_0xfbe2('0x27')]){delete _0x49758d[_0xfbe2('0x27')];}_0x341e26[_0xfbe2('0x18')](_0x288f88)[_0xfbe2('0x28')](_0x49758d);};}exports[_0xfbe2('0x29')]=function(_0x5c9f2c,_0x444f6d){var _0x17027e={},_0x1194b3={},_0x45c55c={'count':0x0,'rows':[]};var _0x5ddb62=_['map'](db[_0xfbe2('0x2a')][_0xfbe2('0x2b')],function(_0x2853d3){return{'name':_0x2853d3[_0xfbe2('0x2c')],'type':_0x2853d3['type'][_0xfbe2('0x2d')]};});_0x1194b3[_0xfbe2('0x2e')]=_[_0xfbe2('0x2f')](_0x5ddb62,_0xfbe2('0x27'));_0x1194b3[_0xfbe2('0x30')]=_[_0xfbe2('0x31')](_0x5c9f2c[_0xfbe2('0x30')]);_0x1194b3[_0xfbe2('0x32')]=_[_0xfbe2('0x33')](_0x1194b3['model'],_0x1194b3[_0xfbe2('0x30')]);_0x17027e[_0xfbe2('0x34')]=_[_0xfbe2('0x33')](_0x1194b3[_0xfbe2('0x2e')],qs[_0xfbe2('0x35')](_0x5c9f2c['query']['fields']));_0x17027e[_0xfbe2('0x34')]=_0x17027e[_0xfbe2('0x34')][_0xfbe2('0x36')]?_0x17027e['attributes']:_0x1194b3[_0xfbe2('0x2e')];if(!_0x5c9f2c[_0xfbe2('0x30')][_0xfbe2('0x37')](_0xfbe2('0x38'))){_0x17027e[_0xfbe2('0x1c')]=qs['limit'](_0x5c9f2c[_0xfbe2('0x30')][_0xfbe2('0x1c')]);_0x17027e[_0xfbe2('0x1e')]=qs[_0xfbe2('0x1e')](_0x5c9f2c[_0xfbe2('0x30')][_0xfbe2('0x1e')]);}_0x17027e['order']=qs[_0xfbe2('0x39')](_0x5c9f2c[_0xfbe2('0x30')][_0xfbe2('0x39')]);_0x17027e[_0xfbe2('0x3a')]=qs['filters'](_['pick'](_0x5c9f2c['query'],_0x1194b3[_0xfbe2('0x32')]),_0x5ddb62);if(_0x5c9f2c['query']['filter']){_0x17027e[_0xfbe2('0x3a')]=_[_0xfbe2('0x3b')](_0x17027e[_0xfbe2('0x3a')],{'$or':_[_0xfbe2('0x2f')](_0x5ddb62,function(_0xc1225a){if(_0xc1225a[_0xfbe2('0x3c')]!==_0xfbe2('0x3d')){var _0x33bafc={};_0x33bafc[_0xc1225a[_0xfbe2('0x27')]]={'$like':'%'+_0x5c9f2c['query'][_0xfbe2('0x3e')]+'%'};return _0x33bafc;}})});}_0x17027e=_['merge']({},_0x17027e,_0x5c9f2c['options']);var _0x5f4574={'where':_0x17027e['where']};return db[_0xfbe2('0x2a')][_0xfbe2('0x1d')](_0x5f4574)[_0xfbe2('0x23')](function(_0x5eefa3){_0x45c55c['count']=_0x5eefa3;if(_0x5c9f2c[_0xfbe2('0x30')][_0xfbe2('0x3f')]){_0x17027e[_0xfbe2('0x40')]=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0x17027e);})[_0xfbe2('0x23')](function(_0x5ec72b){_0x45c55c[_0xfbe2('0x41')]=_0x5ec72b;return _0x45c55c;})[_0xfbe2('0x23')](respondWithFilteredResult(_0x444f6d,_0x17027e))['catch'](handleError(_0x444f6d,null));};exports['show']=function(_0x4d3222,_0x3186e3){var _0x5acf0b={'raw':!![],'where':{'id':_0x4d3222[_0xfbe2('0x42')]['id']}},_0x548fdf={};_0x548fdf[_0xfbe2('0x2e')]=_[_0xfbe2('0x31')](db[_0xfbe2('0x2a')][_0xfbe2('0x2b')]);_0x548fdf[_0xfbe2('0x30')]=_['keys'](_0x4d3222[_0xfbe2('0x30')]);_0x548fdf['filters']=_[_0xfbe2('0x33')](_0x548fdf[_0xfbe2('0x2e')],_0x548fdf[_0xfbe2('0x30')]);_0x5acf0b[_0xfbe2('0x34')]=_[_0xfbe2('0x33')](_0x548fdf[_0xfbe2('0x2e')],qs['fields'](_0x4d3222[_0xfbe2('0x30')][_0xfbe2('0x35')]));_0x5acf0b[_0xfbe2('0x34')]=_0x5acf0b[_0xfbe2('0x34')]['length']?_0x5acf0b[_0xfbe2('0x34')]:_0x548fdf[_0xfbe2('0x2e')];if(_0x4d3222[_0xfbe2('0x30')][_0xfbe2('0x3f')]){_0x5acf0b['include']=[{'all':!![]}];}_0x5acf0b=_[_0xfbe2('0x3b')]({},_0x5acf0b,_0x4d3222[_0xfbe2('0x43')]);return db[_0xfbe2('0x2a')][_0xfbe2('0x44')](_0x5acf0b)[_0xfbe2('0x23')](handleEntityNotFound(_0x3186e3,null))[_0xfbe2('0x23')](respondWithResult(_0x3186e3,null))[_0xfbe2('0x45')](handleError(_0x3186e3,null));};exports['create']=function(_0x163e8b,_0x309362){return db['SmsQueueReport'][_0xfbe2('0x46')](_0x163e8b['body'],{})[_0xfbe2('0x23')](respondWithResult(_0x309362,0xc9))[_0xfbe2('0x45')](handleError(_0x309362,null));};exports[_0xfbe2('0x22')]=function(_0x5359ed,_0x2e3165){if(_0x5359ed[_0xfbe2('0x47')]['id']){delete _0x5359ed[_0xfbe2('0x47')]['id'];}return db['SmsQueueReport'][_0xfbe2('0x44')]({'where':{'id':_0x5359ed['params']['id']}})[_0xfbe2('0x23')](handleEntityNotFound(_0x2e3165,null))['then'](saveUpdates(_0x5359ed[_0xfbe2('0x47')],null))['then'](respondWithResult(_0x2e3165,null))['catch'](handleError(_0x2e3165,null));};exports[_0xfbe2('0x24')]=function(_0x458603,_0x2ce1ed){return db[_0xfbe2('0x2a')][_0xfbe2('0x44')]({'where':{'id':_0x458603[_0xfbe2('0x42')]['id']}})[_0xfbe2('0x23')](handleEntityNotFound(_0x2ce1ed,null))['then'](removeEntity(_0x2ce1ed,null))[_0xfbe2('0x45')](handleError(_0x2ce1ed,null));};exports[_0xfbe2('0x48')]=function(_0x10d64c,_0x503a4d){return db[_0xfbe2('0x2a')]['describe']()[_0xfbe2('0x23')](respondWithResult(_0x503a4d,null))[_0xfbe2('0x45')](handleError(_0x503a4d,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index fef04d0..3715e56 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 _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 +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x17f732,_0x20456f){var _0x5a0e67=function(_0x1ea071){while(--_0x1ea071){_0x17f732['push'](_0x17f732['shift']());}};_0x5a0e67(++_0x20456f);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0xb7e7[_0x1b5aea];return _0x15cfc6;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index a51e39f..2f415a5 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 _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 +var _0xe907=['UpdateSmsQueueReport','SmsQueueReport','update','where','attributes','limit','debug','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport','create','body','options','raw'];(function(_0x512917,_0x26f761){var _0x7375bf=function(_0x5cdb55){while(--_0x5cdb55){_0x512917['push'](_0x512917['shift']());}};_0x7375bf(++_0x26f761);}(_0xe907,0xd9));var _0x7e90=function(_0x26bb87,_0x16a44f){_0x26bb87=_0x26bb87-0x0;var _0xd7aabd=_0xe907[_0x26bb87];return _0xd7aabd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7e90('0x0'));var BPromise=require(_0x7e90('0x1'));var rs=require(_0x7e90('0x2'));var fs=require('fs');var Redis=require(_0x7e90('0x3'));var db=require(_0x7e90('0x4'))['db'];var utils=require(_0x7e90('0x5'));var logger=require(_0x7e90('0x6'))(_0x7e90('0x7'));var config=require(_0x7e90('0x8'));var jayson=require(_0x7e90('0x9'));var client=jayson[_0x7e90('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x411b80,_0x168a31,_0x3ae37e){return new BPromise(function(_0x2f94fd,_0x1b94c4){return client[_0x7e90('0xb')](_0x411b80,_0x3ae37e)[_0x7e90('0xc')](function(_0x520c93){logger[_0x7e90('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x168a31,_0x7e90('0xe'));logger['debug'](_0x7e90('0xf'),_0x168a31,_0x7e90('0xe'),JSON[_0x7e90('0x10')](_0x520c93));if(_0x520c93['error']){if(_0x520c93[_0x7e90('0x11')][_0x7e90('0x12')]===0x1f4){logger[_0x7e90('0x11')](_0x7e90('0x13'),_0x168a31,_0x520c93['error'][_0x7e90('0x14')]);return _0x1b94c4(_0x520c93[_0x7e90('0x11')][_0x7e90('0x14')]);}logger[_0x7e90('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x168a31,_0x520c93[_0x7e90('0x11')][_0x7e90('0x14')]);return _0x2f94fd(_0x520c93[_0x7e90('0x11')][_0x7e90('0x14')]);}else{logger[_0x7e90('0xd')](_0x7e90('0x13'),_0x168a31,_0x7e90('0xe'));_0x2f94fd(_0x520c93[_0x7e90('0x15')][_0x7e90('0x14')]);}})[_0x7e90('0x16')](function(_0x5e13a8){logger[_0x7e90('0x11')](_0x7e90('0x13'),_0x168a31,_0x5e13a8);_0x1b94c4(_0x5e13a8);});});}exports[_0x7e90('0x17')]=function(_0x510b75){var _0x3ef04e=this;return new Promise(function(_0x34398e,_0x127a01){return db['SmsQueueReport'][_0x7e90('0x18')](_0x510b75[_0x7e90('0x19')],{'raw':_0x510b75['options']?_0x510b75[_0x7e90('0x1a')][_0x7e90('0x1b')]===undefined?!![]:![]:!![]})[_0x7e90('0xc')](function(_0x1e5164){logger['info'](_0x7e90('0x17'),_0x510b75);logger['debug']('CreateSmsQueueReport',_0x510b75,JSON[_0x7e90('0x10')](_0x1e5164));_0x34398e(_0x1e5164);})[_0x7e90('0x16')](function(_0x5f5a1c){logger[_0x7e90('0x11')](_0x7e90('0x17'),_0x5f5a1c[_0x7e90('0x14')],_0x510b75);_0x127a01(_0x3ef04e[_0x7e90('0x11')](0x1f4,_0x5f5a1c[_0x7e90('0x14')]));});});};exports[_0x7e90('0x1c')]=function(_0x50bbc5){var _0x464d3c=this;return new Promise(function(_0x30d7dc,_0x53c7ee){return db[_0x7e90('0x1d')][_0x7e90('0x1e')](_0x50bbc5[_0x7e90('0x19')],{'raw':_0x50bbc5[_0x7e90('0x1a')]?_0x50bbc5['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50bbc5[_0x7e90('0x1a')]?_0x50bbc5[_0x7e90('0x1a')][_0x7e90('0x1f')]||null:null,'attributes':_0x50bbc5[_0x7e90('0x1a')]?_0x50bbc5[_0x7e90('0x1a')][_0x7e90('0x20')]||null:null,'limit':_0x50bbc5['options']?_0x50bbc5[_0x7e90('0x1a')][_0x7e90('0x21')]||null:null})[_0x7e90('0xc')](function(_0x43d881){logger[_0x7e90('0xd')]('UpdateSmsQueueReport',_0x50bbc5);logger[_0x7e90('0x22')](_0x7e90('0x1c'),_0x50bbc5,JSON[_0x7e90('0x10')](_0x43d881));_0x30d7dc(_0x43d881);})[_0x7e90('0x16')](function(_0x55c975){logger[_0x7e90('0x11')](_0x7e90('0x1c'),_0x55c975[_0x7e90('0x14')],_0x50bbc5);_0x53c7ee(_0x464d3c[_0x7e90('0x11')](0x1f4,_0x55c975['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 635296f..df2cdf9 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 _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 +var _0x9649=['connect-timeout','Router','fs-extra','../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','put','update','delete','exports','multer','util','path'];(function(_0x3ea8eb,_0x238288){var _0x23b525=function(_0x5e9efc){while(--_0x5e9efc){_0x3ea8eb['push'](_0x3ea8eb['shift']());}};_0x23b525(++_0x238288);}(_0x9649,0x19f));var _0x9964=function(_0x238565,_0x50fdcb){_0x238565=_0x238565-0x0;var _0x59c353=_0x9649[_0x238565];return _0x59c353;};'use strict';var multer=require(_0x9964('0x0'));var util=require(_0x9964('0x1'));var path=require(_0x9964('0x2'));var timeout=require(_0x9964('0x3'));var express=require('express');var router=express[_0x9964('0x4')]();var fs_extra=require(_0x9964('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9964('0x6'));var config=require('../../config/environment');var controller=require(_0x9964('0x7'));router[_0x9964('0x8')]('/',auth[_0x9964('0x9')](),controller[_0x9964('0xa')]);router[_0x9964('0x8')](_0x9964('0xb'),auth[_0x9964('0x9')](),controller['describe']);router[_0x9964('0x8')](_0x9964('0xc'),auth['isAuthenticated'](),controller[_0x9964('0xd')]);router[_0x9964('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9964('0xf')](_0x9964('0xc'),auth[_0x9964('0x9')](),controller[_0x9964('0x10')]);router[_0x9964('0x11')]('/:id',auth[_0x9964('0x9')](),controller['destroy']);module[_0x9964('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 63b6795..8822c09 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 _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 +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x5b2cd5,_0x5caa0f){var _0x45e9aa=function(_0x147280){while(--_0x147280){_0x5b2cd5['push'](_0x5b2cd5['shift']());}};_0x45e9aa(++_0x5caa0f);}(_0x00bb,0x1d8));var _0xb00b=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x00bb[_0x24237f];return _0x48298e;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index dc2f8ba..b6c9111 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 _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 +var _0x636d=['includeAll','rows','catch','show','params','rawAttributes','merge','find','create','body','destroy','describe','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','status','end','undefined','limit','count','offset','set','json','apply','reject','save','update','then','sendStatus','error','name','send','index','SmsTransferReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','sort','filters','pick','filter','where','map','VIRTUAL','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x636d,0xa0));var _0xd636=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x636d[_0x5447fd];return _0x15b28a;};'use strict';var emlformat=require(_0xd636('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd636('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd636('0x2'));var moment=require('moment');var BPromise=require(_0xd636('0x3'));var Mustache=require(_0xd636('0x4'));var util=require(_0xd636('0x5'));var path=require(_0xd636('0x6'));var sox=require('sox');var csv=require(_0xd636('0x7'));var ejs=require(_0xd636('0x8'));var fs=require('fs');var fs_extra=require(_0xd636('0x9'));var _=require(_0xd636('0xa'));var squel=require(_0xd636('0xb'));var crypto=require(_0xd636('0xc'));var jsforce=require(_0xd636('0xd'));var deskjs=require(_0xd636('0xe'));var toCsv=require(_0xd636('0x7'));var querystring=require(_0xd636('0xf'));var Papa=require(_0xd636('0x10'));var Redis=require(_0xd636('0x11'));var authService=require(_0xd636('0x12'));var qs=require(_0xd636('0x13'));var as=require(_0xd636('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd636('0x15'));var utils=require(_0xd636('0x16'));var config=require(_0xd636('0x17'));var licenseUtil=require(_0xd636('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a60ab,_0x58c622){_0x58c622=_0x58c622||0xcc;return function(_0x1f09e2){if(_0x1f09e2){return _0x1a60ab['sendStatus'](_0x58c622);}return _0x1a60ab[_0xd636('0x19')](_0x58c622)[_0xd636('0x1a')]();};}function respondWithResult(_0x425fca,_0x33992d){_0x33992d=_0x33992d||0xc8;return function(_0x4435b2){if(_0x4435b2){return _0x425fca[_0xd636('0x19')](_0x33992d)['json'](_0x4435b2);}};}function respondWithFilteredResult(_0x337703,_0x21d455){return function(_0x1f084d){if(_0x1f084d){var _0x37bb85=typeof _0x21d455['offset']===_0xd636('0x1b')&&typeof _0x21d455[_0xd636('0x1c')]==='undefined';var _0xa0fb38=_0x1f084d[_0xd636('0x1d')];var _0x2a40ec=_0x37bb85?0x0:_0x21d455[_0xd636('0x1e')];var _0x5b3e3e=_0x37bb85?_0x1f084d['count']:_0x21d455[_0xd636('0x1e')]+_0x21d455[_0xd636('0x1c')];var _0x332a35;if(_0x5b3e3e>=_0xa0fb38){_0x5b3e3e=_0xa0fb38;_0x332a35=0xc8;}else{_0x332a35=0xce;}_0x337703[_0xd636('0x19')](_0x332a35);return _0x337703[_0xd636('0x1f')]('Content-Range',_0x2a40ec+'-'+_0x5b3e3e+'/'+_0xa0fb38)[_0xd636('0x20')](_0x1f084d);}return null;};}function patchUpdates(_0x2c1ad4){return function(_0x889830){try{jsonpatch[_0xd636('0x21')](_0x889830,_0x2c1ad4,!![]);}catch(_0x4eeb13){return BPromise[_0xd636('0x22')](_0x4eeb13);}return _0x889830[_0xd636('0x23')]();};}function saveUpdates(_0x3e52f2,_0x3a7d9a){return function(_0x83e19a){if(_0x83e19a){return _0x83e19a[_0xd636('0x24')](_0x3e52f2)[_0xd636('0x25')](function(_0x1c0f81){return _0x1c0f81;});}return null;};}function removeEntity(_0x100878,_0x265637){return function(_0x4a8f95){if(_0x4a8f95){return _0x4a8f95['destroy']()[_0xd636('0x25')](function(){_0x100878['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12735c,_0x22613a){return function(_0x2ad316){if(!_0x2ad316){_0x12735c[_0xd636('0x26')](0x194);}return _0x2ad316;};}function handleError(_0x38707c,_0x531aa0){_0x531aa0=_0x531aa0||0x1f4;return function(_0x214fff){logger[_0xd636('0x27')](_0x214fff['stack']);if(_0x214fff['name']){delete _0x214fff[_0xd636('0x28')];}_0x38707c['status'](_0x531aa0)[_0xd636('0x29')](_0x214fff);};}exports[_0xd636('0x2a')]=function(_0x442fb8,_0x3efd93){var _0x578ae2={},_0x379bcf={},_0x13a654={'count':0x0,'rows':[]};var _0xbdff6c=_['map'](db[_0xd636('0x2b')]['rawAttributes'],function(_0x3c7c62){return{'name':_0x3c7c62[_0xd636('0x2c')],'type':_0x3c7c62[_0xd636('0x2d')][_0xd636('0x2e')]};});_0x379bcf[_0xd636('0x2f')]=_['map'](_0xbdff6c,_0xd636('0x28'));_0x379bcf[_0xd636('0x30')]=_[_0xd636('0x31')](_0x442fb8[_0xd636('0x30')]);_0x379bcf['filters']=_[_0xd636('0x32')](_0x379bcf['model'],_0x379bcf[_0xd636('0x30')]);_0x578ae2[_0xd636('0x33')]=_['intersection'](_0x379bcf[_0xd636('0x2f')],qs['fields'](_0x442fb8['query'][_0xd636('0x34')]));_0x578ae2[_0xd636('0x33')]=_0x578ae2[_0xd636('0x33')][_0xd636('0x35')]?_0x578ae2['attributes']:_0x379bcf[_0xd636('0x2f')];if(!_0x442fb8[_0xd636('0x30')]['hasOwnProperty']('nolimit')){_0x578ae2[_0xd636('0x1c')]=qs['limit'](_0x442fb8[_0xd636('0x30')][_0xd636('0x1c')]);_0x578ae2[_0xd636('0x1e')]=qs[_0xd636('0x1e')](_0x442fb8[_0xd636('0x30')][_0xd636('0x1e')]);}_0x578ae2['order']=qs[_0xd636('0x36')](_0x442fb8['query'][_0xd636('0x36')]);_0x578ae2['where']=qs[_0xd636('0x37')](_[_0xd636('0x38')](_0x442fb8[_0xd636('0x30')],_0x379bcf['filters']),_0xbdff6c);if(_0x442fb8[_0xd636('0x30')][_0xd636('0x39')]){_0x578ae2[_0xd636('0x3a')]=_['merge'](_0x578ae2[_0xd636('0x3a')],{'$or':_[_0xd636('0x3b')](_0xbdff6c,function(_0x342c11){if(_0x342c11[_0xd636('0x2d')]!==_0xd636('0x3c')){var _0x1003fb={};_0x1003fb[_0x342c11[_0xd636('0x28')]]={'$like':'%'+_0x442fb8[_0xd636('0x30')][_0xd636('0x39')]+'%'};return _0x1003fb;}})});}_0x578ae2=_['merge']({},_0x578ae2,_0x442fb8[_0xd636('0x3d')]);var _0x2dfbce={'where':_0x578ae2[_0xd636('0x3a')]};return db[_0xd636('0x2b')]['count'](_0x2dfbce)[_0xd636('0x25')](function(_0x7171a0){_0x13a654[_0xd636('0x1d')]=_0x7171a0;if(_0x442fb8[_0xd636('0x30')][_0xd636('0x3e')]){_0x578ae2['include']=[{'all':!![]}];}return db[_0xd636('0x2b')]['findAll'](_0x578ae2);})[_0xd636('0x25')](function(_0x4baf46){_0x13a654[_0xd636('0x3f')]=_0x4baf46;return _0x13a654;})['then'](respondWithFilteredResult(_0x3efd93,_0x578ae2))[_0xd636('0x40')](handleError(_0x3efd93,null));};exports[_0xd636('0x41')]=function(_0x4796a2,_0x3d4683){var _0xd18a8f={'raw':!![],'where':{'id':_0x4796a2[_0xd636('0x42')]['id']}},_0x2a24d1={};_0x2a24d1['model']=_[_0xd636('0x31')](db[_0xd636('0x2b')][_0xd636('0x43')]);_0x2a24d1[_0xd636('0x30')]=_[_0xd636('0x31')](_0x4796a2[_0xd636('0x30')]);_0x2a24d1[_0xd636('0x37')]=_[_0xd636('0x32')](_0x2a24d1[_0xd636('0x2f')],_0x2a24d1[_0xd636('0x30')]);_0xd18a8f[_0xd636('0x33')]=_[_0xd636('0x32')](_0x2a24d1[_0xd636('0x2f')],qs['fields'](_0x4796a2[_0xd636('0x30')][_0xd636('0x34')]));_0xd18a8f[_0xd636('0x33')]=_0xd18a8f[_0xd636('0x33')][_0xd636('0x35')]?_0xd18a8f[_0xd636('0x33')]:_0x2a24d1['model'];if(_0x4796a2[_0xd636('0x30')][_0xd636('0x3e')]){_0xd18a8f['include']=[{'all':!![]}];}_0xd18a8f=_[_0xd636('0x44')]({},_0xd18a8f,_0x4796a2['options']);return db[_0xd636('0x2b')][_0xd636('0x45')](_0xd18a8f)[_0xd636('0x25')](handleEntityNotFound(_0x3d4683,null))[_0xd636('0x25')](respondWithResult(_0x3d4683,null))[_0xd636('0x40')](handleError(_0x3d4683,null));};exports[_0xd636('0x46')]=function(_0x2be92c,_0x2a8af8){return db[_0xd636('0x2b')][_0xd636('0x46')](_0x2be92c[_0xd636('0x47')],{})['then'](respondWithResult(_0x2a8af8,0xc9))[_0xd636('0x40')](handleError(_0x2a8af8,null));};exports['update']=function(_0x4d17f5,_0x333482){if(_0x4d17f5['body']['id']){delete _0x4d17f5[_0xd636('0x47')]['id'];}return db[_0xd636('0x2b')]['find']({'where':{'id':_0x4d17f5[_0xd636('0x42')]['id']}})[_0xd636('0x25')](handleEntityNotFound(_0x333482,null))[_0xd636('0x25')](saveUpdates(_0x4d17f5[_0xd636('0x47')],null))[_0xd636('0x25')](respondWithResult(_0x333482,null))['catch'](handleError(_0x333482,null));};exports[_0xd636('0x48')]=function(_0x1617b7,_0xeff7bb){return db[_0xd636('0x2b')][_0xd636('0x45')]({'where':{'id':_0x1617b7[_0xd636('0x42')]['id']}})[_0xd636('0x25')](handleEntityNotFound(_0xeff7bb,null))[_0xd636('0x25')](removeEntity(_0xeff7bb,null))[_0xd636('0x40')](handleError(_0xeff7bb,null));};exports[_0xd636('0x49')]=function(_0x138b94,_0x33867d){return db[_0xd636('0x2b')][_0xd636('0x49')]()[_0xd636('0x25')](respondWithResult(_0x33867d,null))['catch'](handleError(_0x33867d,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index e2e5bad..350ced1 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 _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 +var _0xfd3a=['rimraf','../../config/environment','./smsTransferReport.attributes','define','SmsTransferReport','uniqueid','../../config/logger','bluebird','request-promise'];(function(_0x9c642a,_0x2bf217){var _0x2854e8=function(_0x13b323){while(--_0x13b323){_0x9c642a['push'](_0x9c642a['shift']());}};_0x2854e8(++_0x2bf217);}(_0xfd3a,0xb1));var _0xafd3=function(_0x25e211,_0x2778fd){_0x25e211=_0x25e211-0x0;var _0x4e3f93=_0xfd3a[_0x25e211];return _0x4e3f93;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xafd3('0x0'))('api');var moment=require('moment');var BPromise=require(_0xafd3('0x1'));var rp=require(_0xafd3('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xafd3('0x3'));var config=require(_0xafd3('0x4'));var attributes=require(_0xafd3('0x5'));module['exports']=function(_0x1f9fd9,_0xbe660e){return _0x1f9fd9[_0xafd3('0x6')](_0xafd3('0x7'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xafd3('0x8'),'fields':[_0xafd3('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index fb4eaa1..8899ee2 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 _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 +var _0x6c96=['SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x575917,_0x15a1fa){var _0x5dc843=function(_0x40a21a){while(--_0x40a21a){_0x575917['push'](_0x575917['shift']());}};_0x5dc843(++_0x15a1fa);}(_0x6c96,0x1c1));var _0x66c9=function(_0x2c9dfe,_0x18660c){_0x2c9dfe=_0x2c9dfe-0x0;var _0x2e6465=_0x6c96[_0x2c9dfe];return _0x2e6465;};'use strict';var _=require(_0x66c9('0x0'));var util=require('util');var moment=require(_0x66c9('0x1'));var BPromise=require(_0x66c9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x66c9('0x3'));var db=require(_0x66c9('0x4'))['db'];var utils=require(_0x66c9('0x5'));var logger=require(_0x66c9('0x6'))(_0x66c9('0x7'));var config=require(_0x66c9('0x8'));var jayson=require(_0x66c9('0x9'));var client=jayson['client'][_0x66c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c6baa,_0xb03819,_0x4d7692){return new BPromise(function(_0x55b488,_0xfc41a4){return client[_0x66c9('0xb')](_0x4c6baa,_0x4d7692)[_0x66c9('0xc')](function(_0x2e8ad5){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0xb03819,'request\x20sent');logger['debug'](_0x66c9('0xd'),_0xb03819,_0x66c9('0xe'),JSON[_0x66c9('0xf')](_0x2e8ad5));if(_0x2e8ad5['error']){if(_0x2e8ad5[_0x66c9('0x10')][_0x66c9('0x11')]===0x1f4){logger[_0x66c9('0x10')](_0x66c9('0x12'),_0xb03819,_0x2e8ad5['error'][_0x66c9('0x13')]);return _0xfc41a4(_0x2e8ad5['error'][_0x66c9('0x13')]);}logger[_0x66c9('0x10')](_0x66c9('0x12'),_0xb03819,_0x2e8ad5[_0x66c9('0x10')]['message']);return _0x55b488(_0x2e8ad5[_0x66c9('0x10')][_0x66c9('0x13')]);}else{logger['info'](_0x66c9('0x12'),_0xb03819,_0x66c9('0xe'));_0x55b488(_0x2e8ad5[_0x66c9('0x14')][_0x66c9('0x13')]);}})[_0x66c9('0x15')](function(_0x14d989){logger[_0x66c9('0x10')](_0x66c9('0x12'),_0xb03819,_0x14d989);_0xfc41a4(_0x14d989);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 321fdf9..b5d4a38 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 _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 +var _0x32a8=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','basename','extname','now','post','single','file','create','put','delete','exports','multer','util','path','connect-timeout'];(function(_0x3bb15f,_0x3e4cb4){var _0x26050a=function(_0x7432be){while(--_0x7432be){_0x3bb15f['push'](_0x3bb15f['shift']());}};_0x26050a(++_0x3e4cb4);}(_0x32a8,0x17d));var _0x832a=function(_0x12ac1f,_0x461a52){_0x12ac1f=_0x12ac1f-0x0;var _0x724467=_0x32a8[_0x12ac1f];return _0x724467;};'use strict';var multer=require(_0x832a('0x0'));var util=require(_0x832a('0x1'));var path=require(_0x832a('0x2'));var timeout=require(_0x832a('0x3'));var express=require(_0x832a('0x4'));var router=express[_0x832a('0x5')]();var fs_extra=require(_0x832a('0x6'));var auth=require(_0x832a('0x7'));var interaction=require(_0x832a('0x8'));var config=require(_0x832a('0x9'));var controller=require(_0x832a('0xa'));router[_0x832a('0xb')]('/',auth[_0x832a('0xc')](),controller[_0x832a('0xd')]);router['get'](_0x832a('0xe'),auth[_0x832a('0xc')](),controller[_0x832a('0xf')]);router[_0x832a('0xb')](_0x832a('0x10'),auth[_0x832a('0xc')](),controller[_0x832a('0x11')]);var upload=multer({'storage':multer[_0x832a('0x12')]({'destination':function(_0x3d5b6d,_0xf43205,_0x10b586){_0x10b586(null,path[_0x832a('0x13')](config[_0x832a('0x14')],_0x832a('0x15')));},'filename':function(_0x444351,_0x472e04,_0x30f6e3){_0x472e04[_0x832a('0x16')]=_0x472e04[_0x832a('0x16')][_0x832a('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x30f6e3(null,util[_0x832a('0x18')]('%s-%s%s',path[_0x832a('0x19')](_0x472e04['originalname'],path[_0x832a('0x1a')](_0x472e04['originalname'])),Date[_0x832a('0x1b')](),path[_0x832a('0x1a')](_0x472e04[_0x832a('0x16')])));}})});router[_0x832a('0x1c')]('/',upload[_0x832a('0x1d')](_0x832a('0x1e')),controller[_0x832a('0x1f')]);router[_0x832a('0x20')](_0x832a('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x832a('0xe'),auth[_0x832a('0xc')](),controller[_0x832a('0x21')]);module[_0x832a('0x22')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 140cf34..0398149 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 _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 +var _0x231a=['FLOAT','exports','STRING','BIGINT','INTEGER'];(function(_0x7a3c59,_0x3835af){var _0x5183c0=function(_0x3e03ac){while(--_0x3e03ac){_0x7a3c59['push'](_0x7a3c59['shift']());}};_0x5183c0(++_0x3835af);}(_0x231a,0x1a5));var _0xa231=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x231a[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xa231('0x0')]={'name':{'type':Sequelize[_0xa231('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xa231('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xa231('0x1')]},'original_format':{'type':Sequelize[_0xa231('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0xa231('0x2')]},'original_channelCount':{'type':Sequelize[_0xa231('0x3')]},'original_bitRate':{'type':Sequelize[_0xa231('0x2')]},'original_sampleRate':{'type':Sequelize[_0xa231('0x3')]},'converted_format':{'type':Sequelize[_0xa231('0x1')]},'converted_duration':{'type':Sequelize[_0xa231('0x4')]},'converted_sampleCount':{'type':Sequelize[_0xa231('0x2')]},'converted_channelCount':{'type':Sequelize[_0xa231('0x3')]},'converted_bitRate':{'type':Sequelize[_0xa231('0x2')]},'converted_sampleRate':{'type':Sequelize[_0xa231('0x3')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 0898413..3290fb5 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 _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 +var _0x3409=['ejs','fs-extra','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','get','Sounds','error','stack','name','send','index','Sound','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','map','options','includeAll','include','findAll','catch','show','params','intersection','download','find','converted_format','existsSync','join','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','format','%s.%s','save_name','create','basename','file','extname','filename','originalname','info','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','wav','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_sampleRate','0777','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','start','description','delete','server/files/sounds/original','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x4ec0e9,_0x16f919){var _0x40ca33=function(_0x93faab){while(--_0x93faab){_0x4ec0e9['push'](_0x4ec0e9['shift']());}};_0x40ca33(++_0x16f919);}(_0x3409,0x15c));var _0x9340=function(_0x30e74d,_0x73f2c8){_0x30e74d=_0x30e74d-0x0;var _0x337ae2=_0x3409[_0x30e74d];return _0x337ae2;};'use strict';var emlformat=require(_0x9340('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9340('0x1'));var rp=require(_0x9340('0x2'));var moment=require(_0x9340('0x3'));var BPromise=require(_0x9340('0x4'));var Mustache=require(_0x9340('0x5'));var util=require('util');var path=require(_0x9340('0x6'));var sox=require(_0x9340('0x7'));var csv=require(_0x9340('0x8'));var ejs=require(_0x9340('0x9'));var fs=require('fs');var fs_extra=require(_0x9340('0xa'));var _=require('lodash');var squel=require(_0x9340('0xb'));var crypto=require('crypto');var jsforce=require(_0x9340('0xc'));var deskjs=require(_0x9340('0xd'));var toCsv=require(_0x9340('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9340('0xe'));var qs=require(_0x9340('0xf'));var as=require(_0x9340('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9340('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x9340('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x9340('0x13'))['db'];function respondWithStatusCode(_0x8b8544,_0x217f9c){_0x217f9c=_0x217f9c||0xcc;return function(_0x246ac3){if(_0x246ac3){return _0x8b8544[_0x9340('0x14')](_0x217f9c);}return _0x8b8544[_0x9340('0x15')](_0x217f9c)[_0x9340('0x16')]();};}function respondWithResult(_0x44d799,_0x9d60d2){_0x9d60d2=_0x9d60d2||0xc8;return function(_0x27d085){if(_0x27d085){return _0x44d799['status'](_0x9d60d2)[_0x9340('0x17')](_0x27d085);}};}function respondWithFilteredResult(_0x42a882,_0x2c9a22){return function(_0x4e39c3){if(_0x4e39c3){var _0x2b5b27=typeof _0x2c9a22[_0x9340('0x18')]===_0x9340('0x19')&&typeof _0x2c9a22[_0x9340('0x1a')]==='undefined';var _0x40310b=_0x4e39c3['count'];var _0x1702ae=_0x2b5b27?0x0:_0x2c9a22[_0x9340('0x18')];var _0x15c66a=_0x2b5b27?_0x4e39c3[_0x9340('0x1b')]:_0x2c9a22[_0x9340('0x18')]+_0x2c9a22['limit'];var _0x2fb22b;if(_0x15c66a>=_0x40310b){_0x15c66a=_0x40310b;_0x2fb22b=0xc8;}else{_0x2fb22b=0xce;}_0x42a882[_0x9340('0x15')](_0x2fb22b);return _0x42a882[_0x9340('0x1c')](_0x9340('0x1d'),_0x1702ae+'-'+_0x15c66a+'/'+_0x40310b)[_0x9340('0x17')](_0x4e39c3);}return null;};}function patchUpdates(_0x115e52){return function(_0x331146){try{jsonpatch[_0x9340('0x1e')](_0x331146,_0x115e52,!![]);}catch(_0x572c5e){return BPromise[_0x9340('0x1f')](_0x572c5e);}return _0x331146['save']();};}function saveUpdates(_0x382bd0,_0x5d0265){return function(_0x5df7bd){if(_0x5df7bd){return _0x5df7bd[_0x9340('0x20')](_0x382bd0)['then'](function(_0x1284f6){return _0x1284f6;});}return null;};}function removeEntity(_0x26b60f,_0x13e556){return function(_0x3e253a){if(_0x3e253a){return _0x3e253a[_0x9340('0x21')]()[_0x9340('0x22')](function(){var _0x9dd9cb=_0x3e253a[_0x9340('0x23')]({'plain':!![]});var _0x57a430=_0x9340('0x24');return db['UserProfileResource'][_0x9340('0x21')]({'where':{'type':_0x57a430,'resourceId':_0x9dd9cb['id']}})[_0x9340('0x22')](function(){return _0x3e253a;});})[_0x9340('0x22')](function(){_0x26b60f[_0x9340('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ca5d3,_0xe1c9a9){return function(_0x40dbfc){if(!_0x40dbfc){_0x1ca5d3[_0x9340('0x14')](0x194);}return _0x40dbfc;};}function handleError(_0x186baa,_0x4a5ccd){_0x4a5ccd=_0x4a5ccd||0x1f4;return function(_0x525a59){logger[_0x9340('0x25')](_0x525a59[_0x9340('0x26')]);if(_0x525a59[_0x9340('0x27')]){delete _0x525a59['name'];}_0x186baa[_0x9340('0x15')](_0x4a5ccd)[_0x9340('0x28')](_0x525a59);};}exports[_0x9340('0x29')]=function(_0x213bbf,_0x1801fa){var _0x2b48c0={},_0xfc781c={},_0x181ac8={'count':0x0,'rows':[]};var _0x209dea=_['map'](db[_0x9340('0x2a')][_0x9340('0x2b')],function(_0x5f20cb){return{'name':_0x5f20cb[_0x9340('0x2c')],'type':_0x5f20cb[_0x9340('0x2d')][_0x9340('0x2e')]};});_0xfc781c[_0x9340('0x2f')]=_['map'](_0x209dea,_0x9340('0x27'));_0xfc781c[_0x9340('0x30')]=_[_0x9340('0x31')](_0x213bbf[_0x9340('0x30')]);_0xfc781c[_0x9340('0x32')]=_['intersection'](_0xfc781c[_0x9340('0x2f')],_0xfc781c['query']);_0x2b48c0[_0x9340('0x33')]=_['intersection'](_0xfc781c['model'],qs[_0x9340('0x34')](_0x213bbf['query'][_0x9340('0x34')]));_0x2b48c0['attributes']=_0x2b48c0[_0x9340('0x33')][_0x9340('0x35')]?_0x2b48c0[_0x9340('0x33')]:_0xfc781c[_0x9340('0x2f')];if(!_0x213bbf[_0x9340('0x30')][_0x9340('0x36')](_0x9340('0x37'))){_0x2b48c0[_0x9340('0x1a')]=qs[_0x9340('0x1a')](_0x213bbf[_0x9340('0x30')][_0x9340('0x1a')]);_0x2b48c0[_0x9340('0x18')]=qs[_0x9340('0x18')](_0x213bbf['query']['offset']);}_0x2b48c0['order']=qs[_0x9340('0x38')](_0x213bbf[_0x9340('0x30')]['sort']);_0x2b48c0[_0x9340('0x39')]=qs[_0x9340('0x32')](_[_0x9340('0x3a')](_0x213bbf[_0x9340('0x30')],_0xfc781c['filters']),_0x209dea);if(_0x213bbf[_0x9340('0x30')][_0x9340('0x3b')]){_0x2b48c0[_0x9340('0x39')]=_['merge'](_0x2b48c0[_0x9340('0x39')],{'$or':_[_0x9340('0x3c')](_0x209dea,function(_0x9950){if(_0x9950[_0x9340('0x2d')]!=='VIRTUAL'){var _0x322ef4={};_0x322ef4[_0x9950['name']]={'$like':'%'+_0x213bbf[_0x9340('0x30')]['filter']+'%'};return _0x322ef4;}})});}_0x2b48c0=_['merge']({},_0x2b48c0,_0x213bbf[_0x9340('0x3d')]);var _0x282c6c={'where':_0x2b48c0[_0x9340('0x39')]};return db[_0x9340('0x2a')]['count'](_0x282c6c)[_0x9340('0x22')](function(_0x5b5c77){_0x181ac8[_0x9340('0x1b')]=_0x5b5c77;if(_0x213bbf['query'][_0x9340('0x3e')]){_0x2b48c0[_0x9340('0x3f')]=[{'all':!![]}];}return db[_0x9340('0x2a')][_0x9340('0x40')](_0x2b48c0);})[_0x9340('0x22')](function(_0x29b0b8){_0x181ac8['rows']=_0x29b0b8;return _0x181ac8;})[_0x9340('0x22')](respondWithFilteredResult(_0x1801fa,_0x2b48c0))[_0x9340('0x41')](handleError(_0x1801fa,null));};exports[_0x9340('0x42')]=function(_0x4e6b35,_0x47af2a){var _0x2ef450={'raw':!![],'where':{'id':_0x4e6b35[_0x9340('0x43')]['id']}},_0x397fbe={};_0x397fbe[_0x9340('0x2f')]=_[_0x9340('0x31')](db[_0x9340('0x2a')][_0x9340('0x2b')]);_0x397fbe[_0x9340('0x30')]=_[_0x9340('0x31')](_0x4e6b35[_0x9340('0x30')]);_0x397fbe[_0x9340('0x32')]=_[_0x9340('0x44')](_0x397fbe['model'],_0x397fbe[_0x9340('0x30')]);_0x2ef450['attributes']=_[_0x9340('0x44')](_0x397fbe[_0x9340('0x2f')],qs['fields'](_0x4e6b35[_0x9340('0x30')][_0x9340('0x34')]));_0x2ef450[_0x9340('0x33')]=_0x2ef450[_0x9340('0x33')]['length']?_0x2ef450[_0x9340('0x33')]:_0x397fbe['model'];if(_0x4e6b35[_0x9340('0x30')][_0x9340('0x3e')]){_0x2ef450[_0x9340('0x3f')]=[{'all':!![]}];}_0x2ef450=_['merge']({},_0x2ef450,_0x4e6b35[_0x9340('0x3d')]);return db[_0x9340('0x2a')]['find'](_0x2ef450)[_0x9340('0x22')](handleEntityNotFound(_0x47af2a,null))[_0x9340('0x22')](respondWithResult(_0x47af2a,null))[_0x9340('0x41')](handleError(_0x47af2a,null));};exports[_0x9340('0x45')]=function(_0x338a1b,_0x1b9a52,_0x4edb93){return db['Sound'][_0x9340('0x46')]({'where':{'id':_0x338a1b[_0x9340('0x43')]['id']},'attributes':[_0x9340('0x27'),'save_name',_0x9340('0x47')],'raw':!![]})[_0x9340('0x22')](handleEntityNotFound(_0x1b9a52,null))[_0x9340('0x22')](function(_0x34625d){if(_0x34625d){if(!fs[_0x9340('0x48')](path[_0x9340('0x49')](config[_0x9340('0x4a')],_0x9340('0x4b'),_0x34625d['save_name']+'.'+_0x34625d[_0x9340('0x47')]))){throw new db['Sequelize'][(_0x9340('0x4c'))](_0x9340('0x4d'));}return _0x1b9a52[_0x9340('0x45')](path['join'](config[_0x9340('0x4a')],_0x9340('0x4b'),util[_0x9340('0x4e')](_0x9340('0x4f'),_0x34625d[_0x9340('0x50')],_0x34625d['converted_format'])),util[_0x9340('0x4e')](_0x9340('0x4f'),_0x34625d['name'],_0x34625d[_0x9340('0x47')]));}return null;})['catch'](handleError(_0x1b9a52,null));};exports[_0x9340('0x51')]=function(_0x911251,_0x3012a4,_0x232214){var _0x2a6cab={'name':path[_0x9340('0x52')](_0x911251[_0x9340('0x53')]['originalname'],path[_0x9340('0x54')](_0x911251[_0x9340('0x53')]['originalname'])),'save_name':path[_0x9340('0x52')](_0x911251[_0x9340('0x53')][_0x9340('0x55')],path[_0x9340('0x54')](_0x911251[_0x9340('0x53')][_0x9340('0x55')])),'original_format':path[_0x9340('0x54')](_0x911251[_0x9340('0x53')][_0x9340('0x56')])['substring'](0x1),'converted_format':'wav'};var _0x1b2e4e=path['join'](config[_0x9340('0x4a')],'server/files/sounds/original',_0x911251[_0x9340('0x53')]['filename']);var _0xa94656=path[_0x9340('0x49')](config[_0x9340('0x4a')],'server/files/sounds/converted',util[_0x9340('0x4e')](_0x9340('0x4f'),path['basename'](_0x911251[_0x9340('0x53')]['filename'],path[_0x9340('0x54')](_0x911251[_0x9340('0x53')][_0x9340('0x55')])),_0x2a6cab['converted_format']));logger[_0x9340('0x57')]('Sound\x20upload\x20filepath:\x20%s',_0x1b2e4e);logger[_0x9340('0x57')](_0x9340('0x58'),_0xa94656);try{fs[_0x9340('0x59')](_0x1b2e4e,parseInt('0777',0x8));var _0x9b6502=sox[_0x9340('0x5a')](_0x1b2e4e,_0xa94656,{'sampleRate':0x1f40,'format':_0x9340('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x9b6502['on'](_0x9340('0x25'),function(_0x393f86){fs[_0x9340('0x5c')](_0x1b2e4e);_0x3012a4[_0x9340('0x15')](0x1f4)[_0x9340('0x28')](_0x393f86);});_0x9b6502['on'](_0x9340('0x5d'),function(_0x40b47b){_0x2a6cab[_0x9340('0x5e')]=isNaN(_0x40b47b['duration'])?null:_0x40b47b[_0x9340('0x5f')]*0x3e8;_0x2a6cab[_0x9340('0x60')]=isNaN(_0x40b47b[_0x9340('0x61')])?null:_0x40b47b[_0x9340('0x61')];_0x2a6cab['original_channelCount']=isNaN(_0x40b47b['channelCount'])?null:_0x40b47b[_0x9340('0x62')];_0x2a6cab[_0x9340('0x63')]=isNaN(_0x40b47b[_0x9340('0x64')])?null:_0x40b47b['bitRate'];_0x2a6cab[_0x9340('0x65')]=isNaN(_0x40b47b[_0x9340('0x66')])?null:_0x40b47b[_0x9340('0x66')];});_0x9b6502['on'](_0x9340('0x67'),function(_0x47f704){_0x2a6cab['converted_duration']=isNaN(_0x47f704['duration'])?null:_0x47f704[_0x9340('0x5f')]*0x3e8;_0x2a6cab[_0x9340('0x68')]=isNaN(_0x47f704['sampleCount'])?null:_0x47f704[_0x9340('0x61')];_0x2a6cab[_0x9340('0x69')]=isNaN(_0x47f704['channelCount'])?null:_0x47f704['channelCount'];_0x2a6cab['converted_bitRate']=isNaN(_0x47f704[_0x9340('0x64')])?null:_0x47f704[_0x9340('0x64')];_0x2a6cab[_0x9340('0x6a')]=isNaN(_0x47f704[_0x9340('0x66')])?null:_0x47f704['sampleRate'];});_0x9b6502['on'](_0x9340('0x16'),function(){fs[_0x9340('0x59')](_0xa94656,parseInt(_0x9340('0x6b'),0x8));return db[_0x9340('0x2a')][_0x9340('0x51')](_0x2a6cab)['then'](function(_0x5608ca){var _0x1bf8e8={'role':_0x911251[_0x9340('0x6c')]['role'],'userProfileId':_0x911251['body']['userProfileId']};if(!_0x1bf8e8)throw new Error(_0x9340('0x6d'));if(_0x1bf8e8['role']===_0x9340('0x6e')){var _0x2f12b9=_0x5608ca['get']({'plain':!![]});return db[_0x9340('0x6f')][_0x9340('0x46')]({'where':{'name':'Sounds','userProfileId':_0x1bf8e8[_0x9340('0x70')]},'raw':!![]})[_0x9340('0x22')](function(_0xce6292){if(_0xce6292&&_0xce6292[_0x9340('0x71')]===0x0){return db[_0x9340('0x72')][_0x9340('0x51')]({'name':_0x2f12b9[_0x9340('0x27')],'resourceId':_0x2f12b9['id'],'type':_0xce6292[_0x9340('0x27')],'sectionId':_0xce6292['id']},{})['then'](function(){return _0x5608ca;});}else{return _0x5608ca;}})[_0x9340('0x41')](function(_0x49a949){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a949);throw _0x49a949;});}return _0x5608ca;})[_0x9340('0x22')](respondWithResult(_0x3012a4,null))[_0x9340('0x41')](handleError(_0x3012a4,null));});_0x9b6502[_0x9340('0x73')]();}catch(_0x4b245d){_0x3012a4[_0x9340('0x15')](0x1f4)['send'](_0x4b245d);}};exports['update']=function(_0x68e137,_0x34303f,_0x4c06){return db[_0x9340('0x2a')][_0x9340('0x46')]({'where':{'id':_0x68e137[_0x9340('0x43')]['id']}})[_0x9340('0x22')](handleEntityNotFound(_0x34303f,null))['then'](saveUpdates(_[_0x9340('0x3a')](_0x68e137[_0x9340('0x6c')],['name',_0x9340('0x74')]),null))[_0x9340('0x22')](respondWithResult(_0x34303f,null))[_0x9340('0x41')](handleError(_0x34303f,null));};exports[_0x9340('0x75')]=function(_0x27cbd9,_0x5f1eb0,_0x1c9ba1){return db[_0x9340('0x2a')][_0x9340('0x46')]({'where':{'id':_0x27cbd9[_0x9340('0x43')]['id']}})[_0x9340('0x22')](function(_0x5ad95a){if(_0x5ad95a){return _0x5ad95a[_0x9340('0x21')]();}})[_0x9340('0x22')](function(_0x2714a2){var _0x3ebb69=path[_0x9340('0x49')](config[_0x9340('0x4a')],_0x9340('0x76'),util[_0x9340('0x4e')](_0x9340('0x4f'),_0x2714a2[_0x9340('0x50')],_0x2714a2['original_format']));var _0x42b382=path[_0x9340('0x49')](config[_0x9340('0x4a')],_0x9340('0x4b'),util['format'](_0x9340('0x4f'),_0x2714a2[_0x9340('0x50')],_0x2714a2[_0x9340('0x47')]));fs[_0x9340('0x5c')](_0x3ebb69);fs['unlinkSync'](_0x42b382);return _0x2714a2;})['then'](function(_0x4857c9){if(_0x4857c9){return _0x5f1eb0[_0x9340('0x15')](0xcc)[_0x9340('0x16')]();}})[_0x9340('0x22')](handleEntityNotFound(_0x5f1eb0,null))['catch'](handleError(_0x5f1eb0,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index a521aa9..f2314ad 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 _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 +var _0xfce5=['tools_sounds','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./sound.attributes','exports','define','Sound'];(function(_0x5311e8,_0x57c5bb){var _0x582ad8=function(_0x1909af){while(--_0x1909af){_0x5311e8['push'](_0x5311e8['shift']());}};_0x582ad8(++_0x57c5bb);}(_0xfce5,0x1d5));var _0x5fce=function(_0x2bfb31,_0xdd9aae){_0x2bfb31=_0x2bfb31-0x0;var _0x2b00ce=_0xfce5[_0x2bfb31];return _0x2b00ce;};'use strict';var _=require(_0x5fce('0x0'));var util=require(_0x5fce('0x1'));var logger=require(_0x5fce('0x2'))(_0x5fce('0x3'));var moment=require('moment');var BPromise=require(_0x5fce('0x4'));var rp=require(_0x5fce('0x5'));var fs=require('fs');var path=require(_0x5fce('0x6'));var rimraf=require('rimraf');var config=require(_0x5fce('0x7'));var attributes=require(_0x5fce('0x8'));module[_0x5fce('0x9')]=function(_0x3a1256,_0x47e830){return _0x3a1256[_0x5fce('0xa')](_0x5fce('0xb'),attributes,{'tableName':_0x5fce('0xc'),'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 b69dab8..80ce24e 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 _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 +var _0xa1e8=['raw','where','attributes','include','map','model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','request\x20sent','error','message','Sound,\x20%s,\x20%s','result','catch','ShowSound','Sound','find','options'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xa1e8,0xb1));var _0x8a1e=function(_0x3a85fd,_0x574d49){_0x3a85fd=_0x3a85fd-0x0;var _0x2b5c3d=_0xa1e8[_0x3a85fd];return _0x2b5c3d;};'use strict';var _=require(_0x8a1e('0x0'));var util=require(_0x8a1e('0x1'));var moment=require(_0x8a1e('0x2'));var BPromise=require(_0x8a1e('0x3'));var rs=require(_0x8a1e('0x4'));var fs=require('fs');var Redis=require(_0x8a1e('0x5'));var db=require(_0x8a1e('0x6'))['db'];var utils=require(_0x8a1e('0x7'));var logger=require(_0x8a1e('0x8'))(_0x8a1e('0x9'));var config=require('../../config/environment');var jayson=require(_0x8a1e('0xa'));var client=jayson[_0x8a1e('0xb')][_0x8a1e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x105774,_0x18eeb5,_0x1cb8f8){return new BPromise(function(_0x521d21,_0x342fa){return client[_0x8a1e('0xd')](_0x105774,_0x1cb8f8)[_0x8a1e('0xe')](function(_0x2f59fc){logger[_0x8a1e('0xf')]('Sound,\x20%s,\x20%s',_0x18eeb5,'request\x20sent');logger[_0x8a1e('0x10')]('Sound,\x20%s,\x20%s,\x20%s',_0x18eeb5,_0x8a1e('0x11'),JSON['stringify'](_0x2f59fc));if(_0x2f59fc[_0x8a1e('0x12')]){if(_0x2f59fc[_0x8a1e('0x12')]['code']===0x1f4){logger['error']('Sound,\x20%s,\x20%s',_0x18eeb5,_0x2f59fc[_0x8a1e('0x12')][_0x8a1e('0x13')]);return _0x342fa(_0x2f59fc[_0x8a1e('0x12')][_0x8a1e('0x13')]);}logger[_0x8a1e('0x12')](_0x8a1e('0x14'),_0x18eeb5,_0x2f59fc[_0x8a1e('0x12')]['message']);return _0x521d21(_0x2f59fc[_0x8a1e('0x12')]['message']);}else{logger['info']('Sound,\x20%s,\x20%s',_0x18eeb5,_0x8a1e('0x11'));_0x521d21(_0x2f59fc[_0x8a1e('0x15')][_0x8a1e('0x13')]);}})[_0x8a1e('0x16')](function(_0x2ebe21){logger['error'](_0x8a1e('0x14'),_0x18eeb5,_0x2ebe21);_0x342fa(_0x2ebe21);});});}exports[_0x8a1e('0x17')]=function(_0x169d93){var _0xf895b8=this;return new Promise(function(_0x3e5d61,_0x1ae851){return db[_0x8a1e('0x18')][_0x8a1e('0x19')]({'raw':_0x169d93[_0x8a1e('0x1a')]?_0x169d93['options'][_0x8a1e('0x1b')]===undefined?!![]:![]:!![],'where':_0x169d93[_0x8a1e('0x1a')]?_0x169d93[_0x8a1e('0x1a')][_0x8a1e('0x1c')]||null:null,'attributes':_0x169d93['options']?_0x169d93[_0x8a1e('0x1a')][_0x8a1e('0x1d')]||null:null,'include':_0x169d93[_0x8a1e('0x1a')]?_0x169d93['options'][_0x8a1e('0x1e')]?_['map'](_0x169d93[_0x8a1e('0x1a')][_0x8a1e('0x1e')],function(_0x10de3d){return{'model':db[_0x10de3d['model']],'as':_0x10de3d['as'],'attributes':_0x10de3d[_0x8a1e('0x1d')],'include':_0x10de3d['include']?_[_0x8a1e('0x1f')](_0x10de3d[_0x8a1e('0x1e')],function(_0x2201a9){return{'model':db[_0x2201a9[_0x8a1e('0x20')]],'as':_0x2201a9['as'],'attributes':_0x2201a9[_0x8a1e('0x1d')],'include':_0x2201a9['include']?_[_0x8a1e('0x1f')](_0x2201a9[_0x8a1e('0x1e')],function(_0xbbacbc){return{'model':db[_0xbbacbc[_0x8a1e('0x20')]],'as':_0xbbacbc['as'],'attributes':_0xbbacbc['attributes']};}):[]};}):[]};}):[]:[]})[_0x8a1e('0xe')](function(_0x3285b6){logger['info'](_0x8a1e('0x17'),_0x169d93);logger[_0x8a1e('0x10')]('ShowSound',_0x169d93,JSON[_0x8a1e('0x21')](_0x3285b6));_0x3e5d61(_0x3285b6);})[_0x8a1e('0x16')](function(_0x185281){logger[_0x8a1e('0x12')](_0x8a1e('0x17'),_0x185281['message'],_0x169d93);_0x1ae851(_0xf895b8[_0x8a1e('0x12')](0x1f4,_0x185281[_0x8a1e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 80c58ad..09b946c 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_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 +var _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x2a1c0f,_0xe26824){var _0x1f750c=function(_0xa4cf86){while(--_0xa4cf86){_0x2a1c0f['push'](_0x2a1c0f['shift']());}};_0x1f750c(++_0xe26824);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index e7fb96a..4fe82f6 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 _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 +var _0xa9c7=['TEXT','medium','ENUM','out','sequelize','exports','STRING'];(function(_0x3a00a1,_0x200672){var _0x3a97c1=function(_0x2e218f){while(--_0x2e218f){_0x3a00a1['push'](_0x3a00a1['shift']());}};_0x3a97c1(++_0x200672);}(_0xa9c7,0xa5));var _0x7a9c=function(_0x265aa2,_0x220072){_0x265aa2=_0x265aa2-0x0;var _0x447a3a=_0xa9c7[_0x265aa2];return _0x447a3a;};'use strict';var Sequelize=require(_0x7a9c('0x0'));module[_0x7a9c('0x1')]={'uniqueid':{'type':Sequelize[_0x7a9c('0x2')]},'body':{'type':Sequelize[_0x7a9c('0x3')](_0x7a9c('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x7a9c('0x5')]('in',_0x7a9c('0x6')),'defaultValue':_0x7a9c('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0x7a9c('0x2')]},'providerResponse':{'type':Sequelize[_0x7a9c('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index ca044c9..a46c1cd 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 _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 +var _0xa3db=['SquareMessage','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','rows','show','keys','includeAll','include','options','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map'];(function(_0x5a5dc6,_0x1ad6dd){var _0x4c47b9=function(_0x550e62){while(--_0x550e62){_0x5a5dc6['push'](_0x5a5dc6['shift']());}};_0x4c47b9(++_0x1ad6dd);}(_0xa3db,0x10c));var _0xba3d=function(_0x1b3916,_0x1af215){_0x1b3916=_0x1b3916-0x0;var _0x7e8121=_0xa3db[_0x1b3916];return _0x7e8121;};'use strict';var emlformat=require(_0xba3d('0x0'));var rimraf=require(_0xba3d('0x1'));var zipdir=require(_0xba3d('0x2'));var jsonpatch=require(_0xba3d('0x3'));var rp=require(_0xba3d('0x4'));var moment=require(_0xba3d('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xba3d('0x6'));var path=require('path');var sox=require(_0xba3d('0x7'));var csv=require('to-csv');var ejs=require(_0xba3d('0x8'));var fs=require('fs');var fs_extra=require(_0xba3d('0x9'));var _=require(_0xba3d('0xa'));var squel=require(_0xba3d('0xb'));var crypto=require(_0xba3d('0xc'));var jsforce=require(_0xba3d('0xd'));var deskjs=require(_0xba3d('0xe'));var toCsv=require(_0xba3d('0xf'));var querystring=require(_0xba3d('0x10'));var Papa=require(_0xba3d('0x11'));var Redis=require(_0xba3d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xba3d('0x13'));var as=require(_0xba3d('0x14'));var hardwareService=require(_0xba3d('0x15'));var logger=require(_0xba3d('0x16'))(_0xba3d('0x17'));var utils=require('../../config/utils');var config=require(_0xba3d('0x18'));var licenseUtil=require(_0xba3d('0x19'));var db=require(_0xba3d('0x1a'))['db'];function respondWithStatusCode(_0x526026,_0x47f11d){_0x47f11d=_0x47f11d||0xcc;return function(_0x1daf60){if(_0x1daf60){return _0x526026[_0xba3d('0x1b')](_0x47f11d);}return _0x526026['status'](_0x47f11d)['end']();};}function respondWithResult(_0xcdcbab,_0x497630){_0x497630=_0x497630||0xc8;return function(_0x446f86){if(_0x446f86){return _0xcdcbab[_0xba3d('0x1c')](_0x497630)[_0xba3d('0x1d')](_0x446f86);}};}function respondWithFilteredResult(_0x38fcc8,_0x327a3a){return function(_0x186bb){if(_0x186bb){var _0x19e521=typeof _0x327a3a[_0xba3d('0x1e')]===_0xba3d('0x1f')&&typeof _0x327a3a[_0xba3d('0x20')]==='undefined';var _0x208978=_0x186bb[_0xba3d('0x21')];var _0x1112ae=_0x19e521?0x0:_0x327a3a[_0xba3d('0x1e')];var _0xbb8168=_0x19e521?_0x186bb[_0xba3d('0x21')]:_0x327a3a[_0xba3d('0x1e')]+_0x327a3a[_0xba3d('0x20')];var _0x5b85e8;if(_0xbb8168>=_0x208978){_0xbb8168=_0x208978;_0x5b85e8=0xc8;}else{_0x5b85e8=0xce;}_0x38fcc8[_0xba3d('0x1c')](_0x5b85e8);return _0x38fcc8['set'](_0xba3d('0x22'),_0x1112ae+'-'+_0xbb8168+'/'+_0x208978)[_0xba3d('0x1d')](_0x186bb);}return null;};}function patchUpdates(_0x2001f5){return function(_0x3aaef4){try{jsonpatch[_0xba3d('0x23')](_0x3aaef4,_0x2001f5,!![]);}catch(_0x3ad698){return BPromise[_0xba3d('0x24')](_0x3ad698);}return _0x3aaef4[_0xba3d('0x25')]();};}function saveUpdates(_0x6db61d,_0x3b4655){return function(_0x2b10ee){if(_0x2b10ee){return _0x2b10ee[_0xba3d('0x26')](_0x6db61d)[_0xba3d('0x27')](function(_0x59f91f){return _0x59f91f;});}return null;};}function removeEntity(_0x4f2b74,_0x5ac59b){return function(_0x51bace){if(_0x51bace){return _0x51bace[_0xba3d('0x28')]()[_0xba3d('0x27')](function(){_0x4f2b74[_0xba3d('0x1c')](0xcc)[_0xba3d('0x29')]();});}};}function handleEntityNotFound(_0x17b9d9,_0x20d60f){return function(_0x4a8f81){if(!_0x4a8f81){_0x17b9d9[_0xba3d('0x1b')](0x194);}return _0x4a8f81;};}function handleError(_0x3cc662,_0x3e61d9){_0x3e61d9=_0x3e61d9||0x1f4;return function(_0x325861){logger[_0xba3d('0x2a')](_0x325861[_0xba3d('0x2b')]);if(_0x325861['name']){delete _0x325861[_0xba3d('0x2c')];}_0x3cc662[_0xba3d('0x1c')](_0x3e61d9)[_0xba3d('0x2d')](_0x325861);};}exports[_0xba3d('0x2e')]=function(_0x50e82a,_0x1a9b37){var _0x4e24d8={},_0x117b69={},_0x1bd4ec={'count':0x0,'rows':[]};var _0x25c4cc=_[_0xba3d('0x2f')](db[_0xba3d('0x30')][_0xba3d('0x31')],function(_0x3d953b){return{'name':_0x3d953b[_0xba3d('0x32')],'type':_0x3d953b[_0xba3d('0x33')][_0xba3d('0x34')]};});_0x117b69['model']=_[_0xba3d('0x2f')](_0x25c4cc,'name');_0x117b69['query']=_['keys'](_0x50e82a[_0xba3d('0x35')]);_0x117b69[_0xba3d('0x36')]=_[_0xba3d('0x37')](_0x117b69[_0xba3d('0x38')],_0x117b69[_0xba3d('0x35')]);_0x4e24d8['attributes']=_[_0xba3d('0x37')](_0x117b69[_0xba3d('0x38')],qs['fields'](_0x50e82a[_0xba3d('0x35')][_0xba3d('0x39')]));_0x4e24d8['attributes']=_0x4e24d8[_0xba3d('0x3a')][_0xba3d('0x3b')]?_0x4e24d8['attributes']:_0x117b69[_0xba3d('0x38')];if(!_0x50e82a['query']['hasOwnProperty'](_0xba3d('0x3c'))){_0x4e24d8[_0xba3d('0x20')]=qs[_0xba3d('0x20')](_0x50e82a[_0xba3d('0x35')][_0xba3d('0x20')]);_0x4e24d8[_0xba3d('0x1e')]=qs[_0xba3d('0x1e')](_0x50e82a[_0xba3d('0x35')][_0xba3d('0x1e')]);}_0x4e24d8[_0xba3d('0x3d')]=qs[_0xba3d('0x3e')](_0x50e82a['query']['sort']);_0x4e24d8[_0xba3d('0x3f')]=qs['filters'](_[_0xba3d('0x40')](_0x50e82a[_0xba3d('0x35')],_0x117b69[_0xba3d('0x36')]),_0x25c4cc);if(_0x50e82a[_0xba3d('0x35')][_0xba3d('0x41')]){_0x4e24d8['where']=_[_0xba3d('0x42')](_0x4e24d8[_0xba3d('0x3f')],{'$or':_[_0xba3d('0x2f')](_0x25c4cc,function(_0x38362a){if(_0x38362a['type']!==_0xba3d('0x43')){var _0x3c754b={};_0x3c754b[_0x38362a[_0xba3d('0x2c')]]={'$like':'%'+_0x50e82a[_0xba3d('0x35')][_0xba3d('0x41')]+'%'};return _0x3c754b;}})});}_0x4e24d8=_[_0xba3d('0x42')]({},_0x4e24d8,_0x50e82a['options']);var _0x253ce2={'where':_0x4e24d8[_0xba3d('0x3f')]};return db[_0xba3d('0x30')][_0xba3d('0x21')](_0x253ce2)[_0xba3d('0x27')](function(_0x583eb5){_0x1bd4ec[_0xba3d('0x21')]=_0x583eb5;if(_0x50e82a['query']['includeAll']){_0x4e24d8['include']=[{'all':!![]}];}return db[_0xba3d('0x30')]['findAll'](_0x4e24d8);})['then'](function(_0x1f8588){_0x1bd4ec[_0xba3d('0x44')]=_0x1f8588;return _0x1bd4ec;})['then'](respondWithFilteredResult(_0x1a9b37,_0x4e24d8))['catch'](handleError(_0x1a9b37,null));};exports[_0xba3d('0x45')]=function(_0x4007e6,_0x1ab91d){var _0x17cd9d={'raw':!![],'where':{'id':_0x4007e6['params']['id']}},_0x117baa={};_0x117baa[_0xba3d('0x38')]=_[_0xba3d('0x46')](db[_0xba3d('0x30')]['rawAttributes']);_0x117baa[_0xba3d('0x35')]=_[_0xba3d('0x46')](_0x4007e6[_0xba3d('0x35')]);_0x117baa[_0xba3d('0x36')]=_[_0xba3d('0x37')](_0x117baa['model'],_0x117baa[_0xba3d('0x35')]);_0x17cd9d[_0xba3d('0x3a')]=_['intersection'](_0x117baa[_0xba3d('0x38')],qs[_0xba3d('0x39')](_0x4007e6[_0xba3d('0x35')][_0xba3d('0x39')]));_0x17cd9d['attributes']=_0x17cd9d['attributes']['length']?_0x17cd9d[_0xba3d('0x3a')]:_0x117baa[_0xba3d('0x38')];if(_0x4007e6[_0xba3d('0x35')][_0xba3d('0x47')]){_0x17cd9d[_0xba3d('0x48')]=[{'all':!![]}];}_0x17cd9d=_[_0xba3d('0x42')]({},_0x17cd9d,_0x4007e6[_0xba3d('0x49')]);return db['SquareMessage'][_0xba3d('0x4a')](_0x17cd9d)[_0xba3d('0x27')](handleEntityNotFound(_0x1ab91d,null))[_0xba3d('0x27')](respondWithResult(_0x1ab91d,null))[_0xba3d('0x4b')](handleError(_0x1ab91d,null));};exports[_0xba3d('0x4c')]=function(_0xeb7f49,_0x545f30){return db[_0xba3d('0x30')]['create'](_0xeb7f49[_0xba3d('0x4d')],{})[_0xba3d('0x27')](respondWithResult(_0x545f30,0xc9))[_0xba3d('0x4b')](handleError(_0x545f30,null));};exports[_0xba3d('0x26')]=function(_0x468c08,_0x48cfad){if(_0x468c08[_0xba3d('0x4d')]['id']){delete _0x468c08[_0xba3d('0x4d')]['id'];}return db['SquareMessage'][_0xba3d('0x4a')]({'where':{'id':_0x468c08[_0xba3d('0x4e')]['id']}})[_0xba3d('0x27')](handleEntityNotFound(_0x48cfad,null))[_0xba3d('0x27')](saveUpdates(_0x468c08[_0xba3d('0x4d')],null))[_0xba3d('0x27')](respondWithResult(_0x48cfad,null))[_0xba3d('0x4b')](handleError(_0x48cfad,null));};exports[_0xba3d('0x28')]=function(_0x5b84da,_0x57a073){return db[_0xba3d('0x30')][_0xba3d('0x4a')]({'where':{'id':_0x5b84da['params']['id']}})[_0xba3d('0x27')](handleEntityNotFound(_0x57a073,null))[_0xba3d('0x27')](removeEntity(_0x57a073,null))[_0xba3d('0x4b')](handleError(_0x57a073,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 1000c89..b9dd6df 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 _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 +var _0xe4db=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','define','SquareMessage','square_messages'];(function(_0x3de6a3,_0x312259){var _0x3f7a4d=function(_0x6eb1c8){while(--_0x6eb1c8){_0x3de6a3['push'](_0x3de6a3['shift']());}};_0x3f7a4d(++_0x312259);}(_0xe4db,0x1e1));var _0xbe4d=function(_0x34d323,_0x17a187){_0x34d323=_0x34d323-0x0;var _0x36a73d=_0xe4db[_0x34d323];return _0x36a73d;};'use strict';var _=require(_0xbe4d('0x0'));var util=require('util');var logger=require(_0xbe4d('0x1'))(_0xbe4d('0x2'));var moment=require(_0xbe4d('0x3'));var BPromise=require(_0xbe4d('0x4'));var rp=require(_0xbe4d('0x5'));var fs=require('fs');var path=require(_0xbe4d('0x6'));var rimraf=require(_0xbe4d('0x7'));var config=require(_0xbe4d('0x8'));var attributes=require(_0xbe4d('0x9'));module['exports']=function(_0x33b22e,_0x31bbb2){return _0x33b22e[_0xbe4d('0xa')](_0xbe4d('0xb'),attributes,{'tableName':_0xbe4d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 0334af2..a297b1a 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 _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 +var _0x7a76=['CreateSquareMessage','SquareMessage','create','body','options','raw','debug','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','SquareMessage,\x20%s,\x20%s','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x16d3f8,_0x3f5dd3){var _0x49a172=function(_0x2f730d){while(--_0x2f730d){_0x16d3f8['push'](_0x16d3f8['shift']());}};_0x49a172(++_0x3f5dd3);}(_0x7a76,0x6b));var _0x67a7=function(_0x44ae0b,_0x3e9865){_0x44ae0b=_0x44ae0b-0x0;var _0x69232a=_0x7a76[_0x44ae0b];return _0x69232a;};'use strict';var _=require('lodash');var util=require(_0x67a7('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x67a7('0x1'));var fs=require('fs');var Redis=require(_0x67a7('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x67a7('0x3'));var logger=require('../../config/logger')(_0x67a7('0x4'));var config=require(_0x67a7('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x67a7('0x6')][_0x67a7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x31b855,_0x57c5be,_0x583bd1){return new BPromise(function(_0x4392cf,_0x5edca4){return client[_0x67a7('0x8')](_0x31b855,_0x583bd1)['then'](function(_0x1f4e34){logger['info'](_0x67a7('0x9'),_0x57c5be,'request\x20sent');logger['debug'](_0x67a7('0xa'),_0x57c5be,_0x67a7('0xb'),JSON[_0x67a7('0xc')](_0x1f4e34));if(_0x1f4e34[_0x67a7('0xd')]){if(_0x1f4e34[_0x67a7('0xd')][_0x67a7('0xe')]===0x1f4){logger[_0x67a7('0xd')](_0x67a7('0x9'),_0x57c5be,_0x1f4e34['error'][_0x67a7('0xf')]);return _0x5edca4(_0x1f4e34[_0x67a7('0xd')]['message']);}logger[_0x67a7('0xd')](_0x67a7('0x9'),_0x57c5be,_0x1f4e34[_0x67a7('0xd')]['message']);return _0x4392cf(_0x1f4e34[_0x67a7('0xd')]['message']);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x57c5be,_0x67a7('0xb'));_0x4392cf(_0x1f4e34[_0x67a7('0x10')]['message']);}})[_0x67a7('0x11')](function(_0x3a59b7){logger[_0x67a7('0xd')]('SquareMessage,\x20%s,\x20%s',_0x57c5be,_0x3a59b7);_0x5edca4(_0x3a59b7);});});}exports[_0x67a7('0x12')]=function(_0x10d965){var _0x5242a0=this;return new Promise(function(_0x397ab6,_0x5b7bd7){return db[_0x67a7('0x13')][_0x67a7('0x14')](_0x10d965[_0x67a7('0x15')],{'raw':_0x10d965[_0x67a7('0x16')]?_0x10d965[_0x67a7('0x16')][_0x67a7('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4b3df5){logger['info'](_0x67a7('0x12'),_0x10d965);logger[_0x67a7('0x18')](_0x67a7('0x12'),_0x10d965,JSON[_0x67a7('0xc')](_0x4b3df5));_0x397ab6(_0x4b3df5);})[_0x67a7('0x11')](function(_0x4fdd60){logger['error'](_0x67a7('0x12'),_0x4fdd60['message'],_0x10d965);_0x5b7bd7(_0x5242a0[_0x67a7('0xd')](0x1f4,_0x4fdd60[_0x67a7('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 2613d81..44cefa3 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 _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 +var _0xae95=['create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','/:id','show','/:id/test','post'];(function(_0x2c27f9,_0x120e57){var _0x38edef=function(_0x31c018){while(--_0x31c018){_0x2c27f9['push'](_0x2c27f9['shift']());}};_0x38edef(++_0x120e57);}(_0xae95,0x117));var _0x5ae9=function(_0x4de617,_0x2a9ad7){_0x4de617=_0x4de617-0x0;var _0x38df67=_0xae95[_0x4de617];return _0x38df67;};'use strict';var multer=require(_0x5ae9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5ae9('0x1'));var express=require(_0x5ae9('0x2'));var router=express[_0x5ae9('0x3')]();var fs_extra=require(_0x5ae9('0x4'));var auth=require(_0x5ae9('0x5'));var interaction=require(_0x5ae9('0x6'));var config=require(_0x5ae9('0x7'));var controller=require(_0x5ae9('0x8'));router[_0x5ae9('0x9')]('/',auth[_0x5ae9('0xa')](),controller['index']);router[_0x5ae9('0x9')](_0x5ae9('0xb'),auth[_0x5ae9('0xa')](),controller[_0x5ae9('0xc')]);router[_0x5ae9('0x9')](_0x5ae9('0xd'),auth[_0x5ae9('0xa')](),timeout('15s'),controller['test']);router[_0x5ae9('0xe')]('/',auth['isAuthenticated'](),controller[_0x5ae9('0xf')]);router[_0x5ae9('0x10')](_0x5ae9('0xb'),auth[_0x5ae9('0xa')](),controller[_0x5ae9('0x11')]);router[_0x5ae9('0x12')](_0x5ae9('0xb'),auth[_0x5ae9('0xa')](),controller[_0x5ae9('0x13')]);module[_0x5ae9('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 7744b8b..d4b0880 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 _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 +var _0x9e90=['sequelize','STRING','name'];(function(_0x1960b5,_0x1835a4){var _0x18f387=function(_0x4f781b){while(--_0x4f781b){_0x1960b5['push'](_0x1960b5['shift']());}};_0x18f387(++_0x1835a4);}(_0x9e90,0x1ce));var _0x09e9=function(_0x517124,_0x3a2900){_0x517124=_0x517124-0x0;var _0x35accd=_0x9e90[_0x517124];return _0x35accd;};'use strict';var Sequelize=require(_0x09e9('0x0'));module['exports']={'name':{'type':Sequelize[_0x09e9('0x1')],'unique':_0x09e9('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x09e9('0x1')]},'description':{'type':Sequelize[_0x09e9('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index db3dd8b..3fb9f95 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 _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 +var _0xc45f=['path','sox','to-csv','ejs','fs-extra','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','ODBC','UserProfileResource','stack','name','send','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','catch','show','params','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','test','dsn','odbc','openSync','closeSync','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x5dbd8c,_0x290203){var _0x277a82=function(_0x1fb90b){while(--_0x1fb90b){_0x5dbd8c['push'](_0x5dbd8c['shift']());}};_0x277a82(++_0x290203);}(_0xc45f,0xf5));var _0xfc45=function(_0x3e606f,_0x3166d6){_0x3e606f=_0x3e606f-0x0;var _0x419f84=_0xc45f[_0x3e606f];return _0x419f84;};'use strict';var emlformat=require(_0xfc45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfc45('0x1'));var jsonpatch=require(_0xfc45('0x2'));var rp=require('request-promise');var moment=require(_0xfc45('0x3'));var BPromise=require(_0xfc45('0x4'));var Mustache=require(_0xfc45('0x5'));var util=require(_0xfc45('0x6'));var path=require(_0xfc45('0x7'));var sox=require(_0xfc45('0x8'));var csv=require(_0xfc45('0x9'));var ejs=require(_0xfc45('0xa'));var fs=require('fs');var fs_extra=require(_0xfc45('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfc45('0xc'));var toCsv=require(_0xfc45('0x9'));var querystring=require('querystring');var Papa=require(_0xfc45('0xd'));var Redis=require(_0xfc45('0xe'));var authService=require(_0xfc45('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfc45('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfc45('0x11'));var utils=require(_0xfc45('0x12'));var config=require(_0xfc45('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xfc45('0x14'))['db'];function respondWithStatusCode(_0x390679,_0x5a08ce){_0x5a08ce=_0x5a08ce||0xcc;return function(_0x4b359b){if(_0x4b359b){return _0x390679[_0xfc45('0x15')](_0x5a08ce);}return _0x390679[_0xfc45('0x16')](_0x5a08ce)[_0xfc45('0x17')]();};}function respondWithResult(_0x1a04c4,_0x17058a){_0x17058a=_0x17058a||0xc8;return function(_0x1cdaab){if(_0x1cdaab){return _0x1a04c4[_0xfc45('0x16')](_0x17058a)['json'](_0x1cdaab);}};}function respondWithFilteredResult(_0xaf867a,_0x2f84cd){return function(_0x437b2a){if(_0x437b2a){var _0x402e7c=typeof _0x2f84cd[_0xfc45('0x18')]===_0xfc45('0x19')&&typeof _0x2f84cd[_0xfc45('0x1a')]===_0xfc45('0x19');var _0x45386f=_0x437b2a['count'];var _0x2a0ab9=_0x402e7c?0x0:_0x2f84cd[_0xfc45('0x18')];var _0x539e62=_0x402e7c?_0x437b2a[_0xfc45('0x1b')]:_0x2f84cd[_0xfc45('0x18')]+_0x2f84cd[_0xfc45('0x1a')];var _0x123e8b;if(_0x539e62>=_0x45386f){_0x539e62=_0x45386f;_0x123e8b=0xc8;}else{_0x123e8b=0xce;}_0xaf867a['status'](_0x123e8b);return _0xaf867a[_0xfc45('0x1c')](_0xfc45('0x1d'),_0x2a0ab9+'-'+_0x539e62+'/'+_0x45386f)[_0xfc45('0x1e')](_0x437b2a);}return null;};}function patchUpdates(_0x2c168d){return function(_0x4cd4d8){try{jsonpatch[_0xfc45('0x1f')](_0x4cd4d8,_0x2c168d,!![]);}catch(_0x2e1695){return BPromise['reject'](_0x2e1695);}return _0x4cd4d8[_0xfc45('0x20')]();};}function saveUpdates(_0x535373,_0x1def14){return function(_0x117534){if(_0x117534){return _0x117534[_0xfc45('0x21')](_0x535373)[_0xfc45('0x22')](function(_0x1d9cc3){return _0x1d9cc3;});}return null;};}function removeEntity(_0x123465,_0x53df41){return function(_0x5ce183){if(_0x5ce183){return _0x5ce183[_0xfc45('0x23')]()[_0xfc45('0x22')](function(){var _0x20e2e6=_0x5ce183[_0xfc45('0x24')]({'plain':!![]});var _0x2d8dcf=_0xfc45('0x25');return db[_0xfc45('0x26')][_0xfc45('0x23')]({'where':{'type':_0x2d8dcf,'resourceId':_0x20e2e6['id']}})[_0xfc45('0x22')](function(){return _0x5ce183;});})['then'](function(){_0x123465[_0xfc45('0x16')](0xcc)[_0xfc45('0x17')]();});}};}function handleEntityNotFound(_0x8c8a1e,_0x4a2edb){return function(_0x4a19e9){if(!_0x4a19e9){_0x8c8a1e[_0xfc45('0x15')](0x194);}return _0x4a19e9;};}function handleError(_0x41d1c0,_0x385e29){_0x385e29=_0x385e29||0x1f4;return function(_0x528368){logger['error'](_0x528368[_0xfc45('0x27')]);if(_0x528368[_0xfc45('0x28')]){delete _0x528368['name'];}_0x41d1c0[_0xfc45('0x16')](_0x385e29)[_0xfc45('0x29')](_0x528368);};}exports['index']=function(_0x43e232,_0x398049){var _0x21263d={},_0x406286={},_0xc6fe61={'count':0x0,'rows':[]};var _0x544c55=_[_0xfc45('0x2a')](db[_0xfc45('0x2b')][_0xfc45('0x2c')],function(_0x5d42bf){return{'name':_0x5d42bf[_0xfc45('0x2d')],'type':_0x5d42bf[_0xfc45('0x2e')][_0xfc45('0x2f')]};});_0x406286[_0xfc45('0x30')]=_[_0xfc45('0x2a')](_0x544c55,_0xfc45('0x28'));_0x406286[_0xfc45('0x31')]=_[_0xfc45('0x32')](_0x43e232[_0xfc45('0x31')]);_0x406286[_0xfc45('0x33')]=_['intersection'](_0x406286[_0xfc45('0x30')],_0x406286[_0xfc45('0x31')]);_0x21263d[_0xfc45('0x34')]=_[_0xfc45('0x35')](_0x406286[_0xfc45('0x30')],qs['fields'](_0x43e232[_0xfc45('0x31')][_0xfc45('0x36')]));_0x21263d['attributes']=_0x21263d[_0xfc45('0x34')][_0xfc45('0x37')]?_0x21263d[_0xfc45('0x34')]:_0x406286[_0xfc45('0x30')];if(!_0x43e232[_0xfc45('0x31')][_0xfc45('0x38')](_0xfc45('0x39'))){_0x21263d['limit']=qs[_0xfc45('0x1a')](_0x43e232[_0xfc45('0x31')]['limit']);_0x21263d[_0xfc45('0x18')]=qs[_0xfc45('0x18')](_0x43e232[_0xfc45('0x31')]['offset']);}_0x21263d[_0xfc45('0x3a')]=qs[_0xfc45('0x3b')](_0x43e232[_0xfc45('0x31')]['sort']);_0x21263d[_0xfc45('0x3c')]=qs[_0xfc45('0x33')](_['pick'](_0x43e232['query'],_0x406286['filters']),_0x544c55);if(_0x43e232['query'][_0xfc45('0x3d')]){_0x21263d[_0xfc45('0x3c')]=_[_0xfc45('0x3e')](_0x21263d[_0xfc45('0x3c')],{'$or':_[_0xfc45('0x2a')](_0x544c55,function(_0x2edf37){if(_0x2edf37[_0xfc45('0x2e')]!=='VIRTUAL'){var _0x23e7f9={};_0x23e7f9[_0x2edf37[_0xfc45('0x28')]]={'$like':'%'+_0x43e232[_0xfc45('0x31')]['filter']+'%'};return _0x23e7f9;}})});}_0x21263d=_[_0xfc45('0x3e')]({},_0x21263d,_0x43e232['options']);var _0x404bab={'where':_0x21263d[_0xfc45('0x3c')]};return db[_0xfc45('0x2b')][_0xfc45('0x1b')](_0x404bab)[_0xfc45('0x22')](function(_0x59e938){_0xc6fe61[_0xfc45('0x1b')]=_0x59e938;if(_0x43e232[_0xfc45('0x31')][_0xfc45('0x3f')]){_0x21263d[_0xfc45('0x40')]=[{'all':!![]}];}return db[_0xfc45('0x2b')][_0xfc45('0x41')](_0x21263d);})['then'](function(_0x4bbd05){_0xc6fe61['rows']=_0x4bbd05;return _0xc6fe61;})['then'](respondWithFilteredResult(_0x398049,_0x21263d))[_0xfc45('0x42')](handleError(_0x398049,null));};exports[_0xfc45('0x43')]=function(_0x31b630,_0x22f6d9){var _0x265a5b={'raw':!![],'where':{'id':_0x31b630[_0xfc45('0x44')]['id']}},_0xd9aaf7={};_0xd9aaf7[_0xfc45('0x30')]=_[_0xfc45('0x32')](db[_0xfc45('0x2b')]['rawAttributes']);_0xd9aaf7['query']=_[_0xfc45('0x32')](_0x31b630['query']);_0xd9aaf7[_0xfc45('0x33')]=_['intersection'](_0xd9aaf7[_0xfc45('0x30')],_0xd9aaf7['query']);_0x265a5b[_0xfc45('0x34')]=_[_0xfc45('0x35')](_0xd9aaf7[_0xfc45('0x30')],qs[_0xfc45('0x36')](_0x31b630[_0xfc45('0x31')][_0xfc45('0x36')]));_0x265a5b['attributes']=_0x265a5b[_0xfc45('0x34')][_0xfc45('0x37')]?_0x265a5b[_0xfc45('0x34')]:_0xd9aaf7[_0xfc45('0x30')];if(_0x31b630[_0xfc45('0x31')][_0xfc45('0x3f')]){_0x265a5b[_0xfc45('0x40')]=[{'all':!![]}];}_0x265a5b=_[_0xfc45('0x3e')]({},_0x265a5b,_0x31b630['options']);return db[_0xfc45('0x2b')]['find'](_0x265a5b)[_0xfc45('0x22')](handleEntityNotFound(_0x22f6d9,null))[_0xfc45('0x22')](respondWithResult(_0x22f6d9,null))[_0xfc45('0x42')](handleError(_0x22f6d9,null));};exports[_0xfc45('0x45')]=function(_0x58c8ce,_0x105582){return db[_0xfc45('0x2b')][_0xfc45('0x45')](_0x58c8ce[_0xfc45('0x46')],{})[_0xfc45('0x22')](function(_0x22d3b4){var _0x24e445=_0x58c8ce[_0xfc45('0x47')][_0xfc45('0x24')]({'plain':!![]});if(!_0x24e445)throw new Error(_0xfc45('0x48'));if(_0x24e445[_0xfc45('0x49')]===_0xfc45('0x47')){var _0x5ef9a3=_0x22d3b4[_0xfc45('0x24')]({'plain':!![]});var _0x5a3f9e='ODBC';return db[_0xfc45('0x4a')][_0xfc45('0x4b')]({'where':{'name':_0x5a3f9e,'userProfileId':_0x24e445[_0xfc45('0x4c')]},'raw':!![]})[_0xfc45('0x22')](function(_0x584afe){if(_0x584afe&&_0x584afe[_0xfc45('0x4d')]===0x0){return db[_0xfc45('0x26')][_0xfc45('0x45')]({'name':_0x5ef9a3[_0xfc45('0x28')],'resourceId':_0x5ef9a3['id'],'type':_0x584afe[_0xfc45('0x28')],'sectionId':_0x584afe['id']},{})[_0xfc45('0x22')](function(){return _0x22d3b4;});}else{return _0x22d3b4;}})[_0xfc45('0x42')](function(_0x354786){logger['error'](_0xfc45('0x4e'),_0x354786);throw _0x354786;});}return _0x22d3b4;})['then'](respondWithResult(_0x105582,0xc9))[_0xfc45('0x42')](handleError(_0x105582,null));};exports[_0xfc45('0x21')]=function(_0x351075,_0xd323e3){if(_0x351075[_0xfc45('0x46')]['id']){delete _0x351075[_0xfc45('0x46')]['id'];}return db[_0xfc45('0x2b')]['find']({'where':{'id':_0x351075[_0xfc45('0x44')]['id']}})['then'](handleEntityNotFound(_0xd323e3,null))[_0xfc45('0x22')](saveUpdates(_0x351075['body'],null))[_0xfc45('0x22')](respondWithResult(_0xd323e3,null))[_0xfc45('0x42')](handleError(_0xd323e3,null));};exports[_0xfc45('0x23')]=function(_0x33dec3,_0x2b7b32){return db[_0xfc45('0x2b')][_0xfc45('0x4b')]({'where':{'id':_0x33dec3[_0xfc45('0x44')]['id']}})[_0xfc45('0x22')](handleEntityNotFound(_0x2b7b32,null))[_0xfc45('0x22')](removeEntity(_0x2b7b32,null))['catch'](handleError(_0x2b7b32,null));};exports[_0xfc45('0x4f')]=function(_0x32dd6e,_0x42416b,_0x2b4f16){var _0x3daa9b;return db[_0xfc45('0x2b')][_0xfc45('0x4b')]({'where':{'id':_0x32dd6e[_0xfc45('0x44')]['id']},'attributes':['id',_0xfc45('0x50')]})[_0xfc45('0x22')](handleEntityNotFound(_0x42416b,null))['then'](function(_0x3edcf7){if(_0x3edcf7){var _0x48059d=require(_0xfc45('0x51'))();_0x48059d[_0xfc45('0x52')](_0x3edcf7[_0xfc45('0x50')]);_0x48059d[_0xfc45('0x53')]();return _0x3edcf7;}})[_0xfc45('0x22')](respondWithResult(_0x42416b,null))[_0xfc45('0x42')](handleError(_0x42416b,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index dec9624..b986662 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 _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 +var _0xf1f3=['exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./squareOdbc.attributes'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xf1f3,0xee));var _0x3f1f=function(_0x3a2100,_0x3bd58b){_0x3a2100=_0x3a2100-0x0;var _0x15424d=_0xf1f3[_0x3a2100];return _0x15424d;};'use strict';var _=require(_0x3f1f('0x0'));var util=require(_0x3f1f('0x1'));var logger=require(_0x3f1f('0x2'))(_0x3f1f('0x3'));var moment=require(_0x3f1f('0x4'));var BPromise=require(_0x3f1f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f1f('0x6'));var rimraf=require(_0x3f1f('0x7'));var config=require('../../config/environment');var attributes=require(_0x3f1f('0x8'));module[_0x3f1f('0x9')]=function(_0xeb6df,_0x3c5f0f){return _0xeb6df[_0x3f1f('0xa')](_0x3f1f('0xb'),attributes,{'tableName':_0x3f1f('0xc'),'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 6eb1adb..3d447d6 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 _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 +var _0xf505=['message','catch','SquareOdbc','find','options','raw','where','map','model','attributes','include','stringify','ShowSquareOdbc','util','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x2be97c,_0x59eb7a){var _0xe8b143=function(_0x5097a2){while(--_0x5097a2){_0x2be97c['push'](_0x2be97c['shift']());}};_0xe8b143(++_0x59eb7a);}(_0xf505,0x1dd));var _0x5f50=function(_0x22cb5f,_0x2cdd63){_0x22cb5f=_0x22cb5f-0x0;var _0x274d36=_0xf505[_0x22cb5f];return _0x274d36;};'use strict';var _=require('lodash');var util=require(_0x5f50('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5f50('0x1'))['db'];var utils=require(_0x5f50('0x2'));var logger=require(_0x5f50('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5f50('0x4'));var client=jayson[_0x5f50('0x5')][_0x5f50('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5734c9,_0x960b4a,_0x48e3bf){return new BPromise(function(_0xbbbc45,_0x1aef71){return client[_0x5f50('0x7')](_0x5734c9,_0x48e3bf)[_0x5f50('0x8')](function(_0x7d94b5){logger[_0x5f50('0x9')](_0x5f50('0xa'),_0x960b4a,'request\x20sent');logger[_0x5f50('0xb')](_0x5f50('0xc'),_0x960b4a,_0x5f50('0xd'),JSON['stringify'](_0x7d94b5));if(_0x7d94b5[_0x5f50('0xe')]){if(_0x7d94b5[_0x5f50('0xe')][_0x5f50('0xf')]===0x1f4){logger['error'](_0x5f50('0xa'),_0x960b4a,_0x7d94b5['error']['message']);return _0x1aef71(_0x7d94b5[_0x5f50('0xe')][_0x5f50('0x10')]);}logger['error'](_0x5f50('0xa'),_0x960b4a,_0x7d94b5[_0x5f50('0xe')][_0x5f50('0x10')]);return _0xbbbc45(_0x7d94b5['error'][_0x5f50('0x10')]);}else{logger[_0x5f50('0x9')](_0x5f50('0xa'),_0x960b4a,_0x5f50('0xd'));_0xbbbc45(_0x7d94b5['result'][_0x5f50('0x10')]);}})[_0x5f50('0x11')](function(_0x11bbeb){logger[_0x5f50('0xe')](_0x5f50('0xa'),_0x960b4a,_0x11bbeb);_0x1aef71(_0x11bbeb);});});}exports['ShowSquareOdbc']=function(_0x554a95){var _0x1eda90=this;return new Promise(function(_0x594a8f,_0x92f4e2){return db[_0x5f50('0x12')][_0x5f50('0x13')]({'raw':_0x554a95[_0x5f50('0x14')]?_0x554a95[_0x5f50('0x14')][_0x5f50('0x15')]===undefined?!![]:![]:!![],'where':_0x554a95['options']?_0x554a95[_0x5f50('0x14')][_0x5f50('0x16')]||null:null,'attributes':_0x554a95[_0x5f50('0x14')]?_0x554a95[_0x5f50('0x14')]['attributes']||null:null,'include':_0x554a95[_0x5f50('0x14')]?_0x554a95[_0x5f50('0x14')]['include']?_[_0x5f50('0x17')](_0x554a95['options']['include'],function(_0x30cd9a){return{'model':db[_0x30cd9a[_0x5f50('0x18')]],'as':_0x30cd9a['as'],'attributes':_0x30cd9a[_0x5f50('0x19')],'include':_0x30cd9a['include']?_['map'](_0x30cd9a['include'],function(_0x2d5076){return{'model':db[_0x2d5076['model']],'as':_0x2d5076['as'],'attributes':_0x2d5076[_0x5f50('0x19')],'include':_0x2d5076['include']?_['map'](_0x2d5076[_0x5f50('0x1a')],function(_0x4ba667){return{'model':db[_0x4ba667[_0x5f50('0x18')]],'as':_0x4ba667['as'],'attributes':_0x4ba667['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x868c2a){logger['info']('ShowSquareOdbc',_0x554a95);logger[_0x5f50('0xb')]('ShowSquareOdbc',_0x554a95,JSON[_0x5f50('0x1b')](_0x868c2a));_0x594a8f(_0x868c2a);})['catch'](function(_0x571c6e){logger[_0x5f50('0xe')](_0x5f50('0x1c'),_0x571c6e[_0x5f50('0x10')],_0x554a95);_0x92f4e2(_0x1eda90[_0x5f50('0xe')](0x1f4,_0x571c6e['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 31be33c..ba2665e 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 _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 +var _0x9e59=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','/:id','post','create','put','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x3ed8a2,_0x41eba8){var _0x242031=function(_0x5a4ac9){while(--_0x5a4ac9){_0x3ed8a2['push'](_0x3ed8a2['shift']());}};_0x242031(++_0x41eba8);}(_0x9e59,0xa8));var _0x99e5=function(_0x1a76d0,_0x3ffdca){_0x1a76d0=_0x1a76d0-0x0;var _0x51a54f=_0x9e59[_0x1a76d0];return _0x51a54f;};'use strict';var multer=require(_0x99e5('0x0'));var util=require(_0x99e5('0x1'));var path=require('path');var timeout=require(_0x99e5('0x2'));var express=require(_0x99e5('0x3'));var router=express[_0x99e5('0x4')]();var fs_extra=require(_0x99e5('0x5'));var auth=require(_0x99e5('0x6'));var interaction=require(_0x99e5('0x7'));var config=require(_0x99e5('0x8'));var controller=require(_0x99e5('0x9'));router[_0x99e5('0xa')]('/',auth[_0x99e5('0xb')](),controller['index']);router[_0x99e5('0xa')](_0x99e5('0xc'),auth[_0x99e5('0xb')](),controller['show']);router[_0x99e5('0xd')]('/',auth['isAuthenticated'](),controller[_0x99e5('0xe')]);router[_0x99e5('0xf')]('/:id',auth[_0x99e5('0xb')](),controller['update']);router[_0x99e5('0x10')](_0x99e5('0xc'),auth[_0x99e5('0xb')](),controller[_0x99e5('0x11')]);module[_0x99e5('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 7c8bb6d..bc269e9 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 _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 +var _0xd566=['TEXT','long','getDataValue','preproduction','utf8','BLOB','production','toString','DATE','sequelize','exports','STRING','name'];(function(_0x511ff6,_0x426c0b){var _0x2ce7af=function(_0x52e7a5){while(--_0x52e7a5){_0x511ff6['push'](_0x511ff6['shift']());}};_0x2ce7af(++_0x426c0b);}(_0xd566,0x100));var _0x6d56=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd566[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x6d56('0x0'));module[_0x6d56('0x1')]={'name':{'type':Sequelize[_0x6d56('0x2')],'unique':_0x6d56('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x6d56('0x2')]},'notes':{'type':Sequelize[_0x6d56('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0x6d56('0x5')),'get':function(){if(this[_0x6d56('0x6')](_0x6d56('0x7'))){return this[_0x6d56('0x6')]('preproduction')['toString'](_0x6d56('0x8'));}}},'production':{'type':Sequelize[_0x6d56('0x9')]('long'),'get':function(){if(this[_0x6d56('0x6')](_0x6d56('0xa'))){return this[_0x6d56('0x6')](_0x6d56('0xa'))[_0x6d56('0xb')](_0x6d56('0x8'));}}},'savedAt':{'type':Sequelize[_0x6d56('0xc')]},'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 0c8ff2f..2c2d053 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 _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 +var _0x3359=['set','json','update','then','destroy','get','SquareProjects','UserProfileResource','publish','agi','stringify','end','sendStatus','error','name','send','map','SquareProject','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./squareProject.socket','register','status','undefined','limit','count','offset'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x3359,0x150));var _0x9335=function(_0x5c846d,_0x5c02ce){_0x5c846d=_0x5c846d-0x0;var _0xd064e4=_0x3359[_0x5c846d];return _0xd064e4;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0x9335('0x0'));var logger=require(_0x9335('0x1'))(_0x9335('0x2'));var config=require(_0x9335('0x3'));var db=require(_0x9335('0x4'))['db'];config['redis']=_[_0x9335('0x5')](config[_0x9335('0x6')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9335('0x6')]));require(_0x9335('0x7'))[_0x9335('0x8')](socket);function respondWithResult(_0x5e45ce,_0x463263){_0x463263=_0x463263||0xc8;return function(_0x3c99de){if(_0x3c99de){return _0x5e45ce[_0x9335('0x9')](_0x463263)['json'](_0x3c99de);}};}function respondWithFilteredResult(_0x4bbbaf,_0x2b3911){return function(_0x2f34f2){if(_0x2f34f2){var _0x1bbacc=typeof _0x2b3911['offset']===_0x9335('0xa')&&typeof _0x2b3911[_0x9335('0xb')]===_0x9335('0xa');var _0x3f233f=_0x2f34f2[_0x9335('0xc')];var _0x38c2cd=_0x1bbacc?0x0:_0x2b3911[_0x9335('0xd')];var _0x49468f=_0x1bbacc?_0x2f34f2[_0x9335('0xc')]:_0x2b3911['offset']+_0x2b3911[_0x9335('0xb')];var _0x4c828c;if(_0x49468f>=_0x3f233f){_0x49468f=_0x3f233f;_0x4c828c=0xc8;}else{_0x4c828c=0xce;}_0x4bbbaf[_0x9335('0x9')](_0x4c828c);return _0x4bbbaf[_0x9335('0xe')]('Content-Range',_0x38c2cd+'-'+_0x49468f+'/'+_0x3f233f)[_0x9335('0xf')](_0x2f34f2);}return null;};}function saveUpdates(_0x3c3b67){return function(_0x5222b2){if(_0x5222b2){return _0x5222b2[_0x9335('0x10')](_0x3c3b67)[_0x9335('0x11')](function(_0x459c46){return _0x459c46;});}return null;};}function removeEntity(_0x376e31){return function(_0xb5e56d){if(_0xb5e56d){return _0xb5e56d[_0x9335('0x12')]()[_0x9335('0x11')](function(){var _0x1ea502=_0xb5e56d[_0x9335('0x13')]({'plain':!![]});var _0x1f7bca=_0x9335('0x14');return db[_0x9335('0x15')][_0x9335('0x12')]({'where':{'type':_0x1f7bca,'resourceId':_0x1ea502['id']}})['then'](function(){return _0xb5e56d;});})[_0x9335('0x11')](function(){var _0x373f7c=new Redis(config[_0x9335('0x6')]);_0x373f7c[_0x9335('0x16')](_0x9335('0x17'),JSON[_0x9335('0x18')]({'id':_0xb5e56d['id'],'deleted':!![]}));})[_0x9335('0x11')](function(){_0x376e31[_0x9335('0x9')](0xcc)[_0x9335('0x19')]();});}};}function handleEntityNotFound(_0xe34bc2){return function(_0x190e22){if(!_0x190e22){_0xe34bc2[_0x9335('0x1a')](0x194);}return _0x190e22;};}function handleError(_0x4a875f,_0x2499ea){_0x2499ea=_0x2499ea||0x1f4;return function(_0x1e914b){logger[_0x9335('0x1b')](_0x1e914b['stack']);if(_0x1e914b[_0x9335('0x1c')]){delete _0x1e914b[_0x9335('0x1c')];}_0x4a875f[_0x9335('0x9')](_0x2499ea)[_0x9335('0x1d')](_0x1e914b);};}exports['index']=function(_0x5df468,_0x35c7e6){var _0x1d4927={},_0x76d8cc={},_0x57f3e2={'count':0x0,'rows':[]};var _0x52febb=_[_0x9335('0x1e')](db[_0x9335('0x1f')][_0x9335('0x20')],function(_0x5ec7b9){return{'name':_0x5ec7b9[_0x9335('0x21')],'type':_0x5ec7b9['type'][_0x9335('0x22')]};});_0x76d8cc['model']=_[_0x9335('0x1e')](_0x52febb,_0x9335('0x1c'));_0x76d8cc['query']=_['keys'](_0x5df468[_0x9335('0x23')]);_0x76d8cc[_0x9335('0x24')]=_[_0x9335('0x25')](_0x76d8cc[_0x9335('0x26')],_0x76d8cc['query']);_0x1d4927[_0x9335('0x27')]=_[_0x9335('0x25')](_0x76d8cc['model'],qs[_0x9335('0x28')](_0x5df468[_0x9335('0x23')][_0x9335('0x28')]));_0x1d4927[_0x9335('0x27')]=_0x1d4927[_0x9335('0x27')][_0x9335('0x29')]?_0x1d4927[_0x9335('0x27')]:_0x76d8cc[_0x9335('0x26')];if(!_0x5df468[_0x9335('0x23')]['hasOwnProperty'](_0x9335('0x2a'))){_0x1d4927['limit']=qs[_0x9335('0xb')](_0x5df468['query']['limit']);_0x1d4927[_0x9335('0xd')]=qs[_0x9335('0xd')](_0x5df468[_0x9335('0x23')]['offset']);}_0x1d4927[_0x9335('0x2b')]=qs[_0x9335('0x2c')](_0x5df468['query']['sort']);_0x1d4927[_0x9335('0x2d')]=qs[_0x9335('0x24')](_[_0x9335('0x2e')](_0x5df468['query'],_0x76d8cc[_0x9335('0x24')]),_0x52febb);if(_0x5df468[_0x9335('0x23')][_0x9335('0x2f')]){_0x1d4927['where']=_[_0x9335('0x30')](_0x1d4927[_0x9335('0x2d')],{'$or':_[_0x9335('0x1e')](_0x52febb,function(_0x5bb457){if(_0x5bb457[_0x9335('0x31')]!==_0x9335('0x32')){var _0x301cdf={};_0x301cdf[_0x5bb457['name']]={'$like':'%'+_0x5df468[_0x9335('0x23')][_0x9335('0x2f')]+'%'};return _0x301cdf;}})});}_0x1d4927=_['merge']({},_0x1d4927,_0x5df468['options']);var _0x15b12a={'where':_0x1d4927[_0x9335('0x2d')]};return db[_0x9335('0x1f')][_0x9335('0xc')](_0x15b12a)[_0x9335('0x11')](function(_0x32b210){_0x57f3e2[_0x9335('0xc')]=_0x32b210;if(_0x5df468[_0x9335('0x23')][_0x9335('0x33')]){_0x1d4927[_0x9335('0x34')]=[{'all':!![]}];}return db[_0x9335('0x1f')][_0x9335('0x35')](_0x1d4927);})[_0x9335('0x11')](function(_0x4f2f18){_0x57f3e2[_0x9335('0x36')]=_0x4f2f18;return _0x57f3e2;})[_0x9335('0x11')](respondWithFilteredResult(_0x35c7e6,_0x1d4927))[_0x9335('0x37')](handleError(_0x35c7e6,null));};exports[_0x9335('0x38')]=function(_0x28880f,_0x1c466d){var _0xea68c9={'raw':![],'where':{'id':_0x28880f[_0x9335('0x39')]['id']}},_0x4af319={};_0x4af319[_0x9335('0x26')]=_[_0x9335('0x3a')](db[_0x9335('0x1f')]['rawAttributes']);_0x4af319[_0x9335('0x23')]=_['keys'](_0x28880f[_0x9335('0x23')]);_0x4af319[_0x9335('0x24')]=_[_0x9335('0x25')](_0x4af319['model'],_0x4af319['query']);_0xea68c9[_0x9335('0x27')]=_[_0x9335('0x25')](_0x4af319[_0x9335('0x26')],qs['fields'](_0x28880f[_0x9335('0x23')][_0x9335('0x28')]));_0xea68c9[_0x9335('0x27')]=_0xea68c9[_0x9335('0x27')][_0x9335('0x29')]?_0xea68c9[_0x9335('0x27')]:_0x4af319['model'];if(_0x28880f['query'][_0x9335('0x33')]){_0xea68c9[_0x9335('0x34')]=[{'all':!![]}];}_0xea68c9=_[_0x9335('0x30')]({},_0xea68c9,_0x28880f[_0x9335('0x3b')]);return db['SquareProject'][_0x9335('0x3c')](_0xea68c9)[_0x9335('0x11')](handleEntityNotFound(_0x1c466d,null))[_0x9335('0x11')](respondWithResult(_0x1c466d,null))['catch'](handleError(_0x1c466d,null));};exports[_0x9335('0x3d')]=function(_0x27cf30,_0x422a48){return db[_0x9335('0x1f')][_0x9335('0x3d')](_0x27cf30[_0x9335('0x3e')],{})[_0x9335('0x11')](function(_0x2f3454){var _0x577490=_0x27cf30['user'][_0x9335('0x13')]({'plain':!![]});if(!_0x577490)throw new Error(_0x9335('0x3f'));if(_0x577490[_0x9335('0x40')]===_0x9335('0x41')){var _0x4835f5=_0x2f3454[_0x9335('0x13')]({'plain':!![]});var _0x18a80f=_0x9335('0x14');return db[_0x9335('0x42')][_0x9335('0x3c')]({'where':{'name':_0x18a80f,'userProfileId':_0x577490[_0x9335('0x43')]},'raw':!![]})[_0x9335('0x11')](function(_0x5508f8){if(_0x5508f8&&_0x5508f8[_0x9335('0x44')]===0x0){return db['UserProfileResource']['create']({'name':_0x4835f5['name'],'resourceId':_0x4835f5['id'],'type':_0x5508f8[_0x9335('0x1c')],'sectionId':_0x5508f8['id']},{})[_0x9335('0x11')](function(){return _0x2f3454;});}else{return _0x2f3454;}})[_0x9335('0x37')](function(_0x4e1323){logger[_0x9335('0x1b')](_0x9335('0x45'),_0x4e1323);throw _0x4e1323;});}return _0x2f3454;})[_0x9335('0x11')](respondWithResult(_0x422a48,0xc9))['catch'](handleError(_0x422a48,null));};exports[_0x9335('0x10')]=function(_0x3cbd93,_0x4288ef){if(_0x3cbd93['body']['id']){delete _0x3cbd93['body']['id'];}return db['SquareProject'][_0x9335('0x3c')]({'where':{'id':_0x3cbd93[_0x9335('0x39')]['id']}})['then'](handleEntityNotFound(_0x4288ef,null))[_0x9335('0x11')](saveUpdates(_0x3cbd93[_0x9335('0x3e')],null))[_0x9335('0x11')](function(_0x15fc7a){if(!_0x15fc7a)return;var _0x148b2c=_0x15fc7a[_0x9335('0x13')]({'plain':!![]});return _0x148b2c;})['then'](function(_0x16e24f){var _0x1c7ed8=new Redis(config[_0x9335('0x6')]);_0x1c7ed8[_0x9335('0x16')](_0x9335('0x17'),JSON[_0x9335('0x18')](_['pick'](_0x16e24f,['id',_0x9335('0x1c'),'production'])));return _0x16e24f;})[_0x9335('0x11')](respondWithResult(_0x4288ef,null))['catch'](handleError(_0x4288ef,null));};exports['destroy']=function(_0x546b97,_0x3621f5){return db[_0x9335('0x1f')][_0x9335('0x3c')]({'where':{'id':_0x546b97[_0x9335('0x39')]['id']}})[_0x9335('0x11')](handleEntityNotFound(_0x3621f5,null))['then'](removeEntity(_0x3621f5,null))['catch'](handleError(_0x3621f5,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index aab6f63..b6af373 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 _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 +var _0xb320=['update','remove','hasOwnProperty','hook','exports','../../mysqldb','SquareProject','setMaxListeners'];(function(_0x997e5a,_0x1bf92d){var _0x3fa9fc=function(_0x30e4db){while(--_0x30e4db){_0x997e5a['push'](_0x997e5a['shift']());}};_0x3fa9fc(++_0x1bf92d);}(_0xb320,0xfd));var _0x0b32=function(_0x58fc2f,_0x111399){_0x58fc2f=_0x58fc2f-0x0;var _0x3a1312=_0xb320[_0x58fc2f];return _0x3a1312;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x0b32('0x0'))['db'][_0x0b32('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x0b32('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0b32('0x3'),'afterDestroy':_0x0b32('0x4')};function emitEvent(_0x1a748c){return function(_0xd129fb,_0x2345b0,_0x3b804f){SquareProjectEvents['emit'](_0x1a748c+':'+_0xd129fb['id'],_0xd129fb);SquareProjectEvents['emit'](_0x1a748c,_0xd129fb);_0x3b804f(null);};}for(var e in events){if(events[_0x0b32('0x5')](e)){var event=events[e];SquareProject[_0x0b32('0x6')](e,emitEvent(event));}}module[_0x0b32('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index ac7f4ba..a054b33 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 _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 +var _0x18a1=['changed','savedAt','format','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareProject.attributes','exports','define','SquareProject'];(function(_0x36d7d2,_0x5377ec){var _0x515f63=function(_0x314461){while(--_0x314461){_0x36d7d2['push'](_0x36d7d2['shift']());}};_0x515f63(++_0x5377ec);}(_0x18a1,0xde));var _0x118a=function(_0x14a0ff,_0x4947f5){_0x14a0ff=_0x14a0ff-0x0;var _0x2793f9=_0x18a1[_0x14a0ff];return _0x2793f9;};'use strict';var _=require(_0x118a('0x0'));var util=require('util');var logger=require(_0x118a('0x1'))(_0x118a('0x2'));var moment=require(_0x118a('0x3'));var BPromise=require(_0x118a('0x4'));var rp=require(_0x118a('0x5'));var fs=require('fs');var path=require(_0x118a('0x6'));var rimraf=require('rimraf');var config=require(_0x118a('0x7'));var attributes=require(_0x118a('0x8'));module[_0x118a('0x9')]=function(_0x1a5c50,_0x447d2c){return _0x1a5c50[_0x118a('0xa')](_0x118a('0xb'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5ff678,_0x61de07,_0x44fe45){if(_0x5ff678[_0x118a('0xc')]('preproduction')){_0x5ff678[_0x118a('0xd')]=moment()[_0x118a('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x5ff678[_0x118a('0xc')](_0x118a('0xf'))){_0x5ff678[_0x118a('0x10')]=moment()['format'](_0x118a('0x11'));}_0x44fe45(null,_0x5ff678);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index f53cad5..788e24e 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 _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 +var _0x8a4e=['stringify','catch','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','SquareProject','options','raw','where','attributes','limit','include','map','model','then','info','GetSquareProjects','error','message','ShowSquareProject','debug'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x8a4e,0xcd));var _0xe8a4=function(_0x54b648,_0x5648f0){_0x54b648=_0x54b648-0x0;var _0x4f7c5b=_0x8a4e[_0x54b648];return _0x4f7c5b;};'use strict';var _=require(_0xe8a4('0x0'));var Redis=require(_0xe8a4('0x1'));var db=require(_0xe8a4('0x2'))['db'];var logger=require(_0xe8a4('0x3'))(_0xe8a4('0x4'));var config=require(_0xe8a4('0x5'));config[_0xe8a4('0x6')]=_[_0xe8a4('0x7')](config[_0xe8a4('0x6')],{'host':_0xe8a4('0x8'),'port':0x18eb});var socket=require(_0xe8a4('0x9'))(new Redis(config['redis']));require(_0xe8a4('0xa'))['register'](socket);exports['GetSquareProjects']=function(_0x47dec0){var _0x43e05a=this;return new Promise(function(_0x1294e9,_0x3a319a){return db[_0xe8a4('0xb')]['findAll']({'raw':_0x47dec0[_0xe8a4('0xc')]?_0x47dec0['options'][_0xe8a4('0xd')]===undefined?!![]:![]:!![],'where':_0x47dec0['options']?_0x47dec0[_0xe8a4('0xc')][_0xe8a4('0xe')]||null:null,'attributes':_0x47dec0['options']?_0x47dec0['options'][_0xe8a4('0xf')]||null:null,'limit':_0x47dec0[_0xe8a4('0xc')]?_0x47dec0[_0xe8a4('0xc')][_0xe8a4('0x10')]||null:null,'include':_0x47dec0[_0xe8a4('0xc')]?_0x47dec0[_0xe8a4('0xc')][_0xe8a4('0x11')]?_[_0xe8a4('0x12')](_0x47dec0[_0xe8a4('0xc')][_0xe8a4('0x11')],function(_0xf8abc1){return{'model':db[_0xf8abc1[_0xe8a4('0x13')]],'as':_0xf8abc1['as'],'attributes':_0xf8abc1['attributes'],'include':_0xf8abc1[_0xe8a4('0x11')]?_[_0xe8a4('0x12')](_0xf8abc1[_0xe8a4('0x11')],function(_0x137309){return{'model':db[_0x137309[_0xe8a4('0x13')]],'as':_0x137309['as'],'attributes':_0x137309['attributes'],'include':_0x137309['include']?_[_0xe8a4('0x12')](_0x137309[_0xe8a4('0x11')],function(_0x49b010){return{'model':db[_0x49b010[_0xe8a4('0x13')]],'as':_0x49b010['as'],'attributes':_0x49b010['attributes']};}):[]};}):[]};}):[]:[]})[_0xe8a4('0x14')](function(_0x21e03f){logger[_0xe8a4('0x15')](_0xe8a4('0x16'),_0x47dec0);logger['debug']('GetSquareProjects',_0x47dec0,JSON['stringify'](_0x21e03f));_0x1294e9(_0x21e03f);})['catch'](function(_0x1da214){logger[_0xe8a4('0x17')](_0xe8a4('0x16'),_0x1da214[_0xe8a4('0x18')],_0x47dec0);_0x3a319a(_0x43e05a[_0xe8a4('0x17')](0x1f4,_0x1da214[_0xe8a4('0x18')]));});});};exports[_0xe8a4('0x19')]=function(_0x5dae3c){var _0x5d9b93=this;return new Promise(function(_0x1a001d,_0x25ab38){return db[_0xe8a4('0xb')]['find']({'raw':_0x5dae3c[_0xe8a4('0xc')]?_0x5dae3c[_0xe8a4('0xc')][_0xe8a4('0xd')]===undefined?!![]:![]:!![],'where':_0x5dae3c['options']?_0x5dae3c[_0xe8a4('0xc')]['where']||null:null,'attributes':_0x5dae3c[_0xe8a4('0xc')]?_0x5dae3c[_0xe8a4('0xc')]['attributes']||null:null,'include':_0x5dae3c[_0xe8a4('0xc')]?_0x5dae3c[_0xe8a4('0xc')][_0xe8a4('0x11')]?_[_0xe8a4('0x12')](_0x5dae3c[_0xe8a4('0xc')][_0xe8a4('0x11')],function(_0x2177ec){return{'model':db[_0x2177ec['model']],'as':_0x2177ec['as'],'attributes':_0x2177ec[_0xe8a4('0xf')],'include':_0x2177ec[_0xe8a4('0x11')]?_['map'](_0x2177ec[_0xe8a4('0x11')],function(_0x49cf14){return{'model':db[_0x49cf14['model']],'as':_0x49cf14['as'],'attributes':_0x49cf14['attributes'],'include':_0x49cf14[_0xe8a4('0x11')]?_[_0xe8a4('0x12')](_0x49cf14[_0xe8a4('0x11')],function(_0x193247){return{'model':db[_0x193247['model']],'as':_0x193247['as'],'attributes':_0x193247[_0xe8a4('0xf')]};}):[]};}):[]};}):[]:[]})[_0xe8a4('0x14')](function(_0xb0f082){logger[_0xe8a4('0x15')]('ShowSquareProject',_0x5dae3c);logger[_0xe8a4('0x1a')](_0xe8a4('0x19'),_0x5dae3c,JSON[_0xe8a4('0x1b')](_0xb0f082));_0x1a001d(_0xb0f082);})[_0xe8a4('0x1c')](function(_0x3dc88a){logger[_0xe8a4('0x17')](_0xe8a4('0x19'),_0x3dc88a[_0xe8a4('0x18')],_0x5dae3c);_0x25ab38(_0x5d9b93[_0xe8a4('0x17')](0x1f4,_0x3dc88a[_0xe8a4('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 53b97ad..4b59968 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 _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 +var _0xbc44=['removeListener','length','squareProject:','save','remove','update','emit'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xbc44,0xf8));var _0x4bc4=function(_0x387323,_0x9ac7d2){_0x387323=_0x387323-0x0;var _0x45c458=_0xbc44[_0x387323];return _0x45c458;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x4bc4('0x0'),_0x4bc4('0x1'),_0x4bc4('0x2')];function createListener(_0xf577c9,_0x3a94bb){return function(_0x32ea24){_0x3a94bb[_0x4bc4('0x3')](_0xf577c9,_0x32ea24);};}function removeListener(_0x32f7ad,_0x222d9c){return function(){SquareProjectEvents[_0x4bc4('0x4')](_0x32f7ad,_0x222d9c);};}exports['register']=function(_0x12cb7e){for(var _0x44525e=0x0,_0x1615fc=events[_0x4bc4('0x5')];_0x44525e<_0x1615fc;_0x44525e++){var _0x507aff=events[_0x44525e];var _0x4a7b2d=createListener(_0x4bc4('0x6')+_0x507aff,_0x12cb7e);SquareProjectEvents['on'](_0x507aff,_0x4a7b2d);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index bd6ace5..f227554 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(_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 +var _0x5fc3=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','show','/:id/download','download','post','create','put','update','/:id','multer','util','connect-timeout'];(function(_0x22437a,_0x58a642){var _0x793077=function(_0x2fc095){while(--_0x2fc095){_0x22437a['push'](_0x22437a['shift']());}};_0x793077(++_0x58a642);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4c260a,_0x148241){_0x4c260a=_0x4c260a-0x0;var _0x17bbdd=_0x5fc3[_0x4c260a];return _0x17bbdd;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')]('/',auth['isAuthenticated'](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router['delete'](_0x35fc('0x12'),auth[_0x35fc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 19b0c96..8512b55 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 _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 +var _0xf494=['STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize','exports'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xf494,0x1c6));var _0x4f49=function(_0x592726,_0x4430eb){_0x592726=_0x592726-0x0;var _0x436a50=_0xf494[_0x592726];return _0x436a50;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'uniqueid':{'type':Sequelize[_0x4f49('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4f49('0x2')]},'context':{'type':Sequelize[_0x4f49('0x2')]},'extension':{'type':Sequelize[_0x4f49('0x2')]},'priority':{'type':Sequelize[_0x4f49('0x2')]},'accountcode':{'type':Sequelize[_0x4f49('0x2')]},'dnid':{'type':Sequelize[_0x4f49('0x2')]},'projectName':{'type':Sequelize[_0x4f49('0x2')]},'saveName':{'type':Sequelize[_0x4f49('0x2')]},'filename':{'type':Sequelize[_0x4f49('0x2')]},'savePath':{'type':Sequelize[_0x4f49('0x2')]},'format':{'type':Sequelize[_0x4f49('0x3')],'get':function(){var _0x5eb186='';var _0x58e9a0=this[_0x4f49('0x4')](_0x4f49('0x5'));if(_0x58e9a0){_0x5eb186=_0x58e9a0[_0x4f49('0x6')](_0x58e9a0[_0x4f49('0x7')]('.'));}return _0x5eb186;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index e813603..b053bbf 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 _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 +var _0x84e3=['name','index','map','SquareRecording','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','includeAll','include','findAll','rows','catch','show','options','create','body','find','params','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','extname','unlink','message','send','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','then','stack'];(function(_0x5973b8,_0xc5b4c2){var _0x1f2878=function(_0xab57dd){while(--_0xab57dd){_0x5973b8['push'](_0x5973b8['shift']());}};_0x1f2878(++_0xc5b4c2);}(_0x84e3,0xfb));var _0x384e=function(_0x4b2119,_0xaf829b){_0x4b2119=_0x4b2119-0x0;var _0x33d26e=_0x84e3[_0x4b2119];return _0x33d26e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x384e('0x0'));var jsonpatch=require(_0x384e('0x1'));var rp=require(_0x384e('0x2'));var moment=require(_0x384e('0x3'));var BPromise=require(_0x384e('0x4'));var Mustache=require(_0x384e('0x5'));var util=require(_0x384e('0x6'));var path=require(_0x384e('0x7'));var sox=require(_0x384e('0x8'));var csv=require('to-csv');var ejs=require(_0x384e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x384e('0xa'));var squel=require(_0x384e('0xb'));var crypto=require(_0x384e('0xc'));var jsforce=require(_0x384e('0xd'));var deskjs=require(_0x384e('0xe'));var toCsv=require(_0x384e('0xf'));var querystring=require(_0x384e('0x10'));var Papa=require(_0x384e('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x384e('0x12'));var as=require(_0x384e('0x13'));var hardwareService=require(_0x384e('0x14'));var logger=require(_0x384e('0x15'))('api');var utils=require(_0x384e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x384e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x209f0c,_0x3191c5){_0x3191c5=_0x3191c5||0xcc;return function(_0x42b3a5){if(_0x42b3a5){return _0x209f0c[_0x384e('0x18')](_0x3191c5);}return _0x209f0c['status'](_0x3191c5)[_0x384e('0x19')]();};}function respondWithResult(_0x58fce4,_0x16721e){_0x16721e=_0x16721e||0xc8;return function(_0x15e142){if(_0x15e142){return _0x58fce4[_0x384e('0x1a')](_0x16721e)[_0x384e('0x1b')](_0x15e142);}};}function respondWithFilteredResult(_0x19dca3,_0xbde9dd){return function(_0xf57e19){if(_0xf57e19){var _0xd9e6de=typeof _0xbde9dd['offset']===_0x384e('0x1c')&&typeof _0xbde9dd[_0x384e('0x1d')]===_0x384e('0x1c');var _0x1b79db=_0xf57e19[_0x384e('0x1e')];var _0x42b611=_0xd9e6de?0x0:_0xbde9dd[_0x384e('0x1f')];var _0x5d640f=_0xd9e6de?_0xf57e19['count']:_0xbde9dd[_0x384e('0x1f')]+_0xbde9dd[_0x384e('0x1d')];var _0x5c9a97;if(_0x5d640f>=_0x1b79db){_0x5d640f=_0x1b79db;_0x5c9a97=0xc8;}else{_0x5c9a97=0xce;}_0x19dca3[_0x384e('0x1a')](_0x5c9a97);return _0x19dca3[_0x384e('0x20')]('Content-Range',_0x42b611+'-'+_0x5d640f+'/'+_0x1b79db)[_0x384e('0x1b')](_0xf57e19);}return null;};}function patchUpdates(_0x19b5ac){return function(_0x57d8ba){try{jsonpatch[_0x384e('0x21')](_0x57d8ba,_0x19b5ac,!![]);}catch(_0x391c7f){return BPromise[_0x384e('0x22')](_0x391c7f);}return _0x57d8ba['save']();};}function saveUpdates(_0x2fc66f,_0x288aae){return function(_0xea3ec){if(_0xea3ec){return _0xea3ec['update'](_0x2fc66f)[_0x384e('0x23')](function(_0xb2c696){return _0xb2c696;});}return null;};}function removeEntity(_0x54fbe0,_0x3246d7){return function(_0x46e2fe){if(_0x46e2fe){return _0x46e2fe['destroy']()[_0x384e('0x23')](function(){_0x54fbe0[_0x384e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13f780,_0x39f3c7){return function(_0x3c7bf6){if(!_0x3c7bf6){_0x13f780[_0x384e('0x18')](0x194);}return _0x3c7bf6;};}function handleError(_0x5db6af,_0x1d6e56){_0x1d6e56=_0x1d6e56||0x1f4;return function(_0x659f63){logger['error'](_0x659f63[_0x384e('0x24')]);if(_0x659f63['name']){delete _0x659f63[_0x384e('0x25')];}_0x5db6af[_0x384e('0x1a')](_0x1d6e56)['send'](_0x659f63);};}exports[_0x384e('0x26')]=function(_0x4be291,_0x3a0475){var _0x4bf23a={},_0x116847={},_0x57292e={'count':0x0,'rows':[]};var _0x1c58e9=_[_0x384e('0x27')](db[_0x384e('0x28')][_0x384e('0x29')],function(_0x335f29){return{'name':_0x335f29[_0x384e('0x2a')],'type':_0x335f29['type']['key']};});_0x116847[_0x384e('0x2b')]=_[_0x384e('0x27')](_0x1c58e9,'name');_0x116847[_0x384e('0x2c')]=_[_0x384e('0x2d')](_0x4be291[_0x384e('0x2c')]);_0x116847[_0x384e('0x2e')]=_[_0x384e('0x2f')](_0x116847[_0x384e('0x2b')],_0x116847['query']);_0x4bf23a[_0x384e('0x30')]=_[_0x384e('0x2f')](_0x116847[_0x384e('0x2b')],qs[_0x384e('0x31')](_0x4be291[_0x384e('0x2c')][_0x384e('0x31')]));_0x4bf23a[_0x384e('0x30')]=_0x4bf23a[_0x384e('0x30')][_0x384e('0x32')]?_0x4bf23a[_0x384e('0x30')]:_0x116847[_0x384e('0x2b')];if(!_0x4be291['query'][_0x384e('0x33')](_0x384e('0x34'))){_0x4bf23a[_0x384e('0x1d')]=qs[_0x384e('0x1d')](_0x4be291[_0x384e('0x2c')][_0x384e('0x1d')]);_0x4bf23a[_0x384e('0x1f')]=qs[_0x384e('0x1f')](_0x4be291[_0x384e('0x2c')][_0x384e('0x1f')]);}_0x4bf23a[_0x384e('0x35')]=qs[_0x384e('0x36')](_0x4be291[_0x384e('0x2c')][_0x384e('0x36')]);_0x4bf23a[_0x384e('0x37')]=qs[_0x384e('0x2e')](_['pick'](_0x4be291[_0x384e('0x2c')],_0x116847['filters']),_0x1c58e9);if(_0x4be291[_0x384e('0x2c')][_0x384e('0x38')]){_0x4bf23a[_0x384e('0x37')]=_[_0x384e('0x39')](_0x4bf23a[_0x384e('0x37')],{'$or':_[_0x384e('0x27')](_0x1c58e9,function(_0xeebefd){if(_0xeebefd[_0x384e('0x3a')]!=='VIRTUAL'){var _0x5b3828={};_0x5b3828[_0xeebefd[_0x384e('0x25')]]={'$like':'%'+_0x4be291[_0x384e('0x2c')][_0x384e('0x38')]+'%'};return _0x5b3828;}})});}_0x4bf23a=_[_0x384e('0x39')]({},_0x4bf23a,_0x4be291['options']);var _0x56473d={'where':_0x4bf23a['where']};return db[_0x384e('0x28')][_0x384e('0x1e')](_0x56473d)[_0x384e('0x23')](function(_0x1f1ffd){_0x57292e[_0x384e('0x1e')]=_0x1f1ffd;if(_0x4be291[_0x384e('0x2c')][_0x384e('0x3b')]){_0x4bf23a[_0x384e('0x3c')]=[{'all':!![]}];}return db['SquareRecording'][_0x384e('0x3d')](_0x4bf23a);})['then'](function(_0x5aa9e0){_0x57292e[_0x384e('0x3e')]=_0x5aa9e0;return _0x57292e;})[_0x384e('0x23')](respondWithFilteredResult(_0x3a0475,_0x4bf23a))[_0x384e('0x3f')](handleError(_0x3a0475,null));};exports[_0x384e('0x40')]=function(_0x4d8cde,_0x51d110){var _0x51166c={'raw':!![],'where':{'id':_0x4d8cde['params']['id']}},_0x29255f={};_0x29255f[_0x384e('0x2b')]=_['keys'](db[_0x384e('0x28')][_0x384e('0x29')]);_0x29255f[_0x384e('0x2c')]=_[_0x384e('0x2d')](_0x4d8cde[_0x384e('0x2c')]);_0x29255f['filters']=_['intersection'](_0x29255f[_0x384e('0x2b')],_0x29255f[_0x384e('0x2c')]);_0x51166c[_0x384e('0x30')]=_['intersection'](_0x29255f['model'],qs[_0x384e('0x31')](_0x4d8cde['query'][_0x384e('0x31')]));_0x51166c['attributes']=_0x51166c['attributes'][_0x384e('0x32')]?_0x51166c[_0x384e('0x30')]:_0x29255f[_0x384e('0x2b')];if(_0x4d8cde['query']['includeAll']){_0x51166c['include']=[{'all':!![]}];}_0x51166c=_[_0x384e('0x39')]({},_0x51166c,_0x4d8cde[_0x384e('0x41')]);return db[_0x384e('0x28')]['find'](_0x51166c)[_0x384e('0x23')](handleEntityNotFound(_0x51d110,null))['then'](respondWithResult(_0x51d110,null))[_0x384e('0x3f')](handleError(_0x51d110,null));};exports[_0x384e('0x42')]=function(_0x4cec42,_0x3b8cc9){return db[_0x384e('0x28')]['create'](_0x4cec42[_0x384e('0x43')],{})[_0x384e('0x23')](respondWithResult(_0x3b8cc9,0xc9))[_0x384e('0x3f')](handleError(_0x3b8cc9,null));};exports['update']=function(_0x12ca3d,_0x31f5ea){if(_0x12ca3d[_0x384e('0x43')]['id']){delete _0x12ca3d[_0x384e('0x43')]['id'];}return db[_0x384e('0x28')][_0x384e('0x44')]({'where':{'id':_0x12ca3d[_0x384e('0x45')]['id']}})[_0x384e('0x23')](handleEntityNotFound(_0x31f5ea,null))[_0x384e('0x23')](saveUpdates(_0x12ca3d[_0x384e('0x43')],null))[_0x384e('0x23')](respondWithResult(_0x31f5ea,null))['catch'](handleError(_0x31f5ea,null));};exports[_0x384e('0x46')]=function(_0x5e6be6,_0x4d6d9b,_0x30280e){var _0x8e3210=require(_0x384e('0x47'));var _0x3b38ed=![];var _0x132fb4={};if(_0x5e6be6[_0x384e('0x2c')][_0x384e('0x3a')]&&_0x5e6be6[_0x384e('0x2c')]['type']===_0x384e('0x48')){_0x132fb4[_0x384e('0x48')]=_0x5e6be6[_0x384e('0x45')]['id'];}else{_0x132fb4['id']=_0x5e6be6[_0x384e('0x45')]['id'];}return db['SquareRecording'][_0x384e('0x44')]({'where':_0x132fb4,'attributes':['id',_0x384e('0x49'),_0x384e('0x4a')],'raw':!![]})[_0x384e('0x23')](handleEntityNotFound(_0x4d6d9b,null))[_0x384e('0x23')](function(_0x2da563){if(_0x2da563){var _0x2cc149=_0x2da563['savePath'];var _0x37a4d4=util[_0x384e('0x4b')](_0x384e('0x4c'),_0x2cc149);if(fs[_0x384e('0x4d')](_0x37a4d4)){_0x3b38ed=!![];return _0x8e3210[_0x384e('0x4e')](_0x37a4d4,_0x2cc149,config[_0x384e('0x4f')][_0x384e('0x50')])[_0x384e('0x23')](function(){return _0x2da563;});}return _0x2da563;}})[_0x384e('0x23')](function(_0x29321a){if(_0x29321a){var _0x31274d=_0x29321a[_0x384e('0x49')];if(!fs[_0x384e('0x4d')](_0x31274d)){throw new db[(_0x384e('0x51'))]['ValidationError'](_0x384e('0x52'));}if(_0x29321a[_0x384e('0x4a')]){return _0x4d6d9b['download'](_0x31274d,_0x29321a[_0x384e('0x4a')]+path[_0x384e('0x53')](_0x31274d),function(){if(_0x3b38ed){fs[_0x384e('0x54')](_0x31274d);}});}else{return _0x4d6d9b['download'](_0x31274d,function(_0x5d983e){if(_0x3b38ed){fs[_0x384e('0x54')](_0x31274d);}});}}})[_0x384e('0x3f')](function(_0x294f29){if(_0x294f29[_0x384e('0x55')]==='SquareRecording\x20not\x20found'){_0x4d6d9b[_0x384e('0x1a')](0x194)[_0x384e('0x56')](_0x384e('0x57'));}else{return handleError(_0x4d6d9b,null);}});};exports[_0x384e('0x58')]=function(_0xe70f6f,_0x25f7b0){return db[_0x384e('0x28')][_0x384e('0x44')]({'where':{'id':_0xe70f6f['params']['id']}})[_0x384e('0x23')](function(_0x5ddceb){if(_[_0x384e('0x59')](_0x5ddceb)){throw new ReferenceError(_0x384e('0x5a'));}return _0x5ddceb;})['then'](function(_0x130180){var _0x26da8e=_0x130180[_0x384e('0x49')];logger[_0x384e('0x5b')]('cancellazione\x20fisica\x20documento\x20%s',_0x26da8e);if(!_[_0x384e('0x59')](_0x130180['savePath'])&&fs[_0x384e('0x4d')](_0x26da8e)){logger[_0x384e('0x5b')](_0x384e('0x5c')+_0x26da8e+_0x384e('0x5d'));fs[_0x384e('0x5e')](_0x26da8e);}_0x26da8e=_0x26da8e+_0x384e('0x5f');if(!_[_0x384e('0x59')](_0x130180[_0x384e('0x49')])&&fs[_0x384e('0x4d')](_0x26da8e)){logger[_0x384e('0x5b')](_0x384e('0x5c')+_0x26da8e+_0x384e('0x5d'));fs[_0x384e('0x5e')](_0x26da8e);}return _0x130180;})[_0x384e('0x23')](function(_0x19d847){if(!_0x19d847)throw new InternalError();return _0x19d847[_0x384e('0x58')]();})['then'](function(){_0x25f7b0[_0x384e('0x1a')](0xcc)['end']();})[_0x384e('0x3f')](handleError(_0x25f7b0,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 43f8889..6bd6b7e 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 _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 +var _0x6c14=['square_recordings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./squareRecording.attributes','exports','define','SquareRecording'];(function(_0x37fb12,_0x2b75ac){var _0x4479f3=function(_0x13111e){while(--_0x13111e){_0x37fb12['push'](_0x37fb12['shift']());}};_0x4479f3(++_0x2b75ac);}(_0x6c14,0xd1));var _0x46c1=function(_0x802994,_0x5194a7){_0x802994=_0x802994-0x0;var _0x27f1f7=_0x6c14[_0x802994];return _0x27f1f7;};'use strict';var _=require(_0x46c1('0x0'));var util=require(_0x46c1('0x1'));var logger=require(_0x46c1('0x2'))(_0x46c1('0x3'));var moment=require(_0x46c1('0x4'));var BPromise=require('bluebird');var rp=require(_0x46c1('0x5'));var fs=require('fs');var path=require(_0x46c1('0x6'));var rimraf=require(_0x46c1('0x7'));var config=require('../../config/environment');var attributes=require(_0x46c1('0x8'));module[_0x46c1('0x9')]=function(_0x30120b,_0x270204){return _0x30120b[_0x46c1('0xa')](_0x46c1('0xb'),attributes,{'tableName':_0x46c1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 250ae6f..70e4643 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 _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 +var _0xc982=['catch','CreateSquareRecording','SquareRecording','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x3e5006,_0x83e367){var _0x507ddd=function(_0x31ee45){while(--_0x31ee45){_0x3e5006['push'](_0x3e5006['shift']());}};_0x507ddd(++_0x83e367);}(_0xc982,0x11d));var _0x2c98=function(_0x835cb7,_0x1e574d){_0x835cb7=_0x835cb7-0x0;var _0x3ef599=_0xc982[_0x835cb7];return _0x3ef599;};'use strict';var _=require(_0x2c98('0x0'));var util=require(_0x2c98('0x1'));var moment=require(_0x2c98('0x2'));var BPromise=require(_0x2c98('0x3'));var rs=require(_0x2c98('0x4'));var fs=require('fs');var Redis=require(_0x2c98('0x5'));var db=require(_0x2c98('0x6'))['db'];var utils=require(_0x2c98('0x7'));var logger=require(_0x2c98('0x8'))(_0x2c98('0x9'));var config=require('../../config/environment');var jayson=require(_0x2c98('0xa'));var client=jayson[_0x2c98('0xb')][_0x2c98('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x205441,_0x6cca76,_0x26c6d4){return new BPromise(function(_0x587f0b,_0x4297e4){return client[_0x2c98('0xd')](_0x205441,_0x26c6d4)[_0x2c98('0xe')](function(_0x529a74){logger[_0x2c98('0xf')](_0x2c98('0x10'),_0x6cca76,'request\x20sent');logger[_0x2c98('0x11')](_0x2c98('0x12'),_0x6cca76,_0x2c98('0x13'),JSON[_0x2c98('0x14')](_0x529a74));if(_0x529a74[_0x2c98('0x15')]){if(_0x529a74[_0x2c98('0x15')]['code']===0x1f4){logger[_0x2c98('0x15')](_0x2c98('0x10'),_0x6cca76,_0x529a74[_0x2c98('0x15')]['message']);return _0x4297e4(_0x529a74[_0x2c98('0x15')][_0x2c98('0x16')]);}logger[_0x2c98('0x15')](_0x2c98('0x10'),_0x6cca76,_0x529a74[_0x2c98('0x15')][_0x2c98('0x16')]);return _0x587f0b(_0x529a74[_0x2c98('0x15')]['message']);}else{logger[_0x2c98('0xf')](_0x2c98('0x10'),_0x6cca76,_0x2c98('0x13'));_0x587f0b(_0x529a74['result']['message']);}})[_0x2c98('0x17')](function(_0x12e80d){logger['error'](_0x2c98('0x10'),_0x6cca76,_0x12e80d);_0x4297e4(_0x12e80d);});});}exports[_0x2c98('0x18')]=function(_0x47efab){var _0x3e3f40=this;return new Promise(function(_0x16df5d,_0x17aefe){return db[_0x2c98('0x19')]['create'](_0x47efab['body'],{'raw':_0x47efab[_0x2c98('0x1a')]?_0x47efab[_0x2c98('0x1a')][_0x2c98('0x1b')]===undefined?!![]:![]:!![]})[_0x2c98('0xe')](function(_0x2031af){logger[_0x2c98('0xf')](_0x2c98('0x18'),_0x47efab);logger[_0x2c98('0x11')]('CreateSquareRecording',_0x47efab,JSON['stringify'](_0x2031af));_0x16df5d(_0x2031af);})[_0x2c98('0x17')](function(_0x27bc1c){logger[_0x2c98('0x15')](_0x2c98('0x18'),_0x27bc1c[_0x2c98('0x16')],_0x47efab);_0x17aefe(_0x3e3f40[_0x2c98('0x15')](0x1f4,_0x27bc1c[_0x2c98('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index a37f15c..6504f53 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_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 +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x2cc569,_0x4e9568){var _0x1bfc2e=function(_0x5b8fcb){while(--_0x5b8fcb){_0x2cc569['push'](_0x2cc569['shift']());}};_0x1bfc2e(++_0x4e9568);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index f69326d..b822b6c 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 _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 +var _0x7d6f=['BOOLEAN','sequelize','STRING','DATE'];(function(_0x1069be,_0x486ca6){var _0xd1a765=function(_0x1b3cba){while(--_0x1b3cba){_0x1069be['push'](_0x1069be['shift']());}};_0xd1a765(++_0x486ca6);}(_0x7d6f,0xf9));var _0xf7d6=function(_0x328fd2,_0x99c719){_0x328fd2=_0x328fd2-0x0;var _0x5d46f9=_0x7d6f[_0x328fd2];return _0x5d46f9;};'use strict';var Sequelize=require(_0xf7d6('0x0'));module['exports']={'network':{'type':Sequelize[_0xf7d6('0x1')]},'network_script':{'type':Sequelize[_0xf7d6('0x1')]},'request':{'type':Sequelize[_0xf7d6('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xf7d6('0x1')]},'type':{'type':Sequelize[_0xf7d6('0x1')]},'uniqueid':{'type':Sequelize[_0xf7d6('0x1')]},'version':{'type':Sequelize[_0xf7d6('0x1')]},'callerid':{'type':Sequelize[_0xf7d6('0x1')]},'calleridname':{'type':Sequelize[_0xf7d6('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xf7d6('0x1')]},'callingtns':{'type':Sequelize[_0xf7d6('0x1')]},'dnid':{'type':Sequelize[_0xf7d6('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xf7d6('0x1')]},'extension':{'type':Sequelize[_0xf7d6('0x1')]},'priority':{'type':Sequelize[_0xf7d6('0x1')]},'enhanced':{'type':Sequelize[_0xf7d6('0x1')]},'accountcode':{'type':Sequelize[_0xf7d6('0x1')]},'threadid':{'type':Sequelize[_0xf7d6('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xf7d6('0x2')]},'leaveAt':{'type':Sequelize[_0xf7d6('0x2')]},'bot':{'type':Sequelize[_0xf7d6('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 5a66db4..e44088b 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 _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 +var _0xf8f3=['params','keys','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','update','then','destroy','end','error','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','show'];(function(_0x4dd21f,_0x1af4ed){var _0x3981e4=function(_0x3ecfe1){while(--_0x3ecfe1){_0x4dd21f['push'](_0x4dd21f['shift']());}};_0x3981e4(++_0x1af4ed);}(_0xf8f3,0x191));var _0x3f8f=function(_0x579307,_0x5df80e){_0x579307=_0x579307-0x0;var _0x561a6f=_0xf8f3[_0x579307];return _0x561a6f;};'use strict';var emlformat=require(_0x3f8f('0x0'));var rimraf=require(_0x3f8f('0x1'));var zipdir=require(_0x3f8f('0x2'));var jsonpatch=require(_0x3f8f('0x3'));var rp=require(_0x3f8f('0x4'));var moment=require(_0x3f8f('0x5'));var BPromise=require(_0x3f8f('0x6'));var Mustache=require(_0x3f8f('0x7'));var util=require(_0x3f8f('0x8'));var path=require(_0x3f8f('0x9'));var sox=require(_0x3f8f('0xa'));var csv=require(_0x3f8f('0xb'));var ejs=require(_0x3f8f('0xc'));var fs=require('fs');var fs_extra=require(_0x3f8f('0xd'));var _=require(_0x3f8f('0xe'));var squel=require(_0x3f8f('0xf'));var crypto=require(_0x3f8f('0x10'));var jsforce=require(_0x3f8f('0x11'));var deskjs=require(_0x3f8f('0x12'));var toCsv=require(_0x3f8f('0xb'));var querystring=require(_0x3f8f('0x13'));var Papa=require(_0x3f8f('0x14'));var Redis=require(_0x3f8f('0x15'));var authService=require(_0x3f8f('0x16'));var qs=require('../../components/parsers/qs');var as=require(_0x3f8f('0x17'));var hardwareService=require(_0x3f8f('0x18'));var logger=require(_0x3f8f('0x19'))(_0x3f8f('0x1a'));var utils=require(_0x3f8f('0x1b'));var config=require(_0x3f8f('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0x3f8f('0x1d'))['db'];function respondWithStatusCode(_0x33c543,_0xff5d5c){_0xff5d5c=_0xff5d5c||0xcc;return function(_0x35a72e){if(_0x35a72e){return _0x33c543[_0x3f8f('0x1e')](_0xff5d5c);}return _0x33c543['status'](_0xff5d5c)['end']();};}function respondWithResult(_0x85daf2,_0x1ec575){_0x1ec575=_0x1ec575||0xc8;return function(_0x4bb630){if(_0x4bb630){return _0x85daf2[_0x3f8f('0x1f')](_0x1ec575)['json'](_0x4bb630);}};}function respondWithFilteredResult(_0x52521e,_0xd6f07d){return function(_0x5f2c42){if(_0x5f2c42){var _0x4aac57=typeof _0xd6f07d[_0x3f8f('0x20')]===_0x3f8f('0x21')&&typeof _0xd6f07d[_0x3f8f('0x22')]===_0x3f8f('0x21');var _0xf192a4=_0x5f2c42[_0x3f8f('0x23')];var _0x172c9d=_0x4aac57?0x0:_0xd6f07d['offset'];var _0x26b6a9=_0x4aac57?_0x5f2c42[_0x3f8f('0x23')]:_0xd6f07d[_0x3f8f('0x20')]+_0xd6f07d[_0x3f8f('0x22')];var _0x347b3a;if(_0x26b6a9>=_0xf192a4){_0x26b6a9=_0xf192a4;_0x347b3a=0xc8;}else{_0x347b3a=0xce;}_0x52521e[_0x3f8f('0x1f')](_0x347b3a);return _0x52521e[_0x3f8f('0x24')]('Content-Range',_0x172c9d+'-'+_0x26b6a9+'/'+_0xf192a4)[_0x3f8f('0x25')](_0x5f2c42);}return null;};}function patchUpdates(_0x12535b){return function(_0x3af649){try{jsonpatch[_0x3f8f('0x26')](_0x3af649,_0x12535b,!![]);}catch(_0x9c9c9f){return BPromise['reject'](_0x9c9c9f);}return _0x3af649['save']();};}function saveUpdates(_0x5d2f4c,_0x512410){return function(_0x1b3a4d){if(_0x1b3a4d){return _0x1b3a4d[_0x3f8f('0x27')](_0x5d2f4c)[_0x3f8f('0x28')](function(_0x2459f0){return _0x2459f0;});}return null;};}function removeEntity(_0x375235,_0x778ac7){return function(_0x46c2c5){if(_0x46c2c5){return _0x46c2c5[_0x3f8f('0x29')]()[_0x3f8f('0x28')](function(){_0x375235['status'](0xcc)[_0x3f8f('0x2a')]();});}};}function handleEntityNotFound(_0x31559c,_0x3ceb57){return function(_0x485ed0){if(!_0x485ed0){_0x31559c[_0x3f8f('0x1e')](0x194);}return _0x485ed0;};}function handleError(_0x17356b,_0x59ba41){_0x59ba41=_0x59ba41||0x1f4;return function(_0x10a229){logger[_0x3f8f('0x2b')](_0x10a229['stack']);if(_0x10a229[_0x3f8f('0x2c')]){delete _0x10a229[_0x3f8f('0x2c')];}_0x17356b[_0x3f8f('0x1f')](_0x59ba41)[_0x3f8f('0x2d')](_0x10a229);};}exports[_0x3f8f('0x2e')]=function(_0x493d18,_0x209f98){var _0x1e268d={},_0x1027b1={},_0x352641={'count':0x0,'rows':[]};var _0x1e4fd8=_[_0x3f8f('0x2f')](db[_0x3f8f('0x30')][_0x3f8f('0x31')],function(_0x4ba9ea){return{'name':_0x4ba9ea[_0x3f8f('0x32')],'type':_0x4ba9ea[_0x3f8f('0x33')][_0x3f8f('0x34')]};});_0x1027b1['model']=_[_0x3f8f('0x2f')](_0x1e4fd8,_0x3f8f('0x2c'));_0x1027b1[_0x3f8f('0x35')]=_['keys'](_0x493d18[_0x3f8f('0x35')]);_0x1027b1[_0x3f8f('0x36')]=_[_0x3f8f('0x37')](_0x1027b1[_0x3f8f('0x38')],_0x1027b1[_0x3f8f('0x35')]);_0x1e268d[_0x3f8f('0x39')]=_[_0x3f8f('0x37')](_0x1027b1[_0x3f8f('0x38')],qs[_0x3f8f('0x3a')](_0x493d18[_0x3f8f('0x35')][_0x3f8f('0x3a')]));_0x1e268d[_0x3f8f('0x39')]=_0x1e268d['attributes'][_0x3f8f('0x3b')]?_0x1e268d[_0x3f8f('0x39')]:_0x1027b1[_0x3f8f('0x38')];if(!_0x493d18[_0x3f8f('0x35')][_0x3f8f('0x3c')](_0x3f8f('0x3d'))){_0x1e268d[_0x3f8f('0x22')]=qs[_0x3f8f('0x22')](_0x493d18[_0x3f8f('0x35')]['limit']);_0x1e268d[_0x3f8f('0x20')]=qs[_0x3f8f('0x20')](_0x493d18['query'][_0x3f8f('0x20')]);}_0x1e268d[_0x3f8f('0x3e')]=qs[_0x3f8f('0x3f')](_0x493d18[_0x3f8f('0x35')][_0x3f8f('0x3f')]);_0x1e268d['where']=qs[_0x3f8f('0x36')](_['pick'](_0x493d18[_0x3f8f('0x35')],_0x1027b1['filters']),_0x1e4fd8);if(_0x493d18[_0x3f8f('0x35')][_0x3f8f('0x40')]){_0x1e268d[_0x3f8f('0x41')]=_[_0x3f8f('0x42')](_0x1e268d['where'],{'$or':_['map'](_0x1e4fd8,function(_0x3222cd){if(_0x3222cd[_0x3f8f('0x33')]!=='VIRTUAL'){var _0x35ad41={};_0x35ad41[_0x3222cd[_0x3f8f('0x2c')]]={'$like':'%'+_0x493d18[_0x3f8f('0x35')][_0x3f8f('0x40')]+'%'};return _0x35ad41;}})});}_0x1e268d=_[_0x3f8f('0x42')]({},_0x1e268d,_0x493d18[_0x3f8f('0x43')]);var _0x124c95={'where':_0x1e268d['where']};return db[_0x3f8f('0x30')]['count'](_0x124c95)[_0x3f8f('0x28')](function(_0x5691a3){_0x352641[_0x3f8f('0x23')]=_0x5691a3;if(_0x493d18[_0x3f8f('0x35')][_0x3f8f('0x44')]){_0x1e268d[_0x3f8f('0x45')]=[{'all':!![]}];}return db[_0x3f8f('0x30')][_0x3f8f('0x46')](_0x1e268d);})[_0x3f8f('0x28')](function(_0x4e0ed2){_0x352641[_0x3f8f('0x47')]=_0x4e0ed2;return _0x352641;})[_0x3f8f('0x28')](respondWithFilteredResult(_0x209f98,_0x1e268d))['catch'](handleError(_0x209f98,null));};exports[_0x3f8f('0x48')]=function(_0x368107,_0x1d4ecc){var _0x5a7ace={'raw':!![],'where':{'id':_0x368107[_0x3f8f('0x49')]['id']}},_0x1ef161={};_0x1ef161[_0x3f8f('0x38')]=_[_0x3f8f('0x4a')](db[_0x3f8f('0x30')][_0x3f8f('0x31')]);_0x1ef161[_0x3f8f('0x35')]=_[_0x3f8f('0x4a')](_0x368107['query']);_0x1ef161[_0x3f8f('0x36')]=_[_0x3f8f('0x37')](_0x1ef161[_0x3f8f('0x38')],_0x1ef161[_0x3f8f('0x35')]);_0x5a7ace[_0x3f8f('0x39')]=_[_0x3f8f('0x37')](_0x1ef161[_0x3f8f('0x38')],qs[_0x3f8f('0x3a')](_0x368107[_0x3f8f('0x35')][_0x3f8f('0x3a')]));_0x5a7ace[_0x3f8f('0x39')]=_0x5a7ace[_0x3f8f('0x39')]['length']?_0x5a7ace[_0x3f8f('0x39')]:_0x1ef161[_0x3f8f('0x38')];if(_0x368107[_0x3f8f('0x35')]['includeAll']){_0x5a7ace[_0x3f8f('0x45')]=[{'all':!![]}];}_0x5a7ace=_[_0x3f8f('0x42')]({},_0x5a7ace,_0x368107[_0x3f8f('0x43')]);return db[_0x3f8f('0x30')]['find'](_0x5a7ace)[_0x3f8f('0x28')](handleEntityNotFound(_0x1d4ecc,null))['then'](respondWithResult(_0x1d4ecc,null))[_0x3f8f('0x4b')](handleError(_0x1d4ecc,null));};exports[_0x3f8f('0x4c')]=function(_0x45cc83,_0x29febb){return db[_0x3f8f('0x30')]['create'](_0x45cc83[_0x3f8f('0x4d')],{})[_0x3f8f('0x28')](respondWithResult(_0x29febb,0xc9))[_0x3f8f('0x4b')](handleError(_0x29febb,null));};exports[_0x3f8f('0x27')]=function(_0x32aefd,_0x1769a7){if(_0x32aefd[_0x3f8f('0x4d')]['id']){delete _0x32aefd['body']['id'];}return db[_0x3f8f('0x30')][_0x3f8f('0x4e')]({'where':{'id':_0x32aefd[_0x3f8f('0x49')]['id']}})[_0x3f8f('0x28')](handleEntityNotFound(_0x1769a7,null))[_0x3f8f('0x28')](saveUpdates(_0x32aefd[_0x3f8f('0x4d')],null))['then'](respondWithResult(_0x1769a7,null))['catch'](handleError(_0x1769a7,null));};exports[_0x3f8f('0x29')]=function(_0x3a926c,_0x4ba8b3){return db[_0x3f8f('0x30')][_0x3f8f('0x4e')]({'where':{'id':_0x3a926c[_0x3f8f('0x49')]['id']}})[_0x3f8f('0x28')](handleEntityNotFound(_0x4ba8b3,null))['then'](removeEntity(_0x4ba8b3,null))[_0x3f8f('0x4b')](handleError(_0x4ba8b3,null));};exports['describe']=function(_0x1c3e3d,_0x316fdc){return db['SquareReport']['describe']()['then'](respondWithResult(_0x316fdc,null))[_0x3f8f('0x4b')](handleError(_0x316fdc,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 1187d31..1645940 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 _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 +var _0xaab0=['./squareReport.attributes','define','SquareReport','uid_pname','project_name','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0x27e868,_0xa52d2a){var _0x4a9b8a=function(_0x32abfd){while(--_0x32abfd){_0x27e868['push'](_0x27e868['shift']());}};_0x4a9b8a(++_0xa52d2a);}(_0xaab0,0xc5));var _0x0aab=function(_0x11f5ff,_0xa0ef18){_0x11f5ff=_0x11f5ff-0x0;var _0x46eefb=_0xaab0[_0x11f5ff];return _0x46eefb;};'use strict';var _=require(_0x0aab('0x0'));var util=require(_0x0aab('0x1'));var logger=require(_0x0aab('0x2'))('api');var moment=require(_0x0aab('0x3'));var BPromise=require('bluebird');var rp=require(_0x0aab('0x4'));var fs=require('fs');var path=require(_0x0aab('0x5'));var rimraf=require('rimraf');var config=require(_0x0aab('0x6'));var attributes=require(_0x0aab('0x7'));module['exports']=function(_0x3bd34a,_0x11c36e){return _0x3bd34a[_0x0aab('0x8')](_0x0aab('0x9'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x0aab('0xa'),'fields':['uniqueid',_0x0aab('0xb')]},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 1a88dc7..72a89ac 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 _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 +var _0x47a2=['raw','then','debug','stringify','UpdateSquareReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','error','code','message','catch','CreateSquareReport','SquareReport','options'];(function(_0x4652e2,_0x51f2cd){var _0x2cf96b=function(_0x5dfbf6){while(--_0x5dfbf6){_0x4652e2['push'](_0x4652e2['shift']());}};_0x2cf96b(++_0x51f2cd);}(_0x47a2,0x12a));var _0x247a=function(_0x3a6a37,_0x30743f){_0x3a6a37=_0x3a6a37-0x0;var _0xd802a8=_0x47a2[_0x3a6a37];return _0xd802a8;};'use strict';var _=require(_0x247a('0x0'));var util=require(_0x247a('0x1'));var moment=require(_0x247a('0x2'));var BPromise=require(_0x247a('0x3'));var rs=require(_0x247a('0x4'));var fs=require('fs');var Redis=require(_0x247a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x247a('0x6'))('rpc');var config=require(_0x247a('0x7'));var jayson=require(_0x247a('0x8'));var client=jayson[_0x247a('0x9')][_0x247a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x247c99,_0x14cf15,_0x3639cb){return new BPromise(function(_0x2671bf,_0x504e29){return client[_0x247a('0xb')](_0x247c99,_0x3639cb)['then'](function(_0x2e3b5a){logger[_0x247a('0xc')](_0x247a('0xd'),_0x14cf15,_0x247a('0xe'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x14cf15,_0x247a('0xe'),JSON['stringify'](_0x2e3b5a));if(_0x2e3b5a[_0x247a('0xf')]){if(_0x2e3b5a[_0x247a('0xf')][_0x247a('0x10')]===0x1f4){logger['error'](_0x247a('0xd'),_0x14cf15,_0x2e3b5a['error'][_0x247a('0x11')]);return _0x504e29(_0x2e3b5a['error'][_0x247a('0x11')]);}logger['error'](_0x247a('0xd'),_0x14cf15,_0x2e3b5a[_0x247a('0xf')][_0x247a('0x11')]);return _0x2671bf(_0x2e3b5a['error'][_0x247a('0x11')]);}else{logger[_0x247a('0xc')](_0x247a('0xd'),_0x14cf15,'request\x20sent');_0x2671bf(_0x2e3b5a['result'][_0x247a('0x11')]);}})[_0x247a('0x12')](function(_0x42a59d){logger[_0x247a('0xf')](_0x247a('0xd'),_0x14cf15,_0x42a59d);_0x504e29(_0x42a59d);});});}exports[_0x247a('0x13')]=function(_0x5ad4a3){var _0x51974d=this;return new Promise(function(_0x177544,_0x1d5f0a){return db[_0x247a('0x14')]['create'](_0x5ad4a3['body'],{'raw':_0x5ad4a3[_0x247a('0x15')]?_0x5ad4a3['options'][_0x247a('0x16')]===undefined?!![]:![]:!![]})[_0x247a('0x17')](function(_0x2a3af2){logger[_0x247a('0xc')](_0x247a('0x13'),_0x5ad4a3);logger[_0x247a('0x18')](_0x247a('0x13'),_0x5ad4a3,JSON[_0x247a('0x19')](_0x2a3af2));_0x177544(_0x2a3af2);})['catch'](function(_0xf8a2c3){logger[_0x247a('0xf')](_0x247a('0x13'),_0xf8a2c3[_0x247a('0x11')],_0x5ad4a3);_0x1d5f0a(_0x51974d[_0x247a('0xf')](0x1f4,_0xf8a2c3[_0x247a('0x11')]));});});};exports[_0x247a('0x1a')]=function(_0xcde5c1){var _0x2f1446=this;return new Promise(function(_0x2de424,_0x370876){return db[_0x247a('0x14')][_0x247a('0x1b')](_0xcde5c1[_0x247a('0x1c')],{'raw':_0xcde5c1[_0x247a('0x15')]?_0xcde5c1[_0x247a('0x15')][_0x247a('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcde5c1['options']?_0xcde5c1[_0x247a('0x15')][_0x247a('0x1d')]||null:null,'attributes':_0xcde5c1[_0x247a('0x15')]?_0xcde5c1['options'][_0x247a('0x1e')]||null:null,'limit':_0xcde5c1[_0x247a('0x15')]?_0xcde5c1[_0x247a('0x15')][_0x247a('0x1f')]||null:null})[_0x247a('0x17')](function(_0x4569d8){logger['info'](_0x247a('0x1a'),_0xcde5c1);logger[_0x247a('0x18')]('UpdateSquareReport',_0xcde5c1,JSON[_0x247a('0x19')](_0x4569d8));_0x2de424(_0x4569d8);})[_0x247a('0x12')](function(_0x558773){logger[_0x247a('0xf')]('UpdateSquareReport',_0x558773[_0x247a('0x11')],_0xcde5c1);_0x370876(_0x2f1446[_0x247a('0xf')](0x1f4,_0x558773[_0x247a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index c3b797b..36beaa1 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 _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 +var _0xc0e7=['post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x5759b5,_0x3ae4cf){var _0x1cdf60=function(_0x21345c){while(--_0x21345c){_0x5759b5['push'](_0x5759b5['shift']());}};_0x1cdf60(++_0x3ae4cf);}(_0xc0e7,0xa7));var _0x7c0e=function(_0x1b65f1,_0x1d91f0){_0x1b65f1=_0x1b65f1-0x0;var _0x4add6d=_0xc0e7[_0x1b65f1];return _0x4add6d;};'use strict';var multer=require(_0x7c0e('0x0'));var util=require(_0x7c0e('0x1'));var path=require('path');var timeout=require(_0x7c0e('0x2'));var express=require(_0x7c0e('0x3'));var router=express[_0x7c0e('0x4')]();var fs_extra=require(_0x7c0e('0x5'));var auth=require(_0x7c0e('0x6'));var interaction=require(_0x7c0e('0x7'));var config=require(_0x7c0e('0x8'));var controller=require(_0x7c0e('0x9'));router[_0x7c0e('0xa')]('/',auth[_0x7c0e('0xb')](),controller[_0x7c0e('0xc')]);router[_0x7c0e('0xa')](_0x7c0e('0xd'),auth[_0x7c0e('0xb')](),controller[_0x7c0e('0xe')]);router[_0x7c0e('0xa')](_0x7c0e('0xf'),auth[_0x7c0e('0xb')](),controller[_0x7c0e('0x10')]);router[_0x7c0e('0x11')]('/',auth[_0x7c0e('0xb')](),controller[_0x7c0e('0x12')]);router[_0x7c0e('0x13')](_0x7c0e('0xf'),auth[_0x7c0e('0xb')](),controller[_0x7c0e('0x14')]);router[_0x7c0e('0x15')](_0x7c0e('0xf'),auth[_0x7c0e('0xb')](),controller[_0x7c0e('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index b6d69d5..d4e2c5c 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 _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 +var _0x8ea1=['sequelize','STRING','TEXT'];(function(_0x3439b4,_0x3c235c){var _0x38d9f8=function(_0x4a3a54){while(--_0x4a3a54){_0x3439b4['push'](_0x3439b4['shift']());}};_0x38d9f8(++_0x3c235c);}(_0x8ea1,0x1bc));var _0x18ea=function(_0x21f3bf,_0xfb0f59){_0x21f3bf=_0x21f3bf-0x0;var _0x249d08=_0x8ea1[_0x21f3bf];return _0x249d08;};'use strict';var Sequelize=require(_0x18ea('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x18ea('0x1')]},'application':{'type':Sequelize[_0x18ea('0x1')]},'data':{'type':Sequelize[_0x18ea('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x18ea('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 4b2f389..e5c74af 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 _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 +var _0x34b5=['../../config/license/util','../../mysqldb','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','status','sendStatus','error','name','send','index','SquareDetailsReport','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x14bfae,_0x1a3392){var _0x44822d=function(_0x413c9b){while(--_0x413c9b){_0x14bfae['push'](_0x14bfae['shift']());}};_0x44822d(++_0x1a3392);}(_0x34b5,0x1b7));var _0x534b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x34b5[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x534b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x534b('0x1'));var rp=require(_0x534b('0x2'));var moment=require(_0x534b('0x3'));var BPromise=require(_0x534b('0x4'));var Mustache=require(_0x534b('0x5'));var util=require(_0x534b('0x6'));var path=require('path');var sox=require(_0x534b('0x7'));var csv=require('to-csv');var ejs=require(_0x534b('0x8'));var fs=require('fs');var fs_extra=require(_0x534b('0x9'));var _=require('lodash');var squel=require(_0x534b('0xa'));var crypto=require('crypto');var jsforce=require(_0x534b('0xb'));var deskjs=require(_0x534b('0xc'));var toCsv=require(_0x534b('0xd'));var querystring=require(_0x534b('0xe'));var Papa=require('papaparse');var Redis=require(_0x534b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x534b('0x10'));var as=require(_0x534b('0x11'));var hardwareService=require(_0x534b('0x12'));var logger=require(_0x534b('0x13'))(_0x534b('0x14'));var utils=require(_0x534b('0x15'));var config=require(_0x534b('0x16'));var licenseUtil=require(_0x534b('0x17'));var db=require(_0x534b('0x18'))['db'];function respondWithStatusCode(_0x586d07,_0x409529){_0x409529=_0x409529||0xcc;return function(_0x4645b6){if(_0x4645b6){return _0x586d07['sendStatus'](_0x409529);}return _0x586d07['status'](_0x409529)['end']();};}function respondWithResult(_0x2c0eb5,_0x16caa1){_0x16caa1=_0x16caa1||0xc8;return function(_0x4c18a7){if(_0x4c18a7){return _0x2c0eb5['status'](_0x16caa1)[_0x534b('0x19')](_0x4c18a7);}};}function respondWithFilteredResult(_0x26ba35,_0x37cae1){return function(_0xbfe02c){if(_0xbfe02c){var _0x1fcd8b=typeof _0x37cae1['offset']===_0x534b('0x1a')&&typeof _0x37cae1[_0x534b('0x1b')]===_0x534b('0x1a');var _0x5332cc=_0xbfe02c[_0x534b('0x1c')];var _0x1fac97=_0x1fcd8b?0x0:_0x37cae1[_0x534b('0x1d')];var _0x4e085c=_0x1fcd8b?_0xbfe02c[_0x534b('0x1c')]:_0x37cae1[_0x534b('0x1d')]+_0x37cae1[_0x534b('0x1b')];var _0x3410d5;if(_0x4e085c>=_0x5332cc){_0x4e085c=_0x5332cc;_0x3410d5=0xc8;}else{_0x3410d5=0xce;}_0x26ba35['status'](_0x3410d5);return _0x26ba35[_0x534b('0x1e')](_0x534b('0x1f'),_0x1fac97+'-'+_0x4e085c+'/'+_0x5332cc)[_0x534b('0x19')](_0xbfe02c);}return null;};}function patchUpdates(_0x143649){return function(_0x21adf1){try{jsonpatch[_0x534b('0x20')](_0x21adf1,_0x143649,!![]);}catch(_0x54eaef){return BPromise[_0x534b('0x21')](_0x54eaef);}return _0x21adf1[_0x534b('0x22')]();};}function saveUpdates(_0x1fa326,_0x344174){return function(_0x13acc5){if(_0x13acc5){return _0x13acc5[_0x534b('0x23')](_0x1fa326)[_0x534b('0x24')](function(_0x50b6c7){return _0x50b6c7;});}return null;};}function removeEntity(_0x4b811d,_0x1f4c00){return function(_0x4abe34){if(_0x4abe34){return _0x4abe34[_0x534b('0x25')]()['then'](function(){_0x4b811d[_0x534b('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x121b44,_0x3dc0e0){return function(_0x227320){if(!_0x227320){_0x121b44[_0x534b('0x27')](0x194);}return _0x227320;};}function handleError(_0x179cbb,_0xb6039b){_0xb6039b=_0xb6039b||0x1f4;return function(_0x32f944){logger[_0x534b('0x28')](_0x32f944['stack']);if(_0x32f944[_0x534b('0x29')]){delete _0x32f944[_0x534b('0x29')];}_0x179cbb[_0x534b('0x26')](_0xb6039b)[_0x534b('0x2a')](_0x32f944);};}exports[_0x534b('0x2b')]=function(_0x138371,_0x204a13){var _0x2a4a9b={},_0x382d19={},_0x378889={'count':0x0,'rows':[]};var _0x19fdff=_['map'](db[_0x534b('0x2c')]['rawAttributes'],function(_0x2b7d71){return{'name':_0x2b7d71['fieldName'],'type':_0x2b7d71[_0x534b('0x2d')][_0x534b('0x2e')]};});_0x382d19[_0x534b('0x2f')]=_[_0x534b('0x30')](_0x19fdff,_0x534b('0x29'));_0x382d19[_0x534b('0x31')]=_[_0x534b('0x32')](_0x138371[_0x534b('0x31')]);_0x382d19[_0x534b('0x33')]=_[_0x534b('0x34')](_0x382d19[_0x534b('0x2f')],_0x382d19['query']);_0x2a4a9b['attributes']=_['intersection'](_0x382d19[_0x534b('0x2f')],qs[_0x534b('0x35')](_0x138371[_0x534b('0x31')][_0x534b('0x35')]));_0x2a4a9b[_0x534b('0x36')]=_0x2a4a9b['attributes'][_0x534b('0x37')]?_0x2a4a9b[_0x534b('0x36')]:_0x382d19[_0x534b('0x2f')];if(!_0x138371[_0x534b('0x31')][_0x534b('0x38')](_0x534b('0x39'))){_0x2a4a9b[_0x534b('0x1b')]=qs[_0x534b('0x1b')](_0x138371[_0x534b('0x31')][_0x534b('0x1b')]);_0x2a4a9b[_0x534b('0x1d')]=qs[_0x534b('0x1d')](_0x138371[_0x534b('0x31')][_0x534b('0x1d')]);}_0x2a4a9b['order']=qs[_0x534b('0x3a')](_0x138371[_0x534b('0x31')]['sort']);_0x2a4a9b[_0x534b('0x3b')]=qs[_0x534b('0x33')](_[_0x534b('0x3c')](_0x138371[_0x534b('0x31')],_0x382d19[_0x534b('0x33')]),_0x19fdff);if(_0x138371['query'][_0x534b('0x3d')]){_0x2a4a9b['where']=_[_0x534b('0x3e')](_0x2a4a9b[_0x534b('0x3b')],{'$or':_[_0x534b('0x30')](_0x19fdff,function(_0x3e29bf){if(_0x3e29bf['type']!==_0x534b('0x3f')){var _0x2e52b3={};_0x2e52b3[_0x3e29bf[_0x534b('0x29')]]={'$like':'%'+_0x138371[_0x534b('0x31')][_0x534b('0x3d')]+'%'};return _0x2e52b3;}})});}_0x2a4a9b=_[_0x534b('0x3e')]({},_0x2a4a9b,_0x138371[_0x534b('0x40')]);var _0x4a3f02={'where':_0x2a4a9b[_0x534b('0x3b')]};return db[_0x534b('0x2c')][_0x534b('0x1c')](_0x4a3f02)[_0x534b('0x24')](function(_0x1cca62){_0x378889[_0x534b('0x1c')]=_0x1cca62;if(_0x138371[_0x534b('0x31')][_0x534b('0x41')]){_0x2a4a9b[_0x534b('0x42')]=[{'all':!![]}];}return db[_0x534b('0x2c')][_0x534b('0x43')](_0x2a4a9b);})[_0x534b('0x24')](function(_0x3e7c95){_0x378889[_0x534b('0x44')]=_0x3e7c95;return _0x378889;})[_0x534b('0x24')](respondWithFilteredResult(_0x204a13,_0x2a4a9b))['catch'](handleError(_0x204a13,null));};exports[_0x534b('0x45')]=function(_0x59fecd,_0x854cda){var _0x1ce72f={'raw':!![],'where':{'id':_0x59fecd[_0x534b('0x46')]['id']}},_0x4adde7={};_0x4adde7[_0x534b('0x2f')]=_[_0x534b('0x32')](db[_0x534b('0x2c')][_0x534b('0x47')]);_0x4adde7[_0x534b('0x31')]=_[_0x534b('0x32')](_0x59fecd[_0x534b('0x31')]);_0x4adde7[_0x534b('0x33')]=_[_0x534b('0x34')](_0x4adde7['model'],_0x4adde7['query']);_0x1ce72f[_0x534b('0x36')]=_[_0x534b('0x34')](_0x4adde7[_0x534b('0x2f')],qs[_0x534b('0x35')](_0x59fecd[_0x534b('0x31')][_0x534b('0x35')]));_0x1ce72f[_0x534b('0x36')]=_0x1ce72f[_0x534b('0x36')][_0x534b('0x37')]?_0x1ce72f[_0x534b('0x36')]:_0x4adde7[_0x534b('0x2f')];if(_0x59fecd[_0x534b('0x31')][_0x534b('0x41')]){_0x1ce72f[_0x534b('0x42')]=[{'all':!![]}];}_0x1ce72f=_[_0x534b('0x3e')]({},_0x1ce72f,_0x59fecd[_0x534b('0x40')]);return db[_0x534b('0x2c')][_0x534b('0x48')](_0x1ce72f)[_0x534b('0x24')](handleEntityNotFound(_0x854cda,null))[_0x534b('0x24')](respondWithResult(_0x854cda,null))[_0x534b('0x49')](handleError(_0x854cda,null));};exports['create']=function(_0x556802,_0x1d00df){return db[_0x534b('0x2c')][_0x534b('0x4a')](_0x556802[_0x534b('0x4b')],{})['then'](respondWithResult(_0x1d00df,0xc9))[_0x534b('0x49')](handleError(_0x1d00df,null));};exports[_0x534b('0x23')]=function(_0x444883,_0x2c3437){if(_0x444883[_0x534b('0x4b')]['id']){delete _0x444883[_0x534b('0x4b')]['id'];}return db['SquareDetailsReport'][_0x534b('0x48')]({'where':{'id':_0x444883['params']['id']}})['then'](handleEntityNotFound(_0x2c3437,null))['then'](saveUpdates(_0x444883['body'],null))[_0x534b('0x24')](respondWithResult(_0x2c3437,null))['catch'](handleError(_0x2c3437,null));};exports[_0x534b('0x25')]=function(_0x10ce4c,_0x2df7ab){return db[_0x534b('0x2c')][_0x534b('0x48')]({'where':{'id':_0x10ce4c[_0x534b('0x46')]['id']}})[_0x534b('0x24')](handleEntityNotFound(_0x2df7ab,null))[_0x534b('0x24')](removeEntity(_0x2df7ab,null))[_0x534b('0x49')](handleError(_0x2df7ab,null));};exports[_0x534b('0x4c')]=function(_0x3076f4,_0x16ef3f){return db[_0x534b('0x2c')][_0x534b('0x4c')]()[_0x534b('0x24')](respondWithResult(_0x16ef3f,null))['catch'](handleError(_0x16ef3f,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 996d100..71c2ff6 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 _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 +var _0x6785=['bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','../../config/logger','moment'];(function(_0x1ce3aa,_0x37b150){var _0x2a243d=function(_0x104fda){while(--_0x104fda){_0x1ce3aa['push'](_0x1ce3aa['shift']());}};_0x2a243d(++_0x37b150);}(_0x6785,0x128));var _0x5678=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x6785[_0x17928f];return _0x500b63;};'use strict';var _=require(_0x5678('0x0'));var util=require('util');var logger=require(_0x5678('0x1'))('api');var moment=require(_0x5678('0x2'));var BPromise=require(_0x5678('0x3'));var rp=require(_0x5678('0x4'));var fs=require('fs');var path=require(_0x5678('0x5'));var rimraf=require(_0x5678('0x6'));var config=require(_0x5678('0x7'));var attributes=require(_0x5678('0x8'));module[_0x5678('0x9')]=function(_0x1ec705,_0x4589d4){return _0x1ec705[_0x5678('0xa')](_0x5678('0xb'),attributes,{'tableName':_0x5678('0xc'),'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 f263d46..469e126 100644 --- a/server/api/squareReportDetail/squareReportDetail.rpc.js +++ b/server/api/squareReportDetail/squareReportDetail.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa32b=['create','body','CreateSquareDetailsReport','stringify','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','error','SquareDetailsReport,\x20%s,\x20%s','message','info','result','catch','SquareDetailsReport'];(function(_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 +var _0x253d=['create','options','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','message','result','SquareDetailsReport,\x20%s,\x20%s','CreateSquareDetailsReport'];(function(_0x5200c4,_0x4d59a6){var _0x36cb24=function(_0x41bf1f){while(--_0x41bf1f){_0x5200c4['push'](_0x5200c4['shift']());}};_0x36cb24(++_0x4d59a6);}(_0x253d,0x1b3));var _0xd253=function(_0x3a6685,_0x917fa4){_0x3a6685=_0x3a6685-0x0;var _0x4549d7=_0x253d[_0x3a6685];return _0x4549d7;};'use strict';var _=require(_0xd253('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd253('0x1'));var db=require(_0xd253('0x2'))['db'];var utils=require(_0xd253('0x3'));var logger=require(_0xd253('0x4'))(_0xd253('0x5'));var config=require('../../config/environment');var jayson=require(_0xd253('0x6'));var client=jayson[_0xd253('0x7')][_0xd253('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x17589a,_0xf4b457,_0x487f4e){return new BPromise(function(_0x2c4de4,_0x712c81){return client[_0xd253('0x9')](_0x17589a,_0x487f4e)[_0xd253('0xa')](function(_0x351047){logger[_0xd253('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0xf4b457,'request\x20sent');logger[_0xd253('0xc')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0xf4b457,_0xd253('0xd'),JSON[_0xd253('0xe')](_0x351047));if(_0x351047[_0xd253('0xf')]){if(_0x351047[_0xd253('0xf')][_0xd253('0x10')]===0x1f4){logger[_0xd253('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0xf4b457,_0x351047['error'][_0xd253('0x11')]);return _0x712c81(_0x351047[_0xd253('0xf')][_0xd253('0x11')]);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0xf4b457,_0x351047[_0xd253('0xf')][_0xd253('0x11')]);return _0x2c4de4(_0x351047[_0xd253('0xf')]['message']);}else{logger[_0xd253('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0xf4b457,_0xd253('0xd'));_0x2c4de4(_0x351047[_0xd253('0x12')][_0xd253('0x11')]);}})['catch'](function(_0x1b7ed1){logger['error'](_0xd253('0x13'),_0xf4b457,_0x1b7ed1);_0x712c81(_0x1b7ed1);});});}exports[_0xd253('0x14')]=function(_0x5e4051){var _0x2496cb=this;return new Promise(function(_0x2a2adc,_0x5b24ff){return db['SquareDetailsReport'][_0xd253('0x15')](_0x5e4051['body'],{'raw':_0x5e4051['options']?_0x5e4051[_0xd253('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xd253('0xa')](function(_0x1e48c3){logger[_0xd253('0xb')](_0xd253('0x14'),_0x5e4051);logger['debug'](_0xd253('0x14'),_0x5e4051,JSON['stringify'](_0x1e48c3));_0x2a2adc(_0x1e48c3);})[_0xd253('0x17')](function(_0x50f8b5){logger[_0xd253('0xf')](_0xd253('0x14'),_0x50f8b5[_0xd253('0x11')],_0x5e4051);_0x5b24ff(_0x2496cb[_0xd253('0xf')](0x1f4,_0x50f8b5['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index d811ef3..9bfeb55 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 _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 +var _0xd30b=['isAuthenticated','index','exports','express','Router','../../components/auth/service','get'];(function(_0x5f3cbd,_0x1466fe){var _0x5d4b86=function(_0xb72a02){while(--_0xb72a02){_0x5f3cbd['push'](_0x5f3cbd['shift']());}};_0x5d4b86(++_0x1466fe);}(_0xd30b,0x1a7));var _0xbd30=function(_0x119705,_0xba9427){_0x119705=_0x119705-0x0;var _0x2affc2=_0xd30b[_0x119705];return _0x2affc2;};'use strict';var express=require(_0xbd30('0x0'));var router=express[_0xbd30('0x1')]();var auth=require(_0xbd30('0x2'));var controller=require('./system.controller');router[_0xbd30('0x3')]('/',auth[_0xbd30('0x4')](),controller[_0xbd30('0x5')]);router[_0xbd30('0x3')]('/process/:pid/kill',auth[_0xbd30('0x4')](),controller['killProcess']);module[_0xbd30('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 3dbbcb2..143696e 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 _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 +var _0xa5b2=['api','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','status','send','index','then','format','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','json','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','exec','../../config/logger'];(function(_0x5ef939,_0x16d68f){var _0x15cbfb=function(_0x5748d){while(--_0x5748d){_0x5ef939['push'](_0x5ef939['shift']());}};_0x15cbfb(++_0x16d68f);}(_0xa5b2,0x6b));var _0x2a5b=function(_0x296809,_0x1c9665){_0x296809=_0x296809-0x0;var _0x18c0d3=_0xa5b2[_0x296809];return _0x18c0d3;};'use strict';var info=require(_0x2a5b('0x0'));var exec=require('child_process')[_0x2a5b('0x1')];var logger=require(_0x2a5b('0x2'))(_0x2a5b('0x3'));var util=require(_0x2a5b('0x4'));var BPromise=require(_0x2a5b('0x5'));var _=require(_0x2a5b('0x6'));function handleError(_0x41a52c,_0x1bb4a1,_0x3e66a1){_0x1bb4a1=_0x1bb4a1||0x1f4;return function(_0x3599a9){logger['error'](_0x2a5b('0x7'),_0x3e66a1,_0x1bb4a1,util['inspect'](_0x3599a9,{'showHidden':![],'depth':null}));delete _0x3599a9['name'];_0x41a52c[_0x2a5b('0x8')](_0x1bb4a1)[_0x2a5b('0x9')](_0x3599a9);};}exports[_0x2a5b('0xa')]=function(_0x1942f4,_0x553a2e){return info['getAllData']()[_0x2a5b('0xb')](function(_0x2a3a2f){return _0x553a2e[_0x2a5b('0x8')](0xc8)['json'](_0x2a3a2f);})['catch'](function(_0x59c3b5){return _0x553a2e[_0x2a5b('0x8')](0x1f4)['json'](_0x59c3b5);});};exports['killProcess']=function(_0x1b0893,_0x3b8c56){var _0x554843=['components/import/cm'];return new BPromise(function(_0x2ef1eb,_0x2d57ad){return exec(util[_0x2a5b('0xc')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x1b0893[_0x2a5b('0xd')][_0x2a5b('0xe')]),function(_0x284275,_0x5d36d,_0x490e78){if(_0x284275){return _0x2d57ad(_0x284275);}return _0x2ef1eb(_0x5d36d);});})['then'](function(_0x139ed3){var _0x10dc16=![];var _0x20436f=_0x139ed3[_0x2a5b('0xf')](/\n/);for(var _0x3ea2e7=0x0,_0x1243af=_0x554843[_0x2a5b('0x10')];_0x3ea2e7<_0x1243af,_0x10dc16===![];_0x3ea2e7+=0x1){if(_0x139ed3[_0x2a5b('0x11')](_0x554843[_0x3ea2e7])>=0x0){_0x10dc16=!![];}}if(!_0x10dc16){throw new Error(util['format'](_0x2a5b('0x12'),_0x1b0893[_0x2a5b('0xd')]['pid']));}process['kill'](_0x1b0893[_0x2a5b('0xd')][_0x2a5b('0xe')],'SIGINT');return _0x3b8c56[_0x2a5b('0x8')](0xc8)[_0x2a5b('0x13')]({'message':util[_0x2a5b('0xc')](_0x2a5b('0x14'),_0x1b0893['params']['pid'])});})['catch'](handleError(_0x3b8c56,null,_0x2a5b('0x15')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index a14e16b..87138af 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 _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 +var _0x225b=['express','fs-extra','../../components/interaction/service','./tag.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x225b,0xb1));var _0xb225=function(_0x3b9ffe,_0x43d77e){_0x3b9ffe=_0x3b9ffe-0x0;var _0x3aca13=_0x225b[_0x3b9ffe];return _0x3aca13;};'use strict';var multer=require(_0xb225('0x0'));var util=require(_0xb225('0x1'));var path=require('path');var timeout=require(_0xb225('0x2'));var express=require(_0xb225('0x3'));var router=express['Router']();var fs_extra=require(_0xb225('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb225('0x5'));var config=require('../../config/environment');var controller=require(_0xb225('0x6'));router[_0xb225('0x7')]('/',auth[_0xb225('0x8')](),controller[_0xb225('0x9')]);router[_0xb225('0x7')](_0xb225('0xa'),auth[_0xb225('0x8')](),controller['show']);router[_0xb225('0xb')]('/',auth[_0xb225('0x8')](),controller[_0xb225('0xc')]);router[_0xb225('0xd')]('/:id',auth[_0xb225('0x8')](),controller[_0xb225('0xe')]);router[_0xb225('0xf')]('/:id',auth[_0xb225('0x8')](),controller[_0xb225('0x10')]);module[_0xb225('0x11')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 6157f1c..9d66c3b 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 _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 +var _0x3306=['STRING','name','#0091EA','sequelize','exports'];(function(_0x25afd8,_0x3b1b68){var _0x5cdc6c=function(_0x4da052){while(--_0x4da052){_0x25afd8['push'](_0x25afd8['shift']());}};_0x5cdc6c(++_0x3b1b68);}(_0x3306,0x107));var _0x6330=function(_0x3174a4,_0x1bcf37){_0x3174a4=_0x3174a4-0x0;var _0x18d2d7=_0x3306[_0x3174a4];return _0x18d2d7;};'use strict';var Sequelize=require(_0x6330('0x0'));module[_0x6330('0x1')]={'name':{'type':Sequelize[_0x6330('0x2')],'unique':_0x6330('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x6330('0x4')},'description':{'type':Sequelize[_0x6330('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 06f0f6c..0906d4d 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 _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 +var _0xaaa2=['keys','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','params'];(function(_0x5235be,_0xf7abdd){var _0xaab683=function(_0x2e90b3){while(--_0x2e90b3){_0x5235be['push'](_0x5235be['shift']());}};_0xaab683(++_0xf7abdd);}(_0xaaa2,0xac));var _0x2aaa=function(_0x358e63,_0x459f5f){_0x358e63=_0x358e63-0x0;var _0x358366=_0xaaa2[_0x358e63];return _0x358366;};'use strict';var emlformat=require(_0x2aaa('0x0'));var rimraf=require(_0x2aaa('0x1'));var zipdir=require(_0x2aaa('0x2'));var jsonpatch=require(_0x2aaa('0x3'));var rp=require(_0x2aaa('0x4'));var moment=require(_0x2aaa('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2aaa('0x6'));var util=require('util');var path=require(_0x2aaa('0x7'));var sox=require(_0x2aaa('0x8'));var csv=require(_0x2aaa('0x9'));var ejs=require(_0x2aaa('0xa'));var fs=require('fs');var fs_extra=require(_0x2aaa('0xb'));var _=require(_0x2aaa('0xc'));var squel=require('squel');var crypto=require(_0x2aaa('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2aaa('0x9'));var querystring=require('querystring');var Papa=require(_0x2aaa('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2aaa('0xf'));var as=require(_0x2aaa('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2aaa('0x11'))(_0x2aaa('0x12'));var utils=require(_0x2aaa('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2aaa('0x14'));var db=require(_0x2aaa('0x15'))['db'];function respondWithStatusCode(_0x8a5be3,_0x2b51f0){_0x2b51f0=_0x2b51f0||0xcc;return function(_0xd38d6d){if(_0xd38d6d){return _0x8a5be3[_0x2aaa('0x16')](_0x2b51f0);}return _0x8a5be3[_0x2aaa('0x17')](_0x2b51f0)[_0x2aaa('0x18')]();};}function respondWithResult(_0x32dfbf,_0xe22151){_0xe22151=_0xe22151||0xc8;return function(_0x314366){if(_0x314366){return _0x32dfbf[_0x2aaa('0x17')](_0xe22151)['json'](_0x314366);}};}function respondWithFilteredResult(_0x166321,_0x4df56b){return function(_0x35fbc1){if(_0x35fbc1){var _0x1a5573=typeof _0x4df56b['offset']==='undefined'&&typeof _0x4df56b['limit']===_0x2aaa('0x19');var _0x1dc0ba=_0x35fbc1[_0x2aaa('0x1a')];var _0x3b94bf=_0x1a5573?0x0:_0x4df56b[_0x2aaa('0x1b')];var _0xdaa445=_0x1a5573?_0x35fbc1[_0x2aaa('0x1a')]:_0x4df56b['offset']+_0x4df56b[_0x2aaa('0x1c')];var _0x30951c;if(_0xdaa445>=_0x1dc0ba){_0xdaa445=_0x1dc0ba;_0x30951c=0xc8;}else{_0x30951c=0xce;}_0x166321['status'](_0x30951c);return _0x166321[_0x2aaa('0x1d')]('Content-Range',_0x3b94bf+'-'+_0xdaa445+'/'+_0x1dc0ba)['json'](_0x35fbc1);}return null;};}function patchUpdates(_0x1ec32e){return function(_0x5052eb){try{jsonpatch[_0x2aaa('0x1e')](_0x5052eb,_0x1ec32e,!![]);}catch(_0x3e7649){return BPromise[_0x2aaa('0x1f')](_0x3e7649);}return _0x5052eb[_0x2aaa('0x20')]();};}function saveUpdates(_0x2c255f,_0x24da1e){return function(_0x4f581f){if(_0x4f581f){return _0x4f581f[_0x2aaa('0x21')](_0x2c255f)[_0x2aaa('0x22')](function(_0x4836b2){return _0x4836b2;});}return null;};}function removeEntity(_0x4d35aa,_0x19153e){return function(_0x4d7151){if(_0x4d7151){return _0x4d7151[_0x2aaa('0x23')]()[_0x2aaa('0x22')](function(){var _0x4e41ee=_0x4d7151[_0x2aaa('0x24')]({'plain':!![]});var _0x3b99d8='Tags';return db[_0x2aaa('0x25')][_0x2aaa('0x23')]({'where':{'type':_0x3b99d8,'resourceId':_0x4e41ee['id']}})[_0x2aaa('0x22')](function(){return _0x4d7151;});})['then'](function(){_0x4d35aa[_0x2aaa('0x17')](0xcc)[_0x2aaa('0x18')]();});}};}function handleEntityNotFound(_0x47a9fa,_0x565860){return function(_0x3af929){if(!_0x3af929){_0x47a9fa[_0x2aaa('0x16')](0x194);}return _0x3af929;};}function handleError(_0x2f9772,_0xd9891d){_0xd9891d=_0xd9891d||0x1f4;return function(_0x3a6a63){logger[_0x2aaa('0x26')](_0x3a6a63[_0x2aaa('0x27')]);if(_0x3a6a63[_0x2aaa('0x28')]){delete _0x3a6a63[_0x2aaa('0x28')];}_0x2f9772[_0x2aaa('0x17')](_0xd9891d)[_0x2aaa('0x29')](_0x3a6a63);};}exports[_0x2aaa('0x2a')]=function(_0x4f837f,_0x101b6e){var _0x5e29de={},_0xd6482a={},_0xb22a8d={'count':0x0,'rows':[]};var _0x3dd818=_[_0x2aaa('0x2b')](db[_0x2aaa('0x2c')][_0x2aaa('0x2d')],function(_0x436179){return{'name':_0x436179[_0x2aaa('0x2e')],'type':_0x436179[_0x2aaa('0x2f')][_0x2aaa('0x30')]};});_0xd6482a['model']=_['map'](_0x3dd818,'name');_0xd6482a['query']=_['keys'](_0x4f837f[_0x2aaa('0x31')]);_0xd6482a[_0x2aaa('0x32')]=_[_0x2aaa('0x33')](_0xd6482a[_0x2aaa('0x34')],_0xd6482a[_0x2aaa('0x31')]);_0x5e29de[_0x2aaa('0x35')]=_[_0x2aaa('0x33')](_0xd6482a[_0x2aaa('0x34')],qs['fields'](_0x4f837f[_0x2aaa('0x31')][_0x2aaa('0x36')]));_0x5e29de['attributes']=_0x5e29de[_0x2aaa('0x35')][_0x2aaa('0x37')]?_0x5e29de['attributes']:_0xd6482a[_0x2aaa('0x34')];if(!_0x4f837f[_0x2aaa('0x31')][_0x2aaa('0x38')](_0x2aaa('0x39'))){_0x5e29de[_0x2aaa('0x1c')]=qs[_0x2aaa('0x1c')](_0x4f837f[_0x2aaa('0x31')]['limit']);_0x5e29de['offset']=qs[_0x2aaa('0x1b')](_0x4f837f['query'][_0x2aaa('0x1b')]);}_0x5e29de[_0x2aaa('0x3a')]=qs['sort'](_0x4f837f[_0x2aaa('0x31')][_0x2aaa('0x3b')]);_0x5e29de[_0x2aaa('0x3c')]=qs['filters'](_[_0x2aaa('0x3d')](_0x4f837f[_0x2aaa('0x31')],_0xd6482a[_0x2aaa('0x32')]),_0x3dd818);if(_0x4f837f[_0x2aaa('0x31')]['filter']){_0x5e29de[_0x2aaa('0x3c')]=_[_0x2aaa('0x3e')](_0x5e29de[_0x2aaa('0x3c')],{'$or':_[_0x2aaa('0x2b')](_0x3dd818,function(_0x372cae){if(_0x372cae[_0x2aaa('0x2f')]!==_0x2aaa('0x3f')){var _0x1a7fbd={};_0x1a7fbd[_0x372cae[_0x2aaa('0x28')]]={'$like':'%'+_0x4f837f[_0x2aaa('0x31')][_0x2aaa('0x40')]+'%'};return _0x1a7fbd;}})});}_0x5e29de=_[_0x2aaa('0x3e')]({},_0x5e29de,_0x4f837f[_0x2aaa('0x41')]);var _0x54a9c8={'where':_0x5e29de[_0x2aaa('0x3c')]};return db[_0x2aaa('0x2c')][_0x2aaa('0x1a')](_0x54a9c8)['then'](function(_0x17042f){_0xb22a8d[_0x2aaa('0x1a')]=_0x17042f;if(_0x4f837f[_0x2aaa('0x31')]['includeAll']){_0x5e29de[_0x2aaa('0x42')]=[{'all':!![]}];}return db[_0x2aaa('0x2c')][_0x2aaa('0x43')](_0x5e29de);})['then'](function(_0x57554e){_0xb22a8d[_0x2aaa('0x44')]=_0x57554e;return _0xb22a8d;})[_0x2aaa('0x22')](respondWithFilteredResult(_0x101b6e,_0x5e29de))[_0x2aaa('0x45')](handleError(_0x101b6e,null));};exports['show']=function(_0x333786,_0x127a5a){var _0x2ec436={'raw':!![],'where':{'id':_0x333786[_0x2aaa('0x46')]['id']}},_0x2d639a={};_0x2d639a[_0x2aaa('0x34')]=_[_0x2aaa('0x47')](db[_0x2aaa('0x2c')]['rawAttributes']);_0x2d639a['query']=_[_0x2aaa('0x47')](_0x333786['query']);_0x2d639a[_0x2aaa('0x32')]=_['intersection'](_0x2d639a['model'],_0x2d639a['query']);_0x2ec436[_0x2aaa('0x35')]=_[_0x2aaa('0x33')](_0x2d639a['model'],qs[_0x2aaa('0x36')](_0x333786[_0x2aaa('0x31')]['fields']));_0x2ec436[_0x2aaa('0x35')]=_0x2ec436['attributes'][_0x2aaa('0x37')]?_0x2ec436[_0x2aaa('0x35')]:_0x2d639a['model'];if(_0x333786[_0x2aaa('0x31')][_0x2aaa('0x48')]){_0x2ec436[_0x2aaa('0x42')]=[{'all':!![]}];}_0x2ec436=_[_0x2aaa('0x3e')]({},_0x2ec436,_0x333786[_0x2aaa('0x41')]);return db['Tag']['find'](_0x2ec436)['then'](handleEntityNotFound(_0x127a5a,null))[_0x2aaa('0x22')](respondWithResult(_0x127a5a,null))[_0x2aaa('0x45')](handleError(_0x127a5a,null));};exports[_0x2aaa('0x49')]=function(_0x393073,_0x23290d){return db[_0x2aaa('0x2c')][_0x2aaa('0x49')](_0x393073[_0x2aaa('0x4a')],{})[_0x2aaa('0x22')](function(_0x54d9bb){var _0x22ccf0=_0x393073[_0x2aaa('0x4b')][_0x2aaa('0x24')]({'plain':!![]});if(!_0x22ccf0)throw new Error(_0x2aaa('0x4c'));if(_0x22ccf0['role']===_0x2aaa('0x4b')){var _0xe935c3=_0x54d9bb[_0x2aaa('0x24')]({'plain':!![]});var _0x5aeb05='Tags';return db[_0x2aaa('0x4d')][_0x2aaa('0x4e')]({'where':{'name':_0x5aeb05,'userProfileId':_0x22ccf0[_0x2aaa('0x4f')]},'raw':!![]})[_0x2aaa('0x22')](function(_0x4ca930){if(_0x4ca930&&_0x4ca930['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xe935c3[_0x2aaa('0x28')],'resourceId':_0xe935c3['id'],'type':_0x4ca930[_0x2aaa('0x28')],'sectionId':_0x4ca930['id']},{})[_0x2aaa('0x22')](function(){return _0x54d9bb;});}else{return _0x54d9bb;}})['catch'](function(_0x1e690d){logger[_0x2aaa('0x26')](_0x2aaa('0x50'),_0x1e690d);throw _0x1e690d;});}return _0x54d9bb;})[_0x2aaa('0x22')](respondWithResult(_0x23290d,0xc9))[_0x2aaa('0x45')](handleError(_0x23290d,null));};exports[_0x2aaa('0x21')]=function(_0x1c74de,_0x5f3ebb){if(_0x1c74de[_0x2aaa('0x4a')]['id']){delete _0x1c74de['body']['id'];}return db['Tag'][_0x2aaa('0x4e')]({'where':{'id':_0x1c74de[_0x2aaa('0x46')]['id']}})[_0x2aaa('0x22')](handleEntityNotFound(_0x5f3ebb,null))[_0x2aaa('0x22')](saveUpdates(_0x1c74de[_0x2aaa('0x4a')],null))['then'](respondWithResult(_0x5f3ebb,null))[_0x2aaa('0x45')](handleError(_0x5f3ebb,null));};exports[_0x2aaa('0x23')]=function(_0x1a5d71,_0x2639f4){return db[_0x2aaa('0x2c')][_0x2aaa('0x4e')]({'where':{'id':_0x1a5d71[_0x2aaa('0x46')]['id']}})[_0x2aaa('0x22')](handleEntityNotFound(_0x2639f4,null))[_0x2aaa('0x22')](removeEntity(_0x2639f4,null))[_0x2aaa('0x45')](handleError(_0x2639f4,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index b187037..99915f6 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 _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 +var _0xd8c4=['bluebird','path','rimraf','exports','define','Tag','lodash','api','moment'];(function(_0x22e18d,_0x5b9f41){var _0x5473e6=function(_0x5cdf7c){while(--_0x5cdf7c){_0x22e18d['push'](_0x22e18d['shift']());}};_0x5473e6(++_0x5b9f41);}(_0xd8c4,0x126));var _0x4d8c=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xd8c4[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0x4d8c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4d8c('0x1'));var moment=require(_0x4d8c('0x2'));var BPromise=require(_0x4d8c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4d8c('0x4'));var rimraf=require(_0x4d8c('0x5'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0x4d8c('0x6')]=function(_0x3c8258,_0x4ec848){return _0x3c8258[_0x4d8c('0x7')](_0x4d8c('0x8'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index d0b8106..eabc2cf 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 _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 +var _0x8d0e=['info','Tag,\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(_0x36fb81,_0x34bcdb){var _0x61e477=function(_0x1852d8){while(--_0x1852d8){_0x36fb81['push'](_0x36fb81['shift']());}};_0x61e477(++_0x34bcdb);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x300272,_0x45ec90){_0x300272=_0x300272-0x0;var _0x346323=_0x8d0e[_0x300272];return _0x346323;};'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']('Tag,\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')]('Tag,\x20%s,\x20%s',_0x469d37,_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);return _0x13aa63(_0x5605a0['error'][_0xe8d0('0x13')]);}logger['error']('Tag,\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')]('Tag,\x20%s,\x20%s',_0x469d37,_0x3c526c);_0x13aa63(_0x3c526c);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 89128e9..b27e62a 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_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 +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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 7d6b473..791195b 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['STRING','name'];(function(_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 +var _0x757a=['exports','STRING'];(function(_0x2e6423,_0x4a4f4b){var _0x3e70d9=function(_0x33d026){while(--_0x33d026){_0x2e6423['push'](_0x2e6423['shift']());}};_0x3e70d9(++_0x4a4f4b);}(_0x757a,0xde));var _0xa757=function(_0x14ca7f,_0x258d2a){_0x14ca7f=_0x14ca7f-0x0;var _0x52a251=_0x757a[_0x14ca7f];return _0x52a251;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 62d3019..08c859c 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 _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 +var _0x2b81=['save','then','stack','name','index','map','Team','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','catch','include','find','create','body','user','get','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','UserId','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','QueryTypes','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','send','getQueues','channel','isValidChannel','ValidationError','Unknown\x20channel','Queue','capitalize','Queues','addQueues','findOne','toLowerCase','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Mail','Fax','Openchannel','Whatsapp','through','penalty','QueueId','TeamVoiceQueue','findOrCreate','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','spread','removeAgents','Sms','Queue:remove','getAgents','User','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','status','end','json','offset','count','set','Content-Range','apply','reject'];(function(_0x31d721,_0x5ad391){var _0x331be2=function(_0x3abc00){while(--_0x3abc00){_0x31d721['push'](_0x31d721['shift']());}};_0x331be2(++_0x5ad391);}(_0x2b81,0x11b));var _0x12b8=function(_0x84a85,_0x54e55c){_0x84a85=_0x84a85-0x0;var _0x1c2943=_0x2b81[_0x84a85];return _0x1c2943;};'use strict';var emlformat=require(_0x12b8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x12b8('0x1'));var jsonpatch=require(_0x12b8('0x2'));var rp=require(_0x12b8('0x3'));var moment=require(_0x12b8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x12b8('0x5'));var util=require(_0x12b8('0x6'));var path=require(_0x12b8('0x7'));var sox=require(_0x12b8('0x8'));var csv=require('to-csv');var ejs=require(_0x12b8('0x9'));var fs=require('fs');var fs_extra=require(_0x12b8('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x12b8('0xb'));var jsforce=require(_0x12b8('0xc'));var deskjs=require(_0x12b8('0xd'));var toCsv=require(_0x12b8('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x12b8('0xf'));var authService=require(_0x12b8('0x10'));var qs=require(_0x12b8('0x11'));var as=require(_0x12b8('0x12'));var hardwareService=require(_0x12b8('0x13'));var logger=require('../../config/logger')(_0x12b8('0x14'));var utils=require(_0x12b8('0x15'));var config=require(_0x12b8('0x16'));var licenseUtil=require(_0x12b8('0x17'));var db=require(_0x12b8('0x18'))['db'];config['redis']=_[_0x12b8('0x19')](config[_0x12b8('0x1a')],{'host':_0x12b8('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./team.socket')['register'](socket);function respondWithStatusCode(_0x27ea3e,_0x1815a8){_0x1815a8=_0x1815a8||0xcc;return function(_0x4a3a03){if(_0x4a3a03){return _0x27ea3e['sendStatus'](_0x1815a8);}return _0x27ea3e[_0x12b8('0x1c')](_0x1815a8)[_0x12b8('0x1d')]();};}function respondWithResult(_0x410f55,_0x3d2fbd){_0x3d2fbd=_0x3d2fbd||0xc8;return function(_0x1f71a6){if(_0x1f71a6){return _0x410f55['status'](_0x3d2fbd)[_0x12b8('0x1e')](_0x1f71a6);}};}function respondWithFilteredResult(_0x164e9d,_0xabe979){return function(_0x5b2061){if(_0x5b2061){var _0x36ab3b=typeof _0xabe979[_0x12b8('0x1f')]==='undefined'&&typeof _0xabe979['limit']==='undefined';var _0x22f6d1=_0x5b2061['count'];var _0x1fca43=_0x36ab3b?0x0:_0xabe979['offset'];var _0xa86ca5=_0x36ab3b?_0x5b2061[_0x12b8('0x20')]:_0xabe979[_0x12b8('0x1f')]+_0xabe979['limit'];var _0x4ede16;if(_0xa86ca5>=_0x22f6d1){_0xa86ca5=_0x22f6d1;_0x4ede16=0xc8;}else{_0x4ede16=0xce;}_0x164e9d['status'](_0x4ede16);return _0x164e9d[_0x12b8('0x21')](_0x12b8('0x22'),_0x1fca43+'-'+_0xa86ca5+'/'+_0x22f6d1)[_0x12b8('0x1e')](_0x5b2061);}return null;};}function patchUpdates(_0x179cb5){return function(_0xd42dc){try{jsonpatch[_0x12b8('0x23')](_0xd42dc,_0x179cb5,!![]);}catch(_0xe0c238){return BPromise[_0x12b8('0x24')](_0xe0c238);}return _0xd42dc[_0x12b8('0x25')]();};}function saveUpdates(_0x1828c2,_0x38e3b0){return function(_0x37fe7c){if(_0x37fe7c){return _0x37fe7c['update'](_0x1828c2)[_0x12b8('0x26')](function(_0x5c933a){return _0x5c933a;});}return null;};}function handleEntityNotFound(_0x43743e,_0x1a36b1){return function(_0x2735c7){if(!_0x2735c7){_0x43743e['sendStatus'](0x194);}return _0x2735c7;};}function handleError(_0xf0a71d,_0x26067b){_0x26067b=_0x26067b||0x1f4;return function(_0x47aea9){logger['error'](_0x47aea9[_0x12b8('0x27')]);if(_0x47aea9[_0x12b8('0x28')]){delete _0x47aea9[_0x12b8('0x28')];}_0xf0a71d[_0x12b8('0x1c')](_0x26067b)['send'](_0x47aea9);};}exports[_0x12b8('0x29')]=function(_0x2c68af,_0x51dbee){var _0x317d46={},_0x264487={},_0x36446c={'count':0x0,'rows':[]};var _0x252011=_[_0x12b8('0x2a')](db[_0x12b8('0x2b')][_0x12b8('0x2c')],function(_0xfd3f9d){return{'name':_0xfd3f9d[_0x12b8('0x2d')],'type':_0xfd3f9d[_0x12b8('0x2e')]['key']};});_0x264487['model']=_[_0x12b8('0x2a')](_0x252011,_0x12b8('0x28'));_0x264487[_0x12b8('0x2f')]=_[_0x12b8('0x30')](_0x2c68af[_0x12b8('0x2f')]);_0x264487[_0x12b8('0x31')]=_[_0x12b8('0x32')](_0x264487[_0x12b8('0x33')],_0x264487[_0x12b8('0x2f')]);_0x317d46[_0x12b8('0x34')]=_[_0x12b8('0x32')](_0x264487[_0x12b8('0x33')],qs['fields'](_0x2c68af[_0x12b8('0x2f')][_0x12b8('0x35')]));_0x317d46[_0x12b8('0x34')]=_0x317d46['attributes'][_0x12b8('0x36')]?_0x317d46[_0x12b8('0x34')]:_0x264487[_0x12b8('0x33')];if(!_0x2c68af[_0x12b8('0x2f')][_0x12b8('0x37')]('nolimit')){_0x317d46[_0x12b8('0x38')]=qs[_0x12b8('0x38')](_0x2c68af[_0x12b8('0x2f')][_0x12b8('0x38')]);_0x317d46[_0x12b8('0x1f')]=qs[_0x12b8('0x1f')](_0x2c68af[_0x12b8('0x2f')][_0x12b8('0x1f')]);}_0x317d46[_0x12b8('0x39')]=qs[_0x12b8('0x3a')](_0x2c68af[_0x12b8('0x2f')][_0x12b8('0x3a')]);_0x317d46['where']=qs[_0x12b8('0x31')](_[_0x12b8('0x3b')](_0x2c68af[_0x12b8('0x2f')],_0x264487[_0x12b8('0x31')]),_0x252011);if(_0x2c68af['query'][_0x12b8('0x3c')]){_0x317d46[_0x12b8('0x3d')]=_[_0x12b8('0x3e')](_0x317d46[_0x12b8('0x3d')],{'$or':_[_0x12b8('0x2a')](_0x252011,function(_0x57fda9){if(_0x57fda9['type']!=='VIRTUAL'){var _0xa7d730={};_0xa7d730[_0x57fda9['name']]={'$like':'%'+_0x2c68af['query'][_0x12b8('0x3c')]+'%'};return _0xa7d730;}})});}_0x317d46=_['merge']({},_0x317d46,_0x2c68af[_0x12b8('0x3f')]);var _0x55f3fe={'where':_0x317d46[_0x12b8('0x3d')]};return db['Team'][_0x12b8('0x20')](_0x55f3fe)[_0x12b8('0x26')](function(_0x4ad13f){_0x36446c[_0x12b8('0x20')]=_0x4ad13f;if(_0x2c68af[_0x12b8('0x2f')][_0x12b8('0x40')]){_0x317d46['include']=[{'all':!![]}];}return db[_0x12b8('0x2b')][_0x12b8('0x41')](_0x317d46);})[_0x12b8('0x26')](function(_0x28cd2e){_0x36446c[_0x12b8('0x42')]=_0x28cd2e;return _0x36446c;})[_0x12b8('0x26')](respondWithFilteredResult(_0x51dbee,_0x317d46))[_0x12b8('0x43')](handleError(_0x51dbee,null));};exports['show']=function(_0x1eda9a,_0x1931a7){var _0x18941a={'raw':![],'where':{'id':_0x1eda9a['params']['id']}},_0x13cf9c={};_0x13cf9c[_0x12b8('0x33')]=_[_0x12b8('0x30')](db[_0x12b8('0x2b')]['rawAttributes']);_0x13cf9c[_0x12b8('0x2f')]=_[_0x12b8('0x30')](_0x1eda9a['query']);_0x13cf9c[_0x12b8('0x31')]=_['intersection'](_0x13cf9c[_0x12b8('0x33')],_0x13cf9c[_0x12b8('0x2f')]);_0x18941a['attributes']=_[_0x12b8('0x32')](_0x13cf9c[_0x12b8('0x33')],qs[_0x12b8('0x35')](_0x1eda9a[_0x12b8('0x2f')][_0x12b8('0x35')]));_0x18941a[_0x12b8('0x34')]=_0x18941a[_0x12b8('0x34')][_0x12b8('0x36')]?_0x18941a[_0x12b8('0x34')]:_0x13cf9c[_0x12b8('0x33')];if(_0x1eda9a[_0x12b8('0x2f')]['includeAll']){_0x18941a[_0x12b8('0x44')]=[{'all':!![]}];}_0x18941a=_[_0x12b8('0x3e')]({},_0x18941a,_0x1eda9a[_0x12b8('0x3f')]);return db[_0x12b8('0x2b')][_0x12b8('0x45')](_0x18941a)['then'](handleEntityNotFound(_0x1931a7,null))[_0x12b8('0x26')](respondWithResult(_0x1931a7,null))[_0x12b8('0x43')](handleError(_0x1931a7,null));};exports[_0x12b8('0x46')]=function(_0x2be0ff,_0x1c1adf){return db[_0x12b8('0x2b')]['create'](_0x2be0ff[_0x12b8('0x47')],{})[_0x12b8('0x26')](function(_0xe56c43){var _0x105949=_0x2be0ff[_0x12b8('0x48')][_0x12b8('0x49')]({'plain':!![]});if(!_0x105949)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x105949[_0x12b8('0x4a')]===_0x12b8('0x48')){var _0x12b736=_0xe56c43['get']({'plain':!![]});var _0x255e7f=_0x12b8('0x4b');return db[_0x12b8('0x4c')][_0x12b8('0x45')]({'where':{'name':_0x255e7f,'userProfileId':_0x105949[_0x12b8('0x4d')]},'raw':!![]})['then'](function(_0x5ebbca){if(_0x5ebbca&&_0x5ebbca[_0x12b8('0x4e')]===0x0){return db[_0x12b8('0x4f')][_0x12b8('0x46')]({'name':_0x12b736['name'],'resourceId':_0x12b736['id'],'type':_0x5ebbca['name'],'sectionId':_0x5ebbca['id']},{})[_0x12b8('0x26')](function(){return _0xe56c43;});}else{return _0xe56c43;}})[_0x12b8('0x43')](function(_0x934ba6){logger[_0x12b8('0x50')](_0x12b8('0x51'),_0x934ba6);throw _0x934ba6;});}return _0xe56c43;})['then'](respondWithResult(_0x1c1adf,0xc9))['catch'](handleError(_0x1c1adf,null));};exports[_0x12b8('0x52')]=function(_0x29af0d,_0x4f1c5c){if(_0x29af0d[_0x12b8('0x47')]['id']){delete _0x29af0d[_0x12b8('0x47')]['id'];}return db[_0x12b8('0x2b')]['find']({'where':{'id':_0x29af0d[_0x12b8('0x53')]['id']}})[_0x12b8('0x26')](handleEntityNotFound(_0x4f1c5c,null))[_0x12b8('0x26')](saveUpdates(_0x29af0d['body'],null))[_0x12b8('0x26')](respondWithResult(_0x4f1c5c,null))[_0x12b8('0x43')](handleError(_0x4f1c5c,null));};exports[_0x12b8('0x54')]=function(_0x120482,_0x1f5573){var _0xeacf5=_0x120482[_0x12b8('0x53')]['id'];var _0x20a2b1=[];return db[_0x12b8('0x55')][_0x12b8('0x56')](function(_0x571e96){var _0x33c554=_0x12b8('0x57')+_0xeacf5;return db[_0x12b8('0x55')]['query'](_0x33c554,{'type':db[_0x12b8('0x58')]['QueryTypes'][_0x12b8('0x59')],'raw':!![],'transaction':_0x571e96})[_0x12b8('0x26')](function(_0x4374d6){_0x20a2b1=_['map'](_0x4374d6,function(_0x216813){return Number(_0x216813[_0x12b8('0x5a')]);});})['then'](function(){var _0x1015b7=_0x12b8('0x5b')+_0xeacf5;return db[_0x12b8('0x55')][_0x12b8('0x2f')](_0x1015b7,{'type':db['Sequelize']['QueryTypes'][_0x12b8('0x59')],'raw':!![],'transaction':_0x571e96});})['then'](function(_0x579363){var _0x361840=_[_0x12b8('0x2a')](_0x579363,function(_0x227502){return Number(_0x227502[_0x12b8('0x5c')]);});return db[_0x12b8('0x5d')][_0x12b8('0x54')]({'where':{'UserId':{'$in':_0x20a2b1},'VoiceQueueId':{'$in':_0x361840}},'transaction':_0x571e96});})[_0x12b8('0x26')](function(){var _0x2ba9a4=_0x12b8('0x5e')+_0xeacf5;return db[_0x12b8('0x55')][_0x12b8('0x2f')](_0x2ba9a4,{'type':db[_0x12b8('0x58')]['QueryTypes'][_0x12b8('0x59')],'raw':!![],'transaction':_0x571e96});})['then'](function(_0x1bb6d4){var _0x1b95b0=_[_0x12b8('0x2a')](_0x1bb6d4,function(_0x53ec0f){return Number(_0x53ec0f[_0x12b8('0x5f')]);});return db[_0x12b8('0x60')][_0x12b8('0x54')]({'where':{'UserId':{'$in':_0x20a2b1},'MailQueueId':{'$in':_0x1b95b0}},'transaction':_0x571e96});})[_0x12b8('0x26')](function(){var _0x59ff3e=_0x12b8('0x61')+_0xeacf5;return db[_0x12b8('0x55')]['query'](_0x59ff3e,{'type':db['Sequelize'][_0x12b8('0x62')][_0x12b8('0x59')],'raw':!![],'transaction':_0x571e96});})['then'](function(_0x480197){var _0x44b408=_[_0x12b8('0x2a')](_0x480197,function(_0x1022aa){return Number(_0x1022aa[_0x12b8('0x63')]);});return db[_0x12b8('0x64')][_0x12b8('0x54')]({'where':{'UserId':{'$in':_0x20a2b1},'SmsQueueId':{'$in':_0x44b408}},'transaction':_0x571e96});})[_0x12b8('0x26')](function(){var _0x40be9c=_0x12b8('0x65')+_0xeacf5;return db[_0x12b8('0x55')][_0x12b8('0x2f')](_0x40be9c,{'type':db[_0x12b8('0x58')][_0x12b8('0x62')]['SELECT'],'raw':!![],'transaction':_0x571e96});})[_0x12b8('0x26')](function(_0x1b32db){var _0x2705b3=_[_0x12b8('0x2a')](_0x1b32db,function(_0x35e17a){return Number(_0x35e17a[_0x12b8('0x66')]);});return db[_0x12b8('0x67')]['destroy']({'where':{'UserId':{'$in':_0x20a2b1},'ChatQueueId':{'$in':_0x2705b3}},'transaction':_0x571e96});})[_0x12b8('0x26')](function(){var _0x26e731=_0x12b8('0x68')+_0xeacf5;return db[_0x12b8('0x55')][_0x12b8('0x2f')](_0x26e731,{'type':db[_0x12b8('0x58')][_0x12b8('0x62')][_0x12b8('0x59')],'raw':!![],'transaction':_0x571e96});})['then'](function(_0x9b5882){var _0x571de2=_['map'](_0x9b5882,function(_0x5cac32){return Number(_0x5cac32[_0x12b8('0x69')]);});return db[_0x12b8('0x6a')][_0x12b8('0x54')]({'where':{'UserId':{'$in':_0x20a2b1},'FaxQueueId':{'$in':_0x571de2}},'transaction':_0x571e96});})['then'](function(){var _0x3e277f=_0x12b8('0x6b')+_0xeacf5;return db[_0x12b8('0x55')][_0x12b8('0x2f')](_0x3e277f,{'type':db['Sequelize']['QueryTypes'][_0x12b8('0x59')],'raw':!![],'transaction':_0x571e96});})[_0x12b8('0x26')](function(_0x42e8be){var _0x39c181=_[_0x12b8('0x2a')](_0x42e8be,function(_0x416c23){return Number(_0x416c23[_0x12b8('0x6c')]);});return db[_0x12b8('0x6d')][_0x12b8('0x54')]({'where':{'UserId':{'$in':_0x20a2b1},'OpenchannelQueueId':{'$in':_0x39c181}},'transaction':_0x571e96});})['then'](function(){var _0x52a078=_0x12b8('0x6e')+_0xeacf5;return db[_0x12b8('0x55')][_0x12b8('0x2f')](_0x52a078,{'type':db[_0x12b8('0x58')][_0x12b8('0x62')][_0x12b8('0x59')],'raw':!![],'transaction':_0x571e96});})[_0x12b8('0x26')](function(_0x40a984){var _0x3af680=_[_0x12b8('0x2a')](_0x40a984,function(_0x29912b){return Number(_0x29912b['WhatsappQueueId']);});return db[_0x12b8('0x6f')][_0x12b8('0x54')]({'where':{'UserId':{'$in':_0x20a2b1},'WhatsappQueueId':{'$in':_0x3af680}},'transaction':_0x571e96});})[_0x12b8('0x26')](function(){return db[_0x12b8('0x70')][_0x12b8('0x45')]({'where':{'TeamId':_0xeacf5}});})[_0x12b8('0x26')](function(_0x4d094f){if(_0x4d094f===null){return;}return db[_0x12b8('0x71')][_0x12b8('0x54')]({'where':{'UserId':{'$in':_0x20a2b1},'VoicePrefixId':_0x4d094f[_0x12b8('0x72')]},'transaction':_0x571e96});})[_0x12b8('0x26')](function(){return db[_0x12b8('0x2b')]['destroy']({'where':{'id':_0xeacf5},'cascade':!![],'transaction':_0x571e96});})[_0x12b8('0x26')](function(_0x2ea66e){if(_0x2ea66e===0x0){_0x1f5573['sendStatus'](0x194);}else{return db[_0x12b8('0x4f')][_0x12b8('0x54')]({'where':{'type':_0x12b8('0x4b'),'resourceId':_0xeacf5},'cascade':!![],'transaction':_0x571e96})[_0x12b8('0x26')](function(){_0x1f5573[_0x12b8('0x1c')](0xcc)['end']();});}})['catch'](function(_0x25b044){_0x1f5573['status'](0x1f4)[_0x12b8('0x73')](_0x25b044);});});};exports[_0x12b8('0x74')]=function(_0x3261f7,_0x3173e7,_0x8d3d4){return db[_0x12b8('0x2b')]['findOne']({'where':{'id':_0x3261f7[_0x12b8('0x53')]['id']}})[_0x12b8('0x26')](handleEntityNotFound(_0x3173e7,null))['then'](function(_0x63cf5){if(!_0x3261f7[_0x12b8('0x2f')][_0x12b8('0x75')]||!utils[_0x12b8('0x76')](_0x3261f7[_0x12b8('0x2f')][_0x12b8('0x75')])){throw new db[(_0x12b8('0x58'))][(_0x12b8('0x77'))](_0x12b8('0x78'));}var _0x3f733e={};var _0x40455a={};_0x40455a[_0x12b8('0x33')]=_[_0x12b8('0x30')](db[_['capitalize'](_0x3261f7['query']['channel']['toLowerCase']())+_0x12b8('0x79')][_0x12b8('0x2c')]);_0x40455a[_0x12b8('0x2f')]=_[_0x12b8('0x30')](_0x3261f7[_0x12b8('0x2f')]);_0x40455a[_0x12b8('0x31')]=_[_0x12b8('0x32')](_0x40455a[_0x12b8('0x33')],_0x40455a['query']);_0x3f733e[_0x12b8('0x34')]=_[_0x12b8('0x32')](_0x40455a['model'],qs[_0x12b8('0x35')](_0x3261f7[_0x12b8('0x2f')][_0x12b8('0x35')]));_0x3f733e['attributes']=_0x3f733e['attributes']['length']?_0x3f733e['attributes']:_0x40455a[_0x12b8('0x33')];_0x3f733e[_0x12b8('0x38')]=qs[_0x12b8('0x38')](_0x3261f7[_0x12b8('0x2f')]['limit']);_0x3f733e[_0x12b8('0x1f')]=qs[_0x12b8('0x1f')](_0x3261f7[_0x12b8('0x2f')][_0x12b8('0x1f')]);_0x3f733e[_0x12b8('0x39')]=qs['sort'](_0x3261f7[_0x12b8('0x2f')][_0x12b8('0x3a')]);_0x3f733e[_0x12b8('0x3d')]=qs[_0x12b8('0x31')](_[_0x12b8('0x3b')](_0x3261f7[_0x12b8('0x2f')],_0x40455a['filters']));_0x3f733e=_[_0x12b8('0x3e')]({},_0x3f733e,_0x3261f7[_0x12b8('0x3f')]);return _0x63cf5[_0x12b8('0x49')+_[_0x12b8('0x7a')](_0x3261f7[_0x12b8('0x2f')][_0x12b8('0x75')]['toLowerCase']())+_0x12b8('0x7b')](_0x3f733e);})[_0x12b8('0x26')](respondWithResult(_0x3173e7,null))[_0x12b8('0x43')](handleError(_0x3173e7,null));};exports[_0x12b8('0x7c')]=function(_0x37bfef,_0xb013e1,_0xcd95b4){return db[_0x12b8('0x2b')][_0x12b8('0x7d')]({'where':{'id':_0x37bfef['params']['id']}})[_0x12b8('0x26')](function(_0x5f97b4){if(_0x5f97b4){if(!_0x37bfef[_0x12b8('0x47')]['channel']||!utils[_0x12b8('0x76')](_0x37bfef[_0x12b8('0x47')][_0x12b8('0x75')])){throw new db[(_0x12b8('0x58'))][(_0x12b8('0x77'))](_0x12b8('0x78'));}return _0x5f97b4['add'+_[_0x12b8('0x7a')](_0x37bfef[_0x12b8('0x47')][_0x12b8('0x75')][_0x12b8('0x7e')]())+_0x12b8('0x7b')](_0x37bfef[_0x12b8('0x47')][_0x12b8('0x7f')]);}return null;})['then'](handleEntityNotFound(_0xb013e1,null))['then'](respondWithStatusCode(_0xb013e1,null))['catch'](handleError(_0xb013e1,null));};exports[_0x12b8('0x80')]=function(_0x3ed924,_0x3c470a,_0x254897){return db[_0x12b8('0x2b')][_0x12b8('0x7d')]({'where':{'id':_0x3ed924[_0x12b8('0x53')]['id']}})['then'](function(_0x2b6e1f){if(_0x2b6e1f){if(!_0x3ed924[_0x12b8('0x2f')]['channel']||!utils[_0x12b8('0x76')](_0x3ed924[_0x12b8('0x2f')][_0x12b8('0x75')])){throw new db[(_0x12b8('0x58'))][(_0x12b8('0x77'))](_0x12b8('0x78'));}return _0x2b6e1f[_0x12b8('0x81')+_[_0x12b8('0x7a')](_0x3ed924['query'][_0x12b8('0x75')]['toLowerCase']())+_0x12b8('0x7b')](_0x3ed924[_0x12b8('0x2f')]['ids']);}return null;})[_0x12b8('0x26')](handleEntityNotFound(_0x3c470a,null))[_0x12b8('0x26')](respondWithStatusCode(_0x3c470a,null))['catch'](handleError(_0x3c470a,null));};exports[_0x12b8('0x82')]=function(_0x244713,_0x25836b){var _0x666da1=_[_0x12b8('0x83')](_0x244713[_0x12b8('0x47')][_0x12b8('0x7f')])?_0x244713[_0x12b8('0x47')][_0x12b8('0x7f')]:[_0x244713[_0x12b8('0x47')][_0x12b8('0x7f')]];var _0x598c47=_0x244713[_0x12b8('0x53')]['id'];return db[_0x12b8('0x2b')][_0x12b8('0x45')]({'where':{'id':_0x598c47}})['then'](handleEntityNotFound(_0x25836b,null))[_0x12b8('0x26')](function(_0x201e4a){if(_0x201e4a){var _0x2e2018=[_0x12b8('0x84'),_0x12b8('0x85'),_0x12b8('0x86'),'Sms',_0x12b8('0x87'),_0x12b8('0x88'),_0x12b8('0x89')];return db[_0x12b8('0x55')]['transaction'](function(_0x884699){var _0x254d81=_[_0x12b8('0x2a')](_0x2e2018,function(_0x4b6ef4){var _0x502639={'attributes':['id',_0x12b8('0x28')]};if(_0x4b6ef4===_0x12b8('0x84')){_0x502639[_0x12b8('0x8a')]={'attributes':[_0x12b8('0x8b')]};}return _0x201e4a[_0x12b8('0x49')+_0x4b6ef4+'Queues'](_0x502639)[_0x12b8('0x26')](function(_0x894304){var _0x205932=_['map'](_0x894304,function(_0x4f9f6e){var _0x4b1464=_[_0x12b8('0x2a')](_0x666da1,function(_0x315a3f){var _0x580214={'where':{'UserId':_0x315a3f,[_0x4b6ef4+_0x12b8('0x8c')]:_0x4f9f6e['id']},'transaction':_0x884699};if(_0x4b6ef4===_0x12b8('0x84')){_0x580214[_0x12b8('0x19')]={'penalty':_0x4f9f6e[_0x12b8('0x8d')][_0x12b8('0x8b')]};}return db['User'+_0x4b6ef4+_0x12b8('0x79')][_0x12b8('0x8e')](_0x580214)['then'](function(){socket[_0x12b8('0x8f')](_0x12b8('0x48')+_0x4b6ef4+_0x12b8('0x90'),{'UserId':_0x315a3f,[_0x4b6ef4+_0x12b8('0x8c')]:_0x4f9f6e['id']});if(_0x4b6ef4!==_0x12b8('0x84')){return;}return db['User'][_0x12b8('0x41')]({'where':{'id':_0x666da1,'online':0x1},'attributes':['id',_0x12b8('0x28'),_0x12b8('0x91'),_0x12b8('0x92'),_0x12b8('0x93')],'raw':!![]})['then'](function(_0x49c3ac){var _0x58abb5=_[_0x12b8('0x2a')](_0x49c3ac,function(_0x7b51b2){return db[_0x12b8('0x94')][_0x12b8('0x95')]({'membername':_0x7b51b2[_0x12b8('0x28')],'UserId':_0x7b51b2['id'],'queue_name':_0x4f9f6e['name'],'VoiceQueueId':_0x4f9f6e['id'],'interface':_[_0x12b8('0x96')](_0x7b51b2[_0x12b8('0x93')])?util[_0x12b8('0x97')](_0x12b8('0x98'),_0x7b51b2['name']):_0x7b51b2[_0x12b8('0x93')],'paused':_0x7b51b2[_0x12b8('0x92')]||![],'penalty':_0x4f9f6e['TeamVoiceQueue'][_0x12b8('0x8b')]},{'transaction':_0x884699});});return Promise[_0x12b8('0x99')](_0x58abb5);});});});return Promise['all'](_0x4b1464);});return Promise['all'](_0x205932);})['then'](function(){return db[_0x12b8('0x70')][_0x12b8('0x7d')]({'where':{'teamId':_0x598c47}})['then'](function(_0x32d23e){if(_0x32d23e){var _0x3c6d06=_[_0x12b8('0x2a')](_0x666da1,function(_0x4a990e){db['UserVoicePrefix']['upsert']({'UserId':_0x4a990e,'VoicePrefixId':_0x32d23e['VoicePrefixId']});});return Promise[_0x12b8('0x99')](_0x3c6d06);}});});});return Promise[_0x12b8('0x99')](_0x254d81)['then'](function(){return _0x201e4a[_0x12b8('0x82')](_0x666da1,{'transaction':_0x884699})[_0x12b8('0x9a')](function(_0x5a7d98){return _0x5a7d98;});});});}})[_0x12b8('0x26')](respondWithResult(_0x25836b,null))[_0x12b8('0x43')](handleError(_0x25836b,null));};exports[_0x12b8('0x9b')]=function(_0x15ff51,_0x264ff0){var _0x57f442=_[_0x12b8('0x83')](_0x15ff51[_0x12b8('0x2f')][_0x12b8('0x7f')])?_0x15ff51[_0x12b8('0x2f')][_0x12b8('0x7f')]:[_0x15ff51['query'][_0x12b8('0x7f')]];var _0x9ba81e=_0x15ff51[_0x12b8('0x53')]['id'];return db[_0x12b8('0x2b')][_0x12b8('0x45')]({'where':{'id':_0x9ba81e}})[_0x12b8('0x26')](handleEntityNotFound(_0x264ff0,null))[_0x12b8('0x26')](function(_0x277093){if(_0x277093){var _0x5da14c=[_0x12b8('0x84'),_0x12b8('0x85'),_0x12b8('0x86'),_0x12b8('0x9c'),_0x12b8('0x87'),_0x12b8('0x88'),_0x12b8('0x89')];return db[_0x12b8('0x55')][_0x12b8('0x56')](function(_0x2de3b1){var _0x336f54=_['map'](_0x5da14c,function(_0x3690f6){var _0x51a2b2={'attributes':['id',_0x12b8('0x28')]};return _0x277093[_0x12b8('0x49')+_0x3690f6+_0x12b8('0x7b')](_0x51a2b2)[_0x12b8('0x26')](function(_0x43ae83){var _0x10b255=_[_0x12b8('0x2a')](_0x43ae83,function(_0x1867d8){return _0x1867d8[_0x12b8('0x9b')](_0x57f442,{'transaction':_0x2de3b1})[_0x12b8('0x26')](function(){var _0x408cf0=_[_0x12b8('0x2a')](_0x57f442,function(_0x35e4e3){socket['emit'](_0x12b8('0x48')+_0x3690f6+_0x12b8('0x9d'),{'UserId':Number(_0x35e4e3),[_0x3690f6+_0x12b8('0x8c')]:_0x1867d8['id']});if(_0x3690f6!==_0x12b8('0x84')){return;}return db['UserVoiceQueueRt'][_0x12b8('0x54')]({'where':{'VoiceQueueId':_0x1867d8['id'],'UserId':_0x35e4e3},'transaction':_0x2de3b1});});return Promise[_0x12b8('0x99')](_0x408cf0);});});return Promise[_0x12b8('0x99')](_0x10b255);});});return Promise[_0x12b8('0x99')](_0x336f54)['then'](function(){return _0x277093['removeAgents'](_0x57f442,{'transaction':_0x2de3b1});})[_0x12b8('0x26')](function(){return db[_0x12b8('0x70')][_0x12b8('0x7d')]({'where':{'teamId':_0x9ba81e}})['then'](function(_0x484cac){if(_0x484cac){var _0x3b490e=_[_0x12b8('0x2a')](_0x57f442,function(_0x7b5658){db['UserVoicePrefix'][_0x12b8('0x54')]({'where':{'UserId':_0x7b5658,'VoicePrefixId':_0x484cac[_0x12b8('0x72')]}});});return Promise['all'](_0x3b490e);}});});});}})[_0x12b8('0x26')](respondWithStatusCode(_0x264ff0,null))[_0x12b8('0x43')](handleError(_0x264ff0,null));};exports[_0x12b8('0x9e')]=function(_0x5e8bee,_0xb1855a,_0x1bb2c3){var _0x99336e={};var _0x231c17={};var _0x2b9ea5;var _0x148503;return db[_0x12b8('0x2b')][_0x12b8('0x7d')]({'where':{'id':_0x5e8bee[_0x12b8('0x53')]['id']}})[_0x12b8('0x26')](handleEntityNotFound(_0xb1855a,null))[_0x12b8('0x26')](function(_0x46f11a){if(_0x46f11a){_0x2b9ea5=_0x46f11a;_0x231c17[_0x12b8('0x33')]=_[_0x12b8('0x30')](db[_0x12b8('0x9f')][_0x12b8('0x2c')]);_0x231c17['query']=_[_0x12b8('0x30')](_0x5e8bee['query']);_0x231c17[_0x12b8('0x31')]=_[_0x12b8('0x32')](_0x231c17[_0x12b8('0x33')],_0x231c17[_0x12b8('0x2f')]);_0x99336e[_0x12b8('0x34')]=_[_0x12b8('0x32')](_0x231c17['model'],qs['fields'](_0x5e8bee[_0x12b8('0x2f')]['fields']));_0x99336e[_0x12b8('0x34')]=_0x99336e['attributes'][_0x12b8('0x36')]?_0x99336e[_0x12b8('0x34')]:_0x231c17[_0x12b8('0x33')];_0x99336e[_0x12b8('0x39')]=qs[_0x12b8('0x3a')](_0x5e8bee[_0x12b8('0x2f')][_0x12b8('0x3a')]);_0x99336e['where']=qs['filters'](_[_0x12b8('0x3b')](_0x5e8bee[_0x12b8('0x2f')],_0x231c17['filters']));if(_0x5e8bee[_0x12b8('0x2f')]['filter']){_0x99336e[_0x12b8('0x3d')]=_[_0x12b8('0x3e')](_0x99336e[_0x12b8('0x3d')],{'$or':_[_0x12b8('0x2a')](_0x99336e[_0x12b8('0x34')],function(_0x25170a){var _0x3568d4={};_0x3568d4[_0x25170a]={'$like':'%'+_0x5e8bee[_0x12b8('0x2f')]['filter']+'%'};return _0x3568d4;})});}_0x99336e=_[_0x12b8('0x3e')]({},_0x99336e,_0x5e8bee[_0x12b8('0x3f')]);return _0x2b9ea5[_0x12b8('0x9e')](_0x99336e);}})[_0x12b8('0x26')](function(_0x252b36){if(_0x252b36){_0x148503=_0x252b36[_0x12b8('0x36')];if(!_0x5e8bee['query'][_0x12b8('0x37')]('nolimit')){_0x99336e[_0x12b8('0x38')]=qs['limit'](_0x5e8bee[_0x12b8('0x2f')][_0x12b8('0x38')]);_0x99336e[_0x12b8('0x1f')]=qs['offset'](_0x5e8bee[_0x12b8('0x2f')][_0x12b8('0x1f')]);}return _0x2b9ea5[_0x12b8('0x9e')](_0x99336e);}})['then'](function(_0x4f0e8a){if(_0x4f0e8a){return _0x4f0e8a?{'count':_0x148503,'rows':_0x4f0e8a}:null;}})[_0x12b8('0x26')](respondWithResult(_0xb1855a,null))['catch'](handleError(_0xb1855a,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 502c86d..cb54ced 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 _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 +var _0xe525=['save','remove','emit','hasOwnProperty','events','../../mysqldb','Team'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0xe525,0xc8));var _0x5e52=function(_0x444fda,_0x118823){_0x444fda=_0x444fda-0x0;var _0x2c7df0=_0xe525[_0x444fda];return _0x2c7df0;};'use strict';var EventEmitter=require(_0x5e52('0x0'));var Team=require(_0x5e52('0x1'))['db'][_0x5e52('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5e52('0x3'),'afterUpdate':'update','afterDestroy':_0x5e52('0x4')};function emitEvent(_0x3c7c07){return function(_0x367ed8,_0x327505,_0x43a7dc){TeamEvents[_0x5e52('0x5')](_0x3c7c07+':'+_0x367ed8['id'],_0x367ed8);TeamEvents[_0x5e52('0x5')](_0x3c7c07,_0x367ed8);_0x43a7dc(null);};}for(var e in events){if(events[_0x5e52('0x6')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index fbf7132..4e9b074 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 _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 +var _0xe89a=['Chat','Mail','Openchannel','Whatsapp','resolve','then','all','./team.attributes','get','Queues','map','setDataValue','catch','exports','define','teams'];(function(_0x44d0cd,_0x512c33){var _0x152450=function(_0x4395e8){while(--_0x4395e8){_0x44d0cd['push'](_0x44d0cd['shift']());}};_0x152450(++_0x512c33);}(_0xe89a,0x1e7));var _0xae89=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xe89a[_0x32f7d7];return _0x133d09;};'use strict';var _=require('lodash');var attributes=require(_0xae89('0x0'));function getQueuesByChannel(_0x4f1528,_0x237962){var _0x526472=_0xae89('0x1')+_0x237962+_0xae89('0x2');return _0x4f1528[_0x526472]()['then'](function(_0x4a2ad9){return _[_0xae89('0x3')](_0x4a2ad9,function(_0x137ab3){_0x137ab3[_0xae89('0x4')]('channel',_0x237962);return _0x137ab3;});})[_0xae89('0x5')](function(_0x26cb43){throw _0x26cb43;});}module[_0xae89('0x6')]=function(_0x1205b8){return _0x1205b8[_0xae89('0x7')]('Team',attributes,{'tableName':_0xae89('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x35ff52=this;var _0x328685=[_0xae89('0x9'),'Fax',_0xae89('0xa'),_0xae89('0xb'),'Sms','Voice',_0xae89('0xc')];return Promise[_0xae89('0xd')]()[_0xae89('0xe')](function(){var _0x1f4bfd=_[_0xae89('0x3')](_0x328685,function(_0x295a51){return getQueuesByChannel(_0x35ff52,_0x295a51);});return Promise[_0xae89('0xf')](_0x1f4bfd);})['catch'](function(_0x555cc8){throw _0x555cc8;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index ab658e1..cfe1a7c 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 _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 +var _0xa17e=['then','info','request\x20sent','stringify','error','code','Team,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','register','request'];(function(_0x204825,_0x28d681){var _0x42775b=function(_0x450410){while(--_0x450410){_0x204825['push'](_0x204825['shift']());}};_0x42775b(++_0x28d681);}(_0xa17e,0x10e));var _0xea17=function(_0x1fdb4e,_0x33ec99){_0x1fdb4e=_0x1fdb4e-0x0;var _0x5d1baf=_0xa17e[_0x1fdb4e];return _0x5d1baf;};'use strict';var _=require(_0xea17('0x0'));var util=require('util');var moment=require(_0xea17('0x1'));var BPromise=require(_0xea17('0x2'));var rs=require(_0xea17('0x3'));var fs=require('fs');var Redis=require(_0xea17('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xea17('0x5'));var logger=require(_0xea17('0x6'))(_0xea17('0x7'));var config=require(_0xea17('0x8'));var jayson=require(_0xea17('0x9'));var client=jayson[_0xea17('0xa')][_0xea17('0xb')]({'port':0x232a});config[_0xea17('0xc')]=_[_0xea17('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xea17('0xc')]));require('./team.socket')[_0xea17('0xe')](socket);function respondWithRpcPromise(_0x1a1c2a,_0x4cfcc0,_0x20b2b1){return new BPromise(function(_0x44e842,_0x55a287){return client[_0xea17('0xf')](_0x1a1c2a,_0x20b2b1)[_0xea17('0x10')](function(_0x2e15fd){logger[_0xea17('0x11')]('Team,\x20%s,\x20%s',_0x4cfcc0,'request\x20sent');logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x4cfcc0,_0xea17('0x12'),JSON[_0xea17('0x13')](_0x2e15fd));if(_0x2e15fd['error']){if(_0x2e15fd[_0xea17('0x14')][_0xea17('0x15')]===0x1f4){logger['error'](_0xea17('0x16'),_0x4cfcc0,_0x2e15fd[_0xea17('0x14')][_0xea17('0x17')]);return _0x55a287(_0x2e15fd['error'][_0xea17('0x17')]);}logger[_0xea17('0x14')](_0xea17('0x16'),_0x4cfcc0,_0x2e15fd[_0xea17('0x14')][_0xea17('0x17')]);return _0x44e842(_0x2e15fd['error'][_0xea17('0x17')]);}else{logger[_0xea17('0x11')](_0xea17('0x16'),_0x4cfcc0,'request\x20sent');_0x44e842(_0x2e15fd[_0xea17('0x18')][_0xea17('0x17')]);}})[_0xea17('0x19')](function(_0x416a3c){logger[_0xea17('0x14')](_0xea17('0x16'),_0x4cfcc0,_0x416a3c);_0x55a287(_0x416a3c);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 8c12ab9..8738040 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 _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 +var _0x8caf=['save','remove','update','removeListener','register','length','team:'];(function(_0x496d35,_0x5c29a2){var _0x3b4d30=function(_0x34c84e){while(--_0x34c84e){_0x496d35['push'](_0x496d35['shift']());}};_0x3b4d30(++_0x5c29a2);}(_0x8caf,0x1ab));var _0xf8ca=function(_0x5bf79a,_0x2eaa1d){_0x5bf79a=_0x5bf79a-0x0;var _0x3ff10f=_0x8caf[_0x5bf79a];return _0x3ff10f;};'use strict';var TeamEvents=require('./team.events');var events=[_0xf8ca('0x0'),_0xf8ca('0x1'),_0xf8ca('0x2')];function createListener(_0x2306e8,_0xedc446){return function(_0x35d47c){_0xedc446['emit'](_0x2306e8,_0x35d47c);};}function removeListener(_0x129ca9,_0x23939c){return function(){TeamEvents[_0xf8ca('0x3')](_0x129ca9,_0x23939c);};}exports[_0xf8ca('0x4')]=function(_0x1e2888){for(var _0x20c10a=0x0,_0x562eea=events[_0xf8ca('0x5')];_0x20c10a<_0x562eea;_0x20c10a++){var _0x3abd58=events[_0x20c10a];var _0x3a91d3=createListener(_0xf8ca('0x6')+_0x3abd58,_0x1e2888);TeamEvents['on'](_0x3abd58,_0x3a91d3);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 03a5e93..6439c35 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 _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 +var _0xbe0c=['exports','INTEGER','sequelize'];(function(_0x369ed8,_0x15af6c){var _0x3b02f7=function(_0x2d4c6d){while(--_0x2d4c6d){_0x369ed8['push'](_0x369ed8['shift']());}};_0x3b02f7(++_0x15af6c);}(_0xbe0c,0x155));var _0xcbe0=function(_0x4c5a24,_0x5ef60c){_0x4c5a24=_0x4c5a24-0x0;var _0x4b067e=_0xbe0c[_0x4c5a24];return _0x4b067e;};'use strict';var Sequelize=require(_0xcbe0('0x0'));module[_0xcbe0('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xcbe0('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 4d52d33..b4661e9 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 _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 +var _0x2e16=['bluebird','request-promise','path','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','moment'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x2e16,0x8d));var _0x62e1=function(_0x526c54,_0x5b4ab5){_0x526c54=_0x526c54-0x0;var _0x41ba47=_0x2e16[_0x526c54];return _0x41ba47;};'use strict';var _=require(_0x62e1('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x62e1('0x1'));var BPromise=require(_0x62e1('0x2'));var rp=require(_0x62e1('0x3'));var fs=require('fs');var path=require(_0x62e1('0x4'));var rimraf=require('rimraf');var config=require(_0x62e1('0x5'));var attributes=require(_0x62e1('0x6'));module[_0x62e1('0x7')]=function(_0x6d1e6f,_0x3cac6e){return _0x6d1e6f[_0x62e1('0x8')](_0x62e1('0x9'),attributes,{'tableName':_0x62e1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index ea02f3f..611886f 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 _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 +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4d19c1,_0x3e9b6b){var _0x231051=function(_0x1ae913){while(--_0x1ae913){_0x4d19c1['push'](_0x4d19c1['shift']());}};_0x231051(++_0x3e9b6b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 6304590..d79b73d 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 _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 +var _0x0c9f=['INTEGER','sequelize','exports'];(function(_0x34eb4c,_0x1e2dda){var _0x7a0cca=function(_0x44b76d){while(--_0x44b76d){_0x34eb4c['push'](_0x34eb4c['shift']());}};_0x7a0cca(++_0x1e2dda);}(_0x0c9f,0x12a));var _0xf0c9=function(_0x15edb9,_0x1ad393){_0x15edb9=_0x15edb9-0x0;var _0x45fb17=_0x0c9f[_0x15edb9];return _0x45fb17;};'use strict';var Sequelize=require(_0xf0c9('0x0'));module[_0xf0c9('0x1')]={'penalty':{'type':Sequelize[_0xf0c9('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 74b999e..2d28ad0 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 _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 +var _0xf194=['define','lodash','util','../../config/logger','api','bluebird','../../config/environment','./teamVoiceQueue.attributes','exports'];(function(_0x521e09,_0x1e131f){var _0x1f0238=function(_0xc4cec5){while(--_0xc4cec5){_0x521e09['push'](_0x521e09['shift']());}};_0x1f0238(++_0x1e131f);}(_0xf194,0x91));var _0x4f19=function(_0x5f2220,_0x21f341){_0x5f2220=_0x5f2220-0x0;var _0x13bf62=_0xf194[_0x5f2220];return _0x13bf62;};'use strict';var _=require(_0x4f19('0x0'));var util=require(_0x4f19('0x1'));var logger=require(_0x4f19('0x2'))(_0x4f19('0x3'));var moment=require('moment');var BPromise=require(_0x4f19('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4f19('0x5'));var attributes=require(_0x4f19('0x6'));module[_0x4f19('0x7')]=function(_0x57c148,_0x1fbd23){return _0x57c148[_0x4f19('0x8')]('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index e378ea2..3ec064d 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 _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 +var _0x07b9=['rpc','../../config/environment','jayson/promise','client','http','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x3b4ded,_0xf61a79){var _0x2df583=function(_0x5c7075){while(--_0x5c7075){_0x3b4ded['push'](_0x3b4ded['shift']());}};_0x2df583(++_0xf61a79);}(_0x07b9,0x143));var _0x907b=function(_0x350182,_0x2a9feb){_0x350182=_0x350182-0x0;var _0x4a0892=_0x07b9[_0x350182];return _0x4a0892;};'use strict';var _=require(_0x907b('0x0'));var util=require(_0x907b('0x1'));var moment=require(_0x907b('0x2'));var BPromise=require(_0x907b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x907b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x907b('0x5'));var logger=require(_0x907b('0x6'))(_0x907b('0x7'));var config=require(_0x907b('0x8'));var jayson=require(_0x907b('0x9'));var client=jayson[_0x907b('0xa')][_0x907b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c124a,_0x78f108,_0x3804a7){return new BPromise(function(_0x43c574,_0x1ff1ca){return client['request'](_0x5c124a,_0x3804a7)['then'](function(_0x34767a){logger[_0x907b('0xc')](_0x907b('0xd'),_0x78f108,_0x907b('0xe'));logger[_0x907b('0xf')](_0x907b('0x10'),_0x78f108,_0x907b('0xe'),JSON[_0x907b('0x11')](_0x34767a));if(_0x34767a[_0x907b('0x12')]){if(_0x34767a[_0x907b('0x12')]['code']===0x1f4){logger[_0x907b('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x78f108,_0x34767a['error'][_0x907b('0x13')]);return _0x1ff1ca(_0x34767a[_0x907b('0x12')][_0x907b('0x13')]);}logger[_0x907b('0x12')](_0x907b('0xd'),_0x78f108,_0x34767a[_0x907b('0x12')]['message']);return _0x43c574(_0x34767a[_0x907b('0x12')][_0x907b('0x13')]);}else{logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x78f108,_0x907b('0xe'));_0x43c574(_0x34767a[_0x907b('0x14')][_0x907b('0x13')]);}})[_0x907b('0x15')](function(_0x70dcd5){logger['error'](_0x907b('0xd'),_0x78f108,_0x70dcd5);_0x1ff1ca(_0x70dcd5);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 81c5361..9ff5625 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 _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 +var _0x15b8=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','/:id','show','post','create'];(function(_0x4f2d1f,_0x2dfd87){var _0x7fbb02=function(_0x904d3c){while(--_0x904d3c){_0x4f2d1f['push'](_0x4f2d1f['shift']());}};_0x7fbb02(++_0x2dfd87);}(_0x15b8,0xcd));var _0x815b=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x15b8[_0x1caf6a];return _0x1bf493;};'use strict';var multer=require('multer');var util=require(_0x815b('0x0'));var path=require(_0x815b('0x1'));var timeout=require(_0x815b('0x2'));var express=require(_0x815b('0x3'));var router=express[_0x815b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x815b('0x5'));var interaction=require(_0x815b('0x6'));var config=require(_0x815b('0x7'));var controller=require(_0x815b('0x8'));router[_0x815b('0x9')]('/',auth[_0x815b('0xa')](),controller['index']);router[_0x815b('0x9')](_0x815b('0xb'),auth[_0x815b('0xa')](),controller[_0x815b('0xc')]);router[_0x815b('0xd')]('/',auth[_0x815b('0xa')](),controller[_0x815b('0xe')]);router[_0x815b('0xf')](_0x815b('0xb'),auth[_0x815b('0xa')](),controller[_0x815b('0x10')]);router[_0x815b('0x11')](_0x815b('0xb'),auth[_0x815b('0xa')](),controller[_0x815b('0x12')]);module[_0x815b('0x13')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index c33bd5b..5ff4f88 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 _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 +var _0xe015=['TEXT','sequelize','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe015,0xbb));var _0x5e01=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xe015[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require(_0x5e01('0x0'));module['exports']={'name':{'type':Sequelize[_0x5e01('0x1')]},'description':{'type':Sequelize[_0x5e01('0x1')]},'html':{'type':Sequelize[_0x5e01('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 10fb2a2..fba4e3a 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 _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 +var _0xbef4=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','end','sendStatus','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','Template','includeAll','findAll','show','params','include','create'];(function(_0x5b29f7,_0x335b71){var _0x47d235=function(_0x5bf7b7){while(--_0x5bf7b7){_0x5b29f7['push'](_0x5b29f7['shift']());}};_0x47d235(++_0x335b71);}(_0xbef4,0x100));var _0x4bef=function(_0x251ae7,_0xa8af83){_0x251ae7=_0x251ae7-0x0;var _0x38aed7=_0xbef4[_0x251ae7];return _0x38aed7;};'use strict';var emlformat=require(_0x4bef('0x0'));var rimraf=require(_0x4bef('0x1'));var zipdir=require(_0x4bef('0x2'));var jsonpatch=require(_0x4bef('0x3'));var rp=require(_0x4bef('0x4'));var moment=require(_0x4bef('0x5'));var BPromise=require(_0x4bef('0x6'));var Mustache=require(_0x4bef('0x7'));var util=require(_0x4bef('0x8'));var path=require(_0x4bef('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4bef('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4bef('0xb'));var squel=require(_0x4bef('0xc'));var crypto=require('crypto');var jsforce=require(_0x4bef('0xd'));var deskjs=require(_0x4bef('0xe'));var toCsv=require(_0x4bef('0xf'));var querystring=require(_0x4bef('0x10'));var Papa=require(_0x4bef('0x11'));var Redis=require(_0x4bef('0x12'));var authService=require(_0x4bef('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4bef('0x14'));var hardwareService=require(_0x4bef('0x15'));var logger=require(_0x4bef('0x16'))('api');var utils=require(_0x4bef('0x17'));var config=require(_0x4bef('0x18'));var licenseUtil=require(_0x4bef('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd92535,_0x2e234b){_0x2e234b=_0x2e234b||0xcc;return function(_0x4525d0){if(_0x4525d0){return _0xd92535['sendStatus'](_0x2e234b);}return _0xd92535['status'](_0x2e234b)['end']();};}function respondWithResult(_0x295c66,_0x194f80){_0x194f80=_0x194f80||0xc8;return function(_0x25d607){if(_0x25d607){return _0x295c66[_0x4bef('0x1a')](_0x194f80)[_0x4bef('0x1b')](_0x25d607);}};}function respondWithFilteredResult(_0xa307da,_0x2db2af){return function(_0x409399){if(_0x409399){var _0x25c180=typeof _0x2db2af[_0x4bef('0x1c')]===_0x4bef('0x1d')&&typeof _0x2db2af[_0x4bef('0x1e')]===_0x4bef('0x1d');var _0x24019d=_0x409399['count'];var _0x427e8e=_0x25c180?0x0:_0x2db2af[_0x4bef('0x1c')];var _0x3d8316=_0x25c180?_0x409399[_0x4bef('0x1f')]:_0x2db2af[_0x4bef('0x1c')]+_0x2db2af[_0x4bef('0x1e')];var _0x413766;if(_0x3d8316>=_0x24019d){_0x3d8316=_0x24019d;_0x413766=0xc8;}else{_0x413766=0xce;}_0xa307da['status'](_0x413766);return _0xa307da[_0x4bef('0x20')](_0x4bef('0x21'),_0x427e8e+'-'+_0x3d8316+'/'+_0x24019d)[_0x4bef('0x1b')](_0x409399);}return null;};}function patchUpdates(_0x17fc8e){return function(_0x5440de){try{jsonpatch[_0x4bef('0x22')](_0x5440de,_0x17fc8e,!![]);}catch(_0x3d2f4a){return BPromise[_0x4bef('0x23')](_0x3d2f4a);}return _0x5440de[_0x4bef('0x24')]();};}function saveUpdates(_0x39f6e5,_0x27d6e3){return function(_0x14469f){if(_0x14469f){return _0x14469f[_0x4bef('0x25')](_0x39f6e5)[_0x4bef('0x26')](function(_0x384685){return _0x384685;});}return null;};}function removeEntity(_0x2e20b5,_0x1567df){return function(_0x1fe081){if(_0x1fe081){return _0x1fe081[_0x4bef('0x27')]()[_0x4bef('0x26')](function(){var _0x4c9c10=_0x1fe081[_0x4bef('0x28')]({'plain':!![]});var _0x1e11d5=_0x4bef('0x29');return db[_0x4bef('0x2a')][_0x4bef('0x27')]({'where':{'type':_0x1e11d5,'resourceId':_0x4c9c10['id']}})['then'](function(){return _0x1fe081;});})[_0x4bef('0x26')](function(){_0x2e20b5[_0x4bef('0x1a')](0xcc)[_0x4bef('0x2b')]();});}};}function handleEntityNotFound(_0x3abd66,_0x2e8d7f){return function(_0x39cc0b){if(!_0x39cc0b){_0x3abd66[_0x4bef('0x2c')](0x194);}return _0x39cc0b;};}function handleError(_0x58a9b7,_0x1b6860){_0x1b6860=_0x1b6860||0x1f4;return function(_0x462025){logger['error'](_0x462025['stack']);if(_0x462025[_0x4bef('0x2d')]){delete _0x462025['name'];}_0x58a9b7[_0x4bef('0x1a')](_0x1b6860)[_0x4bef('0x2e')](_0x462025);};}exports[_0x4bef('0x2f')]=function(_0x23f021,_0x59aa77){var _0x4a33b3={},_0x5d923e={},_0x287f7c={'count':0x0,'rows':[]};var _0x34c868=_['map'](db['Template'][_0x4bef('0x30')],function(_0x5af544){return{'name':_0x5af544['fieldName'],'type':_0x5af544[_0x4bef('0x31')][_0x4bef('0x32')]};});_0x5d923e[_0x4bef('0x33')]=_[_0x4bef('0x34')](_0x34c868,_0x4bef('0x2d'));_0x5d923e[_0x4bef('0x35')]=_[_0x4bef('0x36')](_0x23f021[_0x4bef('0x35')]);_0x5d923e[_0x4bef('0x37')]=_[_0x4bef('0x38')](_0x5d923e['model'],_0x5d923e['query']);_0x4a33b3[_0x4bef('0x39')]=_[_0x4bef('0x38')](_0x5d923e[_0x4bef('0x33')],qs['fields'](_0x23f021[_0x4bef('0x35')][_0x4bef('0x3a')]));_0x4a33b3[_0x4bef('0x39')]=_0x4a33b3[_0x4bef('0x39')][_0x4bef('0x3b')]?_0x4a33b3['attributes']:_0x5d923e[_0x4bef('0x33')];if(!_0x23f021['query'][_0x4bef('0x3c')](_0x4bef('0x3d'))){_0x4a33b3['limit']=qs['limit'](_0x23f021[_0x4bef('0x35')]['limit']);_0x4a33b3[_0x4bef('0x1c')]=qs[_0x4bef('0x1c')](_0x23f021['query'][_0x4bef('0x1c')]);}_0x4a33b3['order']=qs[_0x4bef('0x3e')](_0x23f021[_0x4bef('0x35')]['sort']);_0x4a33b3['where']=qs[_0x4bef('0x37')](_[_0x4bef('0x3f')](_0x23f021[_0x4bef('0x35')],_0x5d923e[_0x4bef('0x37')]),_0x34c868);if(_0x23f021[_0x4bef('0x35')][_0x4bef('0x40')]){_0x4a33b3[_0x4bef('0x41')]=_[_0x4bef('0x42')](_0x4a33b3[_0x4bef('0x41')],{'$or':_['map'](_0x34c868,function(_0x3b38d7){if(_0x3b38d7[_0x4bef('0x31')]!==_0x4bef('0x43')){var _0x1016b2={};_0x1016b2[_0x3b38d7['name']]={'$like':'%'+_0x23f021['query'][_0x4bef('0x40')]+'%'};return _0x1016b2;}})});}_0x4a33b3=_[_0x4bef('0x42')]({},_0x4a33b3,_0x23f021[_0x4bef('0x44')]);var _0x37f9a4={'where':_0x4a33b3[_0x4bef('0x41')]};return db[_0x4bef('0x45')][_0x4bef('0x1f')](_0x37f9a4)[_0x4bef('0x26')](function(_0x38b47b){_0x287f7c[_0x4bef('0x1f')]=_0x38b47b;if(_0x23f021[_0x4bef('0x35')][_0x4bef('0x46')]){_0x4a33b3['include']=[{'all':!![]}];}return db[_0x4bef('0x45')][_0x4bef('0x47')](_0x4a33b3);})[_0x4bef('0x26')](function(_0x9e249d){_0x287f7c['rows']=_0x9e249d;return _0x287f7c;})['then'](respondWithFilteredResult(_0x59aa77,_0x4a33b3))['catch'](handleError(_0x59aa77,null));};exports[_0x4bef('0x48')]=function(_0x5a2b8e,_0x26455c){var _0x2900ef={'raw':!![],'where':{'id':_0x5a2b8e[_0x4bef('0x49')]['id']}},_0x5c2c49={};_0x5c2c49[_0x4bef('0x33')]=_['keys'](db[_0x4bef('0x45')][_0x4bef('0x30')]);_0x5c2c49[_0x4bef('0x35')]=_[_0x4bef('0x36')](_0x5a2b8e[_0x4bef('0x35')]);_0x5c2c49['filters']=_[_0x4bef('0x38')](_0x5c2c49[_0x4bef('0x33')],_0x5c2c49[_0x4bef('0x35')]);_0x2900ef[_0x4bef('0x39')]=_[_0x4bef('0x38')](_0x5c2c49[_0x4bef('0x33')],qs[_0x4bef('0x3a')](_0x5a2b8e[_0x4bef('0x35')][_0x4bef('0x3a')]));_0x2900ef[_0x4bef('0x39')]=_0x2900ef['attributes'][_0x4bef('0x3b')]?_0x2900ef[_0x4bef('0x39')]:_0x5c2c49['model'];if(_0x5a2b8e['query'][_0x4bef('0x46')]){_0x2900ef[_0x4bef('0x4a')]=[{'all':!![]}];}_0x2900ef=_[_0x4bef('0x42')]({},_0x2900ef,_0x5a2b8e[_0x4bef('0x44')]);return db[_0x4bef('0x45')]['find'](_0x2900ef)[_0x4bef('0x26')](handleEntityNotFound(_0x26455c,null))['then'](respondWithResult(_0x26455c,null))['catch'](handleError(_0x26455c,null));};exports[_0x4bef('0x4b')]=function(_0xc69f53,_0x1a58fa){return db[_0x4bef('0x45')][_0x4bef('0x4b')](_0xc69f53[_0x4bef('0x4c')],{})[_0x4bef('0x26')](function(_0x987050){var _0x1f6b85=_0xc69f53[_0x4bef('0x4d')][_0x4bef('0x28')]({'plain':!![]});if(!_0x1f6b85)throw new Error(_0x4bef('0x4e'));if(_0x1f6b85['role']===_0x4bef('0x4d')){var _0x535371=_0x987050[_0x4bef('0x28')]({'plain':!![]});var _0x4863da=_0x4bef('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x4863da,'userProfileId':_0x1f6b85['userProfileId']},'raw':!![]})['then'](function(_0x8433a7){if(_0x8433a7&&_0x8433a7[_0x4bef('0x4f')]===0x0){return db['UserProfileResource'][_0x4bef('0x4b')]({'name':_0x535371[_0x4bef('0x2d')],'resourceId':_0x535371['id'],'type':_0x8433a7['name'],'sectionId':_0x8433a7['id']},{})[_0x4bef('0x26')](function(){return _0x987050;});}else{return _0x987050;}})[_0x4bef('0x50')](function(_0x267c1a){logger['error'](_0x4bef('0x51'),_0x267c1a);throw _0x267c1a;});}return _0x987050;})['then'](respondWithResult(_0x1a58fa,0xc9))[_0x4bef('0x50')](handleError(_0x1a58fa,null));};exports[_0x4bef('0x25')]=function(_0x4f8f84,_0x445faf){if(_0x4f8f84['body']['id']){delete _0x4f8f84[_0x4bef('0x4c')]['id'];}return db['Template'][_0x4bef('0x52')]({'where':{'id':_0x4f8f84[_0x4bef('0x49')]['id']}})[_0x4bef('0x26')](handleEntityNotFound(_0x445faf,null))[_0x4bef('0x26')](saveUpdates(_0x4f8f84[_0x4bef('0x4c')],null))[_0x4bef('0x26')](respondWithResult(_0x445faf,null))[_0x4bef('0x50')](handleError(_0x445faf,null));};exports[_0x4bef('0x27')]=function(_0x5bd671,_0xf0ef4e){return db[_0x4bef('0x45')]['find']({'where':{'id':_0x5bd671[_0x4bef('0x49')]['id']}})[_0x4bef('0x26')](handleEntityNotFound(_0xf0ef4e,null))[_0x4bef('0x26')](removeEntity(_0xf0ef4e,null))['catch'](handleError(_0xf0ef4e,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 8f9a6f7..310dec5 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 _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 +var _0xe1ea=['request-promise','path','rimraf','../../config/environment','exports','define','Template','tools_templates','lodash','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe1ea,0x13c));var _0xae1e=function(_0xbcc1e9,_0x11270e){_0xbcc1e9=_0xbcc1e9-0x0;var _0x1fb04a=_0xe1ea[_0xbcc1e9];return _0x1fb04a;};'use strict';var _=require(_0xae1e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xae1e('0x1'));var BPromise=require(_0xae1e('0x2'));var rp=require(_0xae1e('0x3'));var fs=require('fs');var path=require(_0xae1e('0x4'));var rimraf=require(_0xae1e('0x5'));var config=require(_0xae1e('0x6'));var attributes=require('./template.attributes');module[_0xae1e('0x7')]=function(_0xa84083,_0xb537c3){return _0xa84083[_0xae1e('0x8')](_0xae1e('0x9'),attributes,{'tableName':_0xae1e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index dd524a8..f166e52 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 _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 +var _0xb418=['model','then','debug','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','info','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Template,\x20%s,\x20%s','result','GetTemplate','Template','findAll','options','raw','where','attributes','include','map'];(function(_0x1a8bc4,_0x732fea){var _0x580f19=function(_0x27715a){while(--_0x27715a){_0x1a8bc4['push'](_0x1a8bc4['shift']());}};_0x580f19(++_0x732fea);}(_0xb418,0x1b6));var _0x8b41=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0xb418[_0x34843e];return _0x598f7f;};'use strict';var _=require(_0x8b41('0x0'));var util=require(_0x8b41('0x1'));var moment=require(_0x8b41('0x2'));var BPromise=require(_0x8b41('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b41('0x4'));var db=require(_0x8b41('0x5'))['db'];var utils=require(_0x8b41('0x6'));var logger=require('../../config/logger')(_0x8b41('0x7'));var config=require('../../config/environment');var jayson=require(_0x8b41('0x8'));var client=jayson['client'][_0x8b41('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x394d2d,_0x592c42,_0x154bd8){return new BPromise(function(_0x38a039,_0x518063){return client['request'](_0x394d2d,_0x154bd8)['then'](function(_0x4c22c0){logger[_0x8b41('0xa')]('Template,\x20%s,\x20%s',_0x592c42,'request\x20sent');logger['debug'](_0x8b41('0xb'),_0x592c42,'request\x20sent',JSON[_0x8b41('0xc')](_0x4c22c0));if(_0x4c22c0[_0x8b41('0xd')]){if(_0x4c22c0[_0x8b41('0xd')][_0x8b41('0xe')]===0x1f4){logger[_0x8b41('0xd')]('Template,\x20%s,\x20%s',_0x592c42,_0x4c22c0[_0x8b41('0xd')]['message']);return _0x518063(_0x4c22c0[_0x8b41('0xd')][_0x8b41('0xf')]);}logger[_0x8b41('0xd')](_0x8b41('0x10'),_0x592c42,_0x4c22c0[_0x8b41('0xd')]['message']);return _0x38a039(_0x4c22c0[_0x8b41('0xd')][_0x8b41('0xf')]);}else{logger['info'](_0x8b41('0x10'),_0x592c42,'request\x20sent');_0x38a039(_0x4c22c0[_0x8b41('0x11')]['message']);}})['catch'](function(_0x384ca0){logger[_0x8b41('0xd')](_0x8b41('0x10'),_0x592c42,_0x384ca0);_0x518063(_0x384ca0);});});}exports[_0x8b41('0x12')]=function(_0x3fa054){var _0x49047c=this;return new Promise(function(_0x4d0580,_0x5eb8ac){return db[_0x8b41('0x13')][_0x8b41('0x14')]({'raw':_0x3fa054[_0x8b41('0x15')]?_0x3fa054[_0x8b41('0x15')][_0x8b41('0x16')]===undefined?!![]:![]:!![],'where':_0x3fa054['options']?_0x3fa054[_0x8b41('0x15')][_0x8b41('0x17')]||null:null,'attributes':_0x3fa054['options']?_0x3fa054[_0x8b41('0x15')][_0x8b41('0x18')]||null:null,'limit':_0x3fa054[_0x8b41('0x15')]?_0x3fa054[_0x8b41('0x15')]['limit']||null:null,'include':_0x3fa054[_0x8b41('0x15')]?_0x3fa054[_0x8b41('0x15')][_0x8b41('0x19')]?_[_0x8b41('0x1a')](_0x3fa054['options'][_0x8b41('0x19')],function(_0x42f16d){return{'model':db[_0x42f16d['model']],'as':_0x42f16d['as'],'attributes':_0x42f16d['attributes'],'include':_0x42f16d[_0x8b41('0x19')]?_[_0x8b41('0x1a')](_0x42f16d[_0x8b41('0x19')],function(_0x32d35e){return{'model':db[_0x32d35e[_0x8b41('0x1b')]],'as':_0x32d35e['as'],'attributes':_0x32d35e[_0x8b41('0x18')],'include':_0x32d35e[_0x8b41('0x19')]?_[_0x8b41('0x1a')](_0x32d35e[_0x8b41('0x19')],function(_0x21ff61){return{'model':db[_0x21ff61[_0x8b41('0x1b')]],'as':_0x21ff61['as'],'attributes':_0x21ff61[_0x8b41('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8b41('0x1c')](function(_0x18a254){logger['info'](_0x8b41('0x12'),_0x3fa054);logger[_0x8b41('0x1d')](_0x8b41('0x12'),_0x3fa054,JSON['stringify'](_0x18a254));_0x4d0580(_0x18a254);})[_0x8b41('0x1e')](function(_0x24c13f){logger[_0x8b41('0xd')](_0x8b41('0x12'),_0x24c13f[_0x8b41('0xf')],_0x3fa054);_0x5eb8ac(_0x49047c[_0x8b41('0xd')](0x1f4,_0x24c13f['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 74857c9..9e06673 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 _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 +var _0x579a=['/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAction','put','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','get','index','/:id','isAuthenticated','show'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x579a,0x9d));var _0xa579=function(_0x237d34,_0x284bdf){_0x237d34=_0x237d34-0x0;var _0x36b9e5=_0x579a[_0x237d34];return _0x36b9e5;};'use strict';var multer=require(_0xa579('0x0'));var util=require(_0xa579('0x1'));var path=require(_0xa579('0x2'));var timeout=require(_0xa579('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa579('0x4'));var auth=require(_0xa579('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./trigger.controller');router[_0xa579('0x6')]('/',auth['isAuthenticated'](),controller[_0xa579('0x7')]);router[_0xa579('0x6')](_0xa579('0x8'),auth[_0xa579('0x9')](),controller[_0xa579('0xa')]);router[_0xa579('0x6')](_0xa579('0xb'),auth[_0xa579('0x9')](),controller['getAllConditions']);router[_0xa579('0x6')](_0xa579('0xc'),auth[_0xa579('0x9')](),controller[_0xa579('0xd')]);router['get'](_0xa579('0xe'),auth[_0xa579('0x9')](),controller[_0xa579('0xf')]);router[_0xa579('0x10')]('/',auth['isAuthenticated'](),controller[_0xa579('0x11')]);router[_0xa579('0x10')](_0xa579('0xb'),auth[_0xa579('0x9')](),controller[_0xa579('0x12')]);router[_0xa579('0x10')]('/:id/any_conditions',auth[_0xa579('0x9')](),controller['addAnyCondition']);router[_0xa579('0x10')](_0xa579('0xe'),auth[_0xa579('0x9')](),controller[_0xa579('0x13')]);router[_0xa579('0x14')](_0xa579('0x8'),auth[_0xa579('0x9')](),controller[_0xa579('0x15')]);router['delete'](_0xa579('0x8'),auth['isAuthenticated'](),controller[_0xa579('0x16')]);module[_0xa579('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 369a336..bdf442b 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 _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 +var _0xf6c2=['exports','STRING','sequelize'];(function(_0x45e4ff,_0x4230f7){var _0x2d34c1=function(_0x244e8c){while(--_0x244e8c){_0x45e4ff['push'](_0x45e4ff['shift']());}};_0x2d34c1(++_0x4230f7);}(_0xf6c2,0x1e8));var _0x2f6c=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xf6c2[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x2f6c('0x0'));module[_0x2f6c('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x2f6c('0x2')]},'description':{'type':Sequelize['STRING']},'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 3cb61be..3dbad24 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 _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 +var _0xd6f5=['params','length','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','pick','getAnyConditions','addAction','TriggerId','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','get','error','stack','name','send','map','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','include','Trigger','findAll','rows','show'];(function(_0x571c65,_0x321f37){var _0x563767=function(_0x2e9f2a){while(--_0x2e9f2a){_0x571c65['push'](_0x571c65['shift']());}};_0x563767(++_0x321f37);}(_0xd6f5,0x75));var _0x5d6f=function(_0x2678d6,_0x4e2001){_0x2678d6=_0x2678d6-0x0;var _0x475503=_0xd6f5[_0x2678d6];return _0x475503;};'use strict';var emlformat=require(_0x5d6f('0x0'));var rimraf=require(_0x5d6f('0x1'));var zipdir=require(_0x5d6f('0x2'));var jsonpatch=require(_0x5d6f('0x3'));var rp=require(_0x5d6f('0x4'));var moment=require(_0x5d6f('0x5'));var BPromise=require(_0x5d6f('0x6'));var Mustache=require(_0x5d6f('0x7'));var util=require(_0x5d6f('0x8'));var path=require('path');var sox=require(_0x5d6f('0x9'));var csv=require(_0x5d6f('0xa'));var ejs=require(_0x5d6f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5d6f('0xc'));var squel=require('squel');var crypto=require(_0x5d6f('0xd'));var jsforce=require(_0x5d6f('0xe'));var deskjs=require(_0x5d6f('0xf'));var toCsv=require(_0x5d6f('0xa'));var querystring=require(_0x5d6f('0x10'));var Papa=require(_0x5d6f('0x11'));var Redis=require(_0x5d6f('0x12'));var authService=require(_0x5d6f('0x13'));var qs=require(_0x5d6f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5d6f('0x15'));var logger=require(_0x5d6f('0x16'))(_0x5d6f('0x17'));var utils=require('../../config/utils');var config=require(_0x5d6f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5d6f('0x19'))['db'];function respondWithStatusCode(_0x489493,_0x4790dc){_0x4790dc=_0x4790dc||0xcc;return function(_0x32735a){if(_0x32735a){return _0x489493[_0x5d6f('0x1a')](_0x4790dc);}return _0x489493[_0x5d6f('0x1b')](_0x4790dc)['end']();};}function respondWithResult(_0x13c132,_0x5e451a){_0x5e451a=_0x5e451a||0xc8;return function(_0x9df947){if(_0x9df947){return _0x13c132[_0x5d6f('0x1b')](_0x5e451a)[_0x5d6f('0x1c')](_0x9df947);}};}function respondWithFilteredResult(_0x413b9c,_0x3c0cad){return function(_0x5773e2){if(_0x5773e2){var _0x2a408e=typeof _0x3c0cad[_0x5d6f('0x1d')]===_0x5d6f('0x1e')&&typeof _0x3c0cad[_0x5d6f('0x1f')]==='undefined';var _0x1c6ef6=_0x5773e2[_0x5d6f('0x20')];var _0xb4cdac=_0x2a408e?0x0:_0x3c0cad[_0x5d6f('0x1d')];var _0x34d7c7=_0x2a408e?_0x5773e2[_0x5d6f('0x20')]:_0x3c0cad[_0x5d6f('0x1d')]+_0x3c0cad[_0x5d6f('0x1f')];var _0x520e24;if(_0x34d7c7>=_0x1c6ef6){_0x34d7c7=_0x1c6ef6;_0x520e24=0xc8;}else{_0x520e24=0xce;}_0x413b9c['status'](_0x520e24);return _0x413b9c[_0x5d6f('0x21')]('Content-Range',_0xb4cdac+'-'+_0x34d7c7+'/'+_0x1c6ef6)[_0x5d6f('0x1c')](_0x5773e2);}return null;};}function patchUpdates(_0x1cdfdb){return function(_0xe65fc9){try{jsonpatch[_0x5d6f('0x22')](_0xe65fc9,_0x1cdfdb,!![]);}catch(_0x4a5ecf){return BPromise['reject'](_0x4a5ecf);}return _0xe65fc9[_0x5d6f('0x23')]();};}function saveUpdates(_0x1fc615,_0x4ba0d8){return function(_0x36d745){if(_0x36d745){return _0x36d745[_0x5d6f('0x24')](_0x1fc615)[_0x5d6f('0x25')](function(_0x485aba){return _0x485aba;});}return null;};}function removeEntity(_0x29630b,_0x10b13a){return function(_0x33c040){if(_0x33c040){return _0x33c040[_0x5d6f('0x26')]()[_0x5d6f('0x25')](function(){var _0x14c62d=_0x33c040[_0x5d6f('0x27')]({'plain':!![]});var _0x3d4bd6='Triggers';return db['UserProfileResource'][_0x5d6f('0x26')]({'where':{'type':_0x3d4bd6,'resourceId':_0x14c62d['id']}})['then'](function(){return _0x33c040;});})[_0x5d6f('0x25')](function(){_0x29630b[_0x5d6f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b580f,_0x5c6226){return function(_0x491716){if(!_0x491716){_0x4b580f[_0x5d6f('0x1a')](0x194);}return _0x491716;};}function handleError(_0x1bd8c2,_0x5f58de){_0x5f58de=_0x5f58de||0x1f4;return function(_0x940f4d){logger[_0x5d6f('0x28')](_0x940f4d[_0x5d6f('0x29')]);if(_0x940f4d['name']){delete _0x940f4d[_0x5d6f('0x2a')];}_0x1bd8c2[_0x5d6f('0x1b')](_0x5f58de)[_0x5d6f('0x2b')](_0x940f4d);};}exports['index']=function(_0x2395c9,_0x2f85b8){var _0x4f6bea={},_0x3c1e26={},_0x7689bc={'count':0x0,'rows':[]};var _0x2cc99c=_[_0x5d6f('0x2c')](db['Trigger'][_0x5d6f('0x2d')],function(_0x5bff01){return{'name':_0x5bff01[_0x5d6f('0x2e')],'type':_0x5bff01[_0x5d6f('0x2f')]['key']};});_0x3c1e26[_0x5d6f('0x30')]=_[_0x5d6f('0x2c')](_0x2cc99c,'name');_0x3c1e26['query']=_[_0x5d6f('0x31')](_0x2395c9[_0x5d6f('0x32')]);_0x3c1e26['filters']=_[_0x5d6f('0x33')](_0x3c1e26[_0x5d6f('0x30')],_0x3c1e26['query']);_0x4f6bea[_0x5d6f('0x34')]=_[_0x5d6f('0x33')](_0x3c1e26['model'],qs['fields'](_0x2395c9[_0x5d6f('0x32')][_0x5d6f('0x35')]));_0x4f6bea[_0x5d6f('0x34')]=_0x4f6bea['attributes']['length']?_0x4f6bea[_0x5d6f('0x34')]:_0x3c1e26[_0x5d6f('0x30')];if(!_0x2395c9[_0x5d6f('0x32')][_0x5d6f('0x36')](_0x5d6f('0x37'))){_0x4f6bea['limit']=qs['limit'](_0x2395c9['query'][_0x5d6f('0x1f')]);_0x4f6bea[_0x5d6f('0x1d')]=qs[_0x5d6f('0x1d')](_0x2395c9[_0x5d6f('0x32')][_0x5d6f('0x1d')]);}_0x4f6bea[_0x5d6f('0x38')]=qs[_0x5d6f('0x39')](_0x2395c9[_0x5d6f('0x32')]['sort']);_0x4f6bea['where']=qs[_0x5d6f('0x3a')](_['pick'](_0x2395c9['query'],_0x3c1e26[_0x5d6f('0x3a')]),_0x2cc99c);if(_0x2395c9[_0x5d6f('0x32')][_0x5d6f('0x3b')]){_0x4f6bea[_0x5d6f('0x3c')]=_[_0x5d6f('0x3d')](_0x4f6bea[_0x5d6f('0x3c')],{'$or':_[_0x5d6f('0x2c')](_0x2cc99c,function(_0x24ec2f){if(_0x24ec2f['type']!==_0x5d6f('0x3e')){var _0x4f1b62={};_0x4f1b62[_0x24ec2f[_0x5d6f('0x2a')]]={'$like':'%'+_0x2395c9['query'][_0x5d6f('0x3b')]+'%'};return _0x4f1b62;}})});}_0x4f6bea=_[_0x5d6f('0x3d')]({},_0x4f6bea,_0x2395c9[_0x5d6f('0x3f')]);var _0xe0d925={'where':_0x4f6bea[_0x5d6f('0x3c')]};return db['Trigger']['count'](_0xe0d925)[_0x5d6f('0x25')](function(_0x2c867d){_0x7689bc[_0x5d6f('0x20')]=_0x2c867d;if(_0x2395c9[_0x5d6f('0x32')]['includeAll']){_0x4f6bea[_0x5d6f('0x40')]=[{'all':!![]}];}return db[_0x5d6f('0x41')][_0x5d6f('0x42')](_0x4f6bea);})[_0x5d6f('0x25')](function(_0x3af4fd){_0x7689bc[_0x5d6f('0x43')]=_0x3af4fd;return _0x7689bc;})['then'](respondWithFilteredResult(_0x2f85b8,_0x4f6bea))['catch'](handleError(_0x2f85b8,null));};exports[_0x5d6f('0x44')]=function(_0x5e5832,_0x1c020a){var _0x2f7a32={'raw':![],'where':{'id':_0x5e5832[_0x5d6f('0x45')]['id']}},_0x50f8fe={};_0x50f8fe[_0x5d6f('0x30')]=_['keys'](db['Trigger'][_0x5d6f('0x2d')]);_0x50f8fe['query']=_['keys'](_0x5e5832['query']);_0x50f8fe['filters']=_[_0x5d6f('0x33')](_0x50f8fe['model'],_0x50f8fe[_0x5d6f('0x32')]);_0x2f7a32[_0x5d6f('0x34')]=_[_0x5d6f('0x33')](_0x50f8fe[_0x5d6f('0x30')],qs[_0x5d6f('0x35')](_0x5e5832[_0x5d6f('0x32')][_0x5d6f('0x35')]));_0x2f7a32[_0x5d6f('0x34')]=_0x2f7a32[_0x5d6f('0x34')][_0x5d6f('0x46')]?_0x2f7a32['attributes']:_0x50f8fe[_0x5d6f('0x30')];if(_0x5e5832['query'][_0x5d6f('0x47')]){_0x2f7a32[_0x5d6f('0x40')]=[{'all':!![]}];}_0x2f7a32=_[_0x5d6f('0x3d')]({},_0x2f7a32,_0x5e5832[_0x5d6f('0x3f')]);return db[_0x5d6f('0x41')]['find'](_0x2f7a32)[_0x5d6f('0x25')](handleEntityNotFound(_0x1c020a,null))['then'](respondWithResult(_0x1c020a,null))[_0x5d6f('0x48')](handleError(_0x1c020a,null));};exports[_0x5d6f('0x49')]=function(_0x3ed31d,_0x5138cf){return db[_0x5d6f('0x41')][_0x5d6f('0x49')](_0x3ed31d[_0x5d6f('0x4a')],{})['then'](function(_0x418785){var _0x2bcea0=_0x3ed31d[_0x5d6f('0x4b')][_0x5d6f('0x27')]({'plain':!![]});if(!_0x2bcea0)throw new Error(_0x5d6f('0x4c'));if(_0x2bcea0['role']===_0x5d6f('0x4b')){var _0xe2e8cb=_0x418785[_0x5d6f('0x27')]({'plain':!![]});var _0x1e2117='Triggers';return db[_0x5d6f('0x4d')][_0x5d6f('0x4e')]({'where':{'name':_0x1e2117,'userProfileId':_0x2bcea0[_0x5d6f('0x4f')]},'raw':!![]})[_0x5d6f('0x25')](function(_0xc43d27){if(_0xc43d27&&_0xc43d27[_0x5d6f('0x50')]===0x0){return db['UserProfileResource'][_0x5d6f('0x49')]({'name':_0xe2e8cb[_0x5d6f('0x2a')],'resourceId':_0xe2e8cb['id'],'type':_0xc43d27[_0x5d6f('0x2a')],'sectionId':_0xc43d27['id']},{})[_0x5d6f('0x25')](function(){return _0x418785;});}else{return _0x418785;}})[_0x5d6f('0x48')](function(_0xf596db){logger[_0x5d6f('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf596db);throw _0xf596db;});}return _0x418785;})[_0x5d6f('0x25')](respondWithResult(_0x5138cf,0xc9))[_0x5d6f('0x48')](handleError(_0x5138cf,null));};exports[_0x5d6f('0x24')]=function(_0x404212,_0x14742b){if(_0x404212[_0x5d6f('0x4a')]['id']){delete _0x404212[_0x5d6f('0x4a')]['id'];}return db[_0x5d6f('0x41')][_0x5d6f('0x4e')]({'where':{'id':_0x404212[_0x5d6f('0x45')]['id']}})['then'](handleEntityNotFound(_0x14742b,null))['then'](saveUpdates(_0x404212[_0x5d6f('0x4a')],null))[_0x5d6f('0x25')](respondWithResult(_0x14742b,null))[_0x5d6f('0x48')](handleError(_0x14742b,null));};exports[_0x5d6f('0x26')]=function(_0x31dafe,_0x4af3c4){return db[_0x5d6f('0x41')][_0x5d6f('0x4e')]({'where':{'id':_0x31dafe['params']['id']}})[_0x5d6f('0x25')](handleEntityNotFound(_0x4af3c4,null))[_0x5d6f('0x25')](removeEntity(_0x4af3c4,null))[_0x5d6f('0x48')](handleError(_0x4af3c4,null));};exports[_0x5d6f('0x51')]=function(_0x28ae72,_0x438146,_0x22654a){if(_0x28ae72['body']['id']){delete _0x28ae72[_0x5d6f('0x4a')]['id'];}return db[_0x5d6f('0x41')][_0x5d6f('0x4e')]({'where':{'id':_0x28ae72['params']['id']}})[_0x5d6f('0x25')](handleEntityNotFound(_0x438146,null))[_0x5d6f('0x25')](function(_0x308630){if(_0x308630){_0x28ae72[_0x5d6f('0x4a')][_0x5d6f('0x52')]=_0x308630['id'];return db[_0x5d6f('0x53')]['create'](_0x28ae72[_0x5d6f('0x4a')]);}})[_0x5d6f('0x25')](respondWithResult(_0x438146,null))[_0x5d6f('0x48')](handleError(_0x438146,null));};exports[_0x5d6f('0x54')]=function(_0x3d88f2,_0x3c0bc1,_0x1d0db5){if(_0x3d88f2[_0x5d6f('0x4a')]['id']){delete _0x3d88f2[_0x5d6f('0x4a')]['id'];}return db[_0x5d6f('0x41')]['find']({'where':{'id':_0x3d88f2['params']['id']}})[_0x5d6f('0x25')](handleEntityNotFound(_0x3c0bc1,null))[_0x5d6f('0x25')](function(_0x51c638){if(_0x51c638){_0x3d88f2[_0x5d6f('0x4a')][_0x5d6f('0x55')]=_0x51c638['id'];return db[_0x5d6f('0x53')][_0x5d6f('0x49')](_0x3d88f2[_0x5d6f('0x4a')]);}})[_0x5d6f('0x25')](respondWithResult(_0x3c0bc1,null))[_0x5d6f('0x48')](handleError(_0x3c0bc1,null));};exports[_0x5d6f('0x56')]=function(_0x572b45,_0x379d11,_0x9610e5){var _0x1b210b={};var _0x4ac75c={};var _0x4aba42;var _0x41e055;return db[_0x5d6f('0x41')][_0x5d6f('0x57')]({'where':{'id':_0x572b45[_0x5d6f('0x45')]['id']}})[_0x5d6f('0x25')](handleEntityNotFound(_0x379d11,null))[_0x5d6f('0x25')](function(_0xd0b154){if(_0xd0b154){_0x4aba42=_0xd0b154;_0x4ac75c['model']=_[_0x5d6f('0x31')](db[_0x5d6f('0x53')][_0x5d6f('0x2d')]);_0x4ac75c[_0x5d6f('0x32')]=_['keys'](_0x572b45['query']);_0x4ac75c['filters']=_[_0x5d6f('0x33')](_0x4ac75c['model'],_0x4ac75c['query']);_0x1b210b[_0x5d6f('0x34')]=_['intersection'](_0x4ac75c[_0x5d6f('0x30')],qs[_0x5d6f('0x35')](_0x572b45[_0x5d6f('0x32')][_0x5d6f('0x35')]));_0x1b210b[_0x5d6f('0x34')]=_0x1b210b[_0x5d6f('0x34')][_0x5d6f('0x46')]?_0x1b210b['attributes']:_0x4ac75c[_0x5d6f('0x30')];_0x1b210b[_0x5d6f('0x38')]=qs[_0x5d6f('0x39')](_0x572b45[_0x5d6f('0x32')]['sort']);_0x1b210b[_0x5d6f('0x3c')]=qs[_0x5d6f('0x3a')](_[_0x5d6f('0x58')](_0x572b45[_0x5d6f('0x32')],_0x4ac75c[_0x5d6f('0x3a')]));if(_0x572b45[_0x5d6f('0x32')]['filter']){_0x1b210b[_0x5d6f('0x3c')]=_[_0x5d6f('0x3d')](_0x1b210b[_0x5d6f('0x3c')],{'$or':_[_0x5d6f('0x2c')](_0x1b210b[_0x5d6f('0x34')],function(_0x25a200){var _0x49d264={};_0x49d264[_0x25a200]={'$like':'%'+_0x572b45[_0x5d6f('0x32')][_0x5d6f('0x3b')]+'%'};return _0x49d264;})});}_0x1b210b=_[_0x5d6f('0x3d')]({},_0x1b210b,_0x572b45['options']);return _0x4aba42['getAllConditions'](_0x1b210b);}})['then'](function(_0x92b63a){if(_0x92b63a){_0x41e055=_0x92b63a[_0x5d6f('0x46')];if(!_0x572b45[_0x5d6f('0x32')]['hasOwnProperty']('nolimit')){_0x1b210b[_0x5d6f('0x1f')]=qs[_0x5d6f('0x1f')](_0x572b45['query'][_0x5d6f('0x1f')]);_0x1b210b['offset']=qs[_0x5d6f('0x1d')](_0x572b45[_0x5d6f('0x32')][_0x5d6f('0x1d')]);}return _0x4aba42['getAllConditions'](_0x1b210b);}})[_0x5d6f('0x25')](function(_0x56b39c){if(_0x56b39c){return _0x56b39c?{'count':_0x41e055,'rows':_0x56b39c}:null;}})['then'](respondWithResult(_0x379d11,null))[_0x5d6f('0x48')](handleError(_0x379d11,null));};exports[_0x5d6f('0x59')]=function(_0x13998d,_0x10fcd0,_0x373370){var _0x94d5d5={};var _0x835515={};var _0x55be67;var _0x1e2645;return db['Trigger'][_0x5d6f('0x57')]({'where':{'id':_0x13998d[_0x5d6f('0x45')]['id']}})[_0x5d6f('0x25')](handleEntityNotFound(_0x10fcd0,null))[_0x5d6f('0x25')](function(_0x2507b4){if(_0x2507b4){_0x55be67=_0x2507b4;_0x835515['model']=_[_0x5d6f('0x31')](db['Condition']['rawAttributes']);_0x835515[_0x5d6f('0x32')]=_[_0x5d6f('0x31')](_0x13998d[_0x5d6f('0x32')]);_0x835515['filters']=_[_0x5d6f('0x33')](_0x835515[_0x5d6f('0x30')],_0x835515[_0x5d6f('0x32')]);_0x94d5d5[_0x5d6f('0x34')]=_[_0x5d6f('0x33')](_0x835515[_0x5d6f('0x30')],qs[_0x5d6f('0x35')](_0x13998d[_0x5d6f('0x32')][_0x5d6f('0x35')]));_0x94d5d5[_0x5d6f('0x34')]=_0x94d5d5['attributes'][_0x5d6f('0x46')]?_0x94d5d5[_0x5d6f('0x34')]:_0x835515[_0x5d6f('0x30')];_0x94d5d5[_0x5d6f('0x38')]=qs[_0x5d6f('0x39')](_0x13998d[_0x5d6f('0x32')][_0x5d6f('0x39')]);_0x94d5d5[_0x5d6f('0x3c')]=qs[_0x5d6f('0x3a')](_[_0x5d6f('0x58')](_0x13998d[_0x5d6f('0x32')],_0x835515[_0x5d6f('0x3a')]));if(_0x13998d[_0x5d6f('0x32')][_0x5d6f('0x3b')]){_0x94d5d5[_0x5d6f('0x3c')]=_[_0x5d6f('0x3d')](_0x94d5d5[_0x5d6f('0x3c')],{'$or':_[_0x5d6f('0x2c')](_0x94d5d5[_0x5d6f('0x34')],function(_0x2b71f8){var _0x3b3304={};_0x3b3304[_0x2b71f8]={'$like':'%'+_0x13998d['query'][_0x5d6f('0x3b')]+'%'};return _0x3b3304;})});}_0x94d5d5=_[_0x5d6f('0x3d')]({},_0x94d5d5,_0x13998d[_0x5d6f('0x3f')]);return _0x55be67[_0x5d6f('0x59')](_0x94d5d5);}})[_0x5d6f('0x25')](function(_0x434898){if(_0x434898){_0x1e2645=_0x434898[_0x5d6f('0x46')];if(!_0x13998d[_0x5d6f('0x32')][_0x5d6f('0x36')](_0x5d6f('0x37'))){_0x94d5d5[_0x5d6f('0x1f')]=qs[_0x5d6f('0x1f')](_0x13998d[_0x5d6f('0x32')][_0x5d6f('0x1f')]);_0x94d5d5['offset']=qs['offset'](_0x13998d[_0x5d6f('0x32')][_0x5d6f('0x1d')]);}return _0x55be67['getAnyConditions'](_0x94d5d5);}})[_0x5d6f('0x25')](function(_0x5ee6a2){if(_0x5ee6a2){return _0x5ee6a2?{'count':_0x1e2645,'rows':_0x5ee6a2}:null;}})['then'](respondWithResult(_0x10fcd0,null))[_0x5d6f('0x48')](handleError(_0x10fcd0,null));};exports[_0x5d6f('0x5a')]=function(_0x58a127,_0x4de6a6,_0x4e6b11){if(_0x58a127[_0x5d6f('0x4a')]['id']){delete _0x58a127[_0x5d6f('0x4a')]['id'];}return db[_0x5d6f('0x41')][_0x5d6f('0x4e')]({'where':{'id':_0x58a127[_0x5d6f('0x45')]['id']}})[_0x5d6f('0x25')](handleEntityNotFound(_0x4de6a6,null))[_0x5d6f('0x25')](function(_0x3ae0d1){if(_0x3ae0d1){_0x58a127['body'][_0x5d6f('0x5b')]=_0x3ae0d1['id'];return db['Action'][_0x5d6f('0x49')](_0x58a127[_0x5d6f('0x4a')]);}})[_0x5d6f('0x25')](respondWithResult(_0x4de6a6,null))['catch'](handleError(_0x4de6a6,null));};exports[_0x5d6f('0x5c')]=function(_0x6f6410,_0x5c3b3d,_0x26d190){var _0x57a1c8={};var _0x109852={};var _0x19f3f3;var _0x4a9f3d;return db[_0x5d6f('0x41')][_0x5d6f('0x57')]({'where':{'id':_0x6f6410[_0x5d6f('0x45')]['id']}})[_0x5d6f('0x25')](handleEntityNotFound(_0x5c3b3d,null))[_0x5d6f('0x25')](function(_0x1a573a){if(_0x1a573a){_0x19f3f3=_0x1a573a;_0x109852[_0x5d6f('0x30')]=_[_0x5d6f('0x31')](db['Action']['rawAttributes']);_0x109852[_0x5d6f('0x32')]=_[_0x5d6f('0x31')](_0x6f6410[_0x5d6f('0x32')]);_0x109852[_0x5d6f('0x3a')]=_['intersection'](_0x109852[_0x5d6f('0x30')],_0x109852[_0x5d6f('0x32')]);_0x57a1c8[_0x5d6f('0x34')]=_['intersection'](_0x109852[_0x5d6f('0x30')],qs['fields'](_0x6f6410[_0x5d6f('0x32')]['fields']));_0x57a1c8['attributes']=_0x57a1c8[_0x5d6f('0x34')][_0x5d6f('0x46')]?_0x57a1c8[_0x5d6f('0x34')]:_0x109852['model'];_0x57a1c8['order']=qs[_0x5d6f('0x39')](_0x6f6410['query'][_0x5d6f('0x39')]);_0x57a1c8[_0x5d6f('0x3c')]=qs[_0x5d6f('0x3a')](_[_0x5d6f('0x58')](_0x6f6410[_0x5d6f('0x32')],_0x109852['filters']));if(_0x6f6410[_0x5d6f('0x32')][_0x5d6f('0x3b')]){_0x57a1c8[_0x5d6f('0x3c')]=_[_0x5d6f('0x3d')](_0x57a1c8[_0x5d6f('0x3c')],{'$or':_[_0x5d6f('0x2c')](_0x57a1c8[_0x5d6f('0x34')],function(_0x5e4a14){var _0x1f346b={};_0x1f346b[_0x5e4a14]={'$like':'%'+_0x6f6410[_0x5d6f('0x32')][_0x5d6f('0x3b')]+'%'};return _0x1f346b;})});}_0x57a1c8=_['merge']({},_0x57a1c8,_0x6f6410['options']);return _0x19f3f3[_0x5d6f('0x5c')](_0x57a1c8);}})[_0x5d6f('0x25')](function(_0x566cdc){if(_0x566cdc){_0x4a9f3d=_0x566cdc[_0x5d6f('0x46')];if(!_0x6f6410[_0x5d6f('0x32')][_0x5d6f('0x36')](_0x5d6f('0x37'))){_0x57a1c8['limit']=qs[_0x5d6f('0x1f')](_0x6f6410[_0x5d6f('0x32')]['limit']);_0x57a1c8['offset']=qs[_0x5d6f('0x1d')](_0x6f6410['query'][_0x5d6f('0x1d')]);}return _0x19f3f3[_0x5d6f('0x5c')](_0x57a1c8);}})[_0x5d6f('0x25')](function(_0xb72484){if(_0xb72484){return _0xb72484?{'count':_0x4a9f3d,'rows':_0xb72484}:null;}})[_0x5d6f('0x25')](respondWithResult(_0x5c3b3d,null))['catch'](handleError(_0x5c3b3d,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index cf97a13..fc8c497 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 _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 +var _0x9b9b=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers'];(function(_0xe4d2fa,_0x1e8116){var _0x34ec66=function(_0x4426c6){while(--_0x4426c6){_0xe4d2fa['push'](_0xe4d2fa['shift']());}};_0x34ec66(++_0x1e8116);}(_0x9b9b,0x114));var _0xb9b9=function(_0x197185,_0x251145){_0x197185=_0x197185-0x0;var _0x2c8af1=_0x9b9b[_0x197185];return _0x2c8af1;};'use strict';var _=require('lodash');var util=require(_0xb9b9('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb9b9('0x1'));var BPromise=require(_0xb9b9('0x2'));var rp=require(_0xb9b9('0x3'));var fs=require('fs');var path=require(_0xb9b9('0x4'));var rimraf=require(_0xb9b9('0x5'));var config=require(_0xb9b9('0x6'));var attributes=require(_0xb9b9('0x7'));module[_0xb9b9('0x8')]=function(_0x79dd,_0x3d1a95){return _0x79dd[_0xb9b9('0x9')](_0xb9b9('0xa'),attributes,{'tableName':_0xb9b9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 1503f57..4ff2a25 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 _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 +var _0xeb8f=['catch','GetTrigger','Trigger','options','raw','where','attributes','include','map','model','debug','ShowTrigger','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','info'];(function(_0x5ad60a,_0x5262c5){var _0x266de2=function(_0x467006){while(--_0x467006){_0x5ad60a['push'](_0x5ad60a['shift']());}};_0x266de2(++_0x5262c5);}(_0xeb8f,0xde));var _0xfeb8=function(_0x8582c4,_0x206cbf){_0x8582c4=_0x8582c4-0x0;var _0x581f5f=_0xeb8f[_0x8582c4];return _0x581f5f;};'use strict';var _=require(_0xfeb8('0x0'));var util=require(_0xfeb8('0x1'));var moment=require(_0xfeb8('0x2'));var BPromise=require(_0xfeb8('0x3'));var rs=require(_0xfeb8('0x4'));var fs=require('fs');var Redis=require(_0xfeb8('0x5'));var db=require(_0xfeb8('0x6'))['db'];var utils=require(_0xfeb8('0x7'));var logger=require(_0xfeb8('0x8'))('rpc');var config=require(_0xfeb8('0x9'));var jayson=require(_0xfeb8('0xa'));var client=jayson[_0xfeb8('0xb')][_0xfeb8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c637e,_0x98ed5d,_0x16cb05){return new BPromise(function(_0x584955,_0x3407ab){return client[_0xfeb8('0xd')](_0x3c637e,_0x16cb05)[_0xfeb8('0xe')](function(_0x4d7a15){logger['info']('Trigger,\x20%s,\x20%s',_0x98ed5d,_0xfeb8('0xf'));logger['debug'](_0xfeb8('0x10'),_0x98ed5d,_0xfeb8('0xf'),JSON[_0xfeb8('0x11')](_0x4d7a15));if(_0x4d7a15['error']){if(_0x4d7a15[_0xfeb8('0x12')][_0xfeb8('0x13')]===0x1f4){logger[_0xfeb8('0x12')](_0xfeb8('0x14'),_0x98ed5d,_0x4d7a15[_0xfeb8('0x12')][_0xfeb8('0x15')]);return _0x3407ab(_0x4d7a15[_0xfeb8('0x12')][_0xfeb8('0x15')]);}logger[_0xfeb8('0x12')](_0xfeb8('0x14'),_0x98ed5d,_0x4d7a15[_0xfeb8('0x12')][_0xfeb8('0x15')]);return _0x584955(_0x4d7a15[_0xfeb8('0x12')][_0xfeb8('0x15')]);}else{logger[_0xfeb8('0x16')](_0xfeb8('0x14'),_0x98ed5d,_0xfeb8('0xf'));_0x584955(_0x4d7a15['result'][_0xfeb8('0x15')]);}})[_0xfeb8('0x17')](function(_0x4eb6ac){logger[_0xfeb8('0x12')](_0xfeb8('0x14'),_0x98ed5d,_0x4eb6ac);_0x3407ab(_0x4eb6ac);});});}exports[_0xfeb8('0x18')]=function(_0xe1e8d){var _0x119b42=this;return new Promise(function(_0x50cf91,_0x44233d){return db[_0xfeb8('0x19')]['findAll']({'raw':_0xe1e8d[_0xfeb8('0x1a')]?_0xe1e8d[_0xfeb8('0x1a')][_0xfeb8('0x1b')]===undefined?!![]:![]:!![],'where':_0xe1e8d[_0xfeb8('0x1a')]?_0xe1e8d[_0xfeb8('0x1a')][_0xfeb8('0x1c')]||null:null,'attributes':_0xe1e8d[_0xfeb8('0x1a')]?_0xe1e8d[_0xfeb8('0x1a')][_0xfeb8('0x1d')]||null:null,'limit':_0xe1e8d[_0xfeb8('0x1a')]?_0xe1e8d[_0xfeb8('0x1a')]['limit']||null:null,'include':_0xe1e8d[_0xfeb8('0x1a')]?_0xe1e8d[_0xfeb8('0x1a')][_0xfeb8('0x1e')]?_[_0xfeb8('0x1f')](_0xe1e8d[_0xfeb8('0x1a')][_0xfeb8('0x1e')],function(_0x284d81){return{'model':db[_0x284d81[_0xfeb8('0x20')]],'as':_0x284d81['as'],'attributes':_0x284d81[_0xfeb8('0x1d')],'include':_0x284d81['include']?_[_0xfeb8('0x1f')](_0x284d81['include'],function(_0x5a7314){return{'model':db[_0x5a7314[_0xfeb8('0x20')]],'as':_0x5a7314['as'],'attributes':_0x5a7314[_0xfeb8('0x1d')],'include':_0x5a7314['include']?_[_0xfeb8('0x1f')](_0x5a7314[_0xfeb8('0x1e')],function(_0x24a68e){return{'model':db[_0x24a68e[_0xfeb8('0x20')]],'as':_0x24a68e['as'],'attributes':_0x24a68e[_0xfeb8('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34eefb){logger[_0xfeb8('0x16')]('GetTrigger',_0xe1e8d);logger[_0xfeb8('0x21')](_0xfeb8('0x18'),_0xe1e8d,JSON[_0xfeb8('0x11')](_0x34eefb));_0x50cf91(_0x34eefb);})[_0xfeb8('0x17')](function(_0x2b4e65){logger[_0xfeb8('0x12')](_0xfeb8('0x18'),_0x2b4e65[_0xfeb8('0x15')],_0xe1e8d);_0x44233d(_0x119b42[_0xfeb8('0x12')](0x1f4,_0x2b4e65[_0xfeb8('0x15')]));});});};exports[_0xfeb8('0x22')]=function(_0x1e0288){var _0x1af8ce=this;return new Promise(function(_0x15b36d,_0x5c9f09){return db['Trigger']['find']({'raw':_0x1e0288[_0xfeb8('0x1a')]?_0x1e0288['options'][_0xfeb8('0x1b')]===undefined?!![]:![]:!![],'where':_0x1e0288['options']?_0x1e0288[_0xfeb8('0x1a')][_0xfeb8('0x1c')]||null:null,'attributes':_0x1e0288[_0xfeb8('0x1a')]?_0x1e0288[_0xfeb8('0x1a')]['attributes']||null:null,'include':_0x1e0288[_0xfeb8('0x1a')]?_0x1e0288[_0xfeb8('0x1a')][_0xfeb8('0x1e')]?_[_0xfeb8('0x1f')](_0x1e0288['options'][_0xfeb8('0x1e')],function(_0x585ee9){return{'model':db[_0x585ee9[_0xfeb8('0x20')]],'as':_0x585ee9['as'],'attributes':_0x585ee9[_0xfeb8('0x1d')],'include':_0x585ee9['include']?_[_0xfeb8('0x1f')](_0x585ee9[_0xfeb8('0x1e')],function(_0x5c3148){return{'model':db[_0x5c3148[_0xfeb8('0x20')]],'as':_0x5c3148['as'],'attributes':_0x5c3148[_0xfeb8('0x1d')],'include':_0x5c3148[_0xfeb8('0x1e')]?_[_0xfeb8('0x1f')](_0x5c3148[_0xfeb8('0x1e')],function(_0x39c1ea){return{'model':db[_0x39c1ea[_0xfeb8('0x20')]],'as':_0x39c1ea['as'],'attributes':_0x39c1ea['attributes']};}):[]};}):[]};}):[]:[]})[_0xfeb8('0xe')](function(_0x549a){logger['info'](_0xfeb8('0x22'),_0x1e0288);logger[_0xfeb8('0x21')](_0xfeb8('0x22'),_0x1e0288,JSON[_0xfeb8('0x11')](_0x549a));_0x15b36d(_0x549a);})[_0xfeb8('0x17')](function(_0x2d8ffa){logger[_0xfeb8('0x12')]('ShowTrigger',_0x2d8ffa[_0xfeb8('0x15')],_0x1e0288);_0x5c9f09(_0x1af8ce[_0xfeb8('0x12')](0x1f4,_0x2d8ffa['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 6fd7716..60a5663 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 _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 +var _0x8bdc=['create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','show','post','clone'];(function(_0x10e902,_0x3c6cab){var _0x4f083c=function(_0x17c795){while(--_0x17c795){_0x10e902['push'](_0x10e902['shift']());}};_0x4f083c(++_0x3c6cab);}(_0x8bdc,0xf9));var _0xc8bd=function(_0x207185,_0xb1d561){_0x207185=_0x207185-0x0;var _0x3b614f=_0x8bdc[_0x207185];return _0x3b614f;};'use strict';var multer=require('multer');var util=require(_0xc8bd('0x0'));var path=require(_0xc8bd('0x1'));var timeout=require(_0xc8bd('0x2'));var express=require(_0xc8bd('0x3'));var router=express[_0xc8bd('0x4')]();var fs_extra=require(_0xc8bd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc8bd('0x6'));var config=require(_0xc8bd('0x7'));var controller=require(_0xc8bd('0x8'));router[_0xc8bd('0x9')]('/',auth[_0xc8bd('0xa')](),controller[_0xc8bd('0xb')]);router[_0xc8bd('0x9')]('/:id',auth[_0xc8bd('0xa')](),controller[_0xc8bd('0xc')]);router[_0xc8bd('0xd')]('/:id/clone',auth[_0xc8bd('0xa')](),controller[_0xc8bd('0xe')]);router[_0xc8bd('0xd')]('/',auth[_0xc8bd('0xa')](),controller[_0xc8bd('0xf')]);router[_0xc8bd('0x10')](_0xc8bd('0x11'),auth[_0xc8bd('0xa')](),controller[_0xc8bd('0x12')]);router[_0xc8bd('0x13')](_0xc8bd('0x11'),auth['isAuthenticated'](),controller[_0xc8bd('0x14')]);module[_0xc8bd('0x15')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index a72db9c..14fcc14 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 _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 +var _0x6fb6=['shortinfo','inband','auto','nonat','update','yes','force_rport,comedia','getDataValue','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','dynamic','sequelize','exports','STRING','name','ENUM','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','setDataValue','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info'];(function(_0x3914ec,_0x251e79){var _0x2149ba=function(_0x8081f5){while(--_0x8081f5){_0x3914ec['push'](_0x3914ec['shift']());}};_0x2149ba(++_0x251e79);}(_0x6fb6,0x87));var _0x66fb=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x6fb6[_0x55e08b];return _0xd1a7ff;};'use strict';var Sequelize=require(_0x66fb('0x0'));module[_0x66fb('0x1')]={'name':{'type':Sequelize[_0x66fb('0x2')],'allowNull':![],'unique':_0x66fb('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x5'),_0x66fb('0x6'),'peer'),'allowNull':![],'defaultValue':_0x66fb('0x5')},'context':{'type':Sequelize[_0x66fb('0x2')],'allowNull':![],'defaultValue':_0x66fb('0x7')},'callingpres':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x8'),_0x66fb('0x9'),_0x66fb('0xa'),_0x66fb('0xb'),_0x66fb('0xc'),_0x66fb('0xd'),_0x66fb('0xe'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x66fb('0x2')]},'md5secret':{'type':Sequelize[_0x66fb('0x2')]},'remotesecret':{'type':Sequelize[_0x66fb('0x2')]},'transport':{'type':Sequelize[_0x66fb('0x2')],'defaultValue':'udp','set':function(_0x467d6b){this[_0x66fb('0xf')]('transport',_0x467d6b?_0x467d6b[_0x66fb('0x10')](','):null);},'get':function(){return this['getDataValue']('transport')?this['getDataValue'](_0x66fb('0x11'))['split'](','):null;},'comment':_0x66fb('0x12')},'dtmfmode':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x13'),_0x66fb('0x14'),_0x66fb('0x15'),_0x66fb('0x16'),_0x66fb('0x17')),'defaultValue':_0x66fb('0x13')},'directmedia':{'type':Sequelize[_0x66fb('0x4')]('yes','no',_0x66fb('0x18'),_0x66fb('0x19'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x66fb('0x2')]},'directmediadeny':{'type':Sequelize[_0x66fb('0x2')]},'nat':{'type':Sequelize[_0x66fb('0x2')],'defaultValue':_0x66fb('0x1b'),'set':function(_0x3e5181){this[_0x66fb('0xf')]('nat',_0x3e5181?_0x3e5181['join'](','):null);},'get':function(){return this[_0x66fb('0x1c')](_0x66fb('0x1d'))?this[_0x66fb('0x1c')](_0x66fb('0x1d'))[_0x66fb('0x1e')](','):null;},'comment':_0x66fb('0x1f')},'callgroup':{'type':Sequelize[_0x66fb('0x2')]},'namedcallgroup':{'type':Sequelize[_0x66fb('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x66fb('0x2')]},'language':{'type':Sequelize[_0x66fb('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x66fb('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x66fb('0x2')],'defaultValue':_0x66fb('0x20')},'allow':{'type':Sequelize[_0x66fb('0x2')],'allowNull':![],'defaultValue':_0x66fb('0x21'),'set':function(_0x55b419){this[_0x66fb('0xf')](_0x66fb('0x22'),_0x55b419?_0x55b419[_0x66fb('0x10')](';'):_0x66fb('0x21'));},'get':function(){return this[_0x66fb('0x1c')](_0x66fb('0x22'))?this[_0x66fb('0x1c')](_0x66fb('0x22'))[_0x66fb('0x1e')](';'):null;},'comment':_0x66fb('0x23')},'autoframing':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x1a'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x66fb('0x24'),'set':function(_0x315ccf){this['setDataValue']('insecure',_0x315ccf?_0x315ccf[_0x66fb('0x10')](','):null);},'get':function(){return this[_0x66fb('0x1c')](_0x66fb('0x25'))?this[_0x66fb('0x1c')](_0x66fb('0x25'))[_0x66fb('0x1e')](','):null;},'comment':_0x66fb('0x26')},'trustrpid':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x66fb('0x1a'),'no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0x66fb('0x1a'),'no')},'useclientcode':{'type':Sequelize[_0x66fb('0x4')]('yes','no')},'accountcode':{'type':Sequelize[_0x66fb('0x27')](0xb)},'setvar':{'type':Sequelize[_0x66fb('0x2')]},'callerid':{'type':Sequelize[_0x66fb('0x2')],'defaultValue':_0x66fb('0x28')},'amaflags':{'type':Sequelize[_0x66fb('0x2')]},'callcounter':{'type':Sequelize[_0x66fb('0x4')]('yes','no'),'defaultValue':_0x66fb('0x1a')},'busylevel':{'type':Sequelize[_0x66fb('0x27')](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize[_0x66fb('0x4')]('yes','no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x66fb('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x1a'),'no')},'subscribecontext':{'type':Sequelize[_0x66fb('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x1a'),'no',_0x66fb('0x29')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x66fb('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x1a'),'no')},'mailbox':{'type':Sequelize[_0x66fb('0x2')]},'session_timers':{'type':Sequelize[_0x66fb('0x4')]('accept',_0x66fb('0x2a'),_0x66fb('0x2b'))},'session_expires':{'type':Sequelize[_0x66fb('0x27')](0xb)},'session_minse':{'type':Sequelize[_0x66fb('0x27')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x66fb('0x2c'),_0x66fb('0x2d')),'defaultValue':_0x66fb('0x2d')},'t38pt_usertpsource':{'type':Sequelize[_0x66fb('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x66fb('0x2')]},'fromuser':{'type':Sequelize[_0x66fb('0x2')]},'port':{'type':Sequelize[_0x66fb('0x27')](0x5)},'qualify':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x1a'),'no'),'defaultValue':_0x66fb('0x1a')},'keepalive':{'type':Sequelize[_0x66fb('0x27')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x66fb('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x66fb('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x1a'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x66fb('0x2')]},'callbackextension':{'type':Sequelize[_0x66fb('0x2')]},'timert1':{'type':Sequelize[_0x66fb('0x27')](0xb)},'timerb':{'type':Sequelize[_0x66fb('0x27')](0xb)},'qualifyfreq':{'type':Sequelize[_0x66fb('0x27')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x66fb('0x2')]},'contactacl':{'type':Sequelize[_0x66fb('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x66fb('0x2')]},'use_q850_reason':{'type':Sequelize[_0x66fb('0x2')]},'maxforwards':{'type':Sequelize[_0x66fb('0x27')](0xb)},'encryption':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x1a'),'no')},'force_avp':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x1a'),'no')},'icesupport':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x1a'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x66fb('0x1a'),'no')},'dtlsverify':{'type':Sequelize[_0x66fb('0x4')]('yes','no',_0x66fb('0x2e'),_0x66fb('0x2f'))},'dtlsrekey':{'type':Sequelize[_0x66fb('0x27')](0xb)},'dtlscertfile':{'type':Sequelize[_0x66fb('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x66fb('0x2')]},'dtlscipher':{'type':Sequelize[_0x66fb('0x2')]},'dtlscafile':{'type':Sequelize[_0x66fb('0x2')]},'dtlscapath':{'type':Sequelize[_0x66fb('0x2')]},'dtlssetup':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x30'),_0x66fb('0x31'),_0x66fb('0x32')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x66fb('0x2')]},'usereqphone':{'type':Sequelize['ENUM'](_0x66fb('0x1a'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x66fb('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x66fb('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x66fb('0x1a'),'no')},'subscribemwi':{'type':Sequelize[_0x66fb('0x4')](_0x66fb('0x1a'),'no')},'vmexten':{'type':Sequelize[_0x66fb('0x2')]},'mohinterpret':{'type':Sequelize[_0x66fb('0x2')]},'mohsuggest':{'type':Sequelize[_0x66fb('0x2')]},'parkinglot':{'type':Sequelize[_0x66fb('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0x66fb('0x33')},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0x66fb('0x18'),_0x66fb('0x19'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x66fb('0x2')]},'otherFields':{'type':Sequelize[_0x66fb('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x66fb('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 e9f88d3..b1a29d1 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 _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 +var _0x6aa7=['sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','length','includeAll','clone','find','get','createdAt','body','omit','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','autoAssociation','update','utf8','server/files/templates/registry.ejs','writeFileSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','then','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','order'];(function(_0x10fabc,_0x38a95b){var _0x11472f=function(_0x5ad663){while(--_0x5ad663){_0x10fabc['push'](_0x10fabc['shift']());}};_0x11472f(++_0x38a95b);}(_0x6aa7,0x178));var _0x76aa=function(_0x47da0f,_0x5239f6){_0x47da0f=_0x47da0f-0x0;var _0x1ec262=_0x6aa7[_0x47da0f];return _0x1ec262;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xf'));var authService=require(_0x76aa('0x10'));var qs=require(_0x76aa('0x11'));var as=require(_0x76aa('0x12'));var hardwareService=require(_0x76aa('0x13'));var logger=require(_0x76aa('0x14'))(_0x76aa('0x15'));var utils=require(_0x76aa('0x16'));var config=require(_0x76aa('0x17'));var licenseUtil=require(_0x76aa('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x76aa('0x19'));var client=jayson['client'][_0x76aa('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x12dde0,_0x3f8f6b,_0x8e44ed,_0x10432c){return new BPromise(function(_0x4e309f,_0x5f5b59){var _0x2b3b4f=_0x10432c||client;return _0x2b3b4f['request'](_0x12dde0,_0x8e44ed)[_0x76aa('0x1b')](function(_0x319bf1){logger['info'](_0x76aa('0x1c'),_0x3f8f6b,'request\x20sent');logger[_0x76aa('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x3f8f6b,_0x76aa('0x1e'),JSON[_0x76aa('0x1f')](_0x319bf1));if(_0x319bf1[_0x76aa('0x20')]){if(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x21')]===0x1f4){logger[_0x76aa('0x20')]('Trunk,\x20%s,\x20%s',_0x3f8f6b,_0x319bf1['error'][_0x76aa('0x22')]);return _0x5f5b59(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);}logger[_0x76aa('0x20')](_0x76aa('0x1c'),_0x3f8f6b,_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);return _0x4e309f(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);}else{logger['info'](_0x76aa('0x1c'),_0x3f8f6b,_0x76aa('0x1e'));_0x4e309f(_0x319bf1[_0x76aa('0x23')]['message']);}})[_0x76aa('0x24')](function(_0x189cb6){logger[_0x76aa('0x20')](_0x76aa('0x1c'),_0x3f8f6b,_0x189cb6);_0x5f5b59(_0x189cb6);});});}function respondWithStatusCode(_0x29c50c,_0xc1044c){_0xc1044c=_0xc1044c||0xcc;return function(_0x3cd039){if(_0x3cd039){return _0x29c50c[_0x76aa('0x25')](_0xc1044c);}return _0x29c50c[_0x76aa('0x26')](_0xc1044c)[_0x76aa('0x27')]();};}function respondWithResult(_0x37f1ab,_0x26b75e){_0x26b75e=_0x26b75e||0xc8;return function(_0x3599a9){if(_0x3599a9){return _0x37f1ab['status'](_0x26b75e)[_0x76aa('0x28')](_0x3599a9);}};}function respondWithFilteredResult(_0x1d6d15,_0x25c614){return function(_0x2e7ab4){if(_0x2e7ab4){var _0xa1e6=typeof _0x25c614[_0x76aa('0x29')]===_0x76aa('0x2a')&&typeof _0x25c614[_0x76aa('0x2b')]===_0x76aa('0x2a');var _0x1bdc3d=_0x2e7ab4['count'];var _0x3fcb7f=_0xa1e6?0x0:_0x25c614['offset'];var _0x994550=_0xa1e6?_0x2e7ab4[_0x76aa('0x2c')]:_0x25c614[_0x76aa('0x29')]+_0x25c614[_0x76aa('0x2b')];var _0x1eecd9;if(_0x994550>=_0x1bdc3d){_0x994550=_0x1bdc3d;_0x1eecd9=0xc8;}else{_0x1eecd9=0xce;}_0x1d6d15[_0x76aa('0x26')](_0x1eecd9);return _0x1d6d15[_0x76aa('0x2d')](_0x76aa('0x2e'),_0x3fcb7f+'-'+_0x994550+'/'+_0x1bdc3d)[_0x76aa('0x28')](_0x2e7ab4);}return null;};}function patchUpdates(_0x3ea05a){return function(_0x5edcd8){try{jsonpatch[_0x76aa('0x2f')](_0x5edcd8,_0x3ea05a,!![]);}catch(_0x5532c7){return BPromise[_0x76aa('0x30')](_0x5532c7);}return _0x5edcd8[_0x76aa('0x31')]();};}function saveUpdates(_0x458ac3,_0x38ecd1){return function(_0x35a705){if(_0x35a705){return _0x35a705['update'](_0x458ac3)[_0x76aa('0x1b')](function(_0x25a11f){return _0x25a11f;});}return null;};}function removeEntity(_0x5a0f72,_0x2ee338){return function(_0x58d860){if(_0x58d860){return _0x58d860[_0x76aa('0x32')]()['then'](function(){var _0x8479a3=_0x58d860['get']({'plain':!![]});var _0x58f135=_0x76aa('0x33');return db[_0x76aa('0x34')][_0x76aa('0x32')]({'where':{'type':_0x58f135,'resourceId':_0x8479a3['id']}})[_0x76aa('0x1b')](function(){return _0x58d860;});})['then'](function(){_0x5a0f72['status'](0xcc)[_0x76aa('0x27')]();});}};}function handleEntityNotFound(_0x1c7b6f,_0x58127c){return function(_0x23e2fd){if(!_0x23e2fd){_0x1c7b6f[_0x76aa('0x25')](0x194);}return _0x23e2fd;};}function handleError(_0x5b57d8,_0x9ce5f4){_0x9ce5f4=_0x9ce5f4||0x1f4;return function(_0x5c77f1){logger['error'](_0x5c77f1[_0x76aa('0x35')]);if(_0x5c77f1[_0x76aa('0x36')]){delete _0x5c77f1[_0x76aa('0x36')];}_0x5b57d8[_0x76aa('0x26')](_0x9ce5f4)['send'](_0x5c77f1);};}exports[_0x76aa('0x37')]=function(_0x1c22f7,_0x2eea79){var _0x4e131a={},_0x113770={},_0x1638db={'count':0x0,'rows':[]};var _0x2f7726=_[_0x76aa('0x38')](db[_0x76aa('0x39')][_0x76aa('0x3a')],function(_0x878903){return{'name':_0x878903[_0x76aa('0x3b')],'type':_0x878903[_0x76aa('0x3c')]['key']};});_0x113770[_0x76aa('0x3d')]=_[_0x76aa('0x38')](_0x2f7726,_0x76aa('0x36'));_0x113770[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x1c22f7[_0x76aa('0x3e')]);_0x113770['filters']=_['intersection'](_0x113770[_0x76aa('0x3d')],_0x113770[_0x76aa('0x3e')]);_0x4e131a[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x113770['model'],qs[_0x76aa('0x42')](_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x4e131a[_0x76aa('0x40')]=_0x4e131a[_0x76aa('0x40')]['length']?_0x4e131a[_0x76aa('0x40')]:_0x113770['model'];if(!_0x1c22f7[_0x76aa('0x3e')]['hasOwnProperty']('nolimit')){_0x4e131a['limit']=qs[_0x76aa('0x2b')](_0x1c22f7['query']['limit']);_0x4e131a['offset']=qs[_0x76aa('0x29')](_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x29')]);}_0x4e131a[_0x76aa('0x43')]=qs[_0x76aa('0x44')](_0x1c22f7['query'][_0x76aa('0x44')]);_0x4e131a[_0x76aa('0x45')]=qs[_0x76aa('0x46')](_[_0x76aa('0x47')](_0x1c22f7[_0x76aa('0x3e')],_0x113770['filters']),_0x2f7726);if(_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x48')]){_0x4e131a['where']=_[_0x76aa('0x49')](_0x4e131a['where'],{'$or':_[_0x76aa('0x38')](_0x2f7726,function(_0x24ea05){if(_0x24ea05[_0x76aa('0x3c')]!==_0x76aa('0x4a')){var _0x2d0bc4={};_0x2d0bc4[_0x24ea05[_0x76aa('0x36')]]={'$like':'%'+_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x48')]+'%'};return _0x2d0bc4;}})});}_0x4e131a=_[_0x76aa('0x49')]({},_0x4e131a,_0x1c22f7[_0x76aa('0x4b')]);var _0x5e4967={'where':_0x4e131a[_0x76aa('0x45')]};return db['Trunk'][_0x76aa('0x2c')](_0x5e4967)[_0x76aa('0x1b')](function(_0x5e95f5){_0x1638db[_0x76aa('0x2c')]=_0x5e95f5;if(_0x1c22f7['query']['includeAll']){_0x4e131a[_0x76aa('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0x76aa('0x4d')](_0x4e131a);})[_0x76aa('0x1b')](function(_0x4315b3){_0x1638db[_0x76aa('0x4e')]=_0x4315b3;return _0x1638db;})[_0x76aa('0x1b')](respondWithFilteredResult(_0x2eea79,_0x4e131a))[_0x76aa('0x24')](handleError(_0x2eea79,null));};exports['show']=function(_0x564546,_0x2fcf8f){var _0x1eafb2={'raw':![],'where':{'id':_0x564546[_0x76aa('0x4f')]['id']}},_0x1708d4={};_0x1708d4[_0x76aa('0x3d')]=_[_0x76aa('0x3f')](db['Trunk'][_0x76aa('0x3a')]);_0x1708d4[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x564546['query']);_0x1708d4[_0x76aa('0x46')]=_['intersection'](_0x1708d4[_0x76aa('0x3d')],_0x1708d4['query']);_0x1eafb2[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x1708d4[_0x76aa('0x3d')],qs[_0x76aa('0x42')](_0x564546[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x1eafb2[_0x76aa('0x40')]=_0x1eafb2['attributes'][_0x76aa('0x50')]?_0x1eafb2['attributes']:_0x1708d4[_0x76aa('0x3d')];if(_0x564546[_0x76aa('0x3e')][_0x76aa('0x51')]){_0x1eafb2[_0x76aa('0x4c')]=[{'all':!![]}];}_0x1eafb2=_[_0x76aa('0x49')]({},_0x1eafb2,_0x564546[_0x76aa('0x4b')]);return db[_0x76aa('0x39')]['find'](_0x1eafb2)[_0x76aa('0x1b')](handleEntityNotFound(_0x2fcf8f,null))[_0x76aa('0x1b')](respondWithResult(_0x2fcf8f,null))[_0x76aa('0x24')](handleError(_0x2fcf8f,null));};exports[_0x76aa('0x52')]=function(_0x5c742c,_0xb9401b){var _0x163440={'where':{'id':_0x5c742c[_0x76aa('0x4f')]['id']}},_0x8dc601={};_0x8dc601[_0x76aa('0x3d')]=_[_0x76aa('0x3f')](db['Trunk'][_0x76aa('0x3a')]);_0x163440[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x8dc601[_0x76aa('0x3d')],qs[_0x76aa('0x42')](_0x5c742c[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x163440['attributes']=_0x163440['attributes'][_0x76aa('0x50')]?_0x163440[_0x76aa('0x40')]:_0x8dc601['model'];if(_0x5c742c[_0x76aa('0x3e')][_0x76aa('0x51')]){_0x163440['include']=[{'all':!![]}];}_0x163440=_[_0x76aa('0x49')]({},_0x163440,_0x5c742c[_0x76aa('0x4b')]);return db[_0x76aa('0x39')][_0x76aa('0x53')](_0x163440)[_0x76aa('0x1b')](handleEntityNotFound(_0xb9401b,null))[_0x76aa('0x1b')](function(_0x3376ec){if(_0x3376ec){var _0x30573a=_0x3376ec[_0x76aa('0x54')]({'plain':!![]});_0x30573a=qs['omit'](_0x30573a,['id',_0x76aa('0x55'),'updatedAt']);_0x5c742c[_0x76aa('0x56')]=_[_0x76aa('0x57')](_0x5c742c[_0x76aa('0x56')],['id',_0x76aa('0x55'),_0x76aa('0x58')]);return db[_0x76aa('0x39')][_0x76aa('0x59')](_[_0x76aa('0x49')](_0x30573a,_0x5c742c[_0x76aa('0x56')]),{'include':_0x5c742c['query'][_0x76aa('0x51')]?[{'all':!![]}]:undefined})[_0x76aa('0x1b')](function(_0x5c542b){var _0xe5957d=_0x5c742c[_0x76aa('0x5a')][_0x76aa('0x54')]({'plain':!![]});if(!_0xe5957d)throw new Error(_0x76aa('0x5b'));if(_0xe5957d[_0x76aa('0x5c')]==='user'){var _0x364d05=_0x5c542b['get']({'plain':!![]});var _0x35bd2b=_0x76aa('0x33');return db[_0x76aa('0x5d')][_0x76aa('0x53')]({'where':{'name':_0x35bd2b,'userProfileId':_0xe5957d[_0x76aa('0x5e')]},'raw':!![]})[_0x76aa('0x1b')](function(_0x2bfb46){if(_0x2bfb46&&_0x2bfb46['autoAssociation']===0x0){return db[_0x76aa('0x34')][_0x76aa('0x59')]({'name':_0x364d05['name'],'resourceId':_0x364d05['id'],'type':_0x2bfb46['name'],'sectionId':_0x2bfb46['id']},{})[_0x76aa('0x1b')](function(){return _0x5c542b;});}else{return _0x5c542b;}})[_0x76aa('0x24')](function(_0x5295a7){logger[_0x76aa('0x20')](_0x76aa('0x5f'),_0x5295a7);throw _0x5295a7;});}return _0x5c542b;});}})[_0x76aa('0x1b')](respondWithResult(_0xb9401b,0xc9))['catch'](handleError(_0xb9401b,null));};exports[_0x76aa('0x59')]=function(_0x47f733,_0xf31e1f,_0x1178e5){var _0x2315cf;return db[_0x76aa('0x39')]['create'](_0x47f733['body'],{'raw':!![]})[_0x76aa('0x1b')](function(_0x4dfeb3){_0x2315cf=_0x4dfeb3;return db[_0x76aa('0x39')][_0x76aa('0x4d')]({'raw':!![]});})[_0x76aa('0x1b')](function(_0x43a2af){var _0x2dd320=fs[_0x76aa('0x60')](path[_0x76aa('0x61')](config[_0x76aa('0x62')],_0x76aa('0x63')),'utf8');var _0x7d02e7=fs[_0x76aa('0x60')](path[_0x76aa('0x61')](config[_0x76aa('0x62')],'server/files/templates/registry.ejs'),'utf8');var _0x557c11=ejs[_0x76aa('0x64')](_0x2dd320,{'trunks':_0x43a2af||[]});fs['writeFileSync'](_0x76aa('0x65'),_0x557c11);if(_0x2315cf[_0x76aa('0x66')]){var _0x38faff=ejs[_0x76aa('0x64')](_0x7d02e7,{'trunks':_0x43a2af||[]});fs['writeFileSync'](_0x76aa('0x67'),_0x38faff);}})['then'](function(){return respondWithRpcPromise(_0x76aa('0x68'),_0x76aa('0x59'),{'module':_0x76aa('0x69')});})[_0x76aa('0x1b')](function(){var _0x1037fb=_0x47f733['user'][_0x76aa('0x54')]({'plain':!![]});if(!_0x1037fb)throw new Error(_0x76aa('0x5b'));if(_0x1037fb[_0x76aa('0x5c')]===_0x76aa('0x5a')){var _0x32c1de=_0x2315cf[_0x76aa('0x54')]({'plain':!![]});return db[_0x76aa('0x5d')][_0x76aa('0x53')]({'where':{'name':'Trunks','userProfileId':_0x1037fb[_0x76aa('0x5e')]},'raw':!![]})[_0x76aa('0x1b')](function(_0x48136a){if(_0x48136a&&_0x48136a[_0x76aa('0x6a')]===0x0){return db[_0x76aa('0x34')][_0x76aa('0x59')]({'name':_0x32c1de[_0x76aa('0x36')],'resourceId':_0x32c1de['id'],'type':_0x48136a[_0x76aa('0x36')],'sectionId':_0x48136a['id']},{})[_0x76aa('0x1b')](function(){return _0x2315cf;});}else{return _0x2315cf;}})[_0x76aa('0x24')](function(_0x5dc923){logger[_0x76aa('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5dc923);throw _0x5dc923;});}return _0x2315cf;})['then'](respondWithResult(_0xf31e1f,0xc9))[_0x76aa('0x24')](handleError(_0xf31e1f,null));};exports[_0x76aa('0x6b')]=function(_0x5d8947,_0x5d1de1,_0x36da4d){var _0x14b5a2;return db[_0x76aa('0x39')]['find']({'where':{'id':_0x5d8947['params']['id']}})[_0x76aa('0x1b')](handleEntityNotFound(_0x5d1de1,null))[_0x76aa('0x1b')](saveUpdates(_0x5d8947[_0x76aa('0x56')],null))['then'](function(_0xb70589){if(_0xb70589){_0x14b5a2=_0xb70589;return db['Trunk'][_0x76aa('0x4d')]({'raw':!![]});}})[_0x76aa('0x1b')](function(_0x383290){if(_0x383290){var _0x325ffa=fs[_0x76aa('0x60')](path['join'](config['root'],_0x76aa('0x63')),_0x76aa('0x6c'));var _0x19ebb7=fs['readFileSync'](path[_0x76aa('0x61')](config[_0x76aa('0x62')],_0x76aa('0x6d')),_0x76aa('0x6c'));var _0x303b78=ejs['render'](_0x325ffa,{'trunks':_0x383290||[]});fs[_0x76aa('0x6e')]('/etc/asterisk/sip_xcally_trunks.conf',_0x303b78);var _0x213f7f=ejs[_0x76aa('0x64')](_0x19ebb7,{'trunks':_0x383290||[]});fs[_0x76aa('0x6e')](_0x76aa('0x67'),_0x213f7f);return respondWithRpcPromise(_0x76aa('0x68'),_0x76aa('0x6b'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x547411){if(_0x547411){return _0x14b5a2;}})['then'](respondWithResult(_0x5d1de1,null))['catch'](handleError(_0x5d1de1,null));};exports[_0x76aa('0x32')]=function(_0x22f44f,_0x52c5be,_0x5c2c91){var _0x4f01e9;return db[_0x76aa('0x39')][_0x76aa('0x53')]({'where':{'id':_0x22f44f[_0x76aa('0x4f')]['id']}})['then'](handleEntityNotFound(_0x52c5be,null))['then'](removeEntity(_0x52c5be,null))[_0x76aa('0x1b')](function(){return db[_0x76aa('0x39')][_0x76aa('0x4d')]({'raw':!![]});})[_0x76aa('0x1b')](function(_0x354c7b){var _0x55e526=fs['readFileSync'](path[_0x76aa('0x61')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x4673e6=fs[_0x76aa('0x60')](path['join'](config[_0x76aa('0x62')],_0x76aa('0x6d')),'utf8');var _0x22063f=ejs[_0x76aa('0x64')](_0x55e526,{'trunks':_0x354c7b});var _0x11d91f=ejs[_0x76aa('0x64')](_0x4673e6,{'trunks':_0x354c7b});fs[_0x76aa('0x6e')](_0x76aa('0x65'),_0x22063f);fs[_0x76aa('0x6e')](_0x76aa('0x67'),_0x11d91f);return respondWithRpcPromise(_0x76aa('0x68'),'destroy',{'module':_0x76aa('0x69')});})[_0x76aa('0x24')](handleError(_0x52c5be,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 07078ae..e334a6e 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 _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 +var _0x92eb=['Trunk','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes'];(function(_0xa16401,_0x9a9949){var _0x3d5676=function(_0x2e639f){while(--_0x2e639f){_0xa16401['push'](_0xa16401['shift']());}};_0x3d5676(++_0x9a9949);}(_0x92eb,0x156));var _0xb92e=function(_0x3ce0b6,_0x2e1e86){_0x3ce0b6=_0x3ce0b6-0x0;var _0x399f48=_0x92eb[_0x3ce0b6];return _0x399f48;};'use strict';var _=require('lodash');var util=require(_0xb92e('0x0'));var logger=require(_0xb92e('0x1'))(_0xb92e('0x2'));var moment=require(_0xb92e('0x3'));var BPromise=require(_0xb92e('0x4'));var rp=require(_0xb92e('0x5'));var fs=require('fs');var path=require(_0xb92e('0x6'));var rimraf=require(_0xb92e('0x7'));var config=require(_0xb92e('0x8'));var attributes=require(_0xb92e('0x9'));module['exports']=function(_0x3d64ac,_0x1e1923){return _0x3d64ac['define'](_0xb92e('0xa'),attributes,{'tableName':'tools_trunks','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 3245d48..1044a21 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 _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 +var _0x61af=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','GetTrunk','options','raw','attributes','limit','include','map','model','ShowTrunk','find','where','lodash','util'];(function(_0x59ddd3,_0x21440c){var _0x49fb32=function(_0x35d5dd){while(--_0x35d5dd){_0x59ddd3['push'](_0x59ddd3['shift']());}};_0x49fb32(++_0x21440c);}(_0x61af,0x196));var _0xf61a=function(_0x1e93fa,_0x210f48){_0x1e93fa=_0x1e93fa-0x0;var _0xd4e1e6=_0x61af[_0x1e93fa];return _0xd4e1e6;};'use strict';var _=require(_0xf61a('0x0'));var util=require(_0xf61a('0x1'));var moment=require(_0xf61a('0x2'));var BPromise=require(_0xf61a('0x3'));var rs=require(_0xf61a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf61a('0x5'))['db'];var utils=require(_0xf61a('0x6'));var logger=require('../../config/logger')(_0xf61a('0x7'));var config=require(_0xf61a('0x8'));var jayson=require(_0xf61a('0x9'));var client=jayson[_0xf61a('0xa')][_0xf61a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13c804,_0x493d87,_0x446478){return new BPromise(function(_0xf4a25a,_0x44d535){return client[_0xf61a('0xc')](_0x13c804,_0x446478)[_0xf61a('0xd')](function(_0x12ceb2){logger['info'](_0xf61a('0xe'),_0x493d87,'request\x20sent');logger[_0xf61a('0xf')](_0xf61a('0x10'),_0x493d87,_0xf61a('0x11'),JSON[_0xf61a('0x12')](_0x12ceb2));if(_0x12ceb2[_0xf61a('0x13')]){if(_0x12ceb2[_0xf61a('0x13')]['code']===0x1f4){logger[_0xf61a('0x13')](_0xf61a('0xe'),_0x493d87,_0x12ceb2[_0xf61a('0x13')][_0xf61a('0x14')]);return _0x44d535(_0x12ceb2[_0xf61a('0x13')][_0xf61a('0x14')]);}logger[_0xf61a('0x13')](_0xf61a('0xe'),_0x493d87,_0x12ceb2[_0xf61a('0x13')][_0xf61a('0x14')]);return _0xf4a25a(_0x12ceb2[_0xf61a('0x13')][_0xf61a('0x14')]);}else{logger[_0xf61a('0x15')](_0xf61a('0xe'),_0x493d87,_0xf61a('0x11'));_0xf4a25a(_0x12ceb2['result']['message']);}})[_0xf61a('0x16')](function(_0x5cfca7){logger['error'](_0xf61a('0xe'),_0x493d87,_0x5cfca7);_0x44d535(_0x5cfca7);});});}exports[_0xf61a('0x17')]=function(_0x4435ae){var _0x28e064=this;return new Promise(function(_0x47ff27,_0x37c060){return db['Trunk']['findAll']({'raw':_0x4435ae[_0xf61a('0x18')]?_0x4435ae[_0xf61a('0x18')][_0xf61a('0x19')]===undefined?!![]:![]:!![],'where':_0x4435ae[_0xf61a('0x18')]?_0x4435ae[_0xf61a('0x18')]['where']||null:null,'attributes':_0x4435ae[_0xf61a('0x18')]?_0x4435ae[_0xf61a('0x18')][_0xf61a('0x1a')]||null:null,'limit':_0x4435ae[_0xf61a('0x18')]?_0x4435ae[_0xf61a('0x18')][_0xf61a('0x1b')]||null:null,'include':_0x4435ae['options']?_0x4435ae[_0xf61a('0x18')][_0xf61a('0x1c')]?_[_0xf61a('0x1d')](_0x4435ae[_0xf61a('0x18')][_0xf61a('0x1c')],function(_0x448f33){return{'model':db[_0x448f33['model']],'as':_0x448f33['as'],'attributes':_0x448f33[_0xf61a('0x1a')],'include':_0x448f33[_0xf61a('0x1c')]?_[_0xf61a('0x1d')](_0x448f33[_0xf61a('0x1c')],function(_0x29e286){return{'model':db[_0x29e286[_0xf61a('0x1e')]],'as':_0x29e286['as'],'attributes':_0x29e286[_0xf61a('0x1a')],'include':_0x29e286[_0xf61a('0x1c')]?_['map'](_0x29e286[_0xf61a('0x1c')],function(_0x1a2e87){return{'model':db[_0x1a2e87[_0xf61a('0x1e')]],'as':_0x1a2e87['as'],'attributes':_0x1a2e87[_0xf61a('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e1e87){logger['info'](_0xf61a('0x17'),_0x4435ae);logger['debug']('GetTrunk',_0x4435ae,JSON['stringify'](_0x5e1e87));_0x47ff27(_0x5e1e87);})[_0xf61a('0x16')](function(_0x63f0f2){logger[_0xf61a('0x13')](_0xf61a('0x17'),_0x63f0f2[_0xf61a('0x14')],_0x4435ae);_0x37c060(_0x28e064[_0xf61a('0x13')](0x1f4,_0x63f0f2[_0xf61a('0x14')]));});});};exports[_0xf61a('0x1f')]=function(_0x1b2144){var _0x2bab58=this;return new Promise(function(_0x918595,_0x16b5ac){return db['Trunk'][_0xf61a('0x20')]({'raw':_0x1b2144['options']?_0x1b2144['options']['raw']===undefined?!![]:![]:!![],'where':_0x1b2144[_0xf61a('0x18')]?_0x1b2144[_0xf61a('0x18')][_0xf61a('0x21')]||null:null,'attributes':_0x1b2144[_0xf61a('0x18')]?_0x1b2144['options']['attributes']||null:null,'include':_0x1b2144[_0xf61a('0x18')]?_0x1b2144[_0xf61a('0x18')][_0xf61a('0x1c')]?_[_0xf61a('0x1d')](_0x1b2144[_0xf61a('0x18')][_0xf61a('0x1c')],function(_0x126daf){return{'model':db[_0x126daf[_0xf61a('0x1e')]],'as':_0x126daf['as'],'attributes':_0x126daf['attributes'],'include':_0x126daf['include']?_[_0xf61a('0x1d')](_0x126daf[_0xf61a('0x1c')],function(_0x4a9080){return{'model':db[_0x4a9080[_0xf61a('0x1e')]],'as':_0x4a9080['as'],'attributes':_0x4a9080[_0xf61a('0x1a')],'include':_0x4a9080['include']?_['map'](_0x4a9080[_0xf61a('0x1c')],function(_0x592889){return{'model':db[_0x592889[_0xf61a('0x1e')]],'as':_0x592889['as'],'attributes':_0x592889[_0xf61a('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f599d){logger[_0xf61a('0x15')](_0xf61a('0x1f'),_0x1b2144);logger[_0xf61a('0xf')](_0xf61a('0x1f'),_0x1b2144,JSON['stringify'](_0x4f599d));_0x918595(_0x4f599d);})['catch'](function(_0x45a18d){logger[_0xf61a('0x13')](_0xf61a('0x1f'),_0x45a18d[_0xf61a('0x14')],_0x1b2144);_0x16b5ac(_0x2bab58[_0xf61a('0x13')](0x1f4,_0x45a18d[_0xf61a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 247904e..075cf8e 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 _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 +var _0x1760=['express','../../components/auth/service','./user-setting.controller','/:id','update','exports'];(function(_0x3794e9,_0x5af1fb){var _0x54c61c=function(_0x5c4872){while(--_0x5c4872){_0x3794e9['push'](_0x3794e9['shift']());}};_0x54c61c(++_0x5af1fb);}(_0x1760,0xd2));var _0x0176=function(_0x4086ea,_0x1f652f){_0x4086ea=_0x4086ea-0x0;var _0x5bab0f=_0x1760[_0x4086ea];return _0x5bab0f;};'use strict';var express=require(_0x0176('0x0'));var router=express['Router']();var auth=require(_0x0176('0x1'));var controller=require(_0x0176('0x2'));router['put'](_0x0176('0x3'),auth['isAuthenticated'](),controller[_0x0176('0x4')]);module[_0x0176('0x5')]=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 48726bd..7e9f3c7 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 _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 +var _0xe6e4=['DATE','INTEGER','UserId','error','warning','info','debug','BOOLEAN'];(function(_0x11a383,_0x4e05ae){var _0x49f2bb=function(_0x52e0ee){while(--_0x52e0ee){_0x11a383['push'](_0x11a383['shift']());}};_0x49f2bb(++_0x4e05ae);}(_0xe6e4,0x123));var _0x4e6e=function(_0x12ce1d,_0x27dad7){_0x12ce1d=_0x12ce1d-0x0;var _0x3e987f=_0xe6e4[_0x12ce1d];return _0x3e987f;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x4e6e('0x0'),_0x4e6e('0x1'),_0x4e6e('0x2'),_0x4e6e('0x3')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x4e6e('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x4e6e('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x4e6e('0x5')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x4e6e('0x6')],'unique':_0x4e6e('0x7')}}; \ 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 45bdaab..d9208f4 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 _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 +var _0xbfda=['status','json','update','then','sendStatus','error','stack','name','send','user','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','catch','lodash','ioredis','../../config/logger','../../config/environment','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost'];(function(_0x5447aa,_0x3afc00){var _0xb21e53=function(_0x2d05f6){while(--_0x2d05f6){_0x5447aa['push'](_0x5447aa['shift']());}};_0xb21e53(++_0x3afc00);}(_0xbfda,0x1dc));var _0xabfd=function(_0x5c72ee,_0x5a8bf8){_0x5c72ee=_0x5c72ee-0x0;var _0x231876=_0xbfda[_0x5c72ee];return _0x231876;};'use strict';var _=require(_0xabfd('0x0'));var Redis=require(_0xabfd('0x1'));var logger=require(_0xabfd('0x2'))('api');var config=require(_0xabfd('0x3'));var db=require('../../mysqldb')['db'];var socket=require(_0xabfd('0x4'))(new Redis(config[_0xabfd('0x5')]));require(_0xabfd('0x6'))[_0xabfd('0x7')](socket);config['redis']=_[_0xabfd('0x8')](config['redis'],{'host':_0xabfd('0x9'),'port':0x18eb});function respondWithResult(_0x537d54,_0x27ca51){_0x27ca51=_0x27ca51||0xc8;return function(_0x49368e){if(_0x49368e){return _0x537d54[_0xabfd('0xa')](_0x27ca51)[_0xabfd('0xb')](_0x49368e);}};}function saveUpdates(_0x1b4264){return function(_0x3ddf0e){if(_0x3ddf0e){return _0x3ddf0e[_0xabfd('0xc')](_0x1b4264)[_0xabfd('0xd')](function(_0x557b3f){return _0x557b3f;});}return null;};}function handleEntityNotFound(_0x3d3448){return function(_0xfef859){if(!_0xfef859){_0x3d3448[_0xabfd('0xe')](0x194);}return _0xfef859;};}function handleError(_0x285d2c,_0x3d779a){_0x3d779a=_0x3d779a||0x1f4;return function(_0x2b2469){logger[_0xabfd('0xf')](_0x2b2469[_0xabfd('0x10')]);if(_0x2b2469[_0xabfd('0x11')]){delete _0x2b2469[_0xabfd('0x11')];}_0x285d2c[_0xabfd('0xa')](_0x3d779a)[_0xabfd('0x12')](_0x2b2469);};}exports[_0xabfd('0xc')]=function(_0x53e590,_0x1c0216){if(_0x53e590[_0xabfd('0x13')]['role']!==_0xabfd('0x14'))throw new Error(_0xabfd('0x15'));if(isNaN(Number(_0x53e590[_0xabfd('0x16')]['id'])))throw new Error(_0xabfd('0x17'));return db[_0xabfd('0x18')][_0xabfd('0x19')]({'where':{'id':_0x53e590[_0xabfd('0x16')]['id']}})[_0xabfd('0xd')](handleEntityNotFound(_0x1c0216,null))[_0xabfd('0xd')](saveUpdates(_0x53e590['body'],null))[_0xabfd('0xd')](respondWithResult(_0x1c0216,null))[_0xabfd('0x1a')](handleError(_0x1c0216,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 a37ac6f..7b99098 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 _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 +var _0xdc9a=['events','../../mysqldb','UserSetting','setMaxListeners','update','remove','hasOwnProperty','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xdc9a,0xc8));var _0xadc9=function(_0x33f5b4,_0x576c15){_0x33f5b4=_0x33f5b4-0x0;var _0xa76b08=_0xdc9a[_0x33f5b4];return _0xa76b08;};'use strict';var EventEmitter=require(_0xadc9('0x0'));var UserSetting=require(_0xadc9('0x1'))['db'][_0xadc9('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xadc9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xadc9('0x4'),'afterDestroy':_0xadc9('0x5')};function emitEvent(_0x3de9c5){return function(_0x2967fb,_0x4f8d04,_0x201aef){UserSettingEvents['emit'](_0x3de9c5+':'+_0x2967fb['id'],_0x2967fb);UserSettingEvents['emit'](_0x3de9c5,_0x2967fb);_0x201aef(null);};}for(var e in events){if(events[_0xadc9('0x6')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0xadc9('0x7')]=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 b8da7dc..b99be68 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 _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 +var _0x80ed=['define','UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x17d76b,_0x54345b){var _0x16f3ac=function(_0x315442){while(--_0x315442){_0x17d76b['push'](_0x17d76b['shift']());}};_0x16f3ac(++_0x54345b);}(_0x80ed,0x11c));var _0xd80e=function(_0x41e001,_0x114672){_0x41e001=_0x41e001-0x0;var _0x12bb76=_0x80ed[_0x41e001];return _0x12bb76;};'use strict';var attributes=require(_0xd80e('0x0'));module['exports']=function(_0x1bb10e){return _0x1bb10e[_0xd80e('0x1')](_0xd80e('0x2'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x47617b){if(!_0x47617b[_0xd80e('0x3')])_0x47617b[_0xd80e('0x4')]=null;else if(_0x47617b[_0xd80e('0x4')]===null)_0x47617b['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 a758d02..6874495 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 _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 +var _0xc85d=['length','save','update','emit','user-setting:update:user-','UserId'];(function(_0x246568,_0x57af04){var _0x19b302=function(_0x4ae034){while(--_0x4ae034){_0x246568['push'](_0x246568['shift']());}};_0x19b302(++_0x57af04);}(_0xc85d,0x19f));var _0xdc85=function(_0x3a2a3c,_0x37bd31){_0x3a2a3c=_0x3a2a3c-0x0;var _0x50ac9a=_0xc85d[_0x3a2a3c];return _0x50ac9a;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0xdc85('0x0'),'remove',_0xdc85('0x1')];function createListener(_0x372b96,_0x41e058){return function(_0x486f71){_0x41e058['emit'](_0x372b96,_0x486f71);if(_0x372b96==='user-setting:update'){_0x41e058[_0xdc85('0x2')](_0xdc85('0x3')+_0x486f71[_0xdc85('0x4')],_0x486f71);}};}exports['register']=function(_0x526bfa){for(var _0x4349d6=0x0,_0x260f12=events[_0xdc85('0x5')];_0x4349d6<_0x260f12;_0x4349d6++){var _0x470f3e=events[_0x4349d6];var _0x19560c=createListener('user-setting:'+_0x470f3e,_0x526bfa);UserSettingEvents['on'](_0x470f3e,_0x19560c);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index e0ac478..0e20011 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 _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 +var _0xadb5=['/:id/agents','getAgents','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','getScheduledCalls','post','/:id/contacts','addContacts','create','/create_many','/:id/queues','addQueues','root','server/files/images/','format','%s-%s','now','single','file','addAvatar','/:id/logout','logout','/:id/pause','pause','addTeams','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addOpenchannelAccounts','addSmsAccounts','/:id/whatsapp_accounts','addWhatsappAccounts','/:id/api_key','createApiKey','put','update','/:id/password','delete','removeQueues','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeFaxInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeWhatsappAccounts','/:id/messengerSoundNotification','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','/:id','show','/:id/avatar','getOpenTabs','getContacts','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','getLists'];(function(_0xc00ba1,_0x4b9460){var _0x3f991f=function(_0x7725d8){while(--_0x7725d8){_0xc00ba1['push'](_0xc00ba1['shift']());}};_0x3f991f(++_0x4b9460);}(_0xadb5,0xad));var _0x5adb=function(_0x11835a,_0x19e3d2){_0x11835a=_0x11835a-0x0;var _0x372f9b=_0xadb5[_0x11835a];return _0x372f9b;};'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('./user.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['getPresence']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['get'](_0x5adb('0x11'),controller['getAvatar']);router[_0x5adb('0x7')]('/:id/open_tabs',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x7')]('/:id/contacts',auth[_0x5adb('0x8')](),controller[_0x5adb('0x13')]);router[_0x5adb('0x7')]('/:id/queues',auth[_0x5adb('0x8')](),controller['getQueues']);router[_0x5adb('0x7')](_0x5adb('0x14'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x15')]);router[_0x5adb('0x7')](_0x5adb('0x16'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x7')]('/:id/recordings',auth[_0x5adb('0x8')](),controller['getRecordings']);router[_0x5adb('0x7')]('/:id/screen_recordings',auth[_0x5adb('0x8')](),controller['getScreenRecordings']);router['get'](_0x5adb('0x18'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);router[_0x5adb('0x7')](_0x5adb('0x1a'),auth['isAuthenticated'](),controller[_0x5adb('0x1b')]);router['get']('/:id/mail/interactions',auth[_0x5adb('0x8')](),controller[_0x5adb('0x1c')]);router[_0x5adb('0x7')](_0x5adb('0x1d'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x1e')]);router[_0x5adb('0x7')]('/:id/fax/interactions',auth[_0x5adb('0x8')](),controller[_0x5adb('0x1f')]);router[_0x5adb('0x7')](_0x5adb('0x20'),auth[_0x5adb('0x8')](),controller['getWhatsappInteractions']);router[_0x5adb('0x7')](_0x5adb('0x21'),auth['isAuthenticated'](),controller[_0x5adb('0x22')]);router[_0x5adb('0x7')](_0x5adb('0x23'),auth['isAuthenticated'](),controller[_0x5adb('0x24')]);router[_0x5adb('0x7')](_0x5adb('0x25'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x26')]);router[_0x5adb('0x7')]('/:id/prefixes',auth['isAuthenticated'](),controller['getVoicePrefixes']);router[_0x5adb('0x7')](_0x5adb('0x27'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x28')]);router[_0x5adb('0x7')]('/:id/mail_accounts',auth[_0x5adb('0x8')](),controller[_0x5adb('0x29')]);router[_0x5adb('0x7')](_0x5adb('0x2a'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x2b')]);router[_0x5adb('0x7')](_0x5adb('0x2c'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x2d')]);router['get'](_0x5adb('0x2e'),auth['isAuthenticated'](),controller[_0x5adb('0x2f')]);router[_0x5adb('0x7')]('/:id/whatsapp_accounts',auth[_0x5adb('0x8')](),controller[_0x5adb('0x30')]);router[_0x5adb('0x7')]('/:id/scheduled_calls',auth[_0x5adb('0x8')](),controller[_0x5adb('0x31')]);router['get']('/:id/api_key',auth[_0x5adb('0x8')](),controller['getApiKey']);router[_0x5adb('0x32')](_0x5adb('0x33'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x34')]);router[_0x5adb('0x32')]('/',auth['isAuthenticated'](),controller[_0x5adb('0x35')]);router[_0x5adb('0x32')](_0x5adb('0x36'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0x5adb('0x32')](_0x5adb('0x37'),auth['isAuthenticated'](),controller[_0x5adb('0x38')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x199d3b,_0x58cc5d,_0x11cb37){_0x11cb37(null,path['join'](config[_0x5adb('0x39')],_0x5adb('0x3a')));},'filename':function(_0x4ccb27,_0x4761e3,_0x5a6a79){_0x5a6a79(null,util[_0x5adb('0x3b')](_0x5adb('0x3c'),Date[_0x5adb('0x3d')](),_0x4761e3['originalname']));}})});router[_0x5adb('0x32')](_0x5adb('0x11'),upload[_0x5adb('0x3e')](_0x5adb('0x3f')),controller[_0x5adb('0x40')]);router['post']('/:id/login',auth['isAuthenticated'](),controller['login']);router[_0x5adb('0x32')](_0x5adb('0x41'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x42')]);router[_0x5adb('0x32')](_0x5adb('0x43'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x44')]);router['post']('/:id/unpause',auth[_0x5adb('0x8')](),controller['unpause']);router[_0x5adb('0x32')](_0x5adb('0x21'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x45')]);router[_0x5adb('0x32')]('/:id/chat_interactions',auth[_0x5adb('0x8')](),controller[_0x5adb('0x46')]);router['post'](_0x5adb('0x47'),auth[_0x5adb('0x8')](),controller['addMailInteractions']);router[_0x5adb('0x32')](_0x5adb('0x48'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x49')]);router[_0x5adb('0x32')](_0x5adb('0x4a'),auth[_0x5adb('0x8')](),controller['addSmsInteractions']);router['post'](_0x5adb('0x4b'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x4c')]);router[_0x5adb('0x32')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0x5adb('0x4d')]);router[_0x5adb('0x32')](_0x5adb('0x27'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x4e')]);router['post'](_0x5adb('0x4f'),auth[_0x5adb('0x8')](),controller['addMailAccounts']);router[_0x5adb('0x32')](_0x5adb('0x2a'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x50')]);router[_0x5adb('0x32')](_0x5adb('0x2c'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x51')]);router['post'](_0x5adb('0x2e'),auth['isAuthenticated'](),controller['addChatWebsites']);router['post'](_0x5adb('0x52'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x53')]);router['post'](_0x5adb('0x54'),auth['isAuthenticated'](),controller[_0x5adb('0x55')]);router[_0x5adb('0x56')](_0x5adb('0xf'),auth['isAuthenticated'](),controller[_0x5adb('0x57')]);router['put'](_0x5adb('0x58'),auth[_0x5adb('0x8')](),controller['changePassword']);router[_0x5adb('0x59')](_0x5adb('0x37'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x5a')]);router[_0x5adb('0x59')]('/:id/teams',auth[_0x5adb('0x8')](),controller[_0x5adb('0x5b')]);router[_0x5adb('0x59')](_0x5adb('0xf'),auth['isAuthenticated'](),controller[_0x5adb('0x5c')]);router[_0x5adb('0x59')](_0x5adb('0x5d'),auth['isAuthenticated'](),controller[_0x5adb('0x5e')]);router[_0x5adb('0x59')](_0x5adb('0x47'),auth[_0x5adb('0x8')](),controller['removeMailInteractions']);router[_0x5adb('0x59')](_0x5adb('0x48'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x5f')]);router[_0x5adb('0x59')]('/:id/sms_interactions',auth[_0x5adb('0x8')](),controller['removeSmsInteractions']);router[_0x5adb('0x59')]('/:id/openchannel_interactions',auth[_0x5adb('0x8')](),controller[_0x5adb('0x60')]);router[_0x5adb('0x59')](_0x5adb('0x61'),auth['isAuthenticated'](),controller[_0x5adb('0x62')]);router[_0x5adb('0x59')](_0x5adb('0x27'),auth['isAuthenticated'](),controller['removeFaxAccounts']);router['delete'](_0x5adb('0x4f'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x63')]);router[_0x5adb('0x59')](_0x5adb('0x2a'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x64')]);router[_0x5adb('0x59')](_0x5adb('0x2c'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x65')]);router[_0x5adb('0x59')](_0x5adb('0x2e'),auth['isAuthenticated'](),controller['removeChatWebsites']);router[_0x5adb('0x59')](_0x5adb('0x52'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x66')]);router['delete'](_0x5adb('0x54'),auth[_0x5adb('0x8')](),controller['removeApiKey']);router[_0x5adb('0x32')](_0x5adb('0x67'),auth[_0x5adb('0x8')](),controller['messengerSoundNotification']);module[_0x5adb('0x68')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 65f9a4a..5ca7015 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 _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 +var _0xad7e=['update,nonat','TEXT','showWebBar','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','dtlsenable','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','name','setDataValue','The\x20name\x20of\x20the\x20user','STRING','callerid','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','admin','user','telephone','INTEGER','accountcode','format','fullname','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB','udp','transport','join','getDataValue','split','info','shortinfo','inband','rfc2833','yes','nonat','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','refuse','originate','uac','uas','certificate','active','actpass'];(function(_0x5514e0,_0x18edcc){var _0x3aa3d1=function(_0x1c6b3c){while(--_0x1c6b3c){_0x5514e0['push'](_0x5514e0['shift']());}};_0x3aa3d1(++_0x18edcc);}(_0xad7e,0x195));var _0xead7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad7e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xead7('0x0'));var moment=require(_0xead7('0x1'));var util=require(_0xead7('0x2'));var _=require(_0xead7('0x3'));module[_0xead7('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xead7('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x52d4ce){this[_0xead7('0x6')]('name',_0x52d4ce);this[_0xead7('0x6')]('defaultuser',_0x52d4ce);},'comment':_0xead7('0x7')},'fullname':{'type':Sequelize[_0xead7('0x8')],'allowNull':![],'set':function(_0x3b0cf4){this[_0xead7('0x6')]('fullname',_0x3b0cf4);this[_0xead7('0x6')](_0xead7('0x9'),util['format'](_0xead7('0xa'),_0x3b0cf4,this['getDataValue'](_0xead7('0xb'))));}},'alias':{'type':Sequelize[_0xead7('0x8')]},'email':{'type':Sequelize[_0xead7('0x8')],'allowNull':![],'unique':_0xead7('0xc'),'validate':{'isEmail':!![]},'set':function(_0x33c594){if(_0x33c594){this['setDataValue'](_0xead7('0xc'),_0x33c594[_0xead7('0xd')]());}}},'role':{'type':Sequelize[_0xead7('0xe')](_0xead7('0xf'),_0xead7('0x10'),'agent',_0xead7('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0xead7('0x8')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0xead7('0x12')](0xb),'allowNull':![],'unique':_0xead7('0xb'),'set':function(_0x4078bf){this[_0xead7('0x6')](_0xead7('0xb'),_0x4078bf);this[_0xead7('0x6')](_0xead7('0x13'),_0x4078bf);this['setDataValue'](_0xead7('0x9'),util[_0xead7('0x14')](_0xead7('0xa'),this['getDataValue'](_0xead7('0x15')),_0x4078bf));}},'salt':{'type':Sequelize[_0xead7('0x8')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xead7('0x8')]},'address':{'type':Sequelize[_0xead7('0x8')]},'zipcode':{'type':Sequelize[_0xead7('0x8')]},'userpic':{'type':Sequelize[_0xead7('0x8')]},'city':{'type':Sequelize[_0xead7('0x8')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xead7('0x16')]},'voicePause':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xead7('0x8')],'defaultValue':_0xead7('0x18')},'lastPauseAt':{'type':Sequelize[_0xead7('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xead7('0x12')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xead7('0x12')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xead7('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xead7('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xead7('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xead7('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xead7('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xead7('0x19')},'ipaddr':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xead7('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xead7('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x1a'),'user',_0xead7('0x1b')),'allowNull':!![],'defaultValue':_0xead7('0x1a')},'context':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![],'defaultValue':_0xead7('0x1c')},'callingpres':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x1d'),_0xead7('0x1e'),_0xead7('0x1f'),_0xead7('0x20'),_0xead7('0x21'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN',_0xead7('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![],'defaultValue':_0xead7('0x23'),'set':function(_0x18c752){this[_0xead7('0x6')](_0xead7('0x24'),_0x18c752?_0x18c752[_0xead7('0x25')](','):null);},'get':function(){return this[_0xead7('0x26')](_0xead7('0x24'))?this[_0xead7('0x26')]('transport')[_0xead7('0x27')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xead7('0xe')]('rfc2833',_0xead7('0x28'),_0xead7('0x29'),_0xead7('0x2a'),'auto'),'allowNull':!![],'defaultValue':_0xead7('0x2b')},'directmedia':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x2c'),'no',_0xead7('0x2d'),_0xead7('0x2e'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xead7('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'nat':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![],'defaultValue':_0xead7('0x2f'),'set':function(_0x2ddbf7){this[_0xead7('0x6')](_0xead7('0x30'),_0x2ddbf7?_0x2ddbf7['join'](','):null);},'get':function(){return this[_0xead7('0x26')](_0xead7('0x30'))?this[_0xead7('0x26')](_0xead7('0x30'))[_0xead7('0x27')](','):null;},'comment':_0xead7('0x31')},'callgroup':{'type':Sequelize[_0xead7('0x8')]},'namedcallgroup':{'type':Sequelize[_0xead7('0x8')]},'pickupgroup':{'type':Sequelize[_0xead7('0x8')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xead7('0x8')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xead7('0x8')],'allowNull':![],'defaultValue':_0xead7('0x32')},'allow':{'type':Sequelize[_0xead7('0x8')],'allowNull':![],'defaultValue':_0xead7('0x33'),'set':function(_0x1fa1fe){this[_0xead7('0x6')](_0xead7('0x34'),_0x1fa1fe?_0x1fa1fe['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xead7('0x26')]('allow')?this[_0xead7('0x26')](_0xead7('0x34'))[_0xead7('0x27')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0xead7('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![],'set':function(_0x468c00){this[_0xead7('0x6')]('insecure',_0x468c00?_0x468c00[_0xead7('0x25')](','):null);},'get':function(){return this[_0xead7('0x26')](_0xead7('0x35'))?this[_0xead7('0x26')](_0xead7('0x35'))[_0xead7('0x27')](','):null;},'comment':_0xead7('0x36')},'trustrpid':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xead7('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x2c'),'no',_0xead7('0x37')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xead7('0xe')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xead7('0xe')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xead7('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![],'defaultValue':_0xead7('0x38')},'amaflags':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x2c'),'no'),'allowNull':!![],'defaultValue':_0xead7('0x2c')},'busylevel':{'type':Sequelize[_0xead7('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x2c'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x2c'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xead7('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xead7('0xe')]('yes','no',_0xead7('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xead7('0xe')]('accept',_0xead7('0x3a'),_0xead7('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xead7('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x3c'),_0xead7('0x3d')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x2c'),'no'),'allowNull':!![],'defaultValue':_0xead7('0x2c')},'keepalive':{'type':Sequelize[_0xead7('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xead7('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xead7('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xead7('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0xead7('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xead7('0xe')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x2c'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xead7('0xe')]('yes','no','fingerprint',_0xead7('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xead7('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x3f'),'passive',_0xead7('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0xead7('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xead7('0xe')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xead7('0xe')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x2c'),'no',_0xead7('0x2d'),_0xead7('0x2e'),_0xead7('0x41')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xead7('0x8')]},'resetPasswordExpires':{'type':Sequelize[_0xead7('0x16')]},'passwordResetAt':{'type':Sequelize[_0xead7('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xead7('0x42')]},'showWebBar':{'type':Sequelize[_0xead7('0x12')],'defaultValue':0x0,'set':function(_0x5ea564){this[_0xead7('0x6')](_0xead7('0x43'),_0x5ea564);var _0x500917=this[_0xead7('0x44')]({'plain':!![]});switch(_0x5ea564){case 0x0:case 0x1:var _0x110037=_0x500917[_0xead7('0x24')]?_[_0xead7('0x45')](_0x500917[_0xead7('0x24')])?_0x500917[_0xead7('0x24')][_0xead7('0x25')]():_0x500917[_0xead7('0x24')]:_0xead7('0x23');if(_0x110037===_0xead7('0x46')){_0x110037=_0xead7('0x23');}this['setDataValue'](_0xead7('0x24'),_0x110037);this[_0xead7('0x6')](_0xead7('0x47'),'no');this[_0xead7('0x6')](_0xead7('0x48'),null);this[_0xead7('0x6')](_0xead7('0x49'),null);this[_0xead7('0x6')](_0xead7('0x4a'),null);this[_0xead7('0x6')]('dtlsenable',null);this[_0xead7('0x6')](_0xead7('0x4b'),null);this['setDataValue'](_0xead7('0x4c'),null);this[_0xead7('0x6')](_0xead7('0x4d'),null);this[_0xead7('0x6')](_0xead7('0x4e'),null);this[_0xead7('0x6')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0xead7('0x24'),'wss');this[_0xead7('0x6')](_0xead7('0x47'),_0xead7('0x2c'));this[_0xead7('0x6')](_0xead7('0x48'),_0xead7('0x2c'));this[_0xead7('0x6')](_0xead7('0x49'),'yes');this[_0xead7('0x6')]('icesupport',_0xead7('0x2c'));this[_0xead7('0x6')](_0xead7('0x4f'),'yes');this[_0xead7('0x6')]('dtlsverify','no');this['setDataValue'](_0xead7('0x4c'),_0xead7('0x40'));this[_0xead7('0x6')](_0xead7('0x4d'),_0x500917[_0xead7('0x4d')]||_0xead7('0x50'));this[_0xead7('0x6')](_0xead7('0x4e'),_0x500917[_0xead7('0x4e')]||_0xead7('0x51'));this[_0xead7('0x6')](_0xead7('0x52'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0xead7('0x42')],'set':function(_0x3fdd5f){this[_0xead7('0x6')](_0xead7('0x53'),_0x3fdd5f?_0x3fdd5f[_0xead7('0x25')](','):[]);},'get':function(){return this[_0xead7('0x26')]('permissions')?_[_0xead7('0x54')](this[_0xead7('0x26')]('permissions')['split'](','),function(_0xb37da1){return parseInt(_0xb37da1,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xead7('0x8')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xead7('0x8')]},'phoneBarBusyNumber':{'type':Sequelize[_0xead7('0x8')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xead7('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xead7('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xead7('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xead7('0x8')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xead7('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xead7('0xe')](_0xead7('0x2c'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xead7('0x8')]},'phoneBarEnableJaws':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xead7('0x55')],'get':function(){return this['getDataValue'](_0xead7('0x56'))?this[_0xead7('0x26')](_0xead7('0x56')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0xead7('0x8')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xead7('0x8')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![],'set':function(_0x2e794b){if(typeof _0x2e794b===_0xead7('0x57')){var _0xb548b6=_0x2e794b==='1'?!![]:_0x2e794b==='0'?![]:_0x2e794b==='true'?!![]:_0x2e794b===_0xead7('0x58')?![]:![];this[_0xead7('0x6')]('screenrecording',_0xb548b6);}else{this[_0xead7('0x6')](_0xead7('0x59'),_0x2e794b);}}},'blocked':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![],'set':function(_0x43f2e5){this[_0xead7('0x6')](_0xead7('0x5a'),_0x43f2e5);if(_0x43f2e5===!![]){this[_0xead7('0x6')](_0xead7('0x5b'),moment());this[_0xead7('0x6')](_0xead7('0x5c'),0x0);}else{this[_0xead7('0x6')](_0xead7('0x5b'),null);}}},'blockedAt':{'type':Sequelize[_0xead7('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xead7('0x12')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xead7('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0xead7('0x5d')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xead7('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xead7('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xead7('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xead7('0x12')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xead7('0x12')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xead7('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xead7('0x12')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 7ab179a..c6bfffa 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 _0x79c2=['Body\x20parameter\x20\x27ids\x27\x20is\x20required','User\x20with\x20id\x20%s\x20not\x20found','transaction','getAssociatedQueues','flattenDeep','addAgent','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','Team','removeAgent','getLists','getAgents','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','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','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notIn','$iLike','$notILike','$overlap','$contains','$contained','$any','firstName','phone','CmContact','Contact','getApiKey','retrieveApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','idle','teams','queues','inbound','toString','sequelize','lower','asc','desc','substring','uniqBy','orderBy','getRealtimeAgents','voiceStatus','unavailable','busy','slice','toUpperCase','select','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','messengerSoundNotification','enabled','moment','util','path','squel','ioredis','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../components/realtime/agents','../../config/logger','api','../../config/utils','../../config/environment','../../errors/api','APIBadRequestError','handleError','../../mysqldb','socket.io-emitter','redis','register','defaults','localhost','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','role','emit','destroy','get','admin','Users','user','Telephones','telephone','filter','ignore','value','includes','find','name','error','User','rawAttributes','map','key','password','salt','resetPasswordToken','md5secret','getOptions','where','query','includeAll','include','userSetting','true','UserSetting','attributes','push','findAll','rows','openTabs','length','chat','dataValues','all','show','params','merge','options','sms','openchannel','whatsapp','fax','mail','catch','body','describe','omit','ids','internal','Setting','findById','securePassword','validatePasswordPattern','max','min_internal','isNil','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','agent','permissions','101','103','113','110','104','105','106','107','108','109','100','111','114','115','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','create','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','UserProfileSection','compact','Agents','oldPassword','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Sequelize','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','interface','isValidChannel','Unknown\x20channel','add','capitalize','penalty','spread','toLowerCase','QueueId','Queue:save','VoiceQueue','voice','format','SIP/%s','voicePause','UserVoiceQueueRt','removeQueues','remove','Queues','isArray','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','server/files/images/','download','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OPENCHANNEL','MailOpenTabs','MAIL','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','hasOwnProperty','CmList','List','Tags','color','tag','getQueues','keys','filters','intersection','model','fields','order','sort','Queue','Unknown\x20role','nolimit','getVoiceQueuesRt','pick','getGroups','ChatGroup','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','FaxInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','remoteAddress','socket','connection','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','upsert','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','device','LOGININPAUSE','isMiddleware','resolve','pause','PAUSE','updateAttributes','type','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','lastPauseAt','getTeams','addTeams'];(function(_0x5d5bcb,_0x25e2ea){var _0x4ea5eb=function(_0x36782b){while(--_0x36782b){_0x5d5bcb['push'](_0x5d5bcb['shift']());}};_0x4ea5eb(++_0x25e2ea);}(_0x79c2,0x7f));var _0x279c=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x79c2[_0x40bffc];return _0x3007e9;};'use strict';var moment=require(_0x279c('0x0'));var util=require(_0x279c('0x1'));var path=require(_0x279c('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0x279c('0x3'));var Redis=require(_0x279c('0x4'));var authService=require(_0x279c('0x5'));var contacts=require(_0x279c('0x6'));var qs=require(_0x279c('0x7'));var rta=require(_0x279c('0x8'));var logger=require(_0x279c('0x9'))(_0x279c('0xa'));var utils=require(_0x279c('0xb'));var config=require(_0x279c('0xc'));var licenseUtil=require('../../config/license/util');var APIBadRequestError=require(_0x279c('0xd'))[_0x279c('0xe')];var APINotFoundError=require(_0x279c('0xd'))['APINotFoundError'];var APIHandleError=require(_0x279c('0xd'))[_0x279c('0xf')];var db=require(_0x279c('0x10'))['db'];var socket=require(_0x279c('0x11'))(new Redis(config[_0x279c('0x12')]));require('./user.socket')[_0x279c('0x13')](socket);config[_0x279c('0x12')]=_[_0x279c('0x14')](config[_0x279c('0x12')],{'host':_0x279c('0x15'),'port':0x18eb});var values;function respondWithStatusCode(_0x36d8b4,_0x2c4646){_0x2c4646=_0x2c4646||0xcc;return function(_0x23bd72){if(_0x23bd72){return _0x36d8b4[_0x279c('0x16')](_0x2c4646);}return _0x36d8b4[_0x279c('0x17')](_0x2c4646)['end']();};}function respondWithResult(_0xc0849f,_0x4a551a){_0x4a551a=_0x4a551a||0xc8;return function(_0x960b87){if(_0x960b87){return _0xc0849f['status'](_0x4a551a)[_0x279c('0x18')](_0x960b87);}};}function respondWithFilteredResult(_0x5debfb,_0x378ac0){return function(_0x2aa6dd){if(_0x2aa6dd){var _0x18a692=typeof _0x378ac0[_0x279c('0x19')]===_0x279c('0x1a')&&typeof _0x378ac0[_0x279c('0x1b')]===_0x279c('0x1a');var _0x327dfa=_0x2aa6dd[_0x279c('0x1c')];var _0x2c0cce=_0x18a692?0x0:_0x378ac0[_0x279c('0x19')];var _0x18377f=_0x18a692?_0x2aa6dd[_0x279c('0x1c')]:_0x378ac0[_0x279c('0x19')]+_0x378ac0['limit'];var _0x146daf;if(_0x18377f>=_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')]=_0x40ca7f){_0x40e8f9=_0x40ca7f;_0xa4f181=0xc8;}else{_0xa4f181=0xce;}_0x520385[_0xeeba('0x16')](_0xa4f181);return _0x520385['set'](_0xeeba('0x1c'),_0x505b0a+'-'+_0x40e8f9+'/'+_0x40ca7f)[_0xeeba('0x18')](_0x29033e);}return null;};}function saveUpdates(_0x1d549a){return function(_0x3716fc){if(_0x3716fc){return _0x3716fc[_0xeeba('0x1d')](_0x1d549a)['then'](function(_0xc9556a){if(_0xc9556a[_0xeeba('0x1e')]===_0xeeba('0x1f')){socket[_0xeeba('0x20')](_0xeeba('0x21')+_0xc9556a['id'],_0xc9556a);}return _0xc9556a;});}return null;};}function removeEntity(_0x4a6762){return function(_0x5cf27b){if(_0x5cf27b){return _0x5cf27b['destroy']()[_0xeeba('0x22')](function(){var _0x4f5832=_0x5cf27b[_0xeeba('0x23')]({'plain':!![]});if(_0x4f5832[_0xeeba('0x1e')]===_0xeeba('0x24'))return;var _0xe363a4=[{'name':_0xeeba('0x25'),'value':_0xeeba('0x26'),'ignore':!![]},{'name':'Agents','value':_0xeeba('0x1f'),'ignore':![]},{'name':_0xeeba('0x27'),'value':_0xeeba('0x28'),'ignore':![]}];var _0x3b8ed6=_(_0xe363a4)['filter']('ignore')[_0xeeba('0x29')](_0xeeba('0x2a'))['value']();if(_[_0xeeba('0x2b')](_0x3b8ed6,_0x4f5832[_0xeeba('0x1e')])){return;}var _0x3f1978=_[_0xeeba('0x2c')](_0xe363a4,['value',_0x4f5832['role']])['name'];return db['UserProfileResource']['destroy']({'where':{'type':_0x3f1978,'resourceId':_0x4f5832['id']}})['then'](function(){return _0x5cf27b;});})[_0xeeba('0x22')](function(){_0x4a6762[_0xeeba('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a5faa){return function(_0x200f6e){if(!_0x200f6e){_0x2a5faa[_0xeeba('0x15')](0x194);}return _0x200f6e;};}function handleError(_0x44eb14,_0xffd638){_0xffd638=_0xffd638||0x1f4;return function(_0x23c05c){logger[_0xeeba('0x2d')](_0x23c05c['stack']);if(_0x23c05c[_0xeeba('0x2e')]){delete _0x23c05c[_0xeeba('0x2e')];}_0x44eb14['status'](_0xffd638)[_0xeeba('0x2f')](_0x23c05c);};}function getUserAttributes(){return _(db[_0xeeba('0x30')]['rawAttributes'])[_0xeeba('0x29')](function(_0xe1086f){return{'name':_0xe1086f[_0xeeba('0x31')],'type':_0xe1086f[_0xeeba('0x32')][_0xeeba('0x33')]};})['filter'](function(_0x5d299c){return![_0xeeba('0x34'),'salt',_0xeeba('0x35'),'resetPasswordToken',_0xeeba('0x36'),_0xeeba('0x37')][_0xeeba('0x2b')](_0x5d299c[_0xeeba('0x2e')]);})[_0xeeba('0x2a')]();}exports[_0xeeba('0x38')]=function(_0x75c670,_0x278548){var _0x187f4a={},_0x4f1021={'count':0x0,'rows':[]};var _0x1dff70=getUserAttributes();_0x187f4a=qs['getOptions'](_0x1dff70,_0x75c670);var _0x25e56c={'where':_0x187f4a['where']};return db[_0xeeba('0x30')][_0xeeba('0x39')](_0x25e56c)['then'](function(_0xe53e87){_0x4f1021[_0xeeba('0x39')]=_0xe53e87;if(_0x75c670[_0xeeba('0x3a')][_0xeeba('0x3b')]){_0x187f4a[_0xeeba('0x3c')]=[{'all':!![]}];}if(_0x75c670[_0xeeba('0x3a')][_0xeeba('0x3d')]===_0xeeba('0x3e')){_0x187f4a[_0xeeba('0x3c')]=[{'model':db[_0xeeba('0x3f')],'as':'userSetting'}];}if(!_['includes'](_0x187f4a['attributes'],'id')){_0x187f4a[_0xeeba('0x40')]['push']('id');}return db[_0xeeba('0x30')]['findAll'](_0x187f4a);})[_0xeeba('0x22')](function(_0x41b085){_0x4f1021['rows']=_0x41b085;if(_0x75c670[_0xeeba('0x3a')][_0xeeba('0x41')]===_0xeeba('0x3e')){var _0x7a2e3=[];for(var _0x59130c=0x0;_0x59130c<_0x4f1021[_0xeeba('0x42')][_0xeeba('0x43')];_0x59130c++){_0x7a2e3[_0xeeba('0x44')](get_open_tabs(_0xeeba('0x45'),_0x4f1021['rows'][_0x59130c][_0xeeba('0x46')]));_0x7a2e3[_0xeeba('0x44')](get_open_tabs(_0xeeba('0x47'),_0x4f1021[_0xeeba('0x42')][_0x59130c][_0xeeba('0x46')]));_0x7a2e3[_0xeeba('0x44')](get_open_tabs(_0xeeba('0x48'),_0x4f1021[_0xeeba('0x42')][_0x59130c]['dataValues']));_0x7a2e3[_0xeeba('0x44')](get_open_tabs('mail',_0x4f1021[_0xeeba('0x42')][_0x59130c]['dataValues']));_0x7a2e3['push'](get_open_tabs(_0xeeba('0x49'),_0x4f1021[_0xeeba('0x42')][_0x59130c]['dataValues']));_0x7a2e3[_0xeeba('0x44')](get_open_tabs('whatsapp',_0x4f1021['rows'][_0x59130c][_0xeeba('0x46')]));}return Promise['all'](_0x7a2e3)[_0xeeba('0x22')](function(){return _0x4f1021;});}else{return _0x4f1021;}})[_0xeeba('0x22')](respondWithFilteredResult(_0x278548,_0x187f4a))['catch'](handleError(_0x278548,null));};exports['show']=function(_0x47441b,_0x1d7ea7){var _0x3dd813=getUserAttributes();_0x47441b[_0xeeba('0x3a')]['id']=_0x47441b[_0xeeba('0x4a')]['id'];var _0x1053cf=qs['getOptions'](_0x3dd813,_0x47441b);if(_0x47441b['query'][_0xeeba('0x3b')]){_0x1053cf[_0xeeba('0x3c')]=[{'all':!![]}];}if(_0x47441b[_0xeeba('0x3a')]['userSetting']===_0xeeba('0x3e')){_0x1053cf['include']=[{'model':db[_0xeeba('0x3f')],'as':_0xeeba('0x3d')}];}_0x1053cf=_['merge']({},_0x1053cf,_0x47441b[_0xeeba('0x4b')]);if(!_[_0xeeba('0x2b')](_0x1053cf[_0xeeba('0x40')],'id')){_0x1053cf[_0xeeba('0x40')][_0xeeba('0x44')]('id');}return db[_0xeeba('0x30')][_0xeeba('0x2c')](_0x1053cf)[_0xeeba('0x22')](handleEntityNotFound(_0x1d7ea7,null))[_0xeeba('0x22')](function(_0x1d33f4){var _0x407321=[];values=_0x1d33f4;if(_0x47441b[_0xeeba('0x3a')][_0xeeba('0x41')]==='true'){_0x407321[_0xeeba('0x44')](get_open_tabs('chat',_0x1d33f4[_0xeeba('0x46')]));_0x407321[_0xeeba('0x44')](get_open_tabs(_0xeeba('0x47'),_0x1d33f4[_0xeeba('0x46')]));_0x407321[_0xeeba('0x44')](get_open_tabs(_0xeeba('0x49'),_0x1d33f4['dataValues']));_0x407321['push'](get_open_tabs(_0xeeba('0x4c'),_0x1d33f4[_0xeeba('0x46')]));_0x407321[_0xeeba('0x44')](get_open_tabs(_0xeeba('0x48'),_0x1d33f4['dataValues']));_0x407321[_0xeeba('0x44')](get_open_tabs(_0xeeba('0x4d'),_0x1d33f4[_0xeeba('0x46')]));return Promise[_0xeeba('0x4e')](_0x407321);}else{return values;}})[_0xeeba('0x22')](function(){return values;})[_0xeeba('0x22')](respondWithResult(_0x1d7ea7,null))[_0xeeba('0x4f')](handleError(_0x1d7ea7,null));};exports['update']=function(_0x1f97e9,_0x4b3134){if(_0x1f97e9[_0xeeba('0x50')]['id']){delete _0x1f97e9[_0xeeba('0x50')]['id'];}delete _0x1f97e9[_0xeeba('0x50')][_0xeeba('0x1e')];return db['User'][_0xeeba('0x2c')]({'where':{'id':_0x1f97e9[_0xeeba('0x4a')]['id']}})[_0xeeba('0x22')](handleEntityNotFound(_0x4b3134,null))[_0xeeba('0x22')](saveUpdates(_0x1f97e9['body'],null))[_0xeeba('0x22')](respondWithResult(_0x4b3134,null))[_0xeeba('0x4f')](handleError(_0x4b3134,null));};exports['describe']=function(_0x92ad44,_0x5c400c){return db[_0xeeba('0x30')][_0xeeba('0x51')]()[_0xeeba('0x22')](respondWithResult(_0x5c400c,null))[_0xeeba('0x4f')](handleError(_0x5c400c,null));};exports[_0xeeba('0x52')]=function(_0x588b4b,_0x1db146){return db[_0xeeba('0x30')]['find']({'where':{'id':_0x588b4b['params']['id']}})[_0xeeba('0x22')](handleEntityNotFound(_0x1db146,null))[_0xeeba('0x22')](function(_0x3f4ef1){if(_0x3f4ef1){return _0x3f4ef1[_0xeeba('0x52')](_0x588b4b[_0xeeba('0x50')][_0xeeba('0x53')],_[_0xeeba('0x54')](_0x588b4b['body'],[_0xeeba('0x53'),'id'])||{});}})['then'](respondWithResult(_0x1db146,null))[_0xeeba('0x4f')](handleError(_0x1db146,null));};function validateUser(_0x281f15){return new Promise(function(_0x34d61c,_0x108581){if(_0x281f15[_0xeeba('0x55')])return _0x34d61c(_0x281f15);return db[_0xeeba('0x56')][_0xeeba('0x57')](0x1)['then'](function(_0x2ace3f){if(_0x2ace3f['securePassword'])authService[_0xeeba('0x58')](_0x281f15[_0xeeba('0x34')]);db[_0xeeba('0x30')][_0xeeba('0x59')](_0xeeba('0x55'))[_0xeeba('0x22')](function(_0x96144c){if(_[_0xeeba('0x5a')](_0x96144c)){_0x281f15['internal']=_0x2ace3f[_0xeeba('0x5b')]||0x1;return;}if(_[_0xeeba('0x5a')](_0x2ace3f[_0xeeba('0x5b')])||_0x2ace3f[_0xeeba('0x5b')]===_0x96144c){_0x281f15[_0xeeba('0x55')]=_0x96144c+0x1;return;}if(_0x2ace3f[_0xeeba('0x5b')]>_0x96144c){_0x281f15[_0xeeba('0x55')]=_0x2ace3f[_0xeeba('0x5b')];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[_0xeeba('0x5c')][_0xeeba('0x5d')][_0xeeba('0x5e')]})[_0xeeba('0x22')](function(_0xe8b8fd){if(_0xe8b8fd&&_0xe8b8fd[_0xeeba('0x43')]){for(var _0x2f41d1=0x0,_0x46b9e9=_0xe8b8fd['length'];_0x2f41d1<_0x46b9e9&&_['isNil'](_0x281f15[_0xeeba('0x55')]);_0x2f41d1++){if(_0x2ace3f[_0xeeba('0x5b')]<=_0xe8b8fd[_0x2f41d1]['from']){_0x281f15[_0xeeba('0x55')]=_0xe8b8fd[_0x2f41d1][_0xeeba('0x5f')];}else if(_0x2ace3f['min_internal']>_0xe8b8fd[_0x2f41d1]['from']&&_0x2ace3f[_0xeeba('0x5b')]<=_0xe8b8fd[_0x2f41d1]['to']){_0x281f15[_0xeeba('0x55')]=_0x2ace3f[_0xeeba('0x5b')];}}}if(_['isNil'](_0x281f15[_0xeeba('0x55')])){_0x281f15['internal']=_0x96144c+0x1;}return _0x34d61c(_0x281f15);});});})[_0xeeba('0x4f')](function(_0x2ba7cb){_0x108581(_0x2ba7cb);});});}function updateUser(_0x306b01){return new Promise(function(_0x205584,_0xc5d82f){try{if(_0x306b01[_0xeeba('0x60')]){_0x306b01[_0xeeba('0x61')]=_0x306b01[_0xeeba('0x55')];_0x306b01[_0xeeba('0x62')]={'mailbox':_0x306b01[_0xeeba('0x55')],'password':_0x306b01[_0xeeba('0x34')],'fullname':_0x306b01[_0xeeba('0x63')],'email':_0x306b01[_0xeeba('0x64')]};}if(_0x306b01[_0xeeba('0x1e')]===_0xeeba('0x1f')){if(!_0x306b01['permissions'])_0x306b01['permissions']=[_0xeeba('0x65'),_0xeeba('0x66'),_0xeeba('0x67'),_0xeeba('0x68'),'110',_0xeeba('0x69'),'105',_0xeeba('0x6a'),_0xeeba('0x6b'),_0xeeba('0x6c'),'109',_0xeeba('0x6d'),'111',_0xeeba('0x6e'),_0xeeba('0x6f')];}_0x205584(_0x306b01);}catch(_0x41b6ff){_0xc5d82f(_0x41b6ff);}});}exports[_0xeeba('0x70')]=function(_0x32c027,_0x3dda32){if(_0x32c027[_0xeeba('0x26')][_0xeeba('0x1e')]===_0xeeba('0x1f'))throw new Error('Unauthorized');if(_0x32c027[_0xeeba('0x50')][_0xeeba('0x1e')]===_0xeeba('0x26')&&_0x32c027[_0xeeba('0x26')][_0xeeba('0x1e')]!==_0xeeba('0x24')){throw new Error(_0xeeba('0x71'));}if(_0x32c027['body'][_0xeeba('0x1e')]==='admin'&&_0x32c027[_0xeeba('0x26')]['role']!==_0xeeba('0x24')){throw new Error(_0xeeba('0x72'));}return licenseUtil[_0xeeba('0x73')]([_0x32c027[_0xeeba('0x50')]])[_0xeeba('0x22')](function(){return validateUser(_0x32c027[_0xeeba('0x50')]);})[_0xeeba('0x22')](function(_0x3a8435){return updateUser(_0x3a8435)['then'](function(_0x53586b){if(_0x53586b['role']===_0xeeba('0x24')){_0x53586b['settingsEnabled']=_0x32c027['user'][_0xeeba('0x74')];delete _0x53586b[_0xeeba('0x75')];}return _0x53586b;});})[_0xeeba('0x22')](function(_0x1f0225){return db[_0xeeba('0x30')][_0xeeba('0x70')](_0x1f0225,{'include':[{'model':db[_0xeeba('0x62')],'as':'VoiceMail'}]});})[_0xeeba('0x22')](function(_0x33052a){if(_0x32c027['body']['role']==='user')return _0x33052a;if(_0x32c027['user']['role']!==_0xeeba('0x26'))return _0x33052a;return db[_0xeeba('0x76')][_0xeeba('0x2c')]({'where':{'name':_0x33052a[_0xeeba('0x1e')]===_0xeeba('0x1f')?_0xeeba('0x77'):_0xeeba('0x27'),'userProfileId':_0x32c027[_0xeeba('0x26')]['userProfileId']},'raw':!![]})[_0xeeba('0x22')](function(_0x8eaa21){if(!_0x8eaa21||_0x8eaa21['autoAssociation']!=0x0)return _0x33052a;return db[_0xeeba('0x78')][_0xeeba('0x70')]({'name':_0x33052a['name'],'resourceId':_0x33052a['id'],'type':_0x8eaa21['name'],'sectionId':_0x8eaa21['id']},{})['then'](function(){return _0x33052a;});})[_0xeeba('0x4f')](function(_0x5f11b9){logger[_0xeeba('0x2d')](_0xeeba('0x79'),_0x5f11b9);throw _0x5f11b9;});})['then'](respondWithResult(_0x3dda32,0xc9))[_0xeeba('0x4f')](handleError(_0x3dda32,null));};exports['bulkCreate']=function(_0x5857bb,_0x3f0070){var _0x35704f=_0x5857bb[_0xeeba('0x50')];var _0x33d731=[];if(_0x5857bb[_0xeeba('0x26')][_0xeeba('0x1e')]===_0xeeba('0x1f'))throw new Error(_0xeeba('0x7a'));if(_[_0xeeba('0x7b')](_0x35704f,['role',_0xeeba('0x26')])&&_0x5857bb['user'][_0xeeba('0x1e')]!==_0xeeba('0x24')){throw new Error(_0xeeba('0x71'));}if(_[_0xeeba('0x7b')](_0x35704f,[_0xeeba('0x1e'),_0xeeba('0x24')])&&_0x5857bb[_0xeeba('0x26')][_0xeeba('0x1e')]!==_0xeeba('0x24')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0xeeba('0x73')](_0x35704f)[_0xeeba('0x22')](function(){return validateUser(_0x35704f[0x0]);})[_0xeeba('0x22')](function(){for(var _0x386e17=0x1;_0x386e17<_0x35704f[_0xeeba('0x43')];_0x386e17++){var _0x468f3c=_0x35704f[_0x386e17-0x1]['internal'];if(!_0x35704f[_0x386e17][_0xeeba('0x55')])_0x35704f[_0x386e17]['internal']=_0x468f3c+0x1;_0x33d731['push'](validateUser(_0x35704f[_0x386e17]));}return Promise[_0xeeba('0x4e')](_0x33d731);})[_0xeeba('0x22')](function(){_0x33d731=[];for(var _0x5dd5f0=0x0;_0x5dd5f0<_0x35704f[_0xeeba('0x43')];_0x5dd5f0++){_0x33d731[_0xeeba('0x44')](updateUser(_0x35704f[_0x5dd5f0]));}return Promise[_0xeeba('0x4e')](_0x33d731);})[_0xeeba('0x22')](function(){_0x33d731=_0x35704f[_0xeeba('0x29')](function(_0x3a0ff3){return db['User'][_0xeeba('0x70')](_0x3a0ff3,{'include':[{'model':db['VoiceMail'],'as':_0xeeba('0x62')}]})[_0xeeba('0x22')](function(_0x2e1e18){_0x3a0ff3['id']=_0x2e1e18['id'];return _0x3a0ff3;});});return Promise[_0xeeba('0x4e')](_0x33d731);})['then'](function(_0x2f5bfa){if(_0x5857bb[_0xeeba('0x50')][_0xeeba('0x1e')]===_0xeeba('0x26'))return _0x2f5bfa;if(_0x5857bb[_0xeeba('0x26')][_0xeeba('0x1e')]!=='user')return _0x2f5bfa;var _0x379cf4=_[_0xeeba('0x7b')](_0x2f5bfa,function(_0x421d41){return _0x421d41[_0xeeba('0x1e')]===_0xeeba('0x1f')||_0x421d41[_0xeeba('0x1e')]==='telephone';});if(!_0x379cf4)return _0x2f5bfa;return db[_0xeeba('0x76')][_0xeeba('0x7c')]({'where':{'name':{'$or':[_0xeeba('0x77'),_0xeeba('0x27')]},'userProfileId':_0x5857bb[_0xeeba('0x26')][_0xeeba('0x75')]},'raw':!![]})[_0xeeba('0x22')](function(_0x141447){if(_['isEmpty'](_0x141447)||!_[_0xeeba('0x7b')](_0x141447,[_0xeeba('0x7d'),0x0]))return _0x2f5bfa;_0x33d731=[];var _0x3fb8d2=_(_0x141447)[_0xeeba('0x29')](function(_0xa6d034){if(_0xa6d034['autoAssociation']===0x1)return;return _0xa6d034['name']===_0xeeba('0x77')?_0xeeba('0x1f'):'telephone';})[_0xeeba('0x7e')]()[_0xeeba('0x2a')]();for(var _0x4f1cd9=0x0;_0x4f1cd9<_0x2f5bfa['length'];_0x4f1cd9++){if(!_['includes'](_0x3fb8d2,_0x2f5bfa[_0x4f1cd9][_0xeeba('0x1e')]))return;var _0x139e64=_0x2f5bfa[_0x4f1cd9][_0xeeba('0x1e')]==='agent'?_0xeeba('0x77'):_0xeeba('0x27');_0x33d731[_0xeeba('0x44')](db['UserProfileResource'][_0xeeba('0x70')]({'name':_0x2f5bfa[_0x4f1cd9][_0xeeba('0x2e')],'resourceId':_0x2f5bfa[_0x4f1cd9]['id'],'type':_0x139e64,'sectionId':_[_0xeeba('0x2c')](_0x141447,[_0xeeba('0x2e'),_0x139e64])['id']},{}));}return Promise[_0xeeba('0x4e')](_0x33d731);});})['then'](respondWithResult(_0x3f0070,0xc9))[_0xeeba('0x4f')](handleError(_0x3f0070,null));};exports[_0xeeba('0x7f')]=function(_0x504784,_0x5332e4){if(_0x504784[_0xeeba('0x50')]['id']){delete _0x504784[_0xeeba('0x50')]['id'];}return db[_0xeeba('0x30')][_0xeeba('0x2c')]({'where':{'id':_0x504784['params']['id']}})[_0xeeba('0x22')](function(_0xed3310){if(!_0xed3310)return null;if(_0xed3310['id']===_0x504784[_0xeeba('0x26')]['id']){if(!_0x504784[_0xeeba('0x50')][_0xeeba('0x80')]||!_0x504784['body'][_0xeeba('0x81')]){throw new db[(_0xeeba('0x82'))][(_0xeeba('0x83'))](_0xeeba('0x84'));}if(!_0xed3310[_0xeeba('0x85')](_0x504784[_0xeeba('0x50')][_0xeeba('0x80')])){throw new db['Sequelize']['ValidationError']('Wrong\x20credentials');}if(_0x504784[_0xeeba('0x50')]['oldPassword']===_0x504784[_0xeeba('0x50')]['newPassword']){throw new db['Sequelize'][(_0xeeba('0x83'))](_0xeeba('0x86'));}}else if(_0x504784[_0xeeba('0x26')][_0xeeba('0x1e')]==='admin'){if(!_0x504784['body']['newPassword']){throw new db[(_0xeeba('0x82'))][(_0xeeba('0x83'))](_0xeeba('0x87'));}}else if(_0x504784[_0xeeba('0x26')][_0xeeba('0x1e')]==='user'){if(!_0x504784[_0xeeba('0x50')][_0xeeba('0x81')]){throw new db['Sequelize'][(_0xeeba('0x83'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0xed3310[_0xeeba('0x1e')]!==_0xeeba('0x1f')){throw new db[(_0xeeba('0x82'))]['ValidationError'](_0xeeba('0x7a'));}}else{throw new db[(_0xeeba('0x82'))]['ValidationError'](_0xeeba('0x7a'));}return _0xed3310;})[_0xeeba('0x22')](handleEntityNotFound(_0x5332e4,null))['then'](function(_0x4b5ca1){return db[_0xeeba('0x56')][_0xeeba('0x88')]({'attributes':['id',_0xeeba('0x89'),_0xeeba('0x8a'),_0xeeba('0x8b')]})[_0xeeba('0x22')](function(_0x3cf0b4){if(_0x3cf0b4[_0xeeba('0x89')])authService[_0xeeba('0x58')](_0x504784['body'][_0xeeba('0x81')]);if(!_0x3cf0b4[_0xeeba('0x8a')]||!_0x4b5ca1[_0xeeba('0x35')])return _0x4b5ca1;authService[_0xeeba('0x8c')](_0x504784[_0xeeba('0x50')][_0xeeba('0x81')],_0x4b5ca1[_0xeeba('0x35')],_0x3cf0b4[_0xeeba('0x8b')]);return _0x4b5ca1;})[_0xeeba('0x22')](saveUpdates({'password':_0x504784['body'][_0xeeba('0x81')],'passwordResetAt':_0x504784[_0xeeba('0x26')]['id']==_0x504784[_0xeeba('0x4a')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x504784['body'][_0xeeba('0x81')],_0x4b5ca1['previousPasswords'])},null));})[_0xeeba('0x22')](respondWithResult(_0x5332e4,null))[_0xeeba('0x4f')](handleError(_0x5332e4,null));};exports['addQueues']=function(_0x1e9a0d,_0x1053a3){var _0x5b4107=_0x1e9a0d[_0xeeba('0x50')]['channel'];return db[_0xeeba('0x30')][_0xeeba('0x2c')]({'where':{'id':_0x1e9a0d[_0xeeba('0x4a')]['id']},'attributes':['id',_0xeeba('0x2e'),'role','online',_0xeeba('0x8d'),_0xeeba('0x8e'),_0xeeba('0x8f')]})[_0xeeba('0x22')](handleEntityNotFound(_0x1053a3,null))[_0xeeba('0x22')](function(_0x1517bf){if(_0x1517bf){if(!utils[_0xeeba('0x90')](_0x5b4107)){throw new db[(_0xeeba('0x82'))]['ValidationError'](_0xeeba('0x91'));}return _0x1517bf['add'+_[_0xeeba('0x92')](_0x5b4107['toLowerCase']())+_0xeeba('0x93')](_0x1e9a0d[_0xeeba('0x50')][_0xeeba('0x53')],{'penalty':_0x1e9a0d[_0xeeba('0x50')][_0xeeba('0x94')]||0x0})[_0xeeba('0x95')](function(_0x3fed55){for(var _0x5aa282=0x0;_0x5aa282<_0x1e9a0d[_0xeeba('0x50')][_0xeeba('0x53')][_0xeeba('0x43')];_0x5aa282+=0x1){var _0x305ae0={'UserId':Number(_0x1e9a0d[_0xeeba('0x4a')]['id'])};_0x305ae0[_[_0xeeba('0x92')](_0x5b4107[_0xeeba('0x96')]())+_0xeeba('0x97')]=Number(_0x1e9a0d[_0xeeba('0x50')][_0xeeba('0x53')][_0x5aa282]);socket[_0xeeba('0x20')](_0xeeba('0x26')+_[_0xeeba('0x92')](_0x5b4107['toLowerCase']())+_0xeeba('0x98'),_0x305ae0);}return _0x3fed55;})[_0xeeba('0x22')](function(){if(_0x5b4107==='voice'){return db[_0xeeba('0x99')][_0xeeba('0x7c')]({'where':{'id':_0x1e9a0d[_0xeeba('0x50')][_0xeeba('0x53')]||[]},'raw':!![],'attributes':['id',_0xeeba('0x2e')]});}})[_0xeeba('0x22')](function(_0x2d9e71){var _0x35b9d3=_0x1517bf[_0xeeba('0x23')]({'plain':!![]});var _0x1043e1=[];if(_0x5b4107===_0xeeba('0x9a')&&_0x35b9d3['role']==='agent'&&_0x35b9d3[_0xeeba('0x9b')]){for(let _0x53bbf4=0x0;_0x53bbf4<_0x2d9e71[_0xeeba('0x43')];_0x53bbf4+=0x1){_0x1043e1[_0xeeba('0x44')]({'membername':_0x35b9d3[_0xeeba('0x2e')],'UserId':_0x35b9d3['id'],'queue_name':_0x2d9e71[_0x53bbf4][_0xeeba('0x2e')],'VoiceQueueId':_0x2d9e71[_0x53bbf4]['id'],'interface':_[_0xeeba('0x5a')](_0x35b9d3[_0xeeba('0x8f')])?util['format'](_0xeeba('0x9c'),_0x35b9d3[_0xeeba('0x2e')]):_0x35b9d3[_0xeeba('0x8f')],'paused':_0x35b9d3[_0xeeba('0x8e')]||![],'penalty':_0x1e9a0d[_0xeeba('0x50')]['penalty']||0x0});}return Promise['all'](_0x1043e1[_0xeeba('0x29')](function(_0x32583b){return db[_0xeeba('0x9d')]['upsert'](_0x32583b);}));}return _0x1517bf;});}})['then'](respondWithStatusCode(_0x1053a3,null))['catch'](handleError(_0x1053a3,null));};exports[_0xeeba('0x9e')]=function(_0xc34d75,_0x225229){var _0x3ac29c,_0x3fdfe4;return db[_0xeeba('0x30')][_0xeeba('0x2c')]({'where':{'id':_0xc34d75[_0xeeba('0x4a')]['id']},'attributes':['id','name',_0xeeba('0x1e')]})[_0xeeba('0x22')](handleEntityNotFound(_0x225229,null))['then'](function(_0x27f258){if(_0x27f258){_0x3ac29c=_0x27f258;if(!_0xc34d75['query'][_0xeeba('0x9f')]||!utils[_0xeeba('0x90')](_0xc34d75[_0xeeba('0x3a')][_0xeeba('0x9f')])){throw new db['Sequelize'][(_0xeeba('0x83'))](_0xeeba('0x91'));}return _0x27f258[_0xeeba('0xa0')+_[_0xeeba('0x92')](_0xc34d75[_0xeeba('0x3a')][_0xeeba('0x9f')][_0xeeba('0x96')]())+_0xeeba('0x93')](_0xc34d75[_0xeeba('0x3a')][_0xeeba('0x53')]);}})[_0xeeba('0x22')](function(_0x5caff2){if(_[_0xeeba('0xa1')](_0xc34d75[_0xeeba('0x3a')][_0xeeba('0x53')])){for(var _0xb329d0=0x0;_0xb329d0<_0xc34d75[_0xeeba('0x3a')]['ids'][_0xeeba('0x43')];_0xb329d0+=0x1){_0x3fdfe4={'UserId':Number(_0xc34d75[_0xeeba('0x4a')]['id'])};_0x3fdfe4[_['capitalize'](_0xc34d75['query'][_0xeeba('0x9f')][_0xeeba('0x96')]())+'QueueId']=Number(_0xc34d75[_0xeeba('0x3a')][_0xeeba('0x53')][_0xb329d0]);socket['emit'](_0xeeba('0x26')+_[_0xeeba('0x92')](_0xc34d75['query'][_0xeeba('0x9f')][_0xeeba('0x96')]())+'Queue:remove',_0x3fdfe4);}}else{_0x3fdfe4={'UserId':Number(_0xc34d75['params']['id'])};_0x3fdfe4[_['capitalize'](_0xc34d75[_0xeeba('0x3a')][_0xeeba('0x9f')]['toLowerCase']())+_0xeeba('0x97')]=Number(_0xc34d75[_0xeeba('0x3a')][_0xeeba('0x53')]);socket[_0xeeba('0x20')]('user'+_[_0xeeba('0x92')](_0xc34d75[_0xeeba('0x3a')]['channel'][_0xeeba('0x96')]())+_0xeeba('0xa2'),_0x3fdfe4);}return _0x5caff2;})['then'](function(){if(_0xc34d75['query'][_0xeeba('0x9f')]===_0xeeba('0x9a')){return db[_0xeeba('0x9d')]['destroy']({'where':{'UserId':_0xc34d75['params']['id'],'VoiceQueueId':_0xc34d75['query'][_0xeeba('0x53')]},'individualHooks':!![]})[_0xeeba('0x22')](function(){return _0x3ac29c;});}return _0x3ac29c;})[_0xeeba('0x22')](respondWithStatusCode(_0x225229,null))['catch'](handleError(_0x225229,null));};exports['addAvatar']=function(_0x2fccf6,_0x28c70f){_0x2fccf6[_0xeeba('0x50')]['userpic']=_0x2fccf6[_0xeeba('0xa3')][_0xeeba('0xa4')];return db[_0xeeba('0x30')]['find']({'where':{'id':_0x2fccf6[_0xeeba('0x4a')]['id']}})[_0xeeba('0x22')](handleEntityNotFound(_0x28c70f,null))[_0xeeba('0x22')](saveUpdates(_0x2fccf6[_0xeeba('0x50')],null))[_0xeeba('0x22')](respondWithResult(_0x28c70f,null))[_0xeeba('0x4f')](handleError(_0x28c70f,null));};exports['getAvatar']=function(_0x1ea41b,_0x54dc3c){var _0x275e02=path[_0xeeba('0xa5')](config[_0xeeba('0xa6')],'server/files/images/logos/default_profile.png');return db['User']['find']({'where':{'id':_0x1ea41b[_0xeeba('0x4a')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0xeeba('0x22')](handleEntityNotFound(_0x54dc3c,null))[_0xeeba('0x22')](function(_0xb9b150){if(_0xb9b150){if(_[_0xeeba('0x5a')](_0xb9b150[_0xeeba('0xa7')])){return _0x54dc3c[_0xeeba('0xa8')](_0x275e02);}else{if(!fs[_0xeeba('0xa9')](path[_0xeeba('0xa5')](config[_0xeeba('0xa6')],'server/files/images/',_0xb9b150['userpic']))){return _0x54dc3c[_0xeeba('0xa8')](_0x275e02);}return _0x54dc3c[_0xeeba('0xa8')](path[_0xeeba('0xa5')](config[_0xeeba('0xa6')],_0xeeba('0xaa'),_0xb9b150[_0xeeba('0xa7')]));}}})[_0xeeba('0x4f')](handleError(_0x54dc3c,null));};exports[_0xeeba('0xab')]=function(_0x1441df,_0x421e48){return db[_0xeeba('0x30')][_0xeeba('0x2c')]({'where':{'id':_0x1441df['params']['id']},'attributes':['id']})[_0xeeba('0x22')](handleEntityNotFound(_0x421e48,null))[_0xeeba('0x22')](function(_0x2b2eca){var _0x626388=[];values=_0x2b2eca['dataValues'];_0x626388[_0xeeba('0x44')](get_open_tabs('chat',_0x2b2eca[_0xeeba('0x46')]));_0x626388['push'](get_open_tabs(_0xeeba('0x47'),_0x2b2eca[_0xeeba('0x46')]));_0x626388[_0xeeba('0x44')](get_open_tabs(_0xeeba('0x49'),_0x2b2eca[_0xeeba('0x46')]));_0x626388['push'](get_open_tabs(_0xeeba('0x4c'),_0x2b2eca[_0xeeba('0x46')]));_0x626388['push'](get_open_tabs(_0xeeba('0x48'),_0x2b2eca[_0xeeba('0x46')]));_0x626388['push'](get_open_tabs('mail',_0x2b2eca['dataValues']));return Promise['all'](_0x626388);})[_0xeeba('0x22')](function(_0x41ea1c){if(_0x41ea1c){var _0x29ee98=_[_0xeeba('0x29')](values[_0xeeba('0xac')],function(_0x25e378){return{'channel':_0xeeba('0xad'),'id':_0x25e378['id'],'createdAt':_0x25e378[_0xeeba('0xae')]};});var _0x26b8b6=_[_0xeeba('0x29')](values['FaxOpenTabs'],function(_0x19ccfa){return{'channel':_0xeeba('0xaf'),'id':_0x19ccfa['id'],'createdAt':_0x19ccfa[_0xeeba('0xae')]};});var _0x4cc9dc=_[_0xeeba('0x29')](values['OpenchannelOpenTabs'],function(_0x1efb1d){return{'channel':_0xeeba('0xb0'),'id':_0x1efb1d['id'],'createdAt':_0x1efb1d[_0xeeba('0xae')]};});var _0x519b2d=_[_0xeeba('0x29')](values[_0xeeba('0xb1')],function(_0x38142f){return{'channel':_0xeeba('0xb2'),'id':_0x38142f['id'],'createdAt':_0x38142f[_0xeeba('0xae')]};});var _0x5b4073=_[_0xeeba('0x29')](values[_0xeeba('0xb3')],function(_0x2655d0){return{'channel':_0xeeba('0xb4'),'id':_0x2655d0['id'],'createdAt':_0x2655d0['createdAt']};});var _0x1db2da=_[_0xeeba('0x29')](values['WhatsappOpenTabs'],function(_0x5f6393){return{'channel':_0xeeba('0xb5'),'id':_0x5f6393['id'],'createdAt':_0x5f6393[_0xeeba('0xae')]};});var _0x534f5c=_['concat'](_0x29ee98,_0x26b8b6,_0x4cc9dc,_0x519b2d,_0x5b4073,_0x1db2da);var _0x4d3d15={'count':_0x534f5c[_0xeeba('0x43')],'rows':_0x534f5c};return _0x4d3d15;}else return null;})[_0xeeba('0x22')](respondWithResult(_0x421e48,null))[_0xeeba('0x4f')](handleError(_0x421e48,null));};exports['getContacts']=function(_0x598095,_0x377a89){var _0x2ada34={};return db[_0xeeba('0x30')][_0xeeba('0x88')]({'where':{'id':_0x598095[_0xeeba('0x4a')]['id']}})[_0xeeba('0x22')](function(_0x5a7e9d){if(!_0x5a7e9d){throw new APINotFoundError(util[_0xeeba('0xb6')](_0xeeba('0xb7'),_0x598095[_0xeeba('0x4a')]['id']));}return contacts[_0xeeba('0x51')]();})['then'](function(_0x303391){_0x598095['query'][_0xeeba('0x30')]=_0x598095['params']['id'];_0x2ada34=qs[_0xeeba('0xb8')](_0x303391,_0x598095);if(_0x598095[_0xeeba('0x3a')][_0xeeba('0xb9')](_0xeeba('0x3b'))){_0x2ada34['include']=[{'model':db[_0xeeba('0xba')],'as':_0xeeba('0xbb'),'required':![]},{'model':db[_0xeeba('0xbc')],'as':_0xeeba('0xbd'),'attributes':['id',_0xeeba('0x2e'),_0xeeba('0xbe')],'where':_0x598095[_0xeeba('0x3a')][_0xeeba('0xbf')]?{'id':_0x598095['query'][_0xeeba('0xbf')]}:undefined,'required':_0x598095[_0xeeba('0x3a')][_0xeeba('0xbf')]?!![]:![]}];}return contacts['findAll'](_0x598095[_0xeeba('0x3a')],_0x598095['user'],_0x2ada34,_0x303391);})[_0xeeba('0x22')](respondWithFilteredResult(_0x377a89,_0x2ada34))['catch'](APIHandleError(_0x377a89));};exports['getQueues']=function(_0x36b0b0,_0x42f438){var _0x584b13;var _0x2ae7be={};var _0x3124e8;return db['User'][_0xeeba('0x88')]({'where':{'id':_0x36b0b0[_0xeeba('0x4a')]['id']},'attributes':['id',_0xeeba('0x2e'),_0xeeba('0x1e')]})[_0xeeba('0x22')](handleEntityNotFound(_0x42f438,null))['then'](function(_0x25665a){if(!utils['isValidChannel'](_0x36b0b0[_0xeeba('0x3a')][_0xeeba('0x9f')])){throw new db[(_0xeeba('0x82'))][(_0xeeba('0x83'))](_0xeeba('0x91'));}_0x584b13=_0x25665a;var _0x3a33f4={};_0x3a33f4['model']=_['keys'](db[_['capitalize'](_0x36b0b0[_0xeeba('0x3a')][_0xeeba('0x9f')])+_0xeeba('0xc0')]['rawAttributes']);_0x3a33f4[_0xeeba('0x3a')]=_[_0xeeba('0xc1')](_0x36b0b0[_0xeeba('0x3a')]);_0x3a33f4['filters']=_['intersection'](_0x3a33f4[_0xeeba('0xc2')],_0x3a33f4[_0xeeba('0x3a')]);_0x2ae7be[_0xeeba('0x40')]=_[_0xeeba('0xc3')](_0x3a33f4[_0xeeba('0xc2')],qs[_0xeeba('0xc4')](_0x36b0b0['query'][_0xeeba('0xc4')]));_0x2ae7be[_0xeeba('0x40')]=_0x2ae7be[_0xeeba('0x40')][_0xeeba('0x43')]?_0x2ae7be[_0xeeba('0x40')]:_0x3a33f4['model'];_0x2ae7be['order']=qs[_0xeeba('0xc5')](_0x36b0b0[_0xeeba('0x3a')][_0xeeba('0xc5')]);_0x2ae7be[_0xeeba('0xc6')]=qs[_0xeeba('0xc7')](_[_0xeeba('0xc8')](_0x36b0b0[_0xeeba('0x3a')],_0x3a33f4[_0xeeba('0xc7')]));if(_0x36b0b0[_0xeeba('0x3a')][_0xeeba('0xc9')]){_0x2ae7be[_0xeeba('0xc6')]=_[_0xeeba('0xca')](_0x2ae7be[_0xeeba('0xc6')],{'$or':_[_0xeeba('0x29')](_0x2ae7be[_0xeeba('0x40')],function(_0xbd9783){var _0x20fc79={};_0x20fc79[_0xbd9783]={'$like':'%'+_0x36b0b0[_0xeeba('0x3a')][_0xeeba('0xc9')]+'%'};return _0x20fc79;})});}_0x2ae7be=_['merge']({},_0x2ae7be,_0x36b0b0[_0xeeba('0x4b')]);switch(_0x584b13[_0xeeba('0x1e')]){case'admin':return db[_[_0xeeba('0x92')](_0x36b0b0[_0xeeba('0x3a')][_0xeeba('0x9f')])+_0xeeba('0xc0')][_0xeeba('0x7c')](_0x2ae7be);case'user':case _0xeeba('0x1f'):return _0x584b13['get'+_[_0xeeba('0x92')](_0x36b0b0[_0xeeba('0x3a')][_0xeeba('0x9f')])+_0xeeba('0x93')](_0x2ae7be);default:throw new db[(_0xeeba('0x82'))]['ValidationError'](_0xeeba('0xcb'));}})[_0xeeba('0x22')](function(_0x4b1f23){_0x3124e8=_0x4b1f23[_0xeeba('0x43')];if(!_0x36b0b0[_0xeeba('0x3a')][_0xeeba('0xb9')](_0xeeba('0xcc'))){_0x2ae7be[_0xeeba('0x1b')]=qs[_0xeeba('0x1b')](_0x36b0b0[_0xeeba('0x3a')]['limit']);_0x2ae7be[_0xeeba('0x19')]=qs[_0xeeba('0x19')](_0x36b0b0['query']['offset']);}switch(_0x584b13[_0xeeba('0x1e')]){case _0xeeba('0x24'):return db[_[_0xeeba('0x92')](_0x36b0b0[_0xeeba('0x3a')]['channel'])+_0xeeba('0xc0')][_0xeeba('0x7c')](_0x2ae7be);case _0xeeba('0x26'):case'agent':return _0x584b13[_0xeeba('0x23')+_[_0xeeba('0x92')](_0x36b0b0['query'][_0xeeba('0x9f')])+_0xeeba('0x93')](_0x2ae7be);}})[_0xeeba('0x22')](function(_0x3a1c6f){return{'count':_0x3124e8,'rows':_0x3a1c6f};})[_0xeeba('0x22')](respondWithResult(_0x42f438,null))['catch'](handleError(_0x42f438,null));};exports[_0xeeba('0xcd')]=function(_0x5a943b,_0x122b05){var _0x370775={};var _0x46e6c6={};var _0xfd7dc1;var _0x57df49;return db['User']['findOne']({'where':{'id':_0x5a943b[_0xeeba('0x4a')]['id']}})[_0xeeba('0x22')](handleEntityNotFound(_0x122b05,null))['then'](function(_0x385964){if(_0x385964){_0xfd7dc1=_0x385964;_0x46e6c6['model']=_['keys'](db[_0xeeba('0x9d')][_0xeeba('0xce')]);_0x46e6c6['query']=_['keys'](_0x5a943b[_0xeeba('0x3a')]);_0x46e6c6[_0xeeba('0xc7')]=_[_0xeeba('0xc3')](_0x46e6c6[_0xeeba('0xc2')],_0x46e6c6[_0xeeba('0x3a')]);_0x370775[_0xeeba('0x40')]=_[_0xeeba('0xc3')](_0x46e6c6[_0xeeba('0xc2')],qs['fields'](_0x5a943b[_0xeeba('0x3a')]['fields']));_0x370775[_0xeeba('0x40')]=_0x370775['attributes'][_0xeeba('0x43')]?_0x370775[_0xeeba('0x40')]:_0x46e6c6[_0xeeba('0xc2')];_0x370775[_0xeeba('0xcf')]=qs['sort'](_0x5a943b[_0xeeba('0x3a')][_0xeeba('0xc5')]);_0x370775[_0xeeba('0xc6')]=qs[_0xeeba('0xc7')](_[_0xeeba('0xc8')](_0x5a943b[_0xeeba('0x3a')],_0x46e6c6['filters']));if(_0x5a943b[_0xeeba('0x3a')][_0xeeba('0xc9')]){_0x370775[_0xeeba('0xc6')]=_[_0xeeba('0xca')](_0x370775['where'],{'$or':_['map'](_0x370775[_0xeeba('0x40')],function(_0x30363e){var _0x4730e6={};_0x4730e6[_0x30363e]={'$like':'%'+_0x5a943b[_0xeeba('0x3a')][_0xeeba('0xc9')]+'%'};return _0x4730e6;})});}_0x370775=_[_0xeeba('0xca')]({},_0x370775,_0x5a943b[_0xeeba('0x4b')]);return _0xfd7dc1[_0xeeba('0xcd')](_0x370775);}})[_0xeeba('0x22')](function(_0x45f9a1){if(_0x45f9a1){_0x57df49=_0x45f9a1[_0xeeba('0x43')];if(!_0x5a943b[_0xeeba('0x3a')][_0xeeba('0xb9')](_0xeeba('0xcc'))){_0x370775['limit']=qs['limit'](_0x5a943b['query'][_0xeeba('0x1b')]);_0x370775[_0xeeba('0x19')]=qs[_0xeeba('0x19')](_0x5a943b[_0xeeba('0x3a')]['offset']);}return _0xfd7dc1['getVoiceQueuesRt'](_0x370775);}})[_0xeeba('0x22')](function(_0x3cd7ae){if(_0x3cd7ae){return _0x3cd7ae?{'count':_0x57df49,'rows':_0x3cd7ae}:null;}})[_0xeeba('0x22')](respondWithResult(_0x122b05,null))[_0xeeba('0x4f')](handleError(_0x122b05,null));};exports[_0xeeba('0xd0')]=function(_0x163b16,_0x33d0eb){var _0x13d3d7={};var _0x2d7cb7={};var _0x33434b;var _0x505e16;return db['User'][_0xeeba('0x88')]({'where':{'id':_0x163b16['params']['id']}})[_0xeeba('0x22')](handleEntityNotFound(_0x33d0eb,null))[_0xeeba('0x22')](function(_0x1a8563){if(_0x1a8563){_0x33434b=_0x1a8563;_0x2d7cb7['model']=_[_0xeeba('0xc1')](db[_0xeeba('0xd1')][_0xeeba('0xce')]);_0x2d7cb7[_0xeeba('0x3a')]=_[_0xeeba('0xc1')](_0x163b16[_0xeeba('0x3a')]);_0x2d7cb7[_0xeeba('0xc7')]=_[_0xeeba('0xc3')](_0x2d7cb7[_0xeeba('0xc2')],_0x2d7cb7[_0xeeba('0x3a')]);_0x13d3d7[_0xeeba('0x40')]=_[_0xeeba('0xc3')](_0x2d7cb7['model'],qs[_0xeeba('0xc4')](_0x163b16[_0xeeba('0x3a')]['fields']));_0x13d3d7['attributes']=_0x13d3d7['attributes']['length']?_0x13d3d7[_0xeeba('0x40')]:_0x2d7cb7['model'];_0x13d3d7['order']=qs[_0xeeba('0xc5')](_0x163b16['query'][_0xeeba('0xc5')]);_0x13d3d7[_0xeeba('0xc6')]=qs[_0xeeba('0xc7')](_[_0xeeba('0xc8')](_0x163b16[_0xeeba('0x3a')],_0x2d7cb7['filters']));if(_0x163b16['query']['filter']){_0x13d3d7[_0xeeba('0xc6')]=_['merge'](_0x13d3d7[_0xeeba('0xc6')],{'$or':_[_0xeeba('0x29')](_0x13d3d7[_0xeeba('0x40')],function(_0x1d53ff){var _0x3440d9={};_0x3440d9[_0x1d53ff]={'$like':'%'+_0x163b16[_0xeeba('0x3a')][_0xeeba('0xc9')]+'%'};return _0x3440d9;})});}_0x13d3d7=_[_0xeeba('0xca')]({},_0x13d3d7,_0x163b16[_0xeeba('0x4b')]);return _0x33434b[_0xeeba('0xd0')](_0x13d3d7);}})['then'](function(_0x5c1943){if(_0x5c1943){_0x505e16=_0x5c1943[_0xeeba('0x43')];if(!_0x163b16[_0xeeba('0x3a')][_0xeeba('0xb9')](_0xeeba('0xcc'))){_0x13d3d7[_0xeeba('0x1b')]=qs[_0xeeba('0x1b')](_0x163b16[_0xeeba('0x3a')][_0xeeba('0x1b')]);_0x13d3d7[_0xeeba('0x19')]=qs[_0xeeba('0x19')](_0x163b16['query']['offset']);}return _0x33434b[_0xeeba('0xd0')](_0x13d3d7);}})['then'](function(_0x5716bd){if(_0x5716bd){return _0x5716bd?{'count':_0x505e16,'rows':_0x5716bd}:null;}})[_0xeeba('0x22')](respondWithResult(_0x33d0eb,null))[_0xeeba('0x4f')](handleError(_0x33d0eb,null));};exports[_0xeeba('0xd2')]=function(_0x39fb5c,_0x4b5af1){var _0x2d20d0={'raw':!![],'where':{}};var _0x3bed32={};var _0x49928f={'count':0x0,'rows':[]};return db['User'][_0xeeba('0x88')]({'where':{'id':_0x39fb5c[_0xeeba('0x4a')]['id']}})[_0xeeba('0x22')](handleEntityNotFound(_0x4b5af1,null))[_0xeeba('0x22')](function(_0x59a496){if(_0x59a496){_0x3bed32['model']=_['keys'](db['VoiceRecording']['rawAttributes']);_0x3bed32[_0xeeba('0x3a')]=_[_0xeeba('0xc1')](_0x39fb5c[_0xeeba('0x3a')]);_0x3bed32[_0xeeba('0xc7')]=_['intersection'](_0x3bed32[_0xeeba('0xc2')],_0x3bed32[_0xeeba('0x3a')]);_0x2d20d0[_0xeeba('0x40')]=_['intersection'](_0x3bed32[_0xeeba('0xc2')],qs[_0xeeba('0xc4')](_0x39fb5c[_0xeeba('0x3a')][_0xeeba('0xc4')]));_0x2d20d0[_0xeeba('0x40')]=_0x2d20d0[_0xeeba('0x40')][_0xeeba('0x43')]?_0x2d20d0[_0xeeba('0x40')]:_0x3bed32[_0xeeba('0xc2')];if(!_0x39fb5c[_0xeeba('0x3a')][_0xeeba('0xb9')](_0xeeba('0xcc'))){_0x2d20d0['limit']=qs[_0xeeba('0x1b')](_0x39fb5c[_0xeeba('0x3a')][_0xeeba('0x1b')]);_0x2d20d0[_0xeeba('0x19')]=qs[_0xeeba('0x19')](_0x39fb5c['query'][_0xeeba('0x19')]);}_0x2d20d0['order']=qs[_0xeeba('0xc5')](_0x39fb5c['query'][_0xeeba('0xc5')]);_0x2d20d0[_0xeeba('0xc6')]=qs[_0xeeba('0xc7')](_[_0xeeba('0xc8')](_0x39fb5c['query'],_0x3bed32[_0xeeba('0xc7')]));_0x2d20d0[_0xeeba('0xc6')]['UserId']=_0x59a496['id'];if(_0x39fb5c[_0xeeba('0x3a')][_0xeeba('0xc9')]){_0x2d20d0[_0xeeba('0xc6')]=_[_0xeeba('0xca')](_0x2d20d0[_0xeeba('0xc6')],{'$or':_['map'](_0x2d20d0[_0xeeba('0x40')],function(_0x56b276){var _0x5ef033={};_0x5ef033[_0x56b276]={'$like':'%'+_0x39fb5c[_0xeeba('0x3a')][_0xeeba('0xc9')]+'%'};return _0x5ef033;})});}_0x2d20d0=_[_0xeeba('0xca')]({},_0x2d20d0,_0x39fb5c[_0xeeba('0x4b')]);return db[_0xeeba('0xd3')]['count']({'where':_0x2d20d0['where']})[_0xeeba('0x22')](function(_0x1e2fb9){_0x49928f[_0xeeba('0x39')]=_0x1e2fb9;if(_0x39fb5c[_0xeeba('0x3a')]['includeAll']){_0x2d20d0[_0xeeba('0x3c')]=[{'all':!![]}];}return db[_0xeeba('0xd3')][_0xeeba('0x7c')](_0x2d20d0);})[_0xeeba('0x22')](function(_0x1a6edb){_0x49928f[_0xeeba('0x42')]=_0x1a6edb;return _0x49928f;});}})[_0xeeba('0x22')](respondWithFilteredResult(_0x4b5af1,_0x2d20d0))[_0xeeba('0x4f')](handleError(_0x4b5af1,null));};exports[_0xeeba('0xd4')]=function(_0x53e5be,_0x922043){var _0x57f1ca={'raw':!![],'where':{}};var _0x5aa3f7={};var _0x21e3bc={'count':0x0,'rows':[]};return db['User'][_0xeeba('0x88')]({'where':{'id':_0x53e5be['params']['id']}})[_0xeeba('0x22')](handleEntityNotFound(_0x922043,null))['then'](function(_0x3555bd){if(_0x3555bd){_0x5aa3f7[_0xeeba('0xc2')]=_[_0xeeba('0xc1')](db[_0xeeba('0xd5')][_0xeeba('0xce')]);_0x5aa3f7[_0xeeba('0x3a')]=_['keys'](_0x53e5be[_0xeeba('0x3a')]);_0x5aa3f7[_0xeeba('0xc7')]=_['intersection'](_0x5aa3f7[_0xeeba('0xc2')],_0x5aa3f7['query']);_0x57f1ca[_0xeeba('0x40')]=_[_0xeeba('0xc3')](_0x5aa3f7[_0xeeba('0xc2')],qs[_0xeeba('0xc4')](_0x53e5be[_0xeeba('0x3a')][_0xeeba('0xc4')]));_0x57f1ca['attributes']=_0x57f1ca[_0xeeba('0x40')][_0xeeba('0x43')]?_0x57f1ca[_0xeeba('0x40')]:_0x5aa3f7[_0xeeba('0xc2')];if(!_0x53e5be['query'][_0xeeba('0xb9')]('nolimit')){_0x57f1ca[_0xeeba('0x1b')]=qs['limit'](_0x53e5be[_0xeeba('0x3a')][_0xeeba('0x1b')]);_0x57f1ca[_0xeeba('0x19')]=qs['offset'](_0x53e5be['query'][_0xeeba('0x19')]);}_0x57f1ca[_0xeeba('0xcf')]=qs['sort'](_0x53e5be['query'][_0xeeba('0xc5')]);_0x57f1ca[_0xeeba('0xc6')]=qs[_0xeeba('0xc7')](_[_0xeeba('0xc8')](_0x53e5be[_0xeeba('0x3a')],_0x5aa3f7[_0xeeba('0xc7')]));_0x57f1ca[_0xeeba('0xc6')][_0xeeba('0xd6')]=_0x3555bd['id'];if(_0x53e5be[_0xeeba('0x3a')][_0xeeba('0xc9')]){_0x57f1ca[_0xeeba('0xc6')]=_[_0xeeba('0xca')](_0x57f1ca[_0xeeba('0xc6')],{'$or':_['map'](_0x57f1ca[_0xeeba('0x40')],function(_0x41ba9c){var _0x3b3c2e={};_0x3b3c2e[_0x41ba9c]={'$like':'%'+_0x53e5be['query'][_0xeeba('0xc9')]+'%'};return _0x3b3c2e;})});}_0x57f1ca=_[_0xeeba('0xca')]({},_0x57f1ca,_0x53e5be[_0xeeba('0x4b')]);return db[_0xeeba('0xd5')][_0xeeba('0x39')]({'where':_0x57f1ca[_0xeeba('0xc6')]})[_0xeeba('0x22')](function(_0x1dc502){_0x21e3bc[_0xeeba('0x39')]=_0x1dc502;if(_0x53e5be[_0xeeba('0x3a')][_0xeeba('0x3b')]){_0x57f1ca[_0xeeba('0x3c')]=[{'all':!![]}];}return db[_0xeeba('0xd5')]['findAll'](_0x57f1ca);})['then'](function(_0x5f2a7d){_0x21e3bc['rows']=_0x5f2a7d;return _0x21e3bc;});}})[_0xeeba('0x22')](respondWithFilteredResult(_0x922043,_0x57f1ca))[_0xeeba('0x4f')](handleError(_0x922043,null));};exports[_0xeeba('0xd7')]=function(_0x1427d5,_0x497a8d){var _0x5eea13={};var _0x19165a={};var _0x33db20;var _0x32cb03;return db[_0xeeba('0x30')]['findOne']({'where':{'id':_0x1427d5['params']['id']}})['then'](handleEntityNotFound(_0x497a8d,null))[_0xeeba('0x22')](function(_0x163024){if(_0x163024){_0x33db20=_0x163024;_0x19165a['model']=_[_0xeeba('0xc1')](db[_0xeeba('0xd8')]['rawAttributes']);_0x19165a[_0xeeba('0x3a')]=_[_0xeeba('0xc1')](_0x1427d5[_0xeeba('0x3a')]);_0x19165a[_0xeeba('0xc7')]=_[_0xeeba('0xc3')](_0x19165a[_0xeeba('0xc2')],_0x19165a[_0xeeba('0x3a')]);_0x5eea13[_0xeeba('0x40')]=_[_0xeeba('0xc3')](_0x19165a['model'],qs[_0xeeba('0xc4')](_0x1427d5[_0xeeba('0x3a')]['fields']));_0x5eea13[_0xeeba('0x40')]=_0x5eea13[_0xeeba('0x40')][_0xeeba('0x43')]?_0x5eea13[_0xeeba('0x40')]:_0x19165a['model'];_0x5eea13['order']=qs[_0xeeba('0xc5')](_0x1427d5['query'][_0xeeba('0xc5')]);_0x5eea13['where']=qs['filters'](_['pick'](_0x1427d5[_0xeeba('0x3a')],_0x19165a[_0xeeba('0xc7')]));if(_0x1427d5['query'][_0xeeba('0xc9')]){_0x5eea13[_0xeeba('0xc6')]=_[_0xeeba('0xca')](_0x5eea13[_0xeeba('0xc6')],{'$or':_['map'](_0x5eea13[_0xeeba('0x40')],function(_0x43f851){var _0x1d0a17={};_0x1d0a17[_0x43f851]={'$like':'%'+_0x1427d5['query']['filter']+'%'};return _0x1d0a17;})});}_0x5eea13=_['merge']({},_0x5eea13,_0x1427d5[_0xeeba('0x4b')]);return _0x33db20['getChatInteractions'](_0x5eea13);}})[_0xeeba('0x22')](function(_0x503665){if(_0x503665){_0x32cb03=_0x503665[_0xeeba('0x43')];if(!_0x1427d5[_0xeeba('0x3a')][_0xeeba('0xb9')]('nolimit')){_0x5eea13[_0xeeba('0x1b')]=qs[_0xeeba('0x1b')](_0x1427d5[_0xeeba('0x3a')]['limit']);_0x5eea13[_0xeeba('0x19')]=qs[_0xeeba('0x19')](_0x1427d5['query'][_0xeeba('0x19')]);}return _0x33db20[_0xeeba('0xd7')](_0x5eea13);}})[_0xeeba('0x22')](function(_0x3b5c72){if(_0x3b5c72){return _0x3b5c72?{'count':_0x32cb03,'rows':_0x3b5c72}:null;}})['then'](respondWithResult(_0x497a8d,null))[_0xeeba('0x4f')](handleError(_0x497a8d,null));};exports[_0xeeba('0xd9')]=function(_0xcb8953,_0x31c2df){var _0x134d06={};var _0xf91f84={};var _0x15a7b4;var _0x3c21d5;return db[_0xeeba('0x30')][_0xeeba('0x88')]({'where':{'id':_0xcb8953[_0xeeba('0x4a')]['id']}})[_0xeeba('0x22')](handleEntityNotFound(_0x31c2df,null))[_0xeeba('0x22')](function(_0x369131){if(_0x369131){_0x15a7b4=_0x369131;_0xf91f84[_0xeeba('0xc2')]=_[_0xeeba('0xc1')](db['OpenchannelInteraction'][_0xeeba('0xce')]);_0xf91f84[_0xeeba('0x3a')]=_[_0xeeba('0xc1')](_0xcb8953[_0xeeba('0x3a')]);_0xf91f84[_0xeeba('0xc7')]=_[_0xeeba('0xc3')](_0xf91f84['model'],_0xf91f84[_0xeeba('0x3a')]);_0x134d06[_0xeeba('0x40')]=_['intersection'](_0xf91f84[_0xeeba('0xc2')],qs['fields'](_0xcb8953[_0xeeba('0x3a')]['fields']));_0x134d06[_0xeeba('0x40')]=_0x134d06[_0xeeba('0x40')][_0xeeba('0x43')]?_0x134d06[_0xeeba('0x40')]:_0xf91f84[_0xeeba('0xc2')];_0x134d06['order']=qs['sort'](_0xcb8953[_0xeeba('0x3a')]['sort']);_0x134d06['where']=qs[_0xeeba('0xc7')](_[_0xeeba('0xc8')](_0xcb8953[_0xeeba('0x3a')],_0xf91f84['filters']));if(_0xcb8953[_0xeeba('0x3a')][_0xeeba('0xc9')]){_0x134d06[_0xeeba('0xc6')]=_[_0xeeba('0xca')](_0x134d06[_0xeeba('0xc6')],{'$or':_[_0xeeba('0x29')](_0x134d06['attributes'],function(_0x32721d){var _0x17a3ad={};_0x17a3ad[_0x32721d]={'$like':'%'+_0xcb8953['query'][_0xeeba('0xc9')]+'%'};return _0x17a3ad;})});}_0x134d06=_[_0xeeba('0xca')]({},_0x134d06,_0xcb8953[_0xeeba('0x4b')]);return _0x15a7b4[_0xeeba('0xd9')](_0x134d06);}})[_0xeeba('0x22')](function(_0x5cdecd){if(_0x5cdecd){_0x3c21d5=_0x5cdecd[_0xeeba('0x43')];if(!_0xcb8953['query'][_0xeeba('0xb9')](_0xeeba('0xcc'))){_0x134d06[_0xeeba('0x1b')]=qs[_0xeeba('0x1b')](_0xcb8953['query'][_0xeeba('0x1b')]);_0x134d06[_0xeeba('0x19')]=qs[_0xeeba('0x19')](_0xcb8953['query']['offset']);}return _0x15a7b4['getOpenchannelInteractions'](_0x134d06);}})[_0xeeba('0x22')](function(_0x26b2ac){if(_0x26b2ac){return _0x26b2ac?{'count':_0x3c21d5,'rows':_0x26b2ac}:null;}})[_0xeeba('0x22')](respondWithResult(_0x31c2df,null))[_0xeeba('0x4f')](handleError(_0x31c2df,null));};exports[_0xeeba('0xda')]=function(_0x5ca169,_0x3a5e60){var _0x513286={'raw':!![],'where':{}};var _0x222ce3={};var _0x55fca6={'count':0x0,'rows':[]};return db[_0xeeba('0x30')][_0xeeba('0x88')]({'where':{'id':_0x5ca169[_0xeeba('0x4a')]['id']}})[_0xeeba('0x22')](handleEntityNotFound(_0x3a5e60,null))[_0xeeba('0x22')](function(_0x5d85b2){if(_0x5d85b2){_0x222ce3['model']=_[_0xeeba('0xc1')](db[_0xeeba('0xdb')][_0xeeba('0xce')]);_0x222ce3['query']=_[_0xeeba('0xc1')](_0x5ca169[_0xeeba('0x3a')]);_0x222ce3[_0xeeba('0xc7')]=_[_0xeeba('0xc3')](_0x222ce3[_0xeeba('0xc2')],_0x222ce3[_0xeeba('0x3a')]);_0x513286[_0xeeba('0x40')]=_[_0xeeba('0xc3')](_0x222ce3[_0xeeba('0xc2')],qs[_0xeeba('0xc4')](_0x5ca169[_0xeeba('0x3a')][_0xeeba('0xc4')]));_0x513286[_0xeeba('0x40')]=_0x513286[_0xeeba('0x40')][_0xeeba('0x43')]?_0x513286[_0xeeba('0x40')]:_0x222ce3[_0xeeba('0xc2')];if(!_0x5ca169[_0xeeba('0x3a')][_0xeeba('0xb9')](_0xeeba('0xcc'))){_0x513286['limit']=qs[_0xeeba('0x1b')](_0x5ca169[_0xeeba('0x3a')][_0xeeba('0x1b')]);_0x513286['offset']=qs['offset'](_0x5ca169[_0xeeba('0x3a')][_0xeeba('0x19')]);}_0x513286[_0xeeba('0xcf')]=qs[_0xeeba('0xc5')](_0x5ca169[_0xeeba('0x3a')][_0xeeba('0xc5')]);_0x513286[_0xeeba('0xc6')]=qs[_0xeeba('0xc7')](_[_0xeeba('0xc8')](_0x5ca169[_0xeeba('0x3a')],_0x222ce3[_0xeeba('0xc7')]));_0x513286[_0xeeba('0xc6')]['UserId']=_0x5d85b2['id'];if(_0x5ca169[_0xeeba('0x3a')][_0xeeba('0xc9')]){_0x513286[_0xeeba('0xc6')]=_[_0xeeba('0xca')](_0x513286[_0xeeba('0xc6')],{'$or':_[_0xeeba('0x29')](_0x513286[_0xeeba('0x40')],function(_0xaaf759){var _0x5be46e={};_0x5be46e[_0xaaf759]={'$like':'%'+_0x5ca169['query']['filter']+'%'};return _0x5be46e;})});}_0x513286=_[_0xeeba('0xca')]({},_0x513286,_0x5ca169[_0xeeba('0x4b')]);return db['MailInteraction'][_0xeeba('0x39')]({'where':_0x513286[_0xeeba('0xc6')]})[_0xeeba('0x22')](function(_0x584dd6){_0x55fca6[_0xeeba('0x39')]=_0x584dd6;if(_0x5ca169['query'][_0xeeba('0x3b')]){_0x513286['include']=[{'all':!![]}];}return db['MailInteraction'][_0xeeba('0x7c')](_0x513286);})[_0xeeba('0x22')](function(_0x430e57){_0x55fca6[_0xeeba('0x42')]=_0x430e57;return _0x55fca6;});}})[_0xeeba('0x22')](respondWithFilteredResult(_0x3a5e60,_0x513286))['catch'](handleError(_0x3a5e60,null));};exports['getSmsInteractions']=function(_0x3f0b6d,_0x3250b9){var _0x18df88={};var _0x4d3d99={};var _0x48820f;var _0x4c6f9d;return db[_0xeeba('0x30')][_0xeeba('0x88')]({'where':{'id':_0x3f0b6d[_0xeeba('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3250b9,null))['then'](function(_0x5bc513){if(_0x5bc513){_0x48820f=_0x5bc513;_0x4d3d99[_0xeeba('0xc2')]=_[_0xeeba('0xc1')](db[_0xeeba('0xdc')][_0xeeba('0xce')]);_0x4d3d99[_0xeeba('0x3a')]=_[_0xeeba('0xc1')](_0x3f0b6d[_0xeeba('0x3a')]);_0x4d3d99[_0xeeba('0xc7')]=_[_0xeeba('0xc3')](_0x4d3d99['model'],_0x4d3d99[_0xeeba('0x3a')]);_0x18df88[_0xeeba('0x40')]=_[_0xeeba('0xc3')](_0x4d3d99['model'],qs[_0xeeba('0xc4')](_0x3f0b6d['query'][_0xeeba('0xc4')]));_0x18df88[_0xeeba('0x40')]=_0x18df88[_0xeeba('0x40')]['length']?_0x18df88[_0xeeba('0x40')]:_0x4d3d99['model'];_0x18df88['order']=qs[_0xeeba('0xc5')](_0x3f0b6d[_0xeeba('0x3a')][_0xeeba('0xc5')]);_0x18df88[_0xeeba('0xc6')]=qs['filters'](_['pick'](_0x3f0b6d[_0xeeba('0x3a')],_0x4d3d99[_0xeeba('0xc7')]));if(_0x3f0b6d['query']['filter']){_0x18df88['where']=_[_0xeeba('0xca')](_0x18df88[_0xeeba('0xc6')],{'$or':_[_0xeeba('0x29')](_0x18df88[_0xeeba('0x40')],function(_0x4dd04e){var _0x6ca5ac={};_0x6ca5ac[_0x4dd04e]={'$like':'%'+_0x3f0b6d[_0xeeba('0x3a')][_0xeeba('0xc9')]+'%'};return _0x6ca5ac;})});}_0x18df88=_[_0xeeba('0xca')]({},_0x18df88,_0x3f0b6d[_0xeeba('0x4b')]);return _0x48820f['getSmsInteractions'](_0x18df88);}})[_0xeeba('0x22')](function(_0x5d3a56){if(_0x5d3a56){_0x4c6f9d=_0x5d3a56[_0xeeba('0x43')];if(!_0x3f0b6d['query'][_0xeeba('0xb9')]('nolimit')){_0x18df88[_0xeeba('0x1b')]=qs['limit'](_0x3f0b6d[_0xeeba('0x3a')]['limit']);_0x18df88['offset']=qs[_0xeeba('0x19')](_0x3f0b6d[_0xeeba('0x3a')]['offset']);}return _0x48820f['getSmsInteractions'](_0x18df88);}})[_0xeeba('0x22')](function(_0xd5eb48){if(_0xd5eb48){return _0xd5eb48?{'count':_0x4c6f9d,'rows':_0xd5eb48}:null;}})[_0xeeba('0x22')](respondWithResult(_0x3250b9,null))[_0xeeba('0x4f')](handleError(_0x3250b9,null));};exports[_0xeeba('0xdd')]=function(_0x20856a,_0x3ff61e){var _0x5b6fb5={};var _0xc6fc3b={};var _0x27557e;var _0x1d3f63;return db[_0xeeba('0x30')][_0xeeba('0x88')]({'where':{'id':_0x20856a['params']['id']}})[_0xeeba('0x22')](handleEntityNotFound(_0x3ff61e,null))[_0xeeba('0x22')](function(_0xd4d00d){if(_0xd4d00d){_0x27557e=_0xd4d00d;_0xc6fc3b[_0xeeba('0xc2')]=_[_0xeeba('0xc1')](db['FaxInteraction']['rawAttributes']);_0xc6fc3b['query']=_[_0xeeba('0xc1')](_0x20856a[_0xeeba('0x3a')]);_0xc6fc3b[_0xeeba('0xc7')]=_[_0xeeba('0xc3')](_0xc6fc3b['model'],_0xc6fc3b[_0xeeba('0x3a')]);_0x5b6fb5[_0xeeba('0x40')]=_[_0xeeba('0xc3')](_0xc6fc3b[_0xeeba('0xc2')],qs[_0xeeba('0xc4')](_0x20856a[_0xeeba('0x3a')][_0xeeba('0xc4')]));_0x5b6fb5[_0xeeba('0x40')]=_0x5b6fb5[_0xeeba('0x40')]['length']?_0x5b6fb5[_0xeeba('0x40')]:_0xc6fc3b[_0xeeba('0xc2')];_0x5b6fb5[_0xeeba('0xcf')]=qs[_0xeeba('0xc5')](_0x20856a[_0xeeba('0x3a')]['sort']);_0x5b6fb5[_0xeeba('0xc6')]=qs[_0xeeba('0xc7')](_['pick'](_0x20856a[_0xeeba('0x3a')],_0xc6fc3b[_0xeeba('0xc7')]));if(_0x20856a[_0xeeba('0x3a')]['filter']){_0x5b6fb5[_0xeeba('0xc6')]=_['merge'](_0x5b6fb5[_0xeeba('0xc6')],{'$or':_[_0xeeba('0x29')](_0x5b6fb5[_0xeeba('0x40')],function(_0x34c2af){var _0x4805e2={};_0x4805e2[_0x34c2af]={'$like':'%'+_0x20856a['query'][_0xeeba('0xc9')]+'%'};return _0x4805e2;})});}_0x5b6fb5=_[_0xeeba('0xca')]({},_0x5b6fb5,_0x20856a['options']);return _0x27557e[_0xeeba('0xdd')](_0x5b6fb5);}})['then'](function(_0x115baf){if(_0x115baf){_0x1d3f63=_0x115baf[_0xeeba('0x43')];if(!_0x20856a['query']['hasOwnProperty']('nolimit')){_0x5b6fb5[_0xeeba('0x1b')]=qs[_0xeeba('0x1b')](_0x20856a[_0xeeba('0x3a')][_0xeeba('0x1b')]);_0x5b6fb5[_0xeeba('0x19')]=qs[_0xeeba('0x19')](_0x20856a['query'][_0xeeba('0x19')]);}return _0x27557e['getFaxInteractions'](_0x5b6fb5);}})[_0xeeba('0x22')](function(_0x498dea){if(_0x498dea){return _0x498dea?{'count':_0x1d3f63,'rows':_0x498dea}:null;}})[_0xeeba('0x22')](respondWithResult(_0x3ff61e,null))['catch'](handleError(_0x3ff61e,null));};exports[_0xeeba('0xde')]=function(_0x5e78d8,_0x20cac0){var _0x32205d={};var _0x27ac3f={};var _0x203288;var _0x46714b;return db['User']['findOne']({'where':{'id':_0x5e78d8[_0xeeba('0x4a')]['id']}})['then'](handleEntityNotFound(_0x20cac0,null))[_0xeeba('0x22')](function(_0x443927){if(_0x443927){_0x203288=_0x443927;_0x27ac3f['model']=_[_0xeeba('0xc1')](db[_0xeeba('0xdf')]['rawAttributes']);_0x27ac3f[_0xeeba('0x3a')]=_[_0xeeba('0xc1')](_0x5e78d8[_0xeeba('0x3a')]);_0x27ac3f['filters']=_[_0xeeba('0xc3')](_0x27ac3f[_0xeeba('0xc2')],_0x27ac3f[_0xeeba('0x3a')]);_0x32205d[_0xeeba('0x40')]=_[_0xeeba('0xc3')](_0x27ac3f['model'],qs[_0xeeba('0xc4')](_0x5e78d8[_0xeeba('0x3a')][_0xeeba('0xc4')]));_0x32205d[_0xeeba('0x40')]=_0x32205d['attributes'][_0xeeba('0x43')]?_0x32205d[_0xeeba('0x40')]:_0x27ac3f['model'];_0x32205d[_0xeeba('0xcf')]=qs[_0xeeba('0xc5')](_0x5e78d8['query'][_0xeeba('0xc5')]);_0x32205d[_0xeeba('0xc6')]=qs[_0xeeba('0xc7')](_[_0xeeba('0xc8')](_0x5e78d8[_0xeeba('0x3a')],_0x27ac3f[_0xeeba('0xc7')]));if(_0x5e78d8[_0xeeba('0x3a')][_0xeeba('0xc9')]){_0x32205d['where']=_[_0xeeba('0xca')](_0x32205d[_0xeeba('0xc6')],{'$or':_['map'](_0x32205d[_0xeeba('0x40')],function(_0x527c70){var _0xffca03={};_0xffca03[_0x527c70]={'$like':'%'+_0x5e78d8['query'][_0xeeba('0xc9')]+'%'};return _0xffca03;})});}_0x32205d=_['merge']({},_0x32205d,_0x5e78d8['options']);return _0x203288[_0xeeba('0xde')](_0x32205d);}})[_0xeeba('0x22')](function(_0x324bc8){if(_0x324bc8){_0x46714b=_0x324bc8[_0xeeba('0x43')];if(!_0x5e78d8[_0xeeba('0x3a')][_0xeeba('0xb9')](_0xeeba('0xcc'))){_0x32205d[_0xeeba('0x1b')]=qs[_0xeeba('0x1b')](_0x5e78d8[_0xeeba('0x3a')]['limit']);_0x32205d[_0xeeba('0x19')]=qs['offset'](_0x5e78d8['query'][_0xeeba('0x19')]);}return _0x203288[_0xeeba('0xde')](_0x32205d);}})[_0xeeba('0x22')](function(_0x3eb5f0){if(_0x3eb5f0){return _0x3eb5f0?{'count':_0x46714b,'rows':_0x3eb5f0}:null;}})[_0xeeba('0x22')](respondWithResult(_0x20cac0,null))[_0xeeba('0x4f')](handleError(_0x20cac0,null));};exports[_0xeeba('0xe0')]=function(_0x387876,_0x36d85d,_0x1bb01c){var _0x5167e7;var _0x3b1acb;var _0x5a0be8;var _0x5f5680=!_['isNil'](_0x387876[_0xeeba('0x4a')]['id'])?_0x387876[_0xeeba('0x4a')]['id']:!_[_0xeeba('0x5a')](_0x387876[_0xeeba('0x26')]['id'])?_0x387876[_0xeeba('0x26')]['id']:null;return db[_0xeeba('0x30')][_0xeeba('0x2c')]({'where':{'id':_0x5f5680,'role':{'$or':[_0xeeba('0x24'),_0xeeba('0x26'),_0xeeba('0x1f')]}},'attributes':['id',_0xeeba('0x2e'),_0xeeba('0xe1'),'mobile',_0xeeba('0x1e'),_0xeeba('0x55'),_0xeeba('0x8d')]})[_0xeeba('0x22')](function(_0xb1040d){if(_0xb1040d){if(_0xb1040d[_0xeeba('0x1e')]===_0xeeba('0x1f')){_0x5167e7=_0xb1040d;if(_0x387876[_0xeeba('0x50')][_0xeeba('0x8f')]){_0x5a0be8=util['format'](_0xeeba('0xe2'),_0x5167e7[_0x387876[_0xeeba('0x50')][_0xeeba('0x8f')]]);}else if(_0x387876[_0xeeba('0x50')][_0xeeba('0xe3')]){_0x5a0be8=util['format'](_0xeeba('0x9c'),_0x387876[_0xeeba('0x50')][_0xeeba('0xe3')]);}else{_0x5a0be8=util['format'](_0xeeba('0x9c'),_0x5167e7[_0xeeba('0x2e')]);}socket['to'](util[_0xeeba('0xb6')]('user:%s',_0x5167e7[_0xeeba('0x2e')]))[_0xeeba('0x20')](_0xeeba('0xe4'),{'user':{'id':_0x5167e7['id'],'name':_0x5167e7[_0xeeba('0x2e')]},'ip':_0x387876[_0xeeba('0xe5')]['x-forwarded-for']||_0x387876[_0xeeba('0xe6')][_0xeeba('0xe7')]||_0x387876[_0xeeba('0xe8')]['remoteAddress']||_0x387876[_0xeeba('0xe6')][_0xeeba('0xe8')][_0xeeba('0xe7')]});return db[_0xeeba('0x9d')][_0xeeba('0xe9')]({'where':{'membername':_0x5167e7[_0xeeba('0x2e')]},'individualHooks':!![]});}}else{throw new db['Sequelize']['ValidationError']('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0xeeba('0x22')](function(){if(_0x5167e7){return _0x5167e7[_0xeeba('0xea')]({'raw':!![]});}})[_0xeeba('0x22')](function(_0x487f8d){if(_0x5167e7){if(_0x487f8d){_0x3b1acb=_0x487f8d;if(_0x3b1acb[_0xeeba('0x43')]){var _0xc919ac=_0x3b1acb[_0xeeba('0x29')](function(_0x37330e){var _0x1e99ef={'membername':_0x5167e7[_0xeeba('0x2e')],'UserId':_0x5167e7['id'],'queue_name':_0x37330e[_0xeeba('0x2e')],'VoiceQueueId':_0x37330e['id'],'interface':_0x5a0be8,'paused':_0x5167e7['loginInPause']||![],'penalty':_0x37330e[_0xeeba('0xeb')]||0x0};return db[_0xeeba('0x9d')]['upsert'](_0x1e99ef);});return Promise[_0xeeba('0x4e')](_0xc919ac);}}}})['then'](function(){if(_0x5167e7){return db['MemberReport'][_0xeeba('0x7c')]({'where':{'membername':_0x5167e7[_0xeeba('0x2e')],'exitAt':null}});}})[_0xeeba('0x22')](function(_0xb28d2){if(_0x5167e7){var _0x46d3f7=[];_0xb28d2[_0xeeba('0xec')](function(_0x1597b3){_0x46d3f7[_0xeeba('0x44')](_0x1597b3[_0xeeba('0x1d')]({'exitAt':moment()[_0xeeba('0xb6')](_0xeeba('0xed'))}));});return Promise['all'](_0x46d3f7);}})[_0xeeba('0x22')](function(){if(_0x5167e7){var _0x453b8f=[];var _0x1be21b=[];var _0x2c27b6=utils[_0xeeba('0xee')]();var _0x4e21f2={'membername':_0x5167e7[_0xeeba('0x2e')],'interface':_0x5a0be8,'enterAt':moment()[_0xeeba('0xb6')](_0xeeba('0xed')),'role':_0x5167e7['role'],'internal':_0x5167e7[_0xeeba('0x55')]};_0x2c27b6[_0xeeba('0xec')](function(_0x14e724){_0x453b8f[_0xeeba('0x44')](_[_0xeeba('0xca')]({'channel':_0x14e724,'type':'LOGIN','data1':_0x387876['body'][_0xeeba('0xef')],'data2':_0x5a0be8},_0x4e21f2));if(_0x5167e7[_0xeeba('0x8d')]){_0x1be21b[_0xeeba('0x44')](_[_0xeeba('0xca')]({'channel':_0x14e724,'type':_0xeeba('0xf0'),'data1':_0xeeba('0xf1')},_0x4e21f2));}});return db[_0xeeba('0xf2')][_0xeeba('0xf3')](_0x453b8f[_0xeeba('0xf4')](_0x1be21b),{'individualHooks':!![]});}})[_0xeeba('0x22')](function(){if(_0x5167e7){return _0x5167e7['update']({'online':!![],'lastLoginAt':moment()[_0xeeba('0xb6')](_0xeeba('0xed')),'voicePause':_0x5167e7[_0xeeba('0x8d')]||![],'mailPause':_0x5167e7['loginInPause']||![],'chatPause':_0x5167e7[_0xeeba('0x8d')]||![],'faxPause':_0x5167e7[_0xeeba('0x8d')]||![],'smsPause':_0x5167e7[_0xeeba('0x8d')]||![],'openchannelPause':_0x5167e7[_0xeeba('0x8d')]||![],'whatsappPause':_0x5167e7[_0xeeba('0x8d')]||![],'pauseType':_0x5167e7[_0xeeba('0x8d')]?_0xeeba('0xf1'):null,'interface':_0x5a0be8,'lastPauseAt':moment()['format'](_0xeeba('0xed'))});}})[_0xeeba('0x22')](function(_0x6dedb3){if(_0x387876[_0xeeba('0xf5')]){return _0x1bb01c();}else{return Promise['resolve'](_0x6dedb3)[_0xeeba('0x22')](respondWithResult(_0x36d85d,null));}})[_0xeeba('0x4f')](handleError(_0x36d85d,null));};exports[_0xeeba('0xf6')]=function(_0x4e7def,_0x4af872){var _0x159b68;return db[_0xeeba('0x30')][_0xeeba('0x2c')]({'where':{'id':_0x4e7def['params']['id'],'role':_0xeeba('0x1f')},'attributes':['id','name',_0xeeba('0x1e')]})[_0xeeba('0x22')](handleEntityNotFound(_0x4af872,null))[_0xeeba('0x22')](function(_0x245877){if(_0x245877){_0x159b68=_0x245877;return db[_0xeeba('0x9d')]['destroy']({'where':{'membername':_0x159b68[_0xeeba('0x2e')]},'individualHooks':!![]});}})[_0xeeba('0x22')](function(){return db[_0xeeba('0xf2')][_0xeeba('0x7c')]({'where':{'membername':_0x159b68[_0xeeba('0x2e')],'exitAt':null}});})[_0xeeba('0x22')](function(_0x4fe870){var _0x2c7ab1=[];_0x4fe870['forEach'](function(_0x5d6da5){_0x2c7ab1[_0xeeba('0x44')](_0x5d6da5[_0xeeba('0x1d')]({'exitAt':moment()[_0xeeba('0xb6')](_0xeeba('0xed'))}));});return Promise['all'](_0x2c7ab1);})[_0xeeba('0x22')](function(){return _0x159b68['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xeeba('0x22')](respondWithResult(_0x4af872,null))[_0xeeba('0x4f')](handleError(_0x4af872,null));};exports[_0xeeba('0xf7')]=function(_0x13066a,_0x312afd){var _0xc1413c;return db[_0xeeba('0x9d')][_0xeeba('0x1d')]({'paused':0x1},{'where':{'UserId':_0x13066a[_0xeeba('0x4a')]['id']},'individualHooks':!![]})[_0xeeba('0x22')](function(){return db[_0xeeba('0x30')][_0xeeba('0x2c')]({'where':{'id':_0x13066a['params']['id'],'role':'agent'},'attributes':['id',_0xeeba('0x2e'),_0xeeba('0x1e'),_0xeeba('0x55'),_0xeeba('0x8f'),_0xeeba('0x9b')]});})['then'](handleEntityNotFound(_0x312afd,null))['then'](function(_0x2e0d9a){if(_0x2e0d9a){_0xc1413c=_0x2e0d9a;return db[_0xeeba('0xf2')][_0xeeba('0x7c')]({'where':{'membername':_0xc1413c[_0xeeba('0x2e')],'type':_0xeeba('0xf0'),'exitAt':null}});}})[_0xeeba('0x22')](function(_0x1983c2){if(_0x1983c2['length']){var _0x61fcbf=moment()[_0xeeba('0xb6')](_0xeeba('0xed'));for(var _0x33821f=0x0,_0x3bc105=_0x1983c2[_0xeeba('0x43')];_0x33821f<_0x3bc105;_0x33821f++){_0x1983c2[_0x33821f]['updateAttributes']({'exitAt':_0x61fcbf});}}})[_0xeeba('0x22')](function(){var _0x10d0f6=[];var _0x25c889=utils[_0xeeba('0xee')]();_0x25c889[_0xeeba('0xec')](function(_0x5e0c35){_0x10d0f6[_0xeeba('0x44')]({'channel':_0x5e0c35,'membername':_0xc1413c[_0xeeba('0x2e')],'interface':_[_0xeeba('0x5a')](_0xc1413c[_0xeeba('0x8f')])?util['format'](_0xeeba('0x9c'),_0xc1413c[_0xeeba('0x2e')]):_0xc1413c['interface'],'type':_0xeeba('0xf0'),'enterAt':moment()[_0xeeba('0xb6')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x13066a['body'][_0xeeba('0x32')]||'DEFAULT\x20PAUSE','role':_0xc1413c[_0xeeba('0x1e')],'internal':_0xc1413c[_0xeeba('0x55')]});});return db[_0xeeba('0xf2')][_0xeeba('0xf3')](_0x10d0f6,{'individualHooks':!![]});})['then'](function(){return _0xc1413c['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x13066a['body']['type']||_0xeeba('0xf8'),'lastPauseAt':moment()[_0xeeba('0xb6')](_0xeeba('0xed'))});})[_0xeeba('0x22')](respondWithResult(_0x312afd,null))[_0xeeba('0x4f')](handleError(_0x312afd,null));};exports[_0xeeba('0xf9')]=function(_0x590774,_0x2ab53d){if(_0x590774[_0xeeba('0x50')][_0xeeba('0x9f')]&&!utils['isValidChannel'](_0x590774['body'][_0xeeba('0x9f')])){throw new APIBadRequestError(util[_0xeeba('0xb6')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x590774[_0xeeba('0x50')][_0xeeba('0x9f')]));}return db['User'][_0xeeba('0x2c')]({'where':{'id':_0x590774[_0xeeba('0x4a')]['id']},'attributes':['id',_0xeeba('0x2e'),_0xeeba('0x1e'),_0xeeba('0x55'),_0xeeba('0x8f'),_0xeeba('0x9b'),'voicePause',_0xeeba('0xfa'),_0xeeba('0xfb'),_0xeeba('0xfc'),_0xeeba('0xfd'),_0xeeba('0xfe'),_0xeeba('0xff'),_0xeeba('0x100'),'lastPauseAt']})[_0xeeba('0x22')](function(_0x440688){if(!_0x440688){throw new APINotFoundError(util[_0xeeba('0xb6')](_0xeeba('0xb7'),_0x590774['params']['id']));}return _0x440688['unpause'](_0x590774[_0xeeba('0x50')][_0xeeba('0x9f')]);})[_0xeeba('0x22')](respondWithResult(_0x2ab53d,null))[_0xeeba('0x4f')](APIHandleError(_0x2ab53d));};exports[_0xeeba('0x101')]=function(_0x4a7d5e,_0xdb8720){var _0x13db64={};var _0x382201={};var _0x1a773d;var _0x435ac5;return db[_0xeeba('0x30')][_0xeeba('0x88')]({'where':{'id':_0x4a7d5e[_0xeeba('0x4a')]['id']}})[_0xeeba('0x22')](handleEntityNotFound(_0xdb8720,null))['then'](function(_0x3a5a9b){if(_0x3a5a9b){_0x1a773d=_0x3a5a9b;_0x382201[_0xeeba('0xc2')]=_[_0xeeba('0xc1')](db[_0xeeba('0x102')][_0xeeba('0xce')]);_0x382201[_0xeeba('0x3a')]=_[_0xeeba('0xc1')](_0x4a7d5e[_0xeeba('0x3a')]);_0x382201['filters']=_[_0xeeba('0xc3')](_0x382201[_0xeeba('0xc2')],_0x382201[_0xeeba('0x3a')]);_0x13db64[_0xeeba('0x40')]=_[_0xeeba('0xc3')](_0x382201[_0xeeba('0xc2')],qs[_0xeeba('0xc4')](_0x4a7d5e[_0xeeba('0x3a')][_0xeeba('0xc4')]));_0x13db64[_0xeeba('0x40')]=_0x13db64[_0xeeba('0x40')][_0xeeba('0x43')]?_0x13db64[_0xeeba('0x40')]:_0x382201['model'];_0x13db64[_0xeeba('0xcf')]=qs[_0xeeba('0xc5')](_0x4a7d5e[_0xeeba('0x3a')][_0xeeba('0xc5')]);_0x13db64['where']=qs[_0xeeba('0xc7')](_['pick'](_0x4a7d5e[_0xeeba('0x3a')],_0x382201[_0xeeba('0xc7')]));if(_0x4a7d5e['query'][_0xeeba('0xc9')]){_0x13db64['where']=_[_0xeeba('0xca')](_0x13db64[_0xeeba('0xc6')],{'$or':_['map'](_0x13db64[_0xeeba('0x40')],function(_0x268dec){var _0x52a093={};_0x52a093[_0x268dec]={'$like':'%'+_0x4a7d5e[_0xeeba('0x3a')]['filter']+'%'};return _0x52a093;})});}_0x13db64=_['merge']({},_0x13db64,_0x4a7d5e[_0xeeba('0x4b')]);return _0x1a773d[_0xeeba('0x101')](_0x13db64);}})['then'](function(_0x14e95f){if(_0x14e95f){_0x435ac5=_0x14e95f[_0xeeba('0x43')];if(!_0x4a7d5e['query'][_0xeeba('0xb9')](_0xeeba('0xcc'))){_0x13db64[_0xeeba('0x1b')]=qs['limit'](_0x4a7d5e[_0xeeba('0x3a')][_0xeeba('0x1b')]);_0x13db64[_0xeeba('0x19')]=qs[_0xeeba('0x19')](_0x4a7d5e[_0xeeba('0x3a')][_0xeeba('0x19')]);}return _0x1a773d[_0xeeba('0x101')](_0x13db64);}})[_0xeeba('0x22')](function(_0x1906bf){if(_0x1906bf){return _0x1906bf?{'count':_0x435ac5,'rows':_0x1906bf}:null;}})['then'](respondWithResult(_0xdb8720,null))['catch'](handleError(_0xdb8720,null));};exports[_0xeeba('0x103')]=function(_0x5e6714,_0xc38326){var _0x43920a=_0x5e6714[_0xeeba('0x4a')]['id'];var _0x459bae=_0x5e6714['body']?_0x5e6714[_0xeeba('0x50')][_0xeeba('0x53')]:null;var _0x38e6af=[];return Promise['resolve']()[_0xeeba('0x22')](function(){if(!_0x459bae)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xeeba('0x22')](function(){return db[_0xeeba('0x30')][_0xeeba('0x88')]({'where':{'id':_0x43920a}});})[_0xeeba('0x22')](function(_0x3e7e5b){if(!_0x3e7e5b)throw new APINotFoundError(util['format'](_0xeeba('0xb7'),_0x5e6714[_0xeeba('0x4a')]['id']));return db['sequelize']['transaction'](function(_0x4f96b0){return _0x3e7e5b['addTeams'](_0x459bae,{'transaction':_0x4f96b0})[_0xeeba('0x22')](function(){return db['Team'][_0xeeba('0x7c')]({'where':{'id':{'$in':_0x459bae}}});})['then'](function(_0x6b26ce){var _0x3d947d=_[_0xeeba('0x29')](_0x6b26ce,function(_0x3a9ff7){return _0x3a9ff7[_0xeeba('0x104')]();});return Promise[_0xeeba('0x4e')](_0x3d947d);})[_0xeeba('0x22')](function(_0x35241a){_0x38e6af=_['flattenDeep'](_0x35241a);var _0x15bdbb=_[_0xeeba('0x29')](_0x38e6af,function(_0x590b69){return _0x590b69[_0xeeba('0x105')](_0x3e7e5b['id'],{'transaction':_0x4f96b0});});return Promise[_0xeeba('0x4e')](_0x15bdbb);})[_0xeeba('0x22')](function(){if(!_0x3e7e5b[_0xeeba('0x9b')])return;var _0x275dab=_[_0xeeba('0xc9')](_0x38e6af,function(_0x4591f5){return _0x4591f5[_0xeeba('0x106')](_0xeeba('0x9f'))===_0xeeba('0x107');});var _0x38c9e1=_[_0xeeba('0x29')](_0x275dab,function(_0x21659f){return db['UserVoiceQueueRt'][_0xeeba('0x108')]({'membername':_0x3e7e5b[_0xeeba('0x2e')],'UserId':_0x3e7e5b['id'],'queue_name':_0x21659f[_0xeeba('0x2e')],'VoiceQueueId':_0x21659f['id'],'interface':_['isNil'](_0x3e7e5b[_0xeeba('0x8f')])?util[_0xeeba('0xb6')](_0xeeba('0x9c'),_0x3e7e5b[_0xeeba('0x2e')]):_0x3e7e5b[_0xeeba('0x8f')],'paused':_0x3e7e5b[_0xeeba('0x8e')]||![],'penalty':_0x3e7e5b[_0xeeba('0x94')]},{'transaction':_0x4f96b0});});return Promise['all'](_0x38c9e1);})[_0xeeba('0x22')](function(){return db[_0xeeba('0x109')]['findAll']({'where':{'teamId':{'$in':_0x459bae}}});})[_0xeeba('0x22')](function(_0x425043){var _0x3e5080=_[_0xeeba('0x29')](_0x425043,function(_0xb57f81){return db[_0xeeba('0x10a')]['create']({'UserId':_0x3e7e5b['id'],'VoicePrefixId':_0xb57f81[_0xeeba('0x10b')]},{'transaction':_0x4f96b0});});return Promise[_0xeeba('0x4e')](_0x3e5080);});});})['then'](function(){for(var _0x50cc12=0x0;_0x50cc12<_0x38e6af['length'];_0x50cc12++){var _0x45045d=_0x38e6af[_0x50cc12][_0xeeba('0x106')](_0xeeba('0x9f'));var _0x57be4a=_0x45045d+_0xeeba('0x97');socket[_0xeeba('0x20')](_0xeeba('0x26')+_0x45045d+_0xeeba('0x98'),{'UserId':_0x43920a,['queueField']:_0x38e6af[_0x50cc12]['id']});}})[_0xeeba('0x22')](respondWithStatusCode(_0xc38326,null))[_0xeeba('0x4f')](APIHandleError(_0xc38326));};exports[_0xeeba('0x10c')]=function(_0x308e40,_0x541e1e){var _0x282874=_0x308e40[_0xeeba('0x4a')]['id'];var _0x4f2339=null;if(_0x308e40[_0xeeba('0x3a')][_0xeeba('0x53')]){_0x4f2339=_['isArray'](_0x308e40[_0xeeba('0x3a')][_0xeeba('0x53')])?_0x308e40['query'][_0xeeba('0x53')]:[_0x308e40[_0xeeba('0x3a')][_0xeeba('0x53')]];}var _0x45a2d7=[];return Promise['resolve']()[_0xeeba('0x22')](function(){if(!_0x4f2339)throw new APIBadRequestError(_0xeeba('0x10d'));})[_0xeeba('0x22')](function(){return db[_0xeeba('0x30')][_0xeeba('0x88')]({'where':{'id':_0x282874}});})[_0xeeba('0x22')](function(_0x32df42){if(!_0x32df42)throw new APINotFoundError(util['format'](_0xeeba('0xb7'),_0x308e40[_0xeeba('0x4a')]['id']));return db[_0xeeba('0x5c')][_0xeeba('0x10e')](function(_0x109514){return _0x32df42['removeTeams'](_0x4f2339,{'transaction':_0x109514})[_0xeeba('0x22')](function(){return db[_0xeeba('0x102')]['findAll']({'where':{'id':{'$in':_0x4f2339}}});})[_0xeeba('0x22')](function(_0x2d85ac){var _0x196584=_['map'](_0x2d85ac,function(_0x578d8b){return _0x578d8b[_0xeeba('0x104')]();});return Promise[_0xeeba('0x4e')](_0x196584);})[_0xeeba('0x22')](function(_0x2ab8b7){_0x45a2d7=_[_0xeeba('0x10f')](_0x2ab8b7);var _0x1d94fc=_[_0xeeba('0x29')](_0x45a2d7,function(_0x3bb941){return _0x3bb941[_0xeeba('0x110')](_0x32df42['id'],{'transaction':_0x109514});});return Promise[_0xeeba('0x4e')](_0x1d94fc);})[_0xeeba('0x22')](function(){if(!_0x32df42['online'])return;var _0x3f88c9=_['filter'](_0x45a2d7,function(_0x144410){return _0x144410[_0xeeba('0x106')]('channel')===_0xeeba('0x107');});var _0x57f3f8=_[_0xeeba('0x29')](_0x3f88c9,function(_0x54b5d0){return db[_0xeeba('0x9d')][_0xeeba('0xe9')]({'where':{'VoiceQueueId':_0x54b5d0['id'],'UserId':_0x32df42['id']},'transaction':_0x109514});});return Promise[_0xeeba('0x4e')](_0x57f3f8);})[_0xeeba('0x22')](function(){return db[_0xeeba('0x109')][_0xeeba('0x7c')]({'where':{'teamId':{'$in':_0x4f2339}}});})[_0xeeba('0x22')](function(_0x6d2451){var _0x560d6d=_[_0xeeba('0x29')](_0x6d2451,function(_0x16920b){return db[_0xeeba('0x10a')][_0xeeba('0xe9')]({'where':{'UserId':_0x32df42['id'],'VoicePrefixId':_0x16920b['VoicePrefixId']}},{'transaction':_0x109514});});return Promise['all'](_0x560d6d);});});})[_0xeeba('0x22')](function(){for(var _0x6d94ea=0x0;_0x6d94ea<_0x45a2d7['length'];_0x6d94ea++){var _0x50cc63=_0x45a2d7[_0x6d94ea]['getDataValue'](_0xeeba('0x9f'));var _0x3108e2=_0x50cc63+_0xeeba('0x97');socket[_0xeeba('0x20')](_0xeeba('0x26')+_0x50cc63+_0xeeba('0xa2'),{'UserId':_0x282874,['queueField']:_0x45a2d7[_0x6d94ea]['id']});}})[_0xeeba('0x22')](respondWithStatusCode(_0x541e1e,null))[_0xeeba('0x4f')](APIHandleError(_0x541e1e));};exports[_0xeeba('0x111')]=function(_0x2bbc5b,_0x125f53){var _0x1ca26d={};var _0x359c48={};var _0x302442;var _0x1ccdf1;return db[_0xeeba('0x30')]['findOne']({'where':{'id':_0x2bbc5b[_0xeeba('0x4a')]['id']}})[_0xeeba('0x22')](handleEntityNotFound(_0x125f53,null))['then'](function(_0xd80a44){if(_0xd80a44){_0x302442=_0xd80a44;_0x359c48[_0xeeba('0xc2')]=_[_0xeeba('0xc1')](db[_0xeeba('0xba')][_0xeeba('0xce')]);_0x359c48[_0xeeba('0x3a')]=_[_0xeeba('0xc1')](_0x2bbc5b[_0xeeba('0x3a')]);_0x359c48[_0xeeba('0xc7')]=_[_0xeeba('0xc3')](_0x359c48[_0xeeba('0xc2')],_0x359c48[_0xeeba('0x3a')]);_0x1ca26d['attributes']=_[_0xeeba('0xc3')](_0x359c48[_0xeeba('0xc2')],qs[_0xeeba('0xc4')](_0x2bbc5b[_0xeeba('0x3a')][_0xeeba('0xc4')]));_0x1ca26d[_0xeeba('0x40')]=_0x1ca26d[_0xeeba('0x40')][_0xeeba('0x43')]?_0x1ca26d[_0xeeba('0x40')]:_0x359c48[_0xeeba('0xc2')];_0x1ca26d[_0xeeba('0xcf')]=qs['sort'](_0x2bbc5b[_0xeeba('0x3a')]['sort']);_0x1ca26d['where']=qs['filters'](_[_0xeeba('0xc8')](_0x2bbc5b[_0xeeba('0x3a')],_0x359c48[_0xeeba('0xc7')]));if(_0x2bbc5b['query']['filter']){_0x1ca26d[_0xeeba('0xc6')]=_[_0xeeba('0xca')](_0x1ca26d[_0xeeba('0xc6')],{'$or':_['map'](_0x1ca26d[_0xeeba('0x40')],function(_0x44cf80){var _0x45613e={};_0x45613e[_0x44cf80]={'$like':'%'+_0x2bbc5b[_0xeeba('0x3a')][_0xeeba('0xc9')]+'%'};return _0x45613e;})});}_0x1ca26d=_['merge']({},_0x1ca26d,_0x2bbc5b[_0xeeba('0x4b')]);return _0x302442[_0xeeba('0x111')](_0x1ca26d);}})[_0xeeba('0x22')](function(_0x2974ce){if(_0x2974ce){_0x1ccdf1=_0x2974ce[_0xeeba('0x43')];if(!_0x2bbc5b[_0xeeba('0x3a')]['hasOwnProperty'](_0xeeba('0xcc'))){_0x1ca26d[_0xeeba('0x1b')]=qs[_0xeeba('0x1b')](_0x2bbc5b[_0xeeba('0x3a')][_0xeeba('0x1b')]);_0x1ca26d['offset']=qs['offset'](_0x2bbc5b['query'][_0xeeba('0x19')]);}return _0x302442[_0xeeba('0x111')](_0x1ca26d);}})[_0xeeba('0x22')](function(_0x53d16a){if(_0x53d16a){return _0x53d16a?{'count':_0x1ccdf1,'rows':_0x53d16a}:null;}})['then'](respondWithResult(_0x125f53,null))[_0xeeba('0x4f')](handleError(_0x125f53,null));};exports[_0xeeba('0x112')]=function(_0x58f7a0,_0x242d4b){var _0x23c755={};var _0x1d2cf6={};var _0x4043d5;return db[_0xeeba('0x30')]['findOne']({'where':{'id':_0x58f7a0[_0xeeba('0x4a')]['id']}})['then'](handleEntityNotFound(_0x242d4b,null))['then'](function(_0x11eede){if(_0x11eede){_0x4043d5=_0x11eede;_0x1d2cf6[_0xeeba('0xc2')]=_['keys'](db[_0xeeba('0x30')]['rawAttributes']);_0x1d2cf6[_0xeeba('0x3a')]=_[_0xeeba('0xc1')](_0x58f7a0['query']);_0x1d2cf6[_0xeeba('0xc7')]=_['intersection'](_0x1d2cf6[_0xeeba('0xc2')],_0x1d2cf6[_0xeeba('0x3a')]);_0x23c755[_0xeeba('0x40')]=_[_0xeeba('0xc3')](_0x1d2cf6['model'],qs[_0xeeba('0xc4')](_0x58f7a0[_0xeeba('0x3a')]['fields']));_0x23c755[_0xeeba('0x40')]=_0x23c755[_0xeeba('0x40')][_0xeeba('0x43')]?_0x23c755[_0xeeba('0x40')]:_0x1d2cf6[_0xeeba('0xc2')];_0x23c755[_0xeeba('0xcf')]=qs[_0xeeba('0xc5')](_0x58f7a0[_0xeeba('0x3a')][_0xeeba('0xc5')]);_0x23c755[_0xeeba('0xc6')]=qs[_0xeeba('0xc7')](_[_0xeeba('0xc8')](_0x58f7a0[_0xeeba('0x3a')],_0x1d2cf6['filters']));if(_0x58f7a0[_0xeeba('0x3a')][_0xeeba('0xc9')]){_0x23c755[_0xeeba('0xc6')]=_['merge'](_0x23c755[_0xeeba('0xc6')],{'$or':_[_0xeeba('0x29')](_0x23c755[_0xeeba('0x40')],function(_0x4d06ba){var _0x5851c1={};_0x5851c1[_0x4d06ba]={'$like':'%'+_0x58f7a0[_0xeeba('0x3a')][_0xeeba('0xc9')]+'%'};return _0x5851c1;})});}_0x23c755[_0xeeba('0xc2')]=db[_0xeeba('0x30')];_0x23c755['as']='Agents';_0x23c755=_[_0xeeba('0xca')]({},_0x23c755,_0x58f7a0['options']);return _0x4043d5['getVoiceQueues']({'include':[_0x23c755]});}})[_0xeeba('0x22')](function(_0x3dff68){if(_0x3dff68){var _0x48bc72={},_0x176491=[];for(var _0x3ddad1=0x0;_0x3ddad1<_0x3dff68['length'];_0x3ddad1+=0x1){for(var _0x5ac566=0x0,_0x42208f;_0x5ac566<_0x3dff68[_0x3ddad1][_0xeeba('0x77')][_0xeeba('0x43')];_0x5ac566+=0x1){_0x42208f=_0x3dff68[_0x3ddad1][_0xeeba('0x77')][_0x5ac566][_0xeeba('0x23')]({'plain':!![]});_0x48bc72[_0x42208f['id']]=_0x42208f;}}_0x48bc72=_[_0xeeba('0x113')](_0x48bc72);for(var _0x3c7d3e=qs['offset'](_0x58f7a0[_0xeeba('0x3a')][_0xeeba('0x19')]);_0x3c7d3e<_0x48bc72['length']&&_0x176491[_0xeeba('0x43')]=_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 +var _0xa19c=['destroy','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','length','upsert','UserVoiceQueue.penalty','all','merge','LOGIN','callysquare','LOGININPAUSE','bulkCreate','concat','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','GetUser','findAll','options','raw','where','limit','include','map','model','attributes','then','info','stringify','catch','error','ShowUser','User','find','message','PauseUser','name','role','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','MemberReport','PAUSE','getChannels','forEach','push','isNil','body','type','DEFAULT\x20PAUSE','update','YYYY-MM-DD\x20HH:mm:ss','resolve','channel','Channel\x20parameter\x20%s\x20is\x20invalid','online','mailPause','chatPause','faxPause','whatsappPause','pauseType','unpause','system','LogoutUser','findOne'];(function(_0x3a351d,_0x5bb577){var _0x370d12=function(_0x45d07a){while(--_0x45d07a){_0x3a351d['push'](_0x3a351d['shift']());}};_0x370d12(++_0x5bb577);}(_0xa19c,0x11b));var _0xca19=function(_0xc28939,_0x49f964){_0xc28939=_0xc28939-0x0;var _0xcb96d2=_0xa19c[_0xc28939];return _0xcb96d2;};'use strict';var _=require(_0xca19('0x0'));var util=require(_0xca19('0x1'));var moment=require(_0xca19('0x2'));var BPromise=require('bluebird');var Redis=require(_0xca19('0x3'));var db=require(_0xca19('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xca19('0x5'))(_0xca19('0x6'));var config=require(_0xca19('0x7'));config[_0xca19('0x8')]=_[_0xca19('0x9')](config['redis'],{'host':_0xca19('0xa'),'port':0x18eb});var socket=require(_0xca19('0xb'))(new Redis(config[_0xca19('0x8')]));require('./user.socket')[_0xca19('0xc')](socket);exports[_0xca19('0xd')]=function(_0x2db2bc){var _0x22f3fe=this;return new Promise(function(_0x397612,_0x3aa801){return db['User'][_0xca19('0xe')]({'raw':_0x2db2bc['options']?_0x2db2bc[_0xca19('0xf')][_0xca19('0x10')]===undefined?!![]:![]:!![],'where':_0x2db2bc[_0xca19('0xf')]?_0x2db2bc['options'][_0xca19('0x11')]||null:null,'attributes':_0x2db2bc['options']?_0x2db2bc[_0xca19('0xf')]['attributes']||null:null,'limit':_0x2db2bc[_0xca19('0xf')]?_0x2db2bc[_0xca19('0xf')][_0xca19('0x12')]||null:null,'include':_0x2db2bc[_0xca19('0xf')]?_0x2db2bc[_0xca19('0xf')][_0xca19('0x13')]?_[_0xca19('0x14')](_0x2db2bc['options'][_0xca19('0x13')],function(_0x27fc41){return{'model':db[_0x27fc41[_0xca19('0x15')]],'as':_0x27fc41['as'],'attributes':_0x27fc41['attributes'],'include':_0x27fc41[_0xca19('0x13')]?_[_0xca19('0x14')](_0x27fc41[_0xca19('0x13')],function(_0x1c277b){return{'model':db[_0x1c277b[_0xca19('0x15')]],'as':_0x1c277b['as'],'attributes':_0x1c277b[_0xca19('0x16')],'include':_0x1c277b[_0xca19('0x13')]?_[_0xca19('0x14')](_0x1c277b[_0xca19('0x13')],function(_0x2c8bcc){return{'model':db[_0x2c8bcc[_0xca19('0x15')]],'as':_0x2c8bcc['as'],'attributes':_0x2c8bcc[_0xca19('0x16')]};}):[]};}):[]};}):[]:[]})[_0xca19('0x17')](function(_0x554b41){logger[_0xca19('0x18')](_0xca19('0xd'),_0x2db2bc);logger['debug'](_0xca19('0xd'),_0x2db2bc,JSON[_0xca19('0x19')](_0x554b41));_0x397612(_0x554b41);})[_0xca19('0x1a')](function(_0x2f57bf){logger[_0xca19('0x1b')](_0xca19('0xd'),_0x2f57bf['message'],_0x2db2bc);_0x3aa801(_0x22f3fe[_0xca19('0x1b')](0x1f4,_0x2f57bf['message']));});});};exports[_0xca19('0x1c')]=function(_0x2ad662){var _0x18ed8d=this;return new Promise(function(_0x4a3733,_0x34e2e0){return db[_0xca19('0x1d')][_0xca19('0x1e')]({'raw':_0x2ad662[_0xca19('0xf')]?_0x2ad662[_0xca19('0xf')][_0xca19('0x10')]===undefined?!![]:![]:!![],'where':_0x2ad662[_0xca19('0xf')]?_0x2ad662[_0xca19('0xf')][_0xca19('0x11')]||null:null,'attributes':_0x2ad662[_0xca19('0xf')]?_0x2ad662[_0xca19('0xf')]['attributes']||null:null,'include':_0x2ad662['options']?_0x2ad662[_0xca19('0xf')][_0xca19('0x13')]?_[_0xca19('0x14')](_0x2ad662[_0xca19('0xf')][_0xca19('0x13')],function(_0x405690){return{'model':db[_0x405690[_0xca19('0x15')]],'as':_0x405690['as'],'attributes':_0x405690[_0xca19('0x16')],'include':_0x405690['include']?_[_0xca19('0x14')](_0x405690['include'],function(_0x27c834){return{'model':db[_0x27c834[_0xca19('0x15')]],'as':_0x27c834['as'],'attributes':_0x27c834[_0xca19('0x16')],'include':_0x27c834[_0xca19('0x13')]?_[_0xca19('0x14')](_0x27c834[_0xca19('0x13')],function(_0xb25fde){return{'model':db[_0xb25fde['model']],'as':_0xb25fde['as'],'attributes':_0xb25fde[_0xca19('0x16')]};}):[]};}):[]};}):[]:[]})[_0xca19('0x17')](function(_0x46a288){logger[_0xca19('0x18')](_0xca19('0x1c'),_0x2ad662);logger['debug'](_0xca19('0x1c'),_0x2ad662,JSON[_0xca19('0x19')](_0x46a288));_0x4a3733(_0x46a288);})[_0xca19('0x1a')](function(_0x60839f){logger[_0xca19('0x1b')](_0xca19('0x1c'),_0x60839f[_0xca19('0x1f')],_0x2ad662);_0x34e2e0(_0x18ed8d[_0xca19('0x1b')](0x1f4,_0x60839f[_0xca19('0x1f')]));});});};exports[_0xca19('0x20')]=function(_0x3a8831){var _0x29feec;return db[_0xca19('0x1d')]['find']({'where':_0x3a8831[_0xca19('0xf')]['where']||{},'attributes':['id',_0xca19('0x21'),_0xca19('0x22'),_0xca19('0x23'),_0xca19('0x24')]})['then'](function(_0x2716ed){if(!_0x2716ed){throw new Error(util[_0xca19('0x25')](_0xca19('0x26'),_0x3a8831[_0xca19('0x27')]['id']));}_0x29feec=_0x2716ed;return db[_0xca19('0x28')]['update']({'paused':0x1},{'where':{'UserId':_0x29feec['id']},'individualHooks':!![]});})[_0xca19('0x17')](function(){return db[_0xca19('0x29')][_0xca19('0xe')]({'where':{'membername':_0x29feec[_0xca19('0x21')],'type':_0xca19('0x2a'),'exitAt':null}});})[_0xca19('0x17')](function(_0x4d65e9){if(_0x4d65e9&&_0x4d65e9['length']){var _0x37811d=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x684828=0x0,_0xe7dd9b=_0x4d65e9['length'];_0x684828<_0xe7dd9b;_0x684828++){_0x4d65e9[_0x684828]['updateAttributes']({'exitAt':_0x37811d});}}})[_0xca19('0x17')](function(){var _0x4536ce=[];var _0x1be812=utils[_0xca19('0x2b')]();_0x1be812[_0xca19('0x2c')](function(_0x21f7e8){_0x4536ce[_0xca19('0x2d')]({'channel':_0x21f7e8,'membername':_0x29feec[_0xca19('0x21')],'interface':_[_0xca19('0x2e')](_0x29feec[_0xca19('0x24')])?util[_0xca19('0x25')]('SIP/%s',_0x29feec[_0xca19('0x21')]):_0x29feec[_0xca19('0x24')],'type':_0xca19('0x2a'),'enterAt':moment()[_0xca19('0x25')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x3a8831[_0xca19('0x2f')][_0xca19('0x30')]||_0xca19('0x31'),'role':_0x29feec['role'],'internal':_0x29feec[_0xca19('0x23')],'uniqueid':_0x3a8831[_0xca19('0x2f')]['uniqueid']||null});});return db[_0xca19('0x29')]['bulkCreate'](_0x4536ce,{'individualHooks':!![]});})[_0xca19('0x17')](function(){return _0x29feec[_0xca19('0x32')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x3a8831[_0xca19('0x2f')][_0xca19('0x30')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xca19('0x25')](_0xca19('0x33'))});})[_0xca19('0x1a')](function(_0xa071de){throw _0xa071de;});};exports['UnpauseUser']=function(_0x5ef243){return Promise[_0xca19('0x34')]()[_0xca19('0x17')](function(){if(_0x5ef243[_0xca19('0x2f')][_0xca19('0x35')]&&!utils['isValidChannel'](_0x5ef243['body'][_0xca19('0x35')])){throw new Error(util[_0xca19('0x25')](_0xca19('0x36'),_0x5ef243[_0xca19('0x2f')]['channel']));}return db[_0xca19('0x1d')]['findOne']({'where':_0x5ef243[_0xca19('0xf')]['where']||{},'attributes':['id',_0xca19('0x21'),_0xca19('0x22'),'internal','interface',_0xca19('0x37'),'voicePause',_0xca19('0x38'),_0xca19('0x39'),_0xca19('0x3a'),'openchannelPause','smsPause',_0xca19('0x3b'),_0xca19('0x3c'),'lastPauseAt']});})[_0xca19('0x17')](function(_0x2db56f){if(!_0x2db56f){throw new Error(util[_0xca19('0x25')](_0xca19('0x26'),_0x5ef243[_0xca19('0x27')]['id']));}return _0x2db56f[_0xca19('0x3d')](_0x5ef243['body']['channel'],_0xca19('0x3e'));})[_0xca19('0x1a')](function(_0x1fa270){throw _0x1fa270;});};exports[_0xca19('0x3f')]=function(_0x39dcdb){var _0x167490=this;return new Promise(function(_0x1c1201,_0xc9ba6f){var _0x4281c3;return db[_0xca19('0x1d')][_0xca19('0x40')]({'where':_0x39dcdb['options'][_0xca19('0x11')]||{},'attributes':['id',_0xca19('0x21')]})[_0xca19('0x17')](function(_0x1cd3e2){if(_0x1cd3e2){_0x4281c3=_0x1cd3e2;return db['UserVoiceQueueRt'][_0xca19('0x41')]({'where':{'membername':_0x4281c3[_0xca19('0x21')]},'individualHooks':!![]});}})[_0xca19('0x17')](function(){if(_0x4281c3){return db[_0xca19('0x29')]['findAll']({'where':{'membername':_0x4281c3[_0xca19('0x21')],'exitAt':null}});}})[_0xca19('0x17')](function(_0x24d8f2){if(_0x4281c3){if(_0x24d8f2&&_0x24d8f2['length']){var _0x498e30=[];_0x24d8f2[_0xca19('0x2c')](function(_0x3dc07f){_0x498e30['push'](_0x3dc07f[_0xca19('0x32')]({'exitAt':moment()[_0xca19('0x25')](_0xca19('0x33'))}));});return BPromise['all'](_0x498e30);}}})[_0xca19('0x17')](function(){if(_0x4281c3){return _0x4281c3['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xca19('0x17')](function(_0x140ef3){_0x1c1201(_0x140ef3);})['catch'](function(_0x447346){_0xc9ba6f(_0x167490[_0xca19('0x1b')](0x1f4,_0x447346[_0xca19('0x1f')]));});});};exports[_0xca19('0x42')]=function(_0x52154b){var _0x356475=this;return new Promise(function(_0x534359,_0x4b7c0e){var _0x5cb76b;var _0x69c214;var _0x5c9a35;var _0xe93edc;return db['User'][_0xca19('0x40')]({'where':_0x52154b[_0xca19('0xf')][_0xca19('0x11')]||{},'attributes':['id',_0xca19('0x21'),_0xca19('0x22'),_0xca19('0x43'),_0xca19('0x44'),_0xca19('0x23'),_0xca19('0x45'),_0xca19('0x24')]})[_0xca19('0x17')](function(_0x3d45b8){if(_0x3d45b8){_0x5cb76b=_0x3d45b8;_0xe93edc=_0x52154b[_0xca19('0x2f')]['interface']?_0x52154b[_0xca19('0x2f')]['interface']:util['format']('SIP/%s',_0x5cb76b[_0xca19('0x21')]);return db[_0xca19('0x1d')][_0xca19('0x46')]({'where':{'role':_0xca19('0x47'),'online':!![],'id':{'$ne':_0x5cb76b['id']}}});}})[_0xca19('0x17')](function(_0x50bf45){if(_0x50bf45){_0x5c9a35=_0x50bf45;return require(_0xca19('0x48'))[_0xca19('0x49')]();}})[_0xca19('0x17')](function(_0x466d37){if(_0x466d37&&_0x466d37[_0xca19('0x4a')]&&_0x5c9a35>=_0x466d37['agents']){throw new Error(_0xca19('0x4b'));}})[_0xca19('0x17')](function(){if(_0x5cb76b){return db[_0xca19('0x28')]['destroy']({'where':{'membername':_0x5cb76b[_0xca19('0x21')]},'individualHooks':!![]});}})['then'](function(){if(_0x5cb76b){return _0x5cb76b[_0xca19('0x4c')]({'raw':!![]});}})[_0xca19('0x17')](function(_0x435b38){if(_0x5cb76b){if(_0x435b38){var _0x37904b=[];_0x69c214=_0x435b38;if(_0x69c214[_0xca19('0x4d')]){for(var _0x593585=0x0;_0x593585<_0x69c214['length'];_0x593585++){_0x37904b[_0xca19('0x2d')](db['UserVoiceQueueRt'][_0xca19('0x4e')]({'membername':_0x5cb76b[_0xca19('0x21')],'UserId':_0x5cb76b['id'],'queue_name':_0x69c214[_0x593585][_0xca19('0x21')],'VoiceQueueId':_0x69c214[_0x593585]['id'],'interface':_0xe93edc,'paused':_0x5cb76b[_0xca19('0x45')]||![],'penalty':_0x69c214[_0x593585][_0xca19('0x4f')]||0x0}));}return BPromise[_0xca19('0x50')](_0x37904b);}}}})[_0xca19('0x17')](function(){if(_0x5cb76b){return db[_0xca19('0x29')][_0xca19('0xe')]({'where':{'membername':_0x5cb76b[_0xca19('0x21')],'exitAt':null}});}})['then'](function(_0x1b7560){if(_0x5cb76b){if(_0x1b7560&&_0x1b7560[_0xca19('0x4d')]){var _0x53683b=[];_0x1b7560['forEach'](function(_0xcbcc67){_0x53683b[_0xca19('0x2d')](_0xcbcc67[_0xca19('0x32')]({'exitAt':moment()[_0xca19('0x25')](_0xca19('0x33'))}));});return BPromise[_0xca19('0x50')](_0x53683b);}}})[_0xca19('0x17')](function(){if(_0x5cb76b){var _0x5b81d3=[];var _0x25a6d6=[];var _0x5a14ab=utils[_0xca19('0x2b')]();var _0x264929={'membername':_0x5cb76b['name'],'interface':_0xe93edc,'enterAt':moment()[_0xca19('0x25')](_0xca19('0x33')),'role':_0x5cb76b[_0xca19('0x22')],'internal':_0x5cb76b[_0xca19('0x23')]};_0x5a14ab[_0xca19('0x2c')](function(_0xc513fd){_0x5b81d3[_0xca19('0x2d')](_[_0xca19('0x51')]({'channel':_0xc513fd,'type':_0xca19('0x52'),'data1':_0xca19('0x53'),'data2':_0xe93edc},_0x264929));if(_0x5cb76b['loginInPause']){_0x25a6d6[_0xca19('0x2d')](_[_0xca19('0x51')]({'channel':_0xc513fd,'type':_0xca19('0x2a'),'data1':_0xca19('0x54')},_0x264929));}});return db['MemberReport'][_0xca19('0x55')](_0x5b81d3[_0xca19('0x56')](_0x25a6d6),{'individualHooks':!![]});}})[_0xca19('0x17')](function(){if(_0x5cb76b){return _0x5cb76b[_0xca19('0x32')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x5cb76b[_0xca19('0x45')]||![],'mailPause':_0x5cb76b[_0xca19('0x45')]||![],'chatPause':_0x5cb76b[_0xca19('0x45')]||![],'faxPause':_0x5cb76b['loginInPause']||![],'smsPause':_0x5cb76b['loginInPause']||![],'openchannelPause':_0x5cb76b[_0xca19('0x45')]||![],'pauseType':_0x5cb76b[_0xca19('0x45')]?_0xca19('0x54'):null,'lastPauseAt':moment()['format'](_0xca19('0x33')),'interface':_0xe93edc});}})[_0xca19('0x17')](function(_0x51e071){_0x534359(_0x51e071);})['catch'](function(_0x476932){_0x4b7c0e(_0x356475['error'](0x1f4,_0x476932[_0xca19('0x1f')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 4269e70..3b18f16 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 _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 +var _0x8920=['emit','removeListener','register','length','user:','./user.events','remove'];(function(_0x495e9f,_0x1b1d80){var _0xb249d2=function(_0x3db4e4){while(--_0x3db4e4){_0x495e9f['push'](_0x495e9f['shift']());}};_0xb249d2(++_0x1b1d80);}(_0x8920,0x1e8));var _0x0892=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x8920[_0x5b644e];return _0x49c6bf;};'use strict';var UserEvents=require(_0x0892('0x0'));var events=['save',_0x0892('0x1'),'update'];function createListener(_0x1f7d12,_0x1b9026){return function(_0x3d7256){_0x1b9026[_0x0892('0x2')](_0x1f7d12,_0x3d7256);};}function removeListener(_0x2d3ae2,_0x4f4b11){return function(){UserEvents[_0x0892('0x3')](_0x2d3ae2,_0x4f4b11);};}exports[_0x0892('0x4')]=function(_0x5aa12e){for(var _0x4ce214=0x0,_0x13b6aa=events[_0x0892('0x5')];_0x4ce214<_0x13b6aa;_0x4ce214++){var _0x38628f=events[_0x4ce214];var _0x5ddfc1=createListener(_0x0892('0x6')+_0x38628f,_0x5aa12e);UserEvents['on'](_0x38628f,_0x5ddfc1);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index a3bc5d8..6c91e7c 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 _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 +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1e52bf,_0x4cfa32){var _0x2fdc63=function(_0x243d06){while(--_0x243d06){_0x1e52bf['push'](_0x1e52bf['shift']());}};_0x2fdc63(++_0x4cfa32);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 8ddff41..9006424 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 _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 +'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index e6d9c91..01da586 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 _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 +var _0x2bc1=['api','moment','bluebird','request-promise','path','rimraf','exports','UserChatQueue','user_has_chat_queues','lodash'];(function(_0x47598a,_0x11b181){var _0xbe321c=function(_0x5e9c32){while(--_0x5e9c32){_0x47598a['push'](_0x47598a['shift']());}};_0xbe321c(++_0x11b181);}(_0x2bc1,0xd1));var _0x12bc=function(_0x43e0c6,_0x4a7e28){_0x43e0c6=_0x43e0c6-0x0;var _0x2f98da=_0x2bc1[_0x43e0c6];return _0x2f98da;};'use strict';var _=require(_0x12bc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x12bc('0x1'));var moment=require(_0x12bc('0x2'));var BPromise=require(_0x12bc('0x3'));var rp=require(_0x12bc('0x4'));var fs=require('fs');var path=require(_0x12bc('0x5'));var rimraf=require(_0x12bc('0x6'));var config=require('../../config/environment');var attributes=require('./userChatQueue.attributes');module[_0x12bc('0x7')]=function(_0x3b649d,_0x4b3ed5){return _0x3b649d['define'](_0x12bc('0x8'),attributes,{'tableName':_0x12bc('0x9'),'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 7e6ae7e..da5c3cd 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 _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 +var _0x03f0=['../../config/environment','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1499c4,_0x57c5c3){var _0x3cf45a=function(_0x4bb7cb){while(--_0x4bb7cb){_0x1499c4['push'](_0x1499c4['shift']());}};_0x3cf45a(++_0x57c5c3);}(_0x03f0,0xa9));var _0x003f=function(_0x2df752,_0x6a411c){_0x2df752=_0x2df752-0x0;var _0x1ed254=_0x03f0[_0x2df752];return _0x1ed254;};'use strict';var _=require(_0x003f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x003f('0x1'));var fs=require('fs');var Redis=require(_0x003f('0x2'));var db=require(_0x003f('0x3'))['db'];var utils=require(_0x003f('0x4'));var logger=require(_0x003f('0x5'))(_0x003f('0x6'));var config=require(_0x003f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x003f('0x8')][_0x003f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x12989c,_0x1f5d12,_0xaf179a){return new BPromise(function(_0x3e58f3,_0x407dba){return client[_0x003f('0xa')](_0x12989c,_0xaf179a)[_0x003f('0xb')](function(_0x39769a){logger[_0x003f('0xc')](_0x003f('0xd'),_0x1f5d12,_0x003f('0xe'));logger[_0x003f('0xf')](_0x003f('0x10'),_0x1f5d12,_0x003f('0xe'),JSON[_0x003f('0x11')](_0x39769a));if(_0x39769a[_0x003f('0x12')]){if(_0x39769a[_0x003f('0x12')]['code']===0x1f4){logger[_0x003f('0x12')](_0x003f('0xd'),_0x1f5d12,_0x39769a['error'][_0x003f('0x13')]);return _0x407dba(_0x39769a[_0x003f('0x12')]['message']);}logger[_0x003f('0x12')](_0x003f('0xd'),_0x1f5d12,_0x39769a[_0x003f('0x12')][_0x003f('0x13')]);return _0x3e58f3(_0x39769a[_0x003f('0x12')][_0x003f('0x13')]);}else{logger[_0x003f('0xc')](_0x003f('0xd'),_0x1f5d12,_0x003f('0xe'));_0x3e58f3(_0x39769a[_0x003f('0x14')]['message']);}})[_0x003f('0x15')](function(_0x3cbc7a){logger[_0x003f('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x1f5d12,_0x3cbc7a);_0x407dba(_0x3cbc7a);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 1857bed..80fbdac 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_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 +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5b9759,_0x1b4663){var _0x586588=function(_0x28b4cb){while(--_0x28b4cb){_0x5b9759['push'](_0x5b9759['shift']());}};_0x586588(++_0x1b4663);}(_0xe706,0xa3));var _0x6e70=function(_0x1b0597,_0xeffacc){_0x1b0597=_0x1b0597-0x0;var _0x2b6a2a=_0xe706[_0x1b0597];return _0x2b6a2a;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index c6956c9..c4586c7 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 _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 +var _0x5d85=['sequelize','exports','STRING'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x5d85,0xf9));var _0x55d8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5d85[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x55d8('0x0'));module[_0x55d8('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x55d8('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 62d59ab..bf94ca2 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 _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 +var _0x25d1=['./userFaxQueue.attributes','define','user_has_fax_queues','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x67cade,_0x37f580){var _0x5f4f0d=function(_0x537036){while(--_0x537036){_0x67cade['push'](_0x67cade['shift']());}};_0x5f4f0d(++_0x37f580);}(_0x25d1,0x157));var _0x125d=function(_0x3a902a,_0xca8442){_0x3a902a=_0x3a902a-0x0;var _0x24f2d5=_0x25d1[_0x3a902a];return _0x24f2d5;};'use strict';var _=require('lodash');var util=require(_0x125d('0x0'));var logger=require(_0x125d('0x1'))(_0x125d('0x2'));var moment=require(_0x125d('0x3'));var BPromise=require('bluebird');var rp=require(_0x125d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x125d('0x5'));var config=require(_0x125d('0x6'));var attributes=require(_0x125d('0x7'));module['exports']=function(_0x195b67,_0x4ea44c){return _0x195b67[_0x125d('0x8')]('UserFaxQueue',attributes,{'tableName':_0x125d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 8f736a7..4f92c86 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 _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 +var _0x65b6=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','randomstring','../../mysqldb','../../config/utils'];(function(_0x2f67ea,_0x5962d9){var _0x108f66=function(_0x11501a){while(--_0x11501a){_0x2f67ea['push'](_0x2f67ea['shift']());}};_0x108f66(++_0x5962d9);}(_0x65b6,0x9c));var _0x665b=function(_0x8a84e7,_0x5296e0){_0x8a84e7=_0x8a84e7-0x0;var _0x2e4353=_0x65b6[_0x8a84e7];return _0x2e4353;};'use strict';var _=require('lodash');var util=require(_0x665b('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x665b('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x665b('0x2'))['db'];var utils=require(_0x665b('0x3'));var logger=require('../../config/logger')(_0x665b('0x4'));var config=require(_0x665b('0x5'));var jayson=require(_0x665b('0x6'));var client=jayson[_0x665b('0x7')][_0x665b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x493451,_0x13ca90,_0x318974){return new BPromise(function(_0x1befb2,_0x17f893){return client[_0x665b('0x9')](_0x493451,_0x318974)[_0x665b('0xa')](function(_0x3ef3e6){logger[_0x665b('0xb')](_0x665b('0xc'),_0x13ca90,_0x665b('0xd'));logger[_0x665b('0xe')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x13ca90,_0x665b('0xd'),JSON['stringify'](_0x3ef3e6));if(_0x3ef3e6[_0x665b('0xf')]){if(_0x3ef3e6[_0x665b('0xf')][_0x665b('0x10')]===0x1f4){logger[_0x665b('0xf')](_0x665b('0xc'),_0x13ca90,_0x3ef3e6[_0x665b('0xf')][_0x665b('0x11')]);return _0x17f893(_0x3ef3e6[_0x665b('0xf')][_0x665b('0x11')]);}logger[_0x665b('0xf')](_0x665b('0xc'),_0x13ca90,_0x3ef3e6[_0x665b('0xf')][_0x665b('0x11')]);return _0x1befb2(_0x3ef3e6[_0x665b('0xf')][_0x665b('0x11')]);}else{logger[_0x665b('0xb')](_0x665b('0xc'),_0x13ca90,_0x665b('0xd'));_0x1befb2(_0x3ef3e6[_0x665b('0x12')][_0x665b('0x11')]);}})[_0x665b('0x13')](function(_0xb94fb0){logger[_0x665b('0xf')](_0x665b('0xc'),_0x13ca90,_0xb94fb0);_0x17f893(_0xb94fb0);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index b438a38..60c4de8 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_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 +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xbf8f73,_0x2ca243){var _0x53d9a9=function(_0x7c851d){while(--_0x7c851d){_0xbf8f73['push'](_0xbf8f73['shift']());}};_0x53d9a9(++_0x2ca243);}(_0x9c44,0x178));var _0x49c4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9c44[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 14268de..f86e5cf 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 _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 +var _0x599e=['sequelize'];(function(_0x2e04bf,_0xa06a0e){var _0x3281af=function(_0x489bb0){while(--_0x489bb0){_0x2e04bf['push'](_0x2e04bf['shift']());}};_0x3281af(++_0xa06a0e);}(_0x599e,0x1a9));var _0xe599=function(_0x527191,_0x51329d){_0x527191=_0x527191-0x0;var _0x57f753=_0x599e[_0x527191];return _0x57f753;};'use strict';var Sequelize=require(_0xe599('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index b1f8733..87a9fa1 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 _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 +var _0xe008=['bluebird','request-promise','./userMailQueue.attributes','exports','user_has_mail_queues','lodash','../../config/logger','api','moment'];(function(_0x3a166a,_0x2018be){var _0x1b0279=function(_0x5b98dd){while(--_0x5b98dd){_0x3a166a['push'](_0x3a166a['shift']());}};_0x1b0279(++_0x2018be);}(_0xe008,0xdd));var _0x8e00=function(_0x5d695b,_0x3f9907){_0x5d695b=_0x5d695b-0x0;var _0x2fdda7=_0xe008[_0x5d695b];return _0x2fdda7;};'use strict';var _=require(_0x8e00('0x0'));var util=require('util');var logger=require(_0x8e00('0x1'))(_0x8e00('0x2'));var moment=require(_0x8e00('0x3'));var BPromise=require(_0x8e00('0x4'));var rp=require(_0x8e00('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8e00('0x6'));module[_0x8e00('0x7')]=function(_0x39b658,_0x38ed02){return _0x39b658['define']('UserMailQueue',attributes,{'tableName':_0x8e00('0x8'),'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 e096e47..e77fa26 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 _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 +var _0xa41a=['rpc','../../config/environment','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2cd777,_0x35d9da){var _0x44e91b=function(_0x1a4f4d){while(--_0x1a4f4d){_0x2cd777['push'](_0x2cd777['shift']());}};_0x44e91b(++_0x35d9da);}(_0xa41a,0x6b));var _0xaa41=function(_0x1ef618,_0x2194a0){_0x1ef618=_0x1ef618-0x0;var _0x24f8ab=_0xa41a[_0x1ef618];return _0x24f8ab;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 4deeeab..f5e2164 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 _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 +var _0x8c22=['exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification'];(function(_0x190343,_0x42789b){var _0x53556a=function(_0x159fa2){while(--_0x159fa2){_0x190343['push'](_0x190343['shift']());}};_0x53556a(++_0x42789b);}(_0x8c22,0xc4));var _0x28c2=function(_0x4ddfe1,_0x35939d){_0x4ddfe1=_0x4ddfe1-0x0;var _0x4aaf51=_0x8c22[_0x4ddfe1];return _0x4aaf51;};'use strict';var multer=require(_0x28c2('0x0'));var util=require(_0x28c2('0x1'));var path=require(_0x28c2('0x2'));var timeout=require('connect-timeout');var express=require(_0x28c2('0x3'));var router=express['Router']();var fs_extra=require(_0x28c2('0x4'));var auth=require(_0x28c2('0x5'));var interaction=require(_0x28c2('0x6'));var config=require(_0x28c2('0x7'));var controller=require(_0x28c2('0x8'));router[_0x28c2('0x9')]('/',auth[_0x28c2('0xa')](),controller[_0x28c2('0xb')]);module[_0x28c2('0xc')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 3030bd3..7cb2ffb 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 _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 +var _0xc3b7=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0xc3b7,0x193));var _0x7c3b=function(_0x5d7bb7,_0xfa7e5e){_0x5d7bb7=_0x5d7bb7-0x0;var _0x38f4ea=_0xc3b7[_0x5d7bb7];return _0x38f4ea;};'use strict';var Sequelize=require(_0x7c3b('0x0'));module[_0x7c3b('0x1')]={'body':{'type':Sequelize[_0x7c3b('0x2')]},'senderName':{'type':Sequelize[_0x7c3b('0x3')]},'recipientsId':{'type':Sequelize[_0x7c3b('0x2')]},'recipientsDescription':{'type':Sequelize[_0x7c3b('0x3')]},'beep':{'type':Sequelize[_0x7c3b('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 338eebf..65a7b38 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 _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 +var _0xe06b=['some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','recipientsId','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','catch','text','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','startCase','model','queue','Queue','ids','push','all','flatten','map','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','json','undefined','offset','count','apply','reject','save','update','then','end','error','stack','name','send','sendUserNotification','body','hasOwnProperty','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Sequelize','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','voicequeue','team','user'];(function(_0x5b192c,_0x56bb3f){var _0x41c977=function(_0x3d7441){while(--_0x3d7441){_0x5b192c['push'](_0x5b192c['shift']());}};_0x41c977(++_0x56bb3f);}(_0xe06b,0x13e));var _0xbe06=function(_0x16d013,_0x3e8f09){_0x16d013=_0x16d013-0x0;var _0x9b3d93=_0xe06b[_0x16d013];return _0x9b3d93;};'use strict';var emlformat=require(_0xbe06('0x0'));var rimraf=require(_0xbe06('0x1'));var zipdir=require(_0xbe06('0x2'));var jsonpatch=require(_0xbe06('0x3'));var rp=require('request-promise');var moment=require(_0xbe06('0x4'));var BPromise=require(_0xbe06('0x5'));var Mustache=require(_0xbe06('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xbe06('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbe06('0x8'));var _=require(_0xbe06('0x9'));var squel=require(_0xbe06('0xa'));var crypto=require(_0xbe06('0xb'));var jsforce=require(_0xbe06('0xc'));var deskjs=require(_0xbe06('0xd'));var toCsv=require(_0xbe06('0x7'));var querystring=require('querystring');var Papa=require(_0xbe06('0xe'));var Redis=require(_0xbe06('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xbe06('0x10'));var as=require(_0xbe06('0x11'));var hardwareService=require(_0xbe06('0x12'));var logger=require(_0xbe06('0x13'))(_0xbe06('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbe06('0x15'));var db=require(_0xbe06('0x16'))['db'];config[_0xbe06('0x17')]=_['defaults'](config[_0xbe06('0x17')],{'host':_0xbe06('0x18'),'port':0x18eb});var socket=require(_0xbe06('0x19'))(new Redis(config[_0xbe06('0x17')]));require(_0xbe06('0x1a'))[_0xbe06('0x1b')](socket);function respondWithStatusCode(_0x1a8e49,_0x4d3ac5){_0x4d3ac5=_0x4d3ac5||0xcc;return function(_0x41765d){if(_0x41765d){return _0x1a8e49[_0xbe06('0x1c')](_0x4d3ac5);}return _0x1a8e49['status'](_0x4d3ac5)['end']();};}function respondWithResult(_0x4b2d9a,_0x539983){_0x539983=_0x539983||0xc8;return function(_0x5457ec){if(_0x5457ec){return _0x4b2d9a[_0xbe06('0x1d')](_0x539983)[_0xbe06('0x1e')](_0x5457ec);}};}function respondWithFilteredResult(_0x251b09,_0x1c18a7){return function(_0xf6f37e){if(_0xf6f37e){var _0x56f8db=typeof _0x1c18a7['offset']===_0xbe06('0x1f')&&typeof _0x1c18a7['limit']===_0xbe06('0x1f');var _0x428cd8=_0xf6f37e['count'];var _0x1ee4e9=_0x56f8db?0x0:_0x1c18a7[_0xbe06('0x20')];var _0x4c9cab=_0x56f8db?_0xf6f37e[_0xbe06('0x21')]:_0x1c18a7[_0xbe06('0x20')]+_0x1c18a7['limit'];var _0x45e62b;if(_0x4c9cab>=_0x428cd8){_0x4c9cab=_0x428cd8;_0x45e62b=0xc8;}else{_0x45e62b=0xce;}_0x251b09[_0xbe06('0x1d')](_0x45e62b);return _0x251b09['set']('Content-Range',_0x1ee4e9+'-'+_0x4c9cab+'/'+_0x428cd8)[_0xbe06('0x1e')](_0xf6f37e);}return null;};}function patchUpdates(_0x3f46a0){return function(_0x35c239){try{jsonpatch[_0xbe06('0x22')](_0x35c239,_0x3f46a0,!![]);}catch(_0x1180d8){return BPromise[_0xbe06('0x23')](_0x1180d8);}return _0x35c239[_0xbe06('0x24')]();};}function saveUpdates(_0x20cd41,_0x4c2397){return function(_0x3e570a){if(_0x3e570a){return _0x3e570a[_0xbe06('0x25')](_0x20cd41)[_0xbe06('0x26')](function(_0x9ad8a3){return _0x9ad8a3;});}return null;};}function removeEntity(_0x84fcaa,_0x2e1a71){return function(_0x20368c){if(_0x20368c){return _0x20368c['destroy']()['then'](function(){_0x84fcaa['status'](0xcc)[_0xbe06('0x27')]();});}};}function handleEntityNotFound(_0x46380e,_0x2ae2a3){return function(_0x54cc13){if(!_0x54cc13){_0x46380e[_0xbe06('0x1c')](0x194);}return _0x54cc13;};}function handleError(_0x5854fe,_0x31b418){_0x31b418=_0x31b418||0x1f4;return function(_0x881edd){logger[_0xbe06('0x28')](_0x881edd[_0xbe06('0x29')]);if(_0x881edd[_0xbe06('0x2a')]){delete _0x881edd[_0xbe06('0x2a')];}_0x5854fe['status'](_0x31b418)[_0xbe06('0x2b')](_0x881edd);};}exports[_0xbe06('0x2c')]=function(_0x1886f8,_0x16473b,_0x26ebaf){if(!_0x1886f8[_0xbe06('0x2d')][_0xbe06('0x2e')]('text')&&!_0x1886f8[_0xbe06('0x2d')][_0xbe06('0x2e')]('TemplateId')){throw new db['Sequelize'][(_0xbe06('0x2f'))](_0xbe06('0x30'));}else{if(_0x1886f8[_0xbe06('0x2d')][_0xbe06('0x2e')](_0xbe06('0x31'))&&!_0x1886f8[_0xbe06('0x2d')]['hasOwnProperty'](_0xbe06('0x32'))){throw new db[(_0xbe06('0x33'))][(_0xbe06('0x2f'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x1886f8[_0xbe06('0x2d')][_0xbe06('0x2e')](_0xbe06('0x34'))){throw new db[(_0xbe06('0x33'))]['ValidationError'](_0xbe06('0x35'));}else{try{var _0x101de7=JSON[_0xbe06('0x36')](_0x1886f8['body'][_0xbe06('0x34')]);}catch(_0x520cd1){logger[_0xbe06('0x28')](_0x520cd1);throw new db['Sequelize']['ValidationError'](_0xbe06('0x37'));}var _0x30aac4=['chatqueue',_0xbe06('0x38'),_0xbe06('0x39'),_0xbe06('0x3a'),'smsqueue',_0xbe06('0x3b'),'whatsappqueue',_0xbe06('0x3c'),_0xbe06('0x3d')];if(_[_0xbe06('0x3e')](_0x101de7,function(_0x564384){return!_[_0xbe06('0x3f')](_0x30aac4,_0x564384['model'][_0xbe06('0x40')]());})){throw new db[(_0xbe06('0x33'))][(_0xbe06('0x2f'))](_0xbe06('0x41'));}}}var _0x290f0b={};_0x290f0b[_0xbe06('0x42')]=_0x1886f8[_0xbe06('0x2d')][_0xbe06('0x2e')](_0xbe06('0x42'))?_0x1886f8[_0xbe06('0x2d')][_0xbe06('0x42')]:_0x1886f8[_0xbe06('0x3d')][_0xbe06('0x43')];_0x290f0b[_0xbe06('0x44')]=_['isEmpty'](_0x1886f8['body'][_0xbe06('0x44')])?null:_0x1886f8['body'][_0xbe06('0x44')];_0x290f0b[_0xbe06('0x45')]=_0x1886f8[_0xbe06('0x2d')][_0xbe06('0x45')]||![];_0x290f0b['SenderId']=_0x1886f8[_0xbe06('0x3d')]['id'];return getContent(_0x1886f8['body'])['then'](function(_0x4c9c08){_0x290f0b[_0xbe06('0x2d')]=_0x4c9c08;return getRecipients(_0x101de7);})[_0xbe06('0x26')](function(_0x2d9f85){_0x290f0b[_0xbe06('0x46')]=_['sortBy'](_0x2d9f85)[_0xbe06('0x47')](',');return db[_0xbe06('0x48')][_0xbe06('0x49')](function(_0x20f95f){return db[_0xbe06('0x4a')][_0xbe06('0x4b')](_0x290f0b,{'raw':!![],'transaction':_0x20f95f})[_0xbe06('0x26')](function(_0x1d9a53){var _0x5c0886={'sender':_0x290f0b['senderName'],'description':_0x290f0b[_0xbe06('0x44')],'content':_0x290f0b[_0xbe06('0x2d')],'beep':_0x290f0b[_0xbe06('0x45')]};_0x2d9f85[_0xbe06('0x4c')](function(_0x1fecc1){_0x5c0886[_0xbe06('0x4d')]=_0x1fecc1;socket[_0xbe06('0x4e')]('userNotification:send',_0x5c0886);});return _0x1d9a53;});});})[_0xbe06('0x26')](respondWithResult(_0x16473b,0xc9))[_0xbe06('0x4f')](handleError(_0x16473b,null));};function getContent(_0x14b8a9){return new BPromise(function(_0x1ef58c,_0x18f964){if(_0x14b8a9[_0xbe06('0x50')]){_0x1ef58c(_0x14b8a9[_0xbe06('0x50')]);return;}return db[_0xbe06('0x51')][_0xbe06('0x52')]({'attributes':['html'],'where':{'id':_0x14b8a9[_0xbe06('0x31')]},'raw':!![]})[_0xbe06('0x26')](function(_0x18024f){if(!_0x18024f)throw new db[(_0xbe06('0x33'))][(_0xbe06('0x2f'))](_0xbe06('0x53'));var _0x59cef9=Mustache[_0xbe06('0x54')](_0x18024f[_0xbe06('0x55')],_0x14b8a9['view']);_0x1ef58c(_0x59cef9);})[_0xbe06('0x4f')](function(_0x149083){_0x18f964(_0x149083);});});}function getRecipients(_0x1859e6){return new BPromise(function(_0x5648bc,_0x3b4329){var _0x53c628=[];var _0x15c488=[];_0x1859e6[_0xbe06('0x4c')](function(_0x372170){var _0x5e3ab6=_[_0xbe06('0x56')](_0x372170[_0xbe06('0x57')][_0xbe06('0x40')]());if(_0x5e3ab6==='User'){_0x53c628=_['union'](_0x53c628,_0x372170['ids']);}else{if(_[_0xbe06('0x3f')](_0x5e3ab6,_0xbe06('0x58')))_0x5e3ab6=_0x5e3ab6['replace'](_0xbe06('0x58'),_0xbe06('0x59'));_0x372170[_0xbe06('0x5a')]['forEach'](function(_0x46dda9){_0x15c488[_0xbe06('0x5b')](getAgents(_0x5e3ab6,_0x46dda9));});}});return BPromise[_0xbe06('0x5c')](_0x15c488)[_0xbe06('0x26')](function(_0x352070){_0x53c628=_['union'](_0x53c628,_[_0xbe06('0x5d')](_0x352070));_0x5648bc(_0x53c628);})[_0xbe06('0x4f')](function(_0x14800a){_0x3b4329(_0x14800a);});});}function getAgents(_0x40786b,_0x11da60){return new BPromise(function(_0x3cf6b2,_0x4b7c2a){return db[_0x40786b][_0xbe06('0x52')]({'where':{'id':_0x11da60}})[_0xbe06('0x26')](function(_0xa44881){return _0xa44881['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x53c95a){var _0x386b9e=_[_0xbe06('0x5e')](_0x53c95a,'id');_0x3cf6b2(_0x386b9e);});})[_0xbe06('0x4f')](function(_0x113d10){_0x4b7c2a(_0x113d10);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index cac350d..7671b6d 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 _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 +var _0x9624=['../../mysqldb','UserNotification','setMaxListeners','save','remove','emit','hook','exports'];(function(_0x4b6346,_0x56e206){var _0x5edfd1=function(_0x35a79b){while(--_0x35a79b){_0x4b6346['push'](_0x4b6346['shift']());}};_0x5edfd1(++_0x56e206);}(_0x9624,0x1d0));var _0x4962=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9624[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x4962('0x0'))['db'][_0x4962('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x4962('0x2')](0x0);var events={'afterCreate':_0x4962('0x3'),'afterUpdate':'update','afterDestroy':_0x4962('0x4')};function emitEvent(_0x314218){return function(_0x59d8a3,_0x178f25,_0x11261c){UserNotificationEvents[_0x4962('0x5')](_0x314218+':'+_0x59d8a3['id'],_0x59d8a3);UserNotificationEvents[_0x4962('0x5')](_0x314218,_0x59d8a3);_0x11261c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x4962('0x6')](e,emitEvent(event));}}module[_0x4962('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index b3752c7..b4a125a 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 _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 +var _0x24f1=['util','api','bluebird','path','rimraf','../../config/environment','./userNotification.attributes','exports','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x147356,_0x213c81){var _0x179172=function(_0x1901d7){while(--_0x1901d7){_0x147356['push'](_0x147356['shift']());}};_0x179172(++_0x213c81);}(_0x24f1,0xb5));var _0x124f=function(_0x31c19c,_0xbe4b70){_0x31c19c=_0x31c19c-0x0;var _0x1a87f7=_0x24f1[_0x31c19c];return _0x1a87f7;};'use strict';var _=require(_0x124f('0x0'));var util=require(_0x124f('0x1'));var logger=require('../../config/logger')(_0x124f('0x2'));var moment=require('moment');var BPromise=require(_0x124f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x124f('0x4'));var rimraf=require(_0x124f('0x5'));var config=require(_0x124f('0x6'));var attributes=require(_0x124f('0x7'));module[_0x124f('0x8')]=function(_0x4713,_0x53f235){return _0x4713['define'](_0x124f('0x9'),attributes,{'tableName':_0x124f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x124f('0xb'),'collate':_0x124f('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 95395d0..6f9f978 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 _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 +var _0x19f2=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserNotification,\x20%s,\x20%s','result','lodash','bluebird','randomstring','ioredis'];(function(_0x295314,_0x17b250){var _0x584b0c=function(_0x51cc84){while(--_0x51cc84){_0x295314['push'](_0x295314['shift']());}};_0x584b0c(++_0x17b250);}(_0x19f2,0xb9));var _0x219f=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0x19f2[_0x236d24];return _0x1574cf;};'use strict';var _=require(_0x219f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x219f('0x1'));var rs=require(_0x219f('0x2'));var fs=require('fs');var Redis=require(_0x219f('0x3'));var db=require(_0x219f('0x4'))['db'];var utils=require(_0x219f('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x219f('0x6'));var jayson=require(_0x219f('0x7'));var client=jayson[_0x219f('0x8')][_0x219f('0x9')]({'port':0x232a});config['redis']=_[_0x219f('0xa')](config['redis'],{'host':_0x219f('0xb'),'port':0x18eb});var socket=require(_0x219f('0xc'))(new Redis(config['redis']));require(_0x219f('0xd'))[_0x219f('0xe')](socket);function respondWithRpcPromise(_0x3cd930,_0x4e0596,_0x15ff2c){return new BPromise(function(_0x375bd8,_0x38dd8e){return client[_0x219f('0xf')](_0x3cd930,_0x15ff2c)[_0x219f('0x10')](function(_0xe6e0be){logger[_0x219f('0x11')]('UserNotification,\x20%s,\x20%s',_0x4e0596,_0x219f('0x12'));logger[_0x219f('0x13')](_0x219f('0x14'),_0x4e0596,'request\x20sent',JSON[_0x219f('0x15')](_0xe6e0be));if(_0xe6e0be[_0x219f('0x16')]){if(_0xe6e0be[_0x219f('0x16')][_0x219f('0x17')]===0x1f4){logger[_0x219f('0x16')]('UserNotification,\x20%s,\x20%s',_0x4e0596,_0xe6e0be['error'][_0x219f('0x18')]);return _0x38dd8e(_0xe6e0be[_0x219f('0x16')][_0x219f('0x18')]);}logger[_0x219f('0x16')](_0x219f('0x19'),_0x4e0596,_0xe6e0be[_0x219f('0x16')][_0x219f('0x18')]);return _0x375bd8(_0xe6e0be[_0x219f('0x16')]['message']);}else{logger[_0x219f('0x11')]('UserNotification,\x20%s,\x20%s',_0x4e0596,'request\x20sent');_0x375bd8(_0xe6e0be[_0x219f('0x1a')][_0x219f('0x18')]);}})['catch'](function(_0x27e73b){logger[_0x219f('0x16')](_0x219f('0x19'),_0x4e0596,_0x27e73b);_0x38dd8e(_0x27e73b);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 02c2d59..c9f0fd4 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 _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 +var _0xf229=['update','emit','register'];(function(_0x870f4a,_0x3ba461){var _0x46c8ea=function(_0x5bfed0){while(--_0x5bfed0){_0x870f4a['push'](_0x870f4a['shift']());}};_0x46c8ea(++_0x3ba461);}(_0xf229,0xb1));var _0x9f22=function(_0x5b15f0,_0x405f5f){_0x5b15f0=_0x5b15f0-0x0;var _0x54cba6=_0xf229[_0x5b15f0];return _0x54cba6;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=['save','remove',_0x9f22('0x0')];function createListener(_0x28d40a,_0x5e4cb3){return function(_0x404773){_0x5e4cb3[_0x9f22('0x1')](_0x28d40a,_0x404773);};}function removeListener(_0x1aa25e,_0x12f033){return function(){UserNotificationEvents['removeListener'](_0x1aa25e,_0x12f033);};}exports[_0x9f22('0x2')]=function(_0x4366d6){for(var _0x3f2c39=0x0,_0x47eabe=events['length'];_0x3f2c39<_0x47eabe;_0x3f2c39++){var _0x37a75a=events[_0x3f2c39];var _0x3365e8=createListener('userNotification:'+_0x37a75a,_0x4366d6);UserNotificationEvents['on'](_0x37a75a,_0x3365e8);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 87c51fa..f516e56 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 _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 +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x40f310,_0x33f8ba){var _0x414b2d=function(_0x23aa85){while(--_0x23aa85){_0x40f310['push'](_0x40f310['shift']());}};_0x414b2d(++_0x33f8ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 1402402..9a4f2be 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 _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 +var _0xaa45=['INTEGER','exports'];(function(_0x56c27a,_0x4760e7){var _0x5a61ad=function(_0x41480a){while(--_0x41480a){_0x56c27a['push'](_0x56c27a['shift']());}};_0x5a61ad(++_0x4760e7);}(_0xaa45,0x17d));var _0x5aa4=function(_0x16ea87,_0x378d8b){_0x16ea87=_0x16ea87-0x0;var _0x6e7b1c=_0xaa45[_0x16ea87];return _0x6e7b1c;};'use strict';var Sequelize=require('sequelize');module[_0x5aa4('0x0')]={'penalty':{'type':Sequelize[_0x5aa4('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 9b78dc2..5d53212 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 _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 +var _0x029d=['../../config/environment','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x390e4b,_0x202f91){var _0x1d2603=function(_0x21b29f){while(--_0x21b29f){_0x390e4b['push'](_0x390e4b['shift']());}};_0x1d2603(++_0x202f91);}(_0x029d,0x19c));var _0xd029=function(_0x2243a1,_0x34b228){_0x2243a1=_0x2243a1-0x0;var _0x47d17d=_0x029d[_0x2243a1];return _0x47d17d;};'use strict';var _=require('lodash');var util=require(_0xd029('0x0'));var logger=require(_0xd029('0x1'))(_0xd029('0x2'));var moment=require(_0xd029('0x3'));var BPromise=require('bluebird');var rp=require(_0xd029('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd029('0x5'));var config=require(_0xd029('0x6'));var attributes=require(_0xd029('0x7'));module[_0xd029('0x8')]=function(_0x219327,_0x59db61){return _0x219327['define'](_0xd029('0x9'),attributes,{'tableName':_0xd029('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 9442e96..4ff2803 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 _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 +var _0x6b54=['http','request','then','info','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x24d1fb,_0x3368ea){var _0x35ff97=function(_0x4ac9e4){while(--_0x4ac9e4){_0x24d1fb['push'](_0x24d1fb['shift']());}};_0x35ff97(++_0x3368ea);}(_0x6b54,0x68));var _0x46b5=function(_0x283e0e,_0x3f29df){_0x283e0e=_0x283e0e-0x0;var _0x37f29a=_0x6b54[_0x283e0e];return _0x37f29a;};'use strict';var _=require(_0x46b5('0x0'));var util=require(_0x46b5('0x1'));var moment=require(_0x46b5('0x2'));var BPromise=require('bluebird');var rs=require(_0x46b5('0x3'));var fs=require('fs');var Redis=require(_0x46b5('0x4'));var db=require(_0x46b5('0x5'))['db'];var utils=require(_0x46b5('0x6'));var logger=require(_0x46b5('0x7'))('rpc');var config=require(_0x46b5('0x8'));var jayson=require(_0x46b5('0x9'));var client=jayson[_0x46b5('0xa')][_0x46b5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a53c3,_0x354f48,_0x12a546){return new BPromise(function(_0x29d787,_0x265768){return client[_0x46b5('0xc')](_0x3a53c3,_0x12a546)[_0x46b5('0xd')](function(_0x4cab52){logger[_0x46b5('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x354f48,_0x46b5('0xf'));logger['debug'](_0x46b5('0x10'),_0x354f48,_0x46b5('0xf'),JSON[_0x46b5('0x11')](_0x4cab52));if(_0x4cab52[_0x46b5('0x12')]){if(_0x4cab52[_0x46b5('0x12')][_0x46b5('0x13')]===0x1f4){logger[_0x46b5('0x12')](_0x46b5('0x14'),_0x354f48,_0x4cab52[_0x46b5('0x12')][_0x46b5('0x15')]);return _0x265768(_0x4cab52['error']['message']);}logger[_0x46b5('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x354f48,_0x4cab52['error']['message']);return _0x29d787(_0x4cab52[_0x46b5('0x12')][_0x46b5('0x15')]);}else{logger[_0x46b5('0xe')](_0x46b5('0x14'),_0x354f48,_0x46b5('0xf'));_0x29d787(_0x4cab52['result'][_0x46b5('0x15')]);}})[_0x46b5('0x16')](function(_0x275444){logger[_0x46b5('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x354f48,_0x275444);_0x265768(_0x275444);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 098d33a..ea60f19 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 _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 +var _0x2922=['/:id/sections','getSections','/:id/resources','getResources','create','post','/:id/clone','clone','addSections','addResources','/:id','delete','destroy','removeSections','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','/describe','isAuthenticated','describe','show'];(function(_0x4b645d,_0x2634a6){var _0x288b7b=function(_0x5d7f91){while(--_0x5d7f91){_0x4b645d['push'](_0x4b645d['shift']());}};_0x288b7b(++_0x2634a6);}(_0x2922,0x6c));var _0x2292=function(_0x46709b,_0x48d0ea){_0x46709b=_0x46709b-0x0;var _0x24ee56=_0x2922[_0x46709b];return _0x24ee56;};'use strict';var multer=require(_0x2292('0x0'));var util=require(_0x2292('0x1'));var path=require(_0x2292('0x2'));var timeout=require(_0x2292('0x3'));var express=require(_0x2292('0x4'));var router=express[_0x2292('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2292('0x6'));var interaction=require(_0x2292('0x7'));var config=require(_0x2292('0x8'));var controller=require(_0x2292('0x9'));router[_0x2292('0xa')]('/',auth['isAuthenticated'](),controller[_0x2292('0xb')]);router['get'](_0x2292('0xc'),auth[_0x2292('0xd')](),controller[_0x2292('0xe')]);router[_0x2292('0xa')]('/:id',auth[_0x2292('0xd')](),controller[_0x2292('0xf')]);router['get'](_0x2292('0x10'),auth[_0x2292('0xd')](),controller[_0x2292('0x11')]);router[_0x2292('0xa')](_0x2292('0x12'),auth[_0x2292('0xd')](),controller[_0x2292('0x13')]);router['post']('/',auth[_0x2292('0xd')](),controller[_0x2292('0x14')]);router[_0x2292('0x15')](_0x2292('0x16'),auth['isAuthenticated'](),controller[_0x2292('0x17')]);router[_0x2292('0x15')](_0x2292('0x10'),auth['isAuthenticated'](),controller[_0x2292('0x18')]);router[_0x2292('0x15')](_0x2292('0x12'),auth['isAuthenticated'](),controller[_0x2292('0x19')]);router['put'](_0x2292('0x1a'),auth[_0x2292('0xd')](),controller['update']);router[_0x2292('0x1b')](_0x2292('0x1a'),auth[_0x2292('0xd')](),controller[_0x2292('0x1c')]);router[_0x2292('0x1b')](_0x2292('0x10'),auth[_0x2292('0xd')](),controller[_0x2292('0x1d')]);router['delete'](_0x2292('0x12'),auth[_0x2292('0xd')](),controller['removeResources']);module[_0x2292('0x1e')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 18f14aa..b94041a 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 _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 +var _0x2e88=['split','BOOLEAN','sequelize','STRING','name','setDataValue','crudPermissions','join','getDataValue'];(function(_0x31cc4b,_0x2c2bf0){var _0x2b9fb2=function(_0x260fe3){while(--_0x260fe3){_0x31cc4b['push'](_0x31cc4b['shift']());}};_0x2b9fb2(++_0x2c2bf0);}(_0x2e88,0x1c4));var _0x82e8=function(_0x3e0b8f,_0x1cddeb){_0x3e0b8f=_0x3e0b8f-0x0;var _0x22f742=_0x2e88[_0x3e0b8f];return _0x22f742;};'use strict';var Sequelize=require(_0x82e8('0x0'));module['exports']={'name':{'type':Sequelize[_0x82e8('0x1')],'allowNull':![],'unique':_0x82e8('0x2')},'crudPermissions':{'type':Sequelize[_0x82e8('0x1')],'set':function(_0xfd1e22){this[_0x82e8('0x3')](_0x82e8('0x4'),_0xfd1e22?_0xfd1e22[_0x82e8('0x5')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x82e8('0x6')](_0x82e8('0x4'))[_0x82e8('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x82e8('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x82e8('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x82e8('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x82e8('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x82e8('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x82e8('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x82e8('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x82e8('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 4254470..82681b5 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 _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 +var _0x4efc=['findAll','rows','show','params','keys','include','find','catch','create','body','get','omit','updatedAt','crudPermissions','createdAt','sequelize','transaction','UserProfileSection','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','each','removeSections','ids','getSections','includes','subsections','enabled','push','findOne','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','fast-json-patch','moment','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','reject','save','then','destroy','end','error','name','send','index','UserProfile','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x4efc,0x10b));var _0xc4ef=function(_0x1e14ad,_0x4b15a6){_0x1e14ad=_0x1e14ad-0x0;var _0x27128a=_0x4efc[_0x1e14ad];return _0x27128a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc4ef('0x0'));var zipdir=require(_0xc4ef('0x1'));var jsonpatch=require(_0xc4ef('0x2'));var rp=require('request-promise');var moment=require(_0xc4ef('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc4ef('0x4'));var sox=require(_0xc4ef('0x5'));var csv=require('to-csv');var ejs=require(_0xc4ef('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc4ef('0x7'));var squel=require(_0xc4ef('0x8'));var crypto=require(_0xc4ef('0x9'));var jsforce=require(_0xc4ef('0xa'));var deskjs=require(_0xc4ef('0xb'));var toCsv=require(_0xc4ef('0xc'));var querystring=require('querystring');var Papa=require(_0xc4ef('0xd'));var Redis=require(_0xc4ef('0xe'));var authService=require(_0xc4ef('0xf'));var qs=require(_0xc4ef('0x10'));var as=require(_0xc4ef('0x11'));var hardwareService=require(_0xc4ef('0x12'));var logger=require(_0xc4ef('0x13'))(_0xc4ef('0x14'));var utils=require(_0xc4ef('0x15'));var config=require(_0xc4ef('0x16'));var licenseUtil=require(_0xc4ef('0x17'));var db=require(_0xc4ef('0x18'))['db'];config['redis']=_['defaults'](config[_0xc4ef('0x19')],{'host':_0xc4ef('0x1a'),'port':0x18eb});var socket=require(_0xc4ef('0x1b'))(new Redis(config[_0xc4ef('0x19')]));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x256e1b,_0x51bc65){_0x51bc65=_0x51bc65||0xcc;return function(_0x42843b){if(_0x42843b){return _0x256e1b[_0xc4ef('0x1c')](_0x51bc65);}return _0x256e1b[_0xc4ef('0x1d')](_0x51bc65)['end']();};}function respondWithResult(_0x302781,_0x161c0f){_0x161c0f=_0x161c0f||0xc8;return function(_0x5b577c){if(_0x5b577c){return _0x302781[_0xc4ef('0x1d')](_0x161c0f)[_0xc4ef('0x1e')](_0x5b577c);}};}function respondWithFilteredResult(_0x3d7e43,_0x6ece60){return function(_0x8e72c3){if(_0x8e72c3){var _0x45fc35=typeof _0x6ece60['offset']==='undefined'&&typeof _0x6ece60[_0xc4ef('0x1f')]===_0xc4ef('0x20');var _0x5e2a0b=_0x8e72c3[_0xc4ef('0x21')];var _0x420d0c=_0x45fc35?0x0:_0x6ece60[_0xc4ef('0x22')];var _0x3f25b1=_0x45fc35?_0x8e72c3[_0xc4ef('0x21')]:_0x6ece60[_0xc4ef('0x22')]+_0x6ece60[_0xc4ef('0x1f')];var _0x2d375d;if(_0x3f25b1>=_0x5e2a0b){_0x3f25b1=_0x5e2a0b;_0x2d375d=0xc8;}else{_0x2d375d=0xce;}_0x3d7e43['status'](_0x2d375d);return _0x3d7e43[_0xc4ef('0x23')](_0xc4ef('0x24'),_0x420d0c+'-'+_0x3f25b1+'/'+_0x5e2a0b)[_0xc4ef('0x1e')](_0x8e72c3);}return null;};}function patchUpdates(_0x33d3d){return function(_0x454fea){try{jsonpatch['apply'](_0x454fea,_0x33d3d,!![]);}catch(_0x127a8a){return BPromise[_0xc4ef('0x25')](_0x127a8a);}return _0x454fea[_0xc4ef('0x26')]();};}function saveUpdates(_0x479a61,_0x13b01a){return function(_0x4663f0){if(_0x4663f0){return _0x4663f0['update'](_0x479a61)[_0xc4ef('0x27')](function(_0x5c19c4){return _0x5c19c4;});}return null;};}function removeEntity(_0x43539b,_0x532a48){return function(_0x23dcd9){if(_0x23dcd9){return _0x23dcd9[_0xc4ef('0x28')]()[_0xc4ef('0x27')](function(){_0x43539b[_0xc4ef('0x1d')](0xcc)[_0xc4ef('0x29')]();});}};}function handleEntityNotFound(_0xa755c0,_0x3bf652){return function(_0x1a42b8){if(!_0x1a42b8){_0xa755c0[_0xc4ef('0x1c')](0x194);}return _0x1a42b8;};}function handleError(_0x13a785,_0x1a6bb3){_0x1a6bb3=_0x1a6bb3||0x1f4;return function(_0x3b899b){logger[_0xc4ef('0x2a')](_0x3b899b['stack']);if(_0x3b899b[_0xc4ef('0x2b')]){delete _0x3b899b[_0xc4ef('0x2b')];}_0x13a785['status'](_0x1a6bb3)[_0xc4ef('0x2c')](_0x3b899b);};}exports[_0xc4ef('0x2d')]=function(_0xb4274f,_0x344201){var _0x29b6ea={},_0x550308={},_0x4803ed={'count':0x0,'rows':[]};var _0x3676b6=_['map'](db[_0xc4ef('0x2e')][_0xc4ef('0x2f')],function(_0x136230){return{'name':_0x136230['fieldName'],'type':_0x136230[_0xc4ef('0x30')][_0xc4ef('0x31')]};});_0x550308[_0xc4ef('0x32')]=_['map'](_0x3676b6,_0xc4ef('0x2b'));_0x550308[_0xc4ef('0x33')]=_['keys'](_0xb4274f[_0xc4ef('0x33')]);_0x550308[_0xc4ef('0x34')]=_[_0xc4ef('0x35')](_0x550308[_0xc4ef('0x32')],_0x550308['query']);_0x29b6ea[_0xc4ef('0x36')]=_[_0xc4ef('0x35')](_0x550308[_0xc4ef('0x32')],qs['fields'](_0xb4274f['query'][_0xc4ef('0x37')]));_0x29b6ea[_0xc4ef('0x36')]=_0x29b6ea[_0xc4ef('0x36')][_0xc4ef('0x38')]?_0x29b6ea[_0xc4ef('0x36')]:_0x550308[_0xc4ef('0x32')];if(!_0xb4274f[_0xc4ef('0x33')][_0xc4ef('0x39')](_0xc4ef('0x3a'))){_0x29b6ea[_0xc4ef('0x1f')]=qs[_0xc4ef('0x1f')](_0xb4274f[_0xc4ef('0x33')][_0xc4ef('0x1f')]);_0x29b6ea['offset']=qs['offset'](_0xb4274f[_0xc4ef('0x33')]['offset']);}_0x29b6ea[_0xc4ef('0x3b')]=qs['sort'](_0xb4274f['query'][_0xc4ef('0x3c')]);_0x29b6ea[_0xc4ef('0x3d')]=qs[_0xc4ef('0x34')](_[_0xc4ef('0x3e')](_0xb4274f[_0xc4ef('0x33')],_0x550308[_0xc4ef('0x34')]),_0x3676b6);if(_0xb4274f[_0xc4ef('0x33')][_0xc4ef('0x3f')]){_0x29b6ea[_0xc4ef('0x3d')]=_[_0xc4ef('0x40')](_0x29b6ea[_0xc4ef('0x3d')],{'$or':_[_0xc4ef('0x41')](_0x3676b6,function(_0x504a7e){if(_0x504a7e[_0xc4ef('0x30')]!==_0xc4ef('0x42')){var _0x2ad67d={};_0x2ad67d[_0x504a7e[_0xc4ef('0x2b')]]={'$like':'%'+_0xb4274f['query'][_0xc4ef('0x3f')]+'%'};return _0x2ad67d;}})});}_0x29b6ea=_[_0xc4ef('0x40')]({},_0x29b6ea,_0xb4274f[_0xc4ef('0x43')]);var _0x54e333={'where':_0x29b6ea[_0xc4ef('0x3d')]};return db['UserProfile']['count'](_0x54e333)[_0xc4ef('0x27')](function(_0x1db64a){_0x4803ed[_0xc4ef('0x21')]=_0x1db64a;if(_0xb4274f[_0xc4ef('0x33')][_0xc4ef('0x44')]){_0x29b6ea['include']=[{'all':!![]}];}return db['UserProfile'][_0xc4ef('0x45')](_0x29b6ea);})[_0xc4ef('0x27')](function(_0x4f8222){_0x4803ed[_0xc4ef('0x46')]=_0x4f8222;return _0x4803ed;})[_0xc4ef('0x27')](respondWithFilteredResult(_0x344201,_0x29b6ea))['catch'](handleError(_0x344201,null));};exports[_0xc4ef('0x47')]=function(_0x1f4e15,_0x406a3a){var _0x43159f={'raw':![],'where':{'id':_0x1f4e15[_0xc4ef('0x48')]['id']}},_0x2bbe94={};_0x2bbe94['model']=_[_0xc4ef('0x49')](db['UserProfile'][_0xc4ef('0x2f')]);_0x2bbe94['query']=_['keys'](_0x1f4e15['query']);_0x2bbe94[_0xc4ef('0x34')]=_[_0xc4ef('0x35')](_0x2bbe94[_0xc4ef('0x32')],_0x2bbe94[_0xc4ef('0x33')]);_0x43159f[_0xc4ef('0x36')]=_[_0xc4ef('0x35')](_0x2bbe94['model'],qs[_0xc4ef('0x37')](_0x1f4e15[_0xc4ef('0x33')]['fields']));_0x43159f['attributes']=_0x43159f[_0xc4ef('0x36')][_0xc4ef('0x38')]?_0x43159f['attributes']:_0x2bbe94[_0xc4ef('0x32')];if(_0x1f4e15[_0xc4ef('0x33')]['includeAll']){_0x43159f[_0xc4ef('0x4a')]=[{'all':!![]}];}_0x43159f=_[_0xc4ef('0x40')]({},_0x43159f,_0x1f4e15[_0xc4ef('0x43')]);return db[_0xc4ef('0x2e')][_0xc4ef('0x4b')](_0x43159f)[_0xc4ef('0x27')](handleEntityNotFound(_0x406a3a,null))[_0xc4ef('0x27')](respondWithResult(_0x406a3a,null))[_0xc4ef('0x4c')](handleError(_0x406a3a,null));};exports[_0xc4ef('0x4d')]=function(_0x1e732d,_0x870faa){return db['UserProfile'][_0xc4ef('0x4d')](_0x1e732d[_0xc4ef('0x4e')],{})[_0xc4ef('0x27')](respondWithResult(_0x870faa,0xc9))[_0xc4ef('0x4c')](handleError(_0x870faa,null));};exports['clone']=function(_0x5c60cc,_0x40bdd3){var _0x2846c3={'where':{'id':_0x5c60cc['params']['id']}},_0x447a15={};_0x447a15[_0xc4ef('0x32')]=_['keys'](db['UserProfile'][_0xc4ef('0x2f')]);_0x2846c3[_0xc4ef('0x36')]=_[_0xc4ef('0x35')](_0x447a15[_0xc4ef('0x32')],qs[_0xc4ef('0x37')](_0x5c60cc[_0xc4ef('0x33')][_0xc4ef('0x37')]));_0x2846c3[_0xc4ef('0x36')]=_0x2846c3[_0xc4ef('0x36')][_0xc4ef('0x38')]?_0x2846c3[_0xc4ef('0x36')]:_0x447a15[_0xc4ef('0x32')];if(_0x5c60cc[_0xc4ef('0x33')][_0xc4ef('0x44')]){_0x2846c3[_0xc4ef('0x4a')]=[{'all':!![]}];}_0x2846c3=_[_0xc4ef('0x40')]({},_0x2846c3,_0x5c60cc[_0xc4ef('0x43')]);return db[_0xc4ef('0x2e')][_0xc4ef('0x4b')](_0x2846c3)[_0xc4ef('0x27')](handleEntityNotFound(_0x40bdd3,null))['then'](function(_0x26d0b7){if(_0x26d0b7){var _0x3bb148=_0x26d0b7[_0xc4ef('0x4f')]({'plain':!![]});_0x3bb148=qs[_0xc4ef('0x50')](_0x3bb148,['id','createdAt',_0xc4ef('0x51'),_0xc4ef('0x52')]);_0x5c60cc['body']=_['omit'](_0x5c60cc[_0xc4ef('0x4e')],['id',_0xc4ef('0x53'),'updatedAt']);return db[_0xc4ef('0x54')][_0xc4ef('0x55')](function(_0x26f07f){return db['UserProfile'][_0xc4ef('0x4d')](_[_0xc4ef('0x40')](_0x3bb148,_0x5c60cc['body']),{'include':_0x5c60cc['query'][_0xc4ef('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x26f07f})[_0xc4ef('0x27')](function(_0x394ab9){var _0x3208df=_0x394ab9[_0xc4ef('0x4f')]({'plain':!![]});return db[_0xc4ef('0x56')]['findAll']({'where':{'userProfileId':_0x5c60cc[_0xc4ef('0x48')]['id']},'raw':!![]})['then'](function(_0x5ed529){if(_0x5ed529){return BPromise['each'](_0x5ed529,function(_0x23930f){return new BPromise(function(_0x507e23,_0x200c75){if(_0x23930f['autoAssociation']===null||_0x23930f[_0xc4ef('0x57')]===0x1)_0x507e23(null);return db[_0xc4ef('0x58')][_0xc4ef('0x45')]({'where':{'sectionId':_0x23930f['id']},'raw':!![]})[_0xc4ef('0x27')](function(_0x1aeafa){var _0x48f3e6=_['map'](_0x1aeafa,function(_0x59447d){return qs['omit'](_0x59447d,['id',_0xc4ef('0x53'),_0xc4ef('0x51'),_0xc4ef('0x59')]);});_0x507e23(_0x48f3e6);})[_0xc4ef('0x4c')](function(_0x2b12d6){_0x200c75(_0x2b12d6);});})[_0xc4ef('0x27')](function(_0xde1ee6){var _0x20fee2=qs[_0xc4ef('0x50')](_0x23930f,['id',_0xc4ef('0x53'),_0xc4ef('0x51')]);_0x20fee2[_0xc4ef('0x5a')]=_0x3208df['id'];if(_0xde1ee6)_0x20fee2['Resources']=_0xde1ee6;return _0x20fee2;})[_0xc4ef('0x27')](function(_0x32a18e){return db['UserProfileSection']['create'](_0x32a18e,{'include':[{'model':db[_0xc4ef('0x58')],'as':_0xc4ef('0x5b')}],'raw':!![],'transaction':_0x26f07f});});})[_0xc4ef('0x27')](function(){return _0x3208df;});}});});});}})[_0xc4ef('0x27')](respondWithResult(_0x40bdd3,0xc9))[_0xc4ef('0x4c')](handleError(_0x40bdd3,null));};exports['update']=function(_0x545f43,_0x26fab9){if(_0x545f43[_0xc4ef('0x4e')]['id']){delete _0x545f43['body']['id'];}return db[_0xc4ef('0x2e')][_0xc4ef('0x4b')]({'where':{'id':_0x545f43[_0xc4ef('0x48')]['id']}})[_0xc4ef('0x27')](handleEntityNotFound(_0x26fab9,null))[_0xc4ef('0x27')](saveUpdates(_0x545f43['body'],null))['then'](respondWithResult(_0x26fab9,null))[_0xc4ef('0x4c')](handleError(_0x26fab9,null));};exports[_0xc4ef('0x28')]=function(_0x3b76d8,_0x526742){return db[_0xc4ef('0x2e')][_0xc4ef('0x4b')]({'where':{'id':_0x3b76d8[_0xc4ef('0x48')]['id']}})[_0xc4ef('0x27')](handleEntityNotFound(_0x526742,null))[_0xc4ef('0x27')](removeEntity(_0x526742,null))['catch'](handleError(_0x526742,null));};exports['describe']=function(_0x21fe1f,_0x3658bf){return db[_0xc4ef('0x2e')][_0xc4ef('0x5c')]()[_0xc4ef('0x27')](respondWithResult(_0x3658bf,null))[_0xc4ef('0x4c')](handleError(_0x3658bf,null));};exports[_0xc4ef('0x5d')]=function(_0x385d13,_0x448f5f){var _0x40ecf8=_0x385d13[_0xc4ef('0x4e')];return db[_0xc4ef('0x2e')][_0xc4ef('0x4b')]({'where':{'id':_0x385d13['params']['id']}})[_0xc4ef('0x27')](handleEntityNotFound(_0x448f5f,null))[_0xc4ef('0x27')](function(_0x44a2e6){if(_0x44a2e6){return db[_0xc4ef('0x54')]['transaction'](function(_0x220d42){return db[_0xc4ef('0x56')][_0xc4ef('0x28')]({'where':{'userProfileId':_0x385d13['params']['id'],'sectionId':_[_0xc4ef('0x41')](_0x40ecf8,function(_0x32b13c){return _0x32b13c[_0xc4ef('0x59')];})},'transaction':_0x220d42})[_0xc4ef('0x27')](function(){var _0x58af66=_[_0xc4ef('0x41')](_0x40ecf8,function(_0x199e7a){_0x199e7a[_0xc4ef('0x5a')]=_0x385d13[_0xc4ef('0x48')]['id'];return _0x199e7a;});var _0x3f5717=[];return BPromise[_0xc4ef('0x5e')](_0x58af66,function(_0x837d0a){return db[_0xc4ef('0x56')][_0xc4ef('0x4d')](_0x837d0a,{'include':[{'model':db[_0xc4ef('0x58')],'as':'Resources'}],'raw':!![],'transaction':_0x220d42})[_0xc4ef('0x27')](function(_0x2bdb9a){_0x3f5717['push'](_0x2bdb9a[_0xc4ef('0x4f')]({'plain':!![]}));});})['then'](function(){return _0x3f5717;});});});}})['then'](function(_0x288d45){return _0x288d45;})[_0xc4ef('0x27')](respondWithResult(_0x448f5f,null))[_0xc4ef('0x4c')](handleError(_0x448f5f,null));};exports[_0xc4ef('0x5f')]=function(_0x29e90c,_0x50054d){var _0x19daef;return db[_0xc4ef('0x2e')][_0xc4ef('0x4b')]({'where':{'id':_0x29e90c[_0xc4ef('0x48')]['id']},'attributes':['id','name']})[_0xc4ef('0x27')](handleEntityNotFound(_0x50054d,null))[_0xc4ef('0x27')](function(_0x57ff47){if(_0x57ff47){_0x19daef=_0x57ff47;return db['UserProfileSection'][_0xc4ef('0x28')]({'where':{'userProfileId':_0x29e90c[_0xc4ef('0x48')]['id'],'sectionId':_0x29e90c['query'][_0xc4ef('0x60')]}});}})[_0xc4ef('0x27')](function(){return _0x19daef;})[_0xc4ef('0x27')](respondWithStatusCode(_0x50054d,null))['catch'](handleError(_0x50054d,null));};exports[_0xc4ef('0x61')]=function(_0x50cd09,_0x3ccdc5){var _0x58729e=[];var _0x37d601=[];return db[_0xc4ef('0x56')]['findAll']({'where':{'userProfileId':_0x50cd09[_0xc4ef('0x48')]['id']},'raw':!![]})[_0xc4ef('0x27')](function(_0x36caff){_0x58729e=_[_0xc4ef('0x3f')](_0x36caff,function(_0xd4f0db){return _0xd4f0db['enabled']===0x1||_[_0xc4ef('0x62')]([0x3eb,0x709],_0xd4f0db[_0xc4ef('0x59')]);});if(!_['isEmpty'](_0x58729e)){return _[_0xc4ef('0x41')](_0x58729e,function(_0x4d60bb){return _0x4d60bb[_0xc4ef('0x59')];});}else{return;}})[_0xc4ef('0x27')](function(_0x389f50){if(_0x389f50)_0x37d601=_0x389f50;if(_[_0xc4ef('0x62')](_0x37d601,0x64)){var _0x5b4c70=_['find'](_0x58729e,{'sectionId':0x64});return hasDefaultDashboard(_0x5b4c70)[_0xc4ef('0x27')](function(_0x597fee){return _[_0xc4ef('0x41')](_0x58729e,function(_0x318eaf){if(_0x318eaf[_0xc4ef('0x59')]===0x64){_0x318eaf[_0xc4ef('0x63')]=_0x597fee;}return _0x318eaf;});});}else{return;}})[_0xc4ef('0x27')](function(_0x52ea4b){if(_0x52ea4b)_0x58729e=_0x52ea4b;if(_[_0xc4ef('0x62')](_0x37d601,0x3eb)){var _0x47eb34=_[_0xc4ef('0x4b')](_0x58729e,{'sectionId':0x3eb});return getCustomDashboards(_0x47eb34)[_0xc4ef('0x27')](function(_0x35ddcd){return _[_0xc4ef('0x41')](_0x58729e,function(_0x2c4e73){if(_0x47eb34[_0xc4ef('0x64')]){if(_0x2c4e73['sectionId']===0x3eb){_0x2c4e73[_0xc4ef('0x63')]=_0x35ddcd;}}else{if(_0x2c4e73[_0xc4ef('0x59')]===0x64){if(!_0x2c4e73[_0xc4ef('0x63')]){_0x2c4e73['subsections']=[];}_0x2c4e73[_0xc4ef('0x63')]=_0x2c4e73[_0xc4ef('0x63')]['concat'](_0x35ddcd);}}return _0x2c4e73;});});}else{return;}})[_0xc4ef('0x27')](function(_0x4ce4e4){if(_0x4ce4e4)_0x58729e=_0x4ce4e4;if(_[_0xc4ef('0x62')](_0x37d601,0x709)){var _0x2d7c3b=_['find'](_0x58729e,{'sectionId':0x709});return getPlugins(_0x2d7c3b)[_0xc4ef('0x27')](function(_0xd75790){if(_0x2d7c3b[_0xc4ef('0x64')]){return _[_0xc4ef('0x41')](_0x58729e,function(_0x26a420){if(_0x26a420[_0xc4ef('0x59')]===0x709){_0x26a420[_0xc4ef('0x63')]=_0xd75790;}return _0x26a420;});}else{var _0x9adfb5={'sectionId':0x76c,'enabled':0x1,'subsections':_0xd75790};var _0x403da6=_[_0xc4ef('0x41')](_0x58729e);_0x403da6[_0xc4ef('0x65')](_0x9adfb5);return _0x403da6;}});}else{return;}})['then'](function(_0x35108f){if(_0x35108f)_0x58729e=_0x35108f;return _[_0xc4ef('0x3f')](_0x58729e,[_0xc4ef('0x64'),0x1]);})[_0xc4ef('0x27')](respondWithResult(_0x3ccdc5,null))[_0xc4ef('0x4c')](handleError(_0x3ccdc5,null));};function hasDefaultDashboard(_0x3a6e95){var _0x306c24=[0x65];return new BPromise(function(_0x412ca9,_0x312088){try{if(_0x3a6e95['autoAssociation']){_0x412ca9(_0x306c24);}else{return db[_0xc4ef('0x58')][_0xc4ef('0x66')]({'where':{'sectionId':_0x3a6e95['id']},'raw':!![]})[_0xc4ef('0x27')](function(_0x54078b){_0x54078b?_0x412ca9(_0x306c24):_0x412ca9();});}}catch(_0x1a54d7){_0x312088(_0x1a54d7);}});}function getCustomDashboards(_0x12b56a){var _0xf2a7e4=[];return new BPromise(function(_0x25f51a,_0x518553){try{if(_0x12b56a[_0xc4ef('0x57')]){return db['Dashboard']['findAll']({'raw':!![]})[_0xc4ef('0x27')](function(_0xc7abf2){_0xc7abf2[_0xc4ef('0x67')](function(_0x4a4b2a){_0xf2a7e4[_0xc4ef('0x65')](_0x4a4b2a['id']+0x1869f);});_0x25f51a(_0xf2a7e4);});}else{return db['UserProfileResource'][_0xc4ef('0x45')]({'where':{'sectionId':_0x12b56a['id']},'raw':!![]})[_0xc4ef('0x27')](function(_0x1df7ed){_0x1df7ed[_0xc4ef('0x67')](function(_0x230679){_0xf2a7e4['push'](_0x230679[_0xc4ef('0x68')]+0x1869f);});_0x25f51a(_0xf2a7e4);});}}catch(_0x3f992b){_0x518553(_0x3f992b);}});}function getPlugins(_0x185f4d){var _0x5bcbf2=[];return new BPromise(function(_0x45be44,_0x4b5d48){try{if(_0x185f4d['autoAssociation']){return db[_0xc4ef('0x69')]['findAll']({'raw':!![]})[_0xc4ef('0x27')](function(_0x45cf11){_0x45cf11[_0xc4ef('0x67')](function(_0x45bfdb){_0x5bcbf2[_0xc4ef('0x65')](_0x45bfdb['id']+0x15b38);});_0x45be44(_0x5bcbf2);});}else{return db[_0xc4ef('0x58')][_0xc4ef('0x45')]({'where':{'sectionId':_0x185f4d['id']},'raw':!![]})['then'](function(_0x53b037){_0x53b037[_0xc4ef('0x67')](function(_0x47c991){_0x5bcbf2[_0xc4ef('0x65')](_0x47c991[_0xc4ef('0x68')]+0x15b38);});_0x45be44(_0x5bcbf2);});}}catch(_0x167b76){_0x4b5d48(_0x167b76);}});}exports[_0xc4ef('0x6a')]=function(_0x4b039c,_0xfd8bbd){return db[_0xc4ef('0x2e')]['find']({'where':{'id':_0x4b039c[_0xc4ef('0x48')]['id']}})[_0xc4ef('0x27')](handleEntityNotFound(_0xfd8bbd,null))[_0xc4ef('0x27')](function(_0x1d08e4){if(_0x1d08e4){return db[_0xc4ef('0x54')][_0xc4ef('0x55')](function(_0x2f625b){return db['UserProfileSection'][_0xc4ef('0x45')]({'where':{'userProfileId':_0x4b039c[_0xc4ef('0x48')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x428ddf){if(_0x428ddf){return db[_0xc4ef('0x56')][_0xc4ef('0x28')]({'where':{'userProfileId':_0x4b039c[_0xc4ef('0x48')]['id'],'id':_[_0xc4ef('0x41')](_0x428ddf,function(_0xd7cf0b){return _0xd7cf0b['id'];})},'transaction':_0x2f625b});}})['then'](function(_0x575712){var _0x486bda=_[_0xc4ef('0x41')](_0x4b039c[_0xc4ef('0x4e')],function(_0x625a7c){_0x625a7c[_0xc4ef('0x5a')]=_0x4b039c[_0xc4ef('0x48')]['id'];return _0x625a7c;});return db[_0xc4ef('0x56')]['bulkCreate'](_0x486bda,{'raw':!![],'transaction':_0x2f625b});})[_0xc4ef('0x27')](function(_0x3dd3da){var _0x154549=_['filter'](_[_0xc4ef('0x41')](_0x3dd3da,function(_0x5c282d){return _0x5c282d[_0xc4ef('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x154549){return db[_0xc4ef('0x56')][_0xc4ef('0x45')]({'where':{'userProfileId':_0x4b039c['params']['id'],'sectionId':_[_0xc4ef('0x41')](_0x154549,function(_0x595c49){return _0x595c49[_0xc4ef('0x59')];})},'attributes':['id',_0xc4ef('0x59')],'raw':!![]})[_0xc4ef('0x27')](function(_0x213701){var _0x303f51=_[_0xc4ef('0x41')](_0x4b039c[_0xc4ef('0x4e')],function(_0x19d235){_0x19d235['userProfileId']=_0x4b039c[_0xc4ef('0x48')]['id'];return _0x19d235;});return db[_0xc4ef('0x58')][_0xc4ef('0x6b')](_0x303f51,{'raw':!![],'transaction':_0x2f625b});});}})[_0xc4ef('0x4c')](handleError(_0xfd8bbd,null));});}})[_0xc4ef('0x27')](function(_0x3e9d4e){var _0x4bd2bc=_[_0xc4ef('0x41')](_0x3e9d4e,function(_0x338243){return _0x338243[_0xc4ef('0x4f')]({'plain':!![]});});})[_0xc4ef('0x27')](respondWithResult(_0xfd8bbd,null))[_0xc4ef('0x4c')](handleError(_0xfd8bbd,null));};exports[_0xc4ef('0x6c')]=function(_0x5e28e6,_0x2cb874,_0x2316fc){return db[_0xc4ef('0x2e')][_0xc4ef('0x4b')]({'where':{'id':_0x5e28e6[_0xc4ef('0x48')]['id']}})[_0xc4ef('0x27')](handleEntityNotFound(_0x2cb874,null))['then'](function(_0x14e9e4){if(_0x14e9e4){return _0x14e9e4[_0xc4ef('0x6c')](_0x5e28e6[_0xc4ef('0x33')][_0xc4ef('0x60')]);}})['then'](respondWithStatusCode(_0x2cb874,null))['catch'](handleError(_0x2cb874,null));};exports[_0xc4ef('0x6d')]=function(_0x123d31,_0x48b115){var _0x5383e2={};if(!_0x123d31['query']['section'])throw new Error(_0xc4ef('0x6e'));if(!_0x123d31[_0xc4ef('0x33')][_0xc4ef('0x39')](_0xc4ef('0x3a'))){_0x5383e2[_0xc4ef('0x1f')]=qs[_0xc4ef('0x1f')](_0x123d31['query'][_0xc4ef('0x1f')]);_0x5383e2[_0xc4ef('0x22')]=qs['offset'](_0x123d31[_0xc4ef('0x33')][_0xc4ef('0x22')]);}return db[_0xc4ef('0x2e')]['find']({'where':{'id':_0x123d31['params']['id']}})[_0xc4ef('0x27')](function(_0x5781d2){if(!_0x5781d2)throw new Error(_0xc4ef('0x6f')+_0x123d31[_0xc4ef('0x48')]['id']);return db['UserProfile'][_0xc4ef('0x6d')](_0x123d31);})[_0xc4ef('0x27')](respondWithFilteredResult(_0x48b115,_0x5383e2))[_0xc4ef('0x4c')](handleError(_0x48b115,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index f604212..5fea4d4 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 _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 +var _0xcf71=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile','setMaxListeners'];(function(_0x2fd954,_0x508b80){var _0x94ad9f=function(_0x541fe7){while(--_0x541fe7){_0x2fd954['push'](_0x2fd954['shift']());}};_0x94ad9f(++_0x508b80);}(_0xcf71,0xba));var _0x1cf7=function(_0xcedf57,_0x335b10){_0xcedf57=_0xcedf57-0x0;var _0x35eccf=_0xcf71[_0xcedf57];return _0x35eccf;};'use strict';var EventEmitter=require(_0x1cf7('0x0'));var UserProfile=require(_0x1cf7('0x1'))['db'][_0x1cf7('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x1cf7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1cf7('0x4'),'afterDestroy':_0x1cf7('0x5')};function emitEvent(_0xcc31bf){return function(_0x21307d,_0x11e462,_0x14d074){UserProfileEvents[_0x1cf7('0x6')](_0xcc31bf+':'+_0x21307d['id'],_0x21307d);UserProfileEvents[_0x1cf7('0x6')](_0xcc31bf,_0x21307d);_0x14d074(null);};}for(var e in events){if(events[_0x1cf7('0x7')](e)){var event=events[e];UserProfile[_0x1cf7('0x8')](e,emitEvent(event));}}module[_0x1cf7('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index e573287..098a4ad 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 _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 +var _0xfe13=['extractedreports','reportId','metrics','charAt','toUpperCase','slice','Sequelize','QueryTypes','select','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','../../components/parsers/qs','raw','mergeResources','isEmpty','length','UserProfileSection','params','ignore','find','autoAssociation','push','model','all','rawAttributes','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','include','findAll','forEach','reportType','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','includeAll','Tag','Tags','color','tag','ThroughTags','true','chat','dataValues','fax','mail','openchannel','whatsapp','exports','filter','field','then','associatedResources','map','value','name','AnalyticExtractedReport','resourceId','type','catch','toLowerCase','squareprojects','childModel','SquareProject','SquareOdbc','SquareRecording','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','CmList','companies','CmCompany','globalcustomfields','CmCustomField','ChatQueue','chatwebsites','faxqueues','FaxQueue','FaxAccount','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','parentSections','Agents','membername','User','role','agent','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','musiconholds','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','user','Telephones','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','Sound','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin'];(function(_0x2ed98b,_0x131330){var _0x57db25=function(_0x4eb4ee){while(--_0x4eb4ee){_0x2ed98b['push'](_0x2ed98b['shift']());}};_0x57db25(++_0x131330);}(_0xfe13,0x10b));var _0x3fe1=function(_0x329437,_0x1de73a){_0x329437=_0x329437-0x0;var _0x3789d9=_0xfe13[_0x329437];return _0x3789d9;};'use strict';var _=require('lodash');var attributes=require('./userProfile.attributes');var squel=require('squel');module[_0x3fe1('0x0')]=function(_0x461405){var _0x7a2bba=_0x461405['models'];function _0x882e25(_0x1b1e99,_0x13df76){return new Promise(function(_0x30452d,_0x531ec4){if(!_0x13df76)return _0x30452d(null);var _0x55e425=_0x13df76[_0x3fe1('0x1')]?{[_0x13df76[_0x3fe1('0x1')][_0x3fe1('0x2')]]:_0x13df76[_0x3fe1('0x1')]['value']}:undefined;return _0x7a2bba[_0x1b1e99]['findAll']({'where':_0x55e425,'raw':!![]})[_0x3fe1('0x3')](function(_0x440e0d){_0x13df76[_0x3fe1('0x4')]=_[_0x3fe1('0x5')](_0x440e0d,'id');_0x30452d(_0x13df76);})['catch'](function(_0x453335){_0x531ec4(_0x453335);});});}function _0x45beb8(_0x2f4f80,_0x2ccda6){return new Promise(function(_0x3e5dd2,_0x533adc){var _0x480a29=_0x2f4f80['filter']?{[_0x2f4f80[_0x3fe1('0x1')][_0x3fe1('0x2')]]:_0x2f4f80[_0x3fe1('0x1')][_0x3fe1('0x6')]}:undefined;return _0x7a2bba[_0x2f4f80['model']]['findAll']({'where':_0x480a29,'raw':!![]})[_0x3fe1('0x3')](function(_0x16c623){_0x2ccda6[_0x3fe1('0x4')]=_[_0x3fe1('0x5')](_0x16c623,function(_0x522862){return _0x522862[_0x3fe1('0x7')];});_0x3e5dd2(_0x2ccda6);})['catch'](function(_0x4c18d7){_0x533adc(_0x4c18d7);});});}function _0x290924(_0x2c734e,_0xed8388,_0x3ca36d){if(!_0xed8388)return Promise['resolve'](null);return new Promise(function(_0x1fe99e,_0x4c7aca){return _0x7a2bba['UserProfileResource']['findAll']({'where':{'sectionId':_0xed8388['id']},'raw':!![]})['then'](function(_0x4ac09f){if(_0x2c734e[_0x3fe1('0x2')]&&_0x2c734e[_0x3fe1('0x2')]!=='id'){_0xed8388['associatedResources']=_[_0x3fe1('0x5')](_0x4ac09f,function(_0x3a5c8d){return _0x3a5c8d[_0x2c734e[_0x3fe1('0x2')]];});}else{if(_0x3ca36d===_0x3fe1('0x8')){_0xed8388[_0x3fe1('0x4')]=_[_0x3fe1('0x5')](_0x4ac09f,function(_0x273a9e){return{'id':_0x273a9e[_0x3fe1('0x9')],'type':_0x273a9e[_0x3fe1('0xa')]};});}else{_0xed8388[_0x3fe1('0x4')]=_['map'](_0x4ac09f,function(_0x25e04b){return _0x25e04b[_0x3fe1('0x9')];});}}_0x1fe99e(_0xed8388);})[_0x3fe1('0xb')](function(_0x154b78){_0x4c7aca(_0x154b78);});});}function _0x26b678(_0x4f9114,_0x3e22c0){var _0x3ab3ab={'parentSections':[]};switch(_0x4f9114[_0x3fe1('0xc')]()){case _0x3fe1('0xd'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0xf');break;case'odbc':_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x10');break;case'squarerecordings':_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x11');_0x3ab3ab['parentSections']=[{'name':'SquareProjects','field':_0x3fe1('0x7'),'foreignKey':_0x3fe1('0x12')}];break;case _0x3fe1('0x13'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x14');break;case _0x3fe1('0x15'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x16');_0x3ab3ab['parentSections']=[{'name':_0x3fe1('0x17'),'field':'id','foreignKey':_0x3fe1('0x18')}];break;case'lists':_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x19');break;case _0x3fe1('0x1a'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x1b');break;case _0x3fe1('0x1c'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x1d');break;case'chatqueues':_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x1e');break;case _0x3fe1('0x1f'):_0x3ab3ab[_0x3fe1('0xe')]='ChatWebsite';break;case _0x3fe1('0x20'):_0x3ab3ab['childModel']=_0x3fe1('0x21');break;case'faxaccounts':_0x3ab3ab['childModel']=_0x3fe1('0x22');break;case'inboundroutes':case'internalroutes':case _0x3fe1('0x23'):_0x3ab3ab['childModel']='VoiceExtension';break;case _0x3fe1('0x24'):_0x3ab3ab['childModel']=_0x3fe1('0x25');break;case _0x3fe1('0x26'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x27');break;case _0x3fe1('0x28'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x29');_0x3ab3ab[_0x3fe1('0x2a')]=[{'name':_0x3fe1('0x2b'),'field':'name','foreignKey':_0x3fe1('0x2c'),'model':_0x3fe1('0x2d'),'filter':{'field':_0x3fe1('0x2e'),'value':[_0x3fe1('0x2f')]}},{'name':'Telephones','field':_0x3fe1('0x7'),'foreignKey':_0x3fe1('0x2c'),'model':_0x3fe1('0x2d'),'filter':{'field':_0x3fe1('0x2e'),'value':[_0x3fe1('0x30')]}},{'name':_0x3fe1('0x31'),'field':'name','foreignKey':_0x3fe1('0x32'),'model':_0x3fe1('0x33'),'filter':{'field':_0x3fe1('0xa'),'value':[_0x3fe1('0x34')]}},{'name':_0x3fe1('0x35'),'field':_0x3fe1('0x7'),'foreignKey':_0x3fe1('0x32'),'model':_0x3fe1('0x33'),'filter':{'field':_0x3fe1('0xa'),'value':['outbound']}}];break;case _0x3fe1('0x36'):_0x3ab3ab[_0x3fe1('0xe')]='VoiceMusicOnHold';break;case _0x3fe1('0x37'):_0x3ab3ab['childModel']=_0x3fe1('0x38');break;case'voiceprefixes':_0x3ab3ab['childModel']=_0x3fe1('0x39');break;case _0x3fe1('0x3a'):_0x3ab3ab[_0x3fe1('0xe')]='Campaign';break;case _0x3fe1('0x3b'):_0x3ab3ab['childModel']=_0x3fe1('0x3c');break;case _0x3fe1('0x3d'):_0x3ab3ab['childModel']='MailAccount';break;case _0x3fe1('0x3e'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x3f');break;case _0x3fe1('0x40'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x41');break;case _0x3fe1('0x42'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x43');break;case _0x3fe1('0x44'):_0x3ab3ab['childModel']='SmsQueue';break;case _0x3fe1('0x45'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x46');break;case _0x3fe1('0x47'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x48');break;case _0x3fe1('0x49'):_0x3ab3ab['childModel']='WhatsappAccount';break;case _0x3fe1('0x4a'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x4b');break;case _0x3fe1('0x4c'):case _0x3fe1('0x4d'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x33');if(_0x3e22c0){_0x3ab3ab[_0x3fe1('0x2a')]=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case _0x3fe1('0x4e'):case _0x3fe1('0x4f'):case _0x3fe1('0x50'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x2d');if(_0x3e22c0){_0x3ab3ab[_0x3fe1('0x2a')]=[{'name':_0x3fe1('0x51'),'filter':{'field':_0x3fe1('0x2e'),'value':['admin',_0x3fe1('0x52')]},'ignore':!![]},{'name':_0x3fe1('0x2b')},{'name':_0x3fe1('0x53')}];}break;case'zendeskaccounts':_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x54');break;case'salesforceaccounts':_0x3ab3ab['childModel']=_0x3fe1('0x55');break;case _0x3fe1('0x56'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x57');break;case _0x3fe1('0x58'):_0x3ab3ab[_0x3fe1('0xe')]='SugarcrmAccount';break;case _0x3fe1('0x59'):_0x3ab3ab['childModel']=_0x3fe1('0x5a');break;case _0x3fe1('0x5b'):_0x3ab3ab[_0x3fe1('0xe')]='ZohoAccount';break;case _0x3fe1('0x5c'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x2d');break;case _0x3fe1('0x5d'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x5e');break;case _0x3fe1('0x5f'):_0x3ab3ab[_0x3fe1('0xe')]='Disposition';break;case _0x3fe1('0x60'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x61');break;case _0x3fe1('0x62'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x63');break;case _0x3fe1('0x64'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x65');break;case _0x3fe1('0x66'):_0x3ab3ab['childModel']=_0x3fe1('0x67');break;case'sounds':_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x68');break;case'tags':_0x3ab3ab[_0x3fe1('0xe')]='Tag';break;case _0x3fe1('0x69'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x6a');break;case _0x3fe1('0x6b'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x6c');break;case _0x3fe1('0x6d'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x6e');break;case _0x3fe1('0x6f'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x70');break;case _0x3fe1('0x71'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x72');break;case _0x3fe1('0x73'):_0x3ab3ab[_0x3fe1('0xe')]=_0x3fe1('0x8');_0x3ab3ab[_0x3fe1('0x2a')]=[{'name':'Reports','field':'id','foreignKey':_0x3fe1('0x74')}];break;case _0x3fe1('0x75'):_0x3ab3ab[_0x3fe1('0xe')]='AnalyticMetric';break;}return _0x3ab3ab;}function _0x297e7f(_0x38a6fa,_0x213c32){var _0x177693=_0x38a6fa[_0x3fe1('0x76')](0x0)[_0x3fe1('0x77')]()+_0x38a6fa[_0x3fe1('0x78')](0x1);var _0x3429b7={'type':_0x7a2bba[_0x3fe1('0x79')][_0x3fe1('0x7a')]['SELECT'],'raw':!![]};return new Promise(function(_0xdba0c4,_0x49fa04){var _0x5ca35c=squel[_0x3fe1('0x7b')]()[_0x3fe1('0x2')]('ui.'+_0x177693+_0x3fe1('0x7c'),'id')['field'](_0x3fe1('0x7d'))[_0x3fe1('0x7e')](_0x3fe1('0x7f')+_0x38a6fa+_0x3fe1('0x80'),'ui')[_0x3fe1('0x81')](_0x3fe1('0x82'),_0x213c32['id']);return _0x7a2bba[_0x3fe1('0x83')][_0x3fe1('0x84')](_0x5ca35c[_0x3fe1('0x85')](),_0x3429b7)[_0x3fe1('0x3')](function(_0x4cdca2){_0x213c32[_0x177693+_0x3fe1('0x86')]=_0x4cdca2;_0xdba0c4(_0x4cdca2);})[_0x3fe1('0xb')](function(_0x378787){_0x49fa04(_0x378787);});});}return _0x461405[_0x3fe1('0x87')](_0x3fe1('0x88'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x4810bc){var _0x55c648=require(_0x3fe1('0x89'));var _0x505eb1={'raw':_0x4810bc[_0x3fe1('0x84')][_0x3fe1('0x8a')],'where':{}};var _0x1d49ac={};var _0x424d29={'count':0x0,'rows':[]};var _0x5c0335=_0x4810bc['query']['section'];var _0x3b0e07=_0x4810bc[_0x3fe1('0x84')][_0x3fe1('0x8b')]||![];var _0x2186cd=_0x26b678(_0x5c0335,_0x3b0e07);if(!_0x2186cd['childModel'])throw new Error('Invalid\x20section\x20\x27'+_0x5c0335+'\x27');var _0x4044ab=[{'name':_0x5c0335}];if(!_[_0x3fe1('0x8c')](_0x2186cd[_0x3fe1('0x2a')]))_0x4044ab=_0x2186cd[_0x3fe1('0x2a')];var _0xd21668=[];for(var _0x1fef0e=0x0;_0x1fef0e<_0x4044ab[_0x3fe1('0x8d')];_0x1fef0e++){_0xd21668['push'](_0x7a2bba[_0x3fe1('0x8e')]['find']({'where':{'userProfileId':_0x4810bc[_0x3fe1('0x8f')]['id'],'name':_0x4044ab[_0x1fef0e][_0x3fe1('0x7')]},'raw':!![]}));}return Promise['all'](_0xd21668)[_0x3fe1('0x3')](function(_0x237bd0){var _0x373dd2=_[_0x3fe1('0x1')](_0x237bd0,function(_0x3a919f){return _0x3a919f?_0x3a919f:undefined;});var _0x1f280f=_[_0x3fe1('0x1')](_0x4044ab,[_0x3fe1('0x90'),!![]]);var _0x1eddb9=_['isEmpty'](_0x373dd2)&&_['isEmpty'](_0x1f280f)?null:_['union'](_0x1f280f,_0x373dd2);if(!_0x1eddb9)return null;var _0x47578c=[];for(var _0x50a961=0x0;_0x50a961<_0x1eddb9['length'];_0x50a961++){var _0x4e00a1=_[_0x3fe1('0x91')](_0x4044ab,function(_0x4a2d6e){return _0x1eddb9[_0x50a961]?_0x4a2d6e[_0x3fe1('0x7')]===_0x1eddb9[_0x50a961][_0x3fe1('0x7')]:null;});if(_0x4e00a1){if(_0x1eddb9[_0x50a961]['ignore']){_0x47578c['push'](_0x882e25(_0x2186cd[_0x3fe1('0xe')],_0x1eddb9[_0x50a961]));}else{if(!_0x1eddb9[_0x50a961][_0x3fe1('0x92')]){_0x47578c[_0x3fe1('0x93')](_0x290924(_0x4e00a1,_0x1eddb9[_0x50a961],_0x2186cd[_0x3fe1('0xe')]));}else{if(_0x4e00a1[_0x3fe1('0x94')]){_0x47578c[_0x3fe1('0x93')](_0x45beb8(_0x4e00a1,_0x1eddb9[_0x50a961]));}}}}}return Promise[_0x3fe1('0x95')](_0x47578c);})[_0x3fe1('0x3')](function(_0x16a4bd){var _0x4c0ac4=_0x16a4bd;var _0x52524a=null;if(_0x4c0ac4){_0x52524a=_0x4c0ac4[_0x3fe1('0x8d')]===0x1?_0x4c0ac4[0x0]:null;}if(!_0x52524a&&!_0x4c0ac4)return _0x424d29;var _0x30ceab=_0x7a2bba[_0x2186cd['childModel']][_0x3fe1('0x96')];_0x1d49ac[_0x3fe1('0x94')]=_[_0x3fe1('0x97')](_0x30ceab);_0x1d49ac['query']=_['keys'](_0x4810bc[_0x3fe1('0x84')]);_0x1d49ac[_0x3fe1('0x98')]=_[_0x3fe1('0x99')](_0x1d49ac['model'],_0x1d49ac[_0x3fe1('0x84')]);_0x505eb1['attributes']=_[_0x3fe1('0x99')](_0x1d49ac['model'],_0x55c648['fields'](_0x4810bc[_0x3fe1('0x84')][_0x3fe1('0x9a')]));_0x505eb1['attributes']=_0x505eb1[_0x3fe1('0x9b')][_0x3fe1('0x8d')]?_0x505eb1[_0x3fe1('0x9b')]:_0x1d49ac[_0x3fe1('0x94')];if(!_0x4810bc[_0x3fe1('0x84')][_0x3fe1('0x9c')](_0x3fe1('0x9d'))){_0x505eb1[_0x3fe1('0x9e')]=_0x55c648[_0x3fe1('0x9e')](_0x4810bc['query'][_0x3fe1('0x9e')]);_0x505eb1[_0x3fe1('0x9f')]=_0x55c648['offset'](_0x4810bc['query'][_0x3fe1('0x9f')]);}_0x505eb1[_0x3fe1('0xa0')]=_0x55c648[_0x3fe1('0xa1')](_0x4810bc[_0x3fe1('0x84')]['sort']);_0x505eb1[_0x3fe1('0x81')]=_0x55c648['filters'](_[_0x3fe1('0xa2')](_0x4810bc[_0x3fe1('0x84')],_0x1d49ac[_0x3fe1('0x98')]));if(_0x4810bc[_0x3fe1('0x84')][_0x3fe1('0x1')]){_0x505eb1[_0x3fe1('0x81')]=_[_0x3fe1('0xa3')](_0x505eb1[_0x3fe1('0x81')],{'$or':_[_0x3fe1('0x5')](_0x30ceab,function(_0x5a3cc4){if(_0x5a3cc4['type'][_0x3fe1('0xa4')]!==_0x3fe1('0xa5')){var _0x106d63={};_0x106d63[_0x5a3cc4[_0x3fe1('0x2')]]={'$like':'%'+_0x4810bc[_0x3fe1('0x84')][_0x3fe1('0x1')]+'%'};return _0x106d63;}})});}var _0x1cab83=[];var _0x3b402e=null;var _0x103fad={};if(_0x52524a){_0x3b402e=_[_0x3fe1('0x91')](_0x4044ab,[_0x3fe1('0x7'),_0x52524a[_0x3fe1('0x7')]]);if(_0x3b402e[_0x3fe1('0x2')]){_0x103fad={};if(_0x2186cd[_0x3fe1('0xe')]==='AnalyticExtractedReport'){_0x103fad[_0x3b402e['foreignKey']]=_[_0x3fe1('0x5')](_0x52524a[_0x3fe1('0x4')],'id');}else{_0x103fad[_0x3b402e['foreignKey']]=_0x52524a[_0x3fe1('0x4')];}_0x1cab83[_0x3fe1('0x93')](_0x103fad);}else{_0x505eb1['where']['id']=_0x52524a[_0x3fe1('0x4')];}}else{for(var _0x25ac89=0x0;_0x25ac89<_0x4c0ac4[_0x3fe1('0x8d')];_0x25ac89++){_0x3b402e=_[_0x3fe1('0x91')](_0x4044ab,[_0x3fe1('0x7'),_0x4c0ac4[_0x25ac89][_0x3fe1('0x7')]]);if(_0x3b402e[_0x3fe1('0x2')]){_0x103fad={};_0x103fad[_0x3b402e[_0x3fe1('0xa6')]]=_0x4c0ac4[_0x25ac89][_0x3fe1('0x4')];_0x1cab83['push'](_0x103fad);}else{if(!_0x505eb1['where']['id'])_0x505eb1[_0x3fe1('0x81')]['id']=[];_0x4c0ac4[_0x25ac89]['associatedResources']['forEach'](function(_0x15d334){_0x505eb1[_0x3fe1('0x81')]['id']['push'](_0x15d334);});}}}if(!_['isEmpty'](_0x1cab83)){_0x505eb1[_0x3fe1('0x81')]=_[_0x3fe1('0xa3')](_0x505eb1['where'],{'$and':{'$or':_0x1cab83}});}_0x505eb1=_[_0x3fe1('0xa3')]({},_0x505eb1,_0x4810bc['options']);if(_0x52524a&&!_0x52524a[_0x3fe1('0x92')]&&_0x2186cd[_0x3fe1('0xe')]==='AnalyticExtractedReport'){if(_0x4810bc[_0x3fe1('0x84')]['includeAll']){_0x505eb1[_0x3fe1('0xa7')]=[{'all':!![]}];}return _0x7a2bba[_0x2186cd[_0x3fe1('0xe')]][_0x3fe1('0xa8')](_0x505eb1)[_0x3fe1('0x3')](function(_0x52ddce){var _0x363a40=[];_0x52ddce[_0x3fe1('0xa9')](function(_0x4f51d3){var _0x1e519e;switch(_0x4f51d3[_0x3fe1('0xaa')]){case'default':_0x1e519e=_[_0x3fe1('0x91')](_0x52524a['associatedResources'],function(_0x10f908){return _0x10f908['id']===_0x4f51d3[_0x3fe1('0x74')]&&_0x10f908['type']==='DefaultReports';});break;case _0x3fe1('0xab'):_0x1e519e=_[_0x3fe1('0x91')](_0x52524a[_0x3fe1('0x4')],function(_0x5d7492){return _0x5d7492['id']===_0x4f51d3[_0x3fe1('0x74')]&&_0x5d7492[_0x3fe1('0xa')]===_0x3fe1('0xac');});break;}if(_0x1e519e)_0x363a40[_0x3fe1('0x93')](_0x4f51d3);});_0x424d29[_0x3fe1('0xad')]=_0x363a40['length'];_0x424d29[_0x3fe1('0xae')]=_0x363a40;return _0x424d29;});}else{if(!_[_0x3fe1('0x8c')](_0x4810bc[_0x3fe1('0x84')][_0x3fe1('0xaf')])){_0x505eb1['where']['id']=_0x505eb1[_0x3fe1('0x81')]['id']?_['intersection'](_0x505eb1[_0x3fe1('0x81')]['id'],_0x4810bc[_0x3fe1('0x84')][_0x3fe1('0xaf')]):_0x4810bc[_0x3fe1('0x84')][_0x3fe1('0xaf')];if(_0x4810bc['query'][_0x3fe1('0xb0')]){_0x505eb1['order']=_0x4810bc[_0x3fe1('0x84')][_0x3fe1('0xb0')];}}if(_0x4810bc[_0x3fe1('0x84')][_0x3fe1('0xb1')]){_0x505eb1['where']=_[_0x3fe1('0xa3')](_0x505eb1[_0x3fe1('0x81')],{'$and':_0x4810bc[_0x3fe1('0x84')][_0x3fe1('0xb1')]});}return _0x7a2bba[_0x2186cd[_0x3fe1('0xe')]]['count']({'where':_0x505eb1[_0x3fe1('0x81')]})['then'](function(_0x4df7c2){_0x424d29['count']=_0x4df7c2;if(_0x4810bc['query'][_0x3fe1('0xb2')]){if(_0x2186cd['childModel']===_0x3fe1('0x16')){_0x505eb1['include']=[{'model':_0x7a2bba[_0x3fe1('0xb3')],'as':_0x3fe1('0xb4'),'attributes':['id',_0x3fe1('0x7'),_0x3fe1('0xb5')],'required':_0x4810bc['query'][_0x3fe1('0xb6')]?!![]:![]},{'model':_0x7a2bba[_0x3fe1('0xb3')],'as':_0x3fe1('0xb7'),'attributes':['id',_0x3fe1('0x7'),_0x3fe1('0xb5')],'through':_0x4810bc['query'][_0x3fe1('0xb6')]?{'attributes':[],'where':{'TagId':_0x4810bc['query'][_0x3fe1('0xb6')]||undefined}}:{},'required':_0x4810bc[_0x3fe1('0x84')][_0x3fe1('0xb6')]?!![]:![]}];}else{_0x505eb1[_0x3fe1('0xa7')]=[{'all':!![]}];}}return _0x7a2bba[_0x2186cd['childModel']][_0x3fe1('0xa8')](_0x505eb1);})['then'](function(_0xfe9351){_0x424d29[_0x3fe1('0xae')]=_0xfe9351;if(_0x5c0335===_0x3fe1('0x2b')&&_0x4810bc[_0x3fe1('0x84')]['openTabs']===_0x3fe1('0xb8')){var _0x76cfc2=[];for(var _0x485b99=0x0;_0x485b99<_0x424d29['rows'][_0x3fe1('0x8d')];_0x485b99++){_0x76cfc2[_0x3fe1('0x93')](_0x297e7f(_0x3fe1('0xb9'),_0x424d29[_0x3fe1('0xae')][_0x485b99][_0x3fe1('0xba')]));_0x76cfc2[_0x3fe1('0x93')](_0x297e7f('sms',_0x424d29[_0x3fe1('0xae')][_0x485b99][_0x3fe1('0xba')]));_0x76cfc2['push'](_0x297e7f(_0x3fe1('0xbb'),_0x424d29[_0x3fe1('0xae')][_0x485b99][_0x3fe1('0xba')]));_0x76cfc2[_0x3fe1('0x93')](_0x297e7f(_0x3fe1('0xbc'),_0x424d29['rows'][_0x485b99]['dataValues']));_0x76cfc2[_0x3fe1('0x93')](_0x297e7f(_0x3fe1('0xbd'),_0x424d29[_0x3fe1('0xae')][_0x485b99]['dataValues']));_0x76cfc2[_0x3fe1('0x93')](_0x297e7f(_0x3fe1('0xbe'),_0x424d29['rows'][_0x485b99]['dataValues']));}return Promise[_0x3fe1('0x95')](_0x76cfc2)['then'](function(){return _0x424d29;});}return _0x424d29;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index cd6b768..0940729 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 _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 +var _0x1883=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','then','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserProfile,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x358321,_0x1a50ae){var _0xd03c42=function(_0x40ba75){while(--_0x40ba75){_0x358321['push'](_0x358321['shift']());}};_0xd03c42(++_0x1a50ae);}(_0x1883,0xab));var _0x3188=function(_0x943413,_0x4c18f2){_0x943413=_0x943413-0x0;var _0x50d5d9=_0x1883[_0x943413];return _0x50d5d9;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var moment=require(_0x3188('0x2'));var BPromise=require(_0x3188('0x3'));var rs=require(_0x3188('0x4'));var fs=require('fs');var Redis=require(_0x3188('0x5'));var db=require(_0x3188('0x6'))['db'];var utils=require(_0x3188('0x7'));var logger=require(_0x3188('0x8'))(_0x3188('0x9'));var config=require(_0x3188('0xa'));var jayson=require(_0x3188('0xb'));var client=jayson[_0x3188('0xc')][_0x3188('0xd')]({'port':0x232a});config[_0x3188('0xe')]=_[_0x3188('0xf')](config[_0x3188('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x3188('0x10'))(new Redis(config[_0x3188('0xe')]));require('./userProfile.socket')[_0x3188('0x11')](socket);function respondWithRpcPromise(_0x5b7f47,_0xc6040,_0x34fc82){return new BPromise(function(_0x209e31,_0x43b69){return client['request'](_0x5b7f47,_0x34fc82)[_0x3188('0x12')](function(_0x2cdcb2){logger['info']('UserProfile,\x20%s,\x20%s',_0xc6040,_0x3188('0x13'));logger[_0x3188('0x14')](_0x3188('0x15'),_0xc6040,_0x3188('0x13'),JSON[_0x3188('0x16')](_0x2cdcb2));if(_0x2cdcb2[_0x3188('0x17')]){if(_0x2cdcb2['error'][_0x3188('0x18')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0xc6040,_0x2cdcb2[_0x3188('0x17')]['message']);return _0x43b69(_0x2cdcb2['error'][_0x3188('0x19')]);}logger[_0x3188('0x17')](_0x3188('0x1a'),_0xc6040,_0x2cdcb2[_0x3188('0x17')][_0x3188('0x19')]);return _0x209e31(_0x2cdcb2[_0x3188('0x17')]['message']);}else{logger[_0x3188('0x1b')](_0x3188('0x1a'),_0xc6040,_0x3188('0x13'));_0x209e31(_0x2cdcb2[_0x3188('0x1c')][_0x3188('0x19')]);}})[_0x3188('0x1d')](function(_0xac7f48){logger[_0x3188('0x17')]('UserProfile,\x20%s,\x20%s',_0xc6040,_0xac7f48);_0x43b69(_0xac7f48);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index f18c2f6..6131272 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 _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 +var _0x6bff=['save','remove','update','emit','removeListener','register','length','./userProfile.events'];(function(_0x294c42,_0xbd23ad){var _0x4c73d9=function(_0x4f140e){while(--_0x4f140e){_0x294c42['push'](_0x294c42['shift']());}};_0x4c73d9(++_0xbd23ad);}(_0x6bff,0x67));var _0xf6bf=function(_0x40a04c,_0x1efbab){_0x40a04c=_0x40a04c-0x0;var _0x45be51=_0x6bff[_0x40a04c];return _0x45be51;};'use strict';var UserProfileEvents=require(_0xf6bf('0x0'));var events=[_0xf6bf('0x1'),_0xf6bf('0x2'),_0xf6bf('0x3')];function createListener(_0x165d3f,_0xf8c6be){return function(_0x462ce0){_0xf8c6be[_0xf6bf('0x4')](_0x165d3f,_0x462ce0);};}function removeListener(_0x5c3371,_0x4fbf28){return function(){UserProfileEvents[_0xf6bf('0x5')](_0x5c3371,_0x4fbf28);};}exports[_0xf6bf('0x6')]=function(_0x440c30){for(var _0x58d071=0x0,_0x28cf05=events[_0xf6bf('0x7')];_0x58d071<_0x28cf05;_0x58d071++){var _0xf47a85=events[_0x58d071];var _0x2b6347=createListener('userProfile:'+_0xf47a85,_0x440c30);UserProfileEvents['on'](_0xf47a85,_0x2b6347);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index c8d2cba..d62a534 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 _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 +var _0x2379=['post','update','delete','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0x4c2af9,_0x4c241d){var _0x45d4a5=function(_0x36fdf4){while(--_0x36fdf4){_0x4c2af9['push'](_0x4c2af9['shift']());}};_0x45d4a5(++_0x4c241d);}(_0x2379,0x82));var _0x9237=function(_0x2cad0c,_0x5b9dc0){_0x2cad0c=_0x2cad0c-0x0;var _0x16aae0=_0x2379[_0x2cad0c];return _0x16aae0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x9237('0x0'));var express=require(_0x9237('0x1'));var router=express[_0x9237('0x2')]();var fs_extra=require(_0x9237('0x3'));var auth=require(_0x9237('0x4'));var interaction=require(_0x9237('0x5'));var config=require(_0x9237('0x6'));var controller=require(_0x9237('0x7'));router[_0x9237('0x8')]('/',auth[_0x9237('0x9')](),controller[_0x9237('0xa')]);router['get']('/describe',auth[_0x9237('0x9')](),controller[_0x9237('0xb')]);router[_0x9237('0x8')](_0x9237('0xc'),auth[_0x9237('0x9')](),controller[_0x9237('0xd')]);router[_0x9237('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x9237('0xc'),auth['isAuthenticated'](),controller[_0x9237('0xf')]);router[_0x9237('0x10')](_0x9237('0xc'),auth[_0x9237('0x9')](),controller['destroy']);module[_0x9237('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 5c5fe1a..c0d3ebb 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 _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 +var _0x0cba=['sequelize','exports','INTEGER'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x0cba,0x1b6));var _0xa0cb=function(_0x53056c,_0x1d56a9){_0x53056c=_0x53056c-0x0;var _0x5cec88=_0x0cba[_0x53056c];return _0x5cec88;};'use strict';var Sequelize=require(_0xa0cb('0x0'));module[_0xa0cb('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xa0cb('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 4330aee..2ec4a3d 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 _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 +var _0x2a07=['index','map','UserProfileResource','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','catch','show','params','fields','includeAll','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','error','name','send'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2a07,0x74));var _0x72a0=function(_0x2873d2,_0x3178b6){_0x2873d2=_0x2873d2-0x0;var _0x31b7c1=_0x2a07[_0x2873d2];return _0x31b7c1;};'use strict';var emlformat=require(_0x72a0('0x0'));var rimraf=require(_0x72a0('0x1'));var zipdir=require(_0x72a0('0x2'));var jsonpatch=require(_0x72a0('0x3'));var rp=require(_0x72a0('0x4'));var moment=require('moment');var BPromise=require(_0x72a0('0x5'));var Mustache=require(_0x72a0('0x6'));var util=require(_0x72a0('0x7'));var path=require(_0x72a0('0x8'));var sox=require(_0x72a0('0x9'));var csv=require(_0x72a0('0xa'));var ejs=require(_0x72a0('0xb'));var fs=require('fs');var fs_extra=require(_0x72a0('0xc'));var _=require(_0x72a0('0xd'));var squel=require(_0x72a0('0xe'));var crypto=require(_0x72a0('0xf'));var jsforce=require(_0x72a0('0x10'));var deskjs=require(_0x72a0('0x11'));var toCsv=require(_0x72a0('0xa'));var querystring=require(_0x72a0('0x12'));var Papa=require(_0x72a0('0x13'));var Redis=require('ioredis');var authService=require(_0x72a0('0x14'));var qs=require(_0x72a0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a0('0x16'));var logger=require(_0x72a0('0x17'))(_0x72a0('0x18'));var utils=require(_0x72a0('0x19'));var config=require(_0x72a0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a0('0x1b'))['db'];function respondWithStatusCode(_0x335b9f,_0x123ca4){_0x123ca4=_0x123ca4||0xcc;return function(_0xf91a82){if(_0xf91a82){return _0x335b9f[_0x72a0('0x1c')](_0x123ca4);}return _0x335b9f[_0x72a0('0x1d')](_0x123ca4)[_0x72a0('0x1e')]();};}function respondWithResult(_0x5e0b5f,_0x4930c5){_0x4930c5=_0x4930c5||0xc8;return function(_0xe103dc){if(_0xe103dc){return _0x5e0b5f[_0x72a0('0x1d')](_0x4930c5)[_0x72a0('0x1f')](_0xe103dc);}};}function respondWithFilteredResult(_0x1d1133,_0x23b001){return function(_0x3f3d62){if(_0x3f3d62){var _0x4ab55e=typeof _0x23b001[_0x72a0('0x20')]===_0x72a0('0x21')&&typeof _0x23b001[_0x72a0('0x22')]===_0x72a0('0x21');var _0x2d1e95=_0x3f3d62['count'];var _0x100d8f=_0x4ab55e?0x0:_0x23b001[_0x72a0('0x20')];var _0x131b73=_0x4ab55e?_0x3f3d62['count']:_0x23b001[_0x72a0('0x20')]+_0x23b001[_0x72a0('0x22')];var _0x30899b;if(_0x131b73>=_0x2d1e95){_0x131b73=_0x2d1e95;_0x30899b=0xc8;}else{_0x30899b=0xce;}_0x1d1133[_0x72a0('0x1d')](_0x30899b);return _0x1d1133['set'](_0x72a0('0x23'),_0x100d8f+'-'+_0x131b73+'/'+_0x2d1e95)['json'](_0x3f3d62);}return null;};}function patchUpdates(_0x3d0607){return function(_0x315413){try{jsonpatch[_0x72a0('0x24')](_0x315413,_0x3d0607,!![]);}catch(_0x5c7479){return BPromise[_0x72a0('0x25')](_0x5c7479);}return _0x315413[_0x72a0('0x26')]();};}function saveUpdates(_0x1d22d8,_0x3d1965){return function(_0x5d6145){if(_0x5d6145){return _0x5d6145[_0x72a0('0x27')](_0x1d22d8)[_0x72a0('0x28')](function(_0x1ddd54){return _0x1ddd54;});}return null;};}function removeEntity(_0x23b918,_0x3022b0){return function(_0x174b1b){if(_0x174b1b){return _0x174b1b['destroy']()['then'](function(){_0x23b918[_0x72a0('0x1d')](0xcc)[_0x72a0('0x1e')]();});}};}function handleEntityNotFound(_0x123df4,_0x1504ed){return function(_0xf5cb49){if(!_0xf5cb49){_0x123df4[_0x72a0('0x1c')](0x194);}return _0xf5cb49;};}function handleError(_0xa5bda0,_0x15922a){_0x15922a=_0x15922a||0x1f4;return function(_0xee99e2){logger[_0x72a0('0x29')](_0xee99e2['stack']);if(_0xee99e2[_0x72a0('0x2a')]){delete _0xee99e2[_0x72a0('0x2a')];}_0xa5bda0[_0x72a0('0x1d')](_0x15922a)[_0x72a0('0x2b')](_0xee99e2);};}exports[_0x72a0('0x2c')]=function(_0x177a3a,_0x432179){var _0x12eda2={},_0x23c96a={},_0x916733={'count':0x0,'rows':[]};var _0x4ba037=_[_0x72a0('0x2d')](db[_0x72a0('0x2e')][_0x72a0('0x2f')],function(_0xfbe9b3){return{'name':_0xfbe9b3[_0x72a0('0x30')],'type':_0xfbe9b3[_0x72a0('0x31')][_0x72a0('0x32')]};});_0x23c96a['model']=_[_0x72a0('0x2d')](_0x4ba037,_0x72a0('0x2a'));_0x23c96a[_0x72a0('0x33')]=_[_0x72a0('0x34')](_0x177a3a[_0x72a0('0x33')]);_0x23c96a[_0x72a0('0x35')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],_0x23c96a['query']);_0x12eda2[_0x72a0('0x38')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],qs['fields'](_0x177a3a[_0x72a0('0x33')]['fields']));_0x12eda2[_0x72a0('0x38')]=_0x12eda2[_0x72a0('0x38')][_0x72a0('0x39')]?_0x12eda2[_0x72a0('0x38')]:_0x23c96a[_0x72a0('0x37')];if(!_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3a')](_0x72a0('0x3b'))){_0x12eda2[_0x72a0('0x22')]=qs[_0x72a0('0x22')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x22')]);_0x12eda2['offset']=qs[_0x72a0('0x20')](_0x177a3a['query'][_0x72a0('0x20')]);}_0x12eda2[_0x72a0('0x3c')]=qs[_0x72a0('0x3d')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3d')]);_0x12eda2[_0x72a0('0x3e')]=qs[_0x72a0('0x35')](_[_0x72a0('0x3f')](_0x177a3a[_0x72a0('0x33')],_0x23c96a['filters']),_0x4ba037);if(_0x177a3a['query'][_0x72a0('0x40')]){_0x12eda2[_0x72a0('0x3e')]=_[_0x72a0('0x41')](_0x12eda2[_0x72a0('0x3e')],{'$or':_[_0x72a0('0x2d')](_0x4ba037,function(_0x512a06){if(_0x512a06[_0x72a0('0x31')]!==_0x72a0('0x42')){var _0x582c90={};_0x582c90[_0x512a06[_0x72a0('0x2a')]]={'$like':'%'+_0x177a3a['query']['filter']+'%'};return _0x582c90;}})});}_0x12eda2=_['merge']({},_0x12eda2,_0x177a3a[_0x72a0('0x43')]);var _0x49633b={'where':_0x12eda2[_0x72a0('0x3e')]};return db[_0x72a0('0x2e')][_0x72a0('0x44')](_0x49633b)[_0x72a0('0x28')](function(_0x4bf56e){_0x916733['count']=_0x4bf56e;if(_0x177a3a['query']['includeAll']){_0x12eda2[_0x72a0('0x45')]=[{'all':!![]}];}return db[_0x72a0('0x2e')]['findAll'](_0x12eda2);})[_0x72a0('0x28')](function(_0x35d790){_0x916733['rows']=_0x35d790;return _0x916733;})[_0x72a0('0x28')](respondWithFilteredResult(_0x432179,_0x12eda2))[_0x72a0('0x46')](handleError(_0x432179,null));};exports[_0x72a0('0x47')]=function(_0xe4abe1,_0x340153){var _0x341451={'raw':![],'where':{'id':_0xe4abe1[_0x72a0('0x48')]['id']}},_0x50eb7f={};_0x50eb7f['model']=_[_0x72a0('0x34')](db['UserProfileResource'][_0x72a0('0x2f')]);_0x50eb7f[_0x72a0('0x33')]=_['keys'](_0xe4abe1[_0x72a0('0x33')]);_0x50eb7f['filters']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],_0x50eb7f[_0x72a0('0x33')]);_0x341451['attributes']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],qs[_0x72a0('0x49')](_0xe4abe1['query']['fields']));_0x341451[_0x72a0('0x38')]=_0x341451['attributes'][_0x72a0('0x39')]?_0x341451[_0x72a0('0x38')]:_0x50eb7f[_0x72a0('0x37')];if(_0xe4abe1[_0x72a0('0x33')][_0x72a0('0x4a')]){_0x341451[_0x72a0('0x45')]=[{'all':!![]}];}_0x341451=_[_0x72a0('0x41')]({},_0x341451,_0xe4abe1[_0x72a0('0x43')]);return db[_0x72a0('0x2e')]['find'](_0x341451)[_0x72a0('0x28')](handleEntityNotFound(_0x340153,null))[_0x72a0('0x28')](respondWithResult(_0x340153,null))[_0x72a0('0x46')](handleError(_0x340153,null));};exports[_0x72a0('0x4b')]=function(_0x3a669d,_0x304400){return db[_0x72a0('0x2e')]['create'](_0x3a669d['body'],{})[_0x72a0('0x28')](respondWithResult(_0x304400,0xc9))[_0x72a0('0x46')](handleError(_0x304400,null));};exports[_0x72a0('0x27')]=function(_0x3cab6a,_0x35a6ad){if(_0x3cab6a[_0x72a0('0x4c')]['id']){delete _0x3cab6a[_0x72a0('0x4c')]['id'];}return db[_0x72a0('0x2e')][_0x72a0('0x4d')]({'where':{'id':_0x3cab6a[_0x72a0('0x48')]['id']}})['then'](handleEntityNotFound(_0x35a6ad,null))[_0x72a0('0x28')](saveUpdates(_0x3cab6a[_0x72a0('0x4c')],null))[_0x72a0('0x28')](respondWithResult(_0x35a6ad,null))[_0x72a0('0x46')](handleError(_0x35a6ad,null));};exports[_0x72a0('0x4e')]=function(_0x5c1570,_0x143410){return db['UserProfileResource']['find']({'where':{'id':_0x5c1570[_0x72a0('0x48')]['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x143410,null))[_0x72a0('0x28')](removeEntity(_0x143410,null))[_0x72a0('0x46')](handleError(_0x143410,null));};exports[_0x72a0('0x4f')]=function(_0x50c8d7,_0xc0f323){return db[_0x72a0('0x2e')]['describe']()['then'](respondWithResult(_0xc0f323,null))[_0x72a0('0x46')](handleError(_0xc0f323,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 355d1b4..1e83968 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 _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 +var _0x41fe=['UserProfileResource','user_profile_has_resources','resourceId','sectionId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./userProfileResource.attributes','exports','define'];(function(_0xfaf019,_0x1b75da){var _0x136640=function(_0x2ace91){while(--_0x2ace91){_0xfaf019['push'](_0xfaf019['shift']());}};_0x136640(++_0x1b75da);}(_0x41fe,0x14e));var _0xe41f=function(_0x3718b7,_0x2da677){_0x3718b7=_0x3718b7-0x0;var _0xf8c91e=_0x41fe[_0x3718b7];return _0xf8c91e;};'use strict';var _=require(_0xe41f('0x0'));var util=require(_0xe41f('0x1'));var logger=require(_0xe41f('0x2'))(_0xe41f('0x3'));var moment=require(_0xe41f('0x4'));var BPromise=require('bluebird');var rp=require(_0xe41f('0x5'));var fs=require('fs');var path=require(_0xe41f('0x6'));var rimraf=require(_0xe41f('0x7'));var config=require('../../config/environment');var attributes=require(_0xe41f('0x8'));module[_0xe41f('0x9')]=function(_0x447869,_0xd95b2){return _0x447869[_0xe41f('0xa')](_0xe41f('0xb'),attributes,{'tableName':_0xe41f('0xc'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xe41f('0xd'),_0xe41f('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 0b71319..6f55634 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 _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 +var _0x9fda=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','info','UserProfileResource,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','lodash','bluebird','randomstring','ioredis'];(function(_0x8672b2,_0x3230c){var _0x4e9e0b=function(_0x3ab163){while(--_0x3ab163){_0x8672b2['push'](_0x8672b2['shift']());}};_0x4e9e0b(++_0x3230c);}(_0x9fda,0x8c));var _0xa9fd=function(_0x2fad4b,_0x221269){_0x2fad4b=_0x2fad4b-0x0;var _0x5e1fc0=_0x9fda[_0x2fad4b];return _0x5e1fc0;};'use strict';var _=require(_0xa9fd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa9fd('0x1'));var rs=require(_0xa9fd('0x2'));var fs=require('fs');var Redis=require(_0xa9fd('0x3'));var db=require(_0xa9fd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa9fd('0x5'))(_0xa9fd('0x6'));var config=require('../../config/environment');var jayson=require(_0xa9fd('0x7'));var client=jayson[_0xa9fd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f2d27,_0x3e5143,_0x1e249e){return new BPromise(function(_0x4072e3,_0x1b1c2e){return client[_0xa9fd('0x9')](_0x5f2d27,_0x1e249e)['then'](function(_0x7bc6c4){logger[_0xa9fd('0xa')](_0xa9fd('0xb'),_0x3e5143,'request\x20sent');logger[_0xa9fd('0xc')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x3e5143,'request\x20sent',JSON[_0xa9fd('0xd')](_0x7bc6c4));if(_0x7bc6c4[_0xa9fd('0xe')]){if(_0x7bc6c4[_0xa9fd('0xe')]['code']===0x1f4){logger[_0xa9fd('0xe')](_0xa9fd('0xb'),_0x3e5143,_0x7bc6c4[_0xa9fd('0xe')][_0xa9fd('0xf')]);return _0x1b1c2e(_0x7bc6c4['error'][_0xa9fd('0xf')]);}logger[_0xa9fd('0xe')](_0xa9fd('0xb'),_0x3e5143,_0x7bc6c4[_0xa9fd('0xe')][_0xa9fd('0xf')]);return _0x4072e3(_0x7bc6c4[_0xa9fd('0xe')][_0xa9fd('0xf')]);}else{logger[_0xa9fd('0xa')]('UserProfileResource,\x20%s,\x20%s',_0x3e5143,_0xa9fd('0x10'));_0x4072e3(_0x7bc6c4[_0xa9fd('0x11')]['message']);}})['catch'](function(_0x42d7d9){logger[_0xa9fd('0xe')](_0xa9fd('0xb'),_0x3e5143,_0x42d7d9);_0x1b1c2e(_0x42d7d9);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index e072332..47565dc 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 _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 +var _0xb853=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','index','isAuthenticated','describe','/:id','show'];(function(_0x4b9292,_0x563a24){var _0x16ddbb=function(_0x56f077){while(--_0x56f077){_0x4b9292['push'](_0x4b9292['shift']());}};_0x16ddbb(++_0x563a24);}(_0xb853,0x1aa));var _0x3b85=function(_0x2a86ee,_0x16910a){_0x2a86ee=_0x2a86ee-0x0;var _0x5dcebb=_0xb853[_0x2a86ee];return _0x5dcebb;};'use strict';var multer=require(_0x3b85('0x0'));var util=require('util');var path=require(_0x3b85('0x1'));var timeout=require(_0x3b85('0x2'));var express=require(_0x3b85('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3b85('0x4'));var interaction=require(_0x3b85('0x5'));var config=require(_0x3b85('0x6'));var controller=require(_0x3b85('0x7'));router[_0x3b85('0x8')]('/',auth['isAuthenticated'](),controller[_0x3b85('0x9')]);router['get']('/describe',auth[_0x3b85('0xa')](),controller[_0x3b85('0xb')]);router[_0x3b85('0x8')](_0x3b85('0xc'),auth[_0x3b85('0xa')](),controller[_0x3b85('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3b85('0xe')]);router[_0x3b85('0xf')](_0x3b85('0xc'),auth[_0x3b85('0xa')](),controller[_0x3b85('0x10')]);router[_0x3b85('0x11')](_0x3b85('0xc'),auth[_0x3b85('0xa')](),controller[_0x3b85('0x12')]);module[_0x3b85('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 2a3418b..aff4a39 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 _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 +var _0x28f2=['join','getDataValue','split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions'];(function(_0x566e8c,_0x26e1f2){var _0x2849b9=function(_0x386a81){while(--_0x386a81){_0x566e8c['push'](_0x566e8c['shift']());}};_0x2849b9(++_0x26e1f2);}(_0x28f2,0x193));var _0x228f=function(_0x125152,_0x476352){_0x125152=_0x125152-0x0;var _0x31c206=_0x28f2[_0x125152];return _0x31c206;};'use strict';var Sequelize=require(_0x228f('0x0'));module[_0x228f('0x1')]={'name':{'type':Sequelize[_0x228f('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x228f('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x228f('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x228f('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x228f('0x2')],'set':function(_0x79ed5f){this[_0x228f('0x5')](_0x228f('0x6'),_0x79ed5f?_0x79ed5f[_0x228f('0x7')](''):[]);},'get':function(){return this[_0x228f('0x8')]('crudPermissions')?this[_0x228f('0x8')]('crudPermissions')[_0x228f('0x9')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 24fb3dc..ebfea13 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 _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 +var _0xa776=['undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','params','options','catch','create','body','find','describe','eml-format','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset'];(function(_0x1e6de6,_0x1af547){var _0x3e2360=function(_0x52d8fa){while(--_0x52d8fa){_0x1e6de6['push'](_0x1e6de6['shift']());}};_0x3e2360(++_0x1af547);}(_0xa776,0x78));var _0x6a77=function(_0x430d02,_0x478a32){_0x430d02=_0x430d02-0x0;var _0x423273=_0xa776[_0x430d02];return _0x423273;};'use strict';var emlformat=require(_0x6a77('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6a77('0x1'));var moment=require(_0x6a77('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6a77('0x3'));var path=require(_0x6a77('0x4'));var sox=require(_0x6a77('0x5'));var csv=require(_0x6a77('0x6'));var ejs=require(_0x6a77('0x7'));var fs=require('fs');var fs_extra=require(_0x6a77('0x8'));var _=require(_0x6a77('0x9'));var squel=require(_0x6a77('0xa'));var crypto=require(_0x6a77('0xb'));var jsforce=require(_0x6a77('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6a77('0x6'));var querystring=require(_0x6a77('0xd'));var Papa=require(_0x6a77('0xe'));var Redis=require(_0x6a77('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6a77('0x10'));var as=require(_0x6a77('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6a77('0x12'))('api');var utils=require(_0x6a77('0x13'));var config=require(_0x6a77('0x14'));var licenseUtil=require(_0x6a77('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d78ab,_0x5a3a5a){_0x5a3a5a=_0x5a3a5a||0xcc;return function(_0x21555a){if(_0x21555a){return _0x4d78ab[_0x6a77('0x16')](_0x5a3a5a);}return _0x4d78ab[_0x6a77('0x17')](_0x5a3a5a)[_0x6a77('0x18')]();};}function respondWithResult(_0x4f6c37,_0x1d4459){_0x1d4459=_0x1d4459||0xc8;return function(_0x1c8310){if(_0x1c8310){return _0x4f6c37[_0x6a77('0x17')](_0x1d4459)['json'](_0x1c8310);}};}function respondWithFilteredResult(_0x16724d,_0x339325){return function(_0x504189){if(_0x504189){var _0x28118a=typeof _0x339325[_0x6a77('0x19')]===_0x6a77('0x1a')&&typeof _0x339325['limit']===_0x6a77('0x1a');var _0xba960c=_0x504189['count'];var _0x2adc97=_0x28118a?0x0:_0x339325[_0x6a77('0x19')];var _0x1b5ecc=_0x28118a?_0x504189[_0x6a77('0x1b')]:_0x339325[_0x6a77('0x19')]+_0x339325['limit'];var _0x70e175;if(_0x1b5ecc>=_0xba960c){_0x1b5ecc=_0xba960c;_0x70e175=0xc8;}else{_0x70e175=0xce;}_0x16724d['status'](_0x70e175);return _0x16724d[_0x6a77('0x1c')](_0x6a77('0x1d'),_0x2adc97+'-'+_0x1b5ecc+'/'+_0xba960c)[_0x6a77('0x1e')](_0x504189);}return null;};}function patchUpdates(_0x30f4d2){return function(_0x409072){try{jsonpatch[_0x6a77('0x1f')](_0x409072,_0x30f4d2,!![]);}catch(_0x10fe83){return BPromise[_0x6a77('0x20')](_0x10fe83);}return _0x409072[_0x6a77('0x21')]();};}function saveUpdates(_0x14623f,_0x32bc2b){return function(_0x10957f){if(_0x10957f){return _0x10957f['update'](_0x14623f)[_0x6a77('0x22')](function(_0xc3edf2){return _0xc3edf2;});}return null;};}function removeEntity(_0x1472a9,_0x29be79){return function(_0x12001e){if(_0x12001e){return _0x12001e[_0x6a77('0x23')]()[_0x6a77('0x22')](function(){_0x1472a9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3de4f0,_0x3362a8){return function(_0x7d2d4){if(!_0x7d2d4){_0x3de4f0[_0x6a77('0x16')](0x194);}return _0x7d2d4;};}function handleError(_0x1cb3e4,_0x853600){_0x853600=_0x853600||0x1f4;return function(_0x4ca6b2){logger[_0x6a77('0x24')](_0x4ca6b2[_0x6a77('0x25')]);if(_0x4ca6b2['name']){delete _0x4ca6b2['name'];}_0x1cb3e4[_0x6a77('0x17')](_0x853600)['send'](_0x4ca6b2);};}exports[_0x6a77('0x26')]=function(_0x24a8cb,_0x1a9381){var _0x5d4659={},_0x51f8fd={},_0xc02a2e={'count':0x0,'rows':[]};var _0x1b65b7=_[_0x6a77('0x27')](db[_0x6a77('0x28')][_0x6a77('0x29')],function(_0xe25f84){return{'name':_0xe25f84[_0x6a77('0x2a')],'type':_0xe25f84[_0x6a77('0x2b')][_0x6a77('0x2c')]};});_0x51f8fd[_0x6a77('0x2d')]=_['map'](_0x1b65b7,_0x6a77('0x2e'));_0x51f8fd[_0x6a77('0x2f')]=_[_0x6a77('0x30')](_0x24a8cb[_0x6a77('0x2f')]);_0x51f8fd[_0x6a77('0x31')]=_[_0x6a77('0x32')](_0x51f8fd[_0x6a77('0x2d')],_0x51f8fd[_0x6a77('0x2f')]);_0x5d4659[_0x6a77('0x33')]=_[_0x6a77('0x32')](_0x51f8fd[_0x6a77('0x2d')],qs['fields'](_0x24a8cb[_0x6a77('0x2f')][_0x6a77('0x34')]));_0x5d4659[_0x6a77('0x33')]=_0x5d4659[_0x6a77('0x33')][_0x6a77('0x35')]?_0x5d4659['attributes']:_0x51f8fd['model'];if(!_0x24a8cb[_0x6a77('0x2f')][_0x6a77('0x36')](_0x6a77('0x37'))){_0x5d4659[_0x6a77('0x38')]=qs[_0x6a77('0x38')](_0x24a8cb['query'][_0x6a77('0x38')]);_0x5d4659[_0x6a77('0x19')]=qs[_0x6a77('0x19')](_0x24a8cb['query'][_0x6a77('0x19')]);}_0x5d4659['order']=qs[_0x6a77('0x39')](_0x24a8cb['query'][_0x6a77('0x39')]);_0x5d4659[_0x6a77('0x3a')]=qs['filters'](_['pick'](_0x24a8cb[_0x6a77('0x2f')],_0x51f8fd[_0x6a77('0x31')]),_0x1b65b7);if(_0x24a8cb[_0x6a77('0x2f')]['filter']){_0x5d4659[_0x6a77('0x3a')]=_[_0x6a77('0x3b')](_0x5d4659[_0x6a77('0x3a')],{'$or':_[_0x6a77('0x27')](_0x1b65b7,function(_0x142702){if(_0x142702['type']!==_0x6a77('0x3c')){var _0x5ea316={};_0x5ea316[_0x142702['name']]={'$like':'%'+_0x24a8cb[_0x6a77('0x2f')][_0x6a77('0x3d')]+'%'};return _0x5ea316;}})});}_0x5d4659=_[_0x6a77('0x3b')]({},_0x5d4659,_0x24a8cb['options']);var _0x2fb90b={'where':_0x5d4659['where']};return db['UserProfileSection'][_0x6a77('0x1b')](_0x2fb90b)[_0x6a77('0x22')](function(_0x20d679){_0xc02a2e[_0x6a77('0x1b')]=_0x20d679;if(_0x24a8cb[_0x6a77('0x2f')][_0x6a77('0x3e')]){_0x5d4659[_0x6a77('0x3f')]=[{'all':!![]}];}return db[_0x6a77('0x28')][_0x6a77('0x40')](_0x5d4659);})['then'](function(_0x14b10d){_0xc02a2e[_0x6a77('0x41')]=_0x14b10d;return _0xc02a2e;})['then'](respondWithFilteredResult(_0x1a9381,_0x5d4659))['catch'](handleError(_0x1a9381,null));};exports['show']=function(_0x199792,_0x56fe6c){var _0x31b610={'raw':![],'where':{'id':_0x199792[_0x6a77('0x42')]['id']}},_0x276190={};_0x276190[_0x6a77('0x2d')]=_['keys'](db[_0x6a77('0x28')][_0x6a77('0x29')]);_0x276190['query']=_[_0x6a77('0x30')](_0x199792['query']);_0x276190['filters']=_['intersection'](_0x276190[_0x6a77('0x2d')],_0x276190[_0x6a77('0x2f')]);_0x31b610[_0x6a77('0x33')]=_[_0x6a77('0x32')](_0x276190[_0x6a77('0x2d')],qs[_0x6a77('0x34')](_0x199792['query']['fields']));_0x31b610[_0x6a77('0x33')]=_0x31b610[_0x6a77('0x33')][_0x6a77('0x35')]?_0x31b610[_0x6a77('0x33')]:_0x276190[_0x6a77('0x2d')];if(_0x199792['query']['includeAll']){_0x31b610[_0x6a77('0x3f')]=[{'all':!![]}];}_0x31b610=_[_0x6a77('0x3b')]({},_0x31b610,_0x199792[_0x6a77('0x43')]);return db[_0x6a77('0x28')]['find'](_0x31b610)[_0x6a77('0x22')](handleEntityNotFound(_0x56fe6c,null))[_0x6a77('0x22')](respondWithResult(_0x56fe6c,null))[_0x6a77('0x44')](handleError(_0x56fe6c,null));};exports['create']=function(_0x440810,_0x1da26b){return db[_0x6a77('0x28')][_0x6a77('0x45')](_0x440810[_0x6a77('0x46')],{})[_0x6a77('0x22')](respondWithResult(_0x1da26b,0xc9))[_0x6a77('0x44')](handleError(_0x1da26b,null));};exports['update']=function(_0x16e588,_0x17debf){if(_0x16e588[_0x6a77('0x46')]['id']){delete _0x16e588[_0x6a77('0x46')]['id'];}return db[_0x6a77('0x28')][_0x6a77('0x47')]({'where':{'id':_0x16e588[_0x6a77('0x42')]['id']}})[_0x6a77('0x22')](handleEntityNotFound(_0x17debf,null))[_0x6a77('0x22')](saveUpdates(_0x16e588['body'],null))[_0x6a77('0x22')](respondWithResult(_0x17debf,null))[_0x6a77('0x44')](handleError(_0x17debf,null));};exports[_0x6a77('0x23')]=function(_0x2aab00,_0x11f0ba){return db[_0x6a77('0x28')][_0x6a77('0x47')]({'where':{'id':_0x2aab00[_0x6a77('0x42')]['id']}})[_0x6a77('0x22')](handleEntityNotFound(_0x11f0ba,null))[_0x6a77('0x22')](removeEntity(_0x11f0ba,null))[_0x6a77('0x44')](handleError(_0x11f0ba,null));};exports[_0x6a77('0x48')]=function(_0xf33e81,_0x4a80d6){return db[_0x6a77('0x28')]['describe']()[_0x6a77('0x22')](respondWithResult(_0x4a80d6,null))[_0x6a77('0x44')](handleError(_0x4a80d6,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index a57f027..36fcb4e 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 _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 +var _0x2c9f=['bluebird','path','rimraf','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','../../config/logger','api','moment'];(function(_0xebc70a,_0xe4088a){var _0x4da0bd=function(_0xe4dbf3){while(--_0xe4dbf3){_0xebc70a['push'](_0xebc70a['shift']());}};_0x4da0bd(++_0xe4088a);}(_0x2c9f,0x110));var _0xf2c9=function(_0x24bab5,_0x39049e){_0x24bab5=_0x24bab5-0x0;var _0x714a1a=_0x2c9f[_0x24bab5];return _0x714a1a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf2c9('0x0'))(_0xf2c9('0x1'));var moment=require(_0xf2c9('0x2'));var BPromise=require(_0xf2c9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf2c9('0x4'));var rimraf=require(_0xf2c9('0x5'));var config=require('../../config/environment');var attributes=require(_0xf2c9('0x6'));module[_0xf2c9('0x7')]=function(_0x78987,_0x3ce30d){return _0x78987[_0xf2c9('0x8')](_0xf2c9('0x9'),attributes,{'tableName':_0xf2c9('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index bbd4061..c111201 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 _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 +var _0xd2c7=['bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util'];(function(_0x56e620,_0x1fbca8){var _0x5d0439=function(_0x5cb4bb){while(--_0x5cb4bb){_0x56e620['push'](_0x56e620['shift']());}};_0x5d0439(++_0x1fbca8);}(_0xd2c7,0x1e5));var _0x7d2c=function(_0x5860b4,_0x1b0c8a){_0x5860b4=_0x5860b4-0x0;var _0xd71fca=_0xd2c7[_0x5860b4];return _0xd71fca;};'use strict';var _=require('lodash');var util=require(_0x7d2c('0x0'));var moment=require('moment');var BPromise=require(_0x7d2c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7d2c('0x2'))['db'];var utils=require(_0x7d2c('0x3'));var logger=require('../../config/logger')(_0x7d2c('0x4'));var config=require('../../config/environment');var jayson=require(_0x7d2c('0x5'));var client=jayson[_0x7d2c('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59532b,_0x6b8d65,_0x2d04b3){return new BPromise(function(_0x41037b,_0x2b5f18){return client[_0x7d2c('0x7')](_0x59532b,_0x2d04b3)['then'](function(_0x163fb7){logger[_0x7d2c('0x8')](_0x7d2c('0x9'),_0x6b8d65,_0x7d2c('0xa'));logger[_0x7d2c('0xb')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x6b8d65,_0x7d2c('0xa'),JSON[_0x7d2c('0xc')](_0x163fb7));if(_0x163fb7[_0x7d2c('0xd')]){if(_0x163fb7['error'][_0x7d2c('0xe')]===0x1f4){logger[_0x7d2c('0xd')](_0x7d2c('0x9'),_0x6b8d65,_0x163fb7[_0x7d2c('0xd')][_0x7d2c('0xf')]);return _0x2b5f18(_0x163fb7['error']['message']);}logger['error'](_0x7d2c('0x9'),_0x6b8d65,_0x163fb7['error'][_0x7d2c('0xf')]);return _0x41037b(_0x163fb7[_0x7d2c('0xd')][_0x7d2c('0xf')]);}else{logger['info'](_0x7d2c('0x9'),_0x6b8d65,'request\x20sent');_0x41037b(_0x163fb7[_0x7d2c('0x10')]['message']);}})[_0x7d2c('0x11')](function(_0x5ec473){logger[_0x7d2c('0xd')](_0x7d2c('0x9'),_0x6b8d65,_0x5ec473);_0x2b5f18(_0x5ec473);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index ff96046..042ba9a 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_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 +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x499c7f,_0x2d8184){var _0x433bee=function(_0xd1543a){while(--_0xd1543a){_0x499c7f['push'](_0x499c7f['shift']());}};_0x433bee(++_0x2d8184);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 6696595..5919358 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _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 +var _0x2c9b=['INTEGER','sequelize'];(function(_0x296ebb,_0x3b5f33){var _0x2406c1=function(_0x26f29c){while(--_0x26f29c){_0x296ebb['push'](_0x296ebb['shift']());}};_0x2406c1(++_0x3b5f33);}(_0x2c9b,0x1e9));var _0xb2c9=function(_0x301a90,_0xbf9228){_0x301a90=_0x301a90-0x0;var _0x4e3e9d=_0x2c9b[_0x301a90];return _0x4e3e9d;};'use strict';var Sequelize=require(_0xb2c9('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xb2c9('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index a17b10c..0f89df1 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 _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 +var _0x0af5=['rimraf','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x270296,_0xcf0837){var _0x4f47ea=function(_0x127fcb){while(--_0x127fcb){_0x270296['push'](_0x270296['shift']());}};_0x4f47ea(++_0xcf0837);}(_0x0af5,0x158));var _0x50af=function(_0x17c17d,_0x2b894f){_0x17c17d=_0x17c17d-0x0;var _0x5782df=_0x0af5[_0x17c17d];return _0x5782df;};'use strict';var _=require('lodash');var util=require(_0x50af('0x0'));var logger=require(_0x50af('0x1'))(_0x50af('0x2'));var moment=require(_0x50af('0x3'));var BPromise=require(_0x50af('0x4'));var rp=require(_0x50af('0x5'));var fs=require('fs');var path=require(_0x50af('0x6'));var rimraf=require(_0x50af('0x7'));var config=require(_0x50af('0x8'));var attributes=require(_0x50af('0x9'));module[_0x50af('0xa')]=function(_0xe37b1,_0x5e94f8){return _0xe37b1['define'](_0x50af('0xb'),attributes,{'tableName':_0x50af('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 21014f5..76a3178 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 _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 +var _0x825c=['UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','UserSmsQueue,\x20%s,\x20%s','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x825c,0x170));var _0xc825=function(_0x21b706,_0x1022f4){_0x21b706=_0x21b706-0x0;var _0x13b94a=_0x825c[_0x21b706];return _0x13b94a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc825('0x0'));var BPromise=require(_0xc825('0x1'));var rs=require(_0xc825('0x2'));var fs=require('fs');var Redis=require(_0xc825('0x3'));var db=require(_0xc825('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc825('0x5'))(_0xc825('0x6'));var config=require(_0xc825('0x7'));var jayson=require(_0xc825('0x8'));var client=jayson[_0xc825('0x9')][_0xc825('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e6df4,_0x399fb4,_0x5aa690){return new BPromise(function(_0xb0cf99,_0x2cb6a5){return client[_0xc825('0xb')](_0x2e6df4,_0x5aa690)[_0xc825('0xc')](function(_0x567d8f){logger[_0xc825('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x399fb4,_0xc825('0xe'));logger[_0xc825('0xf')](_0xc825('0x10'),_0x399fb4,_0xc825('0xe'),JSON[_0xc825('0x11')](_0x567d8f));if(_0x567d8f['error']){if(_0x567d8f['error'][_0xc825('0x12')]===0x1f4){logger[_0xc825('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x399fb4,_0x567d8f[_0xc825('0x13')][_0xc825('0x14')]);return _0x2cb6a5(_0x567d8f['error'][_0xc825('0x14')]);}logger[_0xc825('0x13')](_0xc825('0x15'),_0x399fb4,_0x567d8f[_0xc825('0x13')][_0xc825('0x14')]);return _0xb0cf99(_0x567d8f[_0xc825('0x13')][_0xc825('0x14')]);}else{logger['info'](_0xc825('0x15'),_0x399fb4,'request\x20sent');_0xb0cf99(_0x567d8f[_0xc825('0x16')]['message']);}})[_0xc825('0x17')](function(_0xdda754){logger[_0xc825('0x13')](_0xc825('0x15'),_0x399fb4,_0xdda754);_0x2cb6a5(_0xdda754);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 3ef44ea..5f6e433 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 _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 +var _0xb00e=['INTEGER'];(function(_0x29374a,_0x5788c7){var _0x2bed8f=function(_0x54a84c){while(--_0x54a84c){_0x29374a['push'](_0x29374a['shift']());}};_0x2bed8f(++_0x5788c7);}(_0xb00e,0x1a5));var _0xeb00=function(_0x81dcac,_0x8ff7db){_0x81dcac=_0x81dcac-0x0;var _0xc7803b=_0xb00e[_0x81dcac];return _0xc7803b;};'use strict';var Sequelize=require('sequelize');module['exports']={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xeb00('0x0')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index f4ce598..8a4864c 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(_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 +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x3701e6,_0x7c6ca1){var _0x3071bf=function(_0x70f77c){while(--_0x70f77c){_0x3701e6['push'](_0x3701e6['shift']());}};_0x3071bf(++_0x7c6ca1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 9ee0d06..0dbe9b9 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_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 +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1090df,_0x16f8c4){var _0x3c8d10=function(_0x1ca425){while(--_0x1ca425){_0x1090df['push'](_0x1090df['shift']());}};_0x3c8d10(++_0x16f8c4);}(_0xe706,0xa3));var _0x6e70=function(_0x1cd5b1,_0x58dd23){_0x1cd5b1=_0x1cd5b1-0x0;var _0x25b4c7=_0xe706[_0x1cd5b1];return _0x25b4c7;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index a593b06..522c635 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 _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 +var _0xfa59=['INTEGER'];(function(_0x17d1b2,_0x2b5596){var _0x21e5ec=function(_0x3df4cf){while(--_0x3df4cf){_0x17d1b2['push'](_0x17d1b2['shift']());}};_0x21e5ec(++_0x2b5596);}(_0xfa59,0x121));var _0x9fa5=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xfa59[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x9fa5('0x0')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index d09d6d6..46ba418 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 _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 +var _0xd0f7=['user_has_voice_queues','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0xd0f7,0x109));var _0x7d0f=function(_0x736e2,_0x316ff9){_0x736e2=_0x736e2-0x0;var _0x523195=_0xd0f7[_0x736e2];return _0x523195;};'use strict';var _=require(_0x7d0f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7d0f('0x1'));var BPromise=require(_0x7d0f('0x2'));var rp=require(_0x7d0f('0x3'));var fs=require('fs');var path=require(_0x7d0f('0x4'));var rimraf=require(_0x7d0f('0x5'));var config=require(_0x7d0f('0x6'));var attributes=require(_0x7d0f('0x7'));module[_0x7d0f('0x8')]=function(_0x396e2f,_0x4767e6){return _0x396e2f[_0x7d0f('0x9')](_0x7d0f('0xa'),attributes,{'tableName':_0x7d0f('0xb'),'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 20f7581..9aca03c 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 _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 +var _0xc9d2=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','UserVoiceQueue,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','lodash'];(function(_0x19b9d1,_0x4f603f){var _0x1ca4f7=function(_0x2d1ea7){while(--_0x2d1ea7){_0x19b9d1['push'](_0x19b9d1['shift']());}};_0x1ca4f7(++_0x4f603f);}(_0xc9d2,0x179));var _0x2c9d=function(_0x173bb6,_0x3a6f85){_0x173bb6=_0x173bb6-0x0;var _0x222877=_0xc9d2[_0x173bb6];return _0x222877;};'use strict';var _=require(_0x2c9d('0x0'));var util=require(_0x2c9d('0x1'));var moment=require(_0x2c9d('0x2'));var BPromise=require(_0x2c9d('0x3'));var rs=require(_0x2c9d('0x4'));var fs=require('fs');var Redis=require(_0x2c9d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2c9d('0x6'));var logger=require(_0x2c9d('0x7'))(_0x2c9d('0x8'));var config=require(_0x2c9d('0x9'));var jayson=require(_0x2c9d('0xa'));var client=jayson[_0x2c9d('0xb')][_0x2c9d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4fad20,_0x5cc5db,_0x4275ae){return new BPromise(function(_0x49d87f,_0x51685d){return client[_0x2c9d('0xd')](_0x4fad20,_0x4275ae)['then'](function(_0x27f2ed){logger['info'](_0x2c9d('0xe'),_0x5cc5db,'request\x20sent');logger[_0x2c9d('0xf')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x5cc5db,_0x2c9d('0x10'),JSON['stringify'](_0x27f2ed));if(_0x27f2ed[_0x2c9d('0x11')]){if(_0x27f2ed[_0x2c9d('0x11')][_0x2c9d('0x12')]===0x1f4){logger['error'](_0x2c9d('0xe'),_0x5cc5db,_0x27f2ed['error'][_0x2c9d('0x13')]);return _0x51685d(_0x27f2ed['error'][_0x2c9d('0x13')]);}logger[_0x2c9d('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x5cc5db,_0x27f2ed['error'][_0x2c9d('0x13')]);return _0x49d87f(_0x27f2ed[_0x2c9d('0x11')][_0x2c9d('0x13')]);}else{logger[_0x2c9d('0x14')]('UserVoiceQueue,\x20%s,\x20%s',_0x5cc5db,_0x2c9d('0x10'));_0x49d87f(_0x27f2ed['result'][_0x2c9d('0x13')]);}})['catch'](function(_0x3fef93){logger[_0x2c9d('0x11')](_0x2c9d('0xe'),_0x5cc5db,_0x3fef93);_0x51685d(_0x3fef93);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 04eca3a..90d9ff4 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 _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 +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3876a2,_0x146b65){var _0x374d28=function(_0x240396){while(--_0x240396){_0x3876a2['push'](_0x3876a2['shift']());}};_0x374d28(++_0x146b65);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x134d5e,_0x2a47d8){_0x134d5e=_0x134d5e-0x0;var _0x1e166a=_0xcb91[_0x134d5e];return _0x1e166a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 80c03ae..ceebeda 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 _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 +var _0x4de9=['Required\x20by\x20Asterisk','STRING','INTEGER','queue_interface'];(function(_0x323b01,_0x3a3ad2){var _0x128c3e=function(_0x2a3214){while(--_0x2a3214){_0x323b01['push'](_0x323b01['shift']());}};_0x128c3e(++_0x3a3ad2);}(_0x4de9,0xb0));var _0x94de=function(_0xf16b1,_0x33c637){_0xf16b1=_0xf16b1-0x0;var _0x26f94d=_0x4de9[_0xf16b1];return _0x26f94d;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x94de('0x0')},'membername':{'type':Sequelize[_0x94de('0x1')],'allowNull':![],'comment':_0x94de('0x0')},'UserId':{'type':Sequelize[_0x94de('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x94de('0x3'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x94de('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x94de('0x3'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x94de('0x2')](0xb),'defaultValue':0x0,'comment':_0x94de('0x0')},'paused':{'type':Sequelize[_0x94de('0x2')](0xb),'defaultValue':0x0,'comment':_0x94de('0x0')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 46f7ae1..a5716bb 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 _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 +var _0x6616=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x55e367,_0x184f21){var _0x3080c3=function(_0x1a2fdf){while(--_0x1a2fdf){_0x55e367['push'](_0x55e367['shift']());}};_0x3080c3(++_0x184f21);}(_0x6616,0x103));var _0x6661=function(_0xc2296b,_0x5bbcbd){_0xc2296b=_0xc2296b-0x0;var _0x424505=_0x6616[_0xc2296b];return _0x424505;};'use strict';var EventEmitter=require(_0x6661('0x0'));var UserVoiceQueueRt=require(_0x6661('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x6661('0x2')](0x0);var events={'afterCreate':_0x6661('0x3'),'afterUpdate':_0x6661('0x4'),'afterDestroy':_0x6661('0x5')};function emitEvent(_0x4b2ef0){return function(_0x4d4d77,_0x8ffa8,_0x3e8882){UserVoiceQueueRtEvents['emit'](_0x4b2ef0+':'+_0x4d4d77['id'],_0x4d4d77);UserVoiceQueueRtEvents[_0x6661('0x6')](_0x4b2ef0,_0x4d4d77);_0x3e8882(null);};}for(var e in events){if(events[_0x6661('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x6661('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 8ccd7a7..d1aa8e4 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 _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 +var _0xef63=['exports','define','UserVoiceQueueRt','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes'];(function(_0x596a1b,_0x53ce62){var _0x43b5fc=function(_0x77c8bd){while(--_0x77c8bd){_0x596a1b['push'](_0x596a1b['shift']());}};_0x43b5fc(++_0x53ce62);}(_0xef63,0x12e));var _0x3ef6=function(_0x1b3fe4,_0x1ef110){_0x1b3fe4=_0x1b3fe4-0x0;var _0x5a7c45=_0xef63[_0x1b3fe4];return _0x5a7c45;};'use strict';var _=require('lodash');var util=require(_0x3ef6('0x0'));var logger=require(_0x3ef6('0x1'))(_0x3ef6('0x2'));var moment=require(_0x3ef6('0x3'));var BPromise=require(_0x3ef6('0x4'));var rp=require(_0x3ef6('0x5'));var fs=require('fs');var path=require(_0x3ef6('0x6'));var rimraf=require(_0x3ef6('0x7'));var config=require(_0x3ef6('0x8'));var attributes=require(_0x3ef6('0x9'));module[_0x3ef6('0xa')]=function(_0x5ae04f,_0x4ce064){return _0x5ae04f[_0x3ef6('0xb')](_0x3ef6('0xc'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index a5944db..b30f44c 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 _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 +var _0x290c=['raw','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','defaults','localhost','./userVoiceQueueRt.socket','register','request','then','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'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x290c,0x91));var _0xc290=function(_0x561a9d,_0x2df671){_0x561a9d=_0x561a9d-0x0;var _0x3a9a37=_0x290c[_0x561a9d];return _0x3a9a37;};'use strict';var _=require('lodash');var util=require(_0xc290('0x0'));var moment=require(_0xc290('0x1'));var BPromise=require(_0xc290('0x2'));var rs=require(_0xc290('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc290('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc290('0x5'))('rpc');var config=require(_0xc290('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc290('0x7')][_0xc290('0x8')]({'port':0x232a});config['redis']=_[_0xc290('0x9')](config['redis'],{'host':_0xc290('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc290('0xb'))[_0xc290('0xc')](socket);function respondWithRpcPromise(_0x1b73bc,_0x3833db,_0x5a3906){return new BPromise(function(_0x3bb26e,_0x357dc9){return client[_0xc290('0xd')](_0x1b73bc,_0x5a3906)[_0xc290('0xe')](function(_0x2ac3be){logger[_0xc290('0xf')](_0xc290('0x10'),_0x3833db,_0xc290('0x11'));logger[_0xc290('0x12')](_0xc290('0x13'),_0x3833db,'request\x20sent',JSON[_0xc290('0x14')](_0x2ac3be));if(_0x2ac3be[_0xc290('0x15')]){if(_0x2ac3be[_0xc290('0x15')][_0xc290('0x16')]===0x1f4){logger[_0xc290('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3833db,_0x2ac3be[_0xc290('0x15')][_0xc290('0x17')]);return _0x357dc9(_0x2ac3be[_0xc290('0x15')][_0xc290('0x17')]);}logger[_0xc290('0x15')](_0xc290('0x10'),_0x3833db,_0x2ac3be['error'][_0xc290('0x17')]);return _0x3bb26e(_0x2ac3be['error'][_0xc290('0x17')]);}else{logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x3833db,_0xc290('0x11'));_0x3bb26e(_0x2ac3be[_0xc290('0x18')][_0xc290('0x17')]);}})[_0xc290('0x19')](function(_0x567df9){logger['error'](_0xc290('0x10'),_0x3833db,_0x567df9);_0x357dc9(_0x567df9);});});}exports[_0xc290('0x1a')]=function(_0x5d487f){var _0x202e5b=this;return new Promise(function(_0xaf7679,_0x51de94){return db[_0xc290('0x1b')][_0xc290('0x1c')]({'raw':_0x5d487f[_0xc290('0x1d')]?_0x5d487f[_0xc290('0x1d')][_0xc290('0x1e')]===undefined?!![]:![]:!![],'where':_0x5d487f[_0xc290('0x1d')]?_0x5d487f['options']['where']||null:null,'attributes':[[db[_0xc290('0x1f')]['fn']('COUNT',db[_0xc290('0x1f')]['fn']('IF',db[_0xc290('0x1f')][_0xc290('0x20')](_0xc290('0x21')))),_0xc290('0x22')]]})['then'](function(_0x5e2b6b){logger['info']('GetVoiceQueueRtPauses',_0x5d487f);logger[_0xc290('0x12')](_0xc290('0x1a'),_0x5d487f,JSON['stringify'](_0x5e2b6b));_0xaf7679(_0x5e2b6b);})[_0xc290('0x19')](function(_0x49d246){logger['error'](_0xc290('0x1a'),_0x49d246[_0xc290('0x17')],_0x5d487f);_0x51de94(_0x202e5b[_0xc290('0x15')](0x1f4,_0x49d246[_0xc290('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 944ce2d..b0d2e51 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 _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 +var _0x979e=['update','emit','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove'];(function(_0x1e16c4,_0x1fc1f4){var _0x33e028=function(_0x1c1714){while(--_0x1c1714){_0x1e16c4['push'](_0x1e16c4['shift']());}};_0x33e028(++_0x1fc1f4);}(_0x979e,0x195));var _0xe979=function(_0x48c81d,_0x305c82){_0x48c81d=_0x48c81d-0x0;var _0x45f51e=_0x979e[_0x48c81d];return _0x45f51e;};'use strict';var UserVoiceQueueRtEvents=require(_0xe979('0x0'));var events=[_0xe979('0x1'),_0xe979('0x2'),_0xe979('0x3')];function createListener(_0x5ce889,_0x10fb90){return function(_0x47321a){_0x10fb90[_0xe979('0x4')](_0x5ce889,_0x47321a);};}function removeListener(_0x3b4b06,_0x2d62dd){return function(){UserVoiceQueueRtEvents['removeListener'](_0x3b4b06,_0x2d62dd);};}exports[_0xe979('0x5')]=function(_0x580e20){for(var _0x1a0d35=0x0,_0x13a9ee=events[_0xe979('0x6')];_0x1a0d35<_0x13a9ee;_0x1a0d35++){var _0xc63524=events[_0x1a0d35];var _0xc79c06=createListener(_0xe979('0x7')+_0xc63524,_0x580e20);UserVoiceQueueRtEvents['on'](_0xc63524,_0xc79c06);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 2c01b04..72ca8a5 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 _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 +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5530a9,_0x48e4c2){var _0x1c69f4=function(_0x2577e0){while(--_0x2577e0){_0x5530a9['push'](_0x5530a9['shift']());}};_0x1c69f4(++_0x48e4c2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 1e1b3db..cefcc67 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 _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 +var _0xdd23=['sequelize'];(function(_0x4919a8,_0x4c4863){var _0x5851d8=function(_0x52d353){while(--_0x52d353){_0x4919a8['push'](_0x4919a8['shift']());}};_0x5851d8(++_0x4c4863);}(_0xdd23,0x109));var _0x3dd2=function(_0x394579,_0x144e6d){_0x394579=_0x394579-0x0;var _0x111e75=_0xdd23[_0x394579];return _0x111e75;};'use strict';var Sequelize=require(_0x3dd2('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'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 afb833b..97b5f4b 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 _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 +var _0x3dbd=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue'];(function(_0x1de2a6,_0xc4c40e){var _0x14ab99=function(_0x52e506){while(--_0x52e506){_0x1de2a6['push'](_0x1de2a6['shift']());}};_0x14ab99(++_0xc4c40e);}(_0x3dbd,0x9c));var _0xd3db=function(_0x21946b,_0x165c02){_0x21946b=_0x21946b-0x0;var _0xa7f04=_0x3dbd[_0x21946b];return _0xa7f04;};'use strict';var _=require(_0xd3db('0x0'));var util=require(_0xd3db('0x1'));var logger=require(_0xd3db('0x2'))(_0xd3db('0x3'));var moment=require('moment');var BPromise=require(_0xd3db('0x4'));var rp=require(_0xd3db('0x5'));var fs=require('fs');var path=require(_0xd3db('0x6'));var rimraf=require(_0xd3db('0x7'));var config=require(_0xd3db('0x8'));var attributes=require(_0xd3db('0x9'));module[_0xd3db('0xa')]=function(_0x398742,_0x5902bb){return _0x398742[_0xd3db('0xb')](_0xd3db('0xc'),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 38a4724..671dfa8 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 _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 +var _0xae3c=['stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x1e8031,_0x49e326){var _0x331793=function(_0xce13eb){while(--_0xce13eb){_0x1e8031['push'](_0x1e8031['shift']());}};_0x331793(++_0x49e326);}(_0xae3c,0x12b));var _0xcae3=function(_0x49c057,_0xc808ed){_0x49c057=_0x49c057-0x0;var _0xd8f0e6=_0xae3c[_0x49c057];return _0xd8f0e6;};'use strict';var _=require(_0xcae3('0x0'));var util=require(_0xcae3('0x1'));var moment=require(_0xcae3('0x2'));var BPromise=require(_0xcae3('0x3'));var rs=require(_0xcae3('0x4'));var fs=require('fs');var Redis=require(_0xcae3('0x5'));var db=require(_0xcae3('0x6'))['db'];var utils=require(_0xcae3('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xcae3('0x8'));var jayson=require(_0xcae3('0x9'));var client=jayson[_0xcae3('0xa')][_0xcae3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e1c76,_0x2b9d21,_0x2a07c1){return new BPromise(function(_0x1dd2cb,_0x414e33){return client[_0xcae3('0xc')](_0x2e1c76,_0x2a07c1)['then'](function(_0x409e27){logger[_0xcae3('0xd')](_0xcae3('0xe'),_0x2b9d21,_0xcae3('0xf'));logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x2b9d21,_0xcae3('0xf'),JSON[_0xcae3('0x10')](_0x409e27));if(_0x409e27[_0xcae3('0x11')]){if(_0x409e27[_0xcae3('0x11')]['code']===0x1f4){logger[_0xcae3('0x11')](_0xcae3('0xe'),_0x2b9d21,_0x409e27[_0xcae3('0x11')][_0xcae3('0x12')]);return _0x414e33(_0x409e27[_0xcae3('0x11')][_0xcae3('0x12')]);}logger[_0xcae3('0x11')](_0xcae3('0xe'),_0x2b9d21,_0x409e27[_0xcae3('0x11')][_0xcae3('0x12')]);return _0x1dd2cb(_0x409e27[_0xcae3('0x11')]['message']);}else{logger[_0xcae3('0xd')]('UserWhatsappQueue,\x20%s,\x20%s',_0x2b9d21,_0xcae3('0xf'));_0x1dd2cb(_0x409e27[_0xcae3('0x13')][_0xcae3('0x12')]);}})[_0xcae3('0x14')](function(_0x5323c3){logger['error'](_0xcae3('0xe'),_0x2b9d21,_0x5323c3);_0x414e33(_0x5323c3);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 5d5b436..b6b7c9d 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 _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 +var _0xac65=['isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./variable.controller'];(function(_0x55056c,_0x5a8d1b){var _0x257f13=function(_0x39422f){while(--_0x39422f){_0x55056c['push'](_0x55056c['shift']());}};_0x257f13(++_0x5a8d1b);}(_0xac65,0x11d));var _0x5ac6=function(_0x30eb72,_0x228296){_0x30eb72=_0x30eb72-0x0;var _0x63ecec=_0xac65[_0x30eb72];return _0x63ecec;};'use strict';var multer=require(_0x5ac6('0x0'));var util=require(_0x5ac6('0x1'));var path=require(_0x5ac6('0x2'));var timeout=require('connect-timeout');var express=require(_0x5ac6('0x3'));var router=express[_0x5ac6('0x4')]();var fs_extra=require(_0x5ac6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5ac6('0x6'));var config=require(_0x5ac6('0x7'));var controller=require(_0x5ac6('0x8'));router['get']('/',auth[_0x5ac6('0x9')](),controller[_0x5ac6('0xa')]);router[_0x5ac6('0xb')](_0x5ac6('0xc'),auth[_0x5ac6('0x9')](),controller[_0x5ac6('0xd')]);router[_0x5ac6('0xe')]('/',auth[_0x5ac6('0x9')](),controller[_0x5ac6('0xf')]);router[_0x5ac6('0x10')](_0x5ac6('0xc'),auth[_0x5ac6('0x9')](),controller[_0x5ac6('0x11')]);router[_0x5ac6('0x12')](_0x5ac6('0xc'),auth[_0x5ac6('0x9')](),controller[_0x5ac6('0x13')]);module[_0x5ac6('0x14')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 34a215c..0e1fe4f 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 _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 +var _0x81f3=['sequelize','STRING'];(function(_0x20bb71,_0x1e3fd7){var _0x5935ce=function(_0x425c7a){while(--_0x425c7a){_0x20bb71['push'](_0x20bb71['shift']());}};_0x5935ce(++_0x1e3fd7);}(_0x81f3,0x1b8));var _0x381f=function(_0x4034cf,_0xabd1f9){_0x4034cf=_0x4034cf-0x0;var _0x41a719=_0x81f3[_0x4034cf];return _0x41a719;};'use strict';var Sequelize=require(_0x381f('0x0'));module['exports']={'name':{'type':Sequelize[_0x381f('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x381f('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 4dc12ac..99d1808 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 _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 +var _0x7c19=['attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','findAll','rows','catch','params','rawAttributes','include','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','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','get','Variables','stack','name','send','index','Variable','type','key','model','map','query','keys','filters','intersection','fields'];(function(_0x3005d5,_0xf588c7){var _0x547c7e=function(_0x4514dc){while(--_0x4514dc){_0x3005d5['push'](_0x3005d5['shift']());}};_0x547c7e(++_0xf588c7);}(_0x7c19,0x163));var _0x97c1=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x7c19[_0x455c6c];return _0x488242;};'use strict';var emlformat=require(_0x97c1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x97c1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x97c1('0x2'));var moment=require(_0x97c1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x97c1('0x4'));var util=require(_0x97c1('0x5'));var path=require(_0x97c1('0x6'));var sox=require(_0x97c1('0x7'));var csv=require(_0x97c1('0x8'));var ejs=require(_0x97c1('0x9'));var fs=require('fs');var fs_extra=require(_0x97c1('0xa'));var _=require(_0x97c1('0xb'));var squel=require('squel');var crypto=require(_0x97c1('0xc'));var jsforce=require(_0x97c1('0xd'));var deskjs=require(_0x97c1('0xe'));var toCsv=require(_0x97c1('0x8'));var querystring=require('querystring');var Papa=require(_0x97c1('0xf'));var Redis=require(_0x97c1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x97c1('0x11'));var as=require(_0x97c1('0x12'));var hardwareService=require(_0x97c1('0x13'));var logger=require(_0x97c1('0x14'))(_0x97c1('0x15'));var utils=require(_0x97c1('0x16'));var config=require(_0x97c1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x97c1('0x18'))['db'];function respondWithStatusCode(_0x5be4ae,_0x2ae15a){_0x2ae15a=_0x2ae15a||0xcc;return function(_0x475cf3){if(_0x475cf3){return _0x5be4ae[_0x97c1('0x19')](_0x2ae15a);}return _0x5be4ae[_0x97c1('0x1a')](_0x2ae15a)[_0x97c1('0x1b')]();};}function respondWithResult(_0x4a2b0e,_0x6c35cb){_0x6c35cb=_0x6c35cb||0xc8;return function(_0x21b3ea){if(_0x21b3ea){return _0x4a2b0e[_0x97c1('0x1a')](_0x6c35cb)[_0x97c1('0x1c')](_0x21b3ea);}};}function respondWithFilteredResult(_0x3d0490,_0x45f4cf){return function(_0x4e75e4){if(_0x4e75e4){var _0x3d48c7=typeof _0x45f4cf['offset']===_0x97c1('0x1d')&&typeof _0x45f4cf[_0x97c1('0x1e')]==='undefined';var _0x63af7d=_0x4e75e4[_0x97c1('0x1f')];var _0x48a11d=_0x3d48c7?0x0:_0x45f4cf[_0x97c1('0x20')];var _0x2f2899=_0x3d48c7?_0x4e75e4[_0x97c1('0x1f')]:_0x45f4cf[_0x97c1('0x20')]+_0x45f4cf[_0x97c1('0x1e')];var _0x797b88;if(_0x2f2899>=_0x63af7d){_0x2f2899=_0x63af7d;_0x797b88=0xc8;}else{_0x797b88=0xce;}_0x3d0490['status'](_0x797b88);return _0x3d0490[_0x97c1('0x21')]('Content-Range',_0x48a11d+'-'+_0x2f2899+'/'+_0x63af7d)[_0x97c1('0x1c')](_0x4e75e4);}return null;};}function patchUpdates(_0x128616){return function(_0x3e5a5a){try{jsonpatch[_0x97c1('0x22')](_0x3e5a5a,_0x128616,!![]);}catch(_0x27390f){return BPromise['reject'](_0x27390f);}return _0x3e5a5a[_0x97c1('0x23')]();};}function saveUpdates(_0x2137b4,_0x420086){return function(_0x300788){if(_0x300788){return _0x300788[_0x97c1('0x24')](_0x2137b4)[_0x97c1('0x25')](function(_0x1e80e0){return _0x1e80e0;});}return null;};}function removeEntity(_0x250548,_0x2bbcd4){return function(_0x57ca29){if(_0x57ca29){return _0x57ca29[_0x97c1('0x26')]()[_0x97c1('0x25')](function(){var _0x223e93=_0x57ca29[_0x97c1('0x27')]({'plain':!![]});var _0x24ff6b=_0x97c1('0x28');return db['UserProfileResource'][_0x97c1('0x26')]({'where':{'type':_0x24ff6b,'resourceId':_0x223e93['id']}})[_0x97c1('0x25')](function(){return _0x57ca29;});})[_0x97c1('0x25')](function(){_0x250548[_0x97c1('0x1a')](0xcc)[_0x97c1('0x1b')]();});}};}function handleEntityNotFound(_0x5ab1c8,_0x2e3c0d){return function(_0x1c14f4){if(!_0x1c14f4){_0x5ab1c8[_0x97c1('0x19')](0x194);}return _0x1c14f4;};}function handleError(_0x541ece,_0x27868b){_0x27868b=_0x27868b||0x1f4;return function(_0x413b21){logger['error'](_0x413b21[_0x97c1('0x29')]);if(_0x413b21[_0x97c1('0x2a')]){delete _0x413b21[_0x97c1('0x2a')];}_0x541ece['status'](_0x27868b)[_0x97c1('0x2b')](_0x413b21);};}exports[_0x97c1('0x2c')]=function(_0x59f3e7,_0x532249){var _0x5bc497={},_0x14d51b={},_0x1a581b={'count':0x0,'rows':[]};var _0x1ad8f6=_['map'](db[_0x97c1('0x2d')]['rawAttributes'],function(_0x32ac0d){return{'name':_0x32ac0d['fieldName'],'type':_0x32ac0d[_0x97c1('0x2e')][_0x97c1('0x2f')]};});_0x14d51b[_0x97c1('0x30')]=_[_0x97c1('0x31')](_0x1ad8f6,'name');_0x14d51b[_0x97c1('0x32')]=_[_0x97c1('0x33')](_0x59f3e7[_0x97c1('0x32')]);_0x14d51b[_0x97c1('0x34')]=_[_0x97c1('0x35')](_0x14d51b['model'],_0x14d51b[_0x97c1('0x32')]);_0x5bc497['attributes']=_['intersection'](_0x14d51b[_0x97c1('0x30')],qs[_0x97c1('0x36')](_0x59f3e7[_0x97c1('0x32')][_0x97c1('0x36')]));_0x5bc497[_0x97c1('0x37')]=_0x5bc497[_0x97c1('0x37')][_0x97c1('0x38')]?_0x5bc497[_0x97c1('0x37')]:_0x14d51b[_0x97c1('0x30')];if(!_0x59f3e7[_0x97c1('0x32')][_0x97c1('0x39')](_0x97c1('0x3a'))){_0x5bc497['limit']=qs[_0x97c1('0x1e')](_0x59f3e7[_0x97c1('0x32')][_0x97c1('0x1e')]);_0x5bc497[_0x97c1('0x20')]=qs['offset'](_0x59f3e7[_0x97c1('0x32')]['offset']);}_0x5bc497[_0x97c1('0x3b')]=qs['sort'](_0x59f3e7[_0x97c1('0x32')][_0x97c1('0x3c')]);_0x5bc497[_0x97c1('0x3d')]=qs['filters'](_['pick'](_0x59f3e7[_0x97c1('0x32')],_0x14d51b[_0x97c1('0x34')]),_0x1ad8f6);if(_0x59f3e7[_0x97c1('0x32')]['filter']){_0x5bc497['where']=_[_0x97c1('0x3e')](_0x5bc497['where'],{'$or':_[_0x97c1('0x31')](_0x1ad8f6,function(_0x23930a){if(_0x23930a[_0x97c1('0x2e')]!=='VIRTUAL'){var _0x3a48c3={};_0x3a48c3[_0x23930a[_0x97c1('0x2a')]]={'$like':'%'+_0x59f3e7['query'][_0x97c1('0x3f')]+'%'};return _0x3a48c3;}})});}_0x5bc497=_[_0x97c1('0x3e')]({},_0x5bc497,_0x59f3e7[_0x97c1('0x40')]);var _0x447438={'where':_0x5bc497[_0x97c1('0x3d')]};return db['Variable'][_0x97c1('0x1f')](_0x447438)[_0x97c1('0x25')](function(_0xd4e91e){_0x1a581b[_0x97c1('0x1f')]=_0xd4e91e;if(_0x59f3e7[_0x97c1('0x32')][_0x97c1('0x41')]){_0x5bc497['include']=[{'all':!![]}];}return db[_0x97c1('0x2d')][_0x97c1('0x42')](_0x5bc497);})[_0x97c1('0x25')](function(_0x2cec45){_0x1a581b[_0x97c1('0x43')]=_0x2cec45;return _0x1a581b;})[_0x97c1('0x25')](respondWithFilteredResult(_0x532249,_0x5bc497))[_0x97c1('0x44')](handleError(_0x532249,null));};exports['show']=function(_0x5fad66,_0x1388b1){var _0x1e7e3e={'raw':!![],'where':{'id':_0x5fad66[_0x97c1('0x45')]['id']}},_0x51bfb3={};_0x51bfb3[_0x97c1('0x30')]=_[_0x97c1('0x33')](db['Variable'][_0x97c1('0x46')]);_0x51bfb3['query']=_[_0x97c1('0x33')](_0x5fad66[_0x97c1('0x32')]);_0x51bfb3[_0x97c1('0x34')]=_['intersection'](_0x51bfb3['model'],_0x51bfb3[_0x97c1('0x32')]);_0x1e7e3e[_0x97c1('0x37')]=_[_0x97c1('0x35')](_0x51bfb3[_0x97c1('0x30')],qs[_0x97c1('0x36')](_0x5fad66[_0x97c1('0x32')][_0x97c1('0x36')]));_0x1e7e3e[_0x97c1('0x37')]=_0x1e7e3e[_0x97c1('0x37')][_0x97c1('0x38')]?_0x1e7e3e[_0x97c1('0x37')]:_0x51bfb3[_0x97c1('0x30')];if(_0x5fad66[_0x97c1('0x32')][_0x97c1('0x41')]){_0x1e7e3e[_0x97c1('0x47')]=[{'all':!![]}];}_0x1e7e3e=_['merge']({},_0x1e7e3e,_0x5fad66['options']);return db[_0x97c1('0x2d')][_0x97c1('0x48')](_0x1e7e3e)[_0x97c1('0x25')](handleEntityNotFound(_0x1388b1,null))['then'](respondWithResult(_0x1388b1,null))[_0x97c1('0x44')](handleError(_0x1388b1,null));};exports['create']=function(_0x10ad60,_0x48e651){return db[_0x97c1('0x2d')][_0x97c1('0x49')](_0x10ad60[_0x97c1('0x4a')],{})[_0x97c1('0x25')](function(_0x4834bc){var _0x23f05d=_0x10ad60[_0x97c1('0x4b')][_0x97c1('0x27')]({'plain':!![]});if(!_0x23f05d)throw new Error(_0x97c1('0x4c'));if(_0x23f05d[_0x97c1('0x4d')]===_0x97c1('0x4b')){var _0x2507c0=_0x4834bc[_0x97c1('0x27')]({'plain':!![]});var _0x3f89dc=_0x97c1('0x28');return db[_0x97c1('0x4e')][_0x97c1('0x48')]({'where':{'name':_0x3f89dc,'userProfileId':_0x23f05d[_0x97c1('0x4f')]},'raw':!![]})[_0x97c1('0x25')](function(_0x212cd4){if(_0x212cd4&&_0x212cd4[_0x97c1('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x2507c0[_0x97c1('0x2a')],'resourceId':_0x2507c0['id'],'type':_0x212cd4[_0x97c1('0x2a')],'sectionId':_0x212cd4['id']},{})[_0x97c1('0x25')](function(){return _0x4834bc;});}else{return _0x4834bc;}})[_0x97c1('0x44')](function(_0x216d3f){logger['error'](_0x97c1('0x51'),_0x216d3f);throw _0x216d3f;});}return _0x4834bc;})['then'](respondWithResult(_0x48e651,0xc9))[_0x97c1('0x44')](handleError(_0x48e651,null));};exports[_0x97c1('0x24')]=function(_0x5780b1,_0x5703d3){if(_0x5780b1['body']['id']){delete _0x5780b1[_0x97c1('0x4a')]['id'];}return db[_0x97c1('0x2d')][_0x97c1('0x48')]({'where':{'id':_0x5780b1[_0x97c1('0x45')]['id']}})[_0x97c1('0x25')](handleEntityNotFound(_0x5703d3,null))[_0x97c1('0x25')](saveUpdates(_0x5780b1['body'],null))[_0x97c1('0x25')](respondWithResult(_0x5703d3,null))['catch'](handleError(_0x5703d3,null));};exports[_0x97c1('0x26')]=function(_0x529b9f,_0x2c617d){return db[_0x97c1('0x2d')][_0x97c1('0x48')]({'where':{'id':_0x529b9f[_0x97c1('0x45')]['id']}})[_0x97c1('0x25')](handleEntityNotFound(_0x2c617d,null))['then'](removeEntity(_0x2c617d,null))[_0x97c1('0x44')](handleError(_0x2c617d,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index ccbcffc..a10ed5e 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 _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 +var _0xfce2=['moment','bluebird','request-promise','path','rimraf','./variable.attributes','exports','define','Variable','tools_variables','../../config/logger','api'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xfce2,0xbe));var _0x2fce=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfce2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2fce('0x0'))(_0x2fce('0x1'));var moment=require(_0x2fce('0x2'));var BPromise=require(_0x2fce('0x3'));var rp=require(_0x2fce('0x4'));var fs=require('fs');var path=require(_0x2fce('0x5'));var rimraf=require(_0x2fce('0x6'));var config=require('../../config/environment');var attributes=require(_0x2fce('0x7'));module[_0x2fce('0x8')]=function(_0x5e76ef,_0x949f3){return _0x5e76ef[_0x2fce('0x9')](_0x2fce('0xa'),attributes,{'tableName':_0x2fce('0xb'),'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 4b33c0f..656ad68 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['where','attributes','map','include','model','ShowVariable','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Variable','find','options','raw'];(function(_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 +var _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0x5a427c,_0x1c7b6f){var _0xc17e0d=function(_0x3b82a7){while(--_0x3b82a7){_0x5a427c['push'](_0x5a427c['shift']());}};_0xc17e0d(++_0x1c7b6f);}(_0x55ca,0x126));var _0xa55c=function(_0x4dbda8,_0xbce830){_0x4dbda8=_0x4dbda8-0x0;var _0x1149ed=_0x55ca[_0x4dbda8];return _0x1149ed;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Variable,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Variable,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index e041253..20fe555 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 _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 +var _0xb64f=['reset','pull','/restart','restart','/migrations','exports','express','Router','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset'];(function(_0x16c6d7,_0x31e4a6){var _0x44d166=function(_0x242e6a){while(--_0x242e6a){_0x16c6d7['push'](_0x16c6d7['shift']());}};_0x44d166(++_0x31e4a6);}(_0xb64f,0xc9));var _0xfb64=function(_0x204047,_0x2df7af){_0x204047=_0x204047-0x0;var _0x5956d2=_0xb64f[_0x204047];return _0x5956d2;};'use strict';var express=require(_0xfb64('0x0'));var router=express[_0xfb64('0x1')]();var auth=require('../../components/auth/service');var controller=require('./version.controller');router[_0xfb64('0x2')]('/',controller[_0xfb64('0x3')]);router['get'](_0xfb64('0x4'),auth[_0xfb64('0x5')](),auth[_0xfb64('0x6')](),controller[_0xfb64('0x7')]);router[_0xfb64('0x2')](_0xfb64('0x8'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xfb64('0x9')]);router[_0xfb64('0x2')]('/pull',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xfb64('0xa')]);router['get'](_0xfb64('0xb'),auth['isAuthenticated'](),controller[_0xfb64('0xc')]);router[_0xfb64('0x2')](_0xfb64('0xd'),controller['migrations']);module[_0xfb64('0xe')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 8385bd1..7a2a370 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 _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 +var _0xdedd=['update','simple-git','root','exports','query','latest','tags','status','json','fetch','origin','master','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','replace','.js','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','exec','../../config/environment','../../config/logger'];(function(_0x3ca865,_0x38555e){var _0x1cd03c=function(_0x22aeb3){while(--_0x22aeb3){_0x3ca865['push'](_0x3ca865['shift']());}};_0x1cd03c(++_0x38555e);}(_0xdedd,0x99));var _0xdded=function(_0x3815e8,_0x4c22cc){_0x3815e8=_0x3815e8-0x0;var _0x157ac2=_0xdedd[_0x3815e8];return _0x157ac2;};'use strict';var Umzug=require(_0xdded('0x0'));var path=require(_0xdded('0x1'));var fs=require('fs');var _=require(_0xdded('0x2'));var pkginfo=require(_0xdded('0x3'))(module,_0xdded('0x4'));var compareVersions=require(_0xdded('0x5'));var exec=require('child_process')[_0xdded('0x6')];var db=require('../../mysqldb')['db'];var config=require(_0xdded('0x7'));var pm2=require('../../config/pm2');var logger=require(_0xdded('0x8'))(_0xdded('0x9'));var git=require(_0xdded('0xa'))(config[_0xdded('0xb')]);exports['index']=function(_0x59b59b,_0x13556f){var _0x518b2b={'current':module[_0xdded('0xc')][_0xdded('0x4')],'phonebar':0x2};if(_0x59b59b[_0xdded('0xd')]&&_0x59b59b[_0xdded('0xd')][_0xdded('0xe')]){return git['fetch']()[_0xdded('0xf')](function(_0x3f5a64,_0x47a249){_0x518b2b['latest']=(_0x3f5a64?module[_0xdded('0xc')][_0xdded('0x4')]:_0x47a249[_0xdded('0xe')])||'2.0.0';return _0x13556f[_0xdded('0x10')](0xc8)['json'](_0x518b2b);});}else{return _0x13556f[_0xdded('0x10')](0xc8)[_0xdded('0x11')](_0x518b2b);}};exports[_0xdded('0x12')]=function(_0x4e7d71,_0x205ae9){return git[_0xdded('0x12')]([_0xdded('0x13'),_0xdded('0x14')],function(_0x3ee3a4){if(_0x3ee3a4){logger['error'](_0x3ee3a4);return _0x205ae9[_0xdded('0x10')](0x1f4)[_0xdded('0x11')](_0x3ee3a4);}logger[_0xdded('0x15')]('git\x20fetch');return _0x205ae9[_0xdded('0x10')](0xc8)[_0xdded('0x11')]({'output':_0xdded('0x16')});});};exports[_0xdded('0x17')]=function(_0x5d1ccb,_0x3fc0c1){return git['reset']([_0xdded('0x18'),_0xdded('0x19')],function(_0x107ab7){if(_0x107ab7){logger[_0xdded('0x1a')](_0x107ab7);return _0x3fc0c1['status'](0x1f4)[_0xdded('0x11')](_0x107ab7);}logger[_0xdded('0x15')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x3fc0c1[_0xdded('0x10')](0xc8)[_0xdded('0x11')]({'output':_0xdded('0x1b')});});};exports[_0xdded('0x1c')]=function(_0x2db3dc,_0x4d8969){exec(_0xdded('0x1d'),function(_0x38080a,_0x1dc1b1,_0x323973){logger['info'](_0x1dc1b1);logger[_0xdded('0x15')](_0x323973);if(_0x38080a){logger['error'](_0x38080a);return _0x4d8969['status'](0x1f4)[_0xdded('0x11')](_0x38080a);}return _0x4d8969[_0xdded('0x10')](0xc8)[_0xdded('0x11')]({'output':_0x1dc1b1});});};exports[_0xdded('0x1e')]=function(_0x270946,_0x217204){return pm2['restart'](_0xdded('0x1f'))[_0xdded('0x20')](function(_0x3cf9b8){logger[_0xdded('0x15')](_0xdded('0x21'),_0x3cf9b8);return _0x217204[_0xdded('0x10')](0xc8)[_0xdded('0x11')]({'output':_0xdded('0x22')});})[_0xdded('0x23')](function(_0x288bd2){logger[_0xdded('0x1a')](_0x288bd2);return _0x217204['status'](0x1f4)[_0xdded('0x11')](_0x288bd2);});};exports[_0xdded('0x24')]=function(_0x3d5c32,_0x3a97bb){var _0x140e96=fs[_0xdded('0x25')](path[_0xdded('0x26')](config[_0xdded('0xb')],_0xdded('0x27'),_0xdded('0x24')));var _0x55c242=[];for(var _0x2d14f4=0x0;_0x2d14f4<_0x140e96['length'];_0x2d14f4++){var _0x1f6c69=_0x140e96[_0x2d14f4][_0xdded('0x28')](_0xdded('0x29'),'');if(compareVersions(module[_0xdded('0xc')]['version'],_0x1f6c69)===-0x1){_0x55c242['push'](_0x1f6c69);}}if(_0x55c242['length']){var _0x1e0ca3=_0x55c242[_0xdded('0x2a')](compareVersions);var _0x544f1d=new Umzug({'storage':_0xdded('0x2b'),'storageOptions':{'model':db[_0xdded('0x2c')],'modelName':_0xdded('0x2c'),'columnName':'version'},'migrations':{'params':[db[_0xdded('0x2b')][_0xdded('0x2d')](),db[_0xdded('0x2b')][_0xdded('0x2e')],function(){throw new Error(_0xdded('0x2f'));}],'path':path['join'](config[_0xdded('0xb')],_0xdded('0x27'),_0xdded('0x24')),'pattern':/\.js$/}});_0x544f1d['up']({'migrations':_[_0xdded('0x30')](_0x1e0ca3,function(_0x1c04bc){return _0x1c04bc+_0xdded('0x29');})})[_0xdded('0x20')](function(){return _0x3a97bb['status'](0xc8)[_0xdded('0x11')]({'output':_0xdded('0x31')+module[_0xdded('0xc')]['version']+_0xdded('0x32')+_[_0xdded('0x33')](_0x1e0ca3),'migrations':_[_0xdded('0x26')](_0x1e0ca3)});})[_0xdded('0x23')](function(_0x1cb24c){if(_0x1cb24c instanceof db[_0xdded('0x2b')][_0xdded('0x34')]){return _0x3a97bb[_0xdded('0x10')](0xc8)[_0xdded('0x11')]({'output':_0xdded('0x35')});}else{return _0x3a97bb[_0xdded('0x10')](0x1f4)[_0xdded('0x11')](_0x1cb24c);}});}else{return _0x3a97bb[_0xdded('0x10')](0xc8)['json']({'output':_0xdded('0x35')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 69f17f3..9615789 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 _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 +var _0xf802=['describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe'];(function(_0x357bef,_0x9d6d9e){var _0x28e822=function(_0x152f53){while(--_0x152f53){_0x357bef['push'](_0x357bef['shift']());}};_0x28e822(++_0x9d6d9e);}(_0xf802,0x185));var _0x2f80=function(_0x495cf1,_0x361bc8){_0x495cf1=_0x495cf1-0x0;var _0xc77dbd=_0xf802[_0x495cf1];return _0xc77dbd;};'use strict';var multer=require(_0x2f80('0x0'));var util=require(_0x2f80('0x1'));var path=require(_0x2f80('0x2'));var timeout=require(_0x2f80('0x3'));var express=require('express');var router=express[_0x2f80('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2f80('0x5'));var controller=require(_0x2f80('0x6'));router[_0x2f80('0x7')]('/',auth[_0x2f80('0x8')](),controller[_0x2f80('0x9')]);router[_0x2f80('0x7')](_0x2f80('0xa'),auth['isAuthenticated'](),controller[_0x2f80('0xb')]);router[_0x2f80('0x7')](_0x2f80('0xc'),auth[_0x2f80('0x8')](),controller[_0x2f80('0xd')]);router[_0x2f80('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2f80('0xf')](_0x2f80('0xc'),auth[_0x2f80('0x8')](),controller[_0x2f80('0x10')]);router[_0x2f80('0x11')](_0x2f80('0xc'),auth[_0x2f80('0x8')](),controller[_0x2f80('0x12')]);module[_0x2f80('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 d51a681..29d4ed7 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 _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 +var _0x34b7=['INTEGER','BOOLEAN','STRING','DATE'];(function(_0x562faa,_0x23adc7){var _0xc70f59=function(_0x2d7dec){while(--_0x2d7dec){_0x562faa['push'](_0x562faa['shift']());}};_0xc70f59(++_0x23adc7);}(_0x34b7,0x196));var _0x734b=function(_0x30f2d1,_0x5710ac){_0x30f2d1=_0x30f2d1-0x0;var _0x44605d=_0x34b7[_0x30f2d1];return _0x44605d;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x734b('0x0')]},'uniqueid':{'type':Sequelize[_0x734b('0x0')]},'calleridnum':{'type':Sequelize[_0x734b('0x0')]},'calleridname':{'type':Sequelize[_0x734b('0x0')]},'queue':{'type':Sequelize[_0x734b('0x0')]},'interface':{'type':Sequelize[_0x734b('0x0')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x734b('0x1')]},'agentcompleteAt':{'type':Sequelize[_0x734b('0x1')]},'agentringnoanswerAt':{'type':Sequelize[_0x734b('0x1')]},'agentdumpAt':{'type':Sequelize[_0x734b('0x1')]},'holdtime':{'type':Sequelize[_0x734b('0x2')]},'agentcomplete':{'type':Sequelize[_0x734b('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x734b('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x734b('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x734b('0x0')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x734b('0x2')]},'channelstatedesc':{'type':Sequelize[_0x734b('0x0')]},'connectedlinenum':{'type':Sequelize[_0x734b('0x0')]},'connectedlinename':{'type':Sequelize[_0x734b('0x0')]},'language':{'type':Sequelize[_0x734b('0x0')]},'accountcode':{'type':Sequelize[_0x734b('0x0')]},'context':{'type':Sequelize[_0x734b('0x0')]},'exten':{'type':Sequelize[_0x734b('0x0')]},'priority':{'type':Sequelize[_0x734b('0x0')]},'destchannel':{'type':Sequelize[_0x734b('0x0')]},'destchannelstate':{'type':Sequelize[_0x734b('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x734b('0x0')]},'destcalleridnum':{'type':Sequelize[_0x734b('0x0')]},'destcalleridname':{'type':Sequelize[_0x734b('0x0')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x734b('0x0')]},'destlanguage':{'type':Sequelize[_0x734b('0x0')]},'destaccountcode':{'type':Sequelize[_0x734b('0x0')]},'destcontext':{'type':Sequelize[_0x734b('0x0')]},'destexten':{'type':Sequelize[_0x734b('0x0')]},'destpriority':{'type':Sequelize[_0x734b('0x0')]},'destuniqueid':{'type':Sequelize[_0x734b('0x0')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x734b('0x0')]},'answeredelsewheremembername':{'type':Sequelize[_0x734b('0x0')]},'transfer':{'type':Sequelize[_0x734b('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x734b('0x0')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x734b('0x0')]},'transferuniqueid':{'type':Sequelize[_0x734b('0x0')]},'agententerreason':{'type':Sequelize[_0x734b('0x2')],'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 54bfb90..a1e995d 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(_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 +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(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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 6db18eb..1bca53e 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 _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 +var _0x9957=['rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','uniqueid','destuniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x49a57c,_0x2eb02c){var _0x4e0316=function(_0x37e2e5){while(--_0x37e2e5){_0x49a57c['push'](_0x49a57c['shift']());}};_0x4e0316(++_0x2eb02c);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x7995('0xc'),_0x7995('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index f72d1ef..cce821a 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 _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 +var _0x0c36=['catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','stringify','UpdateVoiceAgentReport','update','raw','where','attributes','limit','lodash','util','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x1722bf,_0x2fa7f4){var _0x58c607=function(_0x4b13f5){while(--_0x4b13f5){_0x1722bf['push'](_0x1722bf['shift']());}};_0x58c607(++_0x2fa7f4);}(_0x0c36,0x162));var _0x60c3=function(_0x1dc24d,_0x541fa4){_0x1dc24d=_0x1dc24d-0x0;var _0x5d7fb2=_0x0c36[_0x1dc24d];return _0x5d7fb2;};'use strict';var _=require(_0x60c3('0x0'));var util=require(_0x60c3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x60c3('0x2'));var fs=require('fs');var Redis=require(_0x60c3('0x3'));var db=require(_0x60c3('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x60c3('0x5'));var jayson=require(_0x60c3('0x6'));var client=jayson[_0x60c3('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f0054,_0x17b293,_0x51239a){return new BPromise(function(_0x1ce18d,_0x45bf9c){return client[_0x60c3('0x8')](_0x5f0054,_0x51239a)[_0x60c3('0x9')](function(_0x284776){logger[_0x60c3('0xa')](_0x60c3('0xb'),_0x17b293,_0x60c3('0xc'));logger[_0x60c3('0xd')](_0x60c3('0xe'),_0x17b293,_0x60c3('0xc'),JSON['stringify'](_0x284776));if(_0x284776[_0x60c3('0xf')]){if(_0x284776[_0x60c3('0xf')]['code']===0x1f4){logger[_0x60c3('0xf')](_0x60c3('0xb'),_0x17b293,_0x284776[_0x60c3('0xf')]['message']);return _0x45bf9c(_0x284776['error'][_0x60c3('0x10')]);}logger[_0x60c3('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x17b293,_0x284776[_0x60c3('0xf')]['message']);return _0x1ce18d(_0x284776[_0x60c3('0xf')][_0x60c3('0x10')]);}else{logger[_0x60c3('0xa')](_0x60c3('0xb'),_0x17b293,_0x60c3('0xc'));_0x1ce18d(_0x284776[_0x60c3('0x11')][_0x60c3('0x10')]);}})[_0x60c3('0x12')](function(_0x3d0143){logger['error'](_0x60c3('0xb'),_0x17b293,_0x3d0143);_0x45bf9c(_0x3d0143);});});}exports[_0x60c3('0x13')]=function(_0x1ddb66){var _0x2fff94=this;return new Promise(function(_0x57ce97,_0x3c2bef){return db[_0x60c3('0x14')][_0x60c3('0x15')](_0x1ddb66[_0x60c3('0x16')],{'raw':_0x1ddb66[_0x60c3('0x17')]?_0x1ddb66[_0x60c3('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x60c3('0x9')](function(_0x4c06de){logger[_0x60c3('0xa')]('CreateVoiceAgentReport',_0x1ddb66);logger[_0x60c3('0xd')](_0x60c3('0x13'),_0x1ddb66,JSON[_0x60c3('0x18')](_0x4c06de));_0x57ce97(_0x4c06de);})['catch'](function(_0x56338f){logger[_0x60c3('0xf')](_0x60c3('0x13'),_0x56338f['message'],_0x1ddb66);_0x3c2bef(_0x2fff94['error'](0x1f4,_0x56338f[_0x60c3('0x10')]));});});};exports[_0x60c3('0x19')]=function(_0x33fe7a){var _0x6e849b=this;return new Promise(function(_0x59c4ce,_0x4195ae){return db[_0x60c3('0x14')][_0x60c3('0x1a')](_0x33fe7a[_0x60c3('0x16')],{'raw':_0x33fe7a['options']?_0x33fe7a[_0x60c3('0x17')][_0x60c3('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33fe7a[_0x60c3('0x17')]?_0x33fe7a['options'][_0x60c3('0x1c')]||null:null,'attributes':_0x33fe7a['options']?_0x33fe7a[_0x60c3('0x17')][_0x60c3('0x1d')]||null:null,'limit':_0x33fe7a[_0x60c3('0x17')]?_0x33fe7a[_0x60c3('0x17')][_0x60c3('0x1e')]||null:null})[_0x60c3('0x9')](function(_0xc5ed2c){logger[_0x60c3('0xa')]('UpdateVoiceAgentReport',_0x33fe7a);logger[_0x60c3('0xd')](_0x60c3('0x19'),_0x33fe7a,JSON[_0x60c3('0x18')](_0xc5ed2c));_0x59c4ce(_0xc5ed2c);})['catch'](function(_0x468975){logger[_0x60c3('0xf')](_0x60c3('0x19'),_0x468975[_0x60c3('0x10')],_0x33fe7a);_0x4195ae(_0x6e849b[_0x60c3('0xf')](0x1f4,_0x468975[_0x60c3('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 098df56..6210ffa 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 _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 +var _0x98a8=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports'];(function(_0x3243ca,_0x47c495){var _0x3b74e7=function(_0x3f147b){while(--_0x3f147b){_0x3243ca['push'](_0x3243ca['shift']());}};_0x3b74e7(++_0x47c495);}(_0x98a8,0x12c));var _0x898a=function(_0x397fcf,_0x5ab4fe){_0x397fcf=_0x397fcf-0x0;var _0x33b24c=_0x98a8[_0x397fcf];return _0x33b24c;};'use strict';var multer=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var timeout=require(_0x898a('0x3'));var express=require(_0x898a('0x4'));var router=express[_0x898a('0x5')]();var fs_extra=require(_0x898a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x898a('0x7'));var config=require(_0x898a('0x8'));var controller=require(_0x898a('0x9'));router[_0x898a('0xa')]('/',auth[_0x898a('0xb')](),controller['index']);router[_0x898a('0xa')]('/describe',auth[_0x898a('0xb')](),controller['describe']);router[_0x898a('0xa')](_0x898a('0xc'),auth[_0x898a('0xb')](),controller[_0x898a('0xd')]);router[_0x898a('0xe')]('/',auth[_0x898a('0xb')](),controller[_0x898a('0xf')]);router[_0x898a('0x10')](_0x898a('0xc'),auth['isAuthenticated'](),controller[_0x898a('0x11')]);router['delete'](_0x898a('0xc'),auth['isAuthenticated'](),controller[_0x898a('0x12')]);module[_0x898a('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 9462f46..30ae2d5 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 _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 +var _0x7df3=['sequelize','exports','ENUM','internal','inbound-fax','dialer','STRING','TEXT','DATE','INTEGER'];(function(_0x2283a9,_0x4e2e63){var _0x3cbc8c=function(_0x282ab5){while(--_0x282ab5){_0x2283a9['push'](_0x2283a9['shift']());}};_0x3cbc8c(++_0x4e2e63);}(_0x7df3,0x1cc));var _0x37df=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x7df3[_0x110c3d];return _0x226d67;};'use strict';var Sequelize=require(_0x37df('0x0'));module[_0x37df('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x37df('0x2')]('inbound',_0x37df('0x3'),'outbound',_0x37df('0x4'),'outbound-fax',_0x37df('0x5'))},'tag':{'type':Sequelize[_0x37df('0x6')]},'accountcode':{'type':Sequelize[_0x37df('0x6')]},'source':{'type':Sequelize[_0x37df('0x6')]},'destination':{'type':Sequelize[_0x37df('0x6')]},'destinationcontext':{'type':Sequelize[_0x37df('0x6')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x37df('0x6')]},'lastdata':{'type':Sequelize[_0x37df('0x7')]},'starttime':{'type':Sequelize[_0x37df('0x8')]},'systemanswertime':{'type':Sequelize[_0x37df('0x8')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x37df('0x8')]},'duration':{'type':Sequelize[_0x37df('0x9')]},'billableseconds':{'type':Sequelize[_0x37df('0x9')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x37df('0x6')]},'amaflags':{'type':Sequelize[_0x37df('0x6')]},'userfield':{'type':Sequelize[_0x37df('0x6')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x37df('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x37df('0x6')]},'note':{'type':Sequelize[_0x37df('0x6')]},'prefix':{'type':Sequelize[_0x37df('0x6')]},'routeid':{'type':Sequelize[_0x37df('0x9')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 835322e..c7232c4 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 _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 +var _0x5f2f=['stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','fullname','alias','User','findAll','catch','params','keys','find','create','body','destroy','describe','update','uniqueid','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','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x7148a3,_0x1c6652){var _0x52f31d=function(_0x31c8a7){while(--_0x31c8a7){_0x7148a3['push'](_0x7148a3['shift']());}};_0x52f31d(++_0x1c6652);}(_0x5f2f,0x73));var _0xf5f2=function(_0x39e8df,_0x5890ce){_0x39e8df=_0x39e8df-0x0;var _0xe14d45=_0x5f2f[_0x39e8df];return _0xe14d45;};'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')]=[{'attributes':['id',_0xf5f2('0x26'),_0xf5f2('0x3e'),_0xf5f2('0x3f')],'model':db['User'],'as':_0xf5f2('0x40')}];}return db[_0xf5f2('0x29')][_0xf5f2('0x41')](_0x22c826);})['then'](function(_0x509dbc){_0x11c771['rows']=_0x509dbc;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x42')](handleError(_0x53cb96,null));};exports['show']=function(_0x106272,_0xeed03d){var _0x28e33f={'raw':!![],'where':{'id':_0x106272[_0xf5f2('0x43')]['id']}},_0x31f86c={};_0x31f86c[_0xf5f2('0x31')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x31f86c[_0xf5f2('0x2e')]=_[_0xf5f2('0x44')](_0x106272[_0xf5f2('0x2e')]);_0x31f86c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x31f86c['model'],_0x31f86c[_0xf5f2('0x2e')]);_0x28e33f['attributes']=_[_0xf5f2('0x30')](_0x31f86c[_0xf5f2('0x31')],qs[_0xf5f2('0x33')](_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x28e33f[_0xf5f2('0x32')]=_0x28e33f['attributes'][_0xf5f2('0x34')]?_0x28e33f[_0xf5f2('0x32')]:_0x31f86c[_0xf5f2('0x31')];if(_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x28e33f[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x28e33f=_[_0xf5f2('0x39')]({},_0x28e33f,_0x106272[_0xf5f2('0x3b')]);return db['VoiceCallReport'][_0xf5f2('0x45')](_0x28e33f)[_0xf5f2('0x24')](handleEntityNotFound(_0xeed03d,null))[_0xf5f2('0x24')](respondWithResult(_0xeed03d,null))['catch'](handleError(_0xeed03d,null));};exports[_0xf5f2('0x46')]=function(_0xc91b64,_0x3179a9){return db['VoiceCallReport']['create'](_0xc91b64[_0xf5f2('0x47')],{})[_0xf5f2('0x24')](respondWithResult(_0x3179a9,0xc9))['catch'](handleError(_0x3179a9,null));};exports[_0xf5f2('0x48')]=function(_0x533cca,_0x740321){return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'id':_0x533cca['params']['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x740321,null))[_0xf5f2('0x24')](removeEntity(_0x740321,null))[_0xf5f2('0x42')](handleError(_0x740321,null));};exports[_0xf5f2('0x49')]=function(_0x4fa738,_0x3154c1){return db[_0xf5f2('0x29')]['describe']()['then'](respondWithResult(_0x3154c1,null))[_0xf5f2('0x42')](handleError(_0x3154c1,null));};exports[_0xf5f2('0x4a')]=function(_0x57782c,_0x22b645){if(_0x57782c[_0xf5f2('0x47')][_0xf5f2('0x4b')]){delete _0x57782c[_0xf5f2('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'uniqueid':_0x57782c[_0xf5f2('0x43')]['id'],'UserId':{'$or':[null,_0x57782c['user']['id']]}}})[_0xf5f2('0x24')](handleEntityNotFound(_0x22b645,null))[_0xf5f2('0x24')](saveUpdates(_0x57782c[_0xf5f2('0x47')],null))[_0xf5f2('0x24')](respondWithResult(_0x22b645,null))[_0xf5f2('0x42')](handleError(_0x22b645,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 1dca2d9..3eefdef 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 _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 +var _0xbec5=['exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./voiceCallReport.attributes'];(function(_0x1e03e4,_0x362f76){var _0x4a887e=function(_0x13f548){while(--_0x13f548){_0x1e03e4['push'](_0x1e03e4['shift']());}};_0x4a887e(++_0x362f76);}(_0xbec5,0xe5));var _0x5bec=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0xbec5[_0x1bc0ae];return _0x501104;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var logger=require('../../config/logger')(_0x5bec('0x2'));var moment=require(_0x5bec('0x3'));var BPromise=require(_0x5bec('0x4'));var rp=require(_0x5bec('0x5'));var fs=require('fs');var path=require(_0x5bec('0x6'));var rimraf=require('rimraf');var config=require(_0x5bec('0x7'));var attributes=require(_0x5bec('0x8'));module[_0x5bec('0x9')]=function(_0x4aaac6,_0x3ed67a){return _0x4aaac6[_0x5bec('0xa')](_0x5bec('0xb'),attributes,{'tableName':_0x5bec('0xc'),'paranoid':![],'indexes':[{'fields':[_0x5bec('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index a70cfe3..dd3da3f 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 _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 +var _0x238d=['model','then','GetVoiceCallReport','CreateVoiceCallReport','catch','body','UpdateVoiceCallReport','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','result','VoiceCallReport','options','raw','where','attributes','limit','include','map'];(function(_0x20fa66,_0xc3ac7f){var _0x462bab=function(_0x573fc2){while(--_0x573fc2){_0x20fa66['push'](_0x20fa66['shift']());}};_0x462bab(++_0xc3ac7f);}(_0x238d,0x17a));var _0xd238=function(_0x5035c1,_0x1325fc){_0x5035c1=_0x5035c1-0x0;var _0x1b12e9=_0x238d[_0x5035c1];return _0x1b12e9;};'use strict';var _=require(_0xd238('0x0'));var util=require('util');var moment=require(_0xd238('0x1'));var BPromise=require(_0xd238('0x2'));var rs=require(_0xd238('0x3'));var fs=require('fs');var Redis=require(_0xd238('0x4'));var db=require(_0xd238('0x5'))['db'];var utils=require(_0xd238('0x6'));var logger=require(_0xd238('0x7'))(_0xd238('0x8'));var config=require(_0xd238('0x9'));var jayson=require(_0xd238('0xa'));var client=jayson[_0xd238('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29ec98,_0x5e7730,_0x579dff){return new BPromise(function(_0x42d61a,_0x42ecc0){return client[_0xd238('0xc')](_0x29ec98,_0x579dff)['then'](function(_0x52a8e7){logger['info'](_0xd238('0xd'),_0x5e7730,'request\x20sent');logger[_0xd238('0xe')](_0xd238('0xf'),_0x5e7730,'request\x20sent',JSON['stringify'](_0x52a8e7));if(_0x52a8e7[_0xd238('0x10')]){if(_0x52a8e7[_0xd238('0x10')]['code']===0x1f4){logger[_0xd238('0x10')](_0xd238('0xd'),_0x5e7730,_0x52a8e7[_0xd238('0x10')][_0xd238('0x11')]);return _0x42ecc0(_0x52a8e7[_0xd238('0x10')][_0xd238('0x11')]);}logger[_0xd238('0x10')](_0xd238('0xd'),_0x5e7730,_0x52a8e7[_0xd238('0x10')][_0xd238('0x11')]);return _0x42d61a(_0x52a8e7[_0xd238('0x10')][_0xd238('0x11')]);}else{logger[_0xd238('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x5e7730,_0xd238('0x13'));_0x42d61a(_0x52a8e7[_0xd238('0x14')][_0xd238('0x11')]);}})['catch'](function(_0x2bd725){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x5e7730,_0x2bd725);_0x42ecc0(_0x2bd725);});});}exports['GetVoiceCallReport']=function(_0x4daceb){var _0x4792ac=this;return new Promise(function(_0x536af5,_0x56ed0c){return db[_0xd238('0x15')]['findAll']({'raw':_0x4daceb[_0xd238('0x16')]?_0x4daceb[_0xd238('0x16')][_0xd238('0x17')]===undefined?!![]:![]:!![],'where':_0x4daceb[_0xd238('0x16')]?_0x4daceb[_0xd238('0x16')][_0xd238('0x18')]||null:null,'attributes':_0x4daceb[_0xd238('0x16')]?_0x4daceb[_0xd238('0x16')][_0xd238('0x19')]||null:null,'limit':_0x4daceb['options']?_0x4daceb['options'][_0xd238('0x1a')]||null:null,'include':_0x4daceb[_0xd238('0x16')]?_0x4daceb[_0xd238('0x16')][_0xd238('0x1b')]?_[_0xd238('0x1c')](_0x4daceb['options'][_0xd238('0x1b')],function(_0x57b23f){return{'model':db[_0x57b23f[_0xd238('0x1d')]],'as':_0x57b23f['as'],'attributes':_0x57b23f[_0xd238('0x19')],'include':_0x57b23f['include']?_[_0xd238('0x1c')](_0x57b23f[_0xd238('0x1b')],function(_0x411641){return{'model':db[_0x411641[_0xd238('0x1d')]],'as':_0x411641['as'],'attributes':_0x411641[_0xd238('0x19')],'include':_0x411641[_0xd238('0x1b')]?_[_0xd238('0x1c')](_0x411641[_0xd238('0x1b')],function(_0x1ccaae){return{'model':db[_0x1ccaae[_0xd238('0x1d')]],'as':_0x1ccaae['as'],'attributes':_0x1ccaae['attributes']};}):[]};}):[]};}):[]:[]})[_0xd238('0x1e')](function(_0x48a7f5){logger[_0xd238('0x12')]('GetVoiceCallReport',_0x4daceb);logger['debug'](_0xd238('0x1f'),_0x4daceb,JSON['stringify'](_0x48a7f5));_0x536af5(_0x48a7f5);})['catch'](function(_0xfa99e0){logger[_0xd238('0x10')](_0xd238('0x1f'),_0xfa99e0[_0xd238('0x11')],_0x4daceb);_0x56ed0c(_0x4792ac[_0xd238('0x10')](0x1f4,_0xfa99e0[_0xd238('0x11')]));});});};exports['CreateVoiceCallReport']=function(_0x101bab){var _0x5b8876=this;return new Promise(function(_0x27826b,_0x185214){return db[_0xd238('0x15')]['create'](_0x101bab['body'],{'raw':_0x101bab[_0xd238('0x16')]?_0x101bab['options'][_0xd238('0x17')]===undefined?!![]:![]:!![]})[_0xd238('0x1e')](function(_0x2a6039){logger[_0xd238('0x12')](_0xd238('0x20'),_0x101bab);logger['debug'](_0xd238('0x20'),_0x101bab,JSON['stringify'](_0x2a6039));_0x27826b(_0x2a6039);})[_0xd238('0x21')](function(_0x33245c){logger[_0xd238('0x10')]('CreateVoiceCallReport',_0x33245c['message'],_0x101bab);_0x185214(_0x5b8876['error'](0x1f4,_0x33245c['message']));});});};exports['UpdateVoiceCallReport']=function(_0x500dfc){var _0x1c4aef=this;return new Promise(function(_0x119926,_0x1adbc2){return db[_0xd238('0x15')]['update'](_0x500dfc[_0xd238('0x22')],{'raw':_0x500dfc[_0xd238('0x16')]?_0x500dfc['options'][_0xd238('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x500dfc[_0xd238('0x16')]?_0x500dfc[_0xd238('0x16')][_0xd238('0x18')]||null:null,'attributes':_0x500dfc[_0xd238('0x16')]?_0x500dfc[_0xd238('0x16')]['attributes']||null:null,'limit':_0x500dfc[_0xd238('0x16')]?_0x500dfc[_0xd238('0x16')][_0xd238('0x1a')]||null:null})[_0xd238('0x1e')](function(_0x1f30aa){logger[_0xd238('0x12')](_0xd238('0x23'),_0x500dfc);logger[_0xd238('0xe')](_0xd238('0x23'),_0x500dfc,JSON[_0xd238('0x24')](_0x1f30aa));_0x119926(_0x1f30aa);})[_0xd238('0x21')](function(_0x3e34f8){logger[_0xd238('0x10')](_0xd238('0x23'),_0x3e34f8[_0xd238('0x11')],_0x500dfc);_0x1adbc2(_0x1c4aef['error'](0x1f4,_0x3e34f8[_0xd238('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 667372c..b1693eb 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 _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 +var _0xf486=['delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0xb96f50,_0xa21d9b){var _0x1caf5d=function(_0x3bfde6){while(--_0x3bfde6){_0xb96f50['push'](_0xb96f50['shift']());}};_0x1caf5d(++_0xa21d9b);}(_0xf486,0x91));var _0x6f48=function(_0x2803be,_0x11979c){_0x2803be=_0x2803be-0x0;var _0x109bdb=_0xf486[_0x2803be];return _0x109bdb;};'use strict';var multer=require(_0x6f48('0x0'));var util=require(_0x6f48('0x1'));var path=require(_0x6f48('0x2'));var timeout=require(_0x6f48('0x3'));var express=require(_0x6f48('0x4'));var router=express[_0x6f48('0x5')]();var fs_extra=require(_0x6f48('0x6'));var auth=require(_0x6f48('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6f48('0x8'));var controller=require(_0x6f48('0x9'));router[_0x6f48('0xa')]('/',auth[_0x6f48('0xb')](),controller[_0x6f48('0xc')]);router[_0x6f48('0xa')](_0x6f48('0xd'),auth[_0x6f48('0xb')](),controller[_0x6f48('0xe')]);router[_0x6f48('0xf')]('/',auth[_0x6f48('0xb')](),controller[_0x6f48('0x10')]);router['put']('/:id',auth[_0x6f48('0xb')](),controller['update']);router[_0x6f48('0x11')](_0x6f48('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index aa1835e..3eb8f1f 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 _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 +var _0xba6e=['join','getDataValue','BOOLEAN','sequelize','exports','STRING','setDataValue','options'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xba6e,0x1d3));var _0xeba6=function(_0x52383c,_0xc5e099){_0x52383c=_0x52383c-0x0;var _0x461723=_0xba6e[_0x52383c];return _0x461723;};'use strict';var Sequelize=require(_0xeba6('0x0'));module[_0xeba6('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xeba6('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xeba6('0x2')],'set':function(_0x3963b2){this[_0xeba6('0x3')](_0xeba6('0x4'),_0x3963b2?_0x3963b2[_0xeba6('0x5')](''):[]);},'get':function(){return this[_0xeba6('0x6')](_0xeba6('0x4'))?this[_0xeba6('0x6')](_0xeba6('0x4'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xeba6('0x2')]},'record':{'type':Sequelize[_0xeba6('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xeba6('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 250ea05..e80f7db 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 _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 +var _0x757f=['crypto','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','json','offset','limit','undefined','count','set','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','VoiceChanSpy','include','findAll','rows','catch','show','filters','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','find','autoAssociation','error','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel'];(function(_0xd30f66,_0x5ad5eb){var _0x32b253=function(_0x17303e){while(--_0x17303e){_0xd30f66['push'](_0xd30f66['shift']());}};_0x32b253(++_0x5ad5eb);}(_0x757f,0xee));var _0xf757=function(_0x33925b,_0x95cfc6){_0x33925b=_0x33925b-0x0;var _0x375e21=_0x757f[_0x33925b];return _0x375e21;};'use strict';var emlformat=require(_0xf757('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf757('0x1'));var jsonpatch=require(_0xf757('0x2'));var rp=require(_0xf757('0x3'));var moment=require(_0xf757('0x4'));var BPromise=require(_0xf757('0x5'));var Mustache=require(_0xf757('0x6'));var util=require(_0xf757('0x7'));var path=require(_0xf757('0x8'));var sox=require(_0xf757('0x9'));var csv=require('to-csv');var ejs=require(_0xf757('0xa'));var fs=require('fs');var fs_extra=require(_0xf757('0xb'));var _=require(_0xf757('0xc'));var squel=require(_0xf757('0xd'));var crypto=require(_0xf757('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf757('0xf'));var querystring=require(_0xf757('0x10'));var Papa=require(_0xf757('0x11'));var Redis=require(_0xf757('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf757('0x13'));var as=require(_0xf757('0x14'));var hardwareService=require(_0xf757('0x15'));var logger=require(_0xf757('0x16'))(_0xf757('0x17'));var utils=require(_0xf757('0x18'));var config=require(_0xf757('0x19'));var licenseUtil=require(_0xf757('0x1a'));var db=require(_0xf757('0x1b'))['db'];function respondWithStatusCode(_0x3b7033,_0xc839ec){_0xc839ec=_0xc839ec||0xcc;return function(_0x20b497){if(_0x20b497){return _0x3b7033[_0xf757('0x1c')](_0xc839ec);}return _0x3b7033[_0xf757('0x1d')](_0xc839ec)[_0xf757('0x1e')]();};}function respondWithResult(_0x22a2d9,_0x6dd606){_0x6dd606=_0x6dd606||0xc8;return function(_0x3fb479){if(_0x3fb479){return _0x22a2d9['status'](_0x6dd606)[_0xf757('0x1f')](_0x3fb479);}};}function respondWithFilteredResult(_0x12fb35,_0x5c297e){return function(_0x1ad422){if(_0x1ad422){var _0x2b3540=typeof _0x5c297e[_0xf757('0x20')]==='undefined'&&typeof _0x5c297e[_0xf757('0x21')]===_0xf757('0x22');var _0x2f3d50=_0x1ad422[_0xf757('0x23')];var _0x54af52=_0x2b3540?0x0:_0x5c297e[_0xf757('0x20')];var _0x4124a0=_0x2b3540?_0x1ad422[_0xf757('0x23')]:_0x5c297e[_0xf757('0x20')]+_0x5c297e[_0xf757('0x21')];var _0x4d6580;if(_0x4124a0>=_0x2f3d50){_0x4124a0=_0x2f3d50;_0x4d6580=0xc8;}else{_0x4d6580=0xce;}_0x12fb35['status'](_0x4d6580);return _0x12fb35[_0xf757('0x24')]('Content-Range',_0x54af52+'-'+_0x4124a0+'/'+_0x2f3d50)['json'](_0x1ad422);}return null;};}function patchUpdates(_0x323bff){return function(_0x366c60){try{jsonpatch['apply'](_0x366c60,_0x323bff,!![]);}catch(_0x3c0bc8){return BPromise[_0xf757('0x25')](_0x3c0bc8);}return _0x366c60[_0xf757('0x26')]();};}function saveUpdates(_0x383bb2,_0x47db84){return function(_0x495bad){if(_0x495bad){return _0x495bad[_0xf757('0x27')](_0x383bb2)[_0xf757('0x28')](function(_0x1e347f){return _0x1e347f;});}return null;};}function removeEntity(_0x180005,_0x3d38dd){return function(_0x12ee1d){if(_0x12ee1d){return _0x12ee1d[_0xf757('0x29')]()[_0xf757('0x28')](function(){var _0x355d70=_0x12ee1d[_0xf757('0x2a')]({'plain':!![]});var _0x4d9012='ChanSpies';return db[_0xf757('0x2b')][_0xf757('0x29')]({'where':{'type':_0x4d9012,'resourceId':_0x355d70['id']}})[_0xf757('0x28')](function(){return _0x12ee1d;});})[_0xf757('0x28')](function(){_0x180005[_0xf757('0x1d')](0xcc)[_0xf757('0x1e')]();});}};}function handleEntityNotFound(_0x155a13,_0x180882){return function(_0x58ac7a){if(!_0x58ac7a){_0x155a13['sendStatus'](0x194);}return _0x58ac7a;};}function handleError(_0x1b61bf,_0x524397){_0x524397=_0x524397||0x1f4;return function(_0x1fa192){logger['error'](_0x1fa192[_0xf757('0x2c')]);if(_0x1fa192[_0xf757('0x2d')]){delete _0x1fa192['name'];}_0x1b61bf[_0xf757('0x1d')](_0x524397)[_0xf757('0x2e')](_0x1fa192);};}exports[_0xf757('0x2f')]=function(_0x3ad266,_0x542b16){var _0x216832={},_0x4f490d={},_0x356d13={'count':0x0,'rows':[]};var _0x5643e6=_[_0xf757('0x30')](db['VoiceChanSpy'][_0xf757('0x31')],function(_0x2077d0){return{'name':_0x2077d0['fieldName'],'type':_0x2077d0[_0xf757('0x32')]['key']};});_0x4f490d[_0xf757('0x33')]=_['map'](_0x5643e6,_0xf757('0x2d'));_0x4f490d[_0xf757('0x34')]=_[_0xf757('0x35')](_0x3ad266[_0xf757('0x34')]);_0x4f490d['filters']=_[_0xf757('0x36')](_0x4f490d[_0xf757('0x33')],_0x4f490d[_0xf757('0x34')]);_0x216832[_0xf757('0x37')]=_[_0xf757('0x36')](_0x4f490d[_0xf757('0x33')],qs[_0xf757('0x38')](_0x3ad266[_0xf757('0x34')][_0xf757('0x38')]));_0x216832['attributes']=_0x216832[_0xf757('0x37')][_0xf757('0x39')]?_0x216832[_0xf757('0x37')]:_0x4f490d[_0xf757('0x33')];if(!_0x3ad266[_0xf757('0x34')][_0xf757('0x3a')](_0xf757('0x3b'))){_0x216832[_0xf757('0x21')]=qs[_0xf757('0x21')](_0x3ad266[_0xf757('0x34')]['limit']);_0x216832['offset']=qs['offset'](_0x3ad266['query'][_0xf757('0x20')]);}_0x216832[_0xf757('0x3c')]=qs[_0xf757('0x3d')](_0x3ad266[_0xf757('0x34')][_0xf757('0x3d')]);_0x216832['where']=qs['filters'](_[_0xf757('0x3e')](_0x3ad266[_0xf757('0x34')],_0x4f490d['filters']),_0x5643e6);if(_0x3ad266[_0xf757('0x34')][_0xf757('0x3f')]){_0x216832['where']=_[_0xf757('0x40')](_0x216832[_0xf757('0x41')],{'$or':_[_0xf757('0x30')](_0x5643e6,function(_0x14796c){if(_0x14796c['type']!==_0xf757('0x42')){var _0x9f3609={};_0x9f3609[_0x14796c[_0xf757('0x2d')]]={'$like':'%'+_0x3ad266[_0xf757('0x34')][_0xf757('0x3f')]+'%'};return _0x9f3609;}})});}_0x216832=_['merge']({},_0x216832,_0x3ad266['options']);var _0x3bcd45={'where':_0x216832[_0xf757('0x41')]};return db[_0xf757('0x43')][_0xf757('0x23')](_0x3bcd45)[_0xf757('0x28')](function(_0x544659){_0x356d13['count']=_0x544659;if(_0x3ad266[_0xf757('0x34')]['includeAll']){_0x216832[_0xf757('0x44')]=[{'all':!![]}];}return db[_0xf757('0x43')][_0xf757('0x45')](_0x216832);})['then'](function(_0x3f4e63){_0x356d13[_0xf757('0x46')]=_0x3f4e63;return _0x356d13;})['then'](respondWithFilteredResult(_0x542b16,_0x216832))[_0xf757('0x47')](handleError(_0x542b16,null));};exports[_0xf757('0x48')]=function(_0x3e7efe,_0xba2238){var _0xfd8913={'raw':![],'where':{'id':_0x3e7efe['params']['id']}},_0x1a021f={};_0x1a021f[_0xf757('0x33')]=_['keys'](db[_0xf757('0x43')][_0xf757('0x31')]);_0x1a021f[_0xf757('0x34')]=_['keys'](_0x3e7efe[_0xf757('0x34')]);_0x1a021f[_0xf757('0x49')]=_['intersection'](_0x1a021f[_0xf757('0x33')],_0x1a021f[_0xf757('0x34')]);_0xfd8913[_0xf757('0x37')]=_[_0xf757('0x36')](_0x1a021f['model'],qs[_0xf757('0x38')](_0x3e7efe['query'][_0xf757('0x38')]));_0xfd8913[_0xf757('0x37')]=_0xfd8913[_0xf757('0x37')][_0xf757('0x39')]?_0xfd8913[_0xf757('0x37')]:_0x1a021f[_0xf757('0x33')];if(_0x3e7efe['query'][_0xf757('0x4a')]){_0xfd8913[_0xf757('0x44')]=[{'all':!![]}];}_0xfd8913=_['merge']({},_0xfd8913,_0x3e7efe['options']);return db[_0xf757('0x43')]['find'](_0xfd8913)[_0xf757('0x28')](handleEntityNotFound(_0xba2238,null))[_0xf757('0x28')](respondWithResult(_0xba2238,null))[_0xf757('0x47')](handleError(_0xba2238,null));};exports[_0xf757('0x4b')]=function(_0x6e4d0b,_0x27ac4d){return db[_0xf757('0x43')][_0xf757('0x4b')](_0x6e4d0b[_0xf757('0x4c')],{})[_0xf757('0x28')](function(_0x2905c2){var _0x1a8b0b=_0x6e4d0b['user'][_0xf757('0x2a')]({'plain':!![]});if(!_0x1a8b0b)throw new Error(_0xf757('0x4d'));if(_0x1a8b0b[_0xf757('0x4e')]==='user'){var _0x5d9f03=_0x2905c2[_0xf757('0x2a')]({'plain':!![]});var _0x6015d4=_0xf757('0x4f');return db['UserProfileSection'][_0xf757('0x50')]({'where':{'name':_0x6015d4,'userProfileId':_0x1a8b0b['userProfileId']},'raw':!![]})[_0xf757('0x28')](function(_0x141d02){if(_0x141d02&&_0x141d02[_0xf757('0x51')]===0x0){return db[_0xf757('0x2b')][_0xf757('0x4b')]({'name':_0x5d9f03['name'],'resourceId':_0x5d9f03['id'],'type':_0x141d02['name'],'sectionId':_0x141d02['id']},{})[_0xf757('0x28')](function(){return _0x2905c2;});}else{return _0x2905c2;}})[_0xf757('0x47')](function(_0x5a95fe){logger[_0xf757('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a95fe);throw _0x5a95fe;});}return _0x2905c2;})[_0xf757('0x28')](respondWithResult(_0x27ac4d,0xc9))[_0xf757('0x47')](handleError(_0x27ac4d,null));};exports[_0xf757('0x27')]=function(_0x53c26a,_0x174ac5){if(_0x53c26a[_0xf757('0x4c')]['id']){delete _0x53c26a['body']['id'];}return db[_0xf757('0x43')]['find']({'where':{'id':_0x53c26a[_0xf757('0x53')]['id']}})['then'](handleEntityNotFound(_0x174ac5,null))[_0xf757('0x28')](saveUpdates(_0x53c26a[_0xf757('0x4c')],null))[_0xf757('0x28')](respondWithResult(_0x174ac5,null))['catch'](handleError(_0x174ac5,null));};exports[_0xf757('0x29')]=function(_0x41692f,_0xa59237){return db[_0xf757('0x43')][_0xf757('0x50')]({'where':{'id':_0x41692f['params']['id']}})[_0xf757('0x28')](handleEntityNotFound(_0xa59237,null))[_0xf757('0x28')](removeEntity(_0xa59237,null))['catch'](handleError(_0xa59237,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index aa29b92..4a292e7 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 _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 +var _0xa1dd=['from-sip','%s%s','prefix','system','push','merge','Set','format','chanspy','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','record','StopMixMonitor','length','concat','internal','User','findAll','agent','then','catch','exports','models','voice_chanspy','VoiceExtension','bulkCreate','destroy','util','bluebird','./voiceChanSpy.attributes','context'];(function(_0x3484ef,_0x8f7086){var _0xae6ed2=function(_0x266fb5){while(--_0x266fb5){_0x3484ef['push'](_0x3484ef['shift']());}};_0xae6ed2(++_0x8f7086);}(_0xa1dd,0x152));var _0xda1d=function(_0x105c48,_0x2d5490){_0x105c48=_0x105c48-0x0;var _0xbc087a=_0xa1dd[_0x105c48];return _0xbc087a;};'use strict';var _=require('lodash');var util=require(_0xda1d('0x0'));var BPromise=require(_0xda1d('0x1'));var attributes=require(_0xda1d('0x2'));var getUserApplications=function(_0x12049f,_0x20b48f,_0x5d20e8){var _0x118386=0x1;var _0xed9b26=[];var _0x3efc10={'context':_0x20b48f[_0xda1d('0x3')]||_0xda1d('0x4'),'exten':util['format'](_0xda1d('0x5'),_0x12049f[_0xda1d('0x6')],_0x5d20e8),'type':_0xda1d('0x7'),'isApp':![],'ChanSpyId':_0x12049f['id'],'UserId':_0x20b48f['id']};_0xed9b26[_0xda1d('0x8')](_[_0xda1d('0x9')]({'app':_0xda1d('0xa'),'appdata':util[_0xda1d('0xb')]('CDR(type)=%s',_0xda1d('0xc')),'priority':_0x118386++},_0x3efc10));if(_0x12049f['record']){_0xed9b26[_0xda1d('0x8')](_[_0xda1d('0x9')]({'app':'MixMonitor','appdata':util[_0xda1d('0xb')]('${UNIQUEID}.%s,a',_0x12049f[_0xda1d('0xd')]),'priority':_0x118386++},_0x3efc10));}if(_0x12049f[_0xda1d('0xe')]){_0xed9b26[_0xda1d('0x8')](_[_0xda1d('0x9')]({'app':_0xda1d('0xf'),'appdata':_0x12049f[_0xda1d('0x10')],'priority':_0x118386++},_0x3efc10));}_0xed9b26[_0xda1d('0x8')](_[_0xda1d('0x9')]({'app':_0xda1d('0x11'),'appdata':util[_0xda1d('0xb')](_0xda1d('0x12'),_0x20b48f[_0xda1d('0x13')],_0x12049f[_0xda1d('0x14')]?_0x12049f[_0xda1d('0x14')][_0xda1d('0x15')](''):''),'priority':_0x118386++},_0x3efc10));if(_0x12049f[_0xda1d('0x16')]){_0xed9b26['push'](_[_0xda1d('0x9')]({'app':_0xda1d('0x17'),'priority':_0x118386++},_0x3efc10));}return _0xed9b26;};var getChanSpyApplications=function(_0x1a76e3,_0x1cca7d){var _0x4704f0=[];for(var _0x28d1a7=0x0,_0x1a06bd=0x1;_0x28d1a7<_0x1cca7d[_0xda1d('0x18')];_0x28d1a7++,_0x1a06bd=0x1){_0x4704f0=_0x4704f0[_0xda1d('0x19')](getUserApplications(_0x1a76e3,_0x1cca7d[_0x28d1a7],_0x1cca7d[_0x28d1a7][_0xda1d('0x1a')]));if(_0x1cca7d[_0x28d1a7]['internal']!=_0x1cca7d[_0x28d1a7]['name']){_0x4704f0=_0x4704f0[_0xda1d('0x19')](getUserApplications(_0x1a76e3,_0x1cca7d[_0x28d1a7],_0x1cca7d[_0x28d1a7][_0xda1d('0x13')]));}}return _0x4704f0;};var getChanSpyPromise=function(_0x5d7ad2,_0x5d66ac){return new BPromise(function(_0x12571e,_0x4e95a6){return _0x5d7ad2[_0xda1d('0x1b')][_0xda1d('0x1c')]({'attributes':['id',_0xda1d('0x13'),'internal'],'where':{'role':_0xda1d('0x1d'),'chanspy':!![]},'raw':!![]})[_0xda1d('0x1e')](function(_0x1a0b13){if(_0x1a0b13){return _0x12571e(getChanSpyApplications(_0x5d66ac,_0x1a0b13));}return _0x12571e([]);})[_0xda1d('0x1f')](function(_0x491dd3){_0x4e95a6(_0x491dd3);});});};module[_0xda1d('0x20')]=function(_0x1a5d97,_0x4d314a){var _0x36031f=_0x1a5d97[_0xda1d('0x21')];return _0x1a5d97['define']('VoiceChanSpy',attributes,{'tableName':_0xda1d('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5d1e21,_0x50a7d4,_0x5c88b6){return getChanSpyPromise(_0x36031f,_0x5d1e21)[_0xda1d('0x1e')](function(_0x876d6d){if(_0x876d6d&&_0x876d6d[_0xda1d('0x18')]){return _0x36031f[_0xda1d('0x23')][_0xda1d('0x24')](_0x876d6d);}})['then'](function(){_0x5c88b6();})[_0xda1d('0x1f')](function(_0x331139){_0x5c88b6(_0x331139);});},'afterUpdate':function(_0x670712,_0x373415,_0x71b7ba){return _0x36031f['VoiceExtension'][_0xda1d('0x25')]({'where':{'ChanSpyId':_0x670712['id']}})['then'](function(){return getChanSpyPromise(_0x36031f,_0x670712);})[_0xda1d('0x1e')](function(_0x447dbe){if(_0x447dbe&&_0x447dbe['length']){return _0x36031f[_0xda1d('0x23')][_0xda1d('0x24')](_0x447dbe);}})[_0xda1d('0x1e')](function(){_0x71b7ba();})['catch'](function(_0x1d786d){_0x71b7ba(_0x1d786d);});},'afterDestroy':function(_0xebf234,_0x49b1bc,_0x5dec81){return _0x36031f['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0xebf234['id']}})['then'](function(){_0x5dec81();})[_0xda1d('0x1f')](function(_0x15881c){_0x5dec81(_0x15881c);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index d0b2ccc..c84c0dd 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 _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 +var _0xe130=['VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0x293aae,_0x116c8e){var _0x3f10ec=function(_0x30b586){while(--_0x30b586){_0x293aae['push'](_0x293aae['shift']());}};_0x3f10ec(++_0x116c8e);}(_0xe130,0x127));var _0x0e13=function(_0x17622d,_0x30d571){_0x17622d=_0x17622d-0x0;var _0x5e7819=_0xe130[_0x17622d];return _0x5e7819;};'use strict';var _=require(_0x0e13('0x0'));var util=require(_0x0e13('0x1'));var moment=require('moment');var BPromise=require(_0x0e13('0x2'));var rs=require(_0x0e13('0x3'));var fs=require('fs');var Redis=require(_0x0e13('0x4'));var db=require(_0x0e13('0x5'))['db'];var utils=require(_0x0e13('0x6'));var logger=require('../../config/logger')(_0x0e13('0x7'));var config=require(_0x0e13('0x8'));var jayson=require(_0x0e13('0x9'));var client=jayson[_0x0e13('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1774a5,_0x5f0d09,_0x567031){return new BPromise(function(_0x5aaa22,_0x2faf49){return client[_0x0e13('0xb')](_0x1774a5,_0x567031)['then'](function(_0x5d066a){logger[_0x0e13('0xc')](_0x0e13('0xd'),_0x5f0d09,_0x0e13('0xe'));logger[_0x0e13('0xf')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x5f0d09,'request\x20sent',JSON[_0x0e13('0x10')](_0x5d066a));if(_0x5d066a[_0x0e13('0x11')]){if(_0x5d066a[_0x0e13('0x11')][_0x0e13('0x12')]===0x1f4){logger['error'](_0x0e13('0xd'),_0x5f0d09,_0x5d066a['error'][_0x0e13('0x13')]);return _0x2faf49(_0x5d066a[_0x0e13('0x11')][_0x0e13('0x13')]);}logger[_0x0e13('0x11')](_0x0e13('0xd'),_0x5f0d09,_0x5d066a[_0x0e13('0x11')][_0x0e13('0x13')]);return _0x5aaa22(_0x5d066a[_0x0e13('0x11')][_0x0e13('0x13')]);}else{logger['info'](_0x0e13('0xd'),_0x5f0d09,_0x0e13('0xe'));_0x5aaa22(_0x5d066a[_0x0e13('0x14')][_0x0e13('0x13')]);}})[_0x0e13('0x15')](function(_0x32f76a){logger['error'](_0x0e13('0xd'),_0x5f0d09,_0x32f76a);_0x2faf49(_0x32f76a);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 6f95762..feb93df 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 _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 +var _0xe144=['show','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe144,0xf1));var _0x4e14=function(_0xa8b370,_0x2b77db){_0xa8b370=_0xa8b370-0x0;var _0x643e37=_0xe144[_0xa8b370];return _0x643e37;};'use strict';var multer=require(_0x4e14('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4e14('0x1'));var express=require(_0x4e14('0x2'));var router=express[_0x4e14('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4e14('0x4'));var config=require(_0x4e14('0x5'));var controller=require(_0x4e14('0x6'));router[_0x4e14('0x7')]('/',auth[_0x4e14('0x8')](),controller[_0x4e14('0x9')]);router[_0x4e14('0x7')](_0x4e14('0xa'),auth[_0x4e14('0x8')](),controller[_0x4e14('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4e14('0xc')]);router[_0x4e14('0xd')]('/:id',auth[_0x4e14('0x8')](),controller[_0x4e14('0xe')]);router[_0x4e14('0xf')](_0x4e14('0xa'),auth[_0x4e14('0x8')](),controller[_0x4e14('0x10')]);module[_0x4e14('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index eb7310d..33c5e42 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 _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 +var _0x84ae=['exports','STRING','name','BOOLEAN','sequelize'];(function(_0xab26a9,_0x47f187){var _0x4f4dd9=function(_0x4c551e){while(--_0x4c551e){_0xab26a9['push'](_0xab26a9['shift']());}};_0x4f4dd9(++_0x47f187);}(_0x84ae,0x1cb));var _0xe84a=function(_0x55a525,_0xceb707){_0x55a525=_0x55a525-0x0;var _0x345ffd=_0x84ae[_0x55a525];return _0x345ffd;};'use strict';var Sequelize=require(_0xe84a('0x0'));module[_0xe84a('0x1')]={'name':{'type':Sequelize[_0xe84a('0x2')],'unique':_0xe84a('0x3')},'description':{'type':Sequelize[_0xe84a('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xe84a('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 90453ba..441b27f 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 _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 +var _0x1dd0=['Reload','chan_sip.so','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','join','server/files/templates/context.ejs','/etc/asterisk/extensions_xcally_contexts.conf','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','destroy','get','Contexts','UserProfileResource','stack','name','send','index','map','VoiceContext','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','sort','where','filter','merge','VIRTUAL','options','rows','params','rawAttributes','includeAll','include','find','catch','create','readFileSync','root','utf8','render','writeFileSync'];(function(_0x1919fc,_0x1667db){var _0x49305a=function(_0x1ee4dd){while(--_0x1ee4dd){_0x1919fc['push'](_0x1919fc['shift']());}};_0x49305a(++_0x1667db);}(_0x1dd0,0x182));var _0x01dd=function(_0x26beeb,_0x92477e){_0x26beeb=_0x26beeb-0x0;var _0x27aeaa=_0x1dd0[_0x26beeb];return _0x27aeaa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x01dd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x01dd('0x1'));var moment=require(_0x01dd('0x2'));var BPromise=require(_0x01dd('0x3'));var Mustache=require(_0x01dd('0x4'));var util=require(_0x01dd('0x5'));var path=require(_0x01dd('0x6'));var sox=require(_0x01dd('0x7'));var csv=require(_0x01dd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x01dd('0x9'));var squel=require(_0x01dd('0xa'));var crypto=require(_0x01dd('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x01dd('0xc'));var Redis=require('ioredis');var authService=require(_0x01dd('0xd'));var qs=require(_0x01dd('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x01dd('0xf'));var logger=require(_0x01dd('0x10'))('api');var utils=require(_0x01dd('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x01dd('0x12'));var db=require(_0x01dd('0x13'))['db'];var jayson=require(_0x01dd('0x14'));var client=jayson[_0x01dd('0x15')][_0x01dd('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x4b9c92,_0x151cb2,_0x5ed854,_0x30ac78){return new BPromise(function(_0x446070,_0x1cd4ef){var _0x11e718=_0x30ac78||client;return _0x11e718['request'](_0x4b9c92,_0x5ed854)[_0x01dd('0x17')](function(_0x32d5ec){logger[_0x01dd('0x18')](_0x01dd('0x19'),_0x151cb2,_0x01dd('0x1a'));logger[_0x01dd('0x1b')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x151cb2,_0x01dd('0x1a'),JSON[_0x01dd('0x1c')](_0x32d5ec));if(_0x32d5ec[_0x01dd('0x1d')]){if(_0x32d5ec[_0x01dd('0x1d')]['code']===0x1f4){logger['error'](_0x01dd('0x19'),_0x151cb2,_0x32d5ec['error'][_0x01dd('0x1e')]);return _0x1cd4ef(_0x32d5ec['error'][_0x01dd('0x1e')]);}logger['error'](_0x01dd('0x19'),_0x151cb2,_0x32d5ec['error']['message']);return _0x446070(_0x32d5ec[_0x01dd('0x1d')][_0x01dd('0x1e')]);}else{logger['info'](_0x01dd('0x19'),_0x151cb2,_0x01dd('0x1a'));_0x446070(_0x32d5ec[_0x01dd('0x1f')][_0x01dd('0x1e')]);}})['catch'](function(_0x16f55e){logger[_0x01dd('0x1d')](_0x01dd('0x19'),_0x151cb2,_0x16f55e);_0x1cd4ef(_0x16f55e);});});}function respondWithStatusCode(_0x5672a4,_0x5213af){_0x5213af=_0x5213af||0xcc;return function(_0x5d923c){if(_0x5d923c){return _0x5672a4[_0x01dd('0x20')](_0x5213af);}return _0x5672a4[_0x01dd('0x21')](_0x5213af)[_0x01dd('0x22')]();};}function respondWithResult(_0x4eb731,_0x3f7838){_0x3f7838=_0x3f7838||0xc8;return function(_0x297eff){if(_0x297eff){return _0x4eb731['status'](_0x3f7838)[_0x01dd('0x23')](_0x297eff);}};}function respondWithFilteredResult(_0x266e49,_0x97e6b7){return function(_0x5ec68d){if(_0x5ec68d){var _0x335784=typeof _0x97e6b7[_0x01dd('0x24')]==='undefined'&&typeof _0x97e6b7[_0x01dd('0x25')]===_0x01dd('0x26');var _0x563105=_0x5ec68d[_0x01dd('0x27')];var _0x285a91=_0x335784?0x0:_0x97e6b7[_0x01dd('0x24')];var _0x31d014=_0x335784?_0x5ec68d[_0x01dd('0x27')]:_0x97e6b7[_0x01dd('0x24')]+_0x97e6b7[_0x01dd('0x25')];var _0x5f783b;if(_0x31d014>=_0x563105){_0x31d014=_0x563105;_0x5f783b=0xc8;}else{_0x5f783b=0xce;}_0x266e49[_0x01dd('0x21')](_0x5f783b);return _0x266e49['set'](_0x01dd('0x28'),_0x285a91+'-'+_0x31d014+'/'+_0x563105)[_0x01dd('0x23')](_0x5ec68d);}return null;};}function patchUpdates(_0x2d470a){return function(_0x2785d6){try{jsonpatch[_0x01dd('0x29')](_0x2785d6,_0x2d470a,!![]);}catch(_0x3bb0d6){return BPromise[_0x01dd('0x2a')](_0x3bb0d6);}return _0x2785d6['save']();};}function saveUpdates(_0x3fc022,_0x4dd7fa){return function(_0x198c4e){if(_0x198c4e){return _0x198c4e[_0x01dd('0x2b')](_0x3fc022)[_0x01dd('0x17')](function(_0x2d7f33){return _0x2d7f33;});}return null;};}function removeEntity(_0x3f615f,_0x7f44bf){return function(_0xae26a9){if(_0xae26a9){return _0xae26a9[_0x01dd('0x2c')]()['then'](function(){var _0x3661e5=_0xae26a9[_0x01dd('0x2d')]({'plain':!![]});var _0x130871=_0x01dd('0x2e');return db[_0x01dd('0x2f')]['destroy']({'where':{'type':_0x130871,'resourceId':_0x3661e5['id']}})[_0x01dd('0x17')](function(){return _0xae26a9;});})[_0x01dd('0x17')](function(){_0x3f615f[_0x01dd('0x21')](0xcc)[_0x01dd('0x22')]();});}};}function handleEntityNotFound(_0x83619,_0x37507a){return function(_0x1c7a58){if(!_0x1c7a58){_0x83619[_0x01dd('0x20')](0x194);}return _0x1c7a58;};}function handleError(_0x27b4a0,_0x444b92){_0x444b92=_0x444b92||0x1f4;return function(_0x237208){logger[_0x01dd('0x1d')](_0x237208[_0x01dd('0x30')]);if(_0x237208[_0x01dd('0x31')]){delete _0x237208[_0x01dd('0x31')];}_0x27b4a0[_0x01dd('0x21')](_0x444b92)[_0x01dd('0x32')](_0x237208);};}exports[_0x01dd('0x33')]=function(_0x2c5adc,_0xc64be6){var _0x482788={},_0x1c89ca={},_0x416c08={'count':0x0,'rows':[]};var _0x400258=_[_0x01dd('0x34')](db[_0x01dd('0x35')]['rawAttributes'],function(_0x3071ab){return{'name':_0x3071ab[_0x01dd('0x36')],'type':_0x3071ab[_0x01dd('0x37')][_0x01dd('0x38')]};});_0x1c89ca['model']=_[_0x01dd('0x34')](_0x400258,_0x01dd('0x31'));_0x1c89ca[_0x01dd('0x39')]=_[_0x01dd('0x3a')](_0x2c5adc[_0x01dd('0x39')]);_0x1c89ca[_0x01dd('0x3b')]=_[_0x01dd('0x3c')](_0x1c89ca[_0x01dd('0x3d')],_0x1c89ca[_0x01dd('0x39')]);_0x482788[_0x01dd('0x3e')]=_[_0x01dd('0x3c')](_0x1c89ca[_0x01dd('0x3d')],qs[_0x01dd('0x3f')](_0x2c5adc[_0x01dd('0x39')]['fields']));_0x482788[_0x01dd('0x3e')]=_0x482788[_0x01dd('0x3e')][_0x01dd('0x40')]?_0x482788[_0x01dd('0x3e')]:_0x1c89ca[_0x01dd('0x3d')];if(!_0x2c5adc[_0x01dd('0x39')]['hasOwnProperty']('nolimit')){_0x482788[_0x01dd('0x25')]=qs[_0x01dd('0x25')](_0x2c5adc[_0x01dd('0x39')][_0x01dd('0x25')]);_0x482788[_0x01dd('0x24')]=qs[_0x01dd('0x24')](_0x2c5adc[_0x01dd('0x39')][_0x01dd('0x24')]);}_0x482788['order']=qs[_0x01dd('0x41')](_0x2c5adc['query']['sort']);_0x482788[_0x01dd('0x42')]=qs[_0x01dd('0x3b')](_['pick'](_0x2c5adc[_0x01dd('0x39')],_0x1c89ca[_0x01dd('0x3b')]),_0x400258);if(_0x2c5adc[_0x01dd('0x39')][_0x01dd('0x43')]){_0x482788[_0x01dd('0x42')]=_[_0x01dd('0x44')](_0x482788[_0x01dd('0x42')],{'$or':_[_0x01dd('0x34')](_0x400258,function(_0x51184c){if(_0x51184c[_0x01dd('0x37')]!==_0x01dd('0x45')){var _0x24b7f6={};_0x24b7f6[_0x51184c['name']]={'$like':'%'+_0x2c5adc['query'][_0x01dd('0x43')]+'%'};return _0x24b7f6;}})});}_0x482788=_['merge']({},_0x482788,_0x2c5adc[_0x01dd('0x46')]);var _0x107b7b={'where':_0x482788[_0x01dd('0x42')]};return db[_0x01dd('0x35')][_0x01dd('0x27')](_0x107b7b)[_0x01dd('0x17')](function(_0x3e526f){_0x416c08[_0x01dd('0x27')]=_0x3e526f;if(_0x2c5adc['query']['includeAll']){_0x482788['include']=[{'all':!![]}];}return db[_0x01dd('0x35')]['findAll'](_0x482788);})['then'](function(_0x143ef7){_0x416c08[_0x01dd('0x47')]=_0x143ef7;return _0x416c08;})['then'](respondWithFilteredResult(_0xc64be6,_0x482788))['catch'](handleError(_0xc64be6,null));};exports['show']=function(_0x3226e2,_0x54412b){var _0x37b329={'raw':![],'where':{'id':_0x3226e2[_0x01dd('0x48')]['id']}},_0x2a79dd={};_0x2a79dd[_0x01dd('0x3d')]=_[_0x01dd('0x3a')](db['VoiceContext'][_0x01dd('0x49')]);_0x2a79dd[_0x01dd('0x39')]=_[_0x01dd('0x3a')](_0x3226e2['query']);_0x2a79dd[_0x01dd('0x3b')]=_[_0x01dd('0x3c')](_0x2a79dd[_0x01dd('0x3d')],_0x2a79dd[_0x01dd('0x39')]);_0x37b329[_0x01dd('0x3e')]=_[_0x01dd('0x3c')](_0x2a79dd[_0x01dd('0x3d')],qs[_0x01dd('0x3f')](_0x3226e2[_0x01dd('0x39')][_0x01dd('0x3f')]));_0x37b329[_0x01dd('0x3e')]=_0x37b329[_0x01dd('0x3e')][_0x01dd('0x40')]?_0x37b329[_0x01dd('0x3e')]:_0x2a79dd[_0x01dd('0x3d')];if(_0x3226e2[_0x01dd('0x39')][_0x01dd('0x4a')]){_0x37b329[_0x01dd('0x4b')]=[{'all':!![]}];}_0x37b329=_[_0x01dd('0x44')]({},_0x37b329,_0x3226e2[_0x01dd('0x46')]);return db[_0x01dd('0x35')][_0x01dd('0x4c')](_0x37b329)['then'](handleEntityNotFound(_0x54412b,null))[_0x01dd('0x17')](respondWithResult(_0x54412b,null))[_0x01dd('0x4d')](handleError(_0x54412b,null));};exports[_0x01dd('0x4e')]=function(_0x17645f,_0x135d4a,_0x4be441){var _0x363f1d;return db['VoiceContext'][_0x01dd('0x4e')](_0x17645f['body'],{'raw':!![]})[_0x01dd('0x17')](function(_0x108026){_0x363f1d=_0x108026;return db[_0x01dd('0x35')]['findAll']({'raw':!![]});})[_0x01dd('0x17')](function(_0x55f397){var _0x54c17f=fs[_0x01dd('0x4f')](path['join'](config[_0x01dd('0x50')],'server/files/templates/context.ejs'),_0x01dd('0x51'));var _0x146f21=ejs[_0x01dd('0x52')](_0x54c17f,{'contexts':_0x55f397||[]});fs[_0x01dd('0x53')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x146f21);})[_0x01dd('0x17')](function(){return respondWithRpcPromise(_0x01dd('0x54'),_0x01dd('0x4e'),{'module':_0x01dd('0x55')});})[_0x01dd('0x17')](function(){var _0x584fd5=_0x17645f['user'][_0x01dd('0x2d')]({'plain':!![]});if(!_0x584fd5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x584fd5[_0x01dd('0x56')]===_0x01dd('0x57')){var _0x193238=_0x363f1d[_0x01dd('0x2d')]({'plain':!![]});return db[_0x01dd('0x58')]['find']({'where':{'name':'Contexts','userProfileId':_0x584fd5['userProfileId']},'raw':!![]})[_0x01dd('0x17')](function(_0x5185af){if(_0x5185af&&_0x5185af['autoAssociation']===0x0){return db[_0x01dd('0x2f')][_0x01dd('0x4e')]({'name':_0x193238[_0x01dd('0x31')],'resourceId':_0x193238['id'],'type':_0x5185af[_0x01dd('0x31')],'sectionId':_0x5185af['id']},{})['then'](function(){return _0x363f1d;});}else{return _0x363f1d;}})[_0x01dd('0x4d')](function(_0x5dfa3b){logger[_0x01dd('0x1d')](_0x01dd('0x59'),_0x5dfa3b);throw _0x5dfa3b;});}return _0x363f1d;})[_0x01dd('0x17')](respondWithResult(_0x135d4a,0xc9))[_0x01dd('0x4d')](handleError(_0x135d4a,null));};exports[_0x01dd('0x2b')]=function(_0x2753fa,_0x221854,_0x48b9ca){var _0x2aea28;return db[_0x01dd('0x35')][_0x01dd('0x4c')]({'where':{'id':_0x2753fa[_0x01dd('0x48')]['id']}})['then'](handleEntityNotFound(_0x221854,null))[_0x01dd('0x17')](saveUpdates(_0x2753fa['body'],null))['then'](function(_0x483755){if(_0x483755){_0x2aea28=_0x483755;return db[_0x01dd('0x35')][_0x01dd('0x5a')]({'raw':!![]});}})[_0x01dd('0x17')](function(_0x3d876c){var _0x342b0f=fs['readFileSync'](path[_0x01dd('0x5b')](config[_0x01dd('0x50')],_0x01dd('0x5c')),_0x01dd('0x51'));var _0x34805c=ejs[_0x01dd('0x52')](_0x342b0f,{'contexts':_0x3d876c||[]});fs['writeFileSync'](_0x01dd('0x5d'),_0x34805c);})[_0x01dd('0x17')](function(){return respondWithRpcPromise('Reload',_0x01dd('0x2b'),{'module':_0x01dd('0x55')});})[_0x01dd('0x17')](function(){return _0x2aea28;})[_0x01dd('0x17')](respondWithResult(_0x221854,null))['catch'](handleError(_0x221854,null));};exports[_0x01dd('0x2c')]=function(_0x352450,_0x1b3378,_0x2aad36){var _0x34aaf8;return db[_0x01dd('0x35')][_0x01dd('0x4c')]({'where':{'id':_0x352450['params']['id']}})[_0x01dd('0x17')](handleEntityNotFound(_0x1b3378,null))[_0x01dd('0x17')](removeEntity(_0x1b3378,null))[_0x01dd('0x17')](function(){return db['VoiceContext'][_0x01dd('0x5a')]({'raw':!![]});})[_0x01dd('0x17')](function(_0x3b1ee0){var _0x450473=fs['readFileSync'](path[_0x01dd('0x5b')](config[_0x01dd('0x50')],_0x01dd('0x5c')),_0x01dd('0x51'));var _0x168d30=ejs[_0x01dd('0x52')](_0x450473,{'contexts':_0x3b1ee0});fs['writeFileSync'](_0x01dd('0x5d'),_0x168d30);return respondWithRpcPromise(_0x01dd('0x54'),'destroy',{'module':_0x01dd('0x55')});})[_0x01dd('0x4d')](handleError(_0x1b3378,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 0992636..fd63df7 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 _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 +var _0x19bd=['./voiceContext.attributes','VoiceContext','voice_contexts','util','../../config/logger','api','moment','request-promise','path'];(function(_0x4c054b,_0x56ebdf){var _0x2a3b76=function(_0x25a2c4){while(--_0x25a2c4){_0x4c054b['push'](_0x4c054b['shift']());}};_0x2a3b76(++_0x56ebdf);}(_0x19bd,0xe4));var _0xd19b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x19bd[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0xd19b('0x0'));var logger=require(_0xd19b('0x1'))(_0xd19b('0x2'));var moment=require(_0xd19b('0x3'));var BPromise=require('bluebird');var rp=require(_0xd19b('0x4'));var fs=require('fs');var path=require(_0xd19b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd19b('0x6'));module['exports']=function(_0x57e10c,_0x1f0166){return _0x57e10c['define'](_0xd19b('0x7'),attributes,{'tableName':_0xd19b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 978e5ea..aa4dfac 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 _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 +var _0xb4c2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment'];(function(_0x5326df,_0x4babd6){var _0x6a86fd=function(_0x53f53c){while(--_0x53f53c){_0x5326df['push'](_0x5326df['shift']());}};_0x6a86fd(++_0x4babd6);}(_0xb4c2,0x19c));var _0x2b4c=function(_0x4aaa48,_0x720763){_0x4aaa48=_0x4aaa48-0x0;var _0x5dca80=_0xb4c2[_0x4aaa48];return _0x5dca80;};'use strict';var _=require('lodash');var util=require(_0x2b4c('0x0'));var moment=require(_0x2b4c('0x1'));var BPromise=require(_0x2b4c('0x2'));var rs=require(_0x2b4c('0x3'));var fs=require('fs');var Redis=require(_0x2b4c('0x4'));var db=require(_0x2b4c('0x5'))['db'];var utils=require(_0x2b4c('0x6'));var logger=require(_0x2b4c('0x7'))(_0x2b4c('0x8'));var config=require(_0x2b4c('0x9'));var jayson=require(_0x2b4c('0xa'));var client=jayson['client'][_0x2b4c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x519953,_0xd1f8e6,_0x5f529b){return new BPromise(function(_0x4251f8,_0x42590a){return client['request'](_0x519953,_0x5f529b)[_0x2b4c('0xc')](function(_0x3445c4){logger[_0x2b4c('0xd')](_0x2b4c('0xe'),_0xd1f8e6,'request\x20sent');logger[_0x2b4c('0xf')](_0x2b4c('0x10'),_0xd1f8e6,_0x2b4c('0x11'),JSON[_0x2b4c('0x12')](_0x3445c4));if(_0x3445c4[_0x2b4c('0x13')]){if(_0x3445c4['error'][_0x2b4c('0x14')]===0x1f4){logger[_0x2b4c('0x13')](_0x2b4c('0xe'),_0xd1f8e6,_0x3445c4[_0x2b4c('0x13')][_0x2b4c('0x15')]);return _0x42590a(_0x3445c4[_0x2b4c('0x13')][_0x2b4c('0x15')]);}logger[_0x2b4c('0x13')](_0x2b4c('0xe'),_0xd1f8e6,_0x3445c4[_0x2b4c('0x13')]['message']);return _0x4251f8(_0x3445c4[_0x2b4c('0x13')][_0x2b4c('0x15')]);}else{logger[_0x2b4c('0xd')](_0x2b4c('0xe'),_0xd1f8e6,_0x2b4c('0x11'));_0x4251f8(_0x3445c4[_0x2b4c('0x16')][_0x2b4c('0x15')]);}})['catch'](function(_0x45f8dd){logger[_0x2b4c('0x13')](_0x2b4c('0xe'),_0xd1f8e6,_0x45f8dd);_0x42590a(_0x45f8dd);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 9934cdf..9c7229e 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 _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 +var _0x8f2f=['post','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','show'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x8f2f,0x1b6));var _0xf8f2=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x8f2f[_0x397cfb];return _0x15fed9;};'use strict';var multer=require(_0xf8f2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf8f2('0x1'));var express=require(_0xf8f2('0x2'));var router=express[_0xf8f2('0x3')]();var fs_extra=require(_0xf8f2('0x4'));var auth=require(_0xf8f2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf8f2('0x6'));var controller=require('./voiceDialReport.controller');router[_0xf8f2('0x7')]('/',auth[_0xf8f2('0x8')](),controller[_0xf8f2('0x9')]);router[_0xf8f2('0x7')]('/describe',auth[_0xf8f2('0x8')](),controller[_0xf8f2('0xa')]);router[_0xf8f2('0x7')]('/:id',auth[_0xf8f2('0x8')](),controller[_0xf8f2('0xb')]);router[_0xf8f2('0xc')]('/',auth[_0xf8f2('0x8')](),controller['create']);router['put'](_0xf8f2('0xd'),auth[_0xf8f2('0x8')](),controller[_0xf8f2('0xe')]);router[_0xf8f2('0xf')](_0xf8f2('0xd'),auth[_0xf8f2('0x8')](),controller[_0xf8f2('0x10')]);module[_0xf8f2('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index d613fca..63a0c3b 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 _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 +var _0xd6d6=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x56223f,_0x4eba12){var _0x2892f4=function(_0xc93462){while(--_0xc93462){_0x56223f['push'](_0x56223f['shift']());}};_0x2892f4(++_0x4eba12);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x3764bd,_0x2fa892){_0x3764bd=_0x3764bd-0x0;var _0x511474=_0xd6d6[_0x3764bd];return _0x511474;};'use strict';var Sequelize=require(_0x6d6d('0x0'));module[_0x6d6d('0x1')]={'privilege':{'type':Sequelize[_0x6d6d('0x2')]},'channel':{'type':Sequelize[_0x6d6d('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x6d6d('0x2')]},'calleridnum':{'type':Sequelize[_0x6d6d('0x2')]},'calleridname':{'type':Sequelize[_0x6d6d('0x2')]},'connectedlinenum':{'type':Sequelize[_0x6d6d('0x2')]},'connectedlinename':{'type':Sequelize[_0x6d6d('0x2')]},'language':{'type':Sequelize[_0x6d6d('0x2')]},'accountcode':{'type':Sequelize[_0x6d6d('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x6d6d('0x2')]},'priority':{'type':Sequelize[_0x6d6d('0x3')]},'uniqueid':{'type':Sequelize[_0x6d6d('0x2')]},'linkedid':{'type':Sequelize[_0x6d6d('0x2')]},'destchannel':{'type':Sequelize[_0x6d6d('0x2')]},'destchannelstate':{'type':Sequelize[_0x6d6d('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x6d6d('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x6d6d('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x6d6d('0x2')]},'destlanguage':{'type':Sequelize[_0x6d6d('0x2')]},'destaccountcode':{'type':Sequelize[_0x6d6d('0x2')]},'destcontext':{'type':Sequelize[_0x6d6d('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x6d6d('0x3')]},'destuniqueid':{'type':Sequelize[_0x6d6d('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x6d6d('0x2')]},'starttime':{'type':Sequelize[_0x6d6d('0x4')]},'answertime':{'type':Sequelize[_0x6d6d('0x4')]},'endtime':{'type':Sequelize[_0x6d6d('0x4')]},'lastevent':{'type':Sequelize[_0x6d6d('0x2')],'comment':_0x6d6d('0x5')},'routeId':{'type':Sequelize[_0x6d6d('0x3')]},'duration':{'type':Sequelize[_0x6d6d('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x6d6d('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 6bf7a3b..8c87985 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 _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 +var _0xf872=['rows','catch','show','length','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','order','sort','where','pick','merge','filter','options','includeAll','findAll'];(function(_0x55a38a,_0x1ed975){var _0x133484=function(_0xd2f86b){while(--_0xd2f86b){_0x55a38a['push'](_0x55a38a['shift']());}};_0x133484(++_0x1ed975);}(_0xf872,0x18a));var _0x2f87=function(_0x20ebb5,_0x237d88){_0x20ebb5=_0x20ebb5-0x0;var _0x487182=_0xf872[_0x20ebb5];return _0x487182;};'use strict';var emlformat=require(_0x2f87('0x0'));var rimraf=require(_0x2f87('0x1'));var zipdir=require(_0x2f87('0x2'));var jsonpatch=require(_0x2f87('0x3'));var rp=require(_0x2f87('0x4'));var moment=require(_0x2f87('0x5'));var BPromise=require(_0x2f87('0x6'));var Mustache=require('mustache');var util=require(_0x2f87('0x7'));var path=require(_0x2f87('0x8'));var sox=require('sox');var csv=require(_0x2f87('0x9'));var ejs=require(_0x2f87('0xa'));var fs=require('fs');var fs_extra=require(_0x2f87('0xb'));var _=require(_0x2f87('0xc'));var squel=require(_0x2f87('0xd'));var crypto=require(_0x2f87('0xe'));var jsforce=require(_0x2f87('0xf'));var deskjs=require(_0x2f87('0x10'));var toCsv=require(_0x2f87('0x9'));var querystring=require('querystring');var Papa=require(_0x2f87('0x11'));var Redis=require(_0x2f87('0x12'));var authService=require(_0x2f87('0x13'));var qs=require(_0x2f87('0x14'));var as=require(_0x2f87('0x15'));var hardwareService=require(_0x2f87('0x16'));var logger=require(_0x2f87('0x17'))(_0x2f87('0x18'));var utils=require(_0x2f87('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4eb6c0,_0x5ab35f){_0x5ab35f=_0x5ab35f||0xcc;return function(_0x82ddcd){if(_0x82ddcd){return _0x4eb6c0[_0x2f87('0x1a')](_0x5ab35f);}return _0x4eb6c0['status'](_0x5ab35f)[_0x2f87('0x1b')]();};}function respondWithResult(_0x53da1d,_0x976b25){_0x976b25=_0x976b25||0xc8;return function(_0x5c0362){if(_0x5c0362){return _0x53da1d[_0x2f87('0x1c')](_0x976b25)[_0x2f87('0x1d')](_0x5c0362);}};}function respondWithFilteredResult(_0x306575,_0x4c4850){return function(_0x19bdaf){if(_0x19bdaf){var _0x351104=typeof _0x4c4850[_0x2f87('0x1e')]===_0x2f87('0x1f')&&typeof _0x4c4850[_0x2f87('0x20')]===_0x2f87('0x1f');var _0x35a9e9=_0x19bdaf[_0x2f87('0x21')];var _0x52b3eb=_0x351104?0x0:_0x4c4850[_0x2f87('0x1e')];var _0xb5ac4e=_0x351104?_0x19bdaf['count']:_0x4c4850[_0x2f87('0x1e')]+_0x4c4850['limit'];var _0x18130d;if(_0xb5ac4e>=_0x35a9e9){_0xb5ac4e=_0x35a9e9;_0x18130d=0xc8;}else{_0x18130d=0xce;}_0x306575[_0x2f87('0x1c')](_0x18130d);return _0x306575[_0x2f87('0x22')]('Content-Range',_0x52b3eb+'-'+_0xb5ac4e+'/'+_0x35a9e9)[_0x2f87('0x1d')](_0x19bdaf);}return null;};}function patchUpdates(_0x233bee){return function(_0x4e7838){try{jsonpatch[_0x2f87('0x23')](_0x4e7838,_0x233bee,!![]);}catch(_0x54c477){return BPromise[_0x2f87('0x24')](_0x54c477);}return _0x4e7838[_0x2f87('0x25')]();};}function saveUpdates(_0x467711,_0x1bd7f5){return function(_0x234f8d){if(_0x234f8d){return _0x234f8d[_0x2f87('0x26')](_0x467711)['then'](function(_0x46f866){return _0x46f866;});}return null;};}function removeEntity(_0x36d706,_0x3e646f){return function(_0x245dc8){if(_0x245dc8){return _0x245dc8[_0x2f87('0x27')]()[_0x2f87('0x28')](function(){_0x36d706[_0x2f87('0x1c')](0xcc)[_0x2f87('0x1b')]();});}};}function handleEntityNotFound(_0x42e8b7,_0x42ea52){return function(_0x4eee58){if(!_0x4eee58){_0x42e8b7[_0x2f87('0x1a')](0x194);}return _0x4eee58;};}function handleError(_0xa397b4,_0x30ac1a){_0x30ac1a=_0x30ac1a||0x1f4;return function(_0x2b702f){logger[_0x2f87('0x29')](_0x2b702f[_0x2f87('0x2a')]);if(_0x2b702f['name']){delete _0x2b702f[_0x2f87('0x2b')];}_0xa397b4[_0x2f87('0x1c')](_0x30ac1a)[_0x2f87('0x2c')](_0x2b702f);};}exports[_0x2f87('0x2d')]=function(_0x2c5ec1,_0x563e71){var _0x57d474={},_0x127c79={},_0x53f26f={'count':0x0,'rows':[]};var _0x11fc68=_[_0x2f87('0x2e')](db[_0x2f87('0x2f')][_0x2f87('0x30')],function(_0x43fef5){return{'name':_0x43fef5[_0x2f87('0x31')],'type':_0x43fef5[_0x2f87('0x32')][_0x2f87('0x33')]};});_0x127c79[_0x2f87('0x34')]=_['map'](_0x11fc68,_0x2f87('0x2b'));_0x127c79[_0x2f87('0x35')]=_[_0x2f87('0x36')](_0x2c5ec1[_0x2f87('0x35')]);_0x127c79[_0x2f87('0x37')]=_['intersection'](_0x127c79[_0x2f87('0x34')],_0x127c79['query']);_0x57d474['attributes']=_[_0x2f87('0x38')](_0x127c79[_0x2f87('0x34')],qs[_0x2f87('0x39')](_0x2c5ec1[_0x2f87('0x35')][_0x2f87('0x39')]));_0x57d474[_0x2f87('0x3a')]=_0x57d474[_0x2f87('0x3a')]['length']?_0x57d474[_0x2f87('0x3a')]:_0x127c79['model'];if(!_0x2c5ec1[_0x2f87('0x35')]['hasOwnProperty']('nolimit')){_0x57d474[_0x2f87('0x20')]=qs[_0x2f87('0x20')](_0x2c5ec1['query'][_0x2f87('0x20')]);_0x57d474[_0x2f87('0x1e')]=qs['offset'](_0x2c5ec1[_0x2f87('0x35')]['offset']);}_0x57d474[_0x2f87('0x3b')]=qs['sort'](_0x2c5ec1['query'][_0x2f87('0x3c')]);_0x57d474[_0x2f87('0x3d')]=qs[_0x2f87('0x37')](_[_0x2f87('0x3e')](_0x2c5ec1[_0x2f87('0x35')],_0x127c79['filters']),_0x11fc68);if(_0x2c5ec1[_0x2f87('0x35')]['filter']){_0x57d474[_0x2f87('0x3d')]=_[_0x2f87('0x3f')](_0x57d474['where'],{'$or':_[_0x2f87('0x2e')](_0x11fc68,function(_0x557ec2){if(_0x557ec2[_0x2f87('0x32')]!=='VIRTUAL'){var _0x1ec217={};_0x1ec217[_0x557ec2['name']]={'$like':'%'+_0x2c5ec1[_0x2f87('0x35')][_0x2f87('0x40')]+'%'};return _0x1ec217;}})});}_0x57d474=_[_0x2f87('0x3f')]({},_0x57d474,_0x2c5ec1[_0x2f87('0x41')]);var _0xee86ea={'where':_0x57d474[_0x2f87('0x3d')]};return db[_0x2f87('0x2f')][_0x2f87('0x21')](_0xee86ea)[_0x2f87('0x28')](function(_0x4f57c1){_0x53f26f[_0x2f87('0x21')]=_0x4f57c1;if(_0x2c5ec1[_0x2f87('0x35')][_0x2f87('0x42')]){_0x57d474['include']=[{'all':!![]}];}return db[_0x2f87('0x2f')][_0x2f87('0x43')](_0x57d474);})[_0x2f87('0x28')](function(_0x5a93b4){_0x53f26f[_0x2f87('0x44')]=_0x5a93b4;return _0x53f26f;})['then'](respondWithFilteredResult(_0x563e71,_0x57d474))[_0x2f87('0x45')](handleError(_0x563e71,null));};exports[_0x2f87('0x46')]=function(_0x216da9,_0x4ae7d5){var _0x4f1cb8={'raw':!![],'where':{'id':_0x216da9['params']['id']}},_0x21d994={};_0x21d994['model']=_[_0x2f87('0x36')](db[_0x2f87('0x2f')][_0x2f87('0x30')]);_0x21d994[_0x2f87('0x35')]=_[_0x2f87('0x36')](_0x216da9['query']);_0x21d994[_0x2f87('0x37')]=_[_0x2f87('0x38')](_0x21d994[_0x2f87('0x34')],_0x21d994[_0x2f87('0x35')]);_0x4f1cb8[_0x2f87('0x3a')]=_['intersection'](_0x21d994[_0x2f87('0x34')],qs[_0x2f87('0x39')](_0x216da9[_0x2f87('0x35')][_0x2f87('0x39')]));_0x4f1cb8['attributes']=_0x4f1cb8[_0x2f87('0x3a')][_0x2f87('0x47')]?_0x4f1cb8['attributes']:_0x21d994[_0x2f87('0x34')];if(_0x216da9['query'][_0x2f87('0x42')]){_0x4f1cb8['include']=[{'all':!![]}];}_0x4f1cb8=_['merge']({},_0x4f1cb8,_0x216da9[_0x2f87('0x41')]);return db[_0x2f87('0x2f')][_0x2f87('0x48')](_0x4f1cb8)['then'](handleEntityNotFound(_0x4ae7d5,null))[_0x2f87('0x28')](respondWithResult(_0x4ae7d5,null))['catch'](handleError(_0x4ae7d5,null));};exports[_0x2f87('0x49')]=function(_0x561b7e,_0x206863){return db[_0x2f87('0x2f')][_0x2f87('0x49')](_0x561b7e[_0x2f87('0x4a')],{})[_0x2f87('0x28')](respondWithResult(_0x206863,0xc9))[_0x2f87('0x45')](handleError(_0x206863,null));};exports[_0x2f87('0x26')]=function(_0x11b8c5,_0x10b43d){if(_0x11b8c5['body']['id']){delete _0x11b8c5[_0x2f87('0x4a')]['id'];}return db['VoiceDialReport']['find']({'where':{'id':_0x11b8c5[_0x2f87('0x4b')]['id']}})['then'](handleEntityNotFound(_0x10b43d,null))[_0x2f87('0x28')](saveUpdates(_0x11b8c5[_0x2f87('0x4a')],null))['then'](respondWithResult(_0x10b43d,null))[_0x2f87('0x45')](handleError(_0x10b43d,null));};exports[_0x2f87('0x27')]=function(_0x373984,_0x2a51a9){return db[_0x2f87('0x2f')][_0x2f87('0x48')]({'where':{'id':_0x373984[_0x2f87('0x4b')]['id']}})[_0x2f87('0x28')](handleEntityNotFound(_0x2a51a9,null))[_0x2f87('0x28')](removeEntity(_0x2a51a9,null))['catch'](handleError(_0x2a51a9,null));};exports[_0x2f87('0x4c')]=function(_0x3007e7,_0x1052d){return db['VoiceDialReport'][_0x2f87('0x4c')]()[_0x2f87('0x28')](respondWithResult(_0x1052d,null))[_0x2f87('0x45')](handleError(_0x1052d,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index ab79a37..1bae81d 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 _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 +var _0x0f09=['report_dial','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','define','VoiceDialReport'];(function(_0xbe39b2,_0x4af135){var _0x5714af=function(_0x401b57){while(--_0x401b57){_0xbe39b2['push'](_0xbe39b2['shift']());}};_0x5714af(++_0x4af135);}(_0x0f09,0x1a5));var _0x90f0=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x0f09[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0x90f0('0x0'));var logger=require(_0x90f0('0x1'))(_0x90f0('0x2'));var moment=require(_0x90f0('0x3'));var BPromise=require(_0x90f0('0x4'));var rp=require(_0x90f0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x90f0('0x6'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x32a8c2,_0x58878c){return _0x32a8c2[_0x90f0('0x7')](_0x90f0('0x8'),attributes,{'tableName':_0x90f0('0x9'),'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 093e17c..6811685 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 _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 +var _0x30f3=['error','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','options','raw','stringify','update','where','attributes','limit','UpdateVoiceDialReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','code'];(function(_0x24e0c9,_0x284109){var _0x4448f0=function(_0x576980){while(--_0x576980){_0x24e0c9['push'](_0x24e0c9['shift']());}};_0x4448f0(++_0x284109);}(_0x30f3,0x117));var _0x330f=function(_0x268fdf,_0x174349){_0x268fdf=_0x268fdf-0x0;var _0x27986e=_0x30f3[_0x268fdf];return _0x27986e;};'use strict';var _=require(_0x330f('0x0'));var util=require(_0x330f('0x1'));var moment=require(_0x330f('0x2'));var BPromise=require(_0x330f('0x3'));var rs=require(_0x330f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x330f('0x5'))['db'];var utils=require(_0x330f('0x6'));var logger=require(_0x330f('0x7'))('rpc');var config=require(_0x330f('0x8'));var jayson=require(_0x330f('0x9'));var client=jayson[_0x330f('0xa')][_0x330f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x460884,_0xdbeb41,_0x1cdb3b){return new BPromise(function(_0x2d0aa6,_0x14c206){return client['request'](_0x460884,_0x1cdb3b)[_0x330f('0xc')](function(_0x3c8669){logger[_0x330f('0xd')](_0x330f('0xe'),_0xdbeb41,_0x330f('0xf'));logger[_0x330f('0x10')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0xdbeb41,'request\x20sent',JSON['stringify'](_0x3c8669));if(_0x3c8669['error']){if(_0x3c8669['error'][_0x330f('0x11')]===0x1f4){logger[_0x330f('0x12')](_0x330f('0xe'),_0xdbeb41,_0x3c8669[_0x330f('0x12')][_0x330f('0x13')]);return _0x14c206(_0x3c8669['error'][_0x330f('0x13')]);}logger[_0x330f('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0xdbeb41,_0x3c8669[_0x330f('0x12')][_0x330f('0x13')]);return _0x2d0aa6(_0x3c8669[_0x330f('0x12')]['message']);}else{logger[_0x330f('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0xdbeb41,_0x330f('0xf'));_0x2d0aa6(_0x3c8669[_0x330f('0x14')][_0x330f('0x13')]);}})[_0x330f('0x15')](function(_0x21d638){logger[_0x330f('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0xdbeb41,_0x21d638);_0x14c206(_0x21d638);});});}exports[_0x330f('0x16')]=function(_0x577474){var _0x5f28bf=this;return new Promise(function(_0x32cb5b,_0x12ec5d){return db[_0x330f('0x17')][_0x330f('0x18')](_0x577474['body'],{'raw':_0x577474[_0x330f('0x19')]?_0x577474['options'][_0x330f('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1432c9){logger[_0x330f('0xd')]('CreateVoiceDialReport',_0x577474);logger['debug']('CreateVoiceDialReport',_0x577474,JSON[_0x330f('0x1b')](_0x1432c9));_0x32cb5b(_0x1432c9);})[_0x330f('0x15')](function(_0x169773){logger['error'](_0x330f('0x16'),_0x169773[_0x330f('0x13')],_0x577474);_0x12ec5d(_0x5f28bf[_0x330f('0x12')](0x1f4,_0x169773['message']));});});};exports['UpdateVoiceDialReport']=function(_0x130bd1){var _0xabd311=this;return new Promise(function(_0x574225,_0x53ba4c){return db[_0x330f('0x17')][_0x330f('0x1c')](_0x130bd1['body'],{'raw':_0x130bd1[_0x330f('0x19')]?_0x130bd1[_0x330f('0x19')][_0x330f('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x130bd1[_0x330f('0x19')]?_0x130bd1[_0x330f('0x19')][_0x330f('0x1d')]||null:null,'attributes':_0x130bd1[_0x330f('0x19')]?_0x130bd1[_0x330f('0x19')][_0x330f('0x1e')]||null:null,'limit':_0x130bd1[_0x330f('0x19')]?_0x130bd1['options'][_0x330f('0x1f')]||null:null})['then'](function(_0x4b70e8){logger['info'](_0x330f('0x20'),_0x130bd1);logger[_0x330f('0x10')](_0x330f('0x20'),_0x130bd1,JSON['stringify'](_0x4b70e8));_0x574225(_0x4b70e8);})[_0x330f('0x15')](function(_0x50cefb){logger['error']('UpdateVoiceDialReport',_0x50cefb['message'],_0x130bd1);_0x53ba4c(_0xabd311[_0x330f('0x12')](0x1f4,_0x50cefb[_0x330f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 1ce3255..614755d 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 _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 +var _0x18f5=['Router','fs-extra','../../components/auth/service','./voiceExtension.controller','get','index','/:id','isAuthenticated','show','post','/:id/applications','addApplications','put','update','delete','exports','util','connect-timeout','express'];(function(_0x239bbf,_0x1687e1){var _0x56b4c2=function(_0x13c6dd){while(--_0x13c6dd){_0x239bbf['push'](_0x239bbf['shift']());}};_0x56b4c2(++_0x1687e1);}(_0x18f5,0x95));var _0x518f=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x18f5[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require('multer');var util=require(_0x518f('0x0'));var path=require('path');var timeout=require(_0x518f('0x1'));var express=require(_0x518f('0x2'));var router=express[_0x518f('0x3')]();var fs_extra=require(_0x518f('0x4'));var auth=require(_0x518f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x518f('0x6'));router[_0x518f('0x7')]('/',auth['isAuthenticated'](),controller[_0x518f('0x8')]);router[_0x518f('0x7')](_0x518f('0x9'),auth[_0x518f('0xa')](),controller[_0x518f('0xb')]);router[_0x518f('0xc')]('/',auth[_0x518f('0xa')](),controller['create']);router[_0x518f('0xc')](_0x518f('0xd'),auth[_0x518f('0xa')](),controller[_0x518f('0xe')]);router[_0x518f('0xf')]('/:id',auth[_0x518f('0xa')](),controller[_0x518f('0x10')]);router[_0x518f('0x11')](_0x518f('0x9'),auth[_0x518f('0xa')](),controller['destroy']);module[_0x518f('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 66d6f54..20968d9 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 _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 +var _0x1e0d=['INTEGER','BOOLEAN','wav','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','any'];(function(_0x678c26,_0x16b906){var _0x565724=function(_0x39f54b){while(--_0x39f54b){_0x678c26['push'](_0x678c26['shift']());}};_0x565724(++_0x16b906);}(_0x1e0d,0x1a5));var _0xd1e0=function(_0x516dca,_0x2fa321){_0x516dca=_0x516dca-0x0;var _0x120176=_0x1e0d[_0x516dca];return _0x120176;};'use strict';var Sequelize=require(_0xd1e0('0x0'));module[_0xd1e0('0x1')]={'context':{'type':Sequelize[_0xd1e0('0x2')],'allowNull':![],'unique':_0xd1e0('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xd1e0('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xd1e0('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xd1e0('0x2')],'allowNull':![],'defaultValue':_0xd1e0('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xd1e0('0x5')](_0xd1e0('0x6'),_0xd1e0('0x7'),_0xd1e0('0x8'),_0xd1e0('0x9'),'outbound-fax','system',_0xd1e0('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0xd1e0('0x2')]},'interval':{'type':Sequelize[_0xd1e0('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xd1e0('0xb')]},'isApp':{'type':Sequelize[_0xd1e0('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xd1e0('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xd1e0('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xd1e0('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xd1e0('0xb')]},'recordingFormat':{'type':Sequelize[_0xd1e0('0x2')],'defaultValue':_0xd1e0('0xd')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1b504a){return this[_0xd1e0('0xe')](_0xd1e0('0xf'));}},'alias':{'type':Sequelize[_0xd1e0('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 6373f2d..b9c7bc4 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 _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 +var _0x2a5a=['pick','filters','merge','where','VIRTUAL','options','VoiceExtension','include','findAll','rows','catch','show','params','keys','includeAll','create','body','startsWith','exten','concat','user','InboundRoutes','internal','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','register','sendStatus','status','end','json','offset','undefined','count','set','then','get','inbound','OutboundRoutes','outbound','filter','ignore','map','value','includes','type','find','UserProfileResource','destroy','error','stack','name','send','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort'];(function(_0x3583b0,_0x59ba89){var _0x5ecee8=function(_0x268147){while(--_0x268147){_0x3583b0['push'](_0x3583b0['shift']());}};_0x5ecee8(++_0x59ba89);}(_0x2a5a,0x142));var _0xa2a5=function(_0x8da2f1,_0x31df6e){_0x8da2f1=_0x8da2f1-0x0;var _0x3035a2=_0x2a5a[_0x8da2f1];return _0x3035a2;};'use strict';var _=require(_0xa2a5('0x0'));var Redis=require(_0xa2a5('0x1'));var qs=require(_0xa2a5('0x2'));var logger=require(_0xa2a5('0x3'))(_0xa2a5('0x4'));var config=require(_0xa2a5('0x5'));var db=require('../../mysqldb')['db'];config[_0xa2a5('0x6')]=_[_0xa2a5('0x7')](config['redis'],{'host':_0xa2a5('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa2a5('0x6')]));require('./voiceExtension.socket')[_0xa2a5('0x9')](socket);function respondWithStatusCode(_0x405385,_0x1f0332){_0x1f0332=_0x1f0332||0xcc;return function(_0x3fb315){if(_0x3fb315){return _0x405385[_0xa2a5('0xa')](_0x1f0332);}return _0x405385[_0xa2a5('0xb')](_0x1f0332)[_0xa2a5('0xc')]();};}function respondWithResult(_0x38b6e6,_0x2870f4){_0x2870f4=_0x2870f4||0xc8;return function(_0x851e50){if(_0x851e50){return _0x38b6e6[_0xa2a5('0xb')](_0x2870f4)[_0xa2a5('0xd')](_0x851e50);}};}function respondWithFilteredResult(_0x4fb618,_0x576533){return function(_0x58eaef){if(_0x58eaef){var _0x381434=typeof _0x576533[_0xa2a5('0xe')]==='undefined'&&typeof _0x576533['limit']===_0xa2a5('0xf');var _0x58a6b0=_0x58eaef[_0xa2a5('0x10')];var _0x48cd02=_0x381434?0x0:_0x576533[_0xa2a5('0xe')];var _0x1fedc9=_0x381434?_0x58eaef['count']:_0x576533[_0xa2a5('0xe')]+_0x576533['limit'];var _0x5cc15b;if(_0x1fedc9>=_0x58a6b0){_0x1fedc9=_0x58a6b0;_0x5cc15b=0xc8;}else{_0x5cc15b=0xce;}_0x4fb618[_0xa2a5('0xb')](_0x5cc15b);return _0x4fb618[_0xa2a5('0x11')]('Content-Range',_0x48cd02+'-'+_0x1fedc9+'/'+_0x58a6b0)[_0xa2a5('0xd')](_0x58eaef);}return null;};}function removeEntity(_0x14bc3c){return function(_0x3a02b7){if(_0x3a02b7){return _0x3a02b7['destroy']()[_0xa2a5('0x12')](function(){var _0x4ad9c6=_0x3a02b7[_0xa2a5('0x13')]({'plain':!![]});var _0x3c106a=[{'name':'InboundRoutes','value':_0xa2a5('0x14'),'ignore':![]},{'name':_0xa2a5('0x15'),'value':_0xa2a5('0x16'),'ignore':![]},{'name':'InternalRoutes','value':'internal','ignore':![]}];var _0x2908f1=_(_0x3c106a)[_0xa2a5('0x17')](_0xa2a5('0x18'))[_0xa2a5('0x19')](_0xa2a5('0x1a'))[_0xa2a5('0x1a')]();if(_[_0xa2a5('0x1b')](_0x2908f1,_0x4ad9c6[_0xa2a5('0x1c')])){return;}var _0x1f92c3=_[_0xa2a5('0x1d')](_0x3c106a,[_0xa2a5('0x1a'),_0x4ad9c6[_0xa2a5('0x1c')]])['name'];return db[_0xa2a5('0x1e')][_0xa2a5('0x1f')]({'where':{'type':_0x1f92c3,'resourceId':_0x4ad9c6['id']}})[_0xa2a5('0x12')](function(){return _0x3a02b7;});})[_0xa2a5('0x12')](function(){_0x14bc3c[_0xa2a5('0xb')](0xcc)[_0xa2a5('0xc')]();});}};}function handleEntityNotFound(_0x58dff1){return function(_0x122b70){if(!_0x122b70){_0x58dff1[_0xa2a5('0xa')](0x194);}return _0x122b70;};}function handleError(_0x2641e6,_0x2eaff2){_0x2eaff2=_0x2eaff2||0x1f4;return function(_0x48b48c){logger[_0xa2a5('0x20')](_0x48b48c[_0xa2a5('0x21')]);if(_0x48b48c['name']){delete _0x48b48c[_0xa2a5('0x22')];}_0x2641e6[_0xa2a5('0xb')](_0x2eaff2)[_0xa2a5('0x23')](_0x48b48c);};}exports['index']=function(_0x210252,_0x506804){var _0x3fc6ee={},_0x49913d={},_0x1b0f21={'count':0x0,'rows':[]};var _0x3794a8=_['map'](db['VoiceExtension'][_0xa2a5('0x24')],function(_0x4e1bc4){return{'name':_0x4e1bc4[_0xa2a5('0x25')],'type':_0x4e1bc4['type'][_0xa2a5('0x26')]};});_0x49913d[_0xa2a5('0x27')]=_['map'](_0x3794a8,'name');_0x49913d[_0xa2a5('0x28')]=_['keys'](_0x210252['query']);_0x49913d['filters']=_[_0xa2a5('0x29')](_0x49913d[_0xa2a5('0x27')],_0x49913d[_0xa2a5('0x28')]);_0x3fc6ee[_0xa2a5('0x2a')]=_[_0xa2a5('0x29')](_0x49913d[_0xa2a5('0x27')],qs[_0xa2a5('0x2b')](_0x210252[_0xa2a5('0x28')][_0xa2a5('0x2b')]));_0x3fc6ee[_0xa2a5('0x2a')]=_0x3fc6ee['attributes'][_0xa2a5('0x2c')]?_0x3fc6ee[_0xa2a5('0x2a')]:_0x49913d['model'];if(!_0x210252[_0xa2a5('0x28')][_0xa2a5('0x2d')](_0xa2a5('0x2e'))){_0x3fc6ee['limit']=qs['limit'](_0x210252[_0xa2a5('0x28')][_0xa2a5('0x2f')]);_0x3fc6ee['offset']=qs[_0xa2a5('0xe')](_0x210252[_0xa2a5('0x28')][_0xa2a5('0xe')]);}_0x3fc6ee[_0xa2a5('0x30')]=qs[_0xa2a5('0x31')](_0x210252[_0xa2a5('0x28')]['sort']);_0x3fc6ee['where']=qs['filters'](_[_0xa2a5('0x32')](_0x210252['query'],_0x49913d[_0xa2a5('0x33')]),_0x3794a8);if(_0x210252['query'][_0xa2a5('0x17')]){_0x3fc6ee['where']=_[_0xa2a5('0x34')](_0x3fc6ee[_0xa2a5('0x35')],{'$or':_[_0xa2a5('0x19')](_0x3794a8,function(_0x32d7aa){if(_0x32d7aa['type']!==_0xa2a5('0x36')){var _0x197a9c={};_0x197a9c[_0x32d7aa[_0xa2a5('0x22')]]={'$like':'%'+_0x210252[_0xa2a5('0x28')][_0xa2a5('0x17')]+'%'};return _0x197a9c;}})});}_0x3fc6ee=_[_0xa2a5('0x34')]({},_0x3fc6ee,_0x210252[_0xa2a5('0x37')]);var _0x5b3fbc={'where':_0x3fc6ee['where']};return db[_0xa2a5('0x38')][_0xa2a5('0x10')](_0x5b3fbc)[_0xa2a5('0x12')](function(_0x4150a9){_0x1b0f21[_0xa2a5('0x10')]=_0x4150a9;if(_0x210252[_0xa2a5('0x28')]['includeAll']){_0x3fc6ee[_0xa2a5('0x39')]=[{'all':!![]}];}return db[_0xa2a5('0x38')][_0xa2a5('0x3a')](_0x3fc6ee);})[_0xa2a5('0x12')](function(_0x11b19e){_0x1b0f21[_0xa2a5('0x3b')]=_0x11b19e;return _0x1b0f21;})[_0xa2a5('0x12')](respondWithFilteredResult(_0x506804,_0x3fc6ee))[_0xa2a5('0x3c')](handleError(_0x506804,null));};exports[_0xa2a5('0x3d')]=function(_0x3c455e,_0x32bf58){var _0x31949f={'raw':![],'where':{'id':_0x3c455e[_0xa2a5('0x3e')]['id']}},_0xf2b7e5={};_0xf2b7e5['model']=_[_0xa2a5('0x3f')](db[_0xa2a5('0x38')]['rawAttributes']);_0xf2b7e5[_0xa2a5('0x28')]=_[_0xa2a5('0x3f')](_0x3c455e[_0xa2a5('0x28')]);_0xf2b7e5[_0xa2a5('0x33')]=_['intersection'](_0xf2b7e5['model'],_0xf2b7e5[_0xa2a5('0x28')]);_0x31949f[_0xa2a5('0x2a')]=_[_0xa2a5('0x29')](_0xf2b7e5[_0xa2a5('0x27')],qs['fields'](_0x3c455e[_0xa2a5('0x28')]['fields']));_0x31949f['attributes']=_0x31949f['attributes'][_0xa2a5('0x2c')]?_0x31949f[_0xa2a5('0x2a')]:_0xf2b7e5[_0xa2a5('0x27')];if(_0x3c455e['query'][_0xa2a5('0x40')]){_0x31949f['include']=[{'all':!![]}];}_0x31949f=_[_0xa2a5('0x34')]({},_0x31949f,_0x3c455e[_0xa2a5('0x37')]);return db[_0xa2a5('0x38')][_0xa2a5('0x1d')](_0x31949f)['then'](handleEntityNotFound(_0x32bf58,null))[_0xa2a5('0x12')](respondWithResult(_0x32bf58,null))[_0xa2a5('0x3c')](handleError(_0x32bf58,null));};exports[_0xa2a5('0x1f')]=function(_0x269c3e,_0x38da5c){return db['VoiceExtension'][_0xa2a5('0x1d')]({'where':{'id':_0x269c3e[_0xa2a5('0x3e')]['id']}})['then'](handleEntityNotFound(_0x38da5c,null))[_0xa2a5('0x12')](removeEntity(_0x38da5c,null))[_0xa2a5('0x3c')](handleError(_0x38da5c,null));};exports[_0xa2a5('0x41')]=function(_0x290ab8,_0x213a88){if(_0x290ab8[_0xa2a5('0x42')][_0xa2a5('0x1c')]===_0xa2a5('0x16')&&!_[_0xa2a5('0x43')](_0x290ab8[_0xa2a5('0x42')][_0xa2a5('0x44')],'_')){_0x290ab8[_0xa2a5('0x42')]['exten']='_'[_0xa2a5('0x45')](_0x290ab8[_0xa2a5('0x42')][_0xa2a5('0x44')]);}return db[_0xa2a5('0x38')]['create'](_0x290ab8[_0xa2a5('0x42')],{'raw':![]})[_0xa2a5('0x12')](function(_0x1b339b){var _0x348e75=_0x290ab8[_0xa2a5('0x46')]['get']({'plain':!![]});if(!_0x348e75)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x348e75['role']==='user'){var _0xb1220d=_0x1b339b[_0xa2a5('0x13')]({'plain':!![]});var _0x351bdb=[{'name':_0xa2a5('0x47'),'value':'inbound'},{'name':_0xa2a5('0x15'),'value':'outbound'},{'name':'InternalRoutes','value':_0xa2a5('0x48')}];var _0x15e55f=_['find'](_0x351bdb,[_0xa2a5('0x1a'),_0xb1220d[_0xa2a5('0x1c')]])[_0xa2a5('0x22')];return db['UserProfileSection'][_0xa2a5('0x1d')]({'where':{'name':_0x15e55f,'userProfileId':_0x348e75['userProfileId']},'raw':!![]})['then'](function(_0x5b7a2f){if(_0x5b7a2f&&_0x5b7a2f[_0xa2a5('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0xb1220d[_0xa2a5('0x22')],'resourceId':_0xb1220d['id'],'type':_0x5b7a2f[_0xa2a5('0x22')],'sectionId':_0x5b7a2f['id']},{})['then'](function(){return _0x1b339b;});}else{return _0x1b339b;}})[_0xa2a5('0x3c')](function(_0x9a4537){logger[_0xa2a5('0x20')](_0xa2a5('0x4a'),_0x9a4537);throw _0x9a4537;});}return _0x1b339b;})[_0xa2a5('0x12')](respondWithResult(_0x213a88,0xc9))[_0xa2a5('0x3c')](handleError(_0x213a88,null));};exports[_0xa2a5('0x4b')]=function(_0x56a287,_0x1a9552){if(_0x56a287[_0xa2a5('0x42')]['id']){delete _0x56a287[_0xa2a5('0x42')]['id'];}return db[_0xa2a5('0x38')][_0xa2a5('0x1d')]({'where':{'id':_0x56a287[_0xa2a5('0x3e')]['id']}})[_0xa2a5('0x12')](handleEntityNotFound(_0x1a9552,null))[_0xa2a5('0x12')](function(_0xfa11){if(_0xfa11){return db[_0xa2a5('0x38')][_0xa2a5('0x4b')](_[_0xa2a5('0x32')](_0x56a287['body'],[_0xa2a5('0x44'),_0xa2a5('0x4c'),_0xa2a5('0x4d'),'recordingFormat',_0xa2a5('0x4e'),_0xa2a5('0x4f'),_0xa2a5('0x50')]),{'where':{'context':_0xfa11[_0xa2a5('0x4c')],'exten':_0xfa11[_0xa2a5('0x44')]},'individualHooks':!![]})['then'](function(_0x4cc246){return _0x4cc246;});}return null;})['then'](respondWithStatusCode(_0x1a9552,null))[_0xa2a5('0x3c')](handleError(_0x1a9552,null));};exports[_0xa2a5('0x51')]=function(_0x35ec99,_0x5302b7){var _0xb10073=_0x35ec99[_0xa2a5('0x3e')]['id'];var _0x343fda=_0x35ec99['body'];var _0x3f6366=0xc8;var _0x4566d0=null;return db[_0xa2a5('0x52')][_0xa2a5('0x53')]({'isolationLevel':db[_0xa2a5('0x52')][_0xa2a5('0x54')][_0xa2a5('0x55')][_0xa2a5('0x56')]},function(_0x199aaa){return db['VoiceExtension'][_0xa2a5('0x57')]({'where':{'id':_0xb10073},'transaction':_0x199aaa})[_0xa2a5('0x12')](function(_0x53095b){if(_0x53095b){return db[_0xa2a5('0x38')]['destroy']({'where':{'VoiceExtensionId':_0xb10073},'transaction':_0x199aaa})['then'](function(){var _0x126892=_[_0xa2a5('0x19')](_0x343fda,function(_0x340108){_0x340108[_0xa2a5('0x58')]=_0xb10073;_0x340108['isApp']=!![];return _0x340108;});return _0x53095b[_0xa2a5('0x59')](_0x126892);})[_0xa2a5('0x12')](function(_0x385c11){return db[_0xa2a5('0x38')][_0xa2a5('0x5a')](_0x385c11,{'transaction':_0x199aaa});});}else{_0x3f6366=0x194;_0x4566d0=[];}});})[_0xa2a5('0x12')](function(){if(_0x3f6366!==0x194){return db['VoiceExtension'][_0xa2a5('0x5b')]({'where':{'isApp':!![],'VoiceExtensionId':_0xb10073},'order':_0xa2a5('0x5c')})['then'](function(_0x1889ed){_0x4566d0=_0x1889ed;});}})[_0xa2a5('0x3c')](function(_0x24fb65){_0x3f6366=0x1f4;logger['error'](_0x24fb65['stack']);if(_0x24fb65[_0xa2a5('0x22')]){delete _0x24fb65[_0xa2a5('0x22')];}_0x4566d0=_0x24fb65;})['finally'](function(){if(_0x4566d0===null){_0x5302b7[_0xa2a5('0xa')](_0x3f6366);}else{if(_0x3f6366===0x1f4){_0x5302b7['status'](_0x3f6366)[_0xa2a5('0x23')](_0x4566d0);}else{_0x5302b7[_0xa2a5('0xb')](_0x3f6366)[_0xa2a5('0xd')](_0x4566d0);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 00914ec..66549a2 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 _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 +var _0xdd2f=['remove','emit','exports','VoiceExtension','setMaxListeners','save','update'];(function(_0x3f0e5b,_0x2da514){var _0x152e34=function(_0x4ca9a9){while(--_0x4ca9a9){_0x3f0e5b['push'](_0x3f0e5b['shift']());}};_0x152e34(++_0x2da514);}(_0xdd2f,0xb9));var _0xfdd2=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xdd2f[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0xfdd2('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xfdd2('0x1')](0x0);var events={'afterCreate':_0xfdd2('0x2'),'afterUpdate':_0xfdd2('0x3'),'afterDestroy':_0xfdd2('0x4')};function emitEvent(_0x20481c){return function(_0x5ed7d8,_0x5156a8,_0x1fb678){VoiceExtensionEvents[_0xfdd2('0x5')](_0x20481c+':'+_0x5ed7d8['id'],_0x5ed7d8);VoiceExtensionEvents[_0xfdd2('0x5')](_0x20481c,_0x5ed7d8);_0x1fb678(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xfdd2('0x6')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index f8b305c..691bfe9 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 _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 +var _0x4917=['findAll','interval','IntervalId','then','intervals','map','filter','toLowerCase','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','concat','define','VoiceExtension','voice_extensions','get','last','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','NoOp','CDR(routeAlias)=','alias','No\x20alias\x20set','context','inbound','push','exten','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','length','name','split','phone','prefix','param','SIP','join','none','U(xcally-mixmonitor-context)'];(function(_0x5eff86,_0x2cdd22){var _0x4b3010=function(_0x319012){while(--_0x319012){_0x5eff86['push'](_0x5eff86['shift']());}};_0x4b3010(++_0x2cdd22);}(_0x4917,0x116));var _0x7491=function(_0x263855,_0x362961){_0x263855=_0x263855-0x0;var _0x24eb25=_0x4917[_0x263855];return _0x24eb25;};'use strict';var _=require(_0x7491('0x0'));var attributes=require(_0x7491('0x1'));module[_0x7491('0x2')]=function(_0x4c4994){var _0x55d91c=_0x4c4994[_0x7491('0x3')];function _0x2c7abe(_0x392031){var _0x380785=0x2;var _0x4d516f=[{'type':_0x392031[_0x7491('0x4')],'app':_0x7491('0x5'),'appdata':_0x7491('0x6')+_0x392031[_0x7491('0x4')],'context':_0x392031['context'],'exten':_0x392031['exten'],'priority':_0x380785++,'VoiceExtensionId':_0x392031['id']},{'type':_0x392031[_0x7491('0x4')],'app':_0x392031['alias']?'Set':_0x7491('0x7'),'appdata':_0x392031['alias']?_0x7491('0x8')+_0x392031[_0x7491('0x9')]:_0x7491('0xa'),'context':_0x392031[_0x7491('0xb')],'exten':_0x392031['exten'],'priority':_0x380785++,'VoiceExtensionId':_0x392031['id']}];if(_0x392031[_0x7491('0x4')]===_0x7491('0xc')){_0x4d516f[_0x7491('0xd')]({'type':_0x7491('0xc'),'app':'Set','appdata':'CDR(routeid)='+_0x392031['id'],'context':_0x392031['context'],'exten':_0x392031[_0x7491('0xe')],'priority':_0x380785++,'VoiceExtensionId':_0x392031['id']});}_0x4d516f[_0x7491('0xd')]({'type':_0x392031[_0x7491('0x4')],'app':_0x7491('0x5'),'appdata':_0x7491('0xf'),'context':_0x392031[_0x7491('0xb')],'exten':_0x392031[_0x7491('0xe')],'priority':_0x380785++,'VoiceExtensionId':_0x392031['id']},{'type':_0x392031[_0x7491('0x4')],'app':_0x7491('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x392031[_0x7491('0xb')],'exten':_0x392031[_0x7491('0xe')],'priority':_0x380785++,'VoiceExtensionId':_0x392031['id']},{'type':_0x392031[_0x7491('0x4')],'app':_0x7491('0x5'),'appdata':_0x7491('0x10'),'context':_0x392031[_0x7491('0xb')],'exten':_0x392031['exten'],'priority':_0x380785++,'VoiceExtensionId':_0x392031['id']});return _0x4d516f;}function _0x134b67(_0x1ff9ab){var _0x2d134e=0x2;var _0x5e7995=[{'type':_0x7491('0x11'),'app':'Set','appdata':_0x7491('0x12'),'context':_0x1ff9ab['context'],'exten':_0x1ff9ab[_0x7491('0xe')],'priority':_0x2d134e++,'VoiceExtensionId':_0x1ff9ab['id']},{'type':_0x7491('0x11'),'app':_0x1ff9ab[_0x7491('0x9')]?_0x7491('0x5'):_0x7491('0x7'),'appdata':_0x1ff9ab['alias']?'CDR(routeAlias)='+_0x1ff9ab[_0x7491('0x9')]:'No\x20alias\x20set','context':_0x1ff9ab[_0x7491('0xb')],'exten':_0x1ff9ab[_0x7491('0xe')],'priority':_0x2d134e++,'VoiceExtensionId':_0x1ff9ab['id']},{'type':'outbound','app':'Set','appdata':_0x7491('0x13')+(_0x1ff9ab[_0x7491('0x14')]?_0x7491('0x15')+_0x1ff9ab['cutdigits']+'}':_0x7491('0x16')),'context':_0x1ff9ab['context'],'exten':_0x1ff9ab[_0x7491('0xe')],'priority':_0x2d134e++,'VoiceExtensionId':_0x1ff9ab['id']},{'type':_0x7491('0x11'),'app':_0x7491('0x5'),'appdata':_0x7491('0x17')+_0x1ff9ab['id'],'context':_0x1ff9ab[_0x7491('0xb')],'exten':_0x1ff9ab[_0x7491('0xe')],'priority':_0x2d134e++,'VoiceExtensionId':_0x1ff9ab['id']},{'type':_0x7491('0x11'),'app':'ExecIf','appdata':_0x7491('0x18')+(_0x2d134e+0x2)+_0x7491('0x19')+(_0x2d134e+0x1)+')','context':_0x1ff9ab['context'],'exten':_0x1ff9ab[_0x7491('0xe')],'priority':_0x2d134e++,'VoiceExtensionId':_0x1ff9ab['id']},{'type':_0x7491('0x11'),'app':_0x7491('0x5'),'appdata':_0x1ff9ab[_0x7491('0x14')]?'CDR(prefix)=${EXTEN:0:'+_0x1ff9ab['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x1ff9ab[_0x7491('0xb')],'exten':_0x1ff9ab['exten'],'priority':_0x2d134e++,'VoiceExtensionId':_0x1ff9ab['id']},{'type':_0x7491('0x11'),'app':_0x7491('0x5'),'appdata':_0x7491('0xf'),'context':_0x1ff9ab['context'],'exten':_0x1ff9ab[_0x7491('0xe')],'priority':_0x2d134e++,'VoiceExtensionId':_0x1ff9ab['id']},{'type':_0x7491('0x11'),'app':_0x7491('0x5'),'appdata':_0x7491('0x1a'),'context':_0x1ff9ab[_0x7491('0xb')],'exten':_0x1ff9ab[_0x7491('0xe')],'priority':_0x2d134e++,'VoiceExtensionId':_0x1ff9ab['id']},{'type':'outbound','app':_0x7491('0x5'),'appdata':_0x7491('0x10'),'context':_0x1ff9ab[_0x7491('0xb')],'exten':_0x1ff9ab['exten'],'priority':_0x2d134e++,'VoiceExtensionId':_0x1ff9ab['id']},{'type':'outbound','app':'Set','appdata':_0x7491('0x1b')+_0x1ff9ab['id'],'context':_0x1ff9ab['context'],'exten':_0x1ff9ab[_0x7491('0xe')],'priority':_0x2d134e++,'VoiceExtensionId':_0x1ff9ab['id']}];if(_0x1ff9ab[_0x7491('0x1c')](_0x7491('0x1d'))&&_0x1ff9ab['recordingFormat']!=='none'){_0x5e7995[_0x7491('0xd')]({'type':'outbound','app':_0x7491('0x5'),'appdata':_0x7491('0x1e'),'context':_0x1ff9ab[_0x7491('0xb')],'exten':_0x1ff9ab[_0x7491('0xe')],'priority':_0x2d134e++,'VoiceExtensionId':_0x1ff9ab['id']},{'type':'outbound','app':'Set','appdata':_0x7491('0x1f')+_0x1ff9ab[_0x7491('0x1d')]||_0x7491('0x20'),'context':_0x1ff9ab[_0x7491('0xb')],'exten':_0x1ff9ab[_0x7491('0xe')],'priority':_0x2d134e++,'VoiceExtensionId':_0x1ff9ab['id']});}return _0x5e7995;}function _0x5accb6(_0x595337,_0x192023){var _0xf9ab78=[{'name':_0x7491('0x21'),'param':0x0},{'name':_0x7491('0x22'),'param':0x1},{'name':_0x7491('0x23'),'param':0x2},{'name':'url','param':0x3}];var _0x579ee4={};var _0x3ca6e2=_0x192023['split'](',');var _0x486317=[];for(var _0x22378f=0x0;_0x22378f<_0xf9ab78[_0x7491('0x24')];_0x22378f++){switch(_0xf9ab78[_0x22378f][_0x7491('0x25')]){case _0x7491('0x21'):_0x579ee4[_0x7491('0x21')]=_0x3ca6e2[_0xf9ab78[_0x22378f]['param']][_0x7491('0x26')]('/')[0x1];_0x579ee4[_0x7491('0x27')]=_0x3ca6e2[_0xf9ab78[_0x22378f]['param']]['split']('/')[0x2];_0x579ee4[_0x7491('0x28')]=_0x579ee4[_0x7491('0x27')]?_0x579ee4[_0x7491('0x27')][_0x7491('0x26')]('$')[0x0]:undefined;_0x579ee4[_0x7491('0x27')]=_0x595337[_0x7491('0x14')]?(_0x579ee4[_0x7491('0x28')]||'')+'${EXTEN:'+_0x595337[_0x7491('0x14')]+'}':(_0x579ee4[_0x7491('0x28')]||'')+'${EXTEN}';_0x486317[_0xf9ab78[_0x22378f][_0x7491('0x29')]]=[_0x7491('0x2a'),_0x579ee4[_0x7491('0x21')],_0x579ee4[_0x7491('0x27')]][_0x7491('0x2b')]('/');break;case _0x7491('0x23'):_0x579ee4['options']=_0x3ca6e2[_0xf9ab78[_0x22378f][_0x7491('0x29')]];if(_0x595337[_0x7491('0x1d')]!==_0x7491('0x2c')){if(_0x579ee4['options']['indexOf']('U(xcally-mixmonitor-context)')<0x0){_0x579ee4[_0x7491('0x23')]+=_0x7491('0x2d');}}else{_0x579ee4[_0x7491('0x23')]=_0x579ee4['options']['replace'](_0x7491('0x2d'),'');}_0x486317[_0xf9ab78[_0x22378f]['param']]=_0x579ee4[_0x7491('0x23')];break;default:_0x486317[_0xf9ab78[_0x22378f]['param']]=_0x3ca6e2[_0xf9ab78[_0x22378f][_0x7491('0x29')]];}}return _0x486317[_0x7491('0x2b')](',');}function _0x1371ab(_0x3a8d73,_0x9c3bf0,_0x533d8a){return new Promise(function(_0x47085f,_0x31d0ef){var _0x1c9c05=[];if(_['isEmpty'](_0x9c3bf0))return _0x47085f(_0x1c9c05);_0x55d91c['Interval'][_0x7491('0x2e')]({'attributes':['id',_0x7491('0x2f'),_0x7491('0x30')],'raw':!![]})[_0x7491('0x31')](function(_0x182448){for(var _0x1fb7ac=0x0,_0x37d318=0x0;_0x1fb7ac<_0x9c3bf0[_0x7491('0x24')];_0x1fb7ac++,_0x37d318=0x0){var _0x5d3df6=_0x9c3bf0[_0x1fb7ac];var _0x3228ef=[];var _0x1d31a5=[];delete _0x5d3df6['id'];if(_0x5d3df6[_0x7491('0x2f')]!=='*,*,*,*'){_0x5d3df6[_0x7491('0x32')]=[_0x5d3df6[_0x7491('0x2f')]];}else{_0x5d3df6['intervals']=_0x5d3df6[_0x7491('0x30')]?_[_0x7491('0x33')](_[_0x7491('0x34')](_0x182448,{'IntervalId':_0x5d3df6[_0x7491('0x30')]}),'interval'):[];}_0x5d3df6[_0x7491('0xb')]=_0x3a8d73[_0x7491('0xb')];_0x5d3df6[_0x7491('0xe')]=_0x3a8d73[_0x7491('0xe')];if(_0x5d3df6[_0x7491('0x4')])_0x5d3df6[_0x7491('0x4')]=_0x5d3df6[_0x7491('0x4')][_0x7491('0x35')]();if(_0x3a8d73['type']===_0x7491('0x11')){if(_0x5d3df6[_0x7491('0x1c')](_0x7491('0x36'))&&_0x5d3df6[_0x7491('0x36')]&&_0x5d3df6[_0x7491('0x36')]!=='--'){_0x3228ef['push']({'type':_0x5d3df6[_0x7491('0x4')]['toLowerCase'](),'app':'Set','appdata':_0x7491('0x37')+_0x5d3df6[_0x7491('0x36')],'context':_0x3a8d73['context'],'exten':_0x3a8d73[_0x7491('0xe')],'priority':_0x5d3df6['intervals'][_0x7491('0x24')]+_0x533d8a+_0x37d318++,'VoiceExtensionId':_0x3a8d73['id']});}_0x3228ef[_0x7491('0xd')]({'type':_0x5d3df6[_0x7491('0x4')][_0x7491('0x35')](),'app':_0x7491('0x38'),'appdata':_0x7491('0x39')+(_0x5d3df6[_0x7491('0x3a')]?_0x7491('0x3b')+_0x5d3df6[_0x7491('0x3a')]+')':_0x7491('0x3c')),'context':_0x3a8d73[_0x7491('0xb')],'exten':_0x3a8d73[_0x7491('0xe')],'priority':_0x5d3df6[_0x7491('0x32')][_0x7491('0x24')]+_0x533d8a+_0x37d318++,'VoiceExtensionId':_0x3a8d73['id']});}else{if(_0x5d3df6[_0x7491('0x1c')](_0x7491('0x3d'))){if([_0x7491('0x3e'),_0x7491('0x3f')][_0x7491('0x40')](_0x5d3df6[_0x7491('0x41')]['toLowerCase']())&&_0x5d3df6[_0x7491('0x42')]!=='custom'){if(_0x5d3df6[_0x7491('0x3d')]){_0x3228ef[_0x7491('0xd')]({'type':_0x5d3df6[_0x7491('0x4')][_0x7491('0x35')](),'app':'ExecIf','appdata':_0x7491('0x43'),'context':_0x3a8d73['context'],'exten':_0x3a8d73[_0x7491('0xe')],'priority':_0x5d3df6[_0x7491('0x32')][_0x7491('0x24')]+_0x533d8a+_0x37d318++,'VoiceExtensionId':_0x3a8d73['id']});_0x3228ef[_0x7491('0xd')]({'type':_0x5d3df6[_0x7491('0x4')][_0x7491('0x35')](),'app':_0x7491('0x5'),'appdata':_0x7491('0x44'),'context':_0x3a8d73[_0x7491('0xb')],'exten':_0x3a8d73[_0x7491('0xe')],'priority':_0x5d3df6[_0x7491('0x32')]['length']+_0x533d8a+_0x37d318++,'VoiceExtensionId':_0x3a8d73['id']});}else{_0x3228ef[_0x7491('0xd')]({'type':_0x5d3df6[_0x7491('0x4')][_0x7491('0x35')](),'app':_0x7491('0x38'),'appdata':_0x7491('0x45'),'context':_0x3a8d73[_0x7491('0xb')],'exten':_0x3a8d73[_0x7491('0xe')],'priority':_0x5d3df6[_0x7491('0x32')][_0x7491('0x24')]+_0x533d8a+_0x37d318++,'VoiceExtensionId':_0x3a8d73['id']});_0x3228ef[_0x7491('0xd')]({'type':_0x5d3df6['type']['toLowerCase'](),'app':'Set','appdata':_0x7491('0x46'),'context':_0x3a8d73[_0x7491('0xb')],'exten':_0x3a8d73[_0x7491('0xe')],'priority':_0x5d3df6['intervals'][_0x7491('0x24')]+_0x533d8a+_0x37d318++,'VoiceExtensionId':_0x3a8d73['id']});}}}}for(var _0x24d0e4=0x0;_0x24d0e4<_0x5d3df6[_0x7491('0x32')][_0x7491('0x24')];_0x24d0e4++){var _0x57fb8b=_0x533d8a+_0x5d3df6[_0x7491('0x32')][_0x7491('0x24')];var _0x16934a=_0x24d0e4===_0x5d3df6['intervals'][_0x7491('0x24')]-0x1?_0x533d8a+_0x3228ef[_0x7491('0x24')]+_0x1d31a5[_0x7491('0x24')]+0x2:_0x533d8a+_0x24d0e4+0x1;_0x3228ef[_0x7491('0x47')](_0x24d0e4,0x0,{'type':_0x3a8d73['type'],'app':_0x7491('0x48'),'appdata':_0x5d3df6[_0x7491('0x32')][_0x24d0e4]+'?'+_0x3a8d73[_0x7491('0xb')]+',${EXTEN},'+_0x57fb8b+':'+_0x3a8d73[_0x7491('0xb')]+',${EXTEN},'+_0x16934a,'exten':_0x3a8d73[_0x7491('0xe')],'context':_0x3a8d73['context'],'priority':_0x533d8a+_0x24d0e4,'VoiceExtensionId':_0x3a8d73['id']});}if(_0x5d3df6[_0x7491('0x42')]==='outboundDial'){_0x5d3df6['appdata']=_0x5accb6(_0x3a8d73,_0x5d3df6['appdata']);}if(_0x5d3df6[_0x7491('0x42')]==='agi'){_0x3228ef[_0x7491('0xd')]({'type':_0x5d3df6['type'][_0x7491('0x35')](),'app':_0x7491('0x5'),'appdata':_0x7491('0x49'),'context':_0x3a8d73['context'],'exten':_0x3a8d73[_0x7491('0xe')],'priority':_0x5d3df6[_0x7491('0x32')]['length']+_0x533d8a+_0x37d318++,'VoiceExtensionId':_0x3a8d73['id']});}_0x5d3df6[_0x7491('0x4a')]=_0x3228ef[_0x7491('0x24')]?_['last'](_0x3228ef)['priority']+0x1:_0x533d8a;_0x1c9c05=_[_0x7491('0x4b')](_0x1c9c05,_0x3228ef,[_0x5d3df6],_0x1d31a5);_0x533d8a=_['last'](_0x1c9c05)['priority']+0x1;}return _0x47085f(_0x1c9c05);})['catch'](function(_0x3514ab){_0x31d0ef(_0x3514ab);});});}return _0x4c4994[_0x7491('0x4c')](_0x7491('0x4d'),attributes,{'tableName':_0x7491('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x90f560){var _0x553475=this[_0x7491('0x4f')]({'plain':!![]});var _0x3f879b=_0x553475[_0x7491('0x4')]==='outbound'?_0x134b67(_0x553475):_0x2c7abe(_0x553475);return _0x1371ab(_0x553475,_0x90f560,_[_0x7491('0x50')](_0x3f879b)['priority']+0x1)['then'](function(_0x56d2a1){var _0x69f7a4=_[_0x7491('0x4b')](_0x3f879b,_0x56d2a1);_0x69f7a4['push']({'type':_0x553475[_0x7491('0x4')],'app':'Hangup','exten':_0x553475[_0x7491('0xe')],'context':_0x553475['context'],'priority':_[_0x7491('0x50')](_0x69f7a4)[_0x7491('0x4a')]+0x1,'VoiceExtensionId':_0x553475['id']});return _0x69f7a4;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index bf272a2..8e51e45 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 _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 +var _0x5b5a=['limit','include','map','model','debug','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','info','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceExtension,\x20%s,\x20%s','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x5b5a,0xc3));var _0xa5b5=function(_0x1bf57f,_0x255df4){_0x1bf57f=_0x1bf57f-0x0;var _0x23a86b=_0x5b5a[_0x1bf57f];return _0x23a86b;};'use strict';var _=require('lodash');var util=require(_0xa5b5('0x0'));var moment=require(_0xa5b5('0x1'));var BPromise=require('bluebird');var rs=require(_0xa5b5('0x2'));var fs=require('fs');var Redis=require(_0xa5b5('0x3'));var db=require(_0xa5b5('0x4'))['db'];var utils=require(_0xa5b5('0x5'));var logger=require(_0xa5b5('0x6'))(_0xa5b5('0x7'));var config=require(_0xa5b5('0x8'));var jayson=require(_0xa5b5('0x9'));var client=jayson['client'][_0xa5b5('0xa')]({'port':0x232a});config[_0xa5b5('0xb')]=_['defaults'](config[_0xa5b5('0xb')],{'host':_0xa5b5('0xc'),'port':0x18eb});var socket=require(_0xa5b5('0xd'))(new Redis(config[_0xa5b5('0xb')]));require(_0xa5b5('0xe'))[_0xa5b5('0xf')](socket);function respondWithRpcPromise(_0x3d635d,_0x396c44,_0x37489f){return new BPromise(function(_0x1a35a0,_0x529bc3){return client['request'](_0x3d635d,_0x37489f)['then'](function(_0x5ad9f4){logger[_0xa5b5('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x396c44,_0xa5b5('0x11'));logger['debug'](_0xa5b5('0x12'),_0x396c44,_0xa5b5('0x11'),JSON[_0xa5b5('0x13')](_0x5ad9f4));if(_0x5ad9f4[_0xa5b5('0x14')]){if(_0x5ad9f4[_0xa5b5('0x14')][_0xa5b5('0x15')]===0x1f4){logger[_0xa5b5('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x396c44,_0x5ad9f4['error'][_0xa5b5('0x16')]);return _0x529bc3(_0x5ad9f4['error'][_0xa5b5('0x16')]);}logger[_0xa5b5('0x14')](_0xa5b5('0x17'),_0x396c44,_0x5ad9f4['error']['message']);return _0x1a35a0(_0x5ad9f4['error']['message']);}else{logger[_0xa5b5('0x10')](_0xa5b5('0x17'),_0x396c44,_0xa5b5('0x11'));_0x1a35a0(_0x5ad9f4[_0xa5b5('0x18')][_0xa5b5('0x16')]);}})[_0xa5b5('0x19')](function(_0x590620){logger[_0xa5b5('0x14')](_0xa5b5('0x17'),_0x396c44,_0x590620);_0x529bc3(_0x590620);});});}exports[_0xa5b5('0x1a')]=function(_0x4f31d4){var _0x21aa02=this;return new Promise(function(_0x243708,_0x5c64a9){return db[_0xa5b5('0x1b')][_0xa5b5('0x1c')]({'raw':_0x4f31d4[_0xa5b5('0x1d')]?_0x4f31d4[_0xa5b5('0x1d')][_0xa5b5('0x1e')]===undefined?!![]:![]:!![],'where':_0x4f31d4[_0xa5b5('0x1d')]?_0x4f31d4[_0xa5b5('0x1d')][_0xa5b5('0x1f')]||null:null,'attributes':_0x4f31d4[_0xa5b5('0x1d')]?_0x4f31d4[_0xa5b5('0x1d')][_0xa5b5('0x20')]||null:null,'limit':_0x4f31d4[_0xa5b5('0x1d')]?_0x4f31d4[_0xa5b5('0x1d')][_0xa5b5('0x21')]||null:null,'include':_0x4f31d4[_0xa5b5('0x1d')]?_0x4f31d4[_0xa5b5('0x1d')][_0xa5b5('0x22')]?_[_0xa5b5('0x23')](_0x4f31d4[_0xa5b5('0x1d')][_0xa5b5('0x22')],function(_0x39f19b){return{'model':db[_0x39f19b[_0xa5b5('0x24')]],'as':_0x39f19b['as'],'attributes':_0x39f19b[_0xa5b5('0x20')],'include':_0x39f19b[_0xa5b5('0x22')]?_['map'](_0x39f19b[_0xa5b5('0x22')],function(_0x159bcd){return{'model':db[_0x159bcd[_0xa5b5('0x24')]],'as':_0x159bcd['as'],'attributes':_0x159bcd[_0xa5b5('0x20')],'include':_0x159bcd['include']?_[_0xa5b5('0x23')](_0x159bcd[_0xa5b5('0x22')],function(_0x39a721){return{'model':db[_0x39a721[_0xa5b5('0x24')]],'as':_0x39a721['as'],'attributes':_0x39a721[_0xa5b5('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x365b73){logger['info'](_0xa5b5('0x1a'),_0x4f31d4);logger[_0xa5b5('0x25')](_0xa5b5('0x1a'),_0x4f31d4,JSON['stringify'](_0x365b73));_0x243708(_0x365b73);})[_0xa5b5('0x19')](function(_0x4b0134){logger[_0xa5b5('0x14')](_0xa5b5('0x1a'),_0x4b0134[_0xa5b5('0x16')],_0x4f31d4);_0x5c64a9(_0x21aa02[_0xa5b5('0x14')](0x1f4,_0x4b0134[_0xa5b5('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 3fd566c..0ba1ad0 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 _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 +var _0x0295=['emit','removeListener','register','voiceExtension:','./voiceExtension.events','update'];(function(_0x3d7bc7,_0x526d29){var _0x1f26c6=function(_0x32b186){while(--_0x32b186){_0x3d7bc7['push'](_0x3d7bc7['shift']());}};_0x1f26c6(++_0x526d29);}(_0x0295,0x1f0));var _0x5029=function(_0x5fb9da,_0x1ac0d0){_0x5fb9da=_0x5fb9da-0x0;var _0x528081=_0x0295[_0x5fb9da];return _0x528081;};'use strict';var VoiceExtensionEvents=require(_0x5029('0x0'));var events=['save','remove',_0x5029('0x1')];function createListener(_0x4f552a,_0x53c2e1){return function(_0x315589){_0x53c2e1[_0x5029('0x2')](_0x4f552a,_0x315589);};}function removeListener(_0x157a4f,_0x3d0af1){return function(){VoiceExtensionEvents[_0x5029('0x3')](_0x157a4f,_0x3d0af1);};}exports[_0x5029('0x4')]=function(_0x200217){for(var _0x215955=0x0,_0x5b3cd=events['length'];_0x215955<_0x5b3cd;_0x215955++){var _0x54978f=events[_0x215955];var _0x4ee867=createListener(_0x5029('0x5')+_0x54978f,_0x200217);VoiceExtensionEvents['on'](_0x54978f,_0x4ee867);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 1aa3699..1646e32 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 _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 +var _0xacf4=['index','/:id','isAuthenticated','show','post','create','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get'];(function(_0x477f6e,_0x21814f){var _0x1af2fe=function(_0x1d01f8){while(--_0x1d01f8){_0x477f6e['push'](_0x477f6e['shift']());}};_0x1af2fe(++_0x21814f);}(_0xacf4,0xe7));var _0x4acf=function(_0x2e48bf,_0x4bde87){_0x2e48bf=_0x2e48bf-0x0;var _0x2b6b2d=_0xacf4[_0x2e48bf];return _0x2b6b2d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4acf('0x0'));var timeout=require(_0x4acf('0x1'));var express=require(_0x4acf('0x2'));var router=express[_0x4acf('0x3')]();var fs_extra=require(_0x4acf('0x4'));var auth=require(_0x4acf('0x5'));var interaction=require(_0x4acf('0x6'));var config=require('../../config/environment');var controller=require(_0x4acf('0x7'));router[_0x4acf('0x8')]('/',auth['isAuthenticated'](),controller[_0x4acf('0x9')]);router[_0x4acf('0x8')](_0x4acf('0xa'),auth[_0x4acf('0xb')](),controller[_0x4acf('0xc')]);router['get']('/:id/messages',auth[_0x4acf('0xb')](),controller['getMessages']);router[_0x4acf('0xd')]('/',auth[_0x4acf('0xb')](),controller[_0x4acf('0xe')]);router['put'](_0x4acf('0xa'),auth[_0x4acf('0xb')](),controller['update']);router['delete'](_0x4acf('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x4acf('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index ed32cca..226b745 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 _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 +var _0x5619=['sequelize','exports','STRING','contest_mailbox','setDataValue','email','trim','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20'];(function(_0x4c27d5,_0x574816){var _0x3a0d7e=function(_0xe5aa3a){while(--_0xe5aa3a){_0x4c27d5['push'](_0x4c27d5['shift']());}};_0x3a0d7e(++_0x574816);}(_0x5619,0x130));var _0x9561=function(_0x136cb4,_0x22a5e3){_0x136cb4=_0x136cb4-0x0;var _0x4190bb=_0x5619[_0x136cb4];return _0x4190bb;};'use strict';var Sequelize=require(_0x9561('0x0'));module[_0x9561('0x1')]={'customer_id':{'type':Sequelize[_0x9561('0x2')]},'context':{'type':Sequelize[_0x9561('0x2')],'defaultValue':'from-voicemail','unique':_0x9561('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x9561('0x3')},'password':{'type':Sequelize[_0x9561('0x2')]},'fullname':{'type':Sequelize[_0x9561('0x2')]},'email':{'type':Sequelize[_0x9561('0x2')],'validate':{'isEmail':!![]},'set':function(_0xe79b5e){this[_0x9561('0x4')](_0x9561('0x5'),typeof _0xe79b5e==='string'&&_0xe79b5e[_0x9561('0x6')]()?_0xe79b5e[_0x9561('0x6')]():null);}},'pager':{'type':Sequelize[_0x9561('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM'](_0x9561('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x9561('0x8')](_0x9561('0x7'),'no'),'defaultValue':_0x9561('0x7'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x9561('0x2')]},'review':{'type':Sequelize[_0x9561('0x8')](_0x9561('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x9561('0x8')](_0x9561('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x9561('0x8')](_0x9561('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x9561('0x8')](_0x9561('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x9561('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x9561('0x8')](_0x9561('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x9561('0x8')](_0x9561('0x7'),'no'),'defaultValue':_0x9561('0x7'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x9561('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x9561('0x8')](_0x9561('0x7'),'no'),'defaultValue':_0x9561('0x7'),'allowNull':![]},'stamp':{'type':_0x9561('0xa')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x9561('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x9561('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x9561('0xc')],'get':function(){return this[_0x9561('0xd')](_0x9561('0xe'))+_0x9561('0xf')+this[_0x9561('0xd')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 563fd50..aca238c 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 _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 +var _0x4e81=['merge','VIRTUAL','filter','options','rows','catch','show','params','length','includeAll','include','find','create','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','findOne','VoiceMailMessage','hasOwnProperty','pick','findAndCountAll','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','get','Voicemails','UserProfileResource','end','name','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where'];(function(_0x2cacef,_0xba1573){var _0x289ba6=function(_0x4ac8b9){while(--_0x4ac8b9){_0x2cacef['push'](_0x2cacef['shift']());}};_0x289ba6(++_0xba1573);}(_0x4e81,0x1bc));var _0x14e8=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0x4e81[_0x15ea09];return _0x3e9c78;};'use strict';var emlformat=require(_0x14e8('0x0'));var rimraf=require(_0x14e8('0x1'));var zipdir=require(_0x14e8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x14e8('0x3'));var Mustache=require(_0x14e8('0x4'));var util=require(_0x14e8('0x5'));var path=require(_0x14e8('0x6'));var sox=require(_0x14e8('0x7'));var csv=require(_0x14e8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x14e8('0x9'));var squel=require(_0x14e8('0xa'));var crypto=require(_0x14e8('0xb'));var jsforce=require(_0x14e8('0xc'));var deskjs=require(_0x14e8('0xd'));var toCsv=require(_0x14e8('0x8'));var querystring=require(_0x14e8('0xe'));var Papa=require(_0x14e8('0xf'));var Redis=require(_0x14e8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x14e8('0x11'));var as=require(_0x14e8('0x12'));var hardwareService=require(_0x14e8('0x13'));var logger=require(_0x14e8('0x14'))(_0x14e8('0x15'));var utils=require(_0x14e8('0x16'));var config=require(_0x14e8('0x17'));var licenseUtil=require(_0x14e8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37eccb,_0x59c6c9){_0x59c6c9=_0x59c6c9||0xcc;return function(_0x2607ef){if(_0x2607ef){return _0x37eccb[_0x14e8('0x19')](_0x59c6c9);}return _0x37eccb[_0x14e8('0x1a')](_0x59c6c9)['end']();};}function respondWithResult(_0x22fa86,_0x4e1064){_0x4e1064=_0x4e1064||0xc8;return function(_0x458e4a){if(_0x458e4a){return _0x22fa86['status'](_0x4e1064)[_0x14e8('0x1b')](_0x458e4a);}};}function respondWithFilteredResult(_0x3761a1,_0xc6101f){return function(_0x135996){if(_0x135996){var _0x52e64f=typeof _0xc6101f[_0x14e8('0x1c')]===_0x14e8('0x1d')&&typeof _0xc6101f[_0x14e8('0x1e')]===_0x14e8('0x1d');var _0xd4d6b2=_0x135996[_0x14e8('0x1f')];var _0x10dc8b=_0x52e64f?0x0:_0xc6101f[_0x14e8('0x1c')];var _0x5a38c1=_0x52e64f?_0x135996[_0x14e8('0x1f')]:_0xc6101f[_0x14e8('0x1c')]+_0xc6101f[_0x14e8('0x1e')];var _0x7b10f2;if(_0x5a38c1>=_0xd4d6b2){_0x5a38c1=_0xd4d6b2;_0x7b10f2=0xc8;}else{_0x7b10f2=0xce;}_0x3761a1[_0x14e8('0x1a')](_0x7b10f2);return _0x3761a1['set'](_0x14e8('0x20'),_0x10dc8b+'-'+_0x5a38c1+'/'+_0xd4d6b2)[_0x14e8('0x1b')](_0x135996);}return null;};}function patchUpdates(_0x2abfec){return function(_0x48e30a){try{jsonpatch[_0x14e8('0x21')](_0x48e30a,_0x2abfec,!![]);}catch(_0x47f060){return BPromise[_0x14e8('0x22')](_0x47f060);}return _0x48e30a[_0x14e8('0x23')]();};}function saveUpdates(_0x3e8d5c,_0x117b00){return function(_0xcf673){if(_0xcf673){return _0xcf673['update'](_0x3e8d5c)[_0x14e8('0x24')](function(_0x5b11f9){return _0x5b11f9;});}return null;};}function removeEntity(_0x31bdd3,_0x185a0e){return function(_0x4ffc8b){if(_0x4ffc8b){return _0x4ffc8b['destroy']()['then'](function(){var _0x4a758c=_0x4ffc8b[_0x14e8('0x25')]({'plain':!![]});var _0x3eae0b=_0x14e8('0x26');return db[_0x14e8('0x27')]['destroy']({'where':{'type':_0x3eae0b,'resourceId':_0x4a758c['id']}})[_0x14e8('0x24')](function(){return _0x4ffc8b;});})[_0x14e8('0x24')](function(){_0x31bdd3[_0x14e8('0x1a')](0xcc)[_0x14e8('0x28')]();});}};}function handleEntityNotFound(_0x28035a,_0xfc0545){return function(_0x2813ae){if(!_0x2813ae){_0x28035a['sendStatus'](0x194);}return _0x2813ae;};}function handleError(_0x38d7a7,_0x151090){_0x151090=_0x151090||0x1f4;return function(_0x393ab0){logger['error'](_0x393ab0['stack']);if(_0x393ab0['name']){delete _0x393ab0[_0x14e8('0x29')];}_0x38d7a7[_0x14e8('0x1a')](_0x151090)['send'](_0x393ab0);};}exports[_0x14e8('0x2a')]=function(_0x1d71ca,_0x176e8f){var _0xa83433={},_0x5c2635={},_0x1f1259={'count':0x0,'rows':[]};var _0x260d51=_[_0x14e8('0x2b')](db[_0x14e8('0x2c')][_0x14e8('0x2d')],function(_0x54068d){return{'name':_0x54068d[_0x14e8('0x2e')],'type':_0x54068d[_0x14e8('0x2f')][_0x14e8('0x30')]};});_0x5c2635[_0x14e8('0x31')]=_['map'](_0x260d51,_0x14e8('0x29'));_0x5c2635['query']=_[_0x14e8('0x32')](_0x1d71ca[_0x14e8('0x33')]);_0x5c2635[_0x14e8('0x34')]=_[_0x14e8('0x35')](_0x5c2635[_0x14e8('0x31')],_0x5c2635[_0x14e8('0x33')]);_0xa83433[_0x14e8('0x36')]=_[_0x14e8('0x35')](_0x5c2635[_0x14e8('0x31')],qs[_0x14e8('0x37')](_0x1d71ca[_0x14e8('0x33')][_0x14e8('0x37')]));_0xa83433['attributes']=_0xa83433['attributes']['length']?_0xa83433[_0x14e8('0x36')]:_0x5c2635['model'];if(!_0x1d71ca[_0x14e8('0x33')]['hasOwnProperty'](_0x14e8('0x38'))){_0xa83433[_0x14e8('0x1e')]=qs[_0x14e8('0x1e')](_0x1d71ca[_0x14e8('0x33')]['limit']);_0xa83433[_0x14e8('0x1c')]=qs['offset'](_0x1d71ca[_0x14e8('0x33')][_0x14e8('0x1c')]);}_0xa83433[_0x14e8('0x39')]=qs[_0x14e8('0x3a')](_0x1d71ca[_0x14e8('0x33')][_0x14e8('0x3a')]);_0xa83433['where']=qs[_0x14e8('0x34')](_['pick'](_0x1d71ca[_0x14e8('0x33')],_0x5c2635[_0x14e8('0x34')]),_0x260d51);if(_0x1d71ca[_0x14e8('0x33')]['filter']){_0xa83433[_0x14e8('0x3b')]=_[_0x14e8('0x3c')](_0xa83433['where'],{'$or':_[_0x14e8('0x2b')](_0x260d51,function(_0x38b874){if(_0x38b874[_0x14e8('0x2f')]!==_0x14e8('0x3d')){var _0x77e8a0={};_0x77e8a0[_0x38b874[_0x14e8('0x29')]]={'$like':'%'+_0x1d71ca[_0x14e8('0x33')][_0x14e8('0x3e')]+'%'};return _0x77e8a0;}})});}_0xa83433=_[_0x14e8('0x3c')]({},_0xa83433,_0x1d71ca[_0x14e8('0x3f')]);var _0x11f0ee={'where':_0xa83433[_0x14e8('0x3b')]};return db[_0x14e8('0x2c')][_0x14e8('0x1f')](_0x11f0ee)[_0x14e8('0x24')](function(_0x596ac7){_0x1f1259[_0x14e8('0x1f')]=_0x596ac7;if(_0x1d71ca['query']['includeAll']){_0xa83433['include']=[{'all':!![]}];}return db[_0x14e8('0x2c')]['findAll'](_0xa83433);})[_0x14e8('0x24')](function(_0x45bff0){_0x1f1259[_0x14e8('0x40')]=_0x45bff0;return _0x1f1259;})[_0x14e8('0x24')](respondWithFilteredResult(_0x176e8f,_0xa83433))[_0x14e8('0x41')](handleError(_0x176e8f,null));};exports[_0x14e8('0x42')]=function(_0x125af5,_0xd52530){var _0x2ccd6c={'raw':!![],'where':{'id':_0x125af5[_0x14e8('0x43')]['id']}},_0x3f9da0={};_0x3f9da0['model']=_[_0x14e8('0x32')](db[_0x14e8('0x2c')][_0x14e8('0x2d')]);_0x3f9da0[_0x14e8('0x33')]=_['keys'](_0x125af5[_0x14e8('0x33')]);_0x3f9da0[_0x14e8('0x34')]=_['intersection'](_0x3f9da0['model'],_0x3f9da0[_0x14e8('0x33')]);_0x2ccd6c['attributes']=_['intersection'](_0x3f9da0[_0x14e8('0x31')],qs[_0x14e8('0x37')](_0x125af5['query'][_0x14e8('0x37')]));_0x2ccd6c[_0x14e8('0x36')]=_0x2ccd6c['attributes'][_0x14e8('0x44')]?_0x2ccd6c[_0x14e8('0x36')]:_0x3f9da0[_0x14e8('0x31')];if(_0x125af5[_0x14e8('0x33')][_0x14e8('0x45')]){_0x2ccd6c[_0x14e8('0x46')]=[{'all':!![]}];}_0x2ccd6c=_[_0x14e8('0x3c')]({},_0x2ccd6c,_0x125af5[_0x14e8('0x3f')]);return db[_0x14e8('0x2c')][_0x14e8('0x47')](_0x2ccd6c)[_0x14e8('0x24')](handleEntityNotFound(_0xd52530,null))[_0x14e8('0x24')](respondWithResult(_0xd52530,null))[_0x14e8('0x41')](handleError(_0xd52530,null));};exports[_0x14e8('0x48')]=function(_0x1bf742,_0x1f50bc){return db['VoiceMail'][_0x14e8('0x48')](_0x1bf742['body'],{})[_0x14e8('0x24')](function(_0x3fadc2){var _0x403628=_0x1bf742[_0x14e8('0x49')]['get']({'plain':!![]});if(!_0x403628)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x403628['role']===_0x14e8('0x49')){var _0x49657e=_0x3fadc2['get']({'plain':!![]});var _0xd2b281=_0x14e8('0x26');return db['UserProfileSection'][_0x14e8('0x47')]({'where':{'name':_0xd2b281,'userProfileId':_0x403628[_0x14e8('0x4a')]},'raw':!![]})[_0x14e8('0x24')](function(_0x416e65){if(_0x416e65&&_0x416e65['autoAssociation']===0x0){return db['UserProfileResource'][_0x14e8('0x48')]({'name':_0x49657e[_0x14e8('0x29')],'resourceId':_0x49657e['id'],'type':_0x416e65[_0x14e8('0x29')],'sectionId':_0x416e65['id']},{})[_0x14e8('0x24')](function(){return _0x3fadc2;});}else{return _0x3fadc2;}})[_0x14e8('0x41')](function(_0x2fbac7){logger['error'](_0x14e8('0x4b'),_0x2fbac7);throw _0x2fbac7;});}return _0x3fadc2;})[_0x14e8('0x24')](respondWithResult(_0x1f50bc,0xc9))[_0x14e8('0x41')](handleError(_0x1f50bc,null));};exports[_0x14e8('0x4c')]=function(_0x5e6083,_0x2af48f){if(_0x5e6083[_0x14e8('0x4d')]['id']){delete _0x5e6083[_0x14e8('0x4d')]['id'];}return db[_0x14e8('0x2c')]['find']({'where':{'id':_0x5e6083[_0x14e8('0x43')]['id']}})[_0x14e8('0x24')](handleEntityNotFound(_0x2af48f,null))[_0x14e8('0x24')](saveUpdates(_0x5e6083[_0x14e8('0x4d')],null))[_0x14e8('0x24')](respondWithResult(_0x2af48f,null))[_0x14e8('0x41')](handleError(_0x2af48f,null));};exports[_0x14e8('0x4e')]=function(_0x168b8a,_0x5ab659){return db['VoiceMail'][_0x14e8('0x47')]({'where':{'id':_0x168b8a[_0x14e8('0x43')]['id']}})[_0x14e8('0x24')](handleEntityNotFound(_0x5ab659,null))[_0x14e8('0x24')](removeEntity(_0x5ab659,null))[_0x14e8('0x41')](handleError(_0x5ab659,null));};exports['getMessages']=function(_0x4a631a,_0x4c49e5,_0xf8a05d){return db[_0x14e8('0x2c')][_0x14e8('0x4f')]({'where':{'id':_0x4a631a['params']['id']}})[_0x14e8('0x24')](handleEntityNotFound(_0x4c49e5,null))[_0x14e8('0x24')](function(_0x1d6683){var _0x54e164;var _0x274837={},_0x63b342={};_0x63b342[_0x14e8('0x31')]=_[_0x14e8('0x32')](db[_0x14e8('0x50')][_0x14e8('0x2d')]);_0x63b342[_0x14e8('0x33')]=_[_0x14e8('0x32')](_0x4a631a[_0x14e8('0x33')]);_0x63b342[_0x14e8('0x34')]=_[_0x14e8('0x35')](_0x63b342['model'],_0x63b342[_0x14e8('0x33')]);_0x274837[_0x14e8('0x36')]=_[_0x14e8('0x35')](_0x63b342[_0x14e8('0x31')],qs[_0x14e8('0x37')](_0x4a631a[_0x14e8('0x33')][_0x14e8('0x37')]));_0x274837[_0x14e8('0x36')]=_0x274837[_0x14e8('0x36')][_0x14e8('0x44')]?_0x274837[_0x14e8('0x36')]:_0x63b342[_0x14e8('0x31')];if(!_0x4a631a['query'][_0x14e8('0x51')](_0x14e8('0x38'))){_0x274837['limit']=qs[_0x14e8('0x1e')](_0x4a631a[_0x14e8('0x33')][_0x14e8('0x1e')]);_0x274837[_0x14e8('0x1c')]=qs[_0x14e8('0x1c')](_0x4a631a[_0x14e8('0x33')][_0x14e8('0x1c')]);}_0x274837['order']=qs['sort'](_0x4a631a['query'][_0x14e8('0x3a')]);_0x274837[_0x14e8('0x3b')]=qs[_0x14e8('0x34')](_[_0x14e8('0x52')](_0x4a631a[_0x14e8('0x33')],_0x63b342[_0x14e8('0x34')]));if(_0x4a631a[_0x14e8('0x33')]['filter']){_0x274837[_0x14e8('0x3b')]=_[_0x14e8('0x3c')](_0x274837['where'],{'$or':_[_0x14e8('0x2b')](_0x274837[_0x14e8('0x36')],function(_0x4c3ead){var _0x58fa2e={};_0x58fa2e[_0x4c3ead]={'$like':'%'+_0x4a631a['query'][_0x14e8('0x3e')]+'%'};return _0x58fa2e;})});}_0x274837[_0x14e8('0x3b')]=_[_0x14e8('0x3c')](_0x274837[_0x14e8('0x3b')],{'mailboxuser':_0x1d6683['mailbox']});_0x274837=_[_0x14e8('0x3c')]({},_0x274837,_0x4a631a[_0x14e8('0x3f')]);return db[_0x14e8('0x50')][_0x14e8('0x53')](_0x274837)[_0x14e8('0x24')](respondWithFilteredResult(_0x4c49e5,_0x274837));})[_0x14e8('0x41')](handleError(_0x4c49e5,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index bf542b1..cba740c 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 _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 +var _0x727b=['mailbox','context','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./voiceMail.attributes','VoiceMail'];(function(_0x3748a9,_0x1b3508){var _0x2f3bbe=function(_0x36a8f5){while(--_0x36a8f5){_0x3748a9['push'](_0x3748a9['shift']());}};_0x2f3bbe(++_0x1b3508);}(_0x727b,0x122));var _0xb727=function(_0x42dcb1,_0x40352b){_0x42dcb1=_0x42dcb1-0x0;var _0x1d59aa=_0x727b[_0x42dcb1];return _0x1d59aa;};'use strict';var _=require(_0xb727('0x0'));var util=require(_0xb727('0x1'));var logger=require(_0xb727('0x2'))(_0xb727('0x3'));var moment=require(_0xb727('0x4'));var BPromise=require('bluebird');var rp=require(_0xb727('0x5'));var fs=require('fs');var path=require(_0xb727('0x6'));var rimraf=require(_0xb727('0x7'));var config=require('../../config/environment');var attributes=require(_0xb727('0x8'));module['exports']=function(_0x5d9d80,_0x158aad){return _0x5d9d80['define'](_0xb727('0x9'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0xb727('0xa'),_0xb727('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 25092aa..cf4099b 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 _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 +var _0x7b0d=['then','VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5fc11b,_0x363fa5){var _0x34fa91=function(_0x1639e7){while(--_0x1639e7){_0x5fc11b['push'](_0x5fc11b['shift']());}};_0x34fa91(++_0x363fa5);}(_0x7b0d,0xba));var _0xd7b0=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x7b0d[_0x29b609];return _0x54c952;};'use strict';var _=require(_0xd7b0('0x0'));var util=require(_0xd7b0('0x1'));var moment=require(_0xd7b0('0x2'));var BPromise=require('bluebird');var rs=require(_0xd7b0('0x3'));var fs=require('fs');var Redis=require(_0xd7b0('0x4'));var db=require(_0xd7b0('0x5'))['db'];var utils=require(_0xd7b0('0x6'));var logger=require(_0xd7b0('0x7'))(_0xd7b0('0x8'));var config=require(_0xd7b0('0x9'));var jayson=require(_0xd7b0('0xa'));var client=jayson[_0xd7b0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0d5b,_0x2a24cc,_0x140f36){return new BPromise(function(_0x54918d,_0x6847fd){return client['request'](_0x3b0d5b,_0x140f36)[_0xd7b0('0xc')](function(_0x4da5c9){logger['info'](_0xd7b0('0xd'),_0x2a24cc,_0xd7b0('0xe'));logger['debug'](_0xd7b0('0xf'),_0x2a24cc,_0xd7b0('0xe'),JSON[_0xd7b0('0x10')](_0x4da5c9));if(_0x4da5c9[_0xd7b0('0x11')]){if(_0x4da5c9[_0xd7b0('0x11')][_0xd7b0('0x12')]===0x1f4){logger[_0xd7b0('0x11')]('VoiceMail,\x20%s,\x20%s',_0x2a24cc,_0x4da5c9[_0xd7b0('0x11')]['message']);return _0x6847fd(_0x4da5c9[_0xd7b0('0x11')]['message']);}logger[_0xd7b0('0x11')]('VoiceMail,\x20%s,\x20%s',_0x2a24cc,_0x4da5c9[_0xd7b0('0x11')][_0xd7b0('0x13')]);return _0x54918d(_0x4da5c9['error']['message']);}else{logger[_0xd7b0('0x14')]('VoiceMail,\x20%s,\x20%s',_0x2a24cc,_0xd7b0('0xe'));_0x54918d(_0x4da5c9['result']['message']);}})[_0xd7b0('0x15')](function(_0x422679){logger[_0xd7b0('0x11')](_0xd7b0('0xd'),_0x2a24cc,_0x422679);_0x6847fd(_0x422679);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index d7a0216..96fb4ae 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 _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 +var _0x8370=['../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','show','/:id/download','download','post','create','put','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x55dd30,_0x4eab62){var _0x10677d=function(_0x552974){while(--_0x552974){_0x55dd30['push'](_0x55dd30['shift']());}};_0x10677d(++_0x4eab62);}(_0x8370,0x16f));var _0x0837=function(_0x57f39f,_0x3b563e){_0x57f39f=_0x57f39f-0x0;var _0x246b22=_0x8370[_0x57f39f];return _0x246b22;};'use strict';var multer=require('multer');var util=require(_0x0837('0x0'));var path=require(_0x0837('0x1'));var timeout=require(_0x0837('0x2'));var express=require(_0x0837('0x3'));var router=express[_0x0837('0x4')]();var fs_extra=require(_0x0837('0x5'));var auth=require(_0x0837('0x6'));var interaction=require(_0x0837('0x7'));var config=require(_0x0837('0x8'));var controller=require(_0x0837('0x9'));router[_0x0837('0xa')]('/',auth[_0x0837('0xb')](),controller['index']);router[_0x0837('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0837('0xc')]);router['get'](_0x0837('0xd'),auth[_0x0837('0xb')](),controller[_0x0837('0xe')]);router[_0x0837('0xf')]('/',auth['isAuthenticated'](),controller[_0x0837('0x10')]);router[_0x0837('0x11')](_0x0837('0x12'),auth[_0x0837('0xb')](),controller[_0x0837('0x13')]);router[_0x0837('0x14')](_0x0837('0x12'),auth[_0x0837('0xb')](),controller[_0x0837('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 087823e..567149f 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 _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 +var _0x6726=['INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','getDataValue'];(function(_0x359358,_0x210b55){var _0x2d24aa=function(_0x3bfa6c){while(--_0x3bfa6c){_0x359358['push'](_0x359358['shift']());}};_0x2d24aa(++_0x210b55);}(_0x6726,0x1f1));var _0x6672=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x6726[_0x481bf7];return _0x461787;};'use strict';var Sequelize=require(_0x6672('0x0'));module['exports']={'name':{'type':Sequelize[_0x6672('0x1')],'get':function(_0x3dda96){return this[_0x6672('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x6672('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x6672('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x6672('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x6672('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x6672('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x6672('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x6672('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x6672('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x6672('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x6672('0x5')](_0x6672('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x6672('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x6672('0x4')],'defaultValue':''},'stamp':{'type':_0x6672('0x7'),'defaultValue':Sequelize[_0x6672('0x8')](_0x6672('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index e9bf1af..c605eb9 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 _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 +var _0x1adc=['../../mysqldb','sendStatus','status','json','offset','limit','count','apply','reject','update','then','end','stack','name','send','index','VoiceMailMessage','rawAttributes','type','key','model','differenceBy','map','query','keys','filters','intersection','attributes','fields','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','length','find','catch','body','destroy','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','set','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0xd63e3a,_0x1bd6eb){var _0x19c178=function(_0x56be0d){while(--_0x56be0d){_0xd63e3a['push'](_0xd63e3a['shift']());}};_0x19c178(++_0x1bd6eb);}(_0x1adc,0x179));var _0xc1ad=function(_0x4ababe,_0x19df6b){_0x4ababe=_0x4ababe-0x0;var _0x500ed9=_0x1adc[_0x4ababe];return _0x500ed9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc1ad('0x0'));var zipdir=require(_0xc1ad('0x1'));var jsonpatch=require(_0xc1ad('0x2'));var rp=require(_0xc1ad('0x3'));var moment=require(_0xc1ad('0x4'));var BPromise=require(_0xc1ad('0x5'));var Mustache=require(_0xc1ad('0x6'));var util=require(_0xc1ad('0x7'));var path=require(_0xc1ad('0x8'));var sox=require(_0xc1ad('0x9'));var csv=require('to-csv');var ejs=require(_0xc1ad('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc1ad('0xb'));var crypto=require(_0xc1ad('0xc'));var jsforce=require(_0xc1ad('0xd'));var deskjs=require(_0xc1ad('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc1ad('0xf'));var Papa=require(_0xc1ad('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc1ad('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc1ad('0x12'));var logger=require('../../config/logger')(_0xc1ad('0x13'));var utils=require(_0xc1ad('0x14'));var config=require(_0xc1ad('0x15'));var licenseUtil=require(_0xc1ad('0x16'));var db=require(_0xc1ad('0x17'))['db'];function respondWithStatusCode(_0x1a0e72,_0x1a5418){_0x1a5418=_0x1a5418||0xcc;return function(_0x58cd06){if(_0x58cd06){return _0x1a0e72[_0xc1ad('0x18')](_0x1a5418);}return _0x1a0e72[_0xc1ad('0x19')](_0x1a5418)['end']();};}function respondWithResult(_0x5b2a15,_0x49843f){_0x49843f=_0x49843f||0xc8;return function(_0x3f037d){if(_0x3f037d){return _0x5b2a15[_0xc1ad('0x19')](_0x49843f)[_0xc1ad('0x1a')](_0x3f037d);}};}function respondWithFilteredResult(_0x157a98,_0x54d9bc){return function(_0x3d27e7){if(_0x3d27e7){var _0x38da0b=typeof _0x54d9bc[_0xc1ad('0x1b')]==='undefined'&&typeof _0x54d9bc[_0xc1ad('0x1c')]==='undefined';var _0x2a7d90=_0x3d27e7[_0xc1ad('0x1d')];var _0x430ca0=_0x38da0b?0x0:_0x54d9bc[_0xc1ad('0x1b')];var _0x1fbf98=_0x38da0b?_0x3d27e7[_0xc1ad('0x1d')]:_0x54d9bc[_0xc1ad('0x1b')]+_0x54d9bc[_0xc1ad('0x1c')];var _0x592ab6;if(_0x1fbf98>=_0x2a7d90){_0x1fbf98=_0x2a7d90;_0x592ab6=0xc8;}else{_0x592ab6=0xce;}_0x157a98['status'](_0x592ab6);return _0x157a98['set']('Content-Range',_0x430ca0+'-'+_0x1fbf98+'/'+_0x2a7d90)[_0xc1ad('0x1a')](_0x3d27e7);}return null;};}function patchUpdates(_0x33f9b4){return function(_0x47e6eb){try{jsonpatch[_0xc1ad('0x1e')](_0x47e6eb,_0x33f9b4,!![]);}catch(_0x30c226){return BPromise[_0xc1ad('0x1f')](_0x30c226);}return _0x47e6eb['save']();};}function saveUpdates(_0x9ad945,_0x3c80be){return function(_0x45add3){if(_0x45add3){return _0x45add3[_0xc1ad('0x20')](_0x9ad945)[_0xc1ad('0x21')](function(_0x48ae44){return _0x48ae44;});}return null;};}function removeEntity(_0x279e23,_0x592c06){return function(_0x133e26){if(_0x133e26){return _0x133e26['destroy']()[_0xc1ad('0x21')](function(){_0x279e23[_0xc1ad('0x19')](0xcc)[_0xc1ad('0x22')]();});}};}function handleEntityNotFound(_0x15f4ce,_0x130da6){return function(_0x710c54){if(!_0x710c54){_0x15f4ce[_0xc1ad('0x18')](0x194);}return _0x710c54;};}function handleError(_0x3a045b,_0x90a0d9){_0x90a0d9=_0x90a0d9||0x1f4;return function(_0x4f253d){logger['error'](_0x4f253d[_0xc1ad('0x23')]);if(_0x4f253d[_0xc1ad('0x24')]){delete _0x4f253d[_0xc1ad('0x24')];}_0x3a045b[_0xc1ad('0x19')](_0x90a0d9)[_0xc1ad('0x25')](_0x4f253d);};}exports[_0xc1ad('0x26')]=function(_0x5632b6,_0x56a1db){var _0x5af7ea={},_0x17a026={},_0x1885c9={'count':0x0,'rows':[]};var _0xf8fdf0=_['map'](db[_0xc1ad('0x27')][_0xc1ad('0x28')],function(_0x1a1abc){return{'name':_0x1a1abc['fieldName'],'type':_0x1a1abc[_0xc1ad('0x29')][_0xc1ad('0x2a')]};});_0x17a026[_0xc1ad('0x2b')]=_[_0xc1ad('0x2c')](_[_0xc1ad('0x2d')](_0xf8fdf0,_0xc1ad('0x24')),[_0xc1ad('0x24')]);_0x17a026[_0xc1ad('0x2e')]=_[_0xc1ad('0x2f')](_0x5632b6['query']);_0x17a026[_0xc1ad('0x30')]=_[_0xc1ad('0x31')](_0x17a026[_0xc1ad('0x2b')],_0x17a026[_0xc1ad('0x2e')]);_0x5af7ea[_0xc1ad('0x32')]=_[_0xc1ad('0x31')](_0x17a026[_0xc1ad('0x2b')],qs[_0xc1ad('0x33')](_0x5632b6[_0xc1ad('0x2e')][_0xc1ad('0x33')]));_0x5af7ea[_0xc1ad('0x32')]=_0x5af7ea[_0xc1ad('0x32')]['length']?_0x5af7ea[_0xc1ad('0x32')]:_0x17a026['model'];if(!_0x5632b6[_0xc1ad('0x2e')]['hasOwnProperty']('nolimit')){_0x5af7ea[_0xc1ad('0x1c')]=qs[_0xc1ad('0x1c')](_0x5632b6[_0xc1ad('0x2e')][_0xc1ad('0x1c')]);_0x5af7ea[_0xc1ad('0x1b')]=qs[_0xc1ad('0x1b')](_0x5632b6[_0xc1ad('0x2e')][_0xc1ad('0x1b')]);}_0x5af7ea[_0xc1ad('0x34')]=qs[_0xc1ad('0x35')](_0x5632b6[_0xc1ad('0x2e')][_0xc1ad('0x35')]);_0x5af7ea['where']=qs['filters'](_[_0xc1ad('0x36')](_0x5632b6['query'],_0x17a026['filters']),_0xf8fdf0);if(_0x5632b6['query'][_0xc1ad('0x37')]){_0x5af7ea[_0xc1ad('0x38')]=_['merge'](_0x5af7ea[_0xc1ad('0x38')],{'$or':_['map'](_0xf8fdf0,function(_0x4c9132){if(_0x4c9132[_0xc1ad('0x29')]!==_0xc1ad('0x39')){var _0x30c770={};_0x30c770[_0x4c9132[_0xc1ad('0x24')]]={'$like':'%'+_0x5632b6[_0xc1ad('0x2e')]['filter']+'%'};return _0x30c770;}})});}_0x5af7ea=_[_0xc1ad('0x3a')]({},_0x5af7ea,_0x5632b6[_0xc1ad('0x3b')]);var _0xc5f19d={'where':_0x5af7ea['where']};return db['VoiceMailMessage']['count'](_0xc5f19d)['then'](function(_0x1edc38){_0x1885c9[_0xc1ad('0x1d')]=_0x1edc38;if(_0x5632b6['query'][_0xc1ad('0x3c')]){_0x5af7ea[_0xc1ad('0x3d')]=[{'all':!![]}];}return db[_0xc1ad('0x27')][_0xc1ad('0x3e')](_0x5af7ea);})[_0xc1ad('0x21')](function(_0x2b3cde){_0x1885c9[_0xc1ad('0x3f')]=_0x2b3cde;return _0x1885c9;})[_0xc1ad('0x21')](respondWithFilteredResult(_0x56a1db,_0x5af7ea))['catch'](handleError(_0x56a1db,null));};exports[_0xc1ad('0x40')]=function(_0x3a819,_0x170f89){var _0x3e4420={'raw':!![],'where':{'id':_0x3a819[_0xc1ad('0x41')]['id']}},_0x55f21f={};_0x55f21f['model']=_[_0xc1ad('0x2f')](db[_0xc1ad('0x27')]['rawAttributes']);_0x55f21f[_0xc1ad('0x2e')]=_[_0xc1ad('0x2f')](_0x3a819[_0xc1ad('0x2e')]);_0x55f21f[_0xc1ad('0x30')]=_[_0xc1ad('0x31')](_0x55f21f['model'],_0x55f21f[_0xc1ad('0x2e')]);_0x3e4420[_0xc1ad('0x32')]=_[_0xc1ad('0x31')](_0x55f21f['model'],qs[_0xc1ad('0x33')](_0x3a819[_0xc1ad('0x2e')]['fields']));_0x3e4420[_0xc1ad('0x32')]=_0x3e4420[_0xc1ad('0x32')][_0xc1ad('0x42')]?_0x3e4420[_0xc1ad('0x32')]:_0x55f21f[_0xc1ad('0x2b')];if(_0x3a819[_0xc1ad('0x2e')][_0xc1ad('0x3c')]){_0x3e4420['include']=[{'all':!![]}];}_0x3e4420=_[_0xc1ad('0x3a')]({},_0x3e4420,_0x3a819[_0xc1ad('0x3b')]);return db[_0xc1ad('0x27')][_0xc1ad('0x43')](_0x3e4420)[_0xc1ad('0x21')](handleEntityNotFound(_0x170f89,null))[_0xc1ad('0x21')](respondWithResult(_0x170f89,null))[_0xc1ad('0x44')](handleError(_0x170f89,null));};exports['create']=function(_0x810042,_0x436fde){return db[_0xc1ad('0x27')]['create'](_0x810042[_0xc1ad('0x45')],{})[_0xc1ad('0x21')](respondWithResult(_0x436fde,0xc9))[_0xc1ad('0x44')](handleError(_0x436fde,null));};exports['update']=function(_0x5bb4b1,_0x3acc02){if(_0x5bb4b1[_0xc1ad('0x45')]['id']){delete _0x5bb4b1[_0xc1ad('0x45')]['id'];}return db['VoiceMailMessage'][_0xc1ad('0x43')]({'where':{'id':_0x5bb4b1[_0xc1ad('0x41')]['id']}})['then'](handleEntityNotFound(_0x3acc02,null))[_0xc1ad('0x21')](saveUpdates(_0x5bb4b1[_0xc1ad('0x45')],null))[_0xc1ad('0x21')](respondWithResult(_0x3acc02,null))[_0xc1ad('0x44')](handleError(_0x3acc02,null));};exports[_0xc1ad('0x46')]=function(_0x3e0574,_0x5e4bf4){return db[_0xc1ad('0x27')][_0xc1ad('0x43')]({'where':{'id':_0x3e0574[_0xc1ad('0x41')]['id']}})[_0xc1ad('0x21')](handleEntityNotFound(_0x5e4bf4,null))['then'](removeEntity(_0x5e4bf4,null))[_0xc1ad('0x44')](handleError(_0x5e4bf4,null));};exports[_0xc1ad('0x47')]=function(_0x4d4200,_0x35f2be,_0x4d590e){return db[_0xc1ad('0x27')]['find']({'where':{'id':_0x4d4200['params']['id']},'attributes':['id',_0xc1ad('0x48'),_0xc1ad('0x49')]})[_0xc1ad('0x21')](handleEntityNotFound(_0x35f2be,null))[_0xc1ad('0x21')](function(_0x441b2a){if(_0x441b2a){if(!_0x441b2a[_0xc1ad('0x48')]){throw new db[(_0xc1ad('0x4a'))][(_0xc1ad('0x4b'))](_0xc1ad('0x4c'));}var _0x15fdfa={'Content-Type':_0xc1ad('0x4d'),'Content-Disposition':_0xc1ad('0x4e')};if(_0x441b2a[_0xc1ad('0x49')]){_0x15fdfa['Content-Disposition']='attachment;\x20filename=\x22'+_0x441b2a[_0xc1ad('0x49')]+'.wav\x22';}_0x35f2be[_0xc1ad('0x4f')](_0x15fdfa);return _0x35f2be['send'](new Buffer(_0x441b2a[_0xc1ad('0x48')]));}})[_0xc1ad('0x44')](handleError(_0x35f2be,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 93e2164..735016d 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 _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 +var _0xa95c=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api'];(function(_0x582274,_0x2cbd9c){var _0x8f14d3=function(_0x1cfe08){while(--_0x1cfe08){_0x582274['push'](_0x582274['shift']());}};_0x8f14d3(++_0x2cbd9c);}(_0xa95c,0x14c));var _0xca95=function(_0x21e4d0,_0x1aef26){_0x21e4d0=_0x21e4d0-0x0;var _0x476d20=_0xa95c[_0x21e4d0];return _0x476d20;};'use strict';var _=require(_0xca95('0x0'));var util=require(_0xca95('0x1'));var logger=require(_0xca95('0x2'))(_0xca95('0x3'));var moment=require(_0xca95('0x4'));var BPromise=require(_0xca95('0x5'));var rp=require(_0xca95('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xca95('0x7'));var config=require(_0xca95('0x8'));var attributes=require(_0xca95('0x9'));module['exports']=function(_0x5daeb3,_0xaf447){return _0x5daeb3[_0xca95('0xa')](_0xca95('0xb'),attributes,{'tableName':_0xca95('0xc'),'paranoid':![],'indexes':[{'name':_0xca95('0xd'),'fields':[_0xca95('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index b3ff630..dd99133 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 _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 +var _0x7c88=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','message','VoiceMailMessage,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x176729,_0x1706ed){var _0x2a2e35=function(_0x514437){while(--_0x514437){_0x176729['push'](_0x176729['shift']());}};_0x2a2e35(++_0x1706ed);}(_0x7c88,0x154));var _0x87c8=function(_0x179bb0,_0x14c538){_0x179bb0=_0x179bb0-0x0;var _0x27e5ff=_0x7c88[_0x179bb0];return _0x27e5ff;};'use strict';var _=require(_0x87c8('0x0'));var util=require(_0x87c8('0x1'));var moment=require(_0x87c8('0x2'));var BPromise=require(_0x87c8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x87c8('0x4'));var db=require(_0x87c8('0x5'))['db'];var utils=require(_0x87c8('0x6'));var logger=require(_0x87c8('0x7'))(_0x87c8('0x8'));var config=require(_0x87c8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x87c8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54ef5c,_0x180ac6,_0x544664){return new BPromise(function(_0x3cd219,_0x186350){return client[_0x87c8('0xb')](_0x54ef5c,_0x544664)[_0x87c8('0xc')](function(_0x40b258){logger[_0x87c8('0xd')]('VoiceMailMessage,\x20%s,\x20%s',_0x180ac6,_0x87c8('0xe'));logger[_0x87c8('0xf')](_0x87c8('0x10'),_0x180ac6,_0x87c8('0xe'),JSON['stringify'](_0x40b258));if(_0x40b258[_0x87c8('0x11')]){if(_0x40b258[_0x87c8('0x11')][_0x87c8('0x12')]===0x1f4){logger[_0x87c8('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x180ac6,_0x40b258['error']['message']);return _0x186350(_0x40b258[_0x87c8('0x11')][_0x87c8('0x13')]);}logger[_0x87c8('0x11')](_0x87c8('0x14'),_0x180ac6,_0x40b258['error'][_0x87c8('0x13')]);return _0x3cd219(_0x40b258['error'][_0x87c8('0x13')]);}else{logger[_0x87c8('0xd')](_0x87c8('0x14'),_0x180ac6,_0x87c8('0xe'));_0x3cd219(_0x40b258[_0x87c8('0x15')][_0x87c8('0x13')]);}})[_0x87c8('0x16')](function(_0xd768f1){logger[_0x87c8('0x11')](_0x87c8('0x14'),_0x180ac6,_0xd768f1);_0x186350(_0xd768f1);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 9ee683c..ad998bf 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 _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 +var _0xbfc6=['put','/:id','update','destroy','delete','removeSound','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','show','/:id/sounds','post','create'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xbfc6,0x177));var _0x6bfc=function(_0x20e3ef,_0x5a5e35){_0x20e3ef=_0x20e3ef-0x0;var _0x5bd92b=_0xbfc6[_0x20e3ef];return _0x5bd92b;};'use strict';var multer=require(_0x6bfc('0x0'));var util=require(_0x6bfc('0x1'));var path=require(_0x6bfc('0x2'));var timeout=require(_0x6bfc('0x3'));var express=require(_0x6bfc('0x4'));var router=express[_0x6bfc('0x5')]();var fs_extra=require(_0x6bfc('0x6'));var auth=require(_0x6bfc('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6bfc('0x8'));var controller=require(_0x6bfc('0x9'));router[_0x6bfc('0xa')]('/',auth[_0x6bfc('0xb')](),controller['index']);router[_0x6bfc('0xa')]('/:id',auth[_0x6bfc('0xb')](),controller[_0x6bfc('0xc')]);router['get'](_0x6bfc('0xd'),auth[_0x6bfc('0xb')](),controller['getSounds']);router[_0x6bfc('0xe')]('/',auth[_0x6bfc('0xb')](),controller[_0x6bfc('0xf')]);router[_0x6bfc('0xe')](_0x6bfc('0xd'),auth[_0x6bfc('0xb')](),controller['addSound']);router[_0x6bfc('0x10')](_0x6bfc('0x11'),auth[_0x6bfc('0xb')](),controller[_0x6bfc('0x12')]);router['delete'](_0x6bfc('0x11'),auth['isAuthenticated'](),controller[_0x6bfc('0x13')]);router[_0x6bfc('0x14')]('/:id/sounds/:id2',auth[_0x6bfc('0xb')](),controller[_0x6bfc('0x15')]);module[_0x6bfc('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index af38760..855dfc0 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 _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 +var _0x1adc=['mp3','alpha','TIMESTAMP','BOOLEAN','exports','STRING','custom','files','mp3nb','quietmp3nb'];(function(_0x137d0c,_0x133d7e){var _0x51f5ea=function(_0x28b1e6){while(--_0x28b1e6){_0x137d0c['push'](_0x137d0c['shift']());}};_0x51f5ea(++_0x133d7e);}(_0x1adc,0x72));var _0xc1ad=function(_0x19d174,_0x37eb66){_0x19d174=_0x19d174-0x0;var _0x383dba=_0x1adc[_0x19d174];return _0x383dba;};'use strict';var Sequelize=require('sequelize');module[_0xc1ad('0x0')]={'name':{'type':Sequelize[_0xc1ad('0x1')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM'](_0xc1ad('0x2'),_0xc1ad('0x3'),_0xc1ad('0x4'),_0xc1ad('0x5'),'quietmp3',_0xc1ad('0x6')),'allowNull':!![],'defaultValue':_0xc1ad('0x3')},'directory':{'type':Sequelize[_0xc1ad('0x1')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xc1ad('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0xc1ad('0x1')],'allowNull':!![],'defaultValue':_0xc1ad('0x7')},'format':{'type':Sequelize[_0xc1ad('0x1')],'allowNull':!![]},'stamp':{'type':_0xc1ad('0x8')},'defaultEntry':{'type':Sequelize[_0xc1ad('0x9')],'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 cc75aaa..5286c84 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 _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 +var _0xf045=['MusicOnHolds','UserProfileResource','end','error','stack','index','map','VoiceMusicOnHold','fieldName','type','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','show','params','keys','options','find','catch','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','Sound','save_name','converted_format','createdAt','%s.%s','basename','symlinkSync','message','removeSound','findOne','id2','format','getSounds','order','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','get'];(function(_0x1169c5,_0x2f8cc9){var _0x4b7f30=function(_0x1c96fe){while(--_0x1c96fe){_0x1169c5['push'](_0x1169c5['shift']());}};_0x4b7f30(++_0x2f8cc9);}(_0xf045,0xbc));var _0x5f04=function(_0x4ff9c8,_0x38ac9b){_0x4ff9c8=_0x4ff9c8-0x0;var _0x3ee9c3=_0xf045[_0x4ff9c8];return _0x3ee9c3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5f04('0x0'));var zipdir=require(_0x5f04('0x1'));var jsonpatch=require(_0x5f04('0x2'));var rp=require(_0x5f04('0x3'));var moment=require('moment');var BPromise=require(_0x5f04('0x4'));var Mustache=require(_0x5f04('0x5'));var util=require('util');var path=require(_0x5f04('0x6'));var sox=require(_0x5f04('0x7'));var csv=require('to-csv');var ejs=require(_0x5f04('0x8'));var fs=require('fs');var fs_extra=require(_0x5f04('0x9'));var _=require(_0x5f04('0xa'));var squel=require(_0x5f04('0xb'));var crypto=require(_0x5f04('0xc'));var jsforce=require(_0x5f04('0xd'));var deskjs=require(_0x5f04('0xe'));var toCsv=require(_0x5f04('0xf'));var querystring=require(_0x5f04('0x10'));var Papa=require(_0x5f04('0x11'));var Redis=require(_0x5f04('0x12'));var authService=require(_0x5f04('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5f04('0x14'));var hardwareService=require(_0x5f04('0x15'));var logger=require('../../config/logger')(_0x5f04('0x16'));var utils=require(_0x5f04('0x17'));var config=require(_0x5f04('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5f04('0x19'))['db'];function respondWithStatusCode(_0x478d8e,_0x465a21){_0x465a21=_0x465a21||0xcc;return function(_0x3ed7a1){if(_0x3ed7a1){return _0x478d8e[_0x5f04('0x1a')](_0x465a21);}return _0x478d8e[_0x5f04('0x1b')](_0x465a21)['end']();};}function respondWithResult(_0xb9c5d5,_0x118f25){_0x118f25=_0x118f25||0xc8;return function(_0x3e1ae8){if(_0x3e1ae8){return _0xb9c5d5[_0x5f04('0x1b')](_0x118f25)[_0x5f04('0x1c')](_0x3e1ae8);}};}function respondWithFilteredResult(_0x534d37,_0x57fcf1){return function(_0x50dcc3){if(_0x50dcc3){var _0x178d3e=typeof _0x57fcf1[_0x5f04('0x1d')]===_0x5f04('0x1e')&&typeof _0x57fcf1['limit']==='undefined';var _0x37516b=_0x50dcc3[_0x5f04('0x1f')];var _0xfa00f9=_0x178d3e?0x0:_0x57fcf1['offset'];var _0x1dbcc3=_0x178d3e?_0x50dcc3['count']:_0x57fcf1[_0x5f04('0x1d')]+_0x57fcf1[_0x5f04('0x20')];var _0x28f387;if(_0x1dbcc3>=_0x37516b){_0x1dbcc3=_0x37516b;_0x28f387=0xc8;}else{_0x28f387=0xce;}_0x534d37[_0x5f04('0x1b')](_0x28f387);return _0x534d37[_0x5f04('0x21')](_0x5f04('0x22'),_0xfa00f9+'-'+_0x1dbcc3+'/'+_0x37516b)[_0x5f04('0x1c')](_0x50dcc3);}return null;};}function patchUpdates(_0x257415){return function(_0x322ff7){try{jsonpatch[_0x5f04('0x23')](_0x322ff7,_0x257415,!![]);}catch(_0x53edac){return BPromise[_0x5f04('0x24')](_0x53edac);}return _0x322ff7[_0x5f04('0x25')]();};}function saveUpdates(_0x2fa9f4,_0x15e959){return function(_0xaf9a3a){if(_0xaf9a3a){return _0xaf9a3a[_0x5f04('0x26')](_0x2fa9f4)['then'](function(_0x84a485){return _0x84a485;});}return null;};}function removeEntity(_0xe9d870,_0x999e86){return function(_0x310a43){if(_0x310a43){return _0x310a43[_0x5f04('0x27')]()[_0x5f04('0x28')](function(){var _0x8fe2dc=_0x310a43[_0x5f04('0x29')]({'plain':!![]});var _0x1f4637=_0x5f04('0x2a');return db[_0x5f04('0x2b')][_0x5f04('0x27')]({'where':{'type':_0x1f4637,'resourceId':_0x8fe2dc['id']}})[_0x5f04('0x28')](function(){return _0x310a43;});})[_0x5f04('0x28')](function(){_0xe9d870[_0x5f04('0x1b')](0xcc)[_0x5f04('0x2c')]();});}};}function handleEntityNotFound(_0x4154f4,_0x23d23b){return function(_0x490598){if(!_0x490598){_0x4154f4[_0x5f04('0x1a')](0x194);}return _0x490598;};}function handleError(_0x122b87,_0x1d253f){_0x1d253f=_0x1d253f||0x1f4;return function(_0x4c3490){logger[_0x5f04('0x2d')](_0x4c3490[_0x5f04('0x2e')]);if(_0x4c3490['name']){delete _0x4c3490['name'];}_0x122b87[_0x5f04('0x1b')](_0x1d253f)['send'](_0x4c3490);};}exports[_0x5f04('0x2f')]=function(_0x5e7c56,_0x427461){var _0x2dda4e={},_0x2de800={},_0xca74a6={'count':0x0,'rows':[]};var _0x32c36a=_[_0x5f04('0x30')](db[_0x5f04('0x31')]['rawAttributes'],function(_0x562b72){return{'name':_0x562b72[_0x5f04('0x32')],'type':_0x562b72[_0x5f04('0x33')]['key']};});_0x2de800['model']=_['map'](_0x32c36a,_0x5f04('0x34'));_0x2de800[_0x5f04('0x35')]=_['keys'](_0x5e7c56[_0x5f04('0x35')]);_0x2de800[_0x5f04('0x36')]=_[_0x5f04('0x37')](_0x2de800[_0x5f04('0x38')],_0x2de800[_0x5f04('0x35')]);_0x2dda4e[_0x5f04('0x39')]=_['intersection'](_0x2de800['model'],qs[_0x5f04('0x3a')](_0x5e7c56[_0x5f04('0x35')][_0x5f04('0x3a')]));_0x2dda4e[_0x5f04('0x39')]=_0x2dda4e[_0x5f04('0x39')][_0x5f04('0x3b')]?_0x2dda4e[_0x5f04('0x39')]:_0x2de800[_0x5f04('0x38')];if(!_0x5e7c56[_0x5f04('0x35')][_0x5f04('0x3c')](_0x5f04('0x3d'))){_0x2dda4e[_0x5f04('0x20')]=qs['limit'](_0x5e7c56[_0x5f04('0x35')]['limit']);_0x2dda4e[_0x5f04('0x1d')]=qs['offset'](_0x5e7c56[_0x5f04('0x35')][_0x5f04('0x1d')]);}_0x2dda4e['order']=qs[_0x5f04('0x3e')](_0x5e7c56['query'][_0x5f04('0x3e')]);delete _0x5e7c56[_0x5f04('0x35')]['sort'];_0x2dda4e['where']=qs['filters'](_[_0x5f04('0x3f')](_0x5e7c56[_0x5f04('0x35')],_0x2de800[_0x5f04('0x36')]),_0x32c36a);if(_0x5e7c56[_0x5f04('0x35')]['filter']){_0x2dda4e[_0x5f04('0x40')]=_[_0x5f04('0x41')](_0x2dda4e[_0x5f04('0x40')],{'$or':_['map'](_0x32c36a,function(_0x4ba3b3){if(_0x4ba3b3[_0x5f04('0x33')]!==_0x5f04('0x42')){var _0x52e15b={};_0x52e15b[_0x4ba3b3['name']]={'$like':'%'+_0x5e7c56[_0x5f04('0x35')][_0x5f04('0x43')]+'%'};return _0x52e15b;}})});}_0x2dda4e=_[_0x5f04('0x41')]({},_0x2dda4e,_0x5e7c56['options']);var _0xce1303={'where':_0x2dda4e[_0x5f04('0x40')]};return db[_0x5f04('0x31')][_0x5f04('0x1f')](_0xce1303)[_0x5f04('0x28')](function(_0x1f5139){_0xca74a6['count']=_0x1f5139;if(_0x5e7c56[_0x5f04('0x35')][_0x5f04('0x44')]){_0x2dda4e[_0x5f04('0x45')]=[{'all':!![]}];}return db[_0x5f04('0x31')][_0x5f04('0x46')](_0x2dda4e);})[_0x5f04('0x28')](function(_0xb9fff6){_0xca74a6['rows']=_0xb9fff6;return _0xca74a6;})[_0x5f04('0x28')](respondWithFilteredResult(_0x427461,_0x2dda4e))['catch'](handleError(_0x427461,null));};exports[_0x5f04('0x47')]=function(_0x333880,_0x59c1fc){var _0xa1ec8c={'raw':![],'where':{'id':_0x333880[_0x5f04('0x48')]['id']}},_0x2fdb88={};_0x2fdb88['model']=_[_0x5f04('0x49')](db[_0x5f04('0x31')]['rawAttributes']);_0x2fdb88[_0x5f04('0x35')]=_[_0x5f04('0x49')](_0x333880[_0x5f04('0x35')]);_0x2fdb88[_0x5f04('0x36')]=_['intersection'](_0x2fdb88['model'],_0x2fdb88[_0x5f04('0x35')]);_0xa1ec8c[_0x5f04('0x39')]=_[_0x5f04('0x37')](_0x2fdb88[_0x5f04('0x38')],qs[_0x5f04('0x3a')](_0x333880[_0x5f04('0x35')][_0x5f04('0x3a')]));_0xa1ec8c['attributes']=_0xa1ec8c['attributes'][_0x5f04('0x3b')]?_0xa1ec8c[_0x5f04('0x39')]:_0x2fdb88['model'];if(_0x333880[_0x5f04('0x35')]['includeAll']){_0xa1ec8c[_0x5f04('0x45')]=[{'all':!![]}];}_0xa1ec8c=_['merge']({},_0xa1ec8c,_0x333880[_0x5f04('0x4a')]);return db[_0x5f04('0x31')][_0x5f04('0x4b')](_0xa1ec8c)[_0x5f04('0x28')](handleEntityNotFound(_0x59c1fc,null))[_0x5f04('0x28')](respondWithResult(_0x59c1fc,null))[_0x5f04('0x4c')](handleError(_0x59c1fc,null));};exports['update']=function(_0x23be7a,_0x1f5104){if(_0x23be7a[_0x5f04('0x4d')]['id']){delete _0x23be7a[_0x5f04('0x4d')]['id'];}return db[_0x5f04('0x31')]['find']({'where':{'id':_0x23be7a[_0x5f04('0x48')]['id']}})[_0x5f04('0x28')](handleEntityNotFound(_0x1f5104,null))[_0x5f04('0x28')](saveUpdates(_0x23be7a[_0x5f04('0x4d')],null))[_0x5f04('0x28')](respondWithResult(_0x1f5104,null))[_0x5f04('0x4c')](handleError(_0x1f5104,null));};exports[_0x5f04('0x4e')]=function(_0x400f33,_0x3bec18,_0x38c944){return db[_0x5f04('0x4f')][_0x5f04('0x50')](function(_0xa2bedb){if(_0x400f33[_0x5f04('0x4d')][_0x5f04('0x51')]===_0x5f04('0x52')){_0x400f33[_0x5f04('0x4d')][_0x5f04('0x53')]=path[_0x5f04('0x54')](config[_0x5f04('0x55')],_0x5f04('0x56'),_0x400f33[_0x5f04('0x4d')][_0x5f04('0x34')]);}return db['VoiceMusicOnHold']['create'](_0x400f33[_0x5f04('0x4d')],{'transaction':_0xa2bedb})[_0x5f04('0x28')](function(_0x33fb44){if(_0x400f33[_0x5f04('0x4d')]['mode']===_0x5f04('0x52')){fs[_0x5f04('0x57')](_0x33fb44[_0x5f04('0x53')],parseInt(_0x5f04('0x58'),0x8));}var _0xd3319a=_0x400f33[_0x5f04('0x59')][_0x5f04('0x29')]({'plain':!![]});if(!_0xd3319a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd3319a[_0x5f04('0x5a')]===_0x5f04('0x59')){var _0x2f39ab=_0x33fb44[_0x5f04('0x29')]({'plain':!![]});return db[_0x5f04('0x5b')][_0x5f04('0x4b')]({'where':{'name':_0x5f04('0x2a'),'userProfileId':_0xd3319a[_0x5f04('0x5c')]},'raw':!![]})[_0x5f04('0x28')](function(_0x5696de){if(_0x5696de&&_0x5696de[_0x5f04('0x5d')]===0x0){return db['UserProfileResource'][_0x5f04('0x4e')]({'name':_0x2f39ab[_0x5f04('0x34')],'resourceId':_0x2f39ab['id'],'type':_0x5696de['name'],'sectionId':_0x5696de['id']},{})['then'](function(){return _0x33fb44;});}else{return _0x33fb44;}})['catch'](function(_0x506fb3){logger[_0x5f04('0x2d')](_0x5f04('0x5e'),_0x506fb3);});}return _0x33fb44;});})[_0x5f04('0x28')](respondWithResult(_0x3bec18,0xc9))[_0x5f04('0x4c')](handleError(_0x3bec18,null));};exports['destroy']=function(_0x5e409a,_0x14d316,_0x11d282){var _0x1ab903;return db[_0x5f04('0x31')]['find']({'where':{'id':_0x5e409a['params']['id']}})['then'](function(_0x514730){if(_0x514730){return db[_0x5f04('0x4f')][_0x5f04('0x50')](function(_0x58f88d){return _0x514730[_0x5f04('0x27')]({'transaction':_0x58f88d,'raw':!![]})['then'](function(_0x37c560){if(_0x37c560[_0x5f04('0x53')]){fs[_0x5f04('0x5f')](_0x37c560[_0x5f04('0x53')])[_0x5f04('0x60')](function(_0x17156d){fs[_0x5f04('0x61')](path[_0x5f04('0x54')](_0x37c560[_0x5f04('0x53')],_0x17156d));});fs[_0x5f04('0x62')](_0x37c560[_0x5f04('0x53')]);}return _0x37c560;});})[_0x5f04('0x4c')](function(_0x49b017){throw new db[(_0x5f04('0x63'))][(_0x5f04('0x64'))](_0x49b017['message']);});}})[_0x5f04('0x28')](handleEntityNotFound(_0x14d316,null))[_0x5f04('0x28')](removeEntity(_0x14d316,null))['catch'](handleError(_0x14d316,null));};exports['addSound']=function(_0x59850a,_0x316434,_0x56388c){return db[_0x5f04('0x4f')][_0x5f04('0x50')](function(_0x34aff4){var _0x1fb15c;return db[_0x5f04('0x31')][_0x5f04('0x4b')]({'where':{'id':_0x59850a[_0x5f04('0x48')]['id']}})['then'](function(_0x44c4e9){if(_0x44c4e9){_0x1fb15c=_0x44c4e9;return _0x44c4e9['addSound'](_0x59850a[_0x5f04('0x4d')]['id'],{'transaction':_0x34aff4});}})[_0x5f04('0x28')](function(_0x2b89a9){if(_0x2b89a9){return db[_0x5f04('0x65')]['findOne']({'where':{'id':_0x59850a[_0x5f04('0x4d')]['id']},'attributes':['id',_0x5f04('0x34'),_0x5f04('0x66'),_0x5f04('0x67'),_0x5f04('0x68')],'raw':!![]});}})[_0x5f04('0x28')](function(_0x43ab03){if(_0x43ab03){var _0x182a86=path[_0x5f04('0x54')](config['root'],'server/files/sounds/converted',util['format'](_0x5f04('0x69'),path[_0x5f04('0x6a')](_0x43ab03['save_name'],path['extname'](_0x43ab03['save_name'])),_0x43ab03['converted_format']));var _0x1953aa=path['join'](config[_0x5f04('0x55')],_0x5f04('0x56'),_0x1fb15c[_0x5f04('0x34')],util['format'](_0x5f04('0x69'),_0x43ab03[_0x5f04('0x34')],_0x43ab03[_0x5f04('0x67')]));fs[_0x5f04('0x6b')](_0x182a86,_0x1953aa);return _0x43ab03;}})['catch'](function(_0xc8d52f){throw new db[(_0x5f04('0x63'))][(_0x5f04('0x64'))](_0xc8d52f[_0x5f04('0x6c')]);});})['then'](handleEntityNotFound(_0x316434,null))['then'](respondWithResult(_0x316434,0xc9))[_0x5f04('0x4c')](handleError(_0x316434,null));};exports[_0x5f04('0x6d')]=function(_0x42555a,_0xd1d2bd,_0x5da516){return db[_0x5f04('0x4f')][_0x5f04('0x50')](function(_0x32491a){var _0x1e4cce;return db[_0x5f04('0x31')][_0x5f04('0x6e')]({'where':{'id':_0x42555a[_0x5f04('0x48')]['id']}})[_0x5f04('0x28')](handleEntityNotFound(_0xd1d2bd,null))[_0x5f04('0x28')](function(_0x53a9a4){if(_0x53a9a4){_0x1e4cce=_0x53a9a4;return _0x53a9a4['removeSound'](_0x42555a[_0x5f04('0x48')][_0x5f04('0x6f')]);}})[_0x5f04('0x28')](function(_0xf910a4){if(_0xf910a4){return db[_0x5f04('0x65')][_0x5f04('0x6e')]({'where':{'id':_0x42555a['params'][_0x5f04('0x6f')]},'attributes':['id','name',_0x5f04('0x66'),_0x5f04('0x67'),'createdAt'],'raw':!![]});}})[_0x5f04('0x28')](function(_0x29aaed){if(_0x29aaed){fs[_0x5f04('0x61')](path['join'](_0x1e4cce[_0x5f04('0x53')],util[_0x5f04('0x70')](_0x5f04('0x69'),_0x29aaed[_0x5f04('0x34')],_0x29aaed['converted_format'])));return _0x29aaed;}})[_0x5f04('0x4c')](function(_0x4593ab){throw new db[(_0x5f04('0x63'))][(_0x5f04('0x64'))](_0x4593ab[_0x5f04('0x6c')]);});})[_0x5f04('0x28')](handleEntityNotFound(_0xd1d2bd,null))[_0x5f04('0x28')](respondWithStatusCode(_0xd1d2bd,0xcc))['catch'](handleError(_0xd1d2bd,null));};exports[_0x5f04('0x71')]=function(_0x71f62f,_0x1ee114,_0x73072a){var _0x425473={};var _0x1fb0db={};var _0x409ca6;var _0x228685;return db[_0x5f04('0x31')]['findOne']({'where':{'id':_0x71f62f[_0x5f04('0x48')]['id']}})[_0x5f04('0x28')](handleEntityNotFound(_0x1ee114,null))[_0x5f04('0x28')](function(_0x3ab9a5){if(_0x3ab9a5){_0x409ca6=_0x3ab9a5;_0x1fb0db[_0x5f04('0x38')]=_[_0x5f04('0x49')](db['Sound']['rawAttributes']);_0x1fb0db[_0x5f04('0x35')]=_[_0x5f04('0x49')](_0x71f62f[_0x5f04('0x35')]);_0x1fb0db['filters']=_['intersection'](_0x1fb0db['model'],_0x1fb0db['query']);_0x425473[_0x5f04('0x39')]=_[_0x5f04('0x37')](_0x1fb0db[_0x5f04('0x38')],qs[_0x5f04('0x3a')](_0x71f62f['query'][_0x5f04('0x3a')]));_0x425473[_0x5f04('0x39')]=_0x425473[_0x5f04('0x39')][_0x5f04('0x3b')]?_0x425473[_0x5f04('0x39')]:_0x1fb0db[_0x5f04('0x38')];_0x425473[_0x5f04('0x72')]=qs[_0x5f04('0x3e')](_0x71f62f[_0x5f04('0x35')]['sort']);_0x425473[_0x5f04('0x40')]=qs[_0x5f04('0x36')](_[_0x5f04('0x3f')](_0x71f62f[_0x5f04('0x35')],_0x1fb0db['filters']));if(_0x71f62f[_0x5f04('0x35')][_0x5f04('0x43')]){_0x425473[_0x5f04('0x40')]=_[_0x5f04('0x41')](_0x425473['where'],{'$or':_[_0x5f04('0x30')](_0x425473[_0x5f04('0x39')],function(_0x24ca15){var _0x131038={};_0x131038[_0x24ca15]={'$like':'%'+_0x71f62f['query'][_0x5f04('0x43')]+'%'};return _0x131038;})});}_0x425473=_[_0x5f04('0x41')]({},_0x425473,_0x71f62f[_0x5f04('0x4a')]);return _0x409ca6[_0x5f04('0x71')](_0x425473);}})['then'](function(_0x1c345e){if(_0x1c345e){_0x228685=_0x1c345e['length'];if(!_0x71f62f[_0x5f04('0x35')][_0x5f04('0x3c')](_0x5f04('0x3d'))){_0x425473[_0x5f04('0x20')]=qs[_0x5f04('0x20')](_0x71f62f[_0x5f04('0x35')][_0x5f04('0x20')]);_0x425473['offset']=qs[_0x5f04('0x1d')](_0x71f62f[_0x5f04('0x35')]['offset']);}return _0x409ca6[_0x5f04('0x71')](_0x425473);}})[_0x5f04('0x28')](function(_0x46837b){if(_0x46837b){return _0x46837b?{'count':_0x228685,'rows':_0x46837b}:null;}})[_0x5f04('0x28')](respondWithResult(_0x1ee114,null))[_0x5f04('0x4c')](handleError(_0x1ee114,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 6cad6fa..60ce27c 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 _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 +var _0xe632=['VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','moment','rimraf','./voiceMusicOnHold.attributes'];(function(_0x4315cf,_0x5a1ac5){var _0x2913b1=function(_0x43c6ab){while(--_0x43c6ab){_0x4315cf['push'](_0x4315cf['shift']());}};_0x2913b1(++_0x5a1ac5);}(_0xe632,0x1b2));var _0x2e63=function(_0x4b1cae,_0x2a415f){_0x4b1cae=_0x4b1cae-0x0;var _0x5eb298=_0xe632[_0x4b1cae];return _0x5eb298;};'use strict';var _=require(_0x2e63('0x0'));var util=require(_0x2e63('0x1'));var logger=require(_0x2e63('0x2'))('api');var moment=require(_0x2e63('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2e63('0x4'));var config=require('../../config/environment');var attributes=require(_0x2e63('0x5'));module['exports']=function(_0xed3ca2,_0x30f098){return _0xed3ca2['define'](_0x2e63('0x6'),attributes,{'tableName':_0x2e63('0x7'),'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 1274a0c..5f9d6e9 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 _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 +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(_0x4ed1c3,_0x231957){var _0x4cb38d=function(_0x1dba62){while(--_0x1dba62){_0x4ed1c3['push'](_0x4ed1c3['shift']());}};_0x4cb38d(++_0x231957);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'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 diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index f5e9afc..dd055b4 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 _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 +var _0x059d=['put','update','destroy','delete','removeTeams','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get','describe','/:id','show','/:id/teams','getTeams','post','create','/:id/users','addAgents','addTeams'];(function(_0x24eabd,_0x258e8d){var _0x2ab3f4=function(_0x1d4e7b){while(--_0x1d4e7b){_0x24eabd['push'](_0x24eabd['shift']());}};_0x2ab3f4(++_0x258e8d);}(_0x059d,0x1b9));var _0xd059=function(_0x3ab4ff,_0x2b749a){_0x3ab4ff=_0x3ab4ff-0x0;var _0x2c08b7=_0x059d[_0x3ab4ff];return _0x2c08b7;};'use strict';var multer=require(_0xd059('0x0'));var util=require(_0xd059('0x1'));var path=require(_0xd059('0x2'));var timeout=require(_0xd059('0x3'));var express=require(_0xd059('0x4'));var router=express[_0xd059('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd059('0x6'));var interaction=require(_0xd059('0x7'));var config=require(_0xd059('0x8'));var controller=require(_0xd059('0x9'));router['get']('/',auth[_0xd059('0xa')](),controller[_0xd059('0xb')]);router[_0xd059('0xc')]('/describe',auth[_0xd059('0xa')](),controller[_0xd059('0xd')]);router[_0xd059('0xc')](_0xd059('0xe'),auth[_0xd059('0xa')](),controller[_0xd059('0xf')]);router['get']('/:id/users',auth[_0xd059('0xa')](),controller['getAgents']);router['get'](_0xd059('0x10'),auth['isAuthenticated'](),controller[_0xd059('0x11')]);router[_0xd059('0x12')]('/',auth[_0xd059('0xa')](),controller[_0xd059('0x13')]);router['post'](_0xd059('0x14'),auth[_0xd059('0xa')](),controller[_0xd059('0x15')]);router[_0xd059('0x12')](_0xd059('0x10'),auth[_0xd059('0xa')](),controller[_0xd059('0x16')]);router[_0xd059('0x17')](_0xd059('0xe'),auth[_0xd059('0xa')](),controller[_0xd059('0x18')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xd059('0x19')]);router['delete'](_0xd059('0x14'),auth[_0xd059('0xa')](),controller['removeAgents']);router[_0xd059('0x1a')]('/:id/teams',auth[_0xd059('0xa')](),controller[_0xd059('0x1b')]);module[_0xd059('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 41f0b15..5d1b15c 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 _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 +var _0xa7c2=['STRING','VIRTUAL','system-','name','INTEGER','sequelize','exports'];(function(_0x30d961,_0x1c5f90){var _0x470b0d=function(_0x9f3509){while(--_0x9f3509){_0x30d961['push'](_0x30d961['shift']());}};_0x470b0d(++_0x1c5f90);}(_0xa7c2,0x8a));var _0x2a7c=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0xa7c2[_0xa6cc5c];return _0x44803d;};'use strict';var Sequelize=require(_0x2a7c('0x0'));module[_0x2a7c('0x1')]={'name':{'type':Sequelize[_0x2a7c('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x2a7c('0x3')],'get':function(_0xeadbe7){return _0x2a7c('0x4')+this['getDataValue'](_0x2a7c('0x5'))+'-';}},'description':{'type':Sequelize[_0x2a7c('0x2')]},'callerIdAll':{'type':Sequelize[_0x2a7c('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x2a7c('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index f29c4f0..d76ed28 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 _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 +var _0x373d=['team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./voicePrefix.socket','register','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','describe','create','sequelize','transaction','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','addAgents','omit','ids','spread','emit','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','getTeams','Team','addTeams','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','userVoicePrefix:save','field','tq.TeamId','from'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x373d,0x1e2));var _0xd373=function(_0x4eb59e,_0x1b60b4){_0x4eb59e=_0x4eb59e-0x0;var _0x595d0d=_0x373d[_0x4eb59e];return _0x595d0d;};'use strict';var emlformat=require(_0xd373('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd373('0x1'));var jsonpatch=require(_0xd373('0x2'));var rp=require(_0xd373('0x3'));var moment=require(_0xd373('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd373('0x5'));var util=require(_0xd373('0x6'));var path=require(_0xd373('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd373('0x8'));var fs=require('fs');var fs_extra=require(_0xd373('0x9'));var _=require(_0xd373('0xa'));var squel=require(_0xd373('0xb'));var crypto=require('crypto');var jsforce=require(_0xd373('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd373('0xd'));var Redis=require(_0xd373('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd373('0xf'));var as=require(_0xd373('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd373('0x11'));var utils=require(_0xd373('0x12'));var config=require(_0xd373('0x13'));var licenseUtil=require(_0xd373('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xd373('0x15')],{'host':_0xd373('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd373('0x15')]));require(_0xd373('0x17'))[_0xd373('0x18')](socket);function respondWithStatusCode(_0x23ed86,_0x28b2bf){_0x28b2bf=_0x28b2bf||0xcc;return function(_0x1a9df9){if(_0x1a9df9){return _0x23ed86[_0xd373('0x19')](_0x28b2bf);}return _0x23ed86[_0xd373('0x1a')](_0x28b2bf)[_0xd373('0x1b')]();};}function respondWithResult(_0x2c5854,_0x3a5316){_0x3a5316=_0x3a5316||0xc8;return function(_0x263ae3){if(_0x263ae3){return _0x2c5854[_0xd373('0x1a')](_0x3a5316)['json'](_0x263ae3);}};}function respondWithFilteredResult(_0x1e26cf,_0x5eab00){return function(_0x460259){if(_0x460259){var _0x36d47a=typeof _0x5eab00['offset']===_0xd373('0x1c')&&typeof _0x5eab00['limit']==='undefined';var _0x23fada=_0x460259[_0xd373('0x1d')];var _0x167597=_0x36d47a?0x0:_0x5eab00[_0xd373('0x1e')];var _0x16b147=_0x36d47a?_0x460259[_0xd373('0x1d')]:_0x5eab00['offset']+_0x5eab00[_0xd373('0x1f')];var _0xd808f8;if(_0x16b147>=_0x23fada){_0x16b147=_0x23fada;_0xd808f8=0xc8;}else{_0xd808f8=0xce;}_0x1e26cf[_0xd373('0x1a')](_0xd808f8);return _0x1e26cf[_0xd373('0x20')](_0xd373('0x21'),_0x167597+'-'+_0x16b147+'/'+_0x23fada)[_0xd373('0x22')](_0x460259);}return null;};}function patchUpdates(_0x4f64bd){return function(_0x355fca){try{jsonpatch[_0xd373('0x23')](_0x355fca,_0x4f64bd,!![]);}catch(_0x157f81){return BPromise[_0xd373('0x24')](_0x157f81);}return _0x355fca[_0xd373('0x25')]();};}function saveUpdates(_0x238ffd,_0x466a03){return function(_0x109e4c){if(_0x109e4c){return _0x109e4c[_0xd373('0x26')](_0x238ffd)[_0xd373('0x27')](function(_0x437110){return _0x437110;});}return null;};}function removeEntity(_0x34f05a,_0x388182){return function(_0x420a30){if(_0x420a30){return _0x420a30[_0xd373('0x28')]()[_0xd373('0x27')](function(){var _0x50b987=_0x420a30[_0xd373('0x29')]({'plain':!![]});var _0x3e657b=_0xd373('0x2a');return db[_0xd373('0x2b')][_0xd373('0x28')]({'where':{'type':_0x3e657b,'resourceId':_0x50b987['id']}})[_0xd373('0x27')](function(){return _0x420a30;});})[_0xd373('0x27')](function(){_0x34f05a[_0xd373('0x1a')](0xcc)[_0xd373('0x1b')]();});}};}function handleEntityNotFound(_0x158825,_0xbc420b){return function(_0x2ee37c){if(!_0x2ee37c){_0x158825[_0xd373('0x19')](0x194);}return _0x2ee37c;};}function handleError(_0x5287e7,_0x7ca56e){_0x7ca56e=_0x7ca56e||0x1f4;return function(_0x490842){logger['error'](_0x490842[_0xd373('0x2c')]);if(_0x490842[_0xd373('0x2d')]){delete _0x490842[_0xd373('0x2d')];}_0x5287e7[_0xd373('0x1a')](_0x7ca56e)[_0xd373('0x2e')](_0x490842);};}exports['index']=function(_0x6659f6,_0x104156){var _0x4e17c9={},_0x102c3a={},_0x8e4884={'count':0x0,'rows':[]};var _0x146e24=_[_0xd373('0x2f')](db[_0xd373('0x30')][_0xd373('0x31')],function(_0x364c01){return{'name':_0x364c01[_0xd373('0x32')],'type':_0x364c01[_0xd373('0x33')]['key']};});_0x102c3a[_0xd373('0x34')]=_[_0xd373('0x2f')](_0x146e24,_0xd373('0x2d'));_0x102c3a[_0xd373('0x35')]=_[_0xd373('0x36')](_0x6659f6[_0xd373('0x35')]);_0x102c3a[_0xd373('0x37')]=_[_0xd373('0x38')](_0x102c3a[_0xd373('0x34')],_0x102c3a[_0xd373('0x35')]);_0x4e17c9[_0xd373('0x39')]=_[_0xd373('0x38')](_0x102c3a[_0xd373('0x34')],qs[_0xd373('0x3a')](_0x6659f6[_0xd373('0x35')]['fields']));_0x4e17c9[_0xd373('0x39')]=_0x4e17c9[_0xd373('0x39')][_0xd373('0x3b')]?_0x4e17c9[_0xd373('0x39')]:_0x102c3a['model'];if(!_0x6659f6[_0xd373('0x35')][_0xd373('0x3c')](_0xd373('0x3d'))){_0x4e17c9[_0xd373('0x1f')]=qs[_0xd373('0x1f')](_0x6659f6[_0xd373('0x35')]['limit']);_0x4e17c9['offset']=qs[_0xd373('0x1e')](_0x6659f6['query'][_0xd373('0x1e')]);}_0x4e17c9[_0xd373('0x3e')]=qs[_0xd373('0x3f')](_0x6659f6['query'][_0xd373('0x3f')]);_0x4e17c9[_0xd373('0x40')]=qs[_0xd373('0x37')](_[_0xd373('0x41')](_0x6659f6['query'],_0x102c3a['filters']),_0x146e24);if(_0x6659f6['query'][_0xd373('0x42')]){_0x4e17c9['where']=_[_0xd373('0x43')](_0x4e17c9[_0xd373('0x40')],{'$or':_['map'](_0x146e24,function(_0x4e8734){if(_0x4e8734['type']!==_0xd373('0x44')){var _0x43a4b8={};_0x43a4b8[_0x4e8734[_0xd373('0x2d')]]={'$like':'%'+_0x6659f6['query']['filter']+'%'};return _0x43a4b8;}})});}_0x4e17c9=_[_0xd373('0x43')]({},_0x4e17c9,_0x6659f6[_0xd373('0x45')]);var _0x51efee={'where':_0x4e17c9[_0xd373('0x40')]};return db[_0xd373('0x30')][_0xd373('0x1d')](_0x51efee)[_0xd373('0x27')](function(_0x2d8c7d){_0x8e4884['count']=_0x2d8c7d;if(_0x6659f6['query'][_0xd373('0x46')]){_0x4e17c9[_0xd373('0x47')]=[{'all':!![]}];}return db[_0xd373('0x30')][_0xd373('0x48')](_0x4e17c9);})['then'](function(_0x29725c){_0x8e4884['rows']=_0x29725c;return _0x8e4884;})[_0xd373('0x27')](respondWithFilteredResult(_0x104156,_0x4e17c9))[_0xd373('0x49')](handleError(_0x104156,null));};exports[_0xd373('0x4a')]=function(_0xfb2922,_0x15cd1f){var _0x54afd4={'raw':![],'where':{'id':_0xfb2922[_0xd373('0x4b')]['id']}},_0x42744d={};_0x42744d['model']=_[_0xd373('0x36')](db[_0xd373('0x30')][_0xd373('0x31')]);_0x42744d[_0xd373('0x35')]=_[_0xd373('0x36')](_0xfb2922[_0xd373('0x35')]);_0x42744d[_0xd373('0x37')]=_[_0xd373('0x38')](_0x42744d[_0xd373('0x34')],_0x42744d[_0xd373('0x35')]);_0x54afd4['attributes']=_['intersection'](_0x42744d[_0xd373('0x34')],qs['fields'](_0xfb2922[_0xd373('0x35')]['fields']));_0x54afd4['attributes']=_0x54afd4['attributes'][_0xd373('0x3b')]?_0x54afd4[_0xd373('0x39')]:_0x42744d[_0xd373('0x34')];if(_0xfb2922[_0xd373('0x35')][_0xd373('0x46')]){_0x54afd4[_0xd373('0x47')]=[{'all':!![]}];}_0x54afd4=_[_0xd373('0x43')]({},_0x54afd4,_0xfb2922['options']);return db[_0xd373('0x30')]['find'](_0x54afd4)[_0xd373('0x27')](handleEntityNotFound(_0x15cd1f,null))[_0xd373('0x27')](respondWithResult(_0x15cd1f,null))['catch'](handleError(_0x15cd1f,null));};exports[_0xd373('0x28')]=function(_0x5ca39c,_0x46a582){return db[_0xd373('0x30')][_0xd373('0x4c')]({'where':{'id':_0x5ca39c[_0xd373('0x4b')]['id']}})[_0xd373('0x27')](handleEntityNotFound(_0x46a582,null))['then'](removeEntity(_0x46a582,null))['catch'](handleError(_0x46a582,null));};exports['describe']=function(_0x3a2192,_0x384e23){return db['VoicePrefix'][_0xd373('0x4d')]()[_0xd373('0x27')](respondWithResult(_0x384e23,null))['catch'](handleError(_0x384e23,null));};exports[_0xd373('0x4e')]=function(_0xb6b583,_0x102101){var _0x473af2;return db[_0xd373('0x4f')][_0xd373('0x50')](function(_0xc255ec){return db[_0xd373('0x30')][_0xd373('0x4e')](_0xb6b583[_0xd373('0x51')],{'transaction':_0xc255ec})[_0xd373('0x27')](function(_0x5b88ea){_0x473af2=_0x5b88ea['get']({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x473af2['VoiceExtensionId']},'raw':!![]})['then'](function(_0x409246){return createVoicePrefixExtensions(_0x473af2,_0x409246,_0xc255ec);});});})[_0xd373('0x27')](function(){var _0x5b2ae9=_0xb6b583['user']['get']({'plain':!![]});if(!_0x5b2ae9)throw new Error(_0xd373('0x52'));if(_0x5b2ae9[_0xd373('0x53')]==='user'){var _0x52fa5b=_0x473af2;return db[_0xd373('0x54')][_0xd373('0x4c')]({'where':{'name':_0xd373('0x2a'),'userProfileId':_0x5b2ae9[_0xd373('0x55')]},'raw':!![]})[_0xd373('0x27')](function(_0x59da03){if(_0x59da03&&_0x59da03[_0xd373('0x56')]===0x0){return db[_0xd373('0x2b')][_0xd373('0x4e')]({'name':_0x52fa5b[_0xd373('0x2d')],'resourceId':_0x52fa5b['id'],'type':_0x59da03[_0xd373('0x2d')],'sectionId':_0x59da03['id']},{})[_0xd373('0x27')](function(){return _0x473af2;});}else{return _0x473af2;}})[_0xd373('0x49')](function(_0x2e4298){logger[_0xd373('0x57')](_0xd373('0x58'),_0x2e4298);throw _0x2e4298;});}return _0x473af2;})[_0xd373('0x27')](respondWithResult(_0x102101,null))[_0xd373('0x49')](handleError(_0x102101,null));};function Extension(_0x213b3c,_0x42e45d,_0x13f139,_0x4cb143){this[_0xd373('0x59')]=_0xd373('0x5a');this[_0xd373('0x5b')]=_0x213b3c;this['app']=_0x13f139;this[_0xd373('0x33')]='system';this[_0xd373('0x5c')]='Voice\x20Prefix\x20Extension';this[_0xd373('0x5d')]=_0x42e45d;this[_0xd373('0x5e')]=_0x4cb143;}function createVoicePrefixExtensions(_0x427f68,_0x19924a,_0x41c327){return new BPromise(function(_0x1ac620,_0xa47b76){var _0xaaf7fa=new Extension(formatPrefixName(_0x427f68[_0xd373('0x5f')]),0x1,_0xd373('0x60'),_0xd373('0x61'));_0xaaf7fa[_0xd373('0x62')]=_0x427f68['id'];return db[_0xd373('0x63')][_0xd373('0x4e')](_0xaaf7fa,{'transaction':_0x41c327})[_0xd373('0x27')](function(_0x2e7edb){var _0x1379e5=_0x2e7edb[_0xd373('0x29')]({'plain':!![]});var _0x209e76=_[_0xd373('0x2f')](addVoicePrefixExtensions(_0x427f68,_0x19924a),function(_0x295e09){_0x295e09[_0xd373('0x64')]=_0x1379e5['id'];_0x295e09[_0xd373('0x62')]=_0x427f68['id'];return _0x295e09;});return db[_0xd373('0x63')][_0xd373('0x65')](_0x209e76,{'transaction':_0x41c327})[_0xd373('0x27')](function(_0x547a8a){if(!_0x547a8a){return _0xa47b76(_0xd373('0x66'));}else{return _0x1ac620(_0x547a8a);}})[_0xd373('0x49')](function(_0x5fdc16){return _0xa47b76(_0x5fdc16);});});;});};function addVoicePrefixExtensions(_0x4a7d01,_0x38068a){var _0x2d9019=[];var _0x33320c=formatPrefixName(_0x4a7d01[_0xd373('0x5f')]);_0x2d9019[_0xd373('0x67')](new Extension(_0x33320c,0x2,_0xd373('0x68'),_0xd373('0x69')+_0x4a7d01['name']));if(_0x4a7d01[_0xd373('0x6a')]){_0x2d9019[_0xd373('0x67')](new Extension(_0x33320c,0x3,_0xd373('0x68'),_0xd373('0x6b')+_0x4a7d01[_0xd373('0x6a')]));}else{_0x2d9019[_0xd373('0x67')](new Extension(_0x33320c,0x3,_0xd373('0x60'),_0xd373('0x6c')));}_0x2d9019['push'](new Extension(_0x33320c,0x4,_0xd373('0x6d'),_0x38068a['context']+','+_0xd373('0x6e')+(0x8+_0x4a7d01[_0xd373('0x2d')][_0xd373('0x3b')])+'}'+','+0x1));return _0x2d9019;}function formatPrefixName(_0x2a9582){var _0x36e7cc='_';for(var _0x32c044=0x0;_0x32c044<_0x2a9582[_0xd373('0x3b')];_0x32c044++){if(_0x2a9582[_0xd373('0x6f')](_0x32c044)=='-'){_0x36e7cc+=_0x2a9582['charAt'](_0x32c044);}else{_0x36e7cc+='['+_0x2a9582[_0xd373('0x6f')](_0x32c044)+']';}}_0x36e7cc+='.';return _0x36e7cc;}exports['update']=function(_0x40f5ad,_0x27fcbe,_0x310a65){var _0x3ce679=_0x40f5ad[_0xd373('0x51')];_0x3ce679[_0xd373('0x5f')]=_0xd373('0x70')+_0x3ce679['name']+'-';return db[_0xd373('0x4f')][_0xd373('0x50')](function(_0x3d375d){return db['VoicePrefix'][_0xd373('0x26')](_0x3ce679,{'where':{'id':_0x3ce679['id']},'transaction':_0x3d375d})[_0xd373('0x27')](function(){return db[_0xd373('0x63')][_0xd373('0x28')]({'where':{'VoicePrefixId':_0x3ce679['id']},'transaction':_0x3d375d})[_0xd373('0x27')](function(){return db[_0xd373('0x63')][_0xd373('0x4c')]({'where':{'id':_0x3ce679[_0xd373('0x64')]},'raw':!![]})[_0xd373('0x27')](function(_0x727541){return createVoicePrefixExtensions(_0x3ce679,_0x727541,_0x3d375d);});});});})[_0xd373('0x27')](function(){return db[_0xd373('0x30')]['findById'](_0x3ce679['id']);})[_0xd373('0x27')](respondWithResult(_0x27fcbe,null))[_0xd373('0x49')](handleError(_0x27fcbe,null));};exports[_0xd373('0x71')]=function(_0x506f49,_0x377147,_0x365028){return db[_0xd373('0x30')]['find']({'where':{'id':_0x506f49[_0xd373('0x4b')]['id']}})['then'](handleEntityNotFound(_0x377147,null))[_0xd373('0x27')](function(_0x26821a){if(_0x26821a){return _0x26821a[_0xd373('0x71')](_0x506f49[_0xd373('0x51')]['ids'],_[_0xd373('0x72')](_0x506f49['body'],[_0xd373('0x73'),'id'])||{})[_0xd373('0x74')](function(_0x140ec4){for(var _0xb658db=0x0;_0xb658db<_0x506f49[_0xd373('0x51')][_0xd373('0x73')]['length'];_0xb658db+=0x1){socket[_0xd373('0x75')]('userVoicePrefix:save',{'UserId':Number(_0x506f49[_0xd373('0x51')]['ids'][_0xb658db]),'VoicePrefixId':Number(_0x506f49['params']['id'])});}return _0x140ec4;});}})[_0xd373('0x27')](respondWithResult(_0x377147,null))[_0xd373('0x49')](handleError(_0x377147,null));};exports[_0xd373('0x76')]=function(_0x32b739,_0x5a5651,_0x546a07){return db[_0xd373('0x30')][_0xd373('0x4c')]({'where':{'id':_0x32b739[_0xd373('0x4b')]['id']}})[_0xd373('0x27')](handleEntityNotFound(_0x5a5651,null))[_0xd373('0x27')](function(_0x1a30eb){if(_0x1a30eb){return _0x1a30eb[_0xd373('0x76')](_0x32b739[_0xd373('0x35')][_0xd373('0x73')])[_0xd373('0x27')](function(){if(_['isArray'](_0x32b739[_0xd373('0x35')][_0xd373('0x73')])){for(var _0x1576e5=0x0;_0x1576e5<_0x32b739[_0xd373('0x35')][_0xd373('0x73')][_0xd373('0x3b')];_0x1576e5+=0x1){socket[_0xd373('0x75')]('userVoicePrefix:remove',{'UserId':Number(_0x32b739[_0xd373('0x35')]['ids'][_0x1576e5]),'VoicePrefixId':Number(_0x32b739['params']['id'])});}}else{socket[_0xd373('0x75')](_0xd373('0x77'),{'UserId':Number(_0x32b739[_0xd373('0x35')][_0xd373('0x73')]),'VoicePrefixId':Number(_0x32b739[_0xd373('0x4b')]['id'])});}});}})[_0xd373('0x27')](respondWithStatusCode(_0x5a5651,null))['catch'](handleError(_0x5a5651,null));};exports[_0xd373('0x78')]=function(_0x19eb94,_0x6114a5,_0x52ab87){var _0x467ac8={};var _0x2c543a={};var _0x1a5666;var _0x47ae4c;return db[_0xd373('0x30')][_0xd373('0x79')]({'where':{'id':_0x19eb94[_0xd373('0x4b')]['id']}})['then'](handleEntityNotFound(_0x6114a5,null))[_0xd373('0x27')](function(_0x288295){if(_0x288295){_0x1a5666=_0x288295;_0x2c543a[_0xd373('0x34')]=_[_0xd373('0x36')](db[_0xd373('0x7a')][_0xd373('0x31')]);_0x2c543a[_0xd373('0x35')]=_[_0xd373('0x36')](_0x19eb94[_0xd373('0x35')]);_0x2c543a[_0xd373('0x37')]=_[_0xd373('0x38')](_0x2c543a[_0xd373('0x34')],_0x2c543a[_0xd373('0x35')]);_0x467ac8['attributes']=_[_0xd373('0x38')](_0x2c543a[_0xd373('0x34')],qs[_0xd373('0x3a')](_0x19eb94['query'][_0xd373('0x3a')]));_0x467ac8[_0xd373('0x39')]=_0x467ac8['attributes'][_0xd373('0x3b')]?_0x467ac8['attributes']:_0x2c543a[_0xd373('0x34')];_0x467ac8[_0xd373('0x3e')]=qs[_0xd373('0x3f')](_0x19eb94[_0xd373('0x35')][_0xd373('0x3f')]);_0x467ac8[_0xd373('0x40')]=qs['filters'](_[_0xd373('0x41')](_0x19eb94['query'],_0x2c543a[_0xd373('0x37')]));if(_0x19eb94[_0xd373('0x35')][_0xd373('0x42')]){_0x467ac8[_0xd373('0x40')]=_[_0xd373('0x43')](_0x467ac8['where'],{'$or':_[_0xd373('0x2f')](_0x467ac8[_0xd373('0x39')],function(_0x232b78){var _0x12ffc0={};_0x12ffc0[_0x232b78]={'$like':'%'+_0x19eb94[_0xd373('0x35')][_0xd373('0x42')]+'%'};return _0x12ffc0;})});}_0x467ac8=_['merge']({},_0x467ac8,_0x19eb94[_0xd373('0x45')]);return _0x1a5666[_0xd373('0x78')](_0x467ac8);}})[_0xd373('0x27')](function(_0x4b32b6){if(_0x4b32b6){_0x47ae4c=_0x4b32b6[_0xd373('0x3b')];if(!_0x19eb94[_0xd373('0x35')]['hasOwnProperty'](_0xd373('0x3d'))){_0x467ac8['limit']=qs[_0xd373('0x1f')](_0x19eb94['query']['limit']);_0x467ac8[_0xd373('0x1e')]=qs[_0xd373('0x1e')](_0x19eb94[_0xd373('0x35')][_0xd373('0x1e')]);}return _0x1a5666[_0xd373('0x78')](_0x467ac8);}})['then'](function(_0x3ae4c8){if(_0x3ae4c8){return _0x3ae4c8?{'count':_0x47ae4c,'rows':_0x3ae4c8}:null;}})['then'](respondWithResult(_0x6114a5,null))[_0xd373('0x49')](handleError(_0x6114a5,null));};exports[_0xd373('0x7b')]=function(_0xc8f4e6,_0x5c951e,_0x113671){var _0x5621d8={};var _0x30549e={};var _0x633ba0;var _0xa854a2;return db[_0xd373('0x30')][_0xd373('0x79')]({'where':{'id':_0xc8f4e6['params']['id']}})[_0xd373('0x27')](handleEntityNotFound(_0x5c951e,null))[_0xd373('0x27')](function(_0x39327f){if(_0x39327f){_0x633ba0=_0x39327f;_0x30549e[_0xd373('0x34')]=_[_0xd373('0x36')](db[_0xd373('0x7c')][_0xd373('0x31')]);_0x30549e['query']=_[_0xd373('0x36')](_0xc8f4e6[_0xd373('0x35')]);_0x30549e[_0xd373('0x37')]=_[_0xd373('0x38')](_0x30549e[_0xd373('0x34')],_0x30549e[_0xd373('0x35')]);_0x5621d8[_0xd373('0x39')]=_[_0xd373('0x38')](_0x30549e[_0xd373('0x34')],qs[_0xd373('0x3a')](_0xc8f4e6[_0xd373('0x35')][_0xd373('0x3a')]));_0x5621d8[_0xd373('0x39')]=_0x5621d8[_0xd373('0x39')][_0xd373('0x3b')]?_0x5621d8[_0xd373('0x39')]:_0x30549e[_0xd373('0x34')];_0x5621d8['order']=qs[_0xd373('0x3f')](_0xc8f4e6[_0xd373('0x35')]['sort']);_0x5621d8['where']=qs[_0xd373('0x37')](_[_0xd373('0x41')](_0xc8f4e6['query'],_0x30549e[_0xd373('0x37')]));if(_0xc8f4e6[_0xd373('0x35')][_0xd373('0x42')]){_0x5621d8[_0xd373('0x40')]=_[_0xd373('0x43')](_0x5621d8[_0xd373('0x40')],{'$or':_[_0xd373('0x2f')](_0x5621d8[_0xd373('0x39')],function(_0x3cc904){var _0x6e6c7e={};_0x6e6c7e[_0x3cc904]={'$like':'%'+_0xc8f4e6[_0xd373('0x35')]['filter']+'%'};return _0x6e6c7e;})});}_0x5621d8=_['merge']({},_0x5621d8,_0xc8f4e6[_0xd373('0x45')]);return _0x633ba0[_0xd373('0x7b')](_0x5621d8);}})['then'](function(_0x3785b7){if(_0x3785b7){_0xa854a2=_0x3785b7[_0xd373('0x3b')];if(!_0xc8f4e6[_0xd373('0x35')][_0xd373('0x3c')](_0xd373('0x3d'))){_0x5621d8[_0xd373('0x1f')]=qs['limit'](_0xc8f4e6[_0xd373('0x35')][_0xd373('0x1f')]);_0x5621d8[_0xd373('0x1e')]=qs['offset'](_0xc8f4e6[_0xd373('0x35')][_0xd373('0x1e')]);}return _0x633ba0[_0xd373('0x7b')](_0x5621d8);}})['then'](function(_0x6463cd){if(_0x6463cd){return _0x6463cd?{'count':_0xa854a2,'rows':_0x6463cd}:null;}})[_0xd373('0x27')](respondWithResult(_0x5c951e,null))['catch'](handleError(_0x5c951e,null));};exports[_0xd373('0x7d')]=function(_0x2da0cd,_0x48624a,_0x316348){var _0x48ee3b=_0x2da0cd[_0xd373('0x51')][_0xd373('0x73')];var _0x3b6ba5;return db['Team']['findAll']({'where':{'id':_0x48ee3b},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd373('0x7e'),'attributes':['id','name',_0xd373('0x7f'),_0xd373('0x80'),'interface'],'raw':!![]}]})[_0xd373('0x27')](function(_0x5be460){if(_0x5be460){_0x3b6ba5=_0x5be460;var _0x449d06=_[_0xd373('0x81')](_0x5be460,function(_0x15eb3d){var _0x1031eb=_0x15eb3d[_0xd373('0x29')]({'plain':!![]});return _0x1031eb[_0xd373('0x7e')];});return db['VoicePrefix'][_0xd373('0x4c')]({'where':{'id':_0x2da0cd['params']['id']}})[_0xd373('0x27')](function(_0x41faec){return db[_0xd373('0x4f')][_0xd373('0x50')](function(_0x39606d){return _0x41faec[_0xd373('0x7d')](_0x48ee3b,{'transaction':_0x39606d})['then'](function(){return BPromise[_0xd373('0x82')](_0x3b6ba5,function(_0x424a53){return db[_0xd373('0x83')]['upsert']({'TeamId':_0x424a53['id'],'VoicePrefixId':_0x2da0cd[_0xd373('0x4b')]['id']},{'transaction':_0x39606d});});})[_0xd373('0x27')](function(){return BPromise[_0xd373('0x82')](_0x449d06,function(_0x2f1dc0){return db[_0xd373('0x84')][_0xd373('0x85')]({'where':{'UserId':_0x2f1dc0['id'],'VoicePrefixId':_0x2da0cd['params']['id']},'transaction':_0x39606d});});})[_0xd373('0x27')](function(){_0x449d06['forEach'](function(_0x447ea9){socket[_0xd373('0x75')](_0xd373('0x86'),{'UserId':_0x447ea9['id'],'VoicePrefixId':_0x41faec['id']});});});});});}})[_0xd373('0x27')](respondWithStatusCode(_0x48624a,null))['catch'](handleError(_0x48624a,null));};exports['removeTeams']=function(_0x22e0bd,_0x44fbef,_0x3c9e20){return db[_0xd373('0x7c')][_0xd373('0x48')]({'where':{'id':_0x22e0bd[_0xd373('0x35')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd373('0x7a')],'as':_0xd373('0x7e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x44fbef,null))[_0xd373('0x27')](function(_0x2225b2){var _0x2d5326=_['map'](_0x2225b2,'id');var _0x259610=[];var _0x747622=[];var _0x5233a2=squel['select']();_0x5233a2[_0xd373('0x87')](_0xd373('0x88'))[_0xd373('0x89')](_0xd373('0x8a'),'tq')[_0xd373('0x8b')](_0xd373('0x8c'),'ut',_0xd373('0x8d'))['where'](_0xd373('0x8e'),_0x22e0bd[_0xd373('0x4b')]['id']);for(var _0x11e4a9=0x0;_0x11e4a9<_0x2225b2[_0xd373('0x3b')];_0x11e4a9+=0x1){let _0x7b49b6=_0x2225b2[_0x11e4a9];for(var _0x4d9ab3=0x0;_0x4d9ab3<_0x7b49b6[_0xd373('0x7e')][_0xd373('0x3b')];_0x4d9ab3+=0x1){let _0x4c924d=_0x7b49b6[_0xd373('0x7e')][_0x4d9ab3];var _0x494de8=_0x5233a2[_0xd373('0x8f')]();_0x494de8[_0xd373('0x40')](_0xd373('0x90'),_0x4c924d['id']);_0x747622[_0xd373('0x67')](db[_0xd373('0x4f')][_0xd373('0x35')](_0x494de8[_0xd373('0x91')](),{'type':db[_0xd373('0x4f')]['QueryTypes'][_0xd373('0x92')]})[_0xd373('0x27')](function(_0x13b085){if(_0x13b085[_0xd373('0x3b')]===0x1){return _0x4c924d['id'];}else{var _0x392bd2=_[_0xd373('0x93')](_['map'](_0x13b085,_0xd373('0x94')),function(_0x10ac87){return _[_0xd373('0x95')](_0x2d5326,_0x10ac87);});if(_0x392bd2){return _0x4c924d['id'];}}}));}}return BPromise[_0xd373('0x96')](_0x747622)[_0xd373('0x27')](function(_0x20fa2e){_0x259610=_(_0x259610)[_0xd373('0x97')](_0x20fa2e)[_0xd373('0x98')]()[_0xd373('0x99')]();return db['VoicePrefix'][_0xd373('0x4c')]({'where':{'id':_0x22e0bd[_0xd373('0x4b')]['id']}})[_0xd373('0x27')](function(_0x536c81){return db[_0xd373('0x4f')]['transaction'](function(_0x4ca4f9){return _0x536c81[_0xd373('0x9a')](_0x22e0bd['query'][_0xd373('0x73')],{'transaction':_0x4ca4f9})['then'](function(){if(!_['isEmpty'](_0x259610)){return _0x536c81['removeAgents'](_0x259610,{'transaction':_0x4ca4f9});}})['then'](function(){_0x259610['forEach'](function(_0x1de658){socket[_0xd373('0x75')](_0xd373('0x77'),{'UserId':_0x1de658,'VoicePrefixId':_0x536c81['id']});});});});});});})[_0xd373('0x27')](respondWithStatusCode(_0x44fbef,null))['catch'](handleError(_0x44fbef,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 9c7ec87..f575078 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 _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 +var _0x5b47=['hasOwnProperty','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save','remove','emit'];(function(_0x5905d3,_0xf3d13){var _0x236b29=function(_0x496ae3){while(--_0x496ae3){_0x5905d3['push'](_0x5905d3['shift']());}};_0x236b29(++_0xf3d13);}(_0x5b47,0x1a0));var _0x75b4=function(_0x44a678,_0x515562){_0x44a678=_0x44a678-0x0;var _0x41fe2a=_0x5b47[_0x44a678];return _0x41fe2a;};'use strict';var EventEmitter=require(_0x75b4('0x0'));var VoicePrefix=require(_0x75b4('0x1'))['db'][_0x75b4('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x75b4('0x3')](0x0);var events={'afterCreate':_0x75b4('0x4'),'afterUpdate':'update','afterDestroy':_0x75b4('0x5')};function emitEvent(_0x3bbd0d){return function(_0x10831c,_0x2a9a53,_0x1685d0){VoicePrefixEvents[_0x75b4('0x6')](_0x3bbd0d+':'+_0x10831c['id'],_0x10831c);VoicePrefixEvents['emit'](_0x3bbd0d,_0x10831c);_0x1685d0(null);};}for(var e in events){if(events[_0x75b4('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x75b4('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 72ea81a..a7d3312 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 _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 +var _0x7ba9=['voice_prefixes','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix'];(function(_0x5831c1,_0xdd9935){var _0x3d0e97=function(_0x39ddb7){while(--_0x39ddb7){_0x5831c1['push'](_0x5831c1['shift']());}};_0x3d0e97(++_0xdd9935);}(_0x7ba9,0x15f));var _0x97ba=function(_0xee2e7a,_0x58354d){_0xee2e7a=_0xee2e7a-0x0;var _0x319dd3=_0x7ba9[_0xee2e7a];return _0x319dd3;};'use strict';var _=require(_0x97ba('0x0'));var util=require('util');var logger=require(_0x97ba('0x1'))(_0x97ba('0x2'));var moment=require(_0x97ba('0x3'));var BPromise=require(_0x97ba('0x4'));var rp=require(_0x97ba('0x5'));var fs=require('fs');var path=require(_0x97ba('0x6'));var rimraf=require(_0x97ba('0x7'));var config=require(_0x97ba('0x8'));var attributes=require(_0x97ba('0x9'));module[_0x97ba('0xa')]=function(_0x2d7a71,_0x7b0596){return _0x2d7a71[_0x97ba('0xb')](_0x97ba('0xc'),attributes,{'tableName':_0x97ba('0xd'),'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 cde7bf8..bf6ce14 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 _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 +var _0xd47f=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./voicePrefix.socket','register','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xd47f,0x1bd));var _0xfd47=function(_0x26d741,_0x18409b){_0x26d741=_0x26d741-0x0;var _0x564540=_0xd47f[_0x26d741];return _0x564540;};'use strict';var _=require(_0xfd47('0x0'));var util=require('util');var moment=require(_0xfd47('0x1'));var BPromise=require(_0xfd47('0x2'));var rs=require(_0xfd47('0x3'));var fs=require('fs');var Redis=require(_0xfd47('0x4'));var db=require(_0xfd47('0x5'))['db'];var utils=require(_0xfd47('0x6'));var logger=require(_0xfd47('0x7'))(_0xfd47('0x8'));var config=require(_0xfd47('0x9'));var jayson=require(_0xfd47('0xa'));var client=jayson[_0xfd47('0xb')][_0xfd47('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0xfd47('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfd47('0xe'))[_0xfd47('0xf')](socket);function respondWithRpcPromise(_0x180808,_0x2bd687,_0x3a174a){return new BPromise(function(_0x2cb7c2,_0x5a6644){return client['request'](_0x180808,_0x3a174a)[_0xfd47('0x10')](function(_0x5e5ad4){logger['info'](_0xfd47('0x11'),_0x2bd687,'request\x20sent');logger['debug']('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x2bd687,_0xfd47('0x12'),JSON['stringify'](_0x5e5ad4));if(_0x5e5ad4[_0xfd47('0x13')]){if(_0x5e5ad4[_0xfd47('0x13')][_0xfd47('0x14')]===0x1f4){logger['error'](_0xfd47('0x11'),_0x2bd687,_0x5e5ad4[_0xfd47('0x13')][_0xfd47('0x15')]);return _0x5a6644(_0x5e5ad4[_0xfd47('0x13')]['message']);}logger[_0xfd47('0x13')](_0xfd47('0x11'),_0x2bd687,_0x5e5ad4[_0xfd47('0x13')]['message']);return _0x2cb7c2(_0x5e5ad4['error'][_0xfd47('0x15')]);}else{logger[_0xfd47('0x16')](_0xfd47('0x11'),_0x2bd687,_0xfd47('0x12'));_0x2cb7c2(_0x5e5ad4[_0xfd47('0x17')]['message']);}})[_0xfd47('0x18')](function(_0x471472){logger[_0xfd47('0x13')](_0xfd47('0x11'),_0x2bd687,_0x471472);_0x5a6644(_0x471472);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index b504f96..7ba8551 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 _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 +var _0xd816=['update','emit','removeListener','./voicePrefix.events','save'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xd816,0xd5));var _0x6d81=function(_0x22fad0,_0x5857fb){_0x22fad0=_0x22fad0-0x0;var _0x90db33=_0xd816[_0x22fad0];return _0x90db33;};'use strict';var VoicePrefixEvents=require(_0x6d81('0x0'));var events=[_0x6d81('0x1'),'remove',_0x6d81('0x2')];function createListener(_0x538e21,_0x540f68){return function(_0x5d99e4){_0x540f68[_0x6d81('0x3')](_0x538e21,_0x5d99e4);};}function removeListener(_0x39a52f,_0x3511a2){return function(){VoicePrefixEvents[_0x6d81('0x4')](_0x39a52f,_0x3511a2);};}exports['register']=function(_0x6c01ef){for(var _0x4ba95f=0x0,_0x10f1a7=events['length'];_0x4ba95f<_0x10f1a7;_0x4ba95f++){var _0x96d1ac=events[_0x4ba95f];var _0x15d634=createListener('voicePrefix:'+_0x96d1ac,_0x6c01ef);VoicePrefixEvents['on'](_0x96d1ac,_0x15d634);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index d01a599..e3426d9 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_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 +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(_0x578835,_0x4e291d){var _0x4a627f=function(_0xaf7a1c){while(--_0xaf7a1c){_0x578835['push'](_0x578835['shift']());}};_0x4a627f(++_0x4e291d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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 c0f5698..792f810 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 _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 +var _0x83f6=['Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','UNSIGNED','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\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)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','getDataValue','dialMethod','strategy','preview','includes','INTEGER','yes','all','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','progressive','power'];(function(_0x4adf06,_0x23beb5){var _0x42d1eb=function(_0x371bb6){while(--_0x371bb6){_0x4adf06['push'](_0x4adf06['shift']());}};_0x42d1eb(++_0x23beb5);}(_0x83f6,0x1e2));var _0x683f=function(_0x31e5cb,_0x2f5adf){_0x31e5cb=_0x31e5cb-0x0;var _0x4170df=_0x83f6[_0x31e5cb];return _0x4170df;};'use strict';var Sequelize=require(_0x683f('0x0'));module[_0x683f('0x1')]={'name':{'type':Sequelize[_0x683f('0x2')],'allowNull':![],'unique':_0x683f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x683f('0x4')](_0x683f('0x5'),_0x683f('0x6')),'allowNull':![],'defaultValue':_0x683f('0x5')},'musiconhold':{'type':Sequelize[_0x683f('0x2')],'defaultValue':_0x683f('0x7')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x683f('0x4')]('rr',_0x683f('0x8'),_0x683f('0x9'),_0x683f('0xa'),_0x683f('0xb'),_0x683f('0xc'),_0x683f('0xd'),_0x683f('0xe'),_0x683f('0xf')),'allowNull':![],'defaultValue':_0x683f('0x8'),'set':function(_0x5ff16d){this[_0x683f('0x10')]('strategy',_0x5ff16d?_0x5ff16d:_0x683f('0xc'));},'get':function(){var _0x506f1e=this[_0x683f('0x11')]('type');var _0x4bcd22=this[_0x683f('0x11')](_0x683f('0x12'));var _0x31044d=this[_0x683f('0x11')](_0x683f('0x13'));if(_0x506f1e===_0x683f('0x6')){if(_0x4bcd22===_0x683f('0x14')){return null;}if(_0x4bcd22==='booked'&&![_0x683f('0xc'),'roundrobin'][_0x683f('0x15')](_0x31044d)){this[_0x683f('0x10')]('strategy',_0x683f('0xc'));}}return _0x31044d;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x683f('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x683f('0x16')](0xb)},'timeout':{'type':Sequelize[_0x683f('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x683f('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x683f('0x2')]},'weight':{'type':Sequelize[_0x683f('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x683f('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x683f('0x4')](_0x683f('0x17'),'no'),'defaultValue':_0x683f('0x17')},'autopause':{'type':Sequelize[_0x683f('0x4')](_0x683f('0x17'),'no',_0x683f('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x683f('0x4')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x683f('0x4')](_0x683f('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x683f('0x4')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x683f('0x4')](_0x683f('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x683f('0x4')](_0x683f('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x683f('0x4')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x683f('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x683f('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x683f('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x683f('0x4')](_0x683f('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x683f('0x4')]('yes','no'),'defaultValue':_0x683f('0x17')},'announce_holdtime':{'type':Sequelize[_0x683f('0x4')](_0x683f('0x17'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x683f('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x683f('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x683f('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x683f('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x683f('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x683f('0x2')]},'queue_youarenext':{'type':Sequelize[_0x683f('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x683f('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x683f('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x683f('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x683f('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x683f('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x683f('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x683f('0x2')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x683f('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x683f('0x2')]},'queue_less_than':{'type':Sequelize[_0x683f('0x2')]},'periodic_announce':{'type':Sequelize[_0x683f('0x19')],'set':function(_0xf8ca8){this[_0x683f('0x10')](_0x683f('0x1a'),_0xf8ca8?_0xf8ca8[_0x683f('0x1b')](','):[]);},'get':function(){return this[_0x683f('0x11')](_0x683f('0x1a'))?this[_0x683f('0x11')](_0x683f('0x1a'))[_0x683f('0x1c')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x683f('0x17'),'set':function(_0x2b67d1){this[_0x683f('0x10')](_0x683f('0x1d'),_0x2b67d1?_0x2b67d1[_0x683f('0x1b')](','):undefined);},'get':function(){return this[_0x683f('0x11')](_0x683f('0x1d'))?this[_0x683f('0x11')](_0x683f('0x1d'))[_0x683f('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x683f('0x2')],'defaultValue':'no','set':function(_0xc26bbf){this[_0x683f('0x10')](_0x683f('0x1e'),_0xc26bbf?_0xc26bbf[_0x683f('0x1b')](','):undefined);},'get':function(){return this[_0x683f('0x11')]('leavewhenempty')?this[_0x683f('0x11')](_0x683f('0x1e'))[_0x683f('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x683f('0x4')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x683f('0x4')](_0x683f('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x683f('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x683f('0x4')](_0x683f('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x683f('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x683f('0x1f')],'defaultValue':0x0,'set':function(_0x1edbc6){this[_0x683f('0x10')]('acw',_0x1edbc6);if(_0x1edbc6){if(this[_0x683f('0x11')](_0x683f('0x20'))<0x2){this[_0x683f('0x10')](_0x683f('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x683f('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x683f('0x1f')],'defaultValue':0x0,'comment':_0x683f('0x21')},'dialMethod':{'type':Sequelize[_0x683f('0x4')](_0x683f('0x14'),_0x683f('0x22'),_0x683f('0x23'),'predictive','booked'),'defaultValue':'progressive','comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x683f('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x683f('0x24')},'dialLimitQueue':{'type':Sequelize[_0x683f('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x683f('0x25')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x683f('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x683f('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x683f('0x4')]('agentBusyFactor','dropRate'),'defaultValue':_0x683f('0x28'),'comment':_0x683f('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x683f('0x2a')](0x2)[_0x683f('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x683f('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0x683f('0x16')](0x3)[_0x683f('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x683f('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x683f('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x683f('0x16')](0x3)[_0x683f('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':'tTxX','comment':_0x683f('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x683f('0x16')](0x3)[_0x683f('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x683f('0x2d')},'dialCongestionMaxRetry':{'type':Sequelize[_0x683f('0x16')](0x3)[_0x683f('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x683f('0x2e')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x683f('0x16')](0x5)[_0x683f('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x683f('0x16')](0x3)[_0x683f('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x683f('0x16')](0x5)[_0x683f('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x683f('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x683f('0x2f')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x683f('0x16')](0x5)[_0x683f('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x683f('0x30')},'dialGlobalMaxRetry':{'type':Sequelize[_0x683f('0x16')](0x3)[_0x683f('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x683f('0x31')},'dialTimezone':{'type':Sequelize[_0x683f('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x683f('0x2')],'defaultValue':_0x683f('0x32')},'dialPrefix':{'type':Sequelize[_0x683f('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x683f('0x4')](_0x683f('0x33'),_0x683f('0x34'),_0x683f('0x35')),'defaultValue':_0x683f('0x33')},'dialAMDActive':{'type':Sequelize[_0x683f('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x683f('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x683f('0x36')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x683f('0x37')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x683f('0x16')](0x9)[_0x683f('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x683f('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x683f('0x38')},'dialAMDMinWordLength':{'type':Sequelize[_0x683f('0x16')](0x9)[_0x683f('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x683f('0x39')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x683f('0x16')](0x9)[_0x683f('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x683f('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x683f('0x3a')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x683f('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x683f('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x683f('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x683f('0x3c')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x683f('0x4')](_0x683f('0x3d'),_0x683f('0x3e')),'defaultValue':_0x683f('0x3d')},'dialQueueProject2':{'type':Sequelize[_0x683f('0x2')],'comment':_0x683f('0x2d')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x683f('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x683f('0x3f')},'dialCutDigit':{'type':Sequelize[_0x683f('0x16')](0x3)[_0x683f('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x683f('0x40')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x683f('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x683f('0x16')](0x5)[_0x683f('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x683f('0x41')},'dialDropMaxRetry':{'type':Sequelize[_0x683f('0x16')](0x3)[_0x683f('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x683f('0x16')](0x5)[_0x683f('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x683f('0x42')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x683f('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x683f('0x43')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x683f('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x683f('0x44')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x683f('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x683f('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x683f('0x45')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x683f('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x683f('0x46')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x683f('0x16')](0x5)[_0x683f('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x683f('0x47')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x683f('0x48')},'mandatoryDisposition':{'type':Sequelize[_0x683f('0x1f')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4eb8e4){if(!_0x4eb8e4)this[_0x683f('0x10')](_0x683f('0x49'),null);this[_0x683f('0x10')]('mandatoryDisposition',_0x4eb8e4);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x683f('0x16')](0x3)[_0x683f('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x683f('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x683f('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x683f('0x16')](0x3)[_0x683f('0x26')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x683f('0x1f')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index c2512cd..c68b8f2 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(_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 +var _0x8ef6=['select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','into','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','VoiceQueues','inbound','outbound','ignore','map','value','find','type','name','UserProfileResource','error','stack','send','index','VoiceQueue','rawAttributes','getOptions','include','query','findAll','rows','catch','show','model','keys','intersection','attributes','fields','length','merge','options','create','body','user','get','role','QueueCampaigns','UserProfileSection','userProfileId','clone','includeAll','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getHoppers','findOne','CmHopper','filters','hasOwnProperty','order','sort','where','pick','filter','getHopperHistories','CmHopperHistory','nolimit','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids'];(function(_0x804fc5,_0x3e8af6){var _0x4855d8=function(_0x993918){while(--_0x993918){_0x804fc5['push'](_0x804fc5['shift']());}};_0x4855d8(++_0x3e8af6);}(_0x8ef6,0xf2));var _0x68ef=function(_0x52a6df,_0x45b0a5){_0x52a6df=_0x52a6df-0x0;var _0x536f67=_0x8ef6[_0x52a6df];return _0x536f67;};'use strict';var moment=require(_0x68ef('0x0'));var BPromise=require(_0x68ef('0x1'));var util=require(_0x68ef('0x2'));var _=require(_0x68ef('0x3'));var squel=require(_0x68ef('0x4'));var Redis=require(_0x68ef('0x5'));var qs=require(_0x68ef('0x6'));var logger=require('../../config/logger')(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var db=require(_0x68ef('0x9'))['db'];config[_0x68ef('0xa')]=_['defaults'](config['redis'],{'host':_0x68ef('0xb'),'port':0x18eb});var socket=require(_0x68ef('0xc'))(new Redis(config[_0x68ef('0xa')]));require('./voiceQueue.socket')[_0x68ef('0xd')](socket);function respondWithStatusCode(_0x31007e,_0x1bee73){_0x1bee73=_0x1bee73||0xcc;return function(_0x22ae26){if(_0x22ae26){return _0x31007e[_0x68ef('0xe')](_0x1bee73);}return _0x31007e[_0x68ef('0xf')](_0x1bee73)[_0x68ef('0x10')]();};}function respondWithResult(_0x23da00,_0x1f6747){_0x1f6747=_0x1f6747||0xc8;return function(_0x255c85){if(_0x255c85){return _0x23da00[_0x68ef('0xf')](_0x1f6747)[_0x68ef('0x11')](_0x255c85);}};}function respondWithFilteredResult(_0x582a79,_0x1aa045){return function(_0x46356f){if(_0x46356f){var _0x1e117a=typeof _0x1aa045[_0x68ef('0x12')]===_0x68ef('0x13')&&typeof _0x1aa045[_0x68ef('0x14')]==='undefined';var _0x3b48dd=_0x46356f[_0x68ef('0x15')];var _0x2657c5=_0x1e117a?0x0:_0x1aa045['offset'];var _0x22fe96=_0x1e117a?_0x46356f[_0x68ef('0x15')]:_0x1aa045[_0x68ef('0x12')]+_0x1aa045['limit'];var _0x35493d;if(_0x22fe96>=_0x3b48dd){_0x22fe96=_0x3b48dd;_0x35493d=0xc8;}else{_0x35493d=0xce;}_0x582a79[_0x68ef('0xf')](_0x35493d);return _0x582a79[_0x68ef('0x16')](_0x68ef('0x17'),_0x2657c5+'-'+_0x22fe96+'/'+_0x3b48dd)['json'](_0x46356f);}return null;};}function saveUpdates(_0x2ada1c){return function(_0x54139e){if(_0x54139e){return _0x54139e['update'](_0x2ada1c)[_0x68ef('0x18')](function(_0x404870){return _0x404870;});}return null;};}function removeEntity(_0x4ade0d){return function(_0x527870){if(_0x527870){return _0x527870[_0x68ef('0x19')]()[_0x68ef('0x18')](function(){var _0x318514=_0x527870['get']({'plain':!![]});var _0x1dc49c=[{'name':_0x68ef('0x1a'),'value':_0x68ef('0x1b'),'ignore':![]},{'name':'QueueCampaigns','value':_0x68ef('0x1c'),'ignore':![]}];var _0x3be4c0=_(_0x1dc49c)['filter'](_0x68ef('0x1d'))[_0x68ef('0x1e')](_0x68ef('0x1f'))['value']();if(_['includes'](_0x3be4c0,_0x318514['type'])){return;}var _0x26018d=_[_0x68ef('0x20')](_0x1dc49c,[_0x68ef('0x1f'),_0x318514[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x23')][_0x68ef('0x19')]({'where':{'type':_0x26018d,'resourceId':_0x318514['id']}})[_0x68ef('0x18')](function(){return _0x527870;});})[_0x68ef('0x18')](function(){_0x4ade0d[_0x68ef('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x178460){return function(_0x57f9ee){if(!_0x57f9ee){_0x178460['sendStatus'](0x194);}return _0x57f9ee;};}function handleError(_0x55d8b0,_0x1a7ce1){_0x1a7ce1=_0x1a7ce1||0x1f4;return function(_0x268f32){logger[_0x68ef('0x24')](_0x268f32[_0x68ef('0x25')]);if(_0x268f32['name']){delete _0x268f32['name'];}_0x55d8b0[_0x68ef('0xf')](_0x1a7ce1)[_0x68ef('0x26')](_0x268f32);};}exports[_0x68ef('0x27')]=function(_0x263b30,_0x22ef25){var _0x201884={};var _0x26288a={'count':0x0,'rows':[]};var _0x4579cb=_['map'](db[_0x68ef('0x28')][_0x68ef('0x29')],function(_0x132d9e){return{'name':_0x132d9e['fieldName'],'type':_0x132d9e[_0x68ef('0x21')]['key']};});_0x201884=qs[_0x68ef('0x2a')](_0x4579cb,_0x263b30);var _0x17588a={'where':_0x201884['where']};return db['VoiceQueue'][_0x68ef('0x15')](_0x17588a)[_0x68ef('0x18')](function(_0x4b8fc8){_0x26288a[_0x68ef('0x15')]=_0x4b8fc8;_0x201884[_0x68ef('0x2b')]=qs[_0x68ef('0x2b')](_0x263b30[_0x68ef('0x2c')]);return db['VoiceQueue'][_0x68ef('0x2d')](_0x201884);})[_0x68ef('0x18')](function(_0x5f137b){_0x26288a[_0x68ef('0x2e')]=_0x5f137b;return _0x26288a;})['then'](respondWithFilteredResult(_0x22ef25,_0x201884))[_0x68ef('0x2f')](handleError(_0x22ef25,null));};exports[_0x68ef('0x30')]=function(_0x4973c2,_0x24c2c9){var _0x4a0763={'raw':![],'where':{'id':_0x4973c2['params']['id']}},_0x38c2f8={};_0x38c2f8[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x28')]['rawAttributes']);_0x38c2f8[_0x68ef('0x2c')]=_['keys'](_0x4973c2[_0x68ef('0x2c')]);_0x38c2f8['filters']=_[_0x68ef('0x33')](_0x38c2f8[_0x68ef('0x31')],_0x38c2f8[_0x68ef('0x2c')]);_0x4a0763[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x38c2f8[_0x68ef('0x31')],qs['fields'](_0x4973c2[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4a0763[_0x68ef('0x34')]=_0x4a0763['attributes'][_0x68ef('0x36')]?_0x4a0763[_0x68ef('0x34')]:_0x38c2f8[_0x68ef('0x31')];if(_0x4973c2['query']['includeAll']){_0x4a0763[_0x68ef('0x2b')]=[{'all':!![]}];}_0x4a0763=_[_0x68ef('0x37')]({},_0x4a0763,_0x4973c2[_0x68ef('0x38')]);return db[_0x68ef('0x28')][_0x68ef('0x20')](_0x4a0763)[_0x68ef('0x18')](handleEntityNotFound(_0x24c2c9,null))[_0x68ef('0x18')](respondWithResult(_0x24c2c9,null))['catch'](handleError(_0x24c2c9,null));};exports[_0x68ef('0x39')]=function(_0xd7f9ca,_0x2f6ee0){return db[_0x68ef('0x28')]['create'](_0xd7f9ca[_0x68ef('0x3a')],{})[_0x68ef('0x18')](function(_0xcf595d){var _0x410c10=_0xd7f9ca[_0x68ef('0x3b')][_0x68ef('0x3c')]({'plain':!![]});if(!_0x410c10)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x410c10[_0x68ef('0x3d')]===_0x68ef('0x3b')){var _0xf5010c=_0xcf595d[_0x68ef('0x3c')]({'plain':!![]});var _0x449f3c=[{'name':_0x68ef('0x1a'),'value':_0x68ef('0x1b')},{'name':_0x68ef('0x3e'),'value':_0x68ef('0x1c')}];var _0x531096=_[_0x68ef('0x20')](_0x449f3c,[_0x68ef('0x1f'),_0xf5010c[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x3f')][_0x68ef('0x20')]({'where':{'name':_0x531096,'userProfileId':_0x410c10[_0x68ef('0x40')]},'raw':!![]})['then'](function(_0xb3d396){if(_0xb3d396&&_0xb3d396['autoAssociation']===0x0){return db[_0x68ef('0x23')][_0x68ef('0x39')]({'name':_0xf5010c[_0x68ef('0x22')],'resourceId':_0xf5010c['id'],'type':_0xb3d396[_0x68ef('0x22')],'sectionId':_0xb3d396['id']},{})['then'](function(){return _0xcf595d;});}else{return _0xcf595d;}})[_0x68ef('0x2f')](function(_0x5a8231){logger[_0x68ef('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a8231);throw _0x5a8231;});}return _0xcf595d;})[_0x68ef('0x18')](respondWithResult(_0x2f6ee0,0xc9))[_0x68ef('0x2f')](handleError(_0x2f6ee0,null));};exports[_0x68ef('0x41')]=function(_0x5c4a66,_0x59b148){var _0x4044d5={'where':{'id':_0x5c4a66['params']['id']}},_0x399055={};_0x399055['model']=_['keys'](db[_0x68ef('0x28')][_0x68ef('0x29')]);_0x4044d5[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x399055[_0x68ef('0x31')],qs['fields'](_0x5c4a66['query'][_0x68ef('0x35')]));_0x4044d5[_0x68ef('0x34')]=_0x4044d5[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4044d5['attributes']:_0x399055[_0x68ef('0x31')];if(_0x5c4a66[_0x68ef('0x2c')][_0x68ef('0x42')]){_0x4044d5[_0x68ef('0x2b')]=[{'all':!![]}];}_0x4044d5=_['merge']({},_0x4044d5,_0x5c4a66['options']);return db[_0x68ef('0x28')][_0x68ef('0x20')](_0x4044d5)['then'](handleEntityNotFound(_0x59b148,null))[_0x68ef('0x18')](function(_0x12fff3){if(_0x12fff3){var _0x3a82a0=_0x12fff3[_0x68ef('0x3c')]({'plain':!![]});_0x3a82a0=qs[_0x68ef('0x43')](_0x3a82a0,['id','createdAt',_0x68ef('0x44')]);_0x5c4a66[_0x68ef('0x3a')]=_[_0x68ef('0x43')](_0x5c4a66['body'],['id',_0x68ef('0x45'),_0x68ef('0x44')]);return db[_0x68ef('0x28')]['create'](_[_0x68ef('0x37')](_0x3a82a0,_0x5c4a66['body']),{'include':_0x5c4a66['query'][_0x68ef('0x42')]?[{'all':!![]}]:undefined})['then'](function(_0x39dd21){var _0xb33afd=_0x5c4a66[_0x68ef('0x3b')][_0x68ef('0x3c')]({'plain':!![]});if(!_0xb33afd)throw new Error(_0x68ef('0x46'));if(_0xb33afd[_0x68ef('0x3d')]===_0x68ef('0x3b')){var _0x1d1d6e=_0x39dd21[_0x68ef('0x3c')]({'plain':!![]});var _0x247915=[{'name':'VoiceQueues','value':'inbound'},{'name':_0x68ef('0x3e'),'value':_0x68ef('0x1c')}];var _0x317b79=_[_0x68ef('0x20')](_0x247915,[_0x68ef('0x1f'),_0x1d1d6e[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x3f')][_0x68ef('0x20')]({'where':{'name':_0x317b79,'userProfileId':_0xb33afd['userProfileId']},'raw':!![]})['then'](function(_0x42a4b2){if(_0x42a4b2&&_0x42a4b2['autoAssociation']===0x0){return db[_0x68ef('0x23')]['create']({'name':_0x1d1d6e[_0x68ef('0x22')],'resourceId':_0x1d1d6e['id'],'type':_0x42a4b2[_0x68ef('0x22')],'sectionId':_0x42a4b2['id']},{})['then'](function(){return _0x39dd21;});}else{return _0x39dd21;}})[_0x68ef('0x2f')](function(_0x4e097e){logger[_0x68ef('0x24')](_0x68ef('0x47'),_0x4e097e);throw _0x4e097e;});}return _0x39dd21;});}})[_0x68ef('0x18')](respondWithResult(_0x59b148,0xc9))[_0x68ef('0x2f')](handleError(_0x59b148,null));};exports[_0x68ef('0x48')]=function(_0x3d81c8,_0x5c347c){if(_0x3d81c8[_0x68ef('0x3a')]['id']){delete _0x3d81c8[_0x68ef('0x3a')]['id'];}return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x3d81c8[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x5c347c,null))['then'](saveUpdates(_0x3d81c8[_0x68ef('0x3a')],null))[_0x68ef('0x18')](respondWithResult(_0x5c347c,null))['catch'](handleError(_0x5c347c,null));};exports[_0x68ef('0x19')]=function(_0x114d9f,_0x3d3087){return db['VoiceQueue'][_0x68ef('0x20')]({'where':{'id':_0x114d9f['params']['id']}})['then'](handleEntityNotFound(_0x3d3087,null))[_0x68ef('0x18')](removeEntity(_0x3d3087,null))['catch'](handleError(_0x3d3087,null));};exports[_0x68ef('0x4a')]=function(_0x47c1d5,_0x100a20){var _0x9e8554={'raw':![],'where':{}};var _0x304405={};var _0x3fbd39={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x47c1d5['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x100a20,null))['then'](function(_0x2cbd99){if(_0x2cbd99){_0x304405['model']=_[_0x68ef('0x32')](db[_0x68ef('0x4c')][_0x68ef('0x29')]);_0x304405[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x47c1d5[_0x68ef('0x2c')]);_0x304405[_0x68ef('0x4d')]=_['intersection'](_0x304405[_0x68ef('0x31')],_0x304405[_0x68ef('0x2c')]);_0x9e8554[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x304405[_0x68ef('0x31')],qs['fields'](_0x47c1d5[_0x68ef('0x2c')]['fields']));_0x9e8554[_0x68ef('0x34')]=_0x9e8554['attributes']['length']?_0x9e8554[_0x68ef('0x34')]:_0x304405[_0x68ef('0x31')];if(!_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x4e')]('nolimit')){_0x9e8554[_0x68ef('0x14')]=qs['limit'](_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x9e8554[_0x68ef('0x12')]=qs['offset'](_0x47c1d5['query'][_0x68ef('0x12')]);}_0x9e8554[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x47c1d5[_0x68ef('0x2c')]['sort']);_0x9e8554[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x47c1d5[_0x68ef('0x2c')],_0x304405['filters']));_0x9e8554[_0x68ef('0x51')]['VoiceQueueId']=_0x2cbd99['id'];if(_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x9e8554[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x9e8554[_0x68ef('0x51')],{'$or':_['map'](_0x9e8554[_0x68ef('0x34')],function(_0x2caed7){var _0x147695={};_0x147695[_0x2caed7]={'$like':'%'+_0x47c1d5['query'][_0x68ef('0x53')]+'%'};return _0x147695;})});}_0x9e8554=_['merge']({},_0x9e8554,_0x47c1d5[_0x68ef('0x38')]);return db['CmHopper']['count']({'where':_0x9e8554[_0x68ef('0x51')]})[_0x68ef('0x18')](function(_0x38c117){_0x3fbd39[_0x68ef('0x15')]=_0x38c117;if(_0x47c1d5['query'][_0x68ef('0x42')]){_0x9e8554[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x4c')]['findAll'](_0x9e8554);})[_0x68ef('0x18')](function(_0x2db826){_0x3fbd39[_0x68ef('0x2e')]=_0x2db826;return _0x3fbd39;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0x100a20,_0x9e8554))[_0x68ef('0x2f')](handleError(_0x100a20,null));};exports[_0x68ef('0x54')]=function(_0x139557,_0xfe72dc){var _0x156ce3={'raw':!![],'where':{}};var _0x11feff={};var _0x454999={'count':0x0,'rows':[]};return db[_0x68ef('0x28')]['findOne']({'where':{'id':_0x139557[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0xfe72dc,null))['then'](function(_0x513c69){if(_0x513c69){_0x11feff[_0x68ef('0x31')]=_['keys'](db[_0x68ef('0x55')][_0x68ef('0x29')]);_0x11feff['query']=_['keys'](_0x139557[_0x68ef('0x2c')]);_0x11feff['filters']=_[_0x68ef('0x33')](_0x11feff['model'],_0x11feff[_0x68ef('0x2c')]);_0x156ce3['attributes']=_[_0x68ef('0x33')](_0x11feff[_0x68ef('0x31')],qs['fields'](_0x139557[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x156ce3[_0x68ef('0x34')]=_0x156ce3[_0x68ef('0x34')]['length']?_0x156ce3[_0x68ef('0x34')]:_0x11feff[_0x68ef('0x31')];if(!_0x139557['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x156ce3[_0x68ef('0x14')]=qs['limit'](_0x139557[_0x68ef('0x2c')]['limit']);_0x156ce3[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x139557['query']['offset']);}_0x156ce3['order']=qs['sort'](_0x139557[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x156ce3[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x139557[_0x68ef('0x2c')],_0x11feff[_0x68ef('0x4d')]));_0x156ce3[_0x68ef('0x51')][_0x68ef('0x57')]=_0x513c69['id'];if(_0x139557[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x156ce3[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x156ce3['where'],{'$or':_[_0x68ef('0x1e')](_0x156ce3['attributes'],function(_0x791181){var _0x5b39a8={};_0x5b39a8[_0x791181]={'$like':'%'+_0x139557['query'][_0x68ef('0x53')]+'%'};return _0x5b39a8;})});}_0x156ce3=_[_0x68ef('0x37')]({},_0x156ce3,_0x139557[_0x68ef('0x38')]);return db[_0x68ef('0x55')]['count']({'where':_0x156ce3['where']})[_0x68ef('0x18')](function(_0x308997){_0x454999[_0x68ef('0x15')]=_0x308997;if(_0x139557['query'][_0x68ef('0x42')]){_0x156ce3[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x55')][_0x68ef('0x2d')](_0x156ce3);})['then'](function(_0x214e89){_0x454999[_0x68ef('0x2e')]=_0x214e89;return _0x454999;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0xfe72dc,_0x156ce3))[_0x68ef('0x2f')](handleError(_0xfe72dc,null));};exports[_0x68ef('0x58')]=function(_0x346049,_0x489ca6){var _0x2a72e8={'raw':!![],'where':{}};var _0x49844f={};var _0xea97f4={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x346049[_0x68ef('0x49')]['id']}})['then'](handleEntityNotFound(_0x489ca6,null))[_0x68ef('0x18')](function(_0x4c47ab){if(_0x4c47ab){_0x49844f[_0x68ef('0x31')]=_[_0x68ef('0x32')](db['CmHopperFinal']['rawAttributes']);_0x49844f[_0x68ef('0x2c')]=_['keys'](_0x346049[_0x68ef('0x2c')]);_0x49844f['filters']=_[_0x68ef('0x33')](_0x49844f[_0x68ef('0x31')],_0x49844f[_0x68ef('0x2c')]);_0x2a72e8[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x49844f[_0x68ef('0x31')],qs['fields'](_0x346049[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x2a72e8[_0x68ef('0x34')]=_0x2a72e8[_0x68ef('0x34')][_0x68ef('0x36')]?_0x2a72e8[_0x68ef('0x34')]:_0x49844f[_0x68ef('0x31')];if(!_0x346049['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x2a72e8[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x346049[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x2a72e8[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x346049[_0x68ef('0x2c')]['offset']);}_0x2a72e8[_0x68ef('0x4f')]=qs['sort'](_0x346049['query']['sort']);_0x2a72e8[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x346049['query'],_0x49844f['filters']));_0x2a72e8['where'][_0x68ef('0x57')]=_0x4c47ab['id'];if(_0x346049[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x2a72e8[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x2a72e8[_0x68ef('0x51')],{'$or':_['map'](_0x2a72e8[_0x68ef('0x34')],function(_0x2c7f18){var _0x1bdacc={};_0x1bdacc[_0x2c7f18]={'$like':'%'+_0x346049[_0x68ef('0x2c')]['filter']+'%'};return _0x1bdacc;})});}_0x2a72e8=_[_0x68ef('0x37')]({},_0x2a72e8,_0x346049[_0x68ef('0x38')]);return db[_0x68ef('0x59')][_0x68ef('0x15')]({'where':_0x2a72e8[_0x68ef('0x51')]})[_0x68ef('0x18')](function(_0x6ca6f4){_0xea97f4[_0x68ef('0x15')]=_0x6ca6f4;if(_0x346049['query'][_0x68ef('0x42')]){_0x2a72e8[_0x68ef('0x2b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x68ef('0x2d')](_0x2a72e8);})[_0x68ef('0x18')](function(_0x1b9028){_0xea97f4[_0x68ef('0x2e')]=_0x1b9028;return _0xea97f4;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0x489ca6,_0x2a72e8))[_0x68ef('0x2f')](handleError(_0x489ca6,null));};exports[_0x68ef('0x5a')]=function(_0x2e626c,_0x3b1781){var _0x159169={'raw':!![],'where':{}};var _0x29522c={};var _0x37bf89={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x2e626c[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x3b1781,null))[_0x68ef('0x18')](function(_0x24af15){if(_0x24af15){_0x29522c['model']=_[_0x68ef('0x32')](db[_0x68ef('0x5b')][_0x68ef('0x29')]);_0x29522c[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x2e626c['query']);_0x29522c[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x29522c['model'],_0x29522c[_0x68ef('0x2c')]);_0x159169['attributes']=_['intersection'](_0x29522c['model'],qs['fields'](_0x2e626c[_0x68ef('0x2c')]['fields']));_0x159169[_0x68ef('0x34')]=_0x159169['attributes']['length']?_0x159169['attributes']:_0x29522c[_0x68ef('0x31')];if(!_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x159169[_0x68ef('0x14')]=qs['limit'](_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x159169[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x2e626c['query'][_0x68ef('0x12')]);}_0x159169['order']=qs['sort'](_0x2e626c['query'][_0x68ef('0x50')]);_0x159169[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x2e626c[_0x68ef('0x2c')],_0x29522c[_0x68ef('0x4d')]));_0x159169[_0x68ef('0x51')][_0x68ef('0x57')]=_0x24af15['id'];if(_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x159169[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x159169['where'],{'$or':_['map'](_0x159169['attributes'],function(_0x25e698){var _0x1cad59={};_0x1cad59[_0x25e698]={'$like':'%'+_0x2e626c[_0x68ef('0x2c')]['filter']+'%'};return _0x1cad59;})});}_0x159169=_[_0x68ef('0x37')]({},_0x159169,_0x2e626c['options']);return db[_0x68ef('0x5b')][_0x68ef('0x15')]({'where':_0x159169[_0x68ef('0x51')]})['then'](function(_0x304260){_0x37bf89[_0x68ef('0x15')]=_0x304260;if(_0x2e626c['query'][_0x68ef('0x42')]){_0x159169[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x5b')][_0x68ef('0x2d')](_0x159169);})[_0x68ef('0x18')](function(_0x23126a){_0x37bf89[_0x68ef('0x2e')]=_0x23126a;return _0x37bf89;});}})['then'](respondWithFilteredResult(_0x3b1781,_0x159169))[_0x68ef('0x2f')](handleError(_0x3b1781,null));};exports[_0x68ef('0x5c')]=function(_0x5a262d,_0x28cad4){var _0x424e46={};var _0x46c87e={};var _0x20a131;var _0x1b8250;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x5a262d['params']['id']}})['then'](handleEntityNotFound(_0x28cad4,null))[_0x68ef('0x18')](function(_0x4dcf9e){if(_0x4dcf9e){_0x20a131=_0x4dcf9e;_0x46c87e[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x5d')][_0x68ef('0x29')]);_0x46c87e[_0x68ef('0x2c')]=_['keys'](_0x5a262d[_0x68ef('0x2c')]);_0x46c87e[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x46c87e[_0x68ef('0x31')],_0x46c87e['query']);_0x424e46['attributes']=_[_0x68ef('0x33')](_0x46c87e[_0x68ef('0x31')],qs[_0x68ef('0x35')](_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x424e46[_0x68ef('0x34')]=_0x424e46[_0x68ef('0x34')][_0x68ef('0x36')]?_0x424e46[_0x68ef('0x34')]:_0x46c87e[_0x68ef('0x31')];_0x424e46[_0x68ef('0x4f')]=qs['sort'](_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x424e46[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x5a262d[_0x68ef('0x2c')],_0x46c87e[_0x68ef('0x4d')]));if(_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x424e46[_0x68ef('0x51')]=_['merge'](_0x424e46['where'],{'$or':_[_0x68ef('0x1e')](_0x424e46[_0x68ef('0x34')],function(_0x3ef9e2){var _0x12ef69={};_0x12ef69[_0x3ef9e2]={'$like':'%'+_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x53')]+'%'};return _0x12ef69;})});}_0x424e46=_[_0x68ef('0x37')]({},_0x424e46,_0x5a262d['options']);return _0x20a131[_0x68ef('0x5c')](_0x424e46);}})[_0x68ef('0x18')](function(_0x11c717){if(_0x11c717){_0x1b8250=_0x11c717[_0x68ef('0x36')];if(!_0x5a262d['query'][_0x68ef('0x4e')]('nolimit')){_0x424e46[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x5a262d[_0x68ef('0x2c')]['limit']);_0x424e46['offset']=qs[_0x68ef('0x12')](_0x5a262d['query'][_0x68ef('0x12')]);}return _0x20a131['getTeams'](_0x424e46);}})[_0x68ef('0x18')](function(_0x426274){if(_0x426274){return _0x426274?{'count':_0x1b8250,'rows':_0x426274}:null;}})['then'](respondWithResult(_0x28cad4,null))['catch'](handleError(_0x28cad4,null));};exports[_0x68ef('0x5e')]=function(_0x1d429a,_0x4d96a9){var _0xf9f2c4=_0x1d429a[_0x68ef('0x3a')][_0x68ef('0x5f')];var _0x4ae311=_['map'](_0xf9f2c4,'id');return db[_0x68ef('0x5d')]['findAll']({'where':{'id':_0x4ae311},'attributes':['id'],'include':[{'model':db[_0x68ef('0x60')],'as':_0x68ef('0x61'),'attributes':['id',_0x68ef('0x22'),_0x68ef('0x62'),_0x68ef('0x63'),_0x68ef('0x64')],'raw':!![]}]})['then'](function(_0x48f3f6){if(_0x48f3f6){var _0x453f91=_[_0x68ef('0x65')](_0x48f3f6,function(_0x8eb711){var _0x39ab6a=_0x8eb711[_0x68ef('0x3c')]({'plain':!![]});_0x39ab6a['Agents'][_0x68ef('0x66')](function(_0x428fd5){_0x428fd5[_0x68ef('0x67')]=_[_0x68ef('0x20')](_0xf9f2c4,{'id':_0x39ab6a['id']})[_0x68ef('0x67')];});return _0x39ab6a[_0x68ef('0x61')];});return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x1d429a['params']['id']}})[_0x68ef('0x18')](function(_0x261ce6){return db[_0x68ef('0x68')][_0x68ef('0x69')](function(_0x2138cd){return _0x261ce6[_0x68ef('0x5e')](_0x4ae311,{'transaction':_0x2138cd})['then'](function(){return BPromise[_0x68ef('0x6a')](_0xf9f2c4,function(_0x13fae2){return db[_0x68ef('0x6b')][_0x68ef('0x6c')]({'TeamId':_0x13fae2['id'],'VoiceQueueId':_0x1d429a[_0x68ef('0x49')]['id'],'penalty':_0x13fae2['penalty']},{'transaction':_0x2138cd});});})[_0x68ef('0x18')](function(){return BPromise[_0x68ef('0x6a')](_0x453f91,function(_0x5d156e){return db['UserVoiceQueue'][_0x68ef('0x6d')]({'where':{'UserId':_0x5d156e['id'],'VoiceQueueId':_0x1d429a[_0x68ef('0x49')]['id']},'defaults':{'penalty':_0x5d156e[_0x68ef('0x67')]},'transaction':_0x2138cd});});})['then'](function(){return BPromise['each'](_[_0x68ef('0x53')](_0x453f91,{'online':!![]}),function(_0x10a3f9){return db[_0x68ef('0x6e')][_0x68ef('0x6c')]({'membername':_0x10a3f9[_0x68ef('0x22')],'UserId':_0x10a3f9['id'],'queue_name':_0x261ce6[_0x68ef('0x22')],'VoiceQueueId':_0x261ce6['id'],'interface':_[_0x68ef('0x6f')](_0x10a3f9[_0x68ef('0x64')])?util[_0x68ef('0x70')](_0x68ef('0x71'),_0x10a3f9[_0x68ef('0x22')]):_0x10a3f9[_0x68ef('0x64')],'paused':_0x10a3f9[_0x68ef('0x63')]||![],'penalty':_0x10a3f9[_0x68ef('0x67')]},{'transaction':_0x2138cd});});})['then'](function(){_0x453f91['forEach'](function(_0x503219){socket[_0x68ef('0x72')](_0x68ef('0x73'),{'UserId':_0x503219['id'],'VoiceQueueId':_0x261ce6['id']});});});});});}})[_0x68ef('0x18')](respondWithStatusCode(_0x4d96a9,null))['catch'](handleError(_0x4d96a9,null));};exports[_0x68ef('0x74')]=function(_0x3713e0,_0x5af5d0){return db['Team'][_0x68ef('0x2d')]({'where':{'id':_0x3713e0[_0x68ef('0x2c')][_0x68ef('0x75')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x68ef('0x61'),'attributes':['id'],'raw':!![]}]})[_0x68ef('0x18')](handleEntityNotFound(_0x5af5d0,null))[_0x68ef('0x18')](function(_0x48959f){var _0x1bb11f=_['map'](_0x48959f,'id');var _0x211d51=[];var _0x3e37e3=[];var _0x5168cd=squel[_0x68ef('0x76')]();_0x5168cd[_0x68ef('0x77')](_0x68ef('0x78'))[_0x68ef('0x79')](_0x68ef('0x7a'),'tq')[_0x68ef('0x7b')](_0x68ef('0x7c'),'ut',_0x68ef('0x7d'))[_0x68ef('0x51')]('VoiceQueueId\x20=\x20?',_0x3713e0[_0x68ef('0x49')]['id']);for(var _0x121a0f=0x0;_0x121a0f<_0x48959f[_0x68ef('0x36')];_0x121a0f+=0x1){let _0x465198=_0x48959f[_0x121a0f];for(var _0x3e3775=0x0;_0x3e3775<_0x465198[_0x68ef('0x61')][_0x68ef('0x36')];_0x3e3775+=0x1){let _0x4906d2=_0x465198['Agents'][_0x3e3775];var _0x1e8577=_0x5168cd['clone']();_0x1e8577[_0x68ef('0x51')](_0x68ef('0x7e'),_0x4906d2['id']);_0x3e37e3[_0x68ef('0x7f')](db[_0x68ef('0x68')]['query'](_0x1e8577[_0x68ef('0x80')](),{'type':db[_0x68ef('0x68')][_0x68ef('0x81')]['SELECT']})[_0x68ef('0x18')](function(_0xe82f3a){if(_0xe82f3a['length']===0x1){return _0x4906d2['id'];}else{var _0x3c3933=_[_0x68ef('0x82')](_['map'](_0xe82f3a,'TeamId'),function(_0x522ef7){return _[_0x68ef('0x83')](_0x1bb11f,_0x522ef7);});if(_0x3c3933){return _0x4906d2['id'];}}}));}}return BPromise[_0x68ef('0x84')](_0x3e37e3)[_0x68ef('0x18')](function(_0x3e92e0){_0x211d51=_(_0x211d51)[_0x68ef('0x85')](_0x3e92e0)[_0x68ef('0x86')]()[_0x68ef('0x1f')]();return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x3713e0['params']['id']}})[_0x68ef('0x18')](function(_0x62a830){return db['sequelize'][_0x68ef('0x69')](function(_0x2374fa){return _0x62a830[_0x68ef('0x74')](_0x3713e0['query'][_0x68ef('0x75')],{'transaction':_0x2374fa})['then'](function(){if(!_[_0x68ef('0x87')](_0x211d51)){return _0x62a830[_0x68ef('0x88')](_0x211d51,{'transaction':_0x2374fa})[_0x68ef('0x18')](function(){return db[_0x68ef('0x6e')][_0x68ef('0x19')]({'where':{'VoiceQueueId':_0x3713e0[_0x68ef('0x49')]['id'],'UserId':_0x211d51},'transaction':_0x2374fa});});}})[_0x68ef('0x18')](function(){_0x211d51[_0x68ef('0x66')](function(_0x491464){socket[_0x68ef('0x72')](_0x68ef('0x89'),{'UserId':_0x491464,'VoiceQueueId':_0x62a830['id']});});});});});});})['then'](respondWithStatusCode(_0x5af5d0,null))[_0x68ef('0x2f')](handleError(_0x5af5d0,null));};exports[_0x68ef('0x8a')]=function(_0x430ef5,_0x1d3499){var _0x2b1686,_0x51c52b;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x430ef5[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x1d3499,null))[_0x68ef('0x18')](function(_0x5548b1){if(_0x5548b1){_0x51c52b=_0x5548b1;return _0x5548b1[_0x68ef('0x8a')](_0x430ef5['body']['ids'],_[_0x68ef('0x43')](_0x430ef5[_0x68ef('0x3a')],[_0x68ef('0x75'),'id'])||{})[_0x68ef('0x8b')](function(_0x32e1e3){for(var _0x150e0d=0x0;_0x150e0d<_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')]['length'];_0x150e0d+=0x1){socket[_0x68ef('0x72')](_0x68ef('0x73'),{'UserId':Number(_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')][_0x150e0d]),'VoiceQueueId':Number(_0x430ef5[_0x68ef('0x49')]['id'])});}return _0x32e1e3;});}})[_0x68ef('0x18')](function(_0x39302e){_0x2b1686=_0x39302e||[];if(_0x51c52b){return db[_0x68ef('0x60')][_0x68ef('0x2d')]({'where':{'id':_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')]},'attributes':['id',_0x68ef('0x22'),'online',_0x68ef('0x63'),_0x68ef('0x64')],'raw':!![]});}})[_0x68ef('0x18')](function(_0xe4c314){if(!_['isEmpty'](_0xe4c314)){var _0xc5163d=[];for(var _0xb342e5=0x0;_0xb342e5<_0xe4c314[_0x68ef('0x36')];_0xb342e5++){if(_0xe4c314[_0xb342e5]['online']){_0xc5163d[_0x68ef('0x7f')](db['UserVoiceQueueRt'][_0x68ef('0x6c')]({'membername':_0xe4c314[_0xb342e5][_0x68ef('0x22')],'UserId':_0xe4c314[_0xb342e5]['id'],'queue_name':_0x51c52b[_0x68ef('0x22')],'VoiceQueueId':_0x51c52b['id'],'interface':_[_0x68ef('0x6f')](_0xe4c314[_0xb342e5][_0x68ef('0x64')])?util['format']('SIP/%s',_0xe4c314[_0xb342e5]['name']):_0xe4c314[_0xb342e5][_0x68ef('0x64')],'paused':_0xe4c314[_0xb342e5][_0x68ef('0x63')]||![],'penalty':_0x430ef5['body'][_0x68ef('0x67')]||0x0}));}}return BPromise[_0x68ef('0x84')](_0xc5163d);}})[_0x68ef('0x18')](function(){return _0x2b1686;})[_0x68ef('0x18')](respondWithResult(_0x1d3499,null))[_0x68ef('0x2f')](handleError(_0x1d3499,null));};exports[_0x68ef('0x88')]=function(_0x34edc4,_0x1576ac){return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x34edc4[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x1576ac,null))[_0x68ef('0x18')](function(_0x31b61d){if(_0x31b61d){return _0x31b61d[_0x68ef('0x88')](_0x34edc4[_0x68ef('0x2c')]['ids'])[_0x68ef('0x18')](function(){if(_[_0x68ef('0x8c')](_0x34edc4['query'][_0x68ef('0x75')])){for(var _0x1774a9=0x0;_0x1774a9<_0x34edc4[_0x68ef('0x2c')][_0x68ef('0x75')][_0x68ef('0x36')];_0x1774a9+=0x1){socket[_0x68ef('0x72')](_0x68ef('0x89'),{'UserId':Number(_0x34edc4['query']['ids'][_0x1774a9]),'VoiceQueueId':Number(_0x34edc4[_0x68ef('0x49')]['id'])});}}else{socket[_0x68ef('0x72')]('userVoiceQueue:remove',{'UserId':Number(_0x34edc4[_0x68ef('0x2c')]['ids']),'VoiceQueueId':Number(_0x34edc4[_0x68ef('0x49')]['id'])});}});}})['then'](function(_0x3054e8){return db[_0x68ef('0x6e')][_0x68ef('0x19')]({'where':{'VoiceQueueId':_0x34edc4[_0x68ef('0x49')]['id'],'UserId':_0x34edc4[_0x68ef('0x2c')][_0x68ef('0x75')]}})[_0x68ef('0x18')](function(){return _0x3054e8;});})[_0x68ef('0x18')](respondWithStatusCode(_0x1576ac,null))['catch'](handleError(_0x1576ac,null));};exports[_0x68ef('0x8d')]=function(_0x60a1e7,_0x3bd9f2){var _0x3dd5f7={};var _0x35eba3={};var _0x18e166;var _0x3a6e25;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x60a1e7['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x3bd9f2,null))[_0x68ef('0x18')](function(_0x33ec8e){if(_0x33ec8e){_0x18e166=_0x33ec8e;_0x35eba3['model']=_[_0x68ef('0x32')](db[_0x68ef('0x60')][_0x68ef('0x29')]);_0x35eba3[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x60a1e7[_0x68ef('0x2c')]);_0x35eba3[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x35eba3[_0x68ef('0x31')],_0x35eba3[_0x68ef('0x2c')]);_0x3dd5f7[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x35eba3[_0x68ef('0x31')],qs[_0x68ef('0x35')](_0x60a1e7[_0x68ef('0x2c')]['fields']));_0x3dd5f7[_0x68ef('0x34')]=_0x3dd5f7[_0x68ef('0x34')]['length']?_0x3dd5f7[_0x68ef('0x34')]:_0x35eba3['model'];_0x3dd5f7[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x3dd5f7[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x60a1e7[_0x68ef('0x2c')],_0x35eba3[_0x68ef('0x4d')]));if(_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x3dd5f7[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x3dd5f7['where'],{'$or':_[_0x68ef('0x1e')](_0x3dd5f7[_0x68ef('0x34')],function(_0x2cf7d3){var _0x154c78={};_0x154c78[_0x2cf7d3]={'$like':'%'+_0x60a1e7['query'][_0x68ef('0x53')]+'%'};return _0x154c78;})});}_0x3dd5f7=_[_0x68ef('0x37')]({},_0x3dd5f7,_0x60a1e7[_0x68ef('0x38')]);return _0x18e166['getAgents'](_0x3dd5f7);}})[_0x68ef('0x18')](function(_0x225067){if(_0x225067){_0x3a6e25=_0x225067[_0x68ef('0x36')];if(!_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x3dd5f7[_0x68ef('0x14')]=qs['limit'](_0x60a1e7['query'][_0x68ef('0x14')]);_0x3dd5f7[_0x68ef('0x12')]=qs['offset'](_0x60a1e7['query'][_0x68ef('0x12')]);}return _0x18e166[_0x68ef('0x8d')](_0x3dd5f7);}})[_0x68ef('0x18')](function(_0x1e1738){if(_0x1e1738){return _0x1e1738?{'count':_0x3a6e25,'rows':_0x1e1738}:null;}})[_0x68ef('0x18')](respondWithResult(_0x3bd9f2,null))[_0x68ef('0x2f')](handleError(_0x3bd9f2,null));};exports[_0x68ef('0x8e')]=function(_0x13db31,_0x58800b){var _0x4cc80a={};var _0x3452d1={};var _0x1c5b4a;var _0x33dd03;return db['VoiceQueue'][_0x68ef('0x4b')]({'where':{'id':_0x13db31[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x58800b,null))[_0x68ef('0x18')](function(_0x535c5c){if(_0x535c5c){_0x1c5b4a=_0x535c5c;_0x3452d1['model']=_[_0x68ef('0x32')](db[_0x68ef('0x6e')][_0x68ef('0x29')]);_0x3452d1['query']=_[_0x68ef('0x32')](_0x13db31[_0x68ef('0x2c')]);_0x3452d1[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x3452d1[_0x68ef('0x31')],_0x3452d1[_0x68ef('0x2c')]);_0x4cc80a[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x3452d1[_0x68ef('0x31')],qs['fields'](_0x13db31[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4cc80a['attributes']=_0x4cc80a[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4cc80a[_0x68ef('0x34')]:_0x3452d1[_0x68ef('0x31')];_0x4cc80a['order']=qs[_0x68ef('0x50')](_0x13db31[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x4cc80a['where']=qs[_0x68ef('0x4d')](_['pick'](_0x13db31['query'],_0x3452d1['filters']));if(_0x13db31[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x4cc80a['where']=_[_0x68ef('0x37')](_0x4cc80a['where'],{'$or':_['map'](_0x4cc80a[_0x68ef('0x34')],function(_0x103585){var _0xa28738={};_0xa28738[_0x103585]={'$like':'%'+_0x13db31[_0x68ef('0x2c')][_0x68ef('0x53')]+'%'};return _0xa28738;})});}_0x4cc80a=_[_0x68ef('0x37')]({},_0x4cc80a,_0x13db31[_0x68ef('0x38')]);return _0x1c5b4a[_0x68ef('0x8e')](_0x4cc80a);}})[_0x68ef('0x18')](function(_0xcd5609){if(_0xcd5609){_0x33dd03=_0xcd5609[_0x68ef('0x36')];if(!_0x13db31['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x4cc80a['limit']=qs[_0x68ef('0x14')](_0x13db31['query'][_0x68ef('0x14')]);_0x4cc80a[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x13db31['query'][_0x68ef('0x12')]);}return _0x1c5b4a[_0x68ef('0x8e')](_0x4cc80a);}})[_0x68ef('0x18')](function(_0x799597){return _0x799597?{'count':_0x33dd03,'rows':_0x799597}:null;})[_0x68ef('0x18')](respondWithResult(_0x58800b,null))[_0x68ef('0x2f')](handleError(_0x58800b,null));};exports['getLists']=function(_0x5e4ec4,_0x40c6ec){var _0x4a45f9={};var _0x16ba3d={};var _0x405008;var _0x3ecec3;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x5e4ec4[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x40c6ec,null))[_0x68ef('0x18')](function(_0x4d4bfa){if(_0x4d4bfa){_0x405008=_0x4d4bfa;_0x16ba3d[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x8f')]['rawAttributes']);_0x16ba3d[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x5e4ec4[_0x68ef('0x2c')]);_0x16ba3d[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x16ba3d[_0x68ef('0x31')],_0x16ba3d[_0x68ef('0x2c')]);_0x4a45f9[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x16ba3d['model'],qs['fields'](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4a45f9['attributes']=_0x4a45f9[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4a45f9['attributes']:_0x16ba3d['model'];_0x4a45f9['order']=qs['sort'](_0x5e4ec4[_0x68ef('0x2c')]['sort']);_0x4a45f9[_0x68ef('0x51')]=qs['filters'](_[_0x68ef('0x52')](_0x5e4ec4[_0x68ef('0x2c')],_0x16ba3d['filters']));if(_0x5e4ec4['query']['filter']){_0x4a45f9[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x4a45f9[_0x68ef('0x51')],{'$or':_['map'](_0x4a45f9[_0x68ef('0x34')],function(_0x4898ad){var _0x22a810={};_0x22a810[_0x4898ad]={'$like':'%'+_0x5e4ec4['query'][_0x68ef('0x53')]+'%'};return _0x22a810;})});}_0x4a45f9=_[_0x68ef('0x37')]({},_0x4a45f9,_0x5e4ec4[_0x68ef('0x38')]);return _0x405008[_0x68ef('0x90')](_0x4a45f9);}})[_0x68ef('0x18')](function(_0x3f9113){if(_0x3f9113){_0x3ecec3=_0x3f9113[_0x68ef('0x36')];if(!_0x5e4ec4['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x4a45f9[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x4a45f9[_0x68ef('0x12')]=qs['offset'](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x12')]);}return _0x405008[_0x68ef('0x90')](_0x4a45f9);}})[_0x68ef('0x18')](function(_0x2a93bf){if(_0x2a93bf){return _0x2a93bf?{'count':_0x3ecec3,'rows':_0x2a93bf}:null;}})[_0x68ef('0x18')](respondWithResult(_0x40c6ec,null))[_0x68ef('0x2f')](handleError(_0x40c6ec,null));};exports[_0x68ef('0x91')]=function(_0x2d0bf5,_0x40da26){var _0x202e78=moment()[_0x68ef('0x70')]('YYYY-MM-DD\x20HH:mm:ss');var _0x253b31,_0x14b845;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x2d0bf5['params']['id']}})['then'](handleEntityNotFound(_0x40da26,null))['then'](function(_0x2e6bcf){if(_0x2e6bcf){_0x14b845=_0x2e6bcf;return _0x2e6bcf[_0x68ef('0x91')](_0x2d0bf5[_0x68ef('0x3a')][_0x68ef('0x75')],_['omit'](_0x2d0bf5['body'],['ids','id'])||{});}return null;})[_0x68ef('0x8b')](function(_0x12dbe5){var _0x547e6d;_0x253b31=_0x12dbe5||[];var _0x575f73=[];if(_0x12dbe5){for(var _0x6dc883=0x0;_0x6dc883<_0x12dbe5[_0x68ef('0x36')];_0x6dc883+=0x1){var _0x1dcc3e=_0x12dbe5[_0x6dc883][_0x68ef('0x3c')]({'plain':!![]});_0x14b845[_0x68ef('0x92')]=_0x2d0bf5[_0x68ef('0x3a')][_0x68ef('0x92')]?_0x2d0bf5['body'][_0x68ef('0x92')]:_0x14b845[_0x68ef('0x92')];switch(_0x14b845[_0x68ef('0x92')]){case _0x68ef('0x93'):_0x547e6d=squel[_0x68ef('0x94')]()['into'](_0x68ef('0x95'))[_0x68ef('0x96')](['phone',_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),_0x68ef('0x57'),'createdAt',_0x68ef('0x44')],squel['select']()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))[_0x68ef('0x77')]('id','ContactId')['field'](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),'ListId')['field'](_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0x9c'))[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f'))[_0x68ef('0x51')](_0x68ef('0xa0'),squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa1'))[_0x68ef('0x79')]('cm_hopper_final')['where'](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')]()))[_0x68ef('0x51')]('phone\x20NOT\x20IN\x20(?)',squel[_0x68ef('0x76')]()[_0x68ef('0x77')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0x68ef('0x51')](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id']['toString']())))[_0x68ef('0x80')]();break;case'onlyIfOpen':_0x547e6d=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0x95'))[_0x68ef('0x96')]([_0x68ef('0x9a'),_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),_0x68ef('0x57'),_0x68ef('0x45'),_0x68ef('0x44')],squel[_0x68ef('0x76')]()['field'](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))[_0x68ef('0x77')]('id',_0x68ef('0x98'))['field'](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),_0x68ef('0x99'))[_0x68ef('0x77')](_0x2d0bf5['params']['id']['toString'](),_0x68ef('0x57'))['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))[_0x68ef('0x79')](_0x68ef('0x9c'))[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f'))[_0x68ef('0x51')](_0x68ef('0xa0'),squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa4'))[_0x68ef('0x79')]('cm_hopper')['where'](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')]())))[_0x68ef('0x80')]();break;default:_0x547e6d=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')]('cm_hopper')[_0x68ef('0x96')]([_0x68ef('0x9a'),_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),'VoiceQueueId','createdAt',_0x68ef('0x44')],squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))['field']('id','ContactId')[_0x68ef('0x77')](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),'ListId')[_0x68ef('0x77')](_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0x9c'))['where'](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e['CmListId'][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f')))[_0x68ef('0x80')]();}_0x575f73[_0x68ef('0x7f')](db[_0x68ef('0x68')][_0x68ef('0x2c')](_0x547e6d));}return BPromise[_0x68ef('0x84')](_0x575f73);}})[_0x68ef('0x18')](function(){var _0x54b4cc=[];var _0x59637f=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0xa5'))['fromQuery']([_0x68ef('0xa6'),_0x68ef('0x9a'),_0x68ef('0xa7'),'createdAt','updatedAt'],squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa8'))[_0x68ef('0x77')](_0x68ef('0xa9'))[_0x68ef('0x77')]('ci.OrderBy+1')['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0xaa'),'ci')[_0x68ef('0x7b')](_0x68ef('0x95'),'h',_0x68ef('0xab'))[_0x68ef('0x51')]('h.scheduledat=?',_0x202e78)[_0x68ef('0x51')](_0x68ef('0xac'),_0x68ef('0xad')))['toString']();_0x54b4cc[_0x68ef('0x7f')](db[_0x68ef('0x68')][_0x68ef('0x2c')](_0x59637f));return BPromise[_0x68ef('0x84')](_0x54b4cc);})[_0x68ef('0x18')](function(){return _0x253b31;})[_0x68ef('0x18')](respondWithResult(_0x40da26,null))[_0x68ef('0x2f')](handleError(_0x40da26,null));};exports[_0x68ef('0xae')]=function(_0x58d5da,_0x1873b5){return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x58d5da[_0x68ef('0x49')]['id']}})['then'](handleEntityNotFound(_0x1873b5,null))[_0x68ef('0x18')](function(_0x351b99){if(_0x351b99){return _0x351b99[_0x68ef('0xae')](_0x58d5da[_0x68ef('0x2c')][_0x68ef('0x75')]);}})['then'](function(_0x5b41f0){if(_0x5b41f0){return db[_0x68ef('0x4c')]['destroy']({'where':{'ListId':_0x58d5da['query'][_0x68ef('0x75')],'VoiceQueueId':_0x58d5da[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](function(){return _0x5b41f0;});}})[_0x68ef('0x18')](respondWithStatusCode(_0x1873b5,null))[_0x68ef('0x2f')](handleError(_0x1873b5,null));};exports[_0x68ef('0xaf')]=function(_0x3ee069,_0x5f49e9){var _0x40cd91={};var _0x848118={};var _0x794d1e;var _0x266f6c;return db[_0x68ef('0x28')]['findOne']({'where':{'id':_0x3ee069[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x5f49e9,null))[_0x68ef('0x18')](function(_0x2b5994){if(_0x2b5994){_0x794d1e=_0x2b5994;_0x848118[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x8f')][_0x68ef('0x29')]);_0x848118['query']=_[_0x68ef('0x32')](_0x3ee069[_0x68ef('0x2c')]);_0x848118[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x848118[_0x68ef('0x31')],_0x848118[_0x68ef('0x2c')]);_0x40cd91[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x848118['model'],qs[_0x68ef('0x35')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x40cd91[_0x68ef('0x34')]=_0x40cd91[_0x68ef('0x34')]['length']?_0x40cd91[_0x68ef('0x34')]:_0x848118[_0x68ef('0x31')];_0x40cd91[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x40cd91[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x3ee069[_0x68ef('0x2c')],_0x848118[_0x68ef('0x4d')]));if(_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x40cd91['where']=_[_0x68ef('0x37')](_0x40cd91[_0x68ef('0x51')],{'$or':_[_0x68ef('0x1e')](_0x40cd91[_0x68ef('0x34')],function(_0x124eda){var _0x4b738d={};_0x4b738d[_0x124eda]={'$like':'%'+_0x3ee069[_0x68ef('0x2c')]['filter']+'%'};return _0x4b738d;})});}_0x40cd91=_['merge']({},_0x40cd91,_0x3ee069[_0x68ef('0x38')]);return _0x794d1e['getBlackLists'](_0x40cd91);}})['then'](function(_0x4210c0){if(_0x4210c0){_0x266f6c=_0x4210c0['length'];if(!_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x40cd91[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x40cd91[_0x68ef('0x12')]=qs['offset'](_0x3ee069['query'][_0x68ef('0x12')]);}return _0x794d1e[_0x68ef('0xaf')](_0x40cd91);}})[_0x68ef('0x18')](function(_0x23946d){if(_0x23946d){return _0x23946d?{'count':_0x266f6c,'rows':_0x23946d}:null;}})[_0x68ef('0x18')](respondWithResult(_0x5f49e9,null))[_0x68ef('0x2f')](handleError(_0x5f49e9,null));};exports[_0x68ef('0xb0')]=function(_0xcc1765,_0x29662c){var _0x1185bd;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0xcc1765['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x29662c,null))['then'](function(_0x30876d){if(_0x30876d){return _0x30876d[_0x68ef('0xb0')](_0xcc1765[_0x68ef('0x3a')][_0x68ef('0x75')],_['omit'](_0xcc1765[_0x68ef('0x3a')],[_0x68ef('0x75'),'id'])||{});}return null;})[_0x68ef('0x8b')](function(_0x295b66){var _0x3455b5;_0x1185bd=_0x295b66||[];var _0xbf2168=[];if(_0x295b66){for(var _0x4cf8b6=0x0;_0x4cf8b6<_0x295b66[_0x68ef('0x36')];_0x4cf8b6+=0x1){var _0x4e3f0a=_0x295b66[_0x4cf8b6][_0x68ef('0x3c')]({'plain':!![]});_0x3455b5=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0xb1'))[_0x68ef('0x96')]([_0x68ef('0x9a'),'ContactId','ListId','VoiceQueueId',_0x68ef('0x45'),_0x68ef('0x44')],squel['select']()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('id','ContactId')[_0x68ef('0x77')](_0x4e3f0a[_0x68ef('0x9b')][_0x68ef('0x80')](),_0x68ef('0x99'))[_0x68ef('0x77')](_0xcc1765[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')](_0x68ef('0xb2'),'createdAt')[_0x68ef('0x77')](_0x68ef('0xb2'),_0x68ef('0x44'))[_0x68ef('0x79')]('cm_contacts')[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x4e3f0a['CmListId'][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f')))['toString']();_0xbf2168['push'](db['sequelize'][_0x68ef('0x2c')](_0x3455b5));}return BPromise['all'](_0xbf2168);}})['then'](function(){return _0x1185bd;})[_0x68ef('0x18')](respondWithResult(_0x29662c,null))['catch'](handleError(_0x29662c,null));};exports[_0x68ef('0xb3')]=function(_0x398899,_0x8dd212){return db[_0x68ef('0x28')]['find']({'where':{'id':_0x398899[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x8dd212,null))[_0x68ef('0x18')](function(_0x57d305){if(_0x57d305){return _0x57d305[_0x68ef('0xb3')](_0x398899[_0x68ef('0x2c')][_0x68ef('0x75')]);}})['then'](function(_0x4c6756){if(_0x4c6756){return db[_0x68ef('0x5b')]['destroy']({'where':{'ListId':_0x398899[_0x68ef('0x2c')]['ids'],'VoiceQueueId':_0x398899['params']['id']}})['then'](function(){return _0x4c6756;});}})[_0x68ef('0x18')](respondWithStatusCode(_0x8dd212,null))[_0x68ef('0x2f')](handleError(_0x8dd212,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 06ebfe6..1821c8b 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 _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 +var _0x6e00=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners'];(function(_0x387ed5,_0x44e590){var _0x20a79e=function(_0x54f5e5){while(--_0x54f5e5){_0x387ed5['push'](_0x387ed5['shift']());}};_0x20a79e(++_0x44e590);}(_0x6e00,0x75));var _0x06e0=function(_0x4f74dd,_0x512666){_0x4f74dd=_0x4f74dd-0x0;var _0x251e19=_0x6e00[_0x4f74dd];return _0x251e19;};'use strict';var EventEmitter=require(_0x06e0('0x0'));var VoiceQueue=require(_0x06e0('0x1'))['db'][_0x06e0('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x06e0('0x3')](0x0);var events={'afterCreate':_0x06e0('0x4'),'afterUpdate':_0x06e0('0x5'),'afterDestroy':_0x06e0('0x6')};function emitEvent(_0x20918f){return function(_0x1c9b32,_0x505b57,_0x22f920){VoiceQueueEvents[_0x06e0('0x7')](_0x20918f+':'+_0x1c9b32['id'],_0x1c9b32);VoiceQueueEvents['emit'](_0x20918f,_0x1c9b32);_0x22f920(null);};}for(var e in events){if(events[_0x06e0('0x8')](e)){var event=events[e];VoiceQueue[_0x06e0('0x9')](e,emitEvent(event));}}module[_0x06e0('0xa')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 3095216..255e3a4 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_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 +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x58be03,_0x208cd6){var _0x514a44=function(_0x319510){while(--_0x319510){_0x58be03['push'](_0x58be03['shift']());}};_0x514a44(++_0x208cd6);}(_0xedd9,0xfc));var _0x9edd=function(_0x5489c4,_0x1e7a17){_0x5489c4=_0x5489c4-0x0;var _0x2c4624=_0xedd9[_0x5489c4];return _0x2c4624;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'voice_queues','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 c44d4c7..428038a 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 _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 +var _0x0fcf=['map','model','debug','GetVoiceQueue','stringify','find','raw','ShowVoiceQueue','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','error','message','result','catch','VoiceQueue','findAll','options','where','attributes','limit','include'];(function(_0x54135c,_0x57499b){var _0x4621c4=function(_0x1c242c){while(--_0x1c242c){_0x54135c['push'](_0x54135c['shift']());}};_0x4621c4(++_0x57499b);}(_0x0fcf,0x17a));var _0xf0fc=function(_0x242e67,_0x1ee0d1){_0x242e67=_0x242e67-0x0;var _0x13e618=_0x0fcf[_0x242e67];return _0x13e618;};'use strict';var _=require('lodash');var util=require(_0xf0fc('0x0'));var moment=require(_0xf0fc('0x1'));var BPromise=require(_0xf0fc('0x2'));var rs=require(_0xf0fc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0fc('0x4'))['db'];var utils=require(_0xf0fc('0x5'));var logger=require('../../config/logger')(_0xf0fc('0x6'));var config=require(_0xf0fc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf0fc('0x8')][_0xf0fc('0x9')]({'port':0x232a});config[_0xf0fc('0xa')]=_[_0xf0fc('0xb')](config[_0xf0fc('0xa')],{'host':_0xf0fc('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x4625b9,_0x2e8268,_0x37f990){return new BPromise(function(_0x20a1ad,_0x396a91){return client[_0xf0fc('0xd')](_0x4625b9,_0x37f990)[_0xf0fc('0xe')](function(_0x22c86c){logger[_0xf0fc('0xf')](_0xf0fc('0x10'),_0x2e8268,_0xf0fc('0x11'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x2e8268,_0xf0fc('0x11'),JSON['stringify'](_0x22c86c));if(_0x22c86c[_0xf0fc('0x12')]){if(_0x22c86c[_0xf0fc('0x12')]['code']===0x1f4){logger[_0xf0fc('0x12')](_0xf0fc('0x10'),_0x2e8268,_0x22c86c[_0xf0fc('0x12')][_0xf0fc('0x13')]);return _0x396a91(_0x22c86c[_0xf0fc('0x12')][_0xf0fc('0x13')]);}logger['error'](_0xf0fc('0x10'),_0x2e8268,_0x22c86c[_0xf0fc('0x12')][_0xf0fc('0x13')]);return _0x20a1ad(_0x22c86c[_0xf0fc('0x12')][_0xf0fc('0x13')]);}else{logger['info'](_0xf0fc('0x10'),_0x2e8268,_0xf0fc('0x11'));_0x20a1ad(_0x22c86c[_0xf0fc('0x14')][_0xf0fc('0x13')]);}})[_0xf0fc('0x15')](function(_0xf309e0){logger['error'](_0xf0fc('0x10'),_0x2e8268,_0xf309e0);_0x396a91(_0xf309e0);});});}exports['GetVoiceQueue']=function(_0x5bf434){var _0x181afe=this;return new Promise(function(_0x2f7890,_0x367b58){return db[_0xf0fc('0x16')][_0xf0fc('0x17')]({'raw':_0x5bf434['options']?_0x5bf434['options']['raw']===undefined?!![]:![]:!![],'where':_0x5bf434[_0xf0fc('0x18')]?_0x5bf434[_0xf0fc('0x18')][_0xf0fc('0x19')]||null:null,'attributes':_0x5bf434['options']?_0x5bf434['options'][_0xf0fc('0x1a')]||null:null,'limit':_0x5bf434['options']?_0x5bf434[_0xf0fc('0x18')][_0xf0fc('0x1b')]||null:null,'include':_0x5bf434[_0xf0fc('0x18')]?_0x5bf434['options'][_0xf0fc('0x1c')]?_[_0xf0fc('0x1d')](_0x5bf434[_0xf0fc('0x18')][_0xf0fc('0x1c')],function(_0xb1962c){return{'model':db[_0xb1962c[_0xf0fc('0x1e')]],'as':_0xb1962c['as'],'attributes':_0xb1962c[_0xf0fc('0x1a')],'include':_0xb1962c['include']?_[_0xf0fc('0x1d')](_0xb1962c[_0xf0fc('0x1c')],function(_0x555b94){return{'model':db[_0x555b94[_0xf0fc('0x1e')]],'as':_0x555b94['as'],'attributes':_0x555b94['attributes'],'include':_0x555b94['include']?_[_0xf0fc('0x1d')](_0x555b94[_0xf0fc('0x1c')],function(_0x51e794){return{'model':db[_0x51e794[_0xf0fc('0x1e')]],'as':_0x51e794['as'],'attributes':_0x51e794[_0xf0fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf0fc('0xe')](function(_0x3e261e){logger[_0xf0fc('0xf')]('GetVoiceQueue',_0x5bf434);logger[_0xf0fc('0x1f')](_0xf0fc('0x20'),_0x5bf434,JSON[_0xf0fc('0x21')](_0x3e261e));_0x2f7890(_0x3e261e);})[_0xf0fc('0x15')](function(_0x2b90ac){logger[_0xf0fc('0x12')]('GetVoiceQueue',_0x2b90ac[_0xf0fc('0x13')],_0x5bf434);_0x367b58(_0x181afe[_0xf0fc('0x12')](0x1f4,_0x2b90ac[_0xf0fc('0x13')]));});});};exports['ShowVoiceQueue']=function(_0x1fe49d){var _0x3bb474=this;return new Promise(function(_0x1af6b8,_0xac3e96){return db[_0xf0fc('0x16')][_0xf0fc('0x22')]({'raw':_0x1fe49d[_0xf0fc('0x18')]?_0x1fe49d['options'][_0xf0fc('0x23')]===undefined?!![]:![]:!![],'where':_0x1fe49d[_0xf0fc('0x18')]?_0x1fe49d[_0xf0fc('0x18')]['where']||null:null,'attributes':_0x1fe49d[_0xf0fc('0x18')]?_0x1fe49d[_0xf0fc('0x18')]['attributes']||null:null,'include':_0x1fe49d['options']?_0x1fe49d[_0xf0fc('0x18')][_0xf0fc('0x1c')]?_['map'](_0x1fe49d[_0xf0fc('0x18')]['include'],function(_0x578577){return{'model':db[_0x578577[_0xf0fc('0x1e')]],'as':_0x578577['as'],'attributes':_0x578577['attributes'],'include':_0x578577[_0xf0fc('0x1c')]?_[_0xf0fc('0x1d')](_0x578577[_0xf0fc('0x1c')],function(_0x24dca0){return{'model':db[_0x24dca0[_0xf0fc('0x1e')]],'as':_0x24dca0['as'],'attributes':_0x24dca0[_0xf0fc('0x1a')],'include':_0x24dca0[_0xf0fc('0x1c')]?_[_0xf0fc('0x1d')](_0x24dca0[_0xf0fc('0x1c')],function(_0x21d3e5){return{'model':db[_0x21d3e5[_0xf0fc('0x1e')]],'as':_0x21d3e5['as'],'attributes':_0x21d3e5[_0xf0fc('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x368814){logger[_0xf0fc('0xf')](_0xf0fc('0x24'),_0x1fe49d);logger[_0xf0fc('0x1f')]('ShowVoiceQueue',_0x1fe49d,JSON[_0xf0fc('0x21')](_0x368814));_0x1af6b8(_0x368814);})['catch'](function(_0x27a05d){logger[_0xf0fc('0x12')](_0xf0fc('0x24'),_0x27a05d[_0xf0fc('0x13')],_0x1fe49d);_0xac3e96(_0x3bb474[_0xf0fc('0x12')](0x1f4,_0x27a05d[_0xf0fc('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 6b4191a..f66429e 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 _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 +var _0x0adb=['./voiceQueue.events','save','remove','update','emit','removeListener','length'];(function(_0xacb1e2,_0x55e0ab){var _0x463815=function(_0x413c3b){while(--_0x413c3b){_0xacb1e2['push'](_0xacb1e2['shift']());}};_0x463815(++_0x55e0ab);}(_0x0adb,0x188));var _0xb0ad=function(_0x7f73c9,_0x547cb9){_0x7f73c9=_0x7f73c9-0x0;var _0x20cd2b=_0x0adb[_0x7f73c9];return _0x20cd2b;};'use strict';var VoiceQueueEvents=require(_0xb0ad('0x0'));var events=[_0xb0ad('0x1'),_0xb0ad('0x2'),_0xb0ad('0x3')];function createListener(_0x2b42fd,_0x49ab0e){return function(_0x142e54){_0x49ab0e[_0xb0ad('0x4')](_0x2b42fd,_0x142e54);};}function removeListener(_0x143104,_0x1ef34b){return function(){VoiceQueueEvents[_0xb0ad('0x5')](_0x143104,_0x1ef34b);};}exports['register']=function(_0x495897){for(var _0x376517=0x0,_0x52ba1c=events[_0xb0ad('0x6')];_0x376517<_0x52ba1c;_0x376517++){var _0x177ae5=events[_0x376517];var _0x26facf=createListener('voiceQueue:'+_0x177ae5,_0x495897);VoiceQueueEvents['on'](_0x177ae5,_0x26facf);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 6b5b5ee..ebe6523 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 _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 +var _0x9e5e=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','index','get','isAuthenticated','describe','/index','getVoiceQueuesReport','/:id','post','update','delete'];(function(_0x5cb972,_0x47c23e){var _0x1ea098=function(_0x5e5be7){while(--_0x5e5be7){_0x5cb972['push'](_0x5cb972['shift']());}};_0x1ea098(++_0x47c23e);}(_0x9e5e,0x1e2));var _0xe9e5=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x9e5e[_0x45d3f0];return _0x314b79;};'use strict';var multer=require(_0xe9e5('0x0'));var util=require(_0xe9e5('0x1'));var path=require('path');var timeout=require(_0xe9e5('0x2'));var express=require(_0xe9e5('0x3'));var router=express[_0xe9e5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe9e5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe9e5('0x6'));var controller=require(_0xe9e5('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xe9e5('0x8')]);router[_0xe9e5('0x9')]('/describe',auth[_0xe9e5('0xa')](),controller[_0xe9e5('0xb')]);router[_0xe9e5('0x9')](_0xe9e5('0xc'),auth[_0xe9e5('0xa')](),controller[_0xe9e5('0xd')]);router[_0xe9e5('0x9')](_0xe9e5('0xe'),auth[_0xe9e5('0xa')](),controller['show']);router[_0xe9e5('0xf')]('/',auth[_0xe9e5('0xa')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xe9e5('0x10')]);router[_0xe9e5('0x11')](_0xe9e5('0xe'),auth[_0xe9e5('0xa')](),controller[_0xe9e5('0x12')]);module[_0xe9e5('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 5fc9e45..2ea5076 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 _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 +var _0xaf31=['sequelize','moment','exports','STRING','DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','diff','queuecallerleaveAt','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','INTEGER'];(function(_0x4f5aa4,_0x226cdd){var _0x17bd0b=function(_0x17ef20){while(--_0x17ef20){_0x4f5aa4['push'](_0x4f5aa4['shift']());}};_0x17bd0b(++_0x226cdd);}(_0xaf31,0x1d4));var _0x1af3=function(_0x553b2e,_0x24f535){_0x553b2e=_0x553b2e-0x0;var _0x325652=_0xaf31[_0x553b2e];return _0x325652;};'use strict';var Sequelize=require(_0x1af3('0x0'));var moment=require(_0x1af3('0x1'));module[_0x1af3('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x1af3('0x3')]},'calleridname':{'type':Sequelize[_0x1af3('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x1af3('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x1af3('0x4')],'set':function(_0x491c06){var _0x3bdc10=moment(_0x491c06);var _0x5ab94a=moment(this[_0x1af3('0x5')]('queuecallerjoinAt'))[_0x1af3('0x6')](_0x1af3('0x7'));var _0x49f82b=_0x3bdc10[_0x1af3('0x8')](_0x5ab94a,'seconds');this['setDataValue'](_0x1af3('0x9'),_0x491c06);this['setDataValue']('holdtime',_0x49f82b||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x1af3('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x1af3('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x1af3('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x1af3('0x4')]},'queuecallerexit':{'type':Sequelize[_0x1af3('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x1af3('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x1af3('0x3')],'comment':_0x1af3('0xb')},'originalposition':{'type':Sequelize[_0x1af3('0xc')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x1af3('0x3')]},'accountcode':{'type':Sequelize[_0x1af3('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x1af3('0x3')]},'priority':{'type':Sequelize[_0x1af3('0x3')]},'holdtime':{'type':Sequelize[_0x1af3('0xc')]},'mohtime':{'type':Sequelize[_0x1af3('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x1af3('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x1af3('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x1af3('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x1af3('0x3')]},'secondDisposition':{'type':Sequelize[_0x1af3('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x1af3('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 494756d..7e8066f 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 _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 +var _0x6fe3=['describe','getVoiceQueuesReport','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','reject','update','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','sort','where','pick','filter','merge','options','VoiceQueueReport','findAll','rows','catch','show','length','includeAll','include','create','body','find','params'];(function(_0x4c2508,_0x220e3b){var _0x5ce988=function(_0x1eefe2){while(--_0x1eefe2){_0x4c2508['push'](_0x4c2508['shift']());}};_0x5ce988(++_0x220e3b);}(_0x6fe3,0x143));var _0x36fe=function(_0xf44d98,_0x12a472){_0xf44d98=_0xf44d98-0x0;var _0x5ebb04=_0x6fe3[_0xf44d98];return _0x5ebb04;};'use strict';var emlformat=require(_0x36fe('0x0'));var rimraf=require(_0x36fe('0x1'));var zipdir=require(_0x36fe('0x2'));var jsonpatch=require(_0x36fe('0x3'));var rp=require(_0x36fe('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x36fe('0x5'));var util=require(_0x36fe('0x6'));var path=require('path');var sox=require(_0x36fe('0x7'));var csv=require(_0x36fe('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x36fe('0x9'));var _=require(_0x36fe('0xa'));var squel=require('squel');var crypto=require(_0x36fe('0xb'));var jsforce=require(_0x36fe('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x36fe('0x8'));var querystring=require(_0x36fe('0xd'));var Papa=require(_0x36fe('0xe'));var Redis=require('ioredis');var authService=require(_0x36fe('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x36fe('0x10'));var hardwareService=require(_0x36fe('0x11'));var logger=require(_0x36fe('0x12'))(_0x36fe('0x13'));var utils=require(_0x36fe('0x14'));var config=require(_0x36fe('0x15'));var licenseUtil=require(_0x36fe('0x16'));var db=require(_0x36fe('0x17'))['db'];config[_0x36fe('0x18')]=_[_0x36fe('0x19')](config[_0x36fe('0x18')],{'host':_0x36fe('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x36fe('0x18')]));require(_0x36fe('0x1b'))[_0x36fe('0x1c')](socket);function respondWithStatusCode(_0x4dc20a,_0x527371){_0x527371=_0x527371||0xcc;return function(_0x24b291){if(_0x24b291){return _0x4dc20a[_0x36fe('0x1d')](_0x527371);}return _0x4dc20a[_0x36fe('0x1e')](_0x527371)['end']();};}function respondWithResult(_0x2e290d,_0x1e1e6f){_0x1e1e6f=_0x1e1e6f||0xc8;return function(_0x219983){if(_0x219983){return _0x2e290d[_0x36fe('0x1e')](_0x1e1e6f)[_0x36fe('0x1f')](_0x219983);}};}function respondWithFilteredResult(_0x54883c,_0x29095f){return function(_0x53c480){if(_0x53c480){var _0x43c37d=typeof _0x29095f[_0x36fe('0x20')]===_0x36fe('0x21')&&typeof _0x29095f['limit']==='undefined';var _0x36f51e=_0x53c480[_0x36fe('0x22')];var _0x221300=_0x43c37d?0x0:_0x29095f[_0x36fe('0x20')];var _0x1d1dc4=_0x43c37d?_0x53c480['count']:_0x29095f[_0x36fe('0x20')]+_0x29095f[_0x36fe('0x23')];var _0x3251df;if(_0x1d1dc4>=_0x36f51e){_0x1d1dc4=_0x36f51e;_0x3251df=0xc8;}else{_0x3251df=0xce;}_0x54883c[_0x36fe('0x1e')](_0x3251df);return _0x54883c[_0x36fe('0x24')]('Content-Range',_0x221300+'-'+_0x1d1dc4+'/'+_0x36f51e)[_0x36fe('0x1f')](_0x53c480);}return null;};}function patchUpdates(_0x4d390f){return function(_0x378b73){try{jsonpatch['apply'](_0x378b73,_0x4d390f,!![]);}catch(_0x1629d8){return BPromise[_0x36fe('0x25')](_0x1629d8);}return _0x378b73['save']();};}function saveUpdates(_0x576908,_0x7fce11){return function(_0x18f0a3){if(_0x18f0a3){return _0x18f0a3[_0x36fe('0x26')](_0x576908)[_0x36fe('0x27')](function(_0x30328f){return _0x30328f;});}return null;};}function removeEntity(_0xa01e1,_0x7882b9){return function(_0x5e50be){if(_0x5e50be){return _0x5e50be[_0x36fe('0x28')]()[_0x36fe('0x27')](function(){_0xa01e1['status'](0xcc)[_0x36fe('0x29')]();});}};}function handleEntityNotFound(_0x340110,_0x4c3766){return function(_0x42257d){if(!_0x42257d){_0x340110[_0x36fe('0x1d')](0x194);}return _0x42257d;};}function handleError(_0x2b7086,_0x266f4f){_0x266f4f=_0x266f4f||0x1f4;return function(_0x5c5a4e){logger[_0x36fe('0x2a')](_0x5c5a4e[_0x36fe('0x2b')]);if(_0x5c5a4e['name']){delete _0x5c5a4e[_0x36fe('0x2c')];}_0x2b7086['status'](_0x266f4f)[_0x36fe('0x2d')](_0x5c5a4e);};}exports['index']=function(_0x5d6f47,_0x121715){var _0x3a75b8={},_0x2e565f={},_0x2b0f2f={'count':0x0,'rows':[]};var _0x56f5b6=_[_0x36fe('0x2e')](db['VoiceQueueReport'][_0x36fe('0x2f')],function(_0x6533b5){return{'name':_0x6533b5[_0x36fe('0x30')],'type':_0x6533b5[_0x36fe('0x31')][_0x36fe('0x32')]};});_0x2e565f['model']=_[_0x36fe('0x2e')](_0x56f5b6,_0x36fe('0x2c'));_0x2e565f[_0x36fe('0x33')]=_[_0x36fe('0x34')](_0x5d6f47[_0x36fe('0x33')]);_0x2e565f[_0x36fe('0x35')]=_[_0x36fe('0x36')](_0x2e565f[_0x36fe('0x37')],_0x2e565f[_0x36fe('0x33')]);_0x3a75b8[_0x36fe('0x38')]=_[_0x36fe('0x36')](_0x2e565f[_0x36fe('0x37')],qs[_0x36fe('0x39')](_0x5d6f47[_0x36fe('0x33')][_0x36fe('0x39')]));_0x3a75b8[_0x36fe('0x38')]=_0x3a75b8[_0x36fe('0x38')]['length']?_0x3a75b8[_0x36fe('0x38')]:_0x2e565f[_0x36fe('0x37')];if(!_0x5d6f47[_0x36fe('0x33')]['hasOwnProperty'](_0x36fe('0x3a'))){_0x3a75b8['limit']=qs[_0x36fe('0x23')](_0x5d6f47[_0x36fe('0x33')][_0x36fe('0x23')]);_0x3a75b8[_0x36fe('0x20')]=qs[_0x36fe('0x20')](_0x5d6f47[_0x36fe('0x33')][_0x36fe('0x20')]);}_0x3a75b8['order']=qs[_0x36fe('0x3b')](_0x5d6f47[_0x36fe('0x33')][_0x36fe('0x3b')]);_0x3a75b8[_0x36fe('0x3c')]=qs['filters'](_[_0x36fe('0x3d')](_0x5d6f47['query'],_0x2e565f[_0x36fe('0x35')]),_0x56f5b6);if(_0x5d6f47['query'][_0x36fe('0x3e')]){_0x3a75b8['where']=_[_0x36fe('0x3f')](_0x3a75b8[_0x36fe('0x3c')],{'$or':_['map'](_0x56f5b6,function(_0xde7dac){if(_0xde7dac['type']!=='VIRTUAL'){var _0x252f37={};_0x252f37[_0xde7dac[_0x36fe('0x2c')]]={'$like':'%'+_0x5d6f47['query']['filter']+'%'};return _0x252f37;}})});}_0x3a75b8=_[_0x36fe('0x3f')]({},_0x3a75b8,_0x5d6f47[_0x36fe('0x40')]);var _0x2e044f={'where':_0x3a75b8[_0x36fe('0x3c')]};return db[_0x36fe('0x41')][_0x36fe('0x22')](_0x2e044f)[_0x36fe('0x27')](function(_0xedcfba){_0x2b0f2f['count']=_0xedcfba;if(_0x5d6f47['query']['includeAll']){_0x3a75b8['include']=[{'all':!![]}];}return db[_0x36fe('0x41')][_0x36fe('0x42')](_0x3a75b8);})[_0x36fe('0x27')](function(_0x33b62b){_0x2b0f2f[_0x36fe('0x43')]=_0x33b62b;return _0x2b0f2f;})['then'](respondWithFilteredResult(_0x121715,_0x3a75b8))[_0x36fe('0x44')](handleError(_0x121715,null));};exports[_0x36fe('0x45')]=function(_0x5c0812,_0x6897b8){var _0x46bde0={'raw':![],'where':{'id':_0x5c0812['params']['id']}},_0x3d7421={};_0x3d7421['model']=_[_0x36fe('0x34')](db['VoiceQueueReport'][_0x36fe('0x2f')]);_0x3d7421['query']=_['keys'](_0x5c0812[_0x36fe('0x33')]);_0x3d7421[_0x36fe('0x35')]=_[_0x36fe('0x36')](_0x3d7421[_0x36fe('0x37')],_0x3d7421['query']);_0x46bde0[_0x36fe('0x38')]=_[_0x36fe('0x36')](_0x3d7421[_0x36fe('0x37')],qs[_0x36fe('0x39')](_0x5c0812[_0x36fe('0x33')][_0x36fe('0x39')]));_0x46bde0[_0x36fe('0x38')]=_0x46bde0[_0x36fe('0x38')][_0x36fe('0x46')]?_0x46bde0[_0x36fe('0x38')]:_0x3d7421['model'];if(_0x5c0812['query'][_0x36fe('0x47')]){_0x46bde0[_0x36fe('0x48')]=[{'all':!![]}];}_0x46bde0=_[_0x36fe('0x3f')]({},_0x46bde0,_0x5c0812[_0x36fe('0x40')]);return db['VoiceQueueReport']['find'](_0x46bde0)[_0x36fe('0x27')](handleEntityNotFound(_0x6897b8,null))[_0x36fe('0x27')](respondWithResult(_0x6897b8,null))[_0x36fe('0x44')](handleError(_0x6897b8,null));};exports[_0x36fe('0x49')]=function(_0x51732d,_0x33075a){return db[_0x36fe('0x41')][_0x36fe('0x49')](_0x51732d[_0x36fe('0x4a')],{})[_0x36fe('0x27')](respondWithResult(_0x33075a,0xc9))[_0x36fe('0x44')](handleError(_0x33075a,null));};exports['update']=function(_0x97837a,_0x50a3d4){if(_0x97837a['body']['id']){delete _0x97837a['body']['id'];}return db[_0x36fe('0x41')][_0x36fe('0x4b')]({'where':{'id':_0x97837a[_0x36fe('0x4c')]['id']}})[_0x36fe('0x27')](handleEntityNotFound(_0x50a3d4,null))[_0x36fe('0x27')](saveUpdates(_0x97837a['body'],null))['then'](respondWithResult(_0x50a3d4,null))['catch'](handleError(_0x50a3d4,null));};exports[_0x36fe('0x28')]=function(_0x5bd841,_0x2ad0b1){return db['VoiceQueueReport']['find']({'where':{'id':_0x5bd841['params']['id']}})[_0x36fe('0x27')](handleEntityNotFound(_0x2ad0b1,null))[_0x36fe('0x27')](removeEntity(_0x2ad0b1,null))[_0x36fe('0x44')](handleError(_0x2ad0b1,null));};exports[_0x36fe('0x4d')]=function(_0x44f42f,_0x49a7c8){return db[_0x36fe('0x41')][_0x36fe('0x4d')]()[_0x36fe('0x27')](respondWithResult(_0x49a7c8,null))[_0x36fe('0x44')](handleError(_0x49a7c8,null));};exports[_0x36fe('0x4e')]=function(_0x48a736,_0xeab8d6){var _0x1ff06a={},_0x2994b5={},_0x5e4177={'count':0x0,'rows':[]};_0x2994b5[_0x36fe('0x37')]=_[_0x36fe('0x34')](db[_0x36fe('0x41')]['rawAttributes']);_0x2994b5['query']=_[_0x36fe('0x34')](_0x48a736[_0x36fe('0x33')]);_0x2994b5['filters']=_[_0x36fe('0x36')](_0x2994b5[_0x36fe('0x37')],_0x2994b5[_0x36fe('0x33')]);_0x1ff06a[_0x36fe('0x38')]=_[_0x36fe('0x36')](_0x2994b5[_0x36fe('0x37')],qs[_0x36fe('0x39')](_0x48a736['query'][_0x36fe('0x39')]));_0x1ff06a[_0x36fe('0x38')]=_0x1ff06a['attributes'][_0x36fe('0x46')]?_0x1ff06a['attributes']:_0x2994b5['model'];if(!_0x48a736[_0x36fe('0x33')][_0x36fe('0x4f')](_0x36fe('0x3a'))){_0x1ff06a[_0x36fe('0x23')]=qs[_0x36fe('0x23')](_0x48a736[_0x36fe('0x33')][_0x36fe('0x23')]);_0x1ff06a['offset']=qs[_0x36fe('0x20')](_0x48a736[_0x36fe('0x33')][_0x36fe('0x20')]);}_0x1ff06a['order']=qs[_0x36fe('0x3b')](_0x48a736['query'][_0x36fe('0x3b')]);_0x1ff06a[_0x36fe('0x3c')]=qs['filters'](_[_0x36fe('0x3d')](_0x48a736['query'],_0x2994b5[_0x36fe('0x35')]));if(_0x48a736['query'][_0x36fe('0x3e')]){_0x1ff06a['where']=_[_0x36fe('0x3f')](_0x1ff06a['where'],{'$or':_[_0x36fe('0x2e')](_0x1ff06a[_0x36fe('0x38')],function(_0x4eb5d0){var _0x2a1820={};_0x2a1820[_0x4eb5d0]={'$like':'%'+_0x48a736['query']['filter']+'%'};return _0x2a1820;})});}_0x1ff06a=_['merge']({},_0x1ff06a,_0x48a736['options']);var _0x24e3e0={'where':_0x1ff06a[_0x36fe('0x3c')]};return db[_0x36fe('0x41')][_0x36fe('0x22')](_0x24e3e0)[_0x36fe('0x27')](function(_0xe9efc0){_0x5e4177['count']=_0xe9efc0;if(_0x48a736[_0x36fe('0x33')][_0x36fe('0x47')]){_0x1ff06a['include']=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x1ff06a);})[_0x36fe('0x27')](function(_0x375ce8){_0x5e4177[_0x36fe('0x43')]=_0x375ce8;return _0x5e4177;})[_0x36fe('0x27')](respondWithFilteredResult(_0xeab8d6,_0x1ff06a,_0x36fe('0x4e')))[_0x36fe('0x44')](handleError(_0xeab8d6,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index debf902..d26da90 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 _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 +var _0x9ffc=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update'];(function(_0x16bfc5,_0x4f9dc3){var _0x43b820=function(_0x363ced){while(--_0x363ced){_0x16bfc5['push'](_0x16bfc5['shift']());}};_0x43b820(++_0x4f9dc3);}(_0x9ffc,0x1c7));var _0xc9ff=function(_0x545fe3,_0x3b191f){_0x545fe3=_0x545fe3-0x0;var _0x480702=_0x9ffc[_0x545fe3];return _0x480702;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xc9ff('0x0'))['db'][_0xc9ff('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xc9ff('0x2')](0x0);var events={'afterCreate':_0xc9ff('0x3'),'afterUpdate':_0xc9ff('0x4'),'afterDestroy':_0xc9ff('0x5')};function emitEvent(_0x4842f4){return function(_0x36279d,_0x3a8d14,_0x35e55f){VoiceQueueReportEvents[_0xc9ff('0x6')](_0x4842f4+':'+_0x36279d['id'],_0x36279d);VoiceQueueReportEvents[_0xc9ff('0x6')](_0x4842f4,_0x36279d);_0x35e55f(null);};}for(var e in events){if(events[_0xc9ff('0x7')](e)){var event=events[e];VoiceQueueReport[_0xc9ff('0x8')](e,emitEvent(event));}}module[_0xc9ff('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 d35fe7a..8b5c8a2 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 _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 +var _0xb0d3=['define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x57194e,_0x35731d){var _0x5da5d2=function(_0x586328){while(--_0x586328){_0x57194e['push'](_0x57194e['shift']());}};_0x5da5d2(++_0x35731d);}(_0xb0d3,0xd5));var _0x3b0d=function(_0x44c935,_0x3653f0){_0x44c935=_0x44c935-0x0;var _0x465bee=_0xb0d3[_0x44c935];return _0x465bee;};'use strict';var _=require(_0x3b0d('0x0'));var util=require(_0x3b0d('0x1'));var logger=require(_0x3b0d('0x2'))('api');var moment=require(_0x3b0d('0x3'));var BPromise=require(_0x3b0d('0x4'));var rp=require(_0x3b0d('0x5'));var fs=require('fs');var path=require(_0x3b0d('0x6'));var rimraf=require(_0x3b0d('0x7'));var config=require(_0x3b0d('0x8'));var attributes=require(_0x3b0d('0x9'));module[_0x3b0d('0xa')]=function(_0x4ce158,_0x1834dc){return _0x4ce158[_0x3b0d('0xb')](_0x3b0d('0xc'),attributes,{'tableName':_0x3b0d('0xd'),'paranoid':![],'indexes':[{'fields':[_0x3b0d('0xe')]},{'fields':[_0x3b0d('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index f04eb72..3c3c441 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 _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 +var _0xf0d0=['http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetVoiceQueueReport','findAll','options','where','attributes','limit','include','map','model','debug','CreateVoiceQueueReport','VoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','update','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x52c553,_0x273e5a){var _0x425607=function(_0x25f443){while(--_0x25f443){_0x52c553['push'](_0x52c553['shift']());}};_0x425607(++_0x273e5a);}(_0xf0d0,0x179));var _0x0f0d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf0d0[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x0f0d('0x0'));var moment=require(_0x0f0d('0x1'));var BPromise=require(_0x0f0d('0x2'));var rs=require(_0x0f0d('0x3'));var fs=require('fs');var Redis=require(_0x0f0d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0f0d('0x5'));var logger=require('../../config/logger')(_0x0f0d('0x6'));var config=require(_0x0f0d('0x7'));var jayson=require(_0x0f0d('0x8'));var client=jayson[_0x0f0d('0x9')][_0x0f0d('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x0f0d('0xb')],{'host':_0x0f0d('0xc'),'port':0x18eb});var socket=require(_0x0f0d('0xd'))(new Redis(config[_0x0f0d('0xb')]));require(_0x0f0d('0xe'))[_0x0f0d('0xf')](socket);function respondWithRpcPromise(_0x5be910,_0x1e713a,_0x4deaaf){return new BPromise(function(_0x205533,_0x39d625){return client[_0x0f0d('0x10')](_0x5be910,_0x4deaaf)[_0x0f0d('0x11')](function(_0x3748d0){logger[_0x0f0d('0x12')](_0x0f0d('0x13'),_0x1e713a,'request\x20sent');logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x1e713a,'request\x20sent',JSON[_0x0f0d('0x14')](_0x3748d0));if(_0x3748d0[_0x0f0d('0x15')]){if(_0x3748d0['error']['code']===0x1f4){logger[_0x0f0d('0x15')](_0x0f0d('0x13'),_0x1e713a,_0x3748d0['error'][_0x0f0d('0x16')]);return _0x39d625(_0x3748d0[_0x0f0d('0x15')][_0x0f0d('0x16')]);}logger[_0x0f0d('0x15')](_0x0f0d('0x13'),_0x1e713a,_0x3748d0[_0x0f0d('0x15')][_0x0f0d('0x16')]);return _0x205533(_0x3748d0[_0x0f0d('0x15')][_0x0f0d('0x16')]);}else{logger['info'](_0x0f0d('0x13'),_0x1e713a,_0x0f0d('0x17'));_0x205533(_0x3748d0[_0x0f0d('0x18')][_0x0f0d('0x16')]);}})[_0x0f0d('0x19')](function(_0x2c75f6){logger['error'](_0x0f0d('0x13'),_0x1e713a,_0x2c75f6);_0x39d625(_0x2c75f6);});});}exports[_0x0f0d('0x1a')]=function(_0x4cc866){var _0x232774=this;return new Promise(function(_0x2a1525,_0x2b6070){return db['VoiceQueueReport'][_0x0f0d('0x1b')]({'raw':_0x4cc866['options']?_0x4cc866[_0x0f0d('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4cc866[_0x0f0d('0x1c')]?_0x4cc866[_0x0f0d('0x1c')][_0x0f0d('0x1d')]||null:null,'attributes':_0x4cc866['options']?_0x4cc866[_0x0f0d('0x1c')][_0x0f0d('0x1e')]||null:null,'limit':_0x4cc866[_0x0f0d('0x1c')]?_0x4cc866['options'][_0x0f0d('0x1f')]||null:null,'include':_0x4cc866['options']?_0x4cc866[_0x0f0d('0x1c')][_0x0f0d('0x20')]?_[_0x0f0d('0x21')](_0x4cc866[_0x0f0d('0x1c')][_0x0f0d('0x20')],function(_0x577b03){return{'model':db[_0x577b03[_0x0f0d('0x22')]],'as':_0x577b03['as'],'attributes':_0x577b03['attributes'],'include':_0x577b03[_0x0f0d('0x20')]?_[_0x0f0d('0x21')](_0x577b03[_0x0f0d('0x20')],function(_0x3d2c54){return{'model':db[_0x3d2c54[_0x0f0d('0x22')]],'as':_0x3d2c54['as'],'attributes':_0x3d2c54['attributes'],'include':_0x3d2c54[_0x0f0d('0x20')]?_[_0x0f0d('0x21')](_0x3d2c54['include'],function(_0x5432ad){return{'model':db[_0x5432ad[_0x0f0d('0x22')]],'as':_0x5432ad['as'],'attributes':_0x5432ad['attributes']};}):[]};}):[]};}):[]:[]})[_0x0f0d('0x11')](function(_0x24f594){logger[_0x0f0d('0x12')](_0x0f0d('0x1a'),_0x4cc866);logger[_0x0f0d('0x23')]('GetVoiceQueueReport',_0x4cc866,JSON[_0x0f0d('0x14')](_0x24f594));_0x2a1525(_0x24f594);})[_0x0f0d('0x19')](function(_0x36467f){logger[_0x0f0d('0x15')](_0x0f0d('0x1a'),_0x36467f['message'],_0x4cc866);_0x2b6070(_0x232774[_0x0f0d('0x15')](0x1f4,_0x36467f[_0x0f0d('0x16')]));});});};exports[_0x0f0d('0x24')]=function(_0x4b315a){var _0x240451=this;return new Promise(function(_0x381b93,_0x5bde79){return db[_0x0f0d('0x25')][_0x0f0d('0x26')](_0x4b315a[_0x0f0d('0x27')],{'raw':_0x4b315a[_0x0f0d('0x1c')]?_0x4b315a[_0x0f0d('0x1c')][_0x0f0d('0x28')]===undefined?!![]:![]:!![]})[_0x0f0d('0x11')](function(_0x4ddbbf){logger[_0x0f0d('0x12')](_0x0f0d('0x24'),_0x4b315a);logger[_0x0f0d('0x23')]('CreateVoiceQueueReport',_0x4b315a,JSON['stringify'](_0x4ddbbf));_0x381b93(_0x4ddbbf);})[_0x0f0d('0x19')](function(_0x594c8a){logger[_0x0f0d('0x15')](_0x0f0d('0x24'),_0x594c8a['message'],_0x4b315a);_0x5bde79(_0x240451[_0x0f0d('0x15')](0x1f4,_0x594c8a['message']));});});};exports[_0x0f0d('0x29')]=function(_0x45c928){var _0x3284f5=this;return new Promise(function(_0x84ec4e,_0x3f1508){return db[_0x0f0d('0x25')][_0x0f0d('0x2a')](_0x45c928[_0x0f0d('0x27')],{'raw':_0x45c928['options']?_0x45c928[_0x0f0d('0x1c')][_0x0f0d('0x28')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45c928['options']?_0x45c928['options'][_0x0f0d('0x1d')]||null:null,'attributes':_0x45c928['options']?_0x45c928[_0x0f0d('0x1c')]['attributes']||null:null,'limit':_0x45c928['options']?_0x45c928[_0x0f0d('0x1c')][_0x0f0d('0x1f')]||null:null})['then'](function(_0x2bda5a){logger['info']('UpdateVoiceQueueReport',_0x45c928);logger[_0x0f0d('0x23')](_0x0f0d('0x29'),_0x45c928,JSON[_0x0f0d('0x14')](_0x2bda5a));_0x84ec4e(_0x2bda5a);})['catch'](function(_0x463cb6){logger[_0x0f0d('0x15')](_0x0f0d('0x29'),_0x463cb6[_0x0f0d('0x16')],_0x45c928);_0x3f1508(_0x3284f5['error'](0x1f4,_0x463cb6[_0x0f0d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index d136d36..30fc040 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 _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 +var _0x180b=['removeListener','register','length','./voiceQueueReport.events','save','remove','emit'];(function(_0x35acd9,_0x46b90a){var _0x421948=function(_0x231930){while(--_0x231930){_0x35acd9['push'](_0x35acd9['shift']());}};_0x421948(++_0x46b90a);}(_0x180b,0xdc));var _0xb180=function(_0x6c532f,_0x7cd1bd){_0x6c532f=_0x6c532f-0x0;var _0x1c30a0=_0x180b[_0x6c532f];return _0x1c30a0;};'use strict';var VoiceQueueReportEvents=require(_0xb180('0x0'));var events=[_0xb180('0x1'),_0xb180('0x2'),'update'];function createListener(_0x2ca54c,_0x73572d){return function(_0xcf0588){_0x73572d[_0xb180('0x3')](_0x2ca54c,_0xcf0588);};}function removeListener(_0x3e3627,_0x19d2d3){return function(){VoiceQueueReportEvents[_0xb180('0x4')](_0x3e3627,_0x19d2d3);};}exports[_0xb180('0x5')]=function(_0x417150){for(var _0x21e952=0x0,_0xb4f0ac=events[_0xb180('0x6')];_0x21e952<_0xb4f0ac;_0x21e952++){var _0x30b656=events[_0x21e952];var _0x274aac=createListener('voiceQueueReport:'+_0x30b656,_0x417150);VoiceQueueReportEvents['on'](_0x30b656,_0x274aac);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index ae6732f..ad12529 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 _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 +var _0x96a2=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','put','update'];(function(_0x34cbea,_0x5f0505){var _0x1874e5=function(_0x48923b){while(--_0x48923b){_0x34cbea['push'](_0x34cbea['shift']());}};_0x1874e5(++_0x5f0505);}(_0x96a2,0x96));var _0x296a=function(_0x3a12e7,_0x13fef6){_0x3a12e7=_0x3a12e7-0x0;var _0x390777=_0x96a2[_0x3a12e7];return _0x390777;};'use strict';var multer=require(_0x296a('0x0'));var util=require('util');var path=require(_0x296a('0x1'));var timeout=require(_0x296a('0x2'));var express=require(_0x296a('0x3'));var router=express[_0x296a('0x4')]();var fs_extra=require(_0x296a('0x5'));var auth=require(_0x296a('0x6'));var interaction=require(_0x296a('0x7'));var config=require(_0x296a('0x8'));var controller=require(_0x296a('0x9'));router[_0x296a('0xa')]('/',auth[_0x296a('0xb')](),controller[_0x296a('0xc')]);router[_0x296a('0xa')](_0x296a('0xd'),auth[_0x296a('0xb')](),controller[_0x296a('0xe')]);router[_0x296a('0xf')]('/',auth[_0x296a('0xb')](),controller['create']);router[_0x296a('0x10')](_0x296a('0xd'),auth['isAuthenticated'](),controller[_0x296a('0x11')]);router[_0x296a('0x12')](_0x296a('0xd'),auth[_0x296a('0xb')](),controller[_0x296a('0x13')]);module[_0x296a('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index a2ad3eb..c1263df 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 _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 +var _0xb974=['sequelize','moment','exports','STRING','DATE','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x357e60,_0x19aee5){var _0x594546=function(_0x476db3){while(--_0x476db3){_0x357e60['push'](_0x357e60['shift']());}};_0x594546(++_0x19aee5);}(_0xb974,0x1b6));var _0x4b97=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb974[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x4b97('0x0'));var moment=require(_0x4b97('0x1'));module[_0x4b97('0x2')]={'time':{'type':Sequelize[_0x4b97('0x3')]},'callid':{'type':Sequelize[_0x4b97('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x4b97('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x4b97('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x4b97('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x4b97('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x4b97('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x4b97('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x4b97('0x4')],'allowNull':![],'defaultValue':Sequelize['literal'](_0x4b97('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 52d482e..f3c65e8 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 _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 +var _0x2833=['intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','then','include','rows','show','params','keys','rawAttributes','body','catch','find','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','error','name','send','index','map','VoiceQueuesLog','type','key','model','query','filters'];(function(_0x4080bd,_0x1680da){var _0x55aa34=function(_0x5f7294){while(--_0x5f7294){_0x4080bd['push'](_0x4080bd['shift']());}};_0x55aa34(++_0x1680da);}(_0x2833,0x165));var _0x3283=function(_0x4fd1f9,_0x7d3902){_0x4fd1f9=_0x4fd1f9-0x0;var _0x3f74e8=_0x2833[_0x4fd1f9];return _0x3f74e8;};'use strict';var emlformat=require(_0x3283('0x0'));var rimraf=require(_0x3283('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3283('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3283('0x3'));var Mustache=require(_0x3283('0x4'));var util=require(_0x3283('0x5'));var path=require(_0x3283('0x6'));var sox=require(_0x3283('0x7'));var csv=require(_0x3283('0x8'));var ejs=require(_0x3283('0x9'));var fs=require('fs');var fs_extra=require(_0x3283('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3283('0xb'));var jsforce=require(_0x3283('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3283('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3283('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x3283('0xe'));var as=require(_0x3283('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3283('0x10'))(_0x3283('0x11'));var utils=require(_0x3283('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3283('0x13'))['db'];function respondWithStatusCode(_0x3bc663,_0xe25d5a){_0xe25d5a=_0xe25d5a||0xcc;return function(_0x47de91){if(_0x47de91){return _0x3bc663[_0x3283('0x14')](_0xe25d5a);}return _0x3bc663[_0x3283('0x15')](_0xe25d5a)[_0x3283('0x16')]();};}function respondWithResult(_0x4e3379,_0x5d12a4){_0x5d12a4=_0x5d12a4||0xc8;return function(_0x48c211){if(_0x48c211){return _0x4e3379['status'](_0x5d12a4)['json'](_0x48c211);}};}function respondWithFilteredResult(_0x2c9b48,_0x5c13e5){return function(_0x32718d){if(_0x32718d){var _0x13bdf6=typeof _0x5c13e5[_0x3283('0x17')]===_0x3283('0x18')&&typeof _0x5c13e5[_0x3283('0x19')]===_0x3283('0x18');var _0x127b9f=_0x32718d['count'];var _0x5908fb=_0x13bdf6?0x0:_0x5c13e5[_0x3283('0x17')];var _0x42cffc=_0x13bdf6?_0x32718d[_0x3283('0x1a')]:_0x5c13e5[_0x3283('0x17')]+_0x5c13e5['limit'];var _0x50b6d1;if(_0x42cffc>=_0x127b9f){_0x42cffc=_0x127b9f;_0x50b6d1=0xc8;}else{_0x50b6d1=0xce;}_0x2c9b48[_0x3283('0x15')](_0x50b6d1);return _0x2c9b48[_0x3283('0x1b')](_0x3283('0x1c'),_0x5908fb+'-'+_0x42cffc+'/'+_0x127b9f)[_0x3283('0x1d')](_0x32718d);}return null;};}function patchUpdates(_0x3d1b62){return function(_0xb2f26){try{jsonpatch['apply'](_0xb2f26,_0x3d1b62,!![]);}catch(_0x27bace){return BPromise[_0x3283('0x1e')](_0x27bace);}return _0xb2f26[_0x3283('0x1f')]();};}function saveUpdates(_0x34b3d8,_0x4db89a){return function(_0x215ff5){if(_0x215ff5){return _0x215ff5[_0x3283('0x20')](_0x34b3d8)['then'](function(_0x39d1cf){return _0x39d1cf;});}return null;};}function removeEntity(_0x50efea,_0x3ab096){return function(_0x2c12b3){if(_0x2c12b3){return _0x2c12b3[_0x3283('0x21')]()['then'](function(){_0x50efea['status'](0xcc)[_0x3283('0x16')]();});}};}function handleEntityNotFound(_0x1f9ef6,_0x1454e5){return function(_0x3426da){if(!_0x3426da){_0x1f9ef6[_0x3283('0x14')](0x194);}return _0x3426da;};}function handleError(_0x4f479c,_0x3c1584){_0x3c1584=_0x3c1584||0x1f4;return function(_0x1e2a32){logger[_0x3283('0x22')](_0x1e2a32['stack']);if(_0x1e2a32[_0x3283('0x23')]){delete _0x1e2a32[_0x3283('0x23')];}_0x4f479c[_0x3283('0x15')](_0x3c1584)[_0x3283('0x24')](_0x1e2a32);};}exports[_0x3283('0x25')]=function(_0x47386d,_0x95e762){var _0x5b0982={},_0x1c7ec5={},_0x148b1f={'count':0x0,'rows':[]};var _0x4e3d77=_[_0x3283('0x26')](db[_0x3283('0x27')]['rawAttributes'],function(_0x29d7a8){return{'name':_0x29d7a8['fieldName'],'type':_0x29d7a8[_0x3283('0x28')][_0x3283('0x29')]};});_0x1c7ec5[_0x3283('0x2a')]=_[_0x3283('0x26')](_0x4e3d77,'name');_0x1c7ec5[_0x3283('0x2b')]=_['keys'](_0x47386d[_0x3283('0x2b')]);_0x1c7ec5[_0x3283('0x2c')]=_[_0x3283('0x2d')](_0x1c7ec5['model'],_0x1c7ec5[_0x3283('0x2b')]);_0x5b0982[_0x3283('0x2e')]=_['intersection'](_0x1c7ec5[_0x3283('0x2a')],qs['fields'](_0x47386d[_0x3283('0x2b')]['fields']));_0x5b0982['attributes']=_0x5b0982['attributes'][_0x3283('0x2f')]?_0x5b0982[_0x3283('0x2e')]:_0x1c7ec5[_0x3283('0x2a')];if(!_0x47386d[_0x3283('0x2b')][_0x3283('0x30')](_0x3283('0x31'))){_0x5b0982[_0x3283('0x19')]=qs[_0x3283('0x19')](_0x47386d[_0x3283('0x2b')]['limit']);_0x5b0982[_0x3283('0x17')]=qs[_0x3283('0x17')](_0x47386d[_0x3283('0x2b')][_0x3283('0x17')]);}_0x5b0982[_0x3283('0x32')]=qs[_0x3283('0x33')](_0x47386d[_0x3283('0x2b')]['sort']);_0x5b0982[_0x3283('0x34')]=qs['filters'](_[_0x3283('0x35')](_0x47386d[_0x3283('0x2b')],_0x1c7ec5[_0x3283('0x2c')]),_0x4e3d77);if(_0x47386d['query']['filter']){_0x5b0982[_0x3283('0x34')]=_[_0x3283('0x36')](_0x5b0982[_0x3283('0x34')],{'$or':_[_0x3283('0x26')](_0x4e3d77,function(_0x426200){if(_0x426200[_0x3283('0x28')]!==_0x3283('0x37')){var _0x5ed034={};_0x5ed034[_0x426200[_0x3283('0x23')]]={'$like':'%'+_0x47386d['query']['filter']+'%'};return _0x5ed034;}})});}_0x5b0982=_['merge']({},_0x5b0982,_0x47386d[_0x3283('0x38')]);var _0x2ea829={'where':_0x5b0982[_0x3283('0x34')]};return db[_0x3283('0x27')][_0x3283('0x1a')](_0x2ea829)[_0x3283('0x39')](function(_0x1c500d){_0x148b1f[_0x3283('0x1a')]=_0x1c500d;if(_0x47386d['query']['includeAll']){_0x5b0982[_0x3283('0x3a')]=[{'all':!![]}];}return db[_0x3283('0x27')]['findAll'](_0x5b0982);})[_0x3283('0x39')](function(_0x53891c){_0x148b1f[_0x3283('0x3b')]=_0x53891c;return _0x148b1f;})[_0x3283('0x39')](respondWithFilteredResult(_0x95e762,_0x5b0982))['catch'](handleError(_0x95e762,null));};exports[_0x3283('0x3c')]=function(_0x532cad,_0x17953c){var _0x158299={'raw':!![],'where':{'id':_0x532cad[_0x3283('0x3d')]['id']}},_0x389fff={};_0x389fff[_0x3283('0x2a')]=_[_0x3283('0x3e')](db['VoiceQueuesLog'][_0x3283('0x3f')]);_0x389fff[_0x3283('0x2b')]=_[_0x3283('0x3e')](_0x532cad[_0x3283('0x2b')]);_0x389fff[_0x3283('0x2c')]=_[_0x3283('0x2d')](_0x389fff[_0x3283('0x2a')],_0x389fff[_0x3283('0x2b')]);_0x158299[_0x3283('0x2e')]=_[_0x3283('0x2d')](_0x389fff[_0x3283('0x2a')],qs['fields'](_0x532cad[_0x3283('0x2b')]['fields']));_0x158299[_0x3283('0x2e')]=_0x158299[_0x3283('0x2e')]['length']?_0x158299[_0x3283('0x2e')]:_0x389fff['model'];if(_0x532cad[_0x3283('0x2b')]['includeAll']){_0x158299[_0x3283('0x3a')]=[{'all':!![]}];}_0x158299=_['merge']({},_0x158299,_0x532cad[_0x3283('0x38')]);return db['VoiceQueuesLog']['find'](_0x158299)[_0x3283('0x39')](handleEntityNotFound(_0x17953c,null))[_0x3283('0x39')](respondWithResult(_0x17953c,null))['catch'](handleError(_0x17953c,null));};exports['create']=function(_0x5cf535,_0x42a4c5){return db[_0x3283('0x27')]['create'](_0x5cf535[_0x3283('0x40')],{})[_0x3283('0x39')](respondWithResult(_0x42a4c5,0xc9))[_0x3283('0x41')](handleError(_0x42a4c5,null));};exports[_0x3283('0x20')]=function(_0xe4e372,_0x5ef400){if(_0xe4e372['body']['id']){delete _0xe4e372[_0x3283('0x40')]['id'];}return db[_0x3283('0x27')]['find']({'where':{'id':_0xe4e372['params']['id']}})[_0x3283('0x39')](handleEntityNotFound(_0x5ef400,null))[_0x3283('0x39')](saveUpdates(_0xe4e372[_0x3283('0x40')],null))['then'](respondWithResult(_0x5ef400,null))['catch'](handleError(_0x5ef400,null));};exports[_0x3283('0x21')]=function(_0x70722c,_0x2280d0){return db[_0x3283('0x27')][_0x3283('0x42')]({'where':{'id':_0x70722c['params']['id']}})[_0x3283('0x39')](handleEntityNotFound(_0x2280d0,null))[_0x3283('0x39')](removeEntity(_0x2280d0,null))[_0x3283('0x41')](handleError(_0x2280d0,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index e9e8c60..2ff260f 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 _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 +var _0xaba3=['event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xaba3,0x123));var _0x3aba=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xaba3[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0x3aba('0x0'));var util=require(_0x3aba('0x1'));var logger=require(_0x3aba('0x2'))(_0x3aba('0x3'));var moment=require(_0x3aba('0x4'));var BPromise=require(_0x3aba('0x5'));var rp=require(_0x3aba('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3aba('0x7'));var config=require(_0x3aba('0x8'));var attributes=require('./voiceQueuesLog.attributes');module[_0x3aba('0x9')]=function(_0x4744b6,_0x244b06){return _0x4744b6[_0x3aba('0xa')](_0x3aba('0xb'),attributes,{'tableName':_0x3aba('0xc'),'paranoid':![],'indexes':[{'name':_0x3aba('0xd'),'fields':[_0x3aba('0xe'),_0x3aba('0xf')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 99d90c7..be250f2 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 _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 +var _0x7f8c=['http','then','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0xd8afde,_0xb44716){var _0xac65e8=function(_0x27e613){while(--_0x27e613){_0xd8afde['push'](_0xd8afde['shift']());}};_0xac65e8(++_0xb44716);}(_0x7f8c,0x139));var _0xc7f8=function(_0x251fb0,_0x529c14){_0x251fb0=_0x251fb0-0x0;var _0x1519c5=_0x7f8c[_0x251fb0];return _0x1519c5;};'use strict';var _=require(_0xc7f8('0x0'));var util=require(_0xc7f8('0x1'));var moment=require(_0xc7f8('0x2'));var BPromise=require(_0xc7f8('0x3'));var rs=require(_0xc7f8('0x4'));var fs=require('fs');var Redis=require(_0xc7f8('0x5'));var db=require(_0xc7f8('0x6'))['db'];var utils=require(_0xc7f8('0x7'));var logger=require(_0xc7f8('0x8'))('rpc');var config=require(_0xc7f8('0x9'));var jayson=require(_0xc7f8('0xa'));var client=jayson[_0xc7f8('0xb')][_0xc7f8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e747c,_0x4103c2,_0x289b0c){return new BPromise(function(_0x504ac1,_0xf64a22){return client['request'](_0x2e747c,_0x289b0c)[_0xc7f8('0xd')](function(_0x4d1667){logger[_0xc7f8('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4103c2,_0xc7f8('0xf'));logger[_0xc7f8('0x10')](_0xc7f8('0x11'),_0x4103c2,'request\x20sent',JSON[_0xc7f8('0x12')](_0x4d1667));if(_0x4d1667[_0xc7f8('0x13')]){if(_0x4d1667[_0xc7f8('0x13')][_0xc7f8('0x14')]===0x1f4){logger[_0xc7f8('0x13')](_0xc7f8('0x15'),_0x4103c2,_0x4d1667[_0xc7f8('0x13')]['message']);return _0xf64a22(_0x4d1667['error'][_0xc7f8('0x16')]);}logger[_0xc7f8('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4103c2,_0x4d1667['error'][_0xc7f8('0x16')]);return _0x504ac1(_0x4d1667[_0xc7f8('0x13')][_0xc7f8('0x16')]);}else{logger[_0xc7f8('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4103c2,'request\x20sent');_0x504ac1(_0x4d1667[_0xc7f8('0x17')][_0xc7f8('0x16')]);}})[_0xc7f8('0x18')](function(_0x5098fe){logger[_0xc7f8('0x13')](_0xc7f8('0x15'),_0x4103c2,_0x5098fe);_0xf64a22(_0x5098fe);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index fd6a8ca..fafcdbb 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 _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 +var _0xe20d=['downloadTranscribe','post','create','/:id/transcribe','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','index','isAuthenticated','describe','/:id','/:id/download','download','/:id/downloads'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xe20d,0x175));var _0xde20=function(_0x49f2bf,_0x461315){_0x49f2bf=_0x49f2bf-0x0;var _0x1897ac=_0xe20d[_0x49f2bf];return _0x1897ac;};'use strict';var multer=require(_0xde20('0x0'));var util=require('util');var path=require(_0xde20('0x1'));var timeout=require(_0xde20('0x2'));var express=require(_0xde20('0x3'));var router=express[_0xde20('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xde20('0x5'));var interaction=require(_0xde20('0x6'));var config=require(_0xde20('0x7'));var controller=require(_0xde20('0x8'));router[_0xde20('0x9')]('/',auth['isAuthenticated'](),controller[_0xde20('0xa')]);router[_0xde20('0x9')]('/describe',auth[_0xde20('0xb')](),controller[_0xde20('0xc')]);router[_0xde20('0x9')](_0xde20('0xd'),auth[_0xde20('0xb')](),controller['show']);router[_0xde20('0x9')](_0xde20('0xe'),auth[_0xde20('0xb')](),controller[_0xde20('0xf')]);router[_0xde20('0x9')](_0xde20('0x10'),controller['downloads']);router[_0xde20('0x9')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0xde20('0x11')]);router[_0xde20('0x12')]('/',auth[_0xde20('0xb')](),controller[_0xde20('0x13')]);router[_0xde20('0x12')](_0xde20('0x14'),auth[_0xde20('0xb')](),controller['runTranscribe']);router[_0xde20('0x15')](_0xde20('0xd'),auth['isAuthenticated'](),controller[_0xde20('0x16')]);router[_0xde20('0x17')](_0xde20('0xd'),auth['isAuthenticated'](),controller[_0xde20('0x18')]);module[_0xde20('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 66beee2..64a5339 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(_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 +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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 3a2b3bc..b46f437 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 _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 +var _0xe6c6=['pick','filters','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','params','length','include','create','body','update','describe','download','uniqueid','find','value','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','downloads','../../components/encryptor','sequelize','MD5','col','$and','push','Sequelize','extname','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','transcribeName','TranscriptionJob','TranscriptionJobStatus','runTranscribe','Setting','findOne','transcribe','transcribeAccountId','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','IN_PROGRESS','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','aws-sdk','uuid/v4','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','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','error','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','model','format','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where'];(function(_0x769a35,_0x2ac76a){var _0x3c21af=function(_0x502ac3){while(--_0x502ac3){_0x769a35['push'](_0x769a35['shift']());}};_0x3c21af(++_0x2ac76a);}(_0xe6c6,0xf9));var _0x6e6c=function(_0x33a75c,_0x4b9993){_0x33a75c=_0x33a75c-0x0;var _0x5e4aa7=_0xe6c6[_0x33a75c];return _0x5e4aa7;};'use strict';var emlformat=require(_0x6e6c('0x0'));var rimraf=require(_0x6e6c('0x1'));var zipdir=require(_0x6e6c('0x2'));var jsonpatch=require(_0x6e6c('0x3'));var rp=require(_0x6e6c('0x4'));var moment=require(_0x6e6c('0x5'));var BPromise=require(_0x6e6c('0x6'));var Mustache=require(_0x6e6c('0x7'));var util=require(_0x6e6c('0x8'));var path=require(_0x6e6c('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6e6c('0xa'));var fs=require('fs');var fs_extra=require(_0x6e6c('0xb'));var _=require(_0x6e6c('0xc'));var squel=require(_0x6e6c('0xd'));var crypto=require(_0x6e6c('0xe'));var jsforce=require(_0x6e6c('0xf'));var deskjs=require(_0x6e6c('0x10'));var toCsv=require(_0x6e6c('0x11'));var querystring=require(_0x6e6c('0x12'));var Papa=require(_0x6e6c('0x13'));var AWS=require(_0x6e6c('0x14'));var uuidv4=require(_0x6e6c('0x15'));var Redis=require(_0x6e6c('0x16'));var authService=require(_0x6e6c('0x17'));var qs=require(_0x6e6c('0x18'));var as=require(_0x6e6c('0x19'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6e6c('0x1a'))(_0x6e6c('0x1b'));var utils=require(_0x6e6c('0x1c'));var config=require(_0x6e6c('0x1d'));var licenseUtil=require(_0x6e6c('0x1e'));var db=require(_0x6e6c('0x1f'))['db'];function respondWithStatusCode(_0x17f996,_0xdbb83c){_0xdbb83c=_0xdbb83c||0xcc;return function(_0x5502ed){if(_0x5502ed){return _0x17f996[_0x6e6c('0x20')](_0xdbb83c);}return _0x17f996[_0x6e6c('0x21')](_0xdbb83c)[_0x6e6c('0x22')]();};}function respondWithResult(_0x31efa6,_0x3a731c){_0x3a731c=_0x3a731c||0xc8;return function(_0x58ad2e){if(_0x58ad2e){return _0x31efa6[_0x6e6c('0x21')](_0x3a731c)[_0x6e6c('0x23')](_0x58ad2e);}};}function respondWithFilteredResult(_0xe58846,_0x4a9d6f){return function(_0x3f91f5){if(_0x3f91f5){var _0x2bcf50=typeof _0x4a9d6f[_0x6e6c('0x24')]===_0x6e6c('0x25')&&typeof _0x4a9d6f[_0x6e6c('0x26')]===_0x6e6c('0x25');var _0x275109=_0x3f91f5['count'];var _0x54fa0d=_0x2bcf50?0x0:_0x4a9d6f[_0x6e6c('0x24')];var _0x56d7de=_0x2bcf50?_0x3f91f5[_0x6e6c('0x27')]:_0x4a9d6f[_0x6e6c('0x24')]+_0x4a9d6f[_0x6e6c('0x26')];var _0x4c3644;if(_0x56d7de>=_0x275109){_0x56d7de=_0x275109;_0x4c3644=0xc8;}else{_0x4c3644=0xce;}_0xe58846[_0x6e6c('0x21')](_0x4c3644);return _0xe58846['set'](_0x6e6c('0x28'),_0x54fa0d+'-'+_0x56d7de+'/'+_0x275109)[_0x6e6c('0x23')](_0x3f91f5);}return null;};}function patchUpdates(_0x1a8102){return function(_0x26c8a2){try{jsonpatch[_0x6e6c('0x29')](_0x26c8a2,_0x1a8102,!![]);}catch(_0x420db0){return BPromise[_0x6e6c('0x2a')](_0x420db0);}return _0x26c8a2['save']();};}function saveUpdates(_0x5c603f,_0x542719){return function(_0x5f5d68){if(_0x5f5d68){return _0x5f5d68['update'](_0x5c603f)[_0x6e6c('0x2b')](function(_0x2ddf04){return _0x2ddf04;});}return null;};}function removeEntity(_0x272f29,_0x4518a9){return function(_0x2b3ab6){if(_0x2b3ab6){return _0x2b3ab6[_0x6e6c('0x2c')]()[_0x6e6c('0x2b')](function(){_0x272f29[_0x6e6c('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x378e2f,_0x43ad4b){return function(_0x59a749){if(!_0x59a749){_0x378e2f[_0x6e6c('0x20')](0x194);}return _0x59a749;};}function handleError(_0x2418e0,_0x42845f){_0x42845f=_0x42845f||0x1f4;return function(_0x38b7d3){logger[_0x6e6c('0x2d')](_0x38b7d3['stack']);if(_0x38b7d3[_0x6e6c('0x2e')]){delete _0x38b7d3[_0x6e6c('0x2e')];}_0x2418e0[_0x6e6c('0x21')](_0x42845f)[_0x6e6c('0x2f')](_0x38b7d3);};}exports[_0x6e6c('0x30')]=function(_0x43d79a,_0x2d6500){var _0x473f7f={},_0x48cdf5={},_0x5a5814={'count':0x0,'rows':[]};var _0xb4f945=_[_0x6e6c('0x31')](db[_0x6e6c('0x32')][_0x6e6c('0x33')],function(_0x2a8013){return{'name':_0x2a8013[_0x6e6c('0x34')],'type':_0x2a8013[_0x6e6c('0x35')]['key']};});_0x48cdf5[_0x6e6c('0x36')]=_['differenceBy'](_[_0x6e6c('0x31')](_0xb4f945,_0x6e6c('0x2e')),[_0x6e6c('0x37')]);_0x48cdf5[_0x6e6c('0x38')]=_[_0x6e6c('0x39')](_0x43d79a[_0x6e6c('0x38')]);_0x48cdf5['filters']=_[_0x6e6c('0x3a')](_0x48cdf5[_0x6e6c('0x36')],_0x48cdf5[_0x6e6c('0x38')]);_0x473f7f[_0x6e6c('0x3b')]=_[_0x6e6c('0x3a')](_0x48cdf5[_0x6e6c('0x36')],qs[_0x6e6c('0x3c')](_0x43d79a['query'][_0x6e6c('0x3c')]));_0x473f7f[_0x6e6c('0x3b')]=_0x473f7f[_0x6e6c('0x3b')]['length']?_0x473f7f['attributes']:_0x48cdf5[_0x6e6c('0x36')];if(!_0x43d79a[_0x6e6c('0x38')][_0x6e6c('0x3d')](_0x6e6c('0x3e'))){_0x473f7f[_0x6e6c('0x26')]=qs[_0x6e6c('0x26')](_0x43d79a[_0x6e6c('0x38')][_0x6e6c('0x26')]);_0x473f7f[_0x6e6c('0x24')]=qs['offset'](_0x43d79a[_0x6e6c('0x38')][_0x6e6c('0x24')]);}_0x473f7f['order']=qs[_0x6e6c('0x3f')](_0x43d79a[_0x6e6c('0x38')]['sort']);_0x473f7f[_0x6e6c('0x40')]=qs['filters'](_[_0x6e6c('0x41')](_0x43d79a[_0x6e6c('0x38')],_0x48cdf5[_0x6e6c('0x42')]),_0xb4f945);if(_0x43d79a[_0x6e6c('0x38')]['filter']){_0x473f7f[_0x6e6c('0x40')]=_['merge'](_0x473f7f[_0x6e6c('0x40')],{'$or':_[_0x6e6c('0x31')](_0xb4f945,function(_0x5a98b0){if(_0x5a98b0[_0x6e6c('0x35')]!==_0x6e6c('0x43')){var _0x59bdf7={};_0x59bdf7[_0x5a98b0[_0x6e6c('0x2e')]]={'$like':'%'+_0x43d79a['query'][_0x6e6c('0x44')]+'%'};return _0x59bdf7;}})});}_0x473f7f=_[_0x6e6c('0x45')]({},_0x473f7f,_0x43d79a[_0x6e6c('0x46')]);var _0x126449={'where':_0x473f7f[_0x6e6c('0x40')]};return db[_0x6e6c('0x32')][_0x6e6c('0x27')](_0x126449)[_0x6e6c('0x2b')](function(_0x137645){_0x5a5814[_0x6e6c('0x27')]=_0x137645;if(_0x43d79a['query'][_0x6e6c('0x47')]){_0x473f7f['include']=[{'all':!![]}];}return db['VoiceRecording'][_0x6e6c('0x48')](_0x473f7f);})['then'](function(_0x15d1d4){_0x5a5814[_0x6e6c('0x49')]=_0x15d1d4;return _0x5a5814;})[_0x6e6c('0x2b')](respondWithFilteredResult(_0x2d6500,_0x473f7f))[_0x6e6c('0x4a')](handleError(_0x2d6500,null));};exports['show']=function(_0x40623e,_0x1cdb89){var _0x416ff9={'raw':![],'where':{'id':_0x40623e[_0x6e6c('0x4b')]['id']}},_0x47e087={};_0x47e087[_0x6e6c('0x36')]=_[_0x6e6c('0x39')](db[_0x6e6c('0x32')][_0x6e6c('0x33')]);_0x47e087[_0x6e6c('0x38')]=_['keys'](_0x40623e['query']);_0x47e087['filters']=_[_0x6e6c('0x3a')](_0x47e087[_0x6e6c('0x36')],_0x47e087[_0x6e6c('0x38')]);_0x416ff9[_0x6e6c('0x3b')]=_[_0x6e6c('0x3a')](_0x47e087[_0x6e6c('0x36')],qs[_0x6e6c('0x3c')](_0x40623e['query'][_0x6e6c('0x3c')]));_0x416ff9[_0x6e6c('0x3b')]=_0x416ff9[_0x6e6c('0x3b')][_0x6e6c('0x4c')]?_0x416ff9[_0x6e6c('0x3b')]:_0x47e087[_0x6e6c('0x36')];if(_0x40623e['query'][_0x6e6c('0x47')]){_0x416ff9[_0x6e6c('0x4d')]=[{'all':!![]}];}_0x416ff9=_[_0x6e6c('0x45')]({},_0x416ff9,_0x40623e['options']);return db[_0x6e6c('0x32')]['find'](_0x416ff9)['then'](handleEntityNotFound(_0x1cdb89,null))['then'](respondWithResult(_0x1cdb89,null))[_0x6e6c('0x4a')](handleError(_0x1cdb89,null));};exports[_0x6e6c('0x4e')]=function(_0xd550d9,_0x3dd040){return db['VoiceRecording'][_0x6e6c('0x4e')](_0xd550d9[_0x6e6c('0x4f')],{})[_0x6e6c('0x2b')](respondWithResult(_0x3dd040,0xc9))[_0x6e6c('0x4a')](handleError(_0x3dd040,null));};exports[_0x6e6c('0x50')]=function(_0x1d915b,_0xe49b36){if(_0x1d915b['body']['id']){delete _0x1d915b['body']['id'];}return db[_0x6e6c('0x32')]['find']({'where':{'id':_0x1d915b[_0x6e6c('0x4b')]['id']}})[_0x6e6c('0x2b')](handleEntityNotFound(_0xe49b36,null))['then'](saveUpdates(_0x1d915b[_0x6e6c('0x4f')],null))[_0x6e6c('0x2b')](respondWithResult(_0xe49b36,null))[_0x6e6c('0x4a')](handleError(_0xe49b36,null));};exports[_0x6e6c('0x51')]=function(_0x18a919,_0x2b6944){return db[_0x6e6c('0x32')][_0x6e6c('0x51')]()[_0x6e6c('0x2b')](respondWithResult(_0x2b6944,null))[_0x6e6c('0x4a')](handleError(_0x2b6944,null));};exports[_0x6e6c('0x52')]=function(_0x56431b,_0x29857d,_0x5358e7){var _0x36ecb1=require('../../components/encryptor');var _0x4d13fb=![];var _0x4dab82={};if(_0x56431b['query'][_0x6e6c('0x35')]&&_0x56431b[_0x6e6c('0x38')]['type']==='uniqueid'){_0x4dab82[_0x6e6c('0x53')]=_0x56431b[_0x6e6c('0x4b')]['id'];}else{_0x4dab82['id']=_0x56431b[_0x6e6c('0x4b')]['id'];}return db[_0x6e6c('0x32')][_0x6e6c('0x54')]({'where':_0x4dab82,'attributes':['id',_0x6e6c('0x55')],'raw':!![]})[_0x6e6c('0x2b')](handleEntityNotFound(_0x29857d,null))[_0x6e6c('0x2b')](function(_0x32f048){if(_0x32f048){var _0x452217=_0x32f048[_0x6e6c('0x55')];var _0x47a7d5=util[_0x6e6c('0x37')](_0x6e6c('0x56'),_0x452217);if(fs[_0x6e6c('0x57')](_0x47a7d5)){_0x4d13fb=!![];return _0x36ecb1[_0x6e6c('0x58')](_0x47a7d5,_0x452217,config[_0x6e6c('0x59')][_0x6e6c('0x5a')])['then'](function(){return _0x32f048;});}return _0x32f048;}})[_0x6e6c('0x2b')](function(_0x48cf6e){if(_0x48cf6e){var _0x1c7243=_0x48cf6e[_0x6e6c('0x55')];if(!fs[_0x6e6c('0x57')](_0x1c7243)){throw new db['Sequelize'][(_0x6e6c('0x5b'))](_0x6e6c('0x5c'));}if(_0x48cf6e[_0x6e6c('0x5d')]){return _0x29857d[_0x6e6c('0x52')](_0x1c7243,_0x48cf6e[_0x6e6c('0x5d')]+path['extname'](_0x1c7243),function(){if(_0x4d13fb){fs[_0x6e6c('0x5e')](_0x1c7243);}});}else{return _0x29857d[_0x6e6c('0x52')](_0x1c7243,function(_0x1cc366){if(_0x4d13fb){fs[_0x6e6c('0x5e')](_0x1c7243);}});}}})[_0x6e6c('0x4a')](function(_0x1f396a){if(_0x1f396a[_0x6e6c('0x5f')]==='VoiceRecording\x20not\x20found'){_0x29857d[_0x6e6c('0x21')](0x194)[_0x6e6c('0x2f')](_0x6e6c('0x60'));}else{return handleError(_0x29857d,null);}});};exports[_0x6e6c('0x61')]=function(_0x99624a,_0x15d3a9,_0x475060){var _0x58c5a4=require(_0x6e6c('0x62'));var _0x192762=![];var _0x4ba9fd={'$and':[db[_0x6e6c('0x63')][_0x6e6c('0x40')](db[_0x6e6c('0x63')]['fn'](_0x6e6c('0x64'),db[_0x6e6c('0x63')][_0x6e6c('0x65')]('uniqueid')),_0x99624a['query']['token'])]};if(_0x99624a[_0x6e6c('0x38')][_0x6e6c('0x35')]&&_0x99624a[_0x6e6c('0x38')]['type']===_0x6e6c('0x53')){_0x4ba9fd[_0x6e6c('0x66')]['push']({'uniqueid':_0x99624a['params']['id']});}else{_0x4ba9fd[_0x6e6c('0x66')][_0x6e6c('0x67')]({'id':_0x99624a[_0x6e6c('0x4b')]['id']});}return db[_0x6e6c('0x32')][_0x6e6c('0x54')]({'where':_0x4ba9fd,'attributes':['id',_0x6e6c('0x55')],'raw':!![]})[_0x6e6c('0x2b')](handleEntityNotFound(_0x15d3a9,null))[_0x6e6c('0x2b')](function(_0x2761ab){if(_0x2761ab){var _0x195abf=util[_0x6e6c('0x37')](_0x6e6c('0x56'),_0x2761ab['value']);if(fs[_0x6e6c('0x57')](_0x195abf)){_0x192762=!![];return _0x58c5a4[_0x6e6c('0x58')](_0x195abf,_0x2761ab[_0x6e6c('0x55')],config['secrets'][_0x6e6c('0x5a')])[_0x6e6c('0x2b')](function(){return _0x2761ab;});}return _0x2761ab;}})[_0x6e6c('0x2b')](function(_0x4bd608){if(_0x4bd608){if(!fs[_0x6e6c('0x57')](_0x4bd608['value'])){throw new db[(_0x6e6c('0x68'))][(_0x6e6c('0x5b'))](_0x6e6c('0x5c'));}if(_0x4bd608[_0x6e6c('0x5d')]){return _0x15d3a9['download'](_0x4bd608['value'],_0x4bd608[_0x6e6c('0x5d')]+path[_0x6e6c('0x69')](_0x4bd608[_0x6e6c('0x55')]),function(){if(_0x192762){fs[_0x6e6c('0x5e')](_0x4bd608[_0x6e6c('0x55')]);}});}else{return _0x15d3a9['download'](_0x4bd608[_0x6e6c('0x55')],function(_0x4b5de5){if(_0x192762){fs[_0x6e6c('0x5e')](_0x4bd608['value']);}});}}})[_0x6e6c('0x4a')](handleError(_0x15d3a9,null));};exports[_0x6e6c('0x2c')]=function(_0x1e76f7,_0x389276){return db[_0x6e6c('0x32')][_0x6e6c('0x54')]({'where':{'id':_0x1e76f7['params']['id']}})[_0x6e6c('0x2b')](function(_0x29a1ef){if(_[_0x6e6c('0x6a')](_0x29a1ef)){throw new ReferenceError(_0x6e6c('0x6b'));}return _0x29a1ef;})['then'](function(_0x1d5e05){var _0x5e7fb1=_0x1d5e05[_0x6e6c('0x55')];logger[_0x6e6c('0x6c')](_0x6e6c('0x6d'),_0x5e7fb1);if(!_[_0x6e6c('0x6a')](_0x1d5e05[_0x6e6c('0x55')])&&fs[_0x6e6c('0x57')](_0x5e7fb1)){logger[_0x6e6c('0x6c')](_0x6e6c('0x6e')+_0x5e7fb1+_0x6e6c('0x6f'));fs[_0x6e6c('0x70')](_0x5e7fb1);}_0x5e7fb1=_0x5e7fb1+'.cypher';if(!_['isNil'](_0x1d5e05[_0x6e6c('0x55')])&&fs['existsSync'](_0x5e7fb1)){logger[_0x6e6c('0x6c')](_0x6e6c('0x6e')+_0x5e7fb1+_0x6e6c('0x6f'));fs[_0x6e6c('0x70')](_0x5e7fb1);}return _0x1d5e05;})['then'](function(_0x264f78){if(!_0x264f78)throw new InternalError();return _0x264f78[_0x6e6c('0x2c')]();})['then'](function(){_0x389276[_0x6e6c('0x21')](0xcc)[_0x6e6c('0x22')]();})[_0x6e6c('0x4a')](handleError(_0x389276,null));};function getBucketslist(_0x2e1891,_0xc1f4e,_0x366e00){return new Promise(function(_0x3b5f31,_0x1be532){var _0x37d56e=new AWS['S3']({'accessKeyId':_0xc1f4e,'secretAccessKey':_0x2e1891,'region':_0x366e00});_0x37d56e[_0x6e6c('0x71')]({},function(_0x35c1b6,_0x32faa9){if(_0x35c1b6){return _0x1be532(_0x35c1b6);}else{return _0x3b5f31(_0x32faa9);}});});}function createBucket(_0x52a04a,_0x4421fb,_0x1c2913,_0xd3d5d2){return new Promise(function(_0x59fb2b,_0x258517){var _0x5bff9d=new AWS['S3']({'accessKeyId':_0x4421fb,'secretAccessKey':_0x52a04a,'region':_0x1c2913});_0x5bff9d['createBucket']({'Bucket':_0xd3d5d2},function(_0x4a824a,_0x23d6df){if(_0x4a824a){return _0x258517(_0x4a824a);}else{return _0x59fb2b(_0x23d6df);}});});}function uploadFile(_0x2103bc,_0x1da89f,_0x3842b1,_0x536b8d,_0x1c7ec8,_0x25ff9c){return new Promise(function(_0x445526,_0x442afd){var _0x2dbd6b=new AWS['S3']({'accessKeyId':_0x1da89f,'secretAccessKey':_0x2103bc,'region':_0x3842b1});_0x2dbd6b[_0x6e6c('0x72')]({'Bucket':_0x536b8d,'Key':_0x1c7ec8,'Body':_0x25ff9c},function(_0x154c85,_0x1fa4a3){if(_0x154c85){return _0x442afd(_0x154c85);}else{return _0x445526(_0x1fa4a3);}});});}function startTranscribe(_0x4ce854,_0xb7d34a,_0x1ef718,_0x670685,_0x463ec6,_0x15a6f8){return new Promise(function(_0xa70228,_0x296896){var _0x3b6d2b=new AWS[(_0x6e6c('0x73'))]({'accessKeyId':_0xb7d34a,'secretAccessKey':_0x4ce854,'region':_0x1ef718});_0x3b6d2b[_0x6e6c('0x74')]({'TranscriptionJobName':_0x670685,'LanguageCode':_0x463ec6,'Media':{'MediaFileUri':_0x15a6f8}},function(_0x3cea15,_0x2d674b){if(_0x3cea15){return _0x296896(_0x3cea15);}else{return _0xa70228(_0x2d674b);}});});}function transcribe(_0x4e5b42,_0x4217ab,_0x490512,_0x11c38f,_0x4bdd82,_0x46b86b,_0x35dc74){return new Promise(function(_0x419874,_0x241913){var _0x1aa152={};logger[_0x6e6c('0x6c')](util[_0x6e6c('0x37')](_0x6e6c('0x75'),_0x4e5b42,_0x4bdd82));return uploadFile(_0x4217ab,_0x490512,_0x11c38f,_0x4bdd82,path[_0x6e6c('0x76')](_0x46b86b),fs['readFileSync'](_0x46b86b))[_0x6e6c('0x2b')](function(_0x244caf){logger[_0x6e6c('0x6c')](util['format'](_0x6e6c('0x77'),_0x4e5b42,_0x4bdd82,_0x244caf[_0x6e6c('0x78')]));_0x1aa152[_0x6e6c('0x79')]=_0x244caf[_0x6e6c('0x7a')];_0x1aa152[_0x6e6c('0x7b')]=_0x244caf[_0x6e6c('0x78')];logger[_0x6e6c('0x6c')](util[_0x6e6c('0x37')](_0x6e6c('0x7c'),_0x4e5b42));return startTranscribe(_0x4217ab,_0x490512,_0x11c38f,uuidv4(),_0x35dc74,_0x244caf['Location']);})['then'](function(_0x22354e){logger[_0x6e6c('0x6c')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x4e5b42,_0x22354e['TranscriptionJob']['TranscriptionJobName']));_0x1aa152[_0x6e6c('0x7d')]=_0x22354e['TranscriptionJob']['TranscriptionJobName'];_0x1aa152['transcribeStatus']=_0x22354e[_0x6e6c('0x7e')][_0x6e6c('0x7f')];return _0x419874(_0x1aa152);})[_0x6e6c('0x4a')](function(_0x498afa){return _0x241913(_0x498afa);});});}exports[_0x6e6c('0x80')]=function(_0x22c6d4,_0x2a11ef,_0x4621de){var _0x306826;var _0x3ed98d;var _0x5141f5;var _0x158692=require(_0x6e6c('0x62'));return db[_0x6e6c('0x32')]['findOne']({'where':{'id':_0x22c6d4[_0x6e6c('0x4b')]['id']}})[_0x6e6c('0x2b')](function(_0x187b55){if(_0x187b55){var _0x57da4d=util[_0x6e6c('0x37')](_0x6e6c('0x56'),_0x187b55['value']);if(fs[_0x6e6c('0x57')](_0x57da4d)){cypher=!![];return _0x158692[_0x6e6c('0x58')](_0x57da4d,_0x187b55[_0x6e6c('0x55')],config[_0x6e6c('0x59')]['recording'])[_0x6e6c('0x2b')](function(){return _0x187b55;});}return _0x187b55;}})[_0x6e6c('0x2b')](function(_0x4e552a){if(!_0x4e552a){throw new db[(_0x6e6c('0x68'))][(_0x6e6c('0x5b'))]('Voice\x20Recording\x20not\x20found');}_0x3ed98d=_0x4e552a;return db[_0x6e6c('0x81')][_0x6e6c('0x82')]({'where':{'id':0x1}});})[_0x6e6c('0x2b')](handleEntityNotFound(_0x2a11ef,null))[_0x6e6c('0x2b')](function(_0x5217fe){if(_0x5217fe){_0x306826=_0x5217fe;if(!_0x306826[_0x6e6c('0x83')]||!_0x306826[_0x6e6c('0x84')]||!_0x306826['transcribeRegion']||!_0x306826[_0x6e6c('0x85')]||!_0x306826[_0x6e6c('0x79')]){throw new db[(_0x6e6c('0x68'))][(_0x6e6c('0x5b'))](_0x6e6c('0x86'));}if(_0x22c6d4[_0x6e6c('0x4f')]['runSentiment']&&(!_0x306826[_0x6e6c('0x87')]||!_0x306826[_0x6e6c('0x88')]||!_0x306826[_0x6e6c('0x89')]||!_0x306826[_0x6e6c('0x85')]||!_0x306826[_0x6e6c('0x79')])){throw new db[(_0x6e6c('0x68'))]['ValidationError'](_0x6e6c('0x8a'));}return db[_0x6e6c('0x8b')][_0x6e6c('0x82')]({'where':{'id':_0x306826[_0x6e6c('0x84')]}});}})[_0x6e6c('0x2b')](function(_0x4a9b74){if(!_0x4a9b74){throw new db['Sequelize'][(_0x6e6c('0x5b'))](_0x6e6c('0x8c'));}if(!_0x4a9b74[_0x6e6c('0x8d')]||!_0x4a9b74['data2']){throw new db[(_0x6e6c('0x68'))][(_0x6e6c('0x5b'))]('Cloud\x20Provider\x20not\x20configured');}_0x5141f5=_0x4a9b74;return getBucketslist(_0x5141f5[_0x6e6c('0x8d')],_0x5141f5[_0x6e6c('0x8e')],_0x306826[_0x6e6c('0x8f')]);})[_0x6e6c('0x2b')](function(_0x204ad0){if(_0x204ad0&&_0x204ad0['Buckets']){var _0x4c1886=_['find'](_0x204ad0['Buckets'],function(_0x62b391){return _0x62b391['Name']===_0x306826[_0x6e6c('0x79')];});if(!_0x4c1886){logger['info'](util['format'](_0x6e6c('0x90'),_0x22c6d4[_0x6e6c('0x4b')]['id'],_0x306826[_0x6e6c('0x79')]));return createBucket(_0x5141f5['data1'],_0x5141f5[_0x6e6c('0x8e')],_0x306826[_0x6e6c('0x8f')],_0x306826[_0x6e6c('0x79')]);}logger[_0x6e6c('0x6c')](util['format'](_0x6e6c('0x91'),_0x22c6d4[_0x6e6c('0x4b')]['id'],_0x306826['bucket']));return;}})['then'](function(_0x117d15){if(_0x3ed98d[_0x6e6c('0x92')]===_0x6e6c('0x93')){return transcribe(_0x22c6d4[_0x6e6c('0x4b')]['id'],_0x5141f5[_0x6e6c('0x8d')],_0x5141f5[_0x6e6c('0x8e')],_0x306826[_0x6e6c('0x8f')],_0x306826['bucket'],_0x3ed98d[_0x6e6c('0x55')],_0x306826['language']);}else{logger[_0x6e6c('0x6c')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x22c6d4[_0x6e6c('0x4b')]['id']));return{'transcribeStatus':_0x6e6c('0x94')};}})['then'](function(_0x2d3a2d){if(_0x2d3a2d){_0x2d3a2d['tempSentiment']=_0x22c6d4[_0x6e6c('0x4f')][_0x6e6c('0x95')];return _0x3ed98d[_0x6e6c('0x96')](_0x2d3a2d);}})[_0x6e6c('0x2b')](respondWithResult(_0x2a11ef,null))['catch'](handleError(_0x2a11ef,null));};function writeFile(_0x1303c6,_0x441f20){return new Promise(function(_0x4a2faa,_0x5e6a78){fs[_0x6e6c('0x97')](_0x441f20,_0x1303c6,function(_0xcf70f8,_0x578cca){if(_0xcf70f8){return _0x5e6a78(_0xcf70f8);}else{return _0x4a2faa(_0x578cca);}});});}exports[_0x6e6c('0x98')]=function(_0x117d8d,_0x712fe0,_0xe338cd){return db[_0x6e6c('0x32')][_0x6e6c('0x82')]({'where':{'id':_0x117d8d[_0x6e6c('0x4b')]['id']}})[_0x6e6c('0x2b')](handleEntityNotFound(_0x712fe0))[_0x6e6c('0x2b')](function(_0x582a8e){if(_0x582a8e&&_0x582a8e[_0x6e6c('0x99')]){var _0x1450d5=_0x582a8e[_0x6e6c('0x99')];var _0x28197c=config[_0x6e6c('0x9a')]+_0x6e6c('0x9b')+_0x582a8e['id']+_0x6e6c('0x9c');if(fs['existsSync'](_0x28197c)){return _0x28197c;}return writeFile(_0x1450d5,_0x28197c)['then'](function(){return _0x28197c;});}else{throw new db[(_0x6e6c('0x68'))]['ValidationError']('Transcript\x20not\x20available');}})[_0x6e6c('0x2b')](function(_0x4d224a){return _0x712fe0[_0x6e6c('0x52')](_0x4d224a);})[_0x6e6c('0x4a')](handleError(_0x712fe0));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index e9e472d..1c5e819 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 _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 +var _0x2bd6=['uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define','voice_recordings'];(function(_0x4d8cc3,_0x5eba5c){var _0x287c9d=function(_0x358da9){while(--_0x358da9){_0x4d8cc3['push'](_0x4d8cc3['shift']());}};_0x287c9d(++_0x5eba5c);}(_0x2bd6,0x1f4));var _0x62bd=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x2bd6[_0x618414];return _0x21c19a;};'use strict';var attributes=require(_0x62bd('0x0'));module[_0x62bd('0x1')]=function(_0x469dda,_0x30ace1){return _0x469dda[_0x62bd('0x2')]('VoiceRecording',attributes,{'tableName':_0x62bd('0x3'),'paranoid':![],'indexes':[{'name':_0x62bd('0x4'),'fields':[_0x62bd('0x4')]},{'name':'transcribeStatus','fields':[_0x62bd('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 b89e6c5..ed5d971 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 _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 +var _0x5f2f=['UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','then','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','encryptFile','secrets','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','VoiceRecording,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x2b426e,_0x491a20){var _0x409d2e=function(_0x40d404){while(--_0x40d404){_0x2b426e['push'](_0x2b426e['shift']());}};_0x409d2e(++_0x491a20);}(_0x5f2f,0x73));var _0xf5f2=function(_0x499341,_0xefcdbb){_0x499341=_0x499341-0x0;var _0x2aa252=_0x5f2f[_0x499341];return _0x2aa252;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20fccd['options']?_0x20fccd['options'][_0xf5f2('0x1d')]||null:null,'attributes':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd['options'][_0xf5f2('0x1e')]||null:null,'limit':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null})[_0xf5f2('0x20')](function(_0x4c691a){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x4c691a));_0x4ff59b(_0x4c691a);})['catch'](function(_0x529f07){logger[_0xf5f2('0x11')](_0xf5f2('0x17'),_0x529f07[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x529f07[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x21')]=function(_0x13a3be){var _0x281ec8=this;return new Promise(function(_0x294414,_0x4ab014){var _0xaa2602=require(_0xf5f2('0x22'));var _0x375ca8;return db[_0xf5f2('0x23')][_0xf5f2('0x24')]({'attributes':['id',_0xf5f2('0x25')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x53cb96){_0x375ca8=_0x53cb96;return db[_0xf5f2('0x18')][_0xf5f2('0x26')](_0x13a3be[_0xf5f2('0x1a')]);})['then'](function(_0x5a2c7e){if(_0x375ca8[_0xf5f2('0x25')]&&fs[_0xf5f2('0x27')](_0x5a2c7e[_0xf5f2('0x28')])){var _0x153924=util[_0xf5f2('0x29')]('%s.cypher',_0x5a2c7e['value']);return _0xaa2602[_0xf5f2('0x2a')](_0x5a2c7e['value'],_0x153924,config[_0xf5f2('0x2b')]['recording'])[_0xf5f2('0x20')](function(){fs[_0xf5f2('0x2c')](_0x5a2c7e[_0xf5f2('0x28')]);logger[_0xf5f2('0xd')](_0xf5f2('0x2d'));return _0x5a2c7e;});}return _0x5a2c7e;})[_0xf5f2('0x20')](function(_0x2ac089){logger[_0xf5f2('0xd')]('CreateVoiceRecording',_0x13a3be);logger[_0xf5f2('0xf')](_0xf5f2('0x21'),_0x13a3be,JSON[_0xf5f2('0x10')](_0x2ac089));_0x294414(_0x2ac089);})[_0xf5f2('0x16')](function(_0x1408b9){logger[_0xf5f2('0x11')](_0xf5f2('0x21'),_0x1408b9['message'],_0x13a3be);_0x4ab014(_0x281ec8[_0xf5f2('0x11')](0x1f4,_0x1408b9[_0xf5f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 1f12030..9e433df 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 _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 +var _0x6c1f=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','/describe','describe','get','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0xc6d35,_0x445827){var _0x41a7cb=function(_0x2b2039){while(--_0x2b2039){_0xc6d35['push'](_0xc6d35['shift']());}};_0x41a7cb(++_0x445827);}(_0x6c1f,0x1cb));var _0xf6c1=function(_0x2ce055,_0x754ee6){_0x2ce055=_0x2ce055-0x0;var _0x31dd95=_0x6c1f[_0x2ce055];return _0x31dd95;};'use strict';var multer=require('multer');var util=require(_0xf6c1('0x0'));var path=require(_0xf6c1('0x1'));var timeout=require(_0xf6c1('0x2'));var express=require(_0xf6c1('0x3'));var router=express[_0xf6c1('0x4')]();var fs_extra=require(_0xf6c1('0x5'));var auth=require(_0xf6c1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf6c1('0x7'));var controller=require(_0xf6c1('0x8'));router['get']('/',auth[_0xf6c1('0x9')](),controller['index']);router['get'](_0xf6c1('0xa'),auth['isAuthenticated'](),controller[_0xf6c1('0xb')]);router[_0xf6c1('0xc')](_0xf6c1('0xd'),auth[_0xf6c1('0x9')](),controller[_0xf6c1('0xe')]);router[_0xf6c1('0xf')]('/',auth[_0xf6c1('0x9')](),controller[_0xf6c1('0x10')]);router[_0xf6c1('0x11')](_0xf6c1('0xd'),auth[_0xf6c1('0x9')](),controller['update']);router[_0xf6c1('0x12')](_0xf6c1('0xd'),auth[_0xf6c1('0x9')](),controller[_0xf6c1('0x13')]);module[_0xf6c1('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 4f66ef7..6a93bf4 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 _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 +var _0x214b=['attended','STRING','Yes','sequelize','moment','exports','ENUM','blind'];(function(_0x1c8fdc,_0x4210b1){var _0x39e241=function(_0x1c1faf){while(--_0x1c1faf){_0x1c8fdc['push'](_0x1c8fdc['shift']());}};_0x39e241(++_0x4210b1);}(_0x214b,0xfb));var _0xb214=function(_0x5ab38f,_0x596fdb){_0x5ab38f=_0x5ab38f-0x0;var _0x224fef=_0x214b[_0x5ab38f];return _0x224fef;};'use strict';var Sequelize=require(_0xb214('0x0'));var moment=require(_0xb214('0x1'));module[_0xb214('0x2')]={'type':{'type':Sequelize[_0xb214('0x3')](_0xb214('0x4'),_0xb214('0x5'))},'result':{'type':Sequelize[_0xb214('0x6')]},'transfererchannel':{'type':Sequelize[_0xb214('0x6')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0xb214('0x6')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xb214('0x6')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xb214('0x6')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xb214('0x6')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xb214('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xb214('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0xb214('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0xb214('0x6')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xb214('0x6')]},'transfereelinkedid':{'type':Sequelize[_0xb214('0x6')]},'isexternal':{'type':Sequelize[_0xb214('0x3')](_0xb214('0x7'),'No')},'context':{'type':Sequelize[_0xb214('0x6')]},'extension':{'type':Sequelize[_0xb214('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 08565dd..512709f 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 _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 +var _0x80bd=['query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','pick','where','VIRTUAL','filter','merge','options','VoiceTransferReport','include','findAll','rows','catch','length','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','type','key'];(function(_0x525dc2,_0x24f1b7){var _0x31349b=function(_0x83582c){while(--_0x83582c){_0x525dc2['push'](_0x525dc2['shift']());}};_0x31349b(++_0x24f1b7);}(_0x80bd,0x154));var _0xd80b=function(_0x9c0e2c,_0x1bf761){_0x9c0e2c=_0x9c0e2c-0x0;var _0x5b15ae=_0x80bd[_0x9c0e2c];return _0x5b15ae;};'use strict';var emlformat=require(_0xd80b('0x0'));var rimraf=require(_0xd80b('0x1'));var zipdir=require(_0xd80b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd80b('0x3'));var moment=require(_0xd80b('0x4'));var BPromise=require(_0xd80b('0x5'));var Mustache=require(_0xd80b('0x6'));var util=require(_0xd80b('0x7'));var path=require(_0xd80b('0x8'));var sox=require(_0xd80b('0x9'));var csv=require(_0xd80b('0xa'));var ejs=require(_0xd80b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd80b('0xc'));var squel=require(_0xd80b('0xd'));var crypto=require(_0xd80b('0xe'));var jsforce=require(_0xd80b('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd80b('0x10'));var Papa=require(_0xd80b('0x11'));var Redis=require(_0xd80b('0x12'));var authService=require(_0xd80b('0x13'));var qs=require(_0xd80b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd80b('0x15'));var logger=require(_0xd80b('0x16'))(_0xd80b('0x17'));var utils=require(_0xd80b('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd80b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3adbbf,_0x13e38c){_0x13e38c=_0x13e38c||0xcc;return function(_0x4bd7bb){if(_0x4bd7bb){return _0x3adbbf[_0xd80b('0x1a')](_0x13e38c);}return _0x3adbbf[_0xd80b('0x1b')](_0x13e38c)[_0xd80b('0x1c')]();};}function respondWithResult(_0x50c3b5,_0x384a78){_0x384a78=_0x384a78||0xc8;return function(_0x58ad65){if(_0x58ad65){return _0x50c3b5['status'](_0x384a78)['json'](_0x58ad65);}};}function respondWithFilteredResult(_0x262eb1,_0x4ba5fa){return function(_0x19bc53){if(_0x19bc53){var _0x16ec59=typeof _0x4ba5fa[_0xd80b('0x1d')]===_0xd80b('0x1e')&&typeof _0x4ba5fa[_0xd80b('0x1f')]===_0xd80b('0x1e');var _0x3a39b1=_0x19bc53[_0xd80b('0x20')];var _0x541daf=_0x16ec59?0x0:_0x4ba5fa[_0xd80b('0x1d')];var _0x1da7ec=_0x16ec59?_0x19bc53[_0xd80b('0x20')]:_0x4ba5fa[_0xd80b('0x1d')]+_0x4ba5fa[_0xd80b('0x1f')];var _0x3168b1;if(_0x1da7ec>=_0x3a39b1){_0x1da7ec=_0x3a39b1;_0x3168b1=0xc8;}else{_0x3168b1=0xce;}_0x262eb1[_0xd80b('0x1b')](_0x3168b1);return _0x262eb1[_0xd80b('0x21')](_0xd80b('0x22'),_0x541daf+'-'+_0x1da7ec+'/'+_0x3a39b1)[_0xd80b('0x23')](_0x19bc53);}return null;};}function patchUpdates(_0x425c13){return function(_0x231e64){try{jsonpatch[_0xd80b('0x24')](_0x231e64,_0x425c13,!![]);}catch(_0x851fe5){return BPromise[_0xd80b('0x25')](_0x851fe5);}return _0x231e64[_0xd80b('0x26')]();};}function saveUpdates(_0x358d35,_0x1e1363){return function(_0x28d737){if(_0x28d737){return _0x28d737[_0xd80b('0x27')](_0x358d35)[_0xd80b('0x28')](function(_0x32e1d9){return _0x32e1d9;});}return null;};}function removeEntity(_0x4ae22d,_0x720693){return function(_0x1d1f43){if(_0x1d1f43){return _0x1d1f43[_0xd80b('0x29')]()[_0xd80b('0x28')](function(){_0x4ae22d[_0xd80b('0x1b')](0xcc)[_0xd80b('0x1c')]();});}};}function handleEntityNotFound(_0x2059c7,_0x2e2d50){return function(_0x5796f5){if(!_0x5796f5){_0x2059c7[_0xd80b('0x1a')](0x194);}return _0x5796f5;};}function handleError(_0x4d105,_0x30e01c){_0x30e01c=_0x30e01c||0x1f4;return function(_0x886dd){logger['error'](_0x886dd[_0xd80b('0x2a')]);if(_0x886dd[_0xd80b('0x2b')]){delete _0x886dd[_0xd80b('0x2b')];}_0x4d105[_0xd80b('0x1b')](_0x30e01c)[_0xd80b('0x2c')](_0x886dd);};}exports['index']=function(_0x8b9517,_0x3ec23f){var _0x1edf09={},_0x28b11b={},_0x1c4ec6={'count':0x0,'rows':[]};var _0x4f12b3=_[_0xd80b('0x2d')](db['VoiceTransferReport'][_0xd80b('0x2e')],function(_0x22bdb3){return{'name':_0x22bdb3[_0xd80b('0x2f')],'type':_0x22bdb3[_0xd80b('0x30')][_0xd80b('0x31')]};});_0x28b11b['model']=_[_0xd80b('0x2d')](_0x4f12b3,'name');_0x28b11b[_0xd80b('0x32')]=_[_0xd80b('0x33')](_0x8b9517[_0xd80b('0x32')]);_0x28b11b[_0xd80b('0x34')]=_[_0xd80b('0x35')](_0x28b11b[_0xd80b('0x36')],_0x28b11b[_0xd80b('0x32')]);_0x1edf09[_0xd80b('0x37')]=_['intersection'](_0x28b11b[_0xd80b('0x36')],qs['fields'](_0x8b9517['query'][_0xd80b('0x38')]));_0x1edf09['attributes']=_0x1edf09[_0xd80b('0x37')]['length']?_0x1edf09[_0xd80b('0x37')]:_0x28b11b[_0xd80b('0x36')];if(!_0x8b9517[_0xd80b('0x32')][_0xd80b('0x39')]('nolimit')){_0x1edf09[_0xd80b('0x1f')]=qs[_0xd80b('0x1f')](_0x8b9517[_0xd80b('0x32')]['limit']);_0x1edf09[_0xd80b('0x1d')]=qs[_0xd80b('0x1d')](_0x8b9517[_0xd80b('0x32')][_0xd80b('0x1d')]);}_0x1edf09[_0xd80b('0x3a')]=qs[_0xd80b('0x3b')](_0x8b9517[_0xd80b('0x32')][_0xd80b('0x3b')]);_0x1edf09['where']=qs[_0xd80b('0x34')](_[_0xd80b('0x3c')](_0x8b9517['query'],_0x28b11b[_0xd80b('0x34')]),_0x4f12b3);if(_0x8b9517[_0xd80b('0x32')]['filter']){_0x1edf09[_0xd80b('0x3d')]=_['merge'](_0x1edf09['where'],{'$or':_['map'](_0x4f12b3,function(_0x21e6e1){if(_0x21e6e1[_0xd80b('0x30')]!==_0xd80b('0x3e')){var _0x17fd5c={};_0x17fd5c[_0x21e6e1[_0xd80b('0x2b')]]={'$like':'%'+_0x8b9517['query'][_0xd80b('0x3f')]+'%'};return _0x17fd5c;}})});}_0x1edf09=_[_0xd80b('0x40')]({},_0x1edf09,_0x8b9517[_0xd80b('0x41')]);var _0x44cbc7={'where':_0x1edf09[_0xd80b('0x3d')]};return db[_0xd80b('0x42')][_0xd80b('0x20')](_0x44cbc7)[_0xd80b('0x28')](function(_0x244622){_0x1c4ec6[_0xd80b('0x20')]=_0x244622;if(_0x8b9517['query']['includeAll']){_0x1edf09[_0xd80b('0x43')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0xd80b('0x44')](_0x1edf09);})[_0xd80b('0x28')](function(_0x39ed7a){_0x1c4ec6[_0xd80b('0x45')]=_0x39ed7a;return _0x1c4ec6;})[_0xd80b('0x28')](respondWithFilteredResult(_0x3ec23f,_0x1edf09))[_0xd80b('0x46')](handleError(_0x3ec23f,null));};exports['show']=function(_0x2c6bd4,_0x19176a){var _0xb5ad33={'raw':!![],'where':{'id':_0x2c6bd4['params']['id']}},_0x34212b={};_0x34212b[_0xd80b('0x36')]=_['keys'](db[_0xd80b('0x42')][_0xd80b('0x2e')]);_0x34212b['query']=_[_0xd80b('0x33')](_0x2c6bd4[_0xd80b('0x32')]);_0x34212b[_0xd80b('0x34')]=_[_0xd80b('0x35')](_0x34212b[_0xd80b('0x36')],_0x34212b['query']);_0xb5ad33[_0xd80b('0x37')]=_[_0xd80b('0x35')](_0x34212b[_0xd80b('0x36')],qs[_0xd80b('0x38')](_0x2c6bd4[_0xd80b('0x32')][_0xd80b('0x38')]));_0xb5ad33[_0xd80b('0x37')]=_0xb5ad33['attributes'][_0xd80b('0x47')]?_0xb5ad33[_0xd80b('0x37')]:_0x34212b[_0xd80b('0x36')];if(_0x2c6bd4['query'][_0xd80b('0x48')]){_0xb5ad33[_0xd80b('0x43')]=[{'all':!![]}];}_0xb5ad33=_[_0xd80b('0x40')]({},_0xb5ad33,_0x2c6bd4[_0xd80b('0x41')]);return db['VoiceTransferReport'][_0xd80b('0x49')](_0xb5ad33)[_0xd80b('0x28')](handleEntityNotFound(_0x19176a,null))[_0xd80b('0x28')](respondWithResult(_0x19176a,null))[_0xd80b('0x46')](handleError(_0x19176a,null));};exports['create']=function(_0x197ee9,_0x12e396){return db['VoiceTransferReport'][_0xd80b('0x4a')](_0x197ee9[_0xd80b('0x4b')],{})[_0xd80b('0x28')](respondWithResult(_0x12e396,0xc9))[_0xd80b('0x46')](handleError(_0x12e396,null));};exports['update']=function(_0x2bed87,_0x2d7d6d){if(_0x2bed87[_0xd80b('0x4b')]['id']){delete _0x2bed87[_0xd80b('0x4b')]['id'];}return db[_0xd80b('0x42')][_0xd80b('0x49')]({'where':{'id':_0x2bed87[_0xd80b('0x4c')]['id']}})[_0xd80b('0x28')](handleEntityNotFound(_0x2d7d6d,null))[_0xd80b('0x28')](saveUpdates(_0x2bed87['body'],null))[_0xd80b('0x28')](respondWithResult(_0x2d7d6d,null))[_0xd80b('0x46')](handleError(_0x2d7d6d,null));};exports[_0xd80b('0x29')]=function(_0x43f31a,_0x6142e7){return db['VoiceTransferReport']['find']({'where':{'id':_0x43f31a[_0xd80b('0x4c')]['id']}})[_0xd80b('0x28')](handleEntityNotFound(_0x6142e7,null))[_0xd80b('0x28')](removeEntity(_0x6142e7,null))[_0xd80b('0x46')](handleError(_0x6142e7,null));};exports[_0xd80b('0x4d')]=function(_0x6924ea,_0x27a4e4){return db[_0xd80b('0x42')][_0xd80b('0x4d')]()[_0xd80b('0x28')](respondWithResult(_0x27a4e4,null))[_0xd80b('0x46')](handleError(_0x27a4e4,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 385540d..e0670d4 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 _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 +var _0x9d43=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','./voiceTransferReport.attributes','exports','define','VoiceTransferReport'];(function(_0xe2dc9e,_0xeb3bc6){var _0x279417=function(_0x32475f){while(--_0x32475f){_0xe2dc9e['push'](_0xe2dc9e['shift']());}};_0x279417(++_0xeb3bc6);}(_0x9d43,0x11e));var _0x39d4=function(_0x581440,_0x23043c){_0x581440=_0x581440-0x0;var _0x21b59f=_0x9d43[_0x581440];return _0x21b59f;};'use strict';var _=require(_0x39d4('0x0'));var util=require(_0x39d4('0x1'));var logger=require(_0x39d4('0x2'))(_0x39d4('0x3'));var moment=require(_0x39d4('0x4'));var BPromise=require('bluebird');var rp=require(_0x39d4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x39d4('0x6'));var config=require('../../config/environment');var attributes=require(_0x39d4('0x7'));module[_0x39d4('0x8')]=function(_0x286334,_0x3daa19){return _0x286334[_0x39d4('0x9')](_0x39d4('0xa'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 6ecb388..51059ed 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 _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 +var _0x04af=['rpc','../../config/environment','client','http','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','create','body','options','raw','CreateVoiceTransferReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x40a357,_0x52d576){var _0x1473fb=function(_0x327c91){while(--_0x327c91){_0x40a357['push'](_0x40a357['shift']());}};_0x1473fb(++_0x52d576);}(_0x04af,0xf4));var _0xf04a=function(_0x74dc61,_0x3cd9cb){_0x74dc61=_0x74dc61-0x0;var _0x29a24c=_0x04af[_0x74dc61];return _0x29a24c;};'use strict';var _=require(_0xf04a('0x0'));var util=require(_0xf04a('0x1'));var moment=require(_0xf04a('0x2'));var BPromise=require(_0xf04a('0x3'));var rs=require(_0xf04a('0x4'));var fs=require('fs');var Redis=require(_0xf04a('0x5'));var db=require(_0xf04a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf04a('0x7'))(_0xf04a('0x8'));var config=require(_0xf04a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf04a('0xa')][_0xf04a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1772ce,_0x52f4e6,_0x4efa4a){return new BPromise(function(_0x3d75bd,_0xf5f34b){return client['request'](_0x1772ce,_0x4efa4a)[_0xf04a('0xc')](function(_0x28f5f4){logger['info'](_0xf04a('0xd'),_0x52f4e6,_0xf04a('0xe'));logger[_0xf04a('0xf')](_0xf04a('0x10'),_0x52f4e6,_0xf04a('0xe'),JSON[_0xf04a('0x11')](_0x28f5f4));if(_0x28f5f4[_0xf04a('0x12')]){if(_0x28f5f4[_0xf04a('0x12')]['code']===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x52f4e6,_0x28f5f4[_0xf04a('0x12')][_0xf04a('0x13')]);return _0xf5f34b(_0x28f5f4[_0xf04a('0x12')][_0xf04a('0x13')]);}logger[_0xf04a('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x52f4e6,_0x28f5f4[_0xf04a('0x12')]['message']);return _0x3d75bd(_0x28f5f4[_0xf04a('0x12')][_0xf04a('0x13')]);}else{logger[_0xf04a('0x14')](_0xf04a('0xd'),_0x52f4e6,_0xf04a('0xe'));_0x3d75bd(_0x28f5f4[_0xf04a('0x15')][_0xf04a('0x13')]);}})[_0xf04a('0x16')](function(_0x169a9e){logger[_0xf04a('0x12')](_0xf04a('0xd'),_0x52f4e6,_0x169a9e);_0xf5f34b(_0x169a9e);});});}exports['CreateVoiceTransferReport']=function(_0x12cdd1){var _0x437c88=this;return new Promise(function(_0xe80cd0,_0x3f9039){return db['VoiceTransferReport'][_0xf04a('0x17')](_0x12cdd1[_0xf04a('0x18')],{'raw':_0x12cdd1[_0xf04a('0x19')]?_0x12cdd1[_0xf04a('0x19')][_0xf04a('0x1a')]===undefined?!![]:![]:!![]})[_0xf04a('0xc')](function(_0x4e94c8){logger[_0xf04a('0x14')](_0xf04a('0x1b'),_0x12cdd1);logger[_0xf04a('0xf')](_0xf04a('0x1b'),_0x12cdd1,JSON[_0xf04a('0x11')](_0x4e94c8));_0xe80cd0(_0x4e94c8);})[_0xf04a('0x16')](function(_0x53518c){logger[_0xf04a('0x12')](_0xf04a('0x1b'),_0x53518c[_0xf04a('0x13')],_0x12cdd1);_0x3f9039(_0x437c88[_0xf04a('0x12')](0x1f4,_0x53518c['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index f954e35..25671e5 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(_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 +var _0xe5b3=['transfer','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','answer','hold','/unhold','unhold','/calls','calls','/transfer'];(function(_0x2b3e44,_0x1c6aad){var _0x21263f=function(_0x423de7){while(--_0x423de7){_0x2b3e44['push'](_0x2b3e44['shift']());}};_0x21263f(++_0x1c6aad);}(_0xe5b3,0x133));var _0x3e5b=function(_0x54cc90,_0x23e1db){_0x54cc90=_0x54cc90-0x0;var _0x11c062=_0xe5b3[_0x54cc90];return _0x11c062;};'use strict';var express=require('express');var router=express[_0x3e5b('0x0')]();var auth=require(_0x3e5b('0x1'));var controller=require(_0x3e5b('0x2'));router[_0x3e5b('0x3')](_0x3e5b('0x4'),auth[_0x3e5b('0x5')](),auth[_0x3e5b('0x6')](),controller[_0x3e5b('0x7')]);router[_0x3e5b('0x3')](_0x3e5b('0x8'),auth[_0x3e5b('0x5')](),auth['isWebrtcLicence'](),controller[_0x3e5b('0x9')]);router[_0x3e5b('0x3')]('/answer',auth[_0x3e5b('0x5')](),auth[_0x3e5b('0x6')](),controller[_0x3e5b('0xa')]);router[_0x3e5b('0x3')]('/hold',auth['isAuthenticated'](),auth[_0x3e5b('0x6')](),controller[_0x3e5b('0xb')]);router[_0x3e5b('0x3')](_0x3e5b('0xc'),auth[_0x3e5b('0x5')](),auth['isWebrtcLicence'](),controller[_0x3e5b('0xd')]);router['post'](_0x3e5b('0xe'),auth[_0x3e5b('0x5')](),auth[_0x3e5b('0x6')](),controller[_0x3e5b('0xf')]);router[_0x3e5b('0x3')](_0x3e5b('0x10'),auth[_0x3e5b('0x5')](),auth['isWebrtcLicence'](),controller[_0x3e5b('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 12713f9..f710c8b 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 _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 +var _0xaa7c=['answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','bluebird','jayson/promise','http','../../config/logger','webbarapi','ioredis','redis','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','entityFound:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer'];(function(_0x5264fd,_0x1cfed9){var _0x1f97c1=function(_0x1501cd){while(--_0x1501cd){_0x5264fd['push'](_0x5264fd['shift']());}};_0x1f97c1(++_0x1cfed9);}(_0xaa7c,0x1ec));var _0xcaa7=function(_0x44f1d0,_0x361cfb){_0x44f1d0=_0x44f1d0-0x0;var _0x37468b=_0xaa7c[_0x44f1d0];return _0x37468b;};'use strict';var path=require(_0xcaa7('0x0'));var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0xcaa7('0x1'));var jayson=require(_0xcaa7('0x2'));var amiClient=jayson['client'][_0xcaa7('0x3')]({'port':0x232a});var logger=require(_0xcaa7('0x4'))(_0xcaa7('0x5'));var Redis=require(_0xcaa7('0x6'));config[_0xcaa7('0x7')]=_['defaults'](config[_0xcaa7('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcaa7('0x7')]));var Schema=require(_0xcaa7('0x8'));var originateValidation=new Schema({'userId':{'type':_0xcaa7('0x9'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xcaa7('0xa'),'required':[!![],_0xcaa7('0xb')]},'callerId':{'type':_0xcaa7('0xa')},'callbackUrl':{'type':_0xcaa7('0xa')}});var hangupValidation=new Schema({'userId':{'type':_0xcaa7('0x9'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xcaa7('0xa'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xcaa7('0x9'),'required':[!![],_0xcaa7('0xc')]},'sessionId':{'type':_0xcaa7('0xa'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xcaa7('0x9'),'required':[!![],_0xcaa7('0xc')]},'sessionId':{'type':'string','required':[!![],_0xcaa7('0xd')]},'transferNumber':{'type':_0xcaa7('0xa'),'required':[!![],_0xcaa7('0xe')]}});var holdValidation=new Schema({'userId':{'type':_0xcaa7('0x9'),'required':[!![],_0xcaa7('0xc')]},'sessionId':{'type':_0xcaa7('0xa'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xcaa7('0x9'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xcaa7('0x9'),'required':[!![],_0xcaa7('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0xcaa7('0x9'),'required':[!![],_0xcaa7('0xc')]}});function emit(_0x49a218,_0x98c3e2,_0x13f970){logger[_0xcaa7('0xf')](_0x49a218,_0x98c3e2,JSON[_0xcaa7('0x10')](_0x13f970));io['to'](_0x49a218)[_0xcaa7('0x11')](_0x98c3e2,_0x13f970);}function handleError(_0xc46e37){return function(_0x20ede0){console['log']('handleError:',_0x20ede0,_0x20ede0 instanceof RangeError);logger[_0xcaa7('0x12')](_0x20ede0[_0xcaa7('0x13')]);if(_0x20ede0 instanceof RangeError){if(_0x20ede0[_0xcaa7('0x14')]){delete _0x20ede0[_0xcaa7('0x14')];}_0xc46e37[_0xcaa7('0x15')](0x194)[_0xcaa7('0x16')](_0x20ede0);}else{if(_0x20ede0[_0xcaa7('0x14')]){delete _0x20ede0['name'];}_0xc46e37[_0xcaa7('0x15')](0x1f4)[_0xcaa7('0x16')](_0x20ede0);}};}function checkError(){return function(_0x1aa4d2){if(!_0x1aa4d2){throw new RangeError(_0xcaa7('0x17'));}return _0x1aa4d2;};}function respondWithRpcPromise(_0x31ce99,_0x2fcdf7){return new BPromise(function(_0x3119d5,_0x4259b7){var _0x2a9a79=amiClient;return _0x2a9a79[_0xcaa7('0x18')](_0x31ce99,_0x2fcdf7)[_0xcaa7('0x19')](function(_0x140c5a){if(_0x140c5a[_0xcaa7('0x12')]){if(_0x140c5a['error'][_0xcaa7('0x1a')]===0x1f4){return _0x4259b7(_0x140c5a[_0xcaa7('0x12')]['message']);}return _0x3119d5(_0x140c5a[_0xcaa7('0x12')][_0xcaa7('0x1b')]);}else{_0x3119d5(_0x140c5a[_0xcaa7('0x1c')]);}})[_0xcaa7('0x1d')](function(_0x58384f){_0x4259b7(_0x58384f);});});}function getAgent(_0x5d4e7e){return db[_0xcaa7('0x1e')][_0xcaa7('0x1f')]({'where':{'id':_0x5d4e7e,'role':_0xcaa7('0x20')}})[_0xcaa7('0x19')](checkError());}function getAgentCheckSession(_0x4391a9,_0x4ec9e9){return new BPromise(function(_0x1a2577,_0x4c6e87){var _0x5b4914=respondWithRpcPromise(_0xcaa7('0x21'));var _0x492362=getAgent(_0x4391a9);Promise[_0xcaa7('0x22')]([_0x5b4914,_0x492362])[_0xcaa7('0x19')](function(_0x748bda){var _0x1c4200=_0x748bda[0x0];var _0x248ca5=_0x748bda[0x1];var _0x292222=_[_0xcaa7('0x23')](_0x1c4200[_0xcaa7('0x24')],function(_0x492843){return _0x492843[_0xcaa7('0x25')]==_0x248ca5['id']&&_0x492843[_0xcaa7('0x26')]==_0x4ec9e9;});if(_0x292222[_0xcaa7('0x27')]==0x1){_0x1a2577(_0x248ca5);}else{_0x4c6e87(new RangeError(_0xcaa7('0x28')+_0x4ec9e9+_0xcaa7('0x29')));}});});}exports['originate']=function(_0x25c847,_0x394da5){logger[_0xcaa7('0xf')](_0xcaa7('0x2a'),_0x25c847[_0xcaa7('0x2b')]);var _0x483b44=originateValidation[_0xcaa7('0x8')](_0x25c847['body']);if(_0x483b44[_0xcaa7('0x27')]>0x0){return _0x394da5[_0xcaa7('0x15')](0x190)[_0xcaa7('0x2c')](_0x483b44);}var _0x59f2c7=_0x25c847[_0xcaa7('0x2b')][_0xcaa7('0x2d')];var _0x133114=_0x25c847[_0xcaa7('0x2b')][_0xcaa7('0x2e')];var _0x27be59=_0x25c847['body'][_0xcaa7('0x2f')];var _0x2b6708=_0x25c847['body'][_0xcaa7('0x30')];return getAgent(_0x59f2c7)[_0xcaa7('0x19')](function(_0x444add){logger[_0xcaa7('0xf')]('entityFound:',_0x444add[_0xcaa7('0x14')]);emit(util[_0xcaa7('0x31')](_0xcaa7('0x32'),_0x444add[_0xcaa7('0x14')]),_0xcaa7('0x33'),{'callNumber':_0x133114,'callerId':_0x27be59,'callbackUrl':_0x2b6708});return _0x394da5[_0xcaa7('0x15')](0xc8)[_0xcaa7('0x2c')]({'error':![],'message':_0xcaa7('0x34')});})[_0xcaa7('0x1d')](handleError(_0x394da5));};exports[_0xcaa7('0x35')]=function(_0xf55432,_0x266d5f){logger['info'](_0xcaa7('0x36'),_0xf55432[_0xcaa7('0x2b')]);var _0x2a57ed=hangupValidation[_0xcaa7('0x8')](_0xf55432[_0xcaa7('0x2b')]);if(_0x2a57ed['length']>0x0){return _0x266d5f[_0xcaa7('0x15')](0x190)[_0xcaa7('0x2c')](_0x2a57ed);}var _0x387b12=_0xf55432['body'][_0xcaa7('0x2d')];var _0x3016f1=_0xf55432[_0xcaa7('0x2b')][_0xcaa7('0x26')];return getAgent(_0x387b12)['then'](function(_0x3b7884){logger['info'](_0xcaa7('0x37'),_0x3b7884['name']);emit(util[_0xcaa7('0x31')]('user:%s',_0x3b7884['name']),_0xcaa7('0x38'),{'sessionId':_0x3016f1});return _0x266d5f[_0xcaa7('0x15')](0xc8)['json']({'error':![],'message':_0xcaa7('0x39')});})[_0xcaa7('0x1d')](handleError(_0x266d5f));};exports[_0xcaa7('0x3a')]=function(_0x202572,_0x341e41){logger[_0xcaa7('0xf')](_0xcaa7('0x3b'),_0x202572[_0xcaa7('0x2b')]);var _0x55caaa=answerValidation[_0xcaa7('0x8')](_0x202572[_0xcaa7('0x2b')]);if(_0x55caaa[_0xcaa7('0x27')]>0x0){return _0x341e41[_0xcaa7('0x15')](0x190)[_0xcaa7('0x2c')](_0x55caaa);}var _0x3d6c26=_0x202572['body'][_0xcaa7('0x2d')];var _0x3da46d=_0x202572[_0xcaa7('0x2b')][_0xcaa7('0x26')];return getAgent(_0x3d6c26)[_0xcaa7('0x19')](function(_0x4df9a6){logger[_0xcaa7('0xf')](_0xcaa7('0x37'),_0x4df9a6[_0xcaa7('0x14')]);emit(util['format'](_0xcaa7('0x32'),_0x4df9a6['name']),_0xcaa7('0x3c'),{'sessionId':_0x3da46d});return _0x341e41[_0xcaa7('0x15')](0xc8)[_0xcaa7('0x2c')]({'error':![],'message':_0xcaa7('0x3d')});})[_0xcaa7('0x1d')](handleError(_0x341e41));};exports[_0xcaa7('0x3e')]=function(_0x3827b8,_0x53a482){logger['info'](_0xcaa7('0x3f'),_0x3827b8['body']);var _0xa2dbac=holdValidation['validate'](_0x3827b8[_0xcaa7('0x2b')]);if(_0xa2dbac['length']>0x0){return _0x53a482[_0xcaa7('0x15')](0x190)[_0xcaa7('0x2c')](_0xa2dbac);}var _0x1304a1=_0x3827b8[_0xcaa7('0x2b')][_0xcaa7('0x2d')];var _0x46c790=_0x3827b8['body']['sessionId'];return getAgent(_0x1304a1)[_0xcaa7('0x19')](function(_0x3a5f1f){logger['info'](_0xcaa7('0x37'),_0x3a5f1f[_0xcaa7('0x14')]);emit(util[_0xcaa7('0x31')](_0xcaa7('0x32'),_0x3a5f1f[_0xcaa7('0x14')]),_0xcaa7('0x40'),{'sessionId':_0x46c790});return _0x53a482[_0xcaa7('0x15')](0xc8)[_0xcaa7('0x2c')]({'error':![],'message':_0xcaa7('0x41')});})[_0xcaa7('0x1d')](handleError(_0x53a482));};exports[_0xcaa7('0x42')]=function(_0x3cc7ae,_0x6dfe9e){logger[_0xcaa7('0xf')](_0xcaa7('0x43'),_0x3cc7ae[_0xcaa7('0x2b')]);var _0x5dcc42=unholdValidation[_0xcaa7('0x8')](_0x3cc7ae['body']);if(_0x5dcc42[_0xcaa7('0x27')]>0x0){return _0x6dfe9e[_0xcaa7('0x15')](0x190)[_0xcaa7('0x2c')](_0x5dcc42);}var _0x3e88bb=_0x3cc7ae[_0xcaa7('0x2b')][_0xcaa7('0x2d')];var _0x1a2e55=_0x3cc7ae[_0xcaa7('0x2b')][_0xcaa7('0x26')];return getAgent(_0x3e88bb)[_0xcaa7('0x19')](function(_0x1df544){logger['info'](_0xcaa7('0x37'),_0x1df544[_0xcaa7('0x14')]);emit(util[_0xcaa7('0x31')]('user:%s',_0x1df544[_0xcaa7('0x14')]),'webbar:unhold',{'sessionId':_0x1a2e55});return _0x6dfe9e[_0xcaa7('0x15')](0xc8)[_0xcaa7('0x2c')]({'error':![],'message':_0xcaa7('0x44')});})[_0xcaa7('0x1d')](handleError(_0x6dfe9e));};exports['calls']=function(_0x13c14b,_0x1da84b){logger[_0xcaa7('0xf')](_0xcaa7('0x45'),_0x1da84b[_0xcaa7('0x2b')]);var _0x2d219a=callsValidation[_0xcaa7('0x8')](_0x13c14b[_0xcaa7('0x2b')]);if(_0x2d219a['length']>0x0){return _0x1da84b[_0xcaa7('0x15')](0x190)[_0xcaa7('0x2c')](_0x2d219a);}var _0x42795f=_0x13c14b[_0xcaa7('0x2b')][_0xcaa7('0x2d')];var _0xb7a21b=respondWithRpcPromise('VoiceChannels');var _0xcf623b=getAgent(_0x42795f);return Promise[_0xcaa7('0x22')]([_0xb7a21b,_0xcf623b])['then'](function(_0x9cb6ca){var _0x1a4a4c=_0x9cb6ca[0x0];var _0x39558c=_0x9cb6ca[0x1];var _0x48272e=_[_0xcaa7('0x23')](_0x1a4a4c[_0xcaa7('0x24')],function(_0x49cfd6){return _0x49cfd6[_0xcaa7('0x25')]==_0x39558c['id'];});return _0x1da84b[_0xcaa7('0x15')](0xc8)[_0xcaa7('0x2c')]({'count':_0x48272e[_0xcaa7('0x27')],'rows':_0x48272e});})[_0xcaa7('0x1d')](handleError(_0x1da84b));};exports[_0xcaa7('0x46')]=function(_0x3d4743,_0x206df4){logger[_0xcaa7('0xf')](_0xcaa7('0x47'),_0x3d4743[_0xcaa7('0x2b')]);var _0x994af2=conferenceValidation[_0xcaa7('0x8')](_0x3d4743[_0xcaa7('0x2b')]);if(_0x994af2[_0xcaa7('0x27')]>0x0){return _0x206df4[_0xcaa7('0x15')](0x190)[_0xcaa7('0x2c')](_0x994af2);}var _0x145444=_0x3d4743['body'][_0xcaa7('0x2d')];return getAgent(_0x145444)['then'](function(_0x20b9f4){logger[_0xcaa7('0xf')](_0xcaa7('0x37'),_0x20b9f4['name']);emit(util[_0xcaa7('0x31')](_0xcaa7('0x32'),_0x20b9f4[_0xcaa7('0x14')]),_0xcaa7('0x48'));return _0x206df4[_0xcaa7('0x15')](0xc8)[_0xcaa7('0x2c')]({'error':![],'message':_0xcaa7('0x49')});})[_0xcaa7('0x1d')](handleError(_0x206df4));};exports[_0xcaa7('0x4a')]=function(_0x75be2c,_0x525dfb){logger[_0xcaa7('0xf')](_0xcaa7('0x4b'),_0x75be2c['body']);var _0x5ce1e9=transferValidation[_0xcaa7('0x8')](_0x75be2c['body']);if(_0x5ce1e9[_0xcaa7('0x27')]>0x0){return _0x525dfb['status'](0x190)[_0xcaa7('0x2c')](_0x5ce1e9);}var _0x4b87f5=_0x75be2c[_0xcaa7('0x2b')][_0xcaa7('0x2d')];var _0x1645f2=_0x75be2c[_0xcaa7('0x2b')][_0xcaa7('0x26')];var _0x43e4f6=_0x75be2c[_0xcaa7('0x2b')][_0xcaa7('0x4c')];return getAgent(_0x4b87f5)[_0xcaa7('0x19')](function(_0x34d5df){logger['info'](_0xcaa7('0x37'),_0x34d5df[_0xcaa7('0x14')]);emit(util[_0xcaa7('0x31')](_0xcaa7('0x32'),_0x34d5df[_0xcaa7('0x14')]),_0xcaa7('0x4d'),{'sessionId':_0x1645f2,'transferNumber':_0x43e4f6});return _0x525dfb[_0xcaa7('0x15')](0xc8)['json']({'error':![],'message':_0xcaa7('0x4e')});})[_0xcaa7('0x1d')](handleError(_0x525dfb));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 476edb9..0dc6ecc 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 _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 +var _0xaea1=['./whatsappAccount.controller','get','index','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','getAgents','getApplications','post','create','addDisposition','/:id/canned_answers','addAnswer','/:id/users','/:id/applications','addApplications','notify','/:id/send','send','put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xaea1,0x1e8));var _0x1aea=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xaea1[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x1aea('0x0'));var util=require(_0x1aea('0x1'));var path=require(_0x1aea('0x2'));var timeout=require('connect-timeout');var express=require(_0x1aea('0x3'));var router=express['Router']();var fs_extra=require(_0x1aea('0x4'));var auth=require(_0x1aea('0x5'));var interaction=require(_0x1aea('0x6'));var config=require('../../config/environment');var controller=require(_0x1aea('0x7'));router[_0x1aea('0x8')]('/',auth['isAuthenticated'](),controller[_0x1aea('0x9')]);router[_0x1aea('0x8')]('/describe',auth[_0x1aea('0xa')](),controller[_0x1aea('0xb')]);router[_0x1aea('0x8')](_0x1aea('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x1aea('0x8')](_0x1aea('0xd'),auth['isAuthenticated'](),controller[_0x1aea('0xe')]);router[_0x1aea('0x8')]('/:id/canned_answers',auth[_0x1aea('0xa')](),controller['getAnswers']);router['get']('/:id/users',auth[_0x1aea('0xa')](),controller[_0x1aea('0xf')]);router[_0x1aea('0x8')]('/:id/applications',auth[_0x1aea('0xa')](),controller[_0x1aea('0x10')]);router[_0x1aea('0x11')]('/',auth[_0x1aea('0xa')](),controller[_0x1aea('0x12')]);router[_0x1aea('0x11')](_0x1aea('0xd'),auth[_0x1aea('0xa')](),controller[_0x1aea('0x13')]);router[_0x1aea('0x11')](_0x1aea('0x14'),auth[_0x1aea('0xa')](),controller[_0x1aea('0x15')]);router[_0x1aea('0x11')](_0x1aea('0x16'),auth[_0x1aea('0xa')](),controller['addAgents']);router['post'](_0x1aea('0x17'),auth['isAuthenticated'](),controller[_0x1aea('0x18')]);router[_0x1aea('0x11')]('/:id/notify',controller[_0x1aea('0x19')]);router[_0x1aea('0x11')](_0x1aea('0x1a'),auth[_0x1aea('0xa')](),controller[_0x1aea('0x1b')]);router[_0x1aea('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x1aea('0x1d')]);router[_0x1aea('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0x1aea('0x1f')]);router[_0x1aea('0x1e')](_0x1aea('0xd'),auth[_0x1aea('0xa')](),controller['removeDispositions']);router[_0x1aea('0x1e')](_0x1aea('0x14'),auth[_0x1aea('0xa')](),controller['removeAnswers']);router['delete'](_0x1aea('0x16'),auth[_0x1aea('0xa')](),controller['removeAgents']);module[_0x1aea('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index e797490..c9fa57b 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 _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 +var _0x5991=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x5991,0x1f4));var _0x1599=function(_0x4afd61,_0x10dfd9){_0x4afd61=_0x4afd61-0x0;var _0xcb0190=_0x5991[_0x4afd61];return _0xcb0190;};'use strict';var Sequelize=require(_0x1599('0x0'));var rs=require(_0x1599('0x1'));module[_0x1599('0x2')]={'name':{'type':Sequelize[_0x1599('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x1599('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x1599('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x1599('0x3')]},'type':{'type':Sequelize[_0x1599('0x4')](_0x1599('0x5'),_0x1599('0x6'))},'accountSid':{'type':Sequelize[_0x1599('0x3')]},'baseUrl':{'type':Sequelize[_0x1599('0x3')]},'authToken':{'type':Sequelize[_0x1599('0x3')]},'notificationTemplate':{'type':Sequelize[_0x1599('0x7')],'defaultValue':function(){return _0x1599('0x8');}},'notificationSound':{'type':Sequelize[_0x1599('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x1599('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1599('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x1599('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1599('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1599('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1599('0xa')],'comment':_0x1599('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x1599('0x9')],'defaultValue':![],'comment':_0x1599('0xc'),'set':function(_0x288652){if(!_0x288652){this[_0x1599('0xd')]('mandatoryDispositionPauseId',null);}this[_0x1599('0xd')](_0x1599('0xe'),_0x288652);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 80e9e9b..8a8f9dd 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 _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 +var _0xf943=['rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappAccount','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','find','create','body','get','role','user','userProfileId','update','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','CmContact','Contacts','DESC','list','WhatsappInteraction','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','UserId','unshift','agent','waitForTheAssignedAgent','WhatsappQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','http','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','WhatsappAccounts','UserProfileResource','then','stack','name','send','index','Pause','map'];(function(_0x512672,_0x240349){var _0x20ea9d=function(_0x5ab15a){while(--_0x5ab15a){_0x512672['push'](_0x512672['shift']());}};_0x20ea9d(++_0x240349);}(_0xf943,0x150));var _0x3f94=function(_0xf38b17,_0x492fc7){_0xf38b17=_0xf38b17-0x0;var _0x43d3f7=_0xf943[_0xf38b17];return _0x43d3f7;};'use strict';var emlformat=require(_0x3f94('0x0'));var rimraf=require(_0x3f94('0x1'));var zipdir=require(_0x3f94('0x2'));var jsonpatch=require(_0x3f94('0x3'));var rp=require(_0x3f94('0x4'));var moment=require(_0x3f94('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3f94('0x6'));var util=require(_0x3f94('0x7'));var path=require('path');var sox=require(_0x3f94('0x8'));var csv=require('to-csv');var ejs=require(_0x3f94('0x9'));var fs=require('fs');var fs_extra=require(_0x3f94('0xa'));var _=require(_0x3f94('0xb'));var squel=require(_0x3f94('0xc'));var crypto=require(_0x3f94('0xd'));var jsforce=require(_0x3f94('0xe'));var deskjs=require(_0x3f94('0xf'));var toCsv=require(_0x3f94('0x10'));var querystring=require(_0x3f94('0x11'));var Papa=require(_0x3f94('0x12'));var Redis=require('ioredis');var authService=require(_0x3f94('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f94('0x14'));var logger=require(_0x3f94('0x15'))('api');var utils=require(_0x3f94('0x16'));var config=require(_0x3f94('0x17'));var licenseUtil=require(_0x3f94('0x18'));var db=require(_0x3f94('0x19'))['db'];config['redis']=_[_0x3f94('0x1a')](config[_0x3f94('0x1b')],{'host':_0x3f94('0x1c'),'port':0x18eb});var socket=require(_0x3f94('0x1d'))(new Redis(config[_0x3f94('0x1b')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x3f94('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x2cbd17,_0x2abc45,_0xdafe3,_0x56a84c){return new BPromise(function(_0x303d26,_0x55a923){var _0x16f927=_0x56a84c||client;return _0x16f927['request'](_0x2cbd17,_0xdafe3)['then'](function(_0x147785){logger[_0x3f94('0x1f')](_0x3f94('0x20'),_0x2abc45,_0x3f94('0x21'));logger[_0x3f94('0x22')](_0x3f94('0x23'),_0x2abc45,_0x3f94('0x21'),JSON[_0x3f94('0x24')](_0x147785));if(_0x147785[_0x3f94('0x25')]){if(_0x147785[_0x3f94('0x25')][_0x3f94('0x26')]===0x1f4){logger[_0x3f94('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x2abc45,_0x147785[_0x3f94('0x25')][_0x3f94('0x27')]);return _0x55a923(_0x147785[_0x3f94('0x25')][_0x3f94('0x27')]);}logger[_0x3f94('0x25')](_0x3f94('0x20'),_0x2abc45,_0x147785[_0x3f94('0x25')][_0x3f94('0x27')]);return _0x303d26(_0x147785[_0x3f94('0x25')][_0x3f94('0x27')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x2abc45,'request\x20sent');_0x303d26(_0x147785[_0x3f94('0x28')][_0x3f94('0x27')]);}})[_0x3f94('0x29')](function(_0x4e8858){logger[_0x3f94('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x2abc45,_0x4e8858);_0x55a923(_0x4e8858);});});}function respondWithStatusCode(_0x29b26a,_0x28d173){_0x28d173=_0x28d173||0xcc;return function(_0x122d70){if(_0x122d70){return _0x29b26a[_0x3f94('0x2a')](_0x28d173);}return _0x29b26a[_0x3f94('0x2b')](_0x28d173)[_0x3f94('0x2c')]();};}function respondWithResult(_0x1e9d7e,_0x386160){_0x386160=_0x386160||0xc8;return function(_0x176c03){if(_0x176c03){return _0x1e9d7e[_0x3f94('0x2b')](_0x386160)[_0x3f94('0x2d')](_0x176c03);}};}function respondWithFilteredResult(_0xc78c14,_0x402add){return function(_0x13ef65){if(_0x13ef65){var _0x3e0661=typeof _0x402add[_0x3f94('0x2e')]===_0x3f94('0x2f')&&typeof _0x402add[_0x3f94('0x30')]==='undefined';var _0x1a12d3=_0x13ef65[_0x3f94('0x31')];var _0x5a7f24=_0x3e0661?0x0:_0x402add['offset'];var _0x4212e6=_0x3e0661?_0x13ef65[_0x3f94('0x31')]:_0x402add[_0x3f94('0x2e')]+_0x402add[_0x3f94('0x30')];var _0x594296;if(_0x4212e6>=_0x1a12d3){_0x4212e6=_0x1a12d3;_0x594296=0xc8;}else{_0x594296=0xce;}_0xc78c14[_0x3f94('0x2b')](_0x594296);return _0xc78c14[_0x3f94('0x32')](_0x3f94('0x33'),_0x5a7f24+'-'+_0x4212e6+'/'+_0x1a12d3)[_0x3f94('0x2d')](_0x13ef65);}return null;};}function patchUpdates(_0x377c6b){return function(_0xf08d60){try{jsonpatch[_0x3f94('0x34')](_0xf08d60,_0x377c6b,!![]);}catch(_0xf305ac){return BPromise[_0x3f94('0x35')](_0xf305ac);}return _0xf08d60['save']();};}function saveUpdates(_0x500133,_0x263195){return function(_0x35fdda){if(_0x35fdda){return _0x35fdda['update'](_0x500133)['then'](function(_0x4a4697){return _0x4a4697;});}return null;};}function removeEntity(_0x54ff40,_0x55feb6){return function(_0x254c41){if(_0x254c41){return _0x254c41[_0x3f94('0x36')]()['then'](function(){var _0x465104=_0x254c41['get']({'plain':!![]});var _0x9fca99=_0x3f94('0x37');return db[_0x3f94('0x38')][_0x3f94('0x36')]({'where':{'type':_0x9fca99,'resourceId':_0x465104['id']}})['then'](function(){return _0x254c41;});})[_0x3f94('0x39')](function(){_0x54ff40[_0x3f94('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x549484,_0xd8e46f){return function(_0x12463d){if(!_0x12463d){_0x549484['sendStatus'](0x194);}return _0x12463d;};}function handleError(_0x4c8c58,_0x1fbe74){_0x1fbe74=_0x1fbe74||0x1f4;return function(_0x4c5b8a){logger[_0x3f94('0x25')](_0x4c5b8a[_0x3f94('0x3a')]);if(_0x4c5b8a[_0x3f94('0x3b')]){delete _0x4c5b8a[_0x3f94('0x3b')];}_0x4c8c58['status'](_0x1fbe74)[_0x3f94('0x3c')](_0x4c5b8a);};}exports[_0x3f94('0x3d')]=function(_0x5e6d4a,_0x495196){var _0x5d7468={'include':[{'model':db[_0x3f94('0x3e')],'as':'mandatoryDispositionPause'}]},_0x3bae04={},_0x24201d={'count':0x0,'rows':[]};var _0xd01f2d=_[_0x3f94('0x3f')](db['WhatsappAccount'][_0x3f94('0x40')],function(_0x3541c6){return{'name':_0x3541c6[_0x3f94('0x41')],'type':_0x3541c6[_0x3f94('0x42')]['key']};});_0x3bae04[_0x3f94('0x43')]=_[_0x3f94('0x3f')](_0xd01f2d,'name');_0x3bae04[_0x3f94('0x44')]=_[_0x3f94('0x45')](_0x5e6d4a[_0x3f94('0x44')]);_0x3bae04[_0x3f94('0x46')]=_[_0x3f94('0x47')](_0x3bae04['model'],_0x3bae04[_0x3f94('0x44')]);_0x5d7468['attributes']=_['intersection'](_0x3bae04[_0x3f94('0x43')],qs[_0x3f94('0x48')](_0x5e6d4a['query'][_0x3f94('0x48')]));_0x5d7468['attributes']=_0x5d7468[_0x3f94('0x49')][_0x3f94('0x4a')]?_0x5d7468[_0x3f94('0x49')]:_0x3bae04[_0x3f94('0x43')];if(!_0x5e6d4a[_0x3f94('0x44')][_0x3f94('0x4b')]('nolimit')){_0x5d7468[_0x3f94('0x30')]=qs['limit'](_0x5e6d4a[_0x3f94('0x44')][_0x3f94('0x30')]);_0x5d7468[_0x3f94('0x2e')]=qs[_0x3f94('0x2e')](_0x5e6d4a[_0x3f94('0x44')][_0x3f94('0x2e')]);}_0x5d7468[_0x3f94('0x4c')]=qs['sort'](_0x5e6d4a[_0x3f94('0x44')][_0x3f94('0x4d')]);_0x5d7468[_0x3f94('0x4e')]=qs[_0x3f94('0x46')](_[_0x3f94('0x4f')](_0x5e6d4a['query'],_0x3bae04['filters']),_0xd01f2d);if(_0x5e6d4a[_0x3f94('0x44')][_0x3f94('0x50')]){_0x5d7468['where']=_[_0x3f94('0x51')](_0x5d7468[_0x3f94('0x4e')],{'$or':_[_0x3f94('0x3f')](_0xd01f2d,function(_0x577b49){if(_0x577b49['type']!==_0x3f94('0x52')){var _0x1457c5={};_0x1457c5[_0x577b49[_0x3f94('0x3b')]]={'$like':'%'+_0x5e6d4a[_0x3f94('0x44')]['filter']+'%'};return _0x1457c5;}})});}_0x5d7468=_[_0x3f94('0x51')]({},_0x5d7468,_0x5e6d4a[_0x3f94('0x53')]);var _0x2ff4c2={'where':_0x5d7468[_0x3f94('0x4e')]};return db[_0x3f94('0x54')][_0x3f94('0x31')](_0x2ff4c2)[_0x3f94('0x39')](function(_0x28c475){_0x24201d[_0x3f94('0x31')]=_0x28c475;if(_0x5e6d4a[_0x3f94('0x44')][_0x3f94('0x55')]){_0x5d7468[_0x3f94('0x56')]=[{'all':!![]}];}return db[_0x3f94('0x54')][_0x3f94('0x57')](_0x5d7468);})['then'](function(_0x251b15){_0x24201d[_0x3f94('0x58')]=_0x251b15;return _0x24201d;})[_0x3f94('0x39')](respondWithFilteredResult(_0x495196,_0x5d7468))[_0x3f94('0x29')](handleError(_0x495196,null));};exports[_0x3f94('0x59')]=function(_0x3537af,_0x43f064){var _0xc9d750={'raw':![],'where':{'id':_0x3537af[_0x3f94('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x3f94('0x5b')}]},_0x3f01a3={};_0x3f01a3[_0x3f94('0x43')]=_[_0x3f94('0x45')](db[_0x3f94('0x54')][_0x3f94('0x40')]);_0x3f01a3[_0x3f94('0x44')]=_['keys'](_0x3537af[_0x3f94('0x44')]);_0x3f01a3[_0x3f94('0x46')]=_[_0x3f94('0x47')](_0x3f01a3['model'],_0x3f01a3['query']);_0xc9d750[_0x3f94('0x49')]=_[_0x3f94('0x47')](_0x3f01a3[_0x3f94('0x43')],qs[_0x3f94('0x48')](_0x3537af[_0x3f94('0x44')][_0x3f94('0x48')]));_0xc9d750[_0x3f94('0x49')]=_0xc9d750['attributes'][_0x3f94('0x4a')]?_0xc9d750[_0x3f94('0x49')]:_0x3f01a3[_0x3f94('0x43')];if(_0x3537af[_0x3f94('0x44')][_0x3f94('0x55')]){_0xc9d750['include']=[{'all':!![]}];}_0xc9d750=_[_0x3f94('0x51')]({},_0xc9d750,_0x3537af[_0x3f94('0x53')]);return db['WhatsappAccount'][_0x3f94('0x5c')](_0xc9d750)[_0x3f94('0x39')](handleEntityNotFound(_0x43f064,null))['then'](respondWithResult(_0x43f064,null))[_0x3f94('0x29')](handleError(_0x43f064,null));};exports[_0x3f94('0x5d')]=function(_0x3f5dc3,_0x41317b){return db['WhatsappAccount'][_0x3f94('0x5d')](_0x3f5dc3[_0x3f94('0x5e')],{})[_0x3f94('0x39')](function(_0x23f71b){var _0x908a9=_0x3f5dc3['user'][_0x3f94('0x5f')]({'plain':!![]});if(!_0x908a9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x908a9[_0x3f94('0x60')]===_0x3f94('0x61')){var _0x424695=_0x23f71b[_0x3f94('0x5f')]({'plain':!![]});var _0x29eed5=_0x3f94('0x37');return db['UserProfileSection'][_0x3f94('0x5c')]({'where':{'name':_0x29eed5,'userProfileId':_0x908a9[_0x3f94('0x62')]},'raw':!![]})['then'](function(_0x9af88){if(_0x9af88&&_0x9af88['autoAssociation']===0x0){return db[_0x3f94('0x38')][_0x3f94('0x5d')]({'name':_0x424695[_0x3f94('0x3b')],'resourceId':_0x424695['id'],'type':_0x9af88[_0x3f94('0x3b')],'sectionId':_0x9af88['id']},{})[_0x3f94('0x39')](function(){return _0x23f71b;});}else{return _0x23f71b;}})['catch'](function(_0x4779bb){logger[_0x3f94('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4779bb);throw _0x4779bb;});}return _0x23f71b;})[_0x3f94('0x39')](respondWithResult(_0x41317b,0xc9))[_0x3f94('0x29')](handleError(_0x41317b,null));};exports[_0x3f94('0x63')]=function(_0x47fd5c,_0xd433ec){if(_0x47fd5c[_0x3f94('0x5e')]['id']){delete _0x47fd5c[_0x3f94('0x5e')]['id'];}return db['WhatsappAccount'][_0x3f94('0x5c')]({'where':{'id':_0x47fd5c['params']['id']},'include':[{'model':db[_0x3f94('0x3e')],'as':_0x3f94('0x5b')}]})[_0x3f94('0x39')](handleEntityNotFound(_0xd433ec,null))[_0x3f94('0x39')](saveUpdates(_0x47fd5c[_0x3f94('0x5e')],null))[_0x3f94('0x39')](respondWithResult(_0xd433ec,null))[_0x3f94('0x29')](handleError(_0xd433ec,null));};exports[_0x3f94('0x36')]=function(_0x1124b0,_0x3e9fd3){return db[_0x3f94('0x54')][_0x3f94('0x5c')]({'where':{'id':_0x1124b0['params']['id']}})[_0x3f94('0x39')](handleEntityNotFound(_0x3e9fd3,null))['then'](removeEntity(_0x3e9fd3,null))[_0x3f94('0x29')](handleError(_0x3e9fd3,null));};exports[_0x3f94('0x64')]=function(_0x2f5c1a,_0x2e0a54){return db[_0x3f94('0x54')][_0x3f94('0x64')]()[_0x3f94('0x39')](respondWithResult(_0x2e0a54,null))[_0x3f94('0x29')](handleError(_0x2e0a54,null));};exports[_0x3f94('0x65')]=function(_0x36f1a7,_0x13a313,_0x43d88c){if(_0x36f1a7[_0x3f94('0x5e')]['id']){delete _0x36f1a7[_0x3f94('0x5e')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x36f1a7[_0x3f94('0x5a')]['id']}})[_0x3f94('0x39')](handleEntityNotFound(_0x13a313,null))[_0x3f94('0x39')](function(_0x478e41){if(_0x478e41){_0x36f1a7[_0x3f94('0x5e')][_0x3f94('0x66')]=_0x478e41['id'];return db[_0x3f94('0x67')][_0x3f94('0x5d')](_0x36f1a7[_0x3f94('0x5e')]);}})[_0x3f94('0x39')](respondWithResult(_0x13a313,null))['catch'](handleError(_0x13a313,null));};exports[_0x3f94('0x68')]=function(_0x11ad49,_0x3c3119,_0xa1566b){var _0x3d7561={'raw':![],'where':{}};var _0x4fc4c5={};var _0x30cfc6={'count':0x0,'rows':[]};return db[_0x3f94('0x54')]['findOne']({'where':{'id':_0x11ad49[_0x3f94('0x5a')]['id']}})[_0x3f94('0x39')](handleEntityNotFound(_0x3c3119,null))['then'](function(_0x62d61b){if(_0x62d61b){_0x4fc4c5[_0x3f94('0x43')]=_['keys'](db[_0x3f94('0x67')][_0x3f94('0x40')]);_0x4fc4c5['query']=_[_0x3f94('0x45')](_0x11ad49[_0x3f94('0x44')]);_0x4fc4c5[_0x3f94('0x46')]=_[_0x3f94('0x47')](_0x4fc4c5[_0x3f94('0x43')],_0x4fc4c5[_0x3f94('0x44')]);_0x3d7561[_0x3f94('0x49')]=_[_0x3f94('0x47')](_0x4fc4c5['model'],qs[_0x3f94('0x48')](_0x11ad49[_0x3f94('0x44')]['fields']));_0x3d7561[_0x3f94('0x49')]=_0x3d7561['attributes'][_0x3f94('0x4a')]?_0x3d7561[_0x3f94('0x49')]:_0x4fc4c5[_0x3f94('0x43')];if(!_0x11ad49[_0x3f94('0x44')][_0x3f94('0x4b')](_0x3f94('0x69'))){_0x3d7561[_0x3f94('0x30')]=qs[_0x3f94('0x30')](_0x11ad49['query'][_0x3f94('0x30')]);_0x3d7561['offset']=qs[_0x3f94('0x2e')](_0x11ad49[_0x3f94('0x44')]['offset']);}_0x3d7561[_0x3f94('0x4c')]=qs['sort'](_0x11ad49[_0x3f94('0x44')][_0x3f94('0x4d')]);_0x3d7561['where']=qs[_0x3f94('0x46')](_[_0x3f94('0x4f')](_0x11ad49['query'],_0x4fc4c5[_0x3f94('0x46')]));_0x3d7561[_0x3f94('0x4e')][_0x3f94('0x66')]=_0x62d61b['id'];if(_0x11ad49[_0x3f94('0x44')]['filter']){_0x3d7561[_0x3f94('0x4e')]=_[_0x3f94('0x51')](_0x3d7561['where'],{'$or':_[_0x3f94('0x3f')](_0x3d7561[_0x3f94('0x49')],function(_0x56df21){var _0x53e90a={};_0x53e90a[_0x56df21]={'$like':'%'+_0x11ad49[_0x3f94('0x44')][_0x3f94('0x50')]+'%'};return _0x53e90a;})});}_0x3d7561=_[_0x3f94('0x51')]({},_0x3d7561,_0x11ad49[_0x3f94('0x53')]);return db[_0x3f94('0x67')][_0x3f94('0x31')]({'where':_0x3d7561[_0x3f94('0x4e')]})[_0x3f94('0x39')](function(_0x16b887){_0x30cfc6[_0x3f94('0x31')]=_0x16b887;if(_0x11ad49[_0x3f94('0x44')]['includeAll']){_0x3d7561[_0x3f94('0x56')]=[{'all':!![]}];}return db[_0x3f94('0x67')][_0x3f94('0x57')](_0x3d7561);})[_0x3f94('0x39')](function(_0x49535d){_0x30cfc6['rows']=_0x49535d;return _0x30cfc6;});}})['then'](respondWithFilteredResult(_0x3c3119,_0x3d7561))[_0x3f94('0x29')](handleError(_0x3c3119,null));};exports[_0x3f94('0x6a')]=function(_0x2d4c30,_0x23319b,_0x2401c8){return db[_0x3f94('0x54')][_0x3f94('0x5c')]({'where':{'id':_0x2d4c30[_0x3f94('0x5a')]['id']}})[_0x3f94('0x39')](handleEntityNotFound(_0x23319b,null))['then'](function(_0x21043e){if(_0x21043e){return _0x21043e['removeDispositions'](_0x2d4c30[_0x3f94('0x44')][_0x3f94('0x6b')]);}})[_0x3f94('0x39')](respondWithStatusCode(_0x23319b,null))[_0x3f94('0x29')](handleError(_0x23319b,null));};exports[_0x3f94('0x6c')]=function(_0x5c920a,_0xab487a,_0x803a9){if(_0x5c920a[_0x3f94('0x5e')]['id']){delete _0x5c920a[_0x3f94('0x5e')]['id'];}return db[_0x3f94('0x54')]['find']({'where':{'id':_0x5c920a['params']['id']}})['then'](handleEntityNotFound(_0xab487a,null))[_0x3f94('0x39')](function(_0x5a2af){if(_0x5a2af){_0x5c920a['body'][_0x3f94('0x66')]=_0x5a2af['id'];return db[_0x3f94('0x6d')][_0x3f94('0x5d')](_0x5c920a['body']);}})[_0x3f94('0x39')](respondWithResult(_0xab487a,null))[_0x3f94('0x29')](handleError(_0xab487a,null));};exports[_0x3f94('0x6e')]=function(_0x500d78,_0x4b4855,_0x4e90e4){var _0x5df0a1={'raw':![],'where':{}};var _0x812fa8={};var _0x150b7a={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x3f94('0x6f')]({'where':{'id':_0x500d78[_0x3f94('0x5a')]['id']}})[_0x3f94('0x39')](handleEntityNotFound(_0x4b4855,null))[_0x3f94('0x39')](function(_0x4ed5e5){if(_0x4ed5e5){_0x812fa8[_0x3f94('0x43')]=_[_0x3f94('0x45')](db[_0x3f94('0x6d')][_0x3f94('0x40')]);_0x812fa8[_0x3f94('0x44')]=_[_0x3f94('0x45')](_0x500d78[_0x3f94('0x44')]);_0x812fa8[_0x3f94('0x46')]=_[_0x3f94('0x47')](_0x812fa8[_0x3f94('0x43')],_0x812fa8[_0x3f94('0x44')]);_0x5df0a1[_0x3f94('0x49')]=_['intersection'](_0x812fa8[_0x3f94('0x43')],qs[_0x3f94('0x48')](_0x500d78[_0x3f94('0x44')][_0x3f94('0x48')]));_0x5df0a1[_0x3f94('0x49')]=_0x5df0a1[_0x3f94('0x49')][_0x3f94('0x4a')]?_0x5df0a1[_0x3f94('0x49')]:_0x812fa8['model'];if(!_0x500d78[_0x3f94('0x44')]['hasOwnProperty'](_0x3f94('0x69'))){_0x5df0a1[_0x3f94('0x30')]=qs[_0x3f94('0x30')](_0x500d78[_0x3f94('0x44')]['limit']);_0x5df0a1[_0x3f94('0x2e')]=qs[_0x3f94('0x2e')](_0x500d78[_0x3f94('0x44')][_0x3f94('0x2e')]);}_0x5df0a1[_0x3f94('0x4c')]=qs[_0x3f94('0x4d')](_0x500d78[_0x3f94('0x44')][_0x3f94('0x4d')]);_0x5df0a1[_0x3f94('0x4e')]=qs['filters'](_[_0x3f94('0x4f')](_0x500d78[_0x3f94('0x44')],_0x812fa8[_0x3f94('0x46')]));_0x5df0a1[_0x3f94('0x4e')][_0x3f94('0x66')]=_0x4ed5e5['id'];if(_0x500d78['query']['filter']){_0x5df0a1['where']=_[_0x3f94('0x51')](_0x5df0a1['where'],{'$or':_[_0x3f94('0x3f')](_0x5df0a1[_0x3f94('0x49')],function(_0x1de727){var _0x5e4234={};_0x5e4234[_0x1de727]={'$like':'%'+_0x500d78[_0x3f94('0x44')][_0x3f94('0x50')]+'%'};return _0x5e4234;})});}_0x5df0a1=_[_0x3f94('0x51')]({},_0x5df0a1,_0x500d78[_0x3f94('0x53')]);return db[_0x3f94('0x6d')]['count']({'where':_0x5df0a1['where']})[_0x3f94('0x39')](function(_0xbe6916){_0x150b7a[_0x3f94('0x31')]=_0xbe6916;if(_0x500d78['query'][_0x3f94('0x55')]){_0x5df0a1[_0x3f94('0x56')]=[{'all':!![]}];}return db[_0x3f94('0x6d')][_0x3f94('0x57')](_0x5df0a1);})[_0x3f94('0x39')](function(_0x5dbaf2){_0x150b7a[_0x3f94('0x58')]=_0x5dbaf2;return _0x150b7a;});}})[_0x3f94('0x39')](respondWithFilteredResult(_0x4b4855,_0x5df0a1))[_0x3f94('0x29')](handleError(_0x4b4855,null));};exports[_0x3f94('0x70')]=function(_0x4b1db9,_0x29c8f4,_0x75f03c){return db[_0x3f94('0x54')][_0x3f94('0x5c')]({'where':{'id':_0x4b1db9['params']['id']}})['then'](handleEntityNotFound(_0x29c8f4,null))[_0x3f94('0x39')](function(_0x2a3c09){if(_0x2a3c09){return _0x2a3c09['removeAnswers'](_0x4b1db9[_0x3f94('0x44')]['ids']);}})[_0x3f94('0x39')](respondWithStatusCode(_0x29c8f4,null))[_0x3f94('0x29')](handleError(_0x29c8f4,null));};exports[_0x3f94('0x71')]=function(_0x4e170d,_0x4d062c,_0x14b115){return db[_0x3f94('0x54')][_0x3f94('0x5c')]({'where':{'id':_0x4e170d[_0x3f94('0x5a')]['id']}})[_0x3f94('0x39')](handleEntityNotFound(_0x4d062c,null))[_0x3f94('0x39')](function(_0x5a9d63){if(_0x5a9d63){return _0x5a9d63['addAgents'](_0x4e170d[_0x3f94('0x5e')][_0x3f94('0x6b')],_[_0x3f94('0x72')](_0x4e170d[_0x3f94('0x5e')],['ids','id'])||{})[_0x3f94('0x73')](function(_0x69726f){for(var _0x4aec98=0x0;_0x4aec98<_0x4e170d[_0x3f94('0x5e')][_0x3f94('0x6b')][_0x3f94('0x4a')];_0x4aec98+=0x1){socket[_0x3f94('0x74')]('userWhatsappAccount:save',{'UserId':Number(_0x4e170d[_0x3f94('0x5e')][_0x3f94('0x6b')][_0x4aec98]),'WhatsappAccountId':Number(_0x4e170d[_0x3f94('0x5a')]['id'])});}return _0x69726f;});}})[_0x3f94('0x39')](respondWithResult(_0x4d062c,null))[_0x3f94('0x29')](handleError(_0x4d062c,null));};exports['removeAgents']=function(_0x5a9357,_0x32a59d,_0x40df45){return db['WhatsappAccount'][_0x3f94('0x5c')]({'where':{'id':_0x5a9357[_0x3f94('0x5a')]['id']}})[_0x3f94('0x39')](handleEntityNotFound(_0x32a59d,null))['then'](function(_0x59f64d){if(_0x59f64d){return _0x59f64d[_0x3f94('0x75')](_0x5a9357[_0x3f94('0x44')]['ids'])[_0x3f94('0x39')](function(){if(_[_0x3f94('0x76')](_0x5a9357['query'][_0x3f94('0x6b')])){for(var _0x22edf8=0x0;_0x22edf8<_0x5a9357[_0x3f94('0x44')][_0x3f94('0x6b')][_0x3f94('0x4a')];_0x22edf8+=0x1){socket[_0x3f94('0x74')]('userWhatsappAccount:remove',{'UserId':Number(_0x5a9357[_0x3f94('0x44')]['ids'][_0x22edf8]),'WhatsappAccountId':Number(_0x5a9357[_0x3f94('0x5a')]['id'])});}}else{socket['emit'](_0x3f94('0x77'),{'UserId':Number(_0x5a9357[_0x3f94('0x44')][_0x3f94('0x6b')]),'WhatsappAccountId':Number(_0x5a9357[_0x3f94('0x5a')]['id'])});}});}})[_0x3f94('0x39')](respondWithStatusCode(_0x32a59d,null))['catch'](handleError(_0x32a59d,null));};exports[_0x3f94('0x78')]=function(_0x133c3a,_0x377c5e,_0x11de6f){var _0x46c09c={};var _0x4a783e={};var _0x398eb9;var _0x377db3;return db[_0x3f94('0x54')][_0x3f94('0x6f')]({'where':{'id':_0x133c3a[_0x3f94('0x5a')]['id']}})[_0x3f94('0x39')](handleEntityNotFound(_0x377c5e,null))[_0x3f94('0x39')](function(_0x312d50){if(_0x312d50){_0x398eb9=_0x312d50;_0x4a783e[_0x3f94('0x43')]=_[_0x3f94('0x45')](db[_0x3f94('0x79')]['rawAttributes']);_0x4a783e[_0x3f94('0x44')]=_['keys'](_0x133c3a[_0x3f94('0x44')]);_0x4a783e[_0x3f94('0x46')]=_[_0x3f94('0x47')](_0x4a783e[_0x3f94('0x43')],_0x4a783e['query']);_0x46c09c[_0x3f94('0x49')]=_[_0x3f94('0x47')](_0x4a783e[_0x3f94('0x43')],qs[_0x3f94('0x48')](_0x133c3a[_0x3f94('0x44')]['fields']));_0x46c09c[_0x3f94('0x49')]=_0x46c09c['attributes']['length']?_0x46c09c[_0x3f94('0x49')]:_0x4a783e[_0x3f94('0x43')];_0x46c09c[_0x3f94('0x4c')]=qs['sort'](_0x133c3a[_0x3f94('0x44')][_0x3f94('0x4d')]);_0x46c09c[_0x3f94('0x4e')]=qs[_0x3f94('0x46')](_['pick'](_0x133c3a[_0x3f94('0x44')],_0x4a783e[_0x3f94('0x46')]));if(_0x133c3a[_0x3f94('0x44')][_0x3f94('0x50')]){_0x46c09c['where']=_[_0x3f94('0x51')](_0x46c09c[_0x3f94('0x4e')],{'$or':_[_0x3f94('0x3f')](_0x46c09c[_0x3f94('0x49')],function(_0x81bde4){var _0x4fb6ed={};_0x4fb6ed[_0x81bde4]={'$like':'%'+_0x133c3a[_0x3f94('0x44')][_0x3f94('0x50')]+'%'};return _0x4fb6ed;})});}_0x46c09c=_[_0x3f94('0x51')]({},_0x46c09c,_0x133c3a[_0x3f94('0x53')]);return _0x398eb9['getAgents'](_0x46c09c);}})[_0x3f94('0x39')](function(_0x33f01b){if(_0x33f01b){_0x377db3=_0x33f01b[_0x3f94('0x4a')];if(!_0x133c3a[_0x3f94('0x44')][_0x3f94('0x4b')](_0x3f94('0x69'))){_0x46c09c[_0x3f94('0x30')]=qs['limit'](_0x133c3a[_0x3f94('0x44')][_0x3f94('0x30')]);_0x46c09c[_0x3f94('0x2e')]=qs['offset'](_0x133c3a[_0x3f94('0x44')][_0x3f94('0x2e')]);}return _0x398eb9[_0x3f94('0x78')](_0x46c09c);}})[_0x3f94('0x39')](function(_0x38aeb3){if(_0x38aeb3){return _0x38aeb3?{'count':_0x377db3,'rows':_0x38aeb3}:null;}})[_0x3f94('0x39')](respondWithResult(_0x377c5e,null))['catch'](handleError(_0x377c5e,null));};exports['addApplications']=function(_0x2b7f05,_0x4160d2){var _0x5628d8=_0x2b7f05[_0x3f94('0x5a')]['id'];var _0x5014f2=_0x2b7f05[_0x3f94('0x5e')];var _0xf26f4a=0xc8;var _0x534c68=null;return db[_0x3f94('0x7a')][_0x3f94('0x7b')]({'isolationLevel':db[_0x3f94('0x7a')][_0x3f94('0x7c')][_0x3f94('0x7d')][_0x3f94('0x7e')]},function(_0x3e0691){return db[_0x3f94('0x54')][_0x3f94('0x6f')]({'where':{'id':_0x5628d8},'transaction':_0x3e0691})[_0x3f94('0x39')](function(_0x2ea836){if(_0x2ea836){return db[_0x3f94('0x7f')][_0x3f94('0x36')]({'where':{'WhatsappAccountId':_0x5628d8},'transaction':_0x3e0691})['then'](function(){var _0x3ba0a8=_[_0x3f94('0x3f')](_0x5014f2,function(_0x19a8b8){_0x19a8b8['WhatsappAccountId']=_0x5628d8;return _0x19a8b8;});return db[_0x3f94('0x7f')][_0x3f94('0x80')](_0x3ba0a8,{'transaction':_0x3e0691});});}else{_0xf26f4a=0x194;_0x534c68=[];}});})[_0x3f94('0x39')](function(){if(_0xf26f4a!==0x194){return db[_0x3f94('0x7f')][_0x3f94('0x81')]({'where':{'WhatsappAccountId':_0x5628d8},'order':_0x3f94('0x82')})[_0x3f94('0x39')](function(_0x153be9){_0x534c68=_0x153be9;});}})[_0x3f94('0x29')](function(_0x104bfb){_0xf26f4a=0x1f4;logger[_0x3f94('0x25')](_0x104bfb[_0x3f94('0x3a')]);if(_0x104bfb[_0x3f94('0x3b')]){delete _0x104bfb[_0x3f94('0x3b')];}_0x534c68=_0x104bfb;})[_0x3f94('0x83')](function(){if(_0x534c68===null){_0x4160d2[_0x3f94('0x2a')](_0xf26f4a);}else{if(_0xf26f4a===0x1f4){_0x4160d2['status'](_0xf26f4a)[_0x3f94('0x3c')](_0x534c68);}else{_0x4160d2['status'](_0xf26f4a)['json'](_0x534c68);}}});};exports[_0x3f94('0x84')]=function(_0x26db89,_0x13b402,_0x20c641){var _0x14659e={};var _0x2def48={};var _0x586ef3;var _0x5f48a2;return db[_0x3f94('0x54')]['findOne']({'where':{'id':_0x26db89[_0x3f94('0x5a')]['id']}})[_0x3f94('0x39')](handleEntityNotFound(_0x13b402,null))[_0x3f94('0x39')](function(_0x10a218){if(_0x10a218){_0x586ef3=_0x10a218;_0x2def48[_0x3f94('0x43')]=_['keys'](db[_0x3f94('0x7f')][_0x3f94('0x40')]);_0x2def48['query']=_['keys'](_0x26db89[_0x3f94('0x44')]);_0x2def48['filters']=_[_0x3f94('0x47')](_0x2def48[_0x3f94('0x43')],_0x2def48[_0x3f94('0x44')]);_0x14659e['attributes']=_[_0x3f94('0x47')](_0x2def48[_0x3f94('0x43')],qs[_0x3f94('0x48')](_0x26db89[_0x3f94('0x44')][_0x3f94('0x48')]));_0x14659e['attributes']=_0x14659e['attributes'][_0x3f94('0x4a')]?_0x14659e[_0x3f94('0x49')]:_0x2def48[_0x3f94('0x43')];_0x14659e['order']=qs[_0x3f94('0x4d')](_0x26db89[_0x3f94('0x44')][_0x3f94('0x4d')]);_0x14659e[_0x3f94('0x4e')]=qs[_0x3f94('0x46')](_[_0x3f94('0x4f')](_0x26db89[_0x3f94('0x44')],_0x2def48[_0x3f94('0x46')]));if(_0x26db89[_0x3f94('0x44')][_0x3f94('0x50')]){_0x14659e[_0x3f94('0x4e')]=_[_0x3f94('0x51')](_0x14659e[_0x3f94('0x4e')],{'$or':_['map'](_0x14659e[_0x3f94('0x49')],function(_0x294482){var _0x5d8946={};_0x5d8946[_0x294482]={'$like':'%'+_0x26db89[_0x3f94('0x44')]['filter']+'%'};return _0x5d8946;})});}_0x14659e=_[_0x3f94('0x51')]({},_0x14659e,_0x26db89[_0x3f94('0x53')]);return _0x586ef3[_0x3f94('0x84')](_0x14659e);}})[_0x3f94('0x39')](function(_0x1b748b){if(_0x1b748b){_0x5f48a2=_0x1b748b['length'];if(!_0x26db89['query'][_0x3f94('0x4b')](_0x3f94('0x69'))){_0x14659e[_0x3f94('0x30')]=qs[_0x3f94('0x30')](_0x26db89['query'][_0x3f94('0x30')]);_0x14659e[_0x3f94('0x2e')]=qs[_0x3f94('0x2e')](_0x26db89[_0x3f94('0x44')][_0x3f94('0x2e')]);}return _0x586ef3[_0x3f94('0x84')](_0x14659e);}})['then'](function(_0x5e1b07){if(_0x5e1b07){return _0x5e1b07?{'count':_0x5f48a2,'rows':_0x5e1b07}:null;}})[_0x3f94('0x39')](respondWithResult(_0x13b402,null))[_0x3f94('0x29')](handleError(_0x13b402,null));};exports[_0x3f94('0x85')]=function(_0xe86953,_0x40a4b1,_0x2df1f4){var _0x51f65b={'channel':'whatsapp'};var _0x153887=[];var _0x2c9640=[];var _0x29f5cb={};return db[_0x3f94('0x54')][_0x3f94('0x5c')]({'where':{'id':_0xe86953[_0x3f94('0x5a')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x3f94('0x86')}]})[_0x3f94('0x39')](handleEntityNotFound(_0x40a4b1,null))[_0x3f94('0x39')](function(_0x429a57){_0x51f65b[_0x3f94('0x87')]=_0x429a57;if(_0x51f65b['account']&&_0x51f65b['account']['type']===_0x3f94('0x88')&&_0xe86953[_0x3f94('0x5e')]['statuses']){if(_0xe86953[_0x3f94('0x5e')]['statuses'][_0x3f94('0x4a')]===0x0)return;if(_0xe86953[_0x3f94('0x5e')][_0x3f94('0x89')][0x0][_0x3f94('0x8a')]!==_0x3f94('0x8b'))return;return db[_0x3f94('0x8c')]['update']({'read':!![],'readAt':_0xe86953[_0x3f94('0x5e')]['statuses'][0x0][_0x3f94('0x8d')]},{'where':{'messageId':_0xe86953['body'][_0x3f94('0x89')][0x0][_0x3f94('0x8e')]},'individualHooks':!![]})[_0x3f94('0x39')](function(_0x1b7daf){return _0x40a4b1[_0x3f94('0x2b')](0xc8)[_0x3f94('0x2d')](_0x1b7daf);});}_0x51f65b[_0x3f94('0x8f')]=_['orderBy'](_0x429a57['Applications'],[_0x3f94('0x82')],['asc']);if(_0x51f65b['account'][_0x3f94('0x86')]){delete _0x51f65b[_0x3f94('0x87')][_0x3f94('0x86')];}return db['CmContact'][_0x3f94('0x64')]()[_0x3f94('0x39')](function(_0x7c85d5){if(!_0x7c85d5){throw new db[(_0x3f94('0x90'))]['ValidationError']('no\x20available\x20attributes');}_0x153887=_[_0x3f94('0x91')](_[_0x3f94('0x45')](_0x7c85d5),[_0x3f94('0x92'),_0x3f94('0x93')]);_0x2c9640=_[_0x3f94('0x91')](_[_0x3f94('0x45')](_0x7c85d5),[_0x3f94('0x92'),_0x3f94('0x93'),_0x3f94('0x94'),_0x3f94('0x95')]);_0x51f65b[_0x3f94('0x5e')]={'mapKey':_0x3f94('0x96')};if(_0x51f65b[_0x3f94('0x87')]&&_0x51f65b['account'][_0x3f94('0x42')]===_0x3f94('0x97')){_0x51f65b[_0x3f94('0x5e')][_0x3f94('0x98')]=_0xe86953[_0x3f94('0x5e')][_0x3f94('0x99')][_0x3f94('0x9a')](_0x3f94('0x9b'),'');_0x51f65b[_0x3f94('0x5e')][_0x3f94('0x5e')]=_0xe86953[_0x3f94('0x5e')][_0x3f94('0x9c')];_0x51f65b[_0x3f94('0x5e')][_0x3f94('0x9d')]=_0xe86953['body'][_0x3f94('0x9e')];}if(_0x51f65b[_0x3f94('0x87')]&&_0x51f65b[_0x3f94('0x87')][_0x3f94('0x42')]===_0x3f94('0x88')){_0x51f65b['body'][_0x3f94('0x98')]=_0xe86953[_0x3f94('0x5e')]['notifications'][0x0][_0x3f94('0x98')];_0x51f65b[_0x3f94('0x5e')][_0x3f94('0x5e')]=_0xe86953[_0x3f94('0x5e')][_0x3f94('0x9f')][0x0][_0x3f94('0x27')]['body'];_0x51f65b['body'][_0x3f94('0x9d')]=_0xe86953[_0x3f94('0x5e')]['notifications'][0x0][_0x3f94('0x8e')];}if(_0x51f65b[_0x3f94('0x5e')]['id']){delete _0x51f65b[_0x3f94('0x5e')]['id'];}if(_[_0x3f94('0xa0')](_0x51f65b[_0x3f94('0x5e')][_0x3f94('0x98')])){throw new db[(_0x3f94('0x90'))]['ValidationError'](_0x3f94('0xa1'));}if(_['isNil'](_0x51f65b[_0x3f94('0x5e')][_0x3f94('0x5e')])||_0x51f65b['body'][_0x3f94('0x5e')]===''){throw new db['Sequelize'][(_0x3f94('0xa2'))](_0x3f94('0xa3'));}if(_[_0x3f94('0xa0')](_0x51f65b['body']['mapKey'])){throw new db[(_0x3f94('0x90'))]['ValidationError'](_0x3f94('0xa4')+_0x2c9640);}if(!_['includes'](_0x2c9640,_0x51f65b[_0x3f94('0x5e')]['mapKey'])){throw new db[(_0x3f94('0x90'))][(_0x3f94('0xa2'))](_0x3f94('0xa5')+_0x2c9640);}_0x29f5cb[_0x51f65b['body'][_0x3f94('0xa6')]]=_0x51f65b['body'][_0x3f94('0x98')];return db[_0x3f94('0xa7')][_0x3f94('0x5c')]({'where':{'id':_0x51f65b[_0x3f94('0x87')][_0x3f94('0x95')]},'include':[{'model':db[_0x3f94('0xa8')],'as':_0x3f94('0xa9'),'where':_0x29f5cb,'limit':0x1,'order':[[_0x3f94('0x93'),_0x3f94('0xaa')]]}]});})['then'](handleEntityNotFound(_0x40a4b1,null))[_0x3f94('0x39')](function(_0x980b4d){if(_0x980b4d){_0x51f65b[_0x3f94('0xab')]=_['omit'](_0x980b4d,['Contacts']);if(_0x980b4d['Contacts'][_0x3f94('0x4a')]){return _0x980b4d[_0x3f94('0xa9')][0x0];}var _0x52888e=_[_0x3f94('0x1a')](_0x51f65b['body'],{'firstName':_0x51f65b[_0x3f94('0x5e')][_0x3f94('0x98')],'ListId':_0x980b4d['id']});_0x52888e[_0x51f65b[_0x3f94('0x5e')][_0x3f94('0xa6')]]=_0x51f65b['body'][_0x3f94('0x98')];return db[_0x3f94('0xa8')][_0x3f94('0x5d')](_0x52888e,{'fields':_0x153887,'raw':!![]});}})[_0x3f94('0x39')](handleEntityNotFound(_0x40a4b1,null))['then'](function(_0x745dda){if(_0x745dda){_0x51f65b['contact']=_0x745dda;var _0xd64ea5={'ContactId':_0x745dda['id'],'phone':_0x51f65b[_0x3f94('0x5e')][_0x3f94('0x98')],'WhatsappAccountId':_0xe86953[_0x3f94('0x5a')]['id']};var _0x7c8e94={'ContactId':_0x745dda['id'],'WhatsappAccountId':_0xe86953['params']['id'],'closed':![]};return db[_0x3f94('0xac')][_0x3f94('0x5c')]({'where':_0x7c8e94})['then'](function(_0x59c2a3){if(_0x59c2a3){return[_0x59c2a3,![]];}return db['WhatsappInteraction'][_0x3f94('0x5d')](_0xd64ea5)[_0x3f94('0x39')](function(_0x510d9a){return[_0x510d9a,!![]];});});}})[_0x3f94('0x73')](function(_0x4b7725,_0x164ade){_0x51f65b[_0x3f94('0xad')]=_0x4b7725[_0x3f94('0x5f')]({'plain':!![]});_0x51f65b[_0x3f94('0xad')]['created']=![];if(_0x164ade){if(_0x51f65b[_0x3f94('0x87')][_0x3f94('0xae')]){_0x51f65b['applications'][_0x3f94('0xaf')]({'id':0x0,'priority':_0x51f65b[_0x3f94('0x8f')][_0x3f94('0x4a')]+0x1,'app':_0x3f94('0xb0'),'appdata':_0x3f94('0xb1'),'interval':_0x3f94('0xb2')});}_0x51f65b[_0x3f94('0xad')][_0x3f94('0xb3')]=!![];}return db['WhatsappMessage'][_0x3f94('0x5d')]({'phone':_0x51f65b['body'][_0x3f94('0x98')],'messageId':_0x51f65b[_0x3f94('0x5e')][_0x3f94('0x9d')],'body':_0x51f65b[_0x3f94('0x5e')][_0x3f94('0x5e')],'WhatsappAccountId':_0xe86953[_0x3f94('0x5a')]['id'],'WhatsappInteractionId':_0x4b7725['id'],'direction':'in','ContactId':_0x4b7725['ContactId'],'AttachmentId':_0x51f65b[_0x3f94('0x5e')]['AttachmentId']});})['then'](function(_0x5ccf07){_0x51f65b[_0x3f94('0x27')]=_0x5ccf07;if(!_0x51f65b['interaction'][_0x3f94('0xb4')])return;return db[_0x3f94('0x79')]['find']({'attributes':['id',_0x3f94('0x3b')],'where':{'id':_0x51f65b[_0x3f94('0xad')]['UserId']}});})[_0x3f94('0x39')](function(_0x1af2a4){if(_0x1af2a4){_0x51f65b[_0x3f94('0x8f')][_0x3f94('0xb5')]({'id':0x0,'priority':0x0,'app':_0x3f94('0xb6'),'appdata':_0x1af2a4[_0x3f94('0x3b')]+','+(_0x51f65b[_0x3f94('0x87')][_0x3f94('0xb7')]||0xa),'interval':_0x3f94('0xb2')});}if(!_0x51f65b[_0x3f94('0xad')]['queueId'])return;return db[_0x3f94('0xb8')][_0x3f94('0x5c')]({'attributes':['id','name'],'where':{'id':_0x51f65b['interaction']['queueId']}});})[_0x3f94('0x39')](function(_0x13b8e7){if(_0x13b8e7){_0x51f65b[_0x3f94('0x8f')][_0x3f94('0xb5')]({'id':0x0,'priority':0x1,'app':_0x3f94('0xb9'),'appdata':_0x13b8e7['name']+','+(_0x51f65b[_0x3f94('0x87')][_0x3f94('0xba')]||0x12c),'interval':_0x3f94('0xb2')});}return respondWithRpcPromise(_0x3f94('0xbb'),_0x3f94('0xbc'),_0x51f65b);})[_0x3f94('0x39')](function(_0x49ad75){if(_0x49ad75){var _0x22d9cd=0xc8;var _0x380874=_0x3f94('0xbd');logger[_0x3f94('0x1f')](_0x3f94('0x23'),_0x380874,_0x22d9cd,_0x3f94('0xbe'));logger['debug'](_0x3f94('0xbf'),_0x380874,_0x22d9cd,'entity\x20found',JSON[_0x3f94('0x24')](_0x49ad75));if(_0x51f65b[_0x3f94('0x87')][_0x3f94('0x42')]==='twilio'){return _0x40a4b1['status'](_0x22d9cd)['set'](_0x3f94('0xc0'),_0x3f94('0xc1'))['send'](_0x3f94('0xc2'));}else{return _0x40a4b1['status'](_0x22d9cd)[_0x3f94('0x2d')](_0x49ad75);}}});})[_0x3f94('0x29')](handleError(_0x40a4b1,null));};exports[_0x3f94('0x3c')]=function(_0x3c25cc,_0x39e387,_0x4f490d){var _0x48755b,_0xf0f793,_0x10b850;if(_[_0x3f94('0xa0')](_0x3c25cc[_0x3f94('0x5e')]['body'])||_0x3c25cc[_0x3f94('0x5e')][_0x3f94('0x5e')]===''){throw new db[(_0x3f94('0x90'))][(_0x3f94('0xa2'))](_0x3f94('0xa3'));}if(_[_0x3f94('0xa0')](_0x3c25cc[_0x3f94('0x5e')]['to'])){throw new db[(_0x3f94('0x90'))][(_0x3f94('0xa2'))](_0x3f94('0xc3'));}_0x48755b=_0x3c25cc[_0x3f94('0x5e')]['to'];return db['WhatsappAccount'][_0x3f94('0x5c')]({'where':{'id':_0x3c25cc[_0x3f94('0x5a')]['id']},'include':[{'model':db[_0x3f94('0xa7')],'as':_0x3f94('0xc4'),'include':[{'model':db[_0x3f94('0xa8')],'as':'Contacts','where':{'mobile':_0x48755b},'limit':0x1,'order':[[_0x3f94('0x93'),_0x3f94('0xaa')]]}]}]})[_0x3f94('0x39')](handleEntityNotFound(_0x39e387,null))['then'](function(_0x252909){if(_0x252909&&_0x252909[_0x3f94('0xc4')]){_0xf0f793=_0x252909[_0x3f94('0x5f')]({'plain':!![]});if(_0xf0f793[_0x3f94('0xc4')]&&_0xf0f793[_0x3f94('0xc4')][_0x3f94('0xa9')]['length']){return _0xf0f793['List'][_0x3f94('0xa9')][0x0];}return db[_0x3f94('0xa8')]['create'](_[_0x3f94('0x1a')](_0x3c25cc[_0x3f94('0x5e')],{'firstName':_0x48755b,'mobile':_0x48755b,'phone':_0x48755b,'ListId':_0xf0f793[_0x3f94('0x95')]}));}})['then'](handleEntityNotFound(_0x39e387,null))['then'](function(_0x582a85){if(_0x582a85){_0x10b850=_0x582a85;return db[_0x3f94('0xac')]['find']({'where':{'ContactId':_0x10b850['id'],'closed':![],'WhatsappAccountId':_0xf0f793['id']}})[_0x3f94('0x39')](function(_0x14af0c){if(_0x14af0c){return[_0x14af0c,![]];}return db['WhatsappInteraction'][_0x3f94('0x5d')]({'UserId':_0x3c25cc[_0x3f94('0x61')]['id'],'ContactId':_0x10b850['id'],'WhatsappAccountId':_0xf0f793['id'],'phone':_0x48755b,'firstMsgDirection':_0x3f94('0xc5'),'Messages':[_[_0x3f94('0x51')](_0x3c25cc[_0x3f94('0x5e')],{'read':![],'body':_0x3c25cc['body']['body'],'phone':_0x48755b,'WhatsappAccountId':_0xf0f793['id'],'UserId':_0x3c25cc[_0x3f94('0x61')]['id'],'ContactId':_0x10b850['id']})]},{'include':[{'model':db[_0x3f94('0x8c')],'as':_0x3f94('0xc6')}]})[_0x3f94('0x39')](function(_0x1a092e){return[_0x1a092e,!![]];});});}})[_0x3f94('0x73')](function(_0x1afad2,_0x11b6c7){if(_0x11b6c7){return _0x1afad2;}return db[_0x3f94('0x8c')][_0x3f94('0x5d')](_[_0x3f94('0x51')](_0x3c25cc['body'],{'read':![],'body':_0x3c25cc[_0x3f94('0x5e')][_0x3f94('0x5e')],'phone':_0x48755b,'WhatsappAccountId':_0xf0f793['id'],'WhatsappInteractionId':_0x1afad2['id'],'UserId':_0x3c25cc[_0x3f94('0x61')]['id'],'ContactId':_0x10b850['id']}))[_0x3f94('0x39')](function(_0x7ba463){_0x1afad2[_0x3f94('0xc7')][_0x3f94('0xc6')]=[];_0x1afad2[_0x3f94('0xc7')][_0x3f94('0xc6')][_0x3f94('0xaf')](_0x7ba463[_0x3f94('0xc7')]);return _0x1afad2;});})[_0x3f94('0x39')](respondWithResult(_0x39e387,null))[_0x3f94('0x29')](handleError(_0x39e387,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index fda40e5..3c2f072 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 _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 +var _0xb5df=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount'];(function(_0x44e6b3,_0x47fc06){var _0x320086=function(_0x3f0eeb){while(--_0x3f0eeb){_0x44e6b3['push'](_0x44e6b3['shift']());}};_0x320086(++_0x47fc06);}(_0xb5df,0x97));var _0xfb5d=function(_0x4644ac,_0x4cfc5d){_0x4644ac=_0x4644ac-0x0;var _0x2dc79c=_0xb5df[_0x4644ac];return _0x2dc79c;};'use strict';var EventEmitter=require(_0xfb5d('0x0'));var WhatsappAccount=require(_0xfb5d('0x1'))['db'][_0xfb5d('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xfb5d('0x3')](0x0);var events={'afterCreate':_0xfb5d('0x4'),'afterUpdate':_0xfb5d('0x5'),'afterDestroy':_0xfb5d('0x6')};function emitEvent(_0x5be09d){return function(_0x8748f5,_0x1ddc33,_0x280e49){WhatsappAccountEvents[_0xfb5d('0x7')](_0x5be09d+':'+_0x8748f5['id'],_0x8748f5);WhatsappAccountEvents[_0xfb5d('0x7')](_0x5be09d,_0x8748f5);_0x280e49(null);};}for(var e in events){if(events[_0xfb5d('0x8')](e)){var event=events[e];WhatsappAccount[_0xfb5d('0x9')](e,emitEvent(event));}}module[_0xfb5d('0xa')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index cc0ebbe..0a6488e 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 _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 +var _0x10ff=['api','request-promise','path','../../config/environment','./whatsappAccount.attributes','exports','define','whatsapp_accounts','lodash','util','../../config/logger'];(function(_0x22e5a2,_0x24d072){var _0x500b45=function(_0x4e8be8){while(--_0x4e8be8){_0x22e5a2['push'](_0x22e5a2['shift']());}};_0x500b45(++_0x24d072);}(_0x10ff,0xce));var _0xf10f=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x10ff[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xf10f('0x0'));var util=require(_0xf10f('0x1'));var logger=require(_0xf10f('0x2'))(_0xf10f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf10f('0x4'));var fs=require('fs');var path=require(_0xf10f('0x5'));var rimraf=require('rimraf');var config=require(_0xf10f('0x6'));var attributes=require(_0xf10f('0x7'));module[_0xf10f('0x8')]=function(_0xd7c777,_0x193e76){return _0xd7c777[_0xf10f('0x9')]('WhatsappAccount',attributes,{'tableName':_0xf10f('0xa'),'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 f3c19c7..fe97605 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 _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 +var _0xb652=['stringify','error','message','result','ShowWhatsappAccount','find','raw','options','where','include','map','model','attributes','catch','util','bluebird','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s'];(function(_0x28111f,_0x254934){var _0x5203e6=function(_0x2c639a){while(--_0x2c639a){_0x28111f['push'](_0x28111f['shift']());}};_0x5203e6(++_0x254934);}(_0xb652,0x1ce));var _0x2b65=function(_0x588a1d,_0x505aeb){_0x588a1d=_0x588a1d-0x0;var _0x4d59af=_0xb652[_0x588a1d];return _0x4d59af;};'use strict';var _=require('lodash');var util=require(_0x2b65('0x0'));var moment=require('moment');var BPromise=require(_0x2b65('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2b65('0x2'))('rpc');var config=require(_0x2b65('0x3'));var jayson=require(_0x2b65('0x4'));var client=jayson[_0x2b65('0x5')][_0x2b65('0x6')]({'port':0x232a});config['redis']=_['defaults'](config[_0x2b65('0x7')],{'host':_0x2b65('0x8'),'port':0x18eb});var socket=require(_0x2b65('0x9'))(new Redis(config['redis']));require(_0x2b65('0xa'))['register'](socket);function respondWithRpcPromise(_0x3e18c8,_0x4f4815,_0x18c0cc){return new BPromise(function(_0x217cb3,_0x1033bf){return client[_0x2b65('0xb')](_0x3e18c8,_0x18c0cc)[_0x2b65('0xc')](function(_0x4d7b87){logger[_0x2b65('0xd')](_0x2b65('0xe'),_0x4f4815,_0x2b65('0xf'));logger[_0x2b65('0x10')](_0x2b65('0x11'),_0x4f4815,'request\x20sent',JSON[_0x2b65('0x12')](_0x4d7b87));if(_0x4d7b87['error']){if(_0x4d7b87[_0x2b65('0x13')]['code']===0x1f4){logger['error'](_0x2b65('0xe'),_0x4f4815,_0x4d7b87['error'][_0x2b65('0x14')]);return _0x1033bf(_0x4d7b87[_0x2b65('0x13')]['message']);}logger[_0x2b65('0x13')](_0x2b65('0xe'),_0x4f4815,_0x4d7b87[_0x2b65('0x13')][_0x2b65('0x14')]);return _0x217cb3(_0x4d7b87[_0x2b65('0x13')][_0x2b65('0x14')]);}else{logger[_0x2b65('0xd')](_0x2b65('0xe'),_0x4f4815,_0x2b65('0xf'));_0x217cb3(_0x4d7b87[_0x2b65('0x15')][_0x2b65('0x14')]);}})['catch'](function(_0x38d99c){logger[_0x2b65('0x13')](_0x2b65('0xe'),_0x4f4815,_0x38d99c);_0x1033bf(_0x38d99c);});});}exports[_0x2b65('0x16')]=function(_0x331bdb){var _0x44aff7=this;return new Promise(function(_0x55908c,_0x57e3ed){return db['WhatsappAccount'][_0x2b65('0x17')]({'raw':_0x331bdb['options']?_0x331bdb['options'][_0x2b65('0x18')]===undefined?!![]:![]:!![],'where':_0x331bdb[_0x2b65('0x19')]?_0x331bdb[_0x2b65('0x19')][_0x2b65('0x1a')]||null:null,'attributes':_0x331bdb[_0x2b65('0x19')]?_0x331bdb[_0x2b65('0x19')]['attributes']||null:null,'include':_0x331bdb[_0x2b65('0x19')]?_0x331bdb[_0x2b65('0x19')][_0x2b65('0x1b')]?_[_0x2b65('0x1c')](_0x331bdb[_0x2b65('0x19')]['include'],function(_0x32eeb9){return{'model':db[_0x32eeb9[_0x2b65('0x1d')]],'as':_0x32eeb9['as'],'attributes':_0x32eeb9[_0x2b65('0x1e')],'include':_0x32eeb9['include']?_['map'](_0x32eeb9[_0x2b65('0x1b')],function(_0x38991e){return{'model':db[_0x38991e['model']],'as':_0x38991e['as'],'attributes':_0x38991e[_0x2b65('0x1e')],'include':_0x38991e['include']?_[_0x2b65('0x1c')](_0x38991e[_0x2b65('0x1b')],function(_0x1f7b20){return{'model':db[_0x1f7b20[_0x2b65('0x1d')]],'as':_0x1f7b20['as'],'attributes':_0x1f7b20[_0x2b65('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2b65('0xc')](function(_0x47d4e5){logger[_0x2b65('0xd')](_0x2b65('0x16'),_0x331bdb);logger[_0x2b65('0x10')](_0x2b65('0x16'),_0x331bdb,JSON[_0x2b65('0x12')](_0x47d4e5));_0x55908c(_0x47d4e5);})[_0x2b65('0x1f')](function(_0x1011d0){logger[_0x2b65('0x13')](_0x2b65('0x16'),_0x1011d0[_0x2b65('0x14')],_0x331bdb);_0x57e3ed(_0x44aff7[_0x2b65('0x13')](0x1f4,_0x1011d0['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index c901929..457a439 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 _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 +var _0x9304=['emit','removeListener','register','whatsappAccount:','./whatsappAccount.events','save','remove'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9304,0x100));var _0x4930=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9304[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappAccountEvents=require(_0x4930('0x0'));var events=[_0x4930('0x1'),_0x4930('0x2'),'update'];function createListener(_0xe4d173,_0xbbdd0b){return function(_0x472662){_0xbbdd0b[_0x4930('0x3')](_0xe4d173,_0x472662);};}function removeListener(_0x40e28f,_0x1e61aa){return function(){WhatsappAccountEvents[_0x4930('0x4')](_0x40e28f,_0x1e61aa);};}exports[_0x4930('0x5')]=function(_0x38378f){for(var _0x5c463e=0x0,_0xfa8abf=events['length'];_0x5c463e<_0xfa8abf;_0x5c463e++){var _0xbd794c=events[_0x5c463e];var _0x3e1cb4=createListener(_0x4930('0x6')+_0xbd794c,_0x38378f);WhatsappAccountEvents['on'](_0xbd794c,_0x3e1cb4);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 210835d..72dfd7d 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 _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 +var _0x9e20=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','update','multer','util','path','connect-timeout'];(function(_0x12e682,_0x33f3a3){var _0x26e600=function(_0x4d79dc){while(--_0x4d79dc){_0x12e682['push'](_0x12e682['shift']());}};_0x26e600(++_0x33f3a3);}(_0x9e20,0xb0));var _0x09e2=function(_0x226936,_0x367ec4){_0x226936=_0x226936-0x0;var _0x338e92=_0x9e20[_0x226936];return _0x338e92;};'use strict';var multer=require(_0x09e2('0x0'));var util=require(_0x09e2('0x1'));var path=require(_0x09e2('0x2'));var timeout=require(_0x09e2('0x3'));var express=require(_0x09e2('0x4'));var router=express[_0x09e2('0x5')]();var fs_extra=require(_0x09e2('0x6'));var auth=require(_0x09e2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x09e2('0x8'));var controller=require(_0x09e2('0x9'));router[_0x09e2('0xa')]('/',auth[_0x09e2('0xb')](),controller[_0x09e2('0xc')]);router[_0x09e2('0xa')](_0x09e2('0xd'),auth[_0x09e2('0xb')](),controller[_0x09e2('0xe')]);router[_0x09e2('0xf')]('/',auth[_0x09e2('0xb')](),controller[_0x09e2('0x10')]);router['put']('/:id',auth[_0x09e2('0xb')](),controller[_0x09e2('0x11')]);router['delete'](_0x09e2('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 886b081..de05a99 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 _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 +var _0x5bd4=['sequelize','exports','noop','STRING','*,*,*,*'];(function(_0x20d9e7,_0x293309){var _0x3e3e52=function(_0x3f9c90){while(--_0x3f9c90){_0x20d9e7['push'](_0x20d9e7['shift']());}};_0x3e3e52(++_0x293309);}(_0x5bd4,0x163));var _0x45bd=function(_0x4597c4,_0x2ca900){_0x4597c4=_0x4597c4-0x0;var _0x53003e=_0x5bd4[_0x4597c4];return _0x53003e;};'use strict';var Sequelize=require(_0x45bd('0x0'));module[_0x45bd('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x45bd('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x45bd('0x3')]},'interval':{'type':Sequelize[_0x45bd('0x3')],'defaultValue':_0x45bd('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 7ead57f..aa48d09 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 _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 +var _0x97b2=['params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','reject','save','then','destroy','error','stack','send','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','filter','where','merge','VIRTUAL','options','WhatsappApplication','includeAll','include','findAll','rows','catch','show','length','find','create','body','update'];(function(_0x456eb7,_0x2830c8){var _0x6f6ee0=function(_0x54a594){while(--_0x54a594){_0x456eb7['push'](_0x456eb7['shift']());}};_0x6f6ee0(++_0x2830c8);}(_0x97b2,0x1b7));var _0x297b=function(_0x51ac09,_0x383098){_0x51ac09=_0x51ac09-0x0;var _0x3f827d=_0x97b2[_0x51ac09];return _0x3f827d;};'use strict';var emlformat=require(_0x297b('0x0'));var rimraf=require(_0x297b('0x1'));var zipdir=require(_0x297b('0x2'));var jsonpatch=require(_0x297b('0x3'));var rp=require(_0x297b('0x4'));var moment=require(_0x297b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x297b('0x6'));var util=require(_0x297b('0x7'));var path=require('path');var sox=require(_0x297b('0x8'));var csv=require(_0x297b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x297b('0xa'));var crypto=require(_0x297b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x297b('0xc'));var toCsv=require(_0x297b('0x9'));var querystring=require('querystring');var Papa=require(_0x297b('0xd'));var Redis=require('ioredis');var authService=require(_0x297b('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x297b('0xf'));var hardwareService=require(_0x297b('0x10'));var logger=require(_0x297b('0x11'))(_0x297b('0x12'));var utils=require(_0x297b('0x13'));var config=require(_0x297b('0x14'));var licenseUtil=require(_0x297b('0x15'));var db=require(_0x297b('0x16'))['db'];function respondWithStatusCode(_0x17c231,_0xd833be){_0xd833be=_0xd833be||0xcc;return function(_0xf8a700){if(_0xf8a700){return _0x17c231[_0x297b('0x17')](_0xd833be);}return _0x17c231[_0x297b('0x18')](_0xd833be)[_0x297b('0x19')]();};}function respondWithResult(_0x27f44b,_0x56c7ed){_0x56c7ed=_0x56c7ed||0xc8;return function(_0x3446e6){if(_0x3446e6){return _0x27f44b[_0x297b('0x18')](_0x56c7ed)['json'](_0x3446e6);}};}function respondWithFilteredResult(_0x376287,_0x1a1434){return function(_0x4455f3){if(_0x4455f3){var _0x241ff6=typeof _0x1a1434[_0x297b('0x1a')]===_0x297b('0x1b')&&typeof _0x1a1434['limit']===_0x297b('0x1b');var _0x34854d=_0x4455f3[_0x297b('0x1c')];var _0x5618eb=_0x241ff6?0x0:_0x1a1434['offset'];var _0x161a40=_0x241ff6?_0x4455f3['count']:_0x1a1434[_0x297b('0x1a')]+_0x1a1434[_0x297b('0x1d')];var _0x2379dd;if(_0x161a40>=_0x34854d){_0x161a40=_0x34854d;_0x2379dd=0xc8;}else{_0x2379dd=0xce;}_0x376287[_0x297b('0x18')](_0x2379dd);return _0x376287[_0x297b('0x1e')]('Content-Range',_0x5618eb+'-'+_0x161a40+'/'+_0x34854d)[_0x297b('0x1f')](_0x4455f3);}return null;};}function patchUpdates(_0x250b19){return function(_0x5d2fa5){try{jsonpatch[_0x297b('0x20')](_0x5d2fa5,_0x250b19,!![]);}catch(_0x367c09){return BPromise[_0x297b('0x21')](_0x367c09);}return _0x5d2fa5[_0x297b('0x22')]();};}function saveUpdates(_0x4776e1,_0xa5bf63){return function(_0x402c1d){if(_0x402c1d){return _0x402c1d['update'](_0x4776e1)[_0x297b('0x23')](function(_0x19d8f3){return _0x19d8f3;});}return null;};}function removeEntity(_0x3df595,_0x56ed4b){return function(_0x279451){if(_0x279451){return _0x279451[_0x297b('0x24')]()[_0x297b('0x23')](function(){_0x3df595[_0x297b('0x18')](0xcc)[_0x297b('0x19')]();});}};}function handleEntityNotFound(_0x4e995f,_0x578d13){return function(_0x27ab73){if(!_0x27ab73){_0x4e995f[_0x297b('0x17')](0x194);}return _0x27ab73;};}function handleError(_0x46c23d,_0x2894b0){_0x2894b0=_0x2894b0||0x1f4;return function(_0x3f63dc){logger[_0x297b('0x25')](_0x3f63dc[_0x297b('0x26')]);if(_0x3f63dc['name']){delete _0x3f63dc['name'];}_0x46c23d['status'](_0x2894b0)[_0x297b('0x27')](_0x3f63dc);};}exports['index']=function(_0x5c2c26,_0x861618){var _0x323c47={},_0x2d64a={},_0xe51de={'count':0x0,'rows':[]};var _0x1caa2b=_[_0x297b('0x28')](db['WhatsappApplication'][_0x297b('0x29')],function(_0x50d2d0){return{'name':_0x50d2d0[_0x297b('0x2a')],'type':_0x50d2d0[_0x297b('0x2b')][_0x297b('0x2c')]};});_0x2d64a[_0x297b('0x2d')]=_[_0x297b('0x28')](_0x1caa2b,_0x297b('0x2e'));_0x2d64a[_0x297b('0x2f')]=_[_0x297b('0x30')](_0x5c2c26[_0x297b('0x2f')]);_0x2d64a[_0x297b('0x31')]=_[_0x297b('0x32')](_0x2d64a[_0x297b('0x2d')],_0x2d64a['query']);_0x323c47['attributes']=_[_0x297b('0x32')](_0x2d64a[_0x297b('0x2d')],qs[_0x297b('0x33')](_0x5c2c26[_0x297b('0x2f')]['fields']));_0x323c47[_0x297b('0x34')]=_0x323c47['attributes']['length']?_0x323c47[_0x297b('0x34')]:_0x2d64a[_0x297b('0x2d')];if(!_0x5c2c26[_0x297b('0x2f')][_0x297b('0x35')]('nolimit')){_0x323c47[_0x297b('0x1d')]=qs['limit'](_0x5c2c26[_0x297b('0x2f')][_0x297b('0x1d')]);_0x323c47['offset']=qs[_0x297b('0x1a')](_0x5c2c26[_0x297b('0x2f')]['offset']);}_0x323c47['order']=qs[_0x297b('0x36')](_0x5c2c26[_0x297b('0x2f')][_0x297b('0x36')]);_0x323c47['where']=qs[_0x297b('0x31')](_['pick'](_0x5c2c26[_0x297b('0x2f')],_0x2d64a['filters']),_0x1caa2b);if(_0x5c2c26[_0x297b('0x2f')][_0x297b('0x37')]){_0x323c47[_0x297b('0x38')]=_[_0x297b('0x39')](_0x323c47[_0x297b('0x38')],{'$or':_['map'](_0x1caa2b,function(_0x3895af){if(_0x3895af[_0x297b('0x2b')]!==_0x297b('0x3a')){var _0x581897={};_0x581897[_0x3895af[_0x297b('0x2e')]]={'$like':'%'+_0x5c2c26[_0x297b('0x2f')][_0x297b('0x37')]+'%'};return _0x581897;}})});}_0x323c47=_[_0x297b('0x39')]({},_0x323c47,_0x5c2c26[_0x297b('0x3b')]);var _0x32ce4c={'where':_0x323c47[_0x297b('0x38')]};return db[_0x297b('0x3c')][_0x297b('0x1c')](_0x32ce4c)[_0x297b('0x23')](function(_0x54ea17){_0xe51de['count']=_0x54ea17;if(_0x5c2c26[_0x297b('0x2f')][_0x297b('0x3d')]){_0x323c47[_0x297b('0x3e')]=[{'all':!![]}];}return db[_0x297b('0x3c')][_0x297b('0x3f')](_0x323c47);})[_0x297b('0x23')](function(_0x4a3e31){_0xe51de[_0x297b('0x40')]=_0x4a3e31;return _0xe51de;})[_0x297b('0x23')](respondWithFilteredResult(_0x861618,_0x323c47))[_0x297b('0x41')](handleError(_0x861618,null));};exports[_0x297b('0x42')]=function(_0x45a868,_0x1168ea){var _0x31780c={'raw':!![],'where':{'id':_0x45a868['params']['id']}},_0x3b89e3={};_0x3b89e3[_0x297b('0x2d')]=_['keys'](db[_0x297b('0x3c')][_0x297b('0x29')]);_0x3b89e3[_0x297b('0x2f')]=_[_0x297b('0x30')](_0x45a868[_0x297b('0x2f')]);_0x3b89e3[_0x297b('0x31')]=_[_0x297b('0x32')](_0x3b89e3['model'],_0x3b89e3[_0x297b('0x2f')]);_0x31780c[_0x297b('0x34')]=_['intersection'](_0x3b89e3[_0x297b('0x2d')],qs[_0x297b('0x33')](_0x45a868[_0x297b('0x2f')]['fields']));_0x31780c[_0x297b('0x34')]=_0x31780c[_0x297b('0x34')][_0x297b('0x43')]?_0x31780c['attributes']:_0x3b89e3[_0x297b('0x2d')];if(_0x45a868[_0x297b('0x2f')][_0x297b('0x3d')]){_0x31780c['include']=[{'all':!![]}];}_0x31780c=_[_0x297b('0x39')]({},_0x31780c,_0x45a868[_0x297b('0x3b')]);return db[_0x297b('0x3c')][_0x297b('0x44')](_0x31780c)[_0x297b('0x23')](handleEntityNotFound(_0x1168ea,null))['then'](respondWithResult(_0x1168ea,null))[_0x297b('0x41')](handleError(_0x1168ea,null));};exports[_0x297b('0x45')]=function(_0x5895b4,_0x3469f1){return db[_0x297b('0x3c')][_0x297b('0x45')](_0x5895b4[_0x297b('0x46')],{})[_0x297b('0x23')](respondWithResult(_0x3469f1,0xc9))[_0x297b('0x41')](handleError(_0x3469f1,null));};exports[_0x297b('0x47')]=function(_0x4e7e7e,_0x17d098){if(_0x4e7e7e[_0x297b('0x46')]['id']){delete _0x4e7e7e[_0x297b('0x46')]['id'];}return db[_0x297b('0x3c')]['find']({'where':{'id':_0x4e7e7e[_0x297b('0x48')]['id']}})[_0x297b('0x23')](handleEntityNotFound(_0x17d098,null))[_0x297b('0x23')](saveUpdates(_0x4e7e7e['body'],null))[_0x297b('0x23')](respondWithResult(_0x17d098,null))[_0x297b('0x41')](handleError(_0x17d098,null));};exports[_0x297b('0x24')]=function(_0xc11452,_0x5411e6){return db['WhatsappApplication'][_0x297b('0x44')]({'where':{'id':_0xc11452[_0x297b('0x48')]['id']}})[_0x297b('0x23')](handleEntityNotFound(_0x5411e6,null))['then'](removeEntity(_0x5411e6,null))[_0x297b('0x41')](handleError(_0x5411e6,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 8e363d1..f4615d0 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 _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 +var _0x2b83=['./whatsappApplication.attributes','define','WhatsappApplication','whatsapp_applications','utf8mb4','util','../../config/logger','moment','bluebird','request-promise','../../config/environment'];(function(_0x2f6d16,_0x516c0c){var _0xf706a=function(_0x43dd25){while(--_0x43dd25){_0x2f6d16['push'](_0x2f6d16['shift']());}};_0xf706a(++_0x516c0c);}(_0x2b83,0x1d3));var _0x32b8=function(_0x166e96,_0x55191d){_0x166e96=_0x166e96-0x0;var _0x553d73=_0x2b83[_0x166e96];return _0x553d73;};'use strict';var _=require('lodash');var util=require(_0x32b8('0x0'));var logger=require(_0x32b8('0x1'))('api');var moment=require(_0x32b8('0x2'));var BPromise=require(_0x32b8('0x3'));var rp=require(_0x32b8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x32b8('0x5'));var attributes=require(_0x32b8('0x6'));module['exports']=function(_0x6bbc3d,_0x55abd0){return _0x6bbc3d[_0x32b8('0x7')](_0x32b8('0x8'),attributes,{'tableName':_0x32b8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x32b8('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 436baf4..a735474 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 _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 +var _0x6f0d=['WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x470d42,_0x1a35cb){var _0x2a7b75=function(_0x1a14cc){while(--_0x1a14cc){_0x470d42['push'](_0x470d42['shift']());}};_0x2a7b75(++_0x1a35cb);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x3b8ff3,_0x3e3cd5){_0x3b8ff3=_0x3b8ff3-0x0;var _0x441aa4=_0x6f0d[_0x3b8ff3];return _0x441aa4;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6f0('0x4'))['db'];var utils=require(_0xd6f0('0x5'));var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6f0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe21ac4,_0x1af29c,_0x8b89a9){return new BPromise(function(_0x1a48a0,_0x4c4916){return client['request'](_0xe21ac4,_0x8b89a9)[_0xd6f0('0xa')](function(_0x272c4e){logger[_0xd6f0('0xb')](_0xd6f0('0xc'),_0x1af29c,_0xd6f0('0xd'));logger['debug'](_0xd6f0('0xe'),_0x1af29c,_0xd6f0('0xd'),JSON[_0xd6f0('0xf')](_0x272c4e));if(_0x272c4e[_0xd6f0('0x10')]){if(_0x272c4e['error'][_0xd6f0('0x11')]===0x1f4){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);return _0x4c4916(_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);}logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e['error'][_0xd6f0('0x12')]);return _0x1a48a0(_0x272c4e[_0xd6f0('0x10')]['message']);}else{logger[_0xd6f0('0xb')]('WhatsappApplication,\x20%s,\x20%s',_0x1af29c,_0xd6f0('0xd'));_0x1a48a0(_0x272c4e[_0xd6f0('0x13')][_0xd6f0('0x12')]);}})[_0xd6f0('0x14')](function(_0x64ff5f){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x64ff5f);_0x4c4916(_0x64ff5f);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 1979b93..cd69ce3 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 _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 +var _0x6ec2=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','isAuthenticated','describe','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','whatsappinteraction:addtags','addTags','put','/:id','whatsapp','whatsappinteraction:update','update','delete'];(function(_0x95a11f,_0x3fa19f){var _0x370d93=function(_0x4212ef){while(--_0x4212ef){_0x95a11f['push'](_0x95a11f['shift']());}};_0x370d93(++_0x3fa19f);}(_0x6ec2,0x78));var _0x26ec=function(_0x55043f,_0x2e6e99){_0x55043f=_0x55043f-0x0;var _0x5d810c=_0x6ec2[_0x55043f];return _0x5d810c;};'use strict';var multer=require(_0x26ec('0x0'));var util=require(_0x26ec('0x1'));var path=require(_0x26ec('0x2'));var timeout=require(_0x26ec('0x3'));var express=require(_0x26ec('0x4'));var router=express[_0x26ec('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x26ec('0x6'));var interaction=require(_0x26ec('0x7'));var config=require(_0x26ec('0x8'));var controller=require(_0x26ec('0x9'));router[_0x26ec('0xa')]('/',auth['isAuthenticated'](),controller[_0x26ec('0xb')]);router['get']('/describe',auth[_0x26ec('0xc')](),controller[_0x26ec('0xd')]);router[_0x26ec('0xa')]('/:id',auth[_0x26ec('0xc')](),controller['show']);router[_0x26ec('0xa')](_0x26ec('0xe'),auth[_0x26ec('0xc')](),controller[_0x26ec('0xf')]);router[_0x26ec('0xa')](_0x26ec('0x10'),auth[_0x26ec('0xc')](),controller[_0x26ec('0x11')]);router[_0x26ec('0x12')]('/',auth[_0x26ec('0xc')](),controller['create']);router['post'](_0x26ec('0xe'),auth[_0x26ec('0xc')](),controller[_0x26ec('0x13')]);router[_0x26ec('0x12')](_0x26ec('0x14'),auth[_0x26ec('0xc')](),interaction[_0x26ec('0x15')]('whatsapp',_0x26ec('0x16')),controller[_0x26ec('0x17')]);router[_0x26ec('0x18')](_0x26ec('0x19'),auth['isAuthenticated'](),interaction['tracked'](_0x26ec('0x1a'),_0x26ec('0x1b')),controller[_0x26ec('0x1c')]);router[_0x26ec('0x1d')]('/:id',auth[_0x26ec('0xc')](),interaction[_0x26ec('0x15')]('whatsapp','whatsappinteraction:destroy'),controller['destroy']);router[_0x26ec('0x1d')](_0x26ec('0x14'),auth[_0x26ec('0xc')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 8e9ebc2..9bb124d 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 _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 +var _0xb10d=['exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize'];(function(_0x5a27fe,_0x43993b){var _0x121c88=function(_0x2aff1f){while(--_0x2aff1f){_0x5a27fe['push'](_0x5a27fe['shift']());}};_0x121c88(++_0x43993b);}(_0xb10d,0x17f));var _0xdb10=function(_0x1f2791,_0x42ad62){_0x1f2791=_0x1f2791-0x0;var _0x3ed363=_0xb10d[_0x1f2791];return _0x3ed363;};'use strict';var Sequelize=require(_0xdb10('0x0'));var moment=require('moment');module[_0xdb10('0x1')]={'closed':{'type':Sequelize[_0xdb10('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xdb10('0x3')]},'disposition':{'type':Sequelize[_0xdb10('0x4')]},'secondDisposition':{'type':Sequelize[_0xdb10('0x4')]},'thirdDisposition':{'type':Sequelize[_0xdb10('0x4')]},'note':{'type':Sequelize[_0xdb10('0x4')]},'phone':{'type':Sequelize[_0xdb10('0x4')]},'read1stAt':{'type':Sequelize[_0xdb10('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xdb10('0x5')]('in',_0xdb10('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xdb10('0x5')]('in',_0xdb10('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xdb10('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xdb10('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 0729bc0..6add103 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 _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 +var _0x601c=['toString','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','push','User','CmContact','Contact','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Owner','fullname','get','Whatsapp','Account','N.A.','createdAt','closedAt','disposition','createReadStream','pipe','createWriteStream','basename','out','System','firstName','read','renderFile','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','unlinkSync','sendStatus','rimraf','zip-dir','util','path','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','status','end','json','offset','undefined','count','limit','then','destroy','error','stack','name','index','WhatsappInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','catch','show','keys','query','filters','intersection','model','attributes','fields','length','includeAll','options','find','create','body','update','params','describe','addMessage','WhatsappMessage','ids','omit','getMessages','hasOwnProperty','sort','where','pick','WhatsappInteractionId','filter','merge','map','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','addTags','setTags','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','unix'];(function(_0x46e182,_0x1046a8){var _0x42ade0=function(_0xb5288f){while(--_0xb5288f){_0x46e182['push'](_0x46e182['shift']());}};_0x42ade0(++_0x1046a8);}(_0x601c,0xa3));var _0xc601=function(_0x46d864,_0x29c503){_0x46d864=_0x46d864-0x0;var _0x3a318b=_0x601c[_0x46d864];return _0x3a318b;};'use strict';var rimraf=require(_0xc601('0x0'));var zipdir=require(_0xc601('0x1'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xc601('0x2'));var path=require(_0xc601('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0xc601('0x4'));var interaction=require(_0xc601('0x5'));var qs=require('../../components/parsers/qs');var pdf=require(_0xc601('0x6'));var logger=require(_0xc601('0x7'))(_0xc601('0x8'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xc601('0x9')]=_[_0xc601('0xa')](config[_0xc601('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xc601('0xb'))(new Redis(config[_0xc601('0x9')]));require(_0xc601('0xc'))['register'](socket);function respondWithStatusCode(_0x3b2552,_0x101460){_0x101460=_0x101460||0xcc;return function(_0x2f1702){if(_0x2f1702){return _0x3b2552['sendStatus'](_0x101460);}return _0x3b2552[_0xc601('0xd')](_0x101460)[_0xc601('0xe')]();};}function respondWithResult(_0x15958a,_0x34d3df){_0x34d3df=_0x34d3df||0xc8;return function(_0x427224){if(_0x427224){return _0x15958a[_0xc601('0xd')](_0x34d3df)[_0xc601('0xf')](_0x427224);}};}function respondWithFilteredResult(_0x445237,_0x6d0e9c){return function(_0x6e04ad){if(_0x6e04ad){var _0x435b2b=typeof _0x6d0e9c[_0xc601('0x10')]==='undefined'&&typeof _0x6d0e9c['limit']===_0xc601('0x11');var _0x28cd61=_0x6e04ad[_0xc601('0x12')];var _0x405c22=_0x435b2b?0x0:_0x6d0e9c[_0xc601('0x10')];var _0x7476ae=_0x435b2b?_0x6e04ad['count']:_0x6d0e9c['offset']+_0x6d0e9c[_0xc601('0x13')];var _0x4d1a20;if(_0x7476ae>=_0x28cd61){_0x7476ae=_0x28cd61;_0x4d1a20=0xc8;}else{_0x4d1a20=0xce;}_0x445237[_0xc601('0xd')](_0x4d1a20);return _0x445237['set']('Content-Range',_0x405c22+'-'+_0x7476ae+'/'+_0x28cd61)[_0xc601('0xf')](_0x6e04ad);}return null;};}function saveUpdates(_0x25fd14){return function(_0x39d557){if(_0x39d557){return _0x39d557['update'](_0x25fd14)[_0xc601('0x14')](function(_0x1388d5){return _0x1388d5;});}return null;};}function removeEntity(_0x4782d6){return function(_0x5c6000){if(_0x5c6000){return _0x5c6000[_0xc601('0x15')]()[_0xc601('0x14')](function(){_0x4782d6[_0xc601('0xd')](0xcc)[_0xc601('0xe')]();});}};}function handleEntityNotFound(_0x32b25d){return function(_0x112a1a){if(!_0x112a1a){_0x32b25d['sendStatus'](0x194);}return _0x112a1a;};}function handleError(_0x83d5a7,_0x37948e){_0x37948e=_0x37948e||0x1f4;return function(_0x4f0532){logger[_0xc601('0x16')](_0x4f0532[_0xc601('0x17')]);if(_0x4f0532[_0xc601('0x18')]){delete _0x4f0532['name'];}_0x83d5a7[_0xc601('0xd')](_0x37948e)['send'](_0x4f0532);};}exports[_0xc601('0x19')]=function(_0x5f0e52,_0x11718a){var _0x5761b3={};var _0x2cf7ae=_['map'](db[_0xc601('0x1a')][_0xc601('0x1b')],function(_0x230387){return{'name':_0x230387[_0xc601('0x1c')],'type':_0x230387[_0xc601('0x1d')][_0xc601('0x1e')]};});_0x5761b3=qs[_0xc601('0x1f')](_0x2cf7ae,_0x5f0e52);return interaction[_0xc601('0x20')]('whatsapp',_0x5f0e52['query'],_0x5f0e52['user'],_0x5761b3,_0x2cf7ae)[_0xc601('0x14')](respondWithFilteredResult(_0x11718a,_0x5761b3))[_0xc601('0x21')](handleError(_0x11718a,null));};exports[_0xc601('0x22')]=function(_0x4ae1fb,_0x46c98b){var _0x773145={'raw':![],'where':{'id':_0x4ae1fb['params']['id']}},_0x79d1cb={};_0x79d1cb['model']=_[_0xc601('0x23')](db[_0xc601('0x1a')][_0xc601('0x1b')]);_0x79d1cb[_0xc601('0x24')]=_[_0xc601('0x23')](_0x4ae1fb[_0xc601('0x24')]);_0x79d1cb[_0xc601('0x25')]=_[_0xc601('0x26')](_0x79d1cb[_0xc601('0x27')],_0x79d1cb[_0xc601('0x24')]);_0x773145[_0xc601('0x28')]=_[_0xc601('0x26')](_0x79d1cb[_0xc601('0x27')],qs[_0xc601('0x29')](_0x4ae1fb[_0xc601('0x24')][_0xc601('0x29')]));_0x773145[_0xc601('0x28')]=_0x773145[_0xc601('0x28')][_0xc601('0x2a')]?_0x773145[_0xc601('0x28')]:_0x79d1cb['model'];if(_0x4ae1fb['query'][_0xc601('0x2b')]){_0x773145['include']=[{'all':!![]}];}_0x773145=_['merge']({},_0x773145,_0x4ae1fb[_0xc601('0x2c')]);return db[_0xc601('0x1a')][_0xc601('0x2d')](_0x773145)['then'](handleEntityNotFound(_0x46c98b,null))['then'](respondWithResult(_0x46c98b,null))[_0xc601('0x21')](handleError(_0x46c98b,null));};exports[_0xc601('0x2e')]=function(_0x4b35be,_0x49660d){return db[_0xc601('0x1a')][_0xc601('0x2e')](_0x4b35be[_0xc601('0x2f')],{})[_0xc601('0x14')](respondWithResult(_0x49660d,0xc9))['catch'](handleError(_0x49660d,null));};exports[_0xc601('0x30')]=function(_0x9bd42a,_0x4d2d85){if(_0x9bd42a[_0xc601('0x2f')]['id']){delete _0x9bd42a[_0xc601('0x2f')]['id'];}return db[_0xc601('0x1a')][_0xc601('0x2d')]({'where':{'id':_0x9bd42a['params']['id']}})[_0xc601('0x14')](handleEntityNotFound(_0x4d2d85,null))[_0xc601('0x14')](saveUpdates(_0x9bd42a[_0xc601('0x2f')],null))['then'](respondWithResult(_0x4d2d85,null))[_0xc601('0x21')](handleError(_0x4d2d85,null));};exports['destroy']=function(_0x236271,_0x2c8ef5){return db[_0xc601('0x1a')]['find']({'where':{'id':_0x236271[_0xc601('0x31')]['id']}})['then'](handleEntityNotFound(_0x2c8ef5,null))[_0xc601('0x14')](removeEntity(_0x2c8ef5,null))[_0xc601('0x21')](handleError(_0x2c8ef5,null));};exports[_0xc601('0x32')]=function(_0xa892c3,_0x332798){return db['WhatsappInteraction'][_0xc601('0x32')]()[_0xc601('0x14')](respondWithResult(_0x332798,null))[_0xc601('0x21')](handleError(_0x332798,null));};exports[_0xc601('0x33')]=function(_0x3e2c79,_0x2cdac1){return db[_0xc601('0x34')]['find']({'where':{'id':_0x3e2c79[_0xc601('0x31')]['id']}})[_0xc601('0x14')](handleEntityNotFound(_0x2cdac1,null))[_0xc601('0x14')](function(_0x1ce1c1){if(_0x1ce1c1){return _0x1ce1c1[_0xc601('0x33')](_0x3e2c79[_0xc601('0x2f')][_0xc601('0x35')],_[_0xc601('0x36')](_0x3e2c79[_0xc601('0x2f')],[_0xc601('0x35'),'id'])||{});}})[_0xc601('0x14')](respondWithResult(_0x2cdac1,null))['catch'](handleError(_0x2cdac1,null));};exports[_0xc601('0x37')]=function(_0x59aa29,_0x5ce949){var _0x5e25b1={'raw':![],'where':{}};var _0x43cf7a={};var _0x3f8a52={'count':0x0,'rows':[]};return db[_0xc601('0x1a')]['findOne']({'where':{'id':_0x59aa29[_0xc601('0x31')]['id']}})[_0xc601('0x14')](handleEntityNotFound(_0x5ce949,null))['then'](function(_0x23bbd2){if(_0x23bbd2){_0x43cf7a[_0xc601('0x27')]=_['keys'](db[_0xc601('0x34')][_0xc601('0x1b')]);_0x43cf7a[_0xc601('0x24')]=_[_0xc601('0x23')](_0x59aa29[_0xc601('0x24')]);_0x43cf7a[_0xc601('0x25')]=_[_0xc601('0x26')](_0x43cf7a[_0xc601('0x27')],_0x43cf7a[_0xc601('0x24')]);_0x5e25b1[_0xc601('0x28')]=_['intersection'](_0x43cf7a[_0xc601('0x27')],qs[_0xc601('0x29')](_0x59aa29[_0xc601('0x24')][_0xc601('0x29')]));_0x5e25b1[_0xc601('0x28')]=_0x5e25b1[_0xc601('0x28')][_0xc601('0x2a')]?_0x5e25b1['attributes']:_0x43cf7a[_0xc601('0x27')];if(!_0x59aa29[_0xc601('0x24')][_0xc601('0x38')]('nolimit')){_0x5e25b1[_0xc601('0x13')]=qs[_0xc601('0x13')](_0x59aa29['query'][_0xc601('0x13')]);_0x5e25b1['offset']=qs[_0xc601('0x10')](_0x59aa29[_0xc601('0x24')][_0xc601('0x10')]);}_0x5e25b1['order']=qs[_0xc601('0x39')](_0x59aa29['query']['sort']);_0x5e25b1[_0xc601('0x3a')]=qs[_0xc601('0x25')](_[_0xc601('0x3b')](_0x59aa29[_0xc601('0x24')],_0x43cf7a[_0xc601('0x25')]));_0x5e25b1[_0xc601('0x3a')][_0xc601('0x3c')]=_0x23bbd2['id'];if(_0x59aa29['query'][_0xc601('0x3d')]){_0x5e25b1[_0xc601('0x3a')]=_[_0xc601('0x3e')](_0x5e25b1['where'],{'$or':_[_0xc601('0x3f')](_0x5e25b1['attributes'],function(_0xfaea1d){var _0x1b042c={};_0x1b042c[_0xfaea1d]={'$like':'%'+_0x59aa29[_0xc601('0x24')][_0xc601('0x3d')]+'%'};return _0x1b042c;})});}if(_0x59aa29[_0xc601('0x24')][_0xc601('0x40')]){var _0x3b3df0=_0x59aa29[_0xc601('0x24')][_0xc601('0x40')]['split'](',');var _0x32e2e4={};_0x32e2e4[_0x3b3df0[0x0]]={'$gte':moment(_0x3b3df0[0x1])[_0xc601('0x41')](_0xc601('0x42'))};_0x5e25b1[_0xc601('0x3a')]=_[_0xc601('0x3e')](_0x5e25b1['where'],_0x32e2e4);}_0x5e25b1=_[_0xc601('0x3e')]({},_0x5e25b1,_0x59aa29[_0xc601('0x2c')]);return db['WhatsappMessage'][_0xc601('0x12')]({'where':_0x5e25b1[_0xc601('0x3a')]})['then'](function(_0x4f64c1){_0x3f8a52[_0xc601('0x12')]=_0x4f64c1;if(_0x59aa29[_0xc601('0x24')][_0xc601('0x2b')]){_0x5e25b1[_0xc601('0x43')]=[{'all':!![]}];}return db[_0xc601('0x34')]['findAll'](_0x5e25b1);})[_0xc601('0x14')](function(_0xa6967c){_0x3f8a52['rows']=_0xa6967c;return _0x3f8a52;});}})['then'](respondWithFilteredResult(_0x5ce949,_0x5e25b1))[_0xc601('0x21')](handleError(_0x5ce949,null));};exports[_0xc601('0x44')]=function(_0x113297,_0x12a8ce){return db[_0xc601('0x1a')]['find']({'where':{'id':_0x113297[_0xc601('0x31')]['id']}})[_0xc601('0x14')](handleEntityNotFound(_0x12a8ce,null))[_0xc601('0x14')](function(_0x2a3dbc){if(_0x2a3dbc){return _0x2a3dbc[_0xc601('0x45')](_0x113297['body']['ids'],_['omit'](_0x113297[_0xc601('0x2f')],['ids','id'])||{})[_0xc601('0x46')](function(){return db[_0xc601('0x47')]['findAll']({'attributes':['id',_0xc601('0x18'),_0xc601('0x48')],'where':{'id':_0x113297['body'][_0xc601('0x35')]}});})['then'](function(_0x575f58){socket[_0xc601('0x49')](_0xc601('0x4a'),{'id':Number(_0x113297[_0xc601('0x31')]['id']),'tags':_0x575f58||[]});return{'id':Number(_0x113297[_0xc601('0x31')]['id']),'tags':_0x575f58||[]};});}})[_0xc601('0x14')](respondWithResult(_0x12a8ce,null))[_0xc601('0x21')](handleError(_0x12a8ce,null));};exports[_0xc601('0x4b')]=function(_0x51c717,_0x14e5b0){return db[_0xc601('0x1a')][_0xc601('0x2d')]({'where':{'id':_0x51c717[_0xc601('0x31')]['id']}})[_0xc601('0x14')](handleEntityNotFound(_0x14e5b0,null))['then'](function(_0x1739fb){if(_0x1739fb){return _0x1739fb[_0xc601('0x4b')](_0x51c717[_0xc601('0x24')][_0xc601('0x35')]);}})[_0xc601('0x14')](respondWithStatusCode(_0x14e5b0,null))[_0xc601('0x21')](handleError(_0x14e5b0,null));};exports['download']=function(_0x21fc1d,_0x1d890d){var _0x3587ca=moment()[_0xc601('0x4c')]()[_0xc601('0x4d')]();var _0x2fe654=path[_0xc601('0x4e')](config[_0xc601('0x4f')],_0xc601('0x50'),'files',_0xc601('0x51'));var _0x238cc1=path[_0xc601('0x4e')](config[_0xc601('0x4f')],_0xc601('0x50'),_0xc601('0x52'),_0xc601('0x53'));var _0x4ecec3=path[_0xc601('0x4e')](_0x2fe654,_0x3587ca);var _0x2d9fe0=util['format'](_0xc601('0x54'),_0x21fc1d[_0xc601('0x31')]['id'],_0x3587ca);var _0x12fb2f=path[_0xc601('0x4e')](_0x2fe654,_0x2d9fe0);var _0x413337=[];_0x413337[_0xc601('0x55')]({'model':db[_0xc601('0x56')],'as':_0xc601('0x56'),'attributes':['id','fullname'],'raw':!![]});_0x413337['push']({'model':db[_0xc601('0x57')],'as':_0xc601('0x58'),'attributes':['id','firstName',_0xc601('0x59')],'raw':!![]});if(_0x21fc1d[_0xc601('0x24')][_0xc601('0x53')]){_0x413337[_0xc601('0x55')]({'model':db[_0xc601('0x5a')],'as':_0xc601('0x5a'),'raw':!![]});}var _0x5e5627=[{'model':db[_0xc601('0x34')],'as':_0xc601('0x5b'),'attributes':['id',_0xc601('0x2f'),'createdAt',_0xc601('0x5c'),_0xc601('0x5d'),'read'],'include':_0x413337}];_0x5e5627[_0xc601('0x55')]({'model':db[_0xc601('0x5e')],'as':'Account','attributes':['id',_0xc601('0x18')]});_0x5e5627['push']({'model':db['User'],'as':_0xc601('0x5f'),'attributes':['id',_0xc601('0x60')]});return db['WhatsappInteraction'][_0xc601('0x2d')]({'where':{'id':_0x21fc1d[_0xc601('0x31')]['id']},'include':_0x5e5627})['then'](handleEntityNotFound(_0x1d890d,null))[_0xc601('0x14')](function(_0x1a7fc1){if(_0x1a7fc1){var _0x33f218=_0x1a7fc1[_0xc601('0x61')]({'plain':!![]});fs['mkdirSync'](_0x4ecec3);var _0x5221f3={'channel':_0xc601('0x62'),'account':_0x33f218[_0xc601('0x63')]['name'],'agent':_0x33f218['Owner']?_0x33f218[_0xc601('0x5f')]['fullname']:_0xc601('0x64'),'createdAt':moment(_0x33f218[_0xc601('0x65')])['format'](_0xc601('0x42'))[_0xc601('0x4d')](),'closedAt':_0x33f218['closed']?moment(_0x33f218[_0xc601('0x66')])[_0xc601('0x41')](_0xc601('0x42'))['toString']():'','disposition':_0x33f218[_0xc601('0x67')],'messages':_(_0x33f218[_0xc601('0x5b')])[_0xc601('0x3d')]({'secret':![]})[_0xc601('0x3f')](function(_0x966a30){if(_0x966a30['Attachment']){var _0x515c30=path['join'](_0x238cc1,_0x966a30['Attachment']['basename']);if(fs['existsSync'](_0x515c30)){fs[_0xc601('0x68')](_0x515c30)[_0xc601('0x69')](fs[_0xc601('0x6a')](path['join'](_0x4ecec3,_0x966a30[_0xc601('0x5a')][_0xc601('0x6b')])));}}return{'date':moment(_0x966a30[_0xc601('0x65')])[_0xc601('0x41')](_0xc601('0x42'))[_0xc601('0x4d')](),'sender':_0x966a30[_0xc601('0x5c')]===_0xc601('0x6c')?_0x966a30[_0xc601('0x56')]?_0x966a30['User'][_0xc601('0x60')]:_0xc601('0x6d'):_0x966a30['Contact'][_0xc601('0x6e')]+(_0x966a30[_0xc601('0x58')]['lastName']?'\x20'+_0x966a30['Contact'][_0xc601('0x59')]:''),'body':_0x966a30[_0xc601('0x5a')]?_0x966a30[_0xc601('0x5a')][_0xc601('0x6b')]:_0x966a30[_0xc601('0x2f')],'direction':_0x966a30[_0xc601('0x5c')]===_0xc601('0x6c')?'A':'C','secret':_0x966a30[_0xc601('0x5d')],'read':_0x966a30[_0xc601('0x6f')],'attachment':_0x966a30['Attachment']};})['value']()};return ejs[_0xc601('0x70')](path[_0xc601('0x4e')](config['root'],_0xc601('0x50'),'views',_0xc601('0x71')),{'interaction':_0x5221f3})[_0xc601('0x14')](function(_0x30522a){var _0x80345=path['join'](_0x4ecec3,_0xc601('0x72')+_0x33f218['id']+'-'+_0x3587ca+'.pdf');var _0x4b7197={'path':_0x80345,'channel':_0xc601('0x62'),'interactionId':_0x33f218['id']};return pdf[_0xc601('0x73')](_0x30522a,_0x4b7197);})[_0xc601('0x14')](function(){return new BPromise(function(_0x3ca008,_0x3c779c){zipdir(_0x4ecec3,{'saveTo':_0x12fb2f},function(_0x51731b,_0x11754c){if(_0x51731b)return _0x3c779c(_0x51731b);return _0x3ca008(_0x11754c);});})[_0xc601('0x14')](function(){return new BPromise(function(_0x3a2bf5,_0x46d336){rimraf(_0x4ecec3,function(_0x461ede){if(_0x461ede)_0x46d336(_0x461ede);return _0x3a2bf5();});});})[_0xc601('0x14')](function(){return _0x1d890d['download'](_0x12fb2f,_0x2d9fe0,function(_0x28f79b){if(_0x28f79b){console[_0xc601('0x74')](_0xc601('0x75'),_0x28f79b);}else{fs[_0xc601('0x76')](_0x12fb2f);}});});});}else{return _0x1d890d[_0xc601('0x77')](0xc8);}})[_0xc601('0x21')](handleError(_0x1d890d,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index b7601b7..8047c55 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 _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 +var _0x1a83=['map','findAll','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x115b2e,_0x3f07bd){var _0x1e98ad=function(_0x58e8ff){while(--_0x58e8ff){_0x115b2e['push'](_0x115b2e['shift']());}};_0x1e98ad(++_0x3f07bd);}(_0x1a83,0x1c0));var _0x31a8=function(_0x5e798d,_0x5dcb0b){_0x5e798d=_0x5e798d-0x0;var _0x1fcda6=_0x1a83[_0x5e798d];return _0x1fcda6;};'use strict';var EventEmitter=require(_0x31a8('0x0'));var WhatsappInteraction=require(_0x31a8('0x1'))['db'][_0x31a8('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0x31a8('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x31a8('0x4'),'afterUpdate':_0x31a8('0x5'),'afterDestroy':_0x31a8('0x6')};function emitEvent(_0x26aa71){return function(_0x4f18c3,_0x5e07ea,_0xde01e8){_0x4f18c3[_0x31a8('0x7')]({'attributes':['id'],'raw':!![]})[_0x31a8('0x8')](function(_0x2c4b45){_0x4f18c3[_0x31a8('0x9')](_0x31a8('0xa'),_0x2c4b45[_0x31a8('0xb')](function(_0x12e5c8){return{'id':_0x12e5c8['id']};}));return WhatsappMessage[_0x31a8('0xc')]({'where':{'WhatsappInteractionId':_0x4f18c3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x31a8('0x8')](function(_0x4f1881){_0x4f18c3[_0x31a8('0x9')]('unreadMessages',_0x4f1881['length']);WhatsappInteractionEvents[_0x31a8('0xd')](_0x26aa71+':'+_0x4f18c3['id'],_0x4f18c3);WhatsappInteractionEvents[_0x31a8('0xd')](_0x26aa71,_0x4f18c3);_0xde01e8(null);})['catch'](_0xde01e8(null));};}for(var e in events){if(events[_0x31a8('0xe')](e)){var event=events[e];WhatsappInteraction[_0x31a8('0xf')](e,emitEvent(event));}}module[_0x31a8('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index c4aa616..8bceaf7 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 _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 +var _0xd7b1=['../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4c5c97,_0x4f85bf){var _0xd5d2cb=function(_0x1e6100){while(--_0x1e6100){_0x4c5c97['push'](_0x4c5c97['shift']());}};_0xd5d2cb(++_0x4f85bf);}(_0xd7b1,0x1ab));var _0x1d7b=function(_0x405708,_0x5ec09b){_0x405708=_0x405708-0x0;var _0x52924f=_0xd7b1[_0x405708];return _0x52924f;};'use strict';var _=require(_0x1d7b('0x0'));var util=require('util');var logger=require(_0x1d7b('0x1'))(_0x1d7b('0x2'));var moment=require(_0x1d7b('0x3'));var BPromise=require(_0x1d7b('0x4'));var rp=require(_0x1d7b('0x5'));var fs=require('fs');var path=require(_0x1d7b('0x6'));var rimraf=require(_0x1d7b('0x7'));var config=require(_0x1d7b('0x8'));var attributes=require(_0x1d7b('0x9'));module[_0x1d7b('0xa')]=function(_0x288bbd,_0xa83ea7){return _0x288bbd['define'](_0x1d7b('0xb'),attributes,{'tableName':_0x1d7b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x217213,_0x47c343,_0x4a2fb0){if(_0x217213['changed']('closed')){_0x217213[_0x1d7b('0xd')]=moment()['format'](_0x1d7b('0xe'));}_0x4a2fb0(null,_0x217213);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index b4f3623..cfd9f1e 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 _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 +var _0xf050=['request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','attributes','limit','AddTagsToWhatsappInteraction','ids','omit','body','AddTags','lodash','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','defaults','redis','then','info','WhatsappInteraction,\x20%s,\x20%s'];(function(_0x2b7924,_0x293315){var _0x3cfc1b=function(_0x421cde){while(--_0x421cde){_0x2b7924['push'](_0x2b7924['shift']());}};_0x3cfc1b(++_0x293315);}(_0xf050,0x1e4));var _0x0f05=function(_0x195a84,_0x37a11b){_0x195a84=_0x195a84-0x0;var _0x35fa94=_0xf050[_0x195a84];return _0x35fa94;};'use strict';var _=require(_0x0f05('0x0'));var util=require('util');var moment=require(_0x0f05('0x1'));var BPromise=require(_0x0f05('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f05('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0f05('0x4'))(_0x0f05('0x5'));var config=require(_0x0f05('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x0f05('0x7')](config[_0x0f05('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0f05('0x8')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x442a42,_0x5d5e53,_0x20560d){return new BPromise(function(_0x9e2a30,_0xa741ed){return client['request'](_0x442a42,_0x20560d)[_0x0f05('0x9')](function(_0x274e11){logger[_0x0f05('0xa')](_0x0f05('0xb'),_0x5d5e53,_0x0f05('0xc'));logger[_0x0f05('0xd')](_0x0f05('0xe'),_0x5d5e53,_0x0f05('0xc'),JSON[_0x0f05('0xf')](_0x274e11));if(_0x274e11[_0x0f05('0x10')]){if(_0x274e11['error']['code']===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x5d5e53,_0x274e11[_0x0f05('0x10')][_0x0f05('0x11')]);return _0xa741ed(_0x274e11[_0x0f05('0x10')][_0x0f05('0x11')]);}logger[_0x0f05('0x10')](_0x0f05('0xb'),_0x5d5e53,_0x274e11[_0x0f05('0x10')][_0x0f05('0x11')]);return _0x9e2a30(_0x274e11['error'][_0x0f05('0x11')]);}else{logger[_0x0f05('0xa')](_0x0f05('0xb'),_0x5d5e53,_0x0f05('0xc'));_0x9e2a30(_0x274e11[_0x0f05('0x12')][_0x0f05('0x11')]);}})[_0x0f05('0x13')](function(_0x129880){logger[_0x0f05('0x10')](_0x0f05('0xb'),_0x5d5e53,_0x129880);_0xa741ed(_0x129880);});});}exports[_0x0f05('0x14')]=function(_0x33b81a){var _0x4233aa=this;return new Promise(function(_0x21923a,_0x1f36d8){return db[_0x0f05('0x15')][_0x0f05('0x16')](_0x33b81a['body'],{'raw':_0x33b81a[_0x0f05('0x17')]?_0x33b81a[_0x0f05('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33b81a[_0x0f05('0x17')]?_0x33b81a[_0x0f05('0x17')]['where']||null:null,'attributes':_0x33b81a[_0x0f05('0x17')]?_0x33b81a[_0x0f05('0x17')][_0x0f05('0x18')]||null:null,'limit':_0x33b81a['options']?_0x33b81a['options'][_0x0f05('0x19')]||null:null})['then'](function(_0x4e6f0d){logger[_0x0f05('0xa')](_0x0f05('0x14'),_0x33b81a);logger[_0x0f05('0xd')](_0x0f05('0x14'),_0x33b81a,JSON[_0x0f05('0xf')](_0x4e6f0d));_0x21923a(_0x4e6f0d);})['catch'](function(_0xb4139b){logger[_0x0f05('0x10')](_0x0f05('0x14'),_0xb4139b['message'],_0x33b81a);_0x1f36d8(_0x4233aa[_0x0f05('0x10')](0x1f4,_0xb4139b['message']));});});};exports[_0x0f05('0x1a')]=function(_0x349c60){return new Promise(function(_0x2d025b,_0x562c63){return db[_0x0f05('0x15')]['find']({'where':_0x349c60['options']?_0x349c60[_0x0f05('0x17')]['where']||null:null})[_0x0f05('0x9')](function(_0x415722){if(_0x415722){return _0x415722['addTags'](_0x349c60['body'][_0x0f05('0x1b')],_[_0x0f05('0x1c')](_0x349c60[_0x0f05('0x1d')],['ids','id'])||{});}})['spread'](function(_0x406961){logger['info']('AddTags',_0x349c60);logger[_0x0f05('0xd')](_0x0f05('0x1e'),_0x349c60,JSON[_0x0f05('0xf')](_0x406961));_0x2d025b(_0x406961);})[_0x0f05('0x13')](function(_0x2d1bb3){logger[_0x0f05('0x10')](_0x0f05('0x1e'),_0x2d1bb3[_0x0f05('0x11')],_0x349c60);_0x562c63(_this[_0x0f05('0x10')](0x1f4,_0x2d1bb3['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index cd998e0..af29aa5 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 _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 +var _0x1586=['removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save','update','emit'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x1586,0x104));var _0x6158=function(_0x1db831,_0x42b7b5){_0x1db831=_0x1db831-0x0;var _0x39ba56=_0x1586[_0x1db831];return _0x39ba56;};'use strict';var WhatsappInteractionEvents=require(_0x6158('0x0'));var events=[_0x6158('0x1'),'remove',_0x6158('0x2')];function createListener(_0x44496b,_0x516624){return function(_0x4e2af9){_0x516624[_0x6158('0x3')](_0x44496b,_0x4e2af9);};}function removeListener(_0x4608ab,_0x33f0c8){return function(){WhatsappInteractionEvents[_0x6158('0x4')](_0x4608ab,_0x33f0c8);};}exports[_0x6158('0x5')]=function(_0x12c23f){for(var _0xe15ce4=0x0,_0x330cf3=events[_0x6158('0x6')];_0xe15ce4<_0x330cf3;_0xe15ce4++){var _0x156ec5=events[_0xe15ce4];var _0x480247=createListener(_0x6158('0x7')+_0x156ec5,_0x12c23f);WhatsappInteractionEvents['on'](_0x156ec5,_0x480247);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 0bcd634..8b8f8fa 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 _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 +var _0x38ed=['../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','whatsappmessage:create','create','/:id/status','status','update','/:id/accept','put','/:id/reject','reject','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x26ec70,_0x233756){var _0x21b933=function(_0x3aab67){while(--_0x3aab67){_0x26ec70['push'](_0x26ec70['shift']());}};_0x21b933(++_0x233756);}(_0x38ed,0x1c5));var _0xd38e=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x38ed[_0x209941];return _0x1e8729;};'use strict';var multer=require(_0xd38e('0x0'));var util=require(_0xd38e('0x1'));var path=require(_0xd38e('0x2'));var timeout=require('connect-timeout');var express=require(_0xd38e('0x3'));var router=express[_0xd38e('0x4')]();var fs_extra=require(_0xd38e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd38e('0x6'));var controller=require(_0xd38e('0x7'));router[_0xd38e('0x8')]('/',auth[_0xd38e('0x9')](),controller['index']);router[_0xd38e('0x8')](_0xd38e('0xa'),auth[_0xd38e('0x9')](),controller[_0xd38e('0xb')]);router[_0xd38e('0x8')](_0xd38e('0xc'),auth[_0xd38e('0x9')](),controller[_0xd38e('0xd')]);router[_0xd38e('0xe')]('/',auth[_0xd38e('0x9')](),interaction[_0xd38e('0xf')]('whatsapp',_0xd38e('0x10')),controller[_0xd38e('0x11')]);router[_0xd38e('0xe')](_0xd38e('0x12'),controller[_0xd38e('0x13')]);router['put']('/:id',auth[_0xd38e('0x9')](),controller[_0xd38e('0x14')]);router['put'](_0xd38e('0x15'),auth['isAuthenticated'](),controller['accept']);router[_0xd38e('0x16')](_0xd38e('0x17'),auth[_0xd38e('0x9')](),controller[_0xd38e('0x18')]);router['delete']('/:id',auth[_0xd38e('0x9')](),controller[_0xd38e('0x19')]);module[_0xd38e('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 51dbf39..ade8ad9 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 _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 +var _0x448a=['out','STRING','DATE','exports','TEXT','BOOLEAN'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x448a,0x1ef));var _0xa448=function(_0xc3629e,_0x286d5c){_0xc3629e=_0xc3629e-0x0;var _0x117f8d=_0x448a[_0xc3629e];return _0x117f8d;};'use strict';var Sequelize=require('sequelize');module[_0xa448('0x0')]={'body':{'type':Sequelize[_0xa448('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa448('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xa448('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa448('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xa448('0x5')]},'secret':{'type':Sequelize[_0xa448('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa448('0x4')]},'providerResponse':{'type':Sequelize[_0xa448('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index aa06e85..5a88ba9 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 _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 +var _0x913b=['keys','intersection','model','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','WhatsappMessage','include','rows','show','params','includeAll','find','body','describe','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','format','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','internal','manual','interface','channel','motionChannel','event','accept','EventManager','acceptmessage','../../config/logger','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','sequelize','User','fullname','email','SIP/%s','WhatsappAccountId','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./whatsappMessage.socket','register','jayson/promise','http','client','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','catch','sendStatus','end','status','json','undefined','count','offset','limit','set','update','destroy','name','send','index','map','rawAttributes','fieldName','type','key','query'];(function(_0x2f0db1,_0x53ecfe){var _0x45381a=function(_0x536287){while(--_0x536287){_0x2f0db1['push'](_0x2f0db1['shift']());}};_0x45381a(++_0x53ecfe);}(_0x913b,0x1e8));var _0xb913=function(_0x2757fc,_0xfbd23){_0x2757fc=_0x2757fc-0x0;var _0x58efc4=_0x913b[_0x2757fc];return _0x58efc4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb913('0x0'));var jsonpatch=require(_0xb913('0x1'));var rp=require(_0xb913('0x2'));var moment=require(_0xb913('0x3'));var BPromise=require(_0xb913('0x4'));var Mustache=require(_0xb913('0x5'));var util=require(_0xb913('0x6'));var path=require(_0xb913('0x7'));var sox=require(_0xb913('0x8'));var csv=require(_0xb913('0x9'));var ejs=require(_0xb913('0xa'));var fs=require('fs');var fs_extra=require(_0xb913('0xb'));var _=require(_0xb913('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb913('0xd'));var toCsv=require(_0xb913('0x9'));var querystring=require(_0xb913('0xe'));var Papa=require(_0xb913('0xf'));var Redis=require(_0xb913('0x10'));var authService=require(_0xb913('0x11'));var qs=require(_0xb913('0x12'));var as=require(_0xb913('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb913('0x14'));var utils=require(_0xb913('0x15'));var config=require(_0xb913('0x16'));var licenseUtil=require(_0xb913('0x17'));var db=require(_0xb913('0x18'))['db'];config[_0xb913('0x19')]=_['defaults'](config[_0xb913('0x19')],{'host':_0xb913('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb913('0x19')]));require(_0xb913('0x1b'))[_0xb913('0x1c')](socket);var jayson=require(_0xb913('0x1d'));var client=jayson['client'][_0xb913('0x1e')]({'port':0x232c});var client9002=jayson[_0xb913('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x599fb6,_0x4874f9,_0x471b3f,_0x435fdf){return new BPromise(function(_0x359c88,_0x1c7b97){var _0x2746a2=_0x435fdf||client;return _0x2746a2[_0xb913('0x20')](_0x599fb6,_0x471b3f)[_0xb913('0x21')](function(_0x126e95){logger[_0xb913('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x4874f9,_0xb913('0x23'));logger[_0xb913('0x24')](_0xb913('0x25'),_0x4874f9,_0xb913('0x23'),JSON[_0xb913('0x26')](_0x126e95));if(_0x126e95[_0xb913('0x27')]){if(_0x126e95['error'][_0xb913('0x28')]===0x1f4){logger[_0xb913('0x27')](_0xb913('0x29'),_0x4874f9,_0x126e95['error'][_0xb913('0x2a')]);return _0x1c7b97(_0x126e95[_0xb913('0x27')][_0xb913('0x2a')]);}logger[_0xb913('0x27')](_0xb913('0x29'),_0x4874f9,_0x126e95['error']['message']);return _0x359c88(_0x126e95[_0xb913('0x27')][_0xb913('0x2a')]);}else{logger['info'](_0xb913('0x29'),_0x4874f9,'request\x20sent');_0x359c88(_0x126e95['result']['message']);}})[_0xb913('0x2b')](function(_0x431e37){logger[_0xb913('0x27')](_0xb913('0x29'),_0x4874f9,_0x431e37);_0x1c7b97(_0x431e37);});});}function respondWithStatusCode(_0x3eed7e,_0xbaabcc){_0xbaabcc=_0xbaabcc||0xcc;return function(_0x3fb45a){if(_0x3fb45a){return _0x3eed7e[_0xb913('0x2c')](_0xbaabcc);}return _0x3eed7e['status'](_0xbaabcc)[_0xb913('0x2d')]();};}function respondWithResult(_0x1ba4db,_0x2cdb2c){_0x2cdb2c=_0x2cdb2c||0xc8;return function(_0xae010f){if(_0xae010f){return _0x1ba4db[_0xb913('0x2e')](_0x2cdb2c)[_0xb913('0x2f')](_0xae010f);}};}function respondWithFilteredResult(_0x42467c,_0x1606e0){return function(_0x186638){if(_0x186638){var _0xb20088=typeof _0x1606e0['offset']===_0xb913('0x30')&&typeof _0x1606e0['limit']===_0xb913('0x30');var _0x136812=_0x186638[_0xb913('0x31')];var _0x5c914f=_0xb20088?0x0:_0x1606e0[_0xb913('0x32')];var _0x55e45d=_0xb20088?_0x186638[_0xb913('0x31')]:_0x1606e0[_0xb913('0x32')]+_0x1606e0[_0xb913('0x33')];var _0x1dd0b3;if(_0x55e45d>=_0x136812){_0x55e45d=_0x136812;_0x1dd0b3=0xc8;}else{_0x1dd0b3=0xce;}_0x42467c[_0xb913('0x2e')](_0x1dd0b3);return _0x42467c[_0xb913('0x34')]('Content-Range',_0x5c914f+'-'+_0x55e45d+'/'+_0x136812)[_0xb913('0x2f')](_0x186638);}return null;};}function patchUpdates(_0x281fc6){return function(_0x564852){try{jsonpatch['apply'](_0x564852,_0x281fc6,!![]);}catch(_0x14827d){return BPromise['reject'](_0x14827d);}return _0x564852['save']();};}function saveUpdates(_0x5732dd,_0x514d2c){return function(_0x5d37cc){if(_0x5d37cc){return _0x5d37cc[_0xb913('0x35')](_0x5732dd)[_0xb913('0x21')](function(_0x20e260){return _0x20e260;});}return null;};}function removeEntity(_0x3333fb,_0x3c1ede){return function(_0x2d9cbc){if(_0x2d9cbc){return _0x2d9cbc[_0xb913('0x36')]()[_0xb913('0x21')](function(){_0x3333fb['status'](0xcc)[_0xb913('0x2d')]();});}};}function handleEntityNotFound(_0x360d53,_0x2002ef){return function(_0x43bd55){if(!_0x43bd55){_0x360d53[_0xb913('0x2c')](0x194);}return _0x43bd55;};}function handleError(_0x21e329,_0x497f3c){_0x497f3c=_0x497f3c||0x1f4;return function(_0x45a696){logger[_0xb913('0x27')](_0x45a696['stack']);if(_0x45a696[_0xb913('0x37')]){delete _0x45a696['name'];}_0x21e329[_0xb913('0x2e')](_0x497f3c)[_0xb913('0x38')](_0x45a696);};}exports[_0xb913('0x39')]=function(_0x2604a8,_0x3b8300){var _0x59fd2f={},_0x430cc2={},_0x5f1e95={'count':0x0,'rows':[]};var _0xc299a0=_[_0xb913('0x3a')](db['WhatsappMessage'][_0xb913('0x3b')],function(_0x2846d8){return{'name':_0x2846d8[_0xb913('0x3c')],'type':_0x2846d8[_0xb913('0x3d')][_0xb913('0x3e')]};});_0x430cc2['model']=_[_0xb913('0x3a')](_0xc299a0,_0xb913('0x37'));_0x430cc2[_0xb913('0x3f')]=_[_0xb913('0x40')](_0x2604a8[_0xb913('0x3f')]);_0x430cc2['filters']=_[_0xb913('0x41')](_0x430cc2['model'],_0x430cc2[_0xb913('0x3f')]);_0x59fd2f['attributes']=_[_0xb913('0x41')](_0x430cc2[_0xb913('0x42')],qs[_0xb913('0x43')](_0x2604a8[_0xb913('0x3f')][_0xb913('0x43')]));_0x59fd2f[_0xb913('0x44')]=_0x59fd2f[_0xb913('0x44')][_0xb913('0x45')]?_0x59fd2f['attributes']:_0x430cc2[_0xb913('0x42')];if(!_0x2604a8['query']['hasOwnProperty'](_0xb913('0x46'))){_0x59fd2f[_0xb913('0x33')]=qs[_0xb913('0x33')](_0x2604a8[_0xb913('0x3f')][_0xb913('0x33')]);_0x59fd2f[_0xb913('0x32')]=qs[_0xb913('0x32')](_0x2604a8['query'][_0xb913('0x32')]);}_0x59fd2f[_0xb913('0x47')]=qs['sort'](_0x2604a8[_0xb913('0x3f')][_0xb913('0x48')]);_0x59fd2f[_0xb913('0x49')]=qs[_0xb913('0x4a')](_[_0xb913('0x4b')](_0x2604a8[_0xb913('0x3f')],_0x430cc2[_0xb913('0x4a')]),_0xc299a0);if(_0x2604a8[_0xb913('0x3f')][_0xb913('0x4c')]){_0x59fd2f[_0xb913('0x49')]=_[_0xb913('0x4d')](_0x59fd2f[_0xb913('0x49')],{'$or':_[_0xb913('0x3a')](_0xc299a0,function(_0x4a0f3a){if(_0x4a0f3a[_0xb913('0x3d')]!==_0xb913('0x4e')){var _0x4039e4={};_0x4039e4[_0x4a0f3a[_0xb913('0x37')]]={'$like':'%'+_0x2604a8[_0xb913('0x3f')][_0xb913('0x4c')]+'%'};return _0x4039e4;}})});}_0x59fd2f=_[_0xb913('0x4d')]({},_0x59fd2f,_0x2604a8[_0xb913('0x4f')]);var _0xc7f17d={'where':_0x59fd2f['where']};return db[_0xb913('0x50')][_0xb913('0x31')](_0xc7f17d)[_0xb913('0x21')](function(_0x5e43b3){_0x5f1e95['count']=_0x5e43b3;if(_0x2604a8[_0xb913('0x3f')]['includeAll']){_0x59fd2f[_0xb913('0x51')]=[{'all':!![]}];}return db[_0xb913('0x50')]['findAll'](_0x59fd2f);})[_0xb913('0x21')](function(_0x2b2340){_0x5f1e95[_0xb913('0x52')]=_0x2b2340;return _0x5f1e95;})[_0xb913('0x21')](respondWithFilteredResult(_0x3b8300,_0x59fd2f))[_0xb913('0x2b')](handleError(_0x3b8300,null));};exports[_0xb913('0x53')]=function(_0x1e58a8,_0x50f20b){var _0x246946={'raw':!![],'where':{'id':_0x1e58a8[_0xb913('0x54')]['id']}},_0x5464ee={};_0x5464ee[_0xb913('0x42')]=_[_0xb913('0x40')](db[_0xb913('0x50')][_0xb913('0x3b')]);_0x5464ee['query']=_[_0xb913('0x40')](_0x1e58a8[_0xb913('0x3f')]);_0x5464ee['filters']=_[_0xb913('0x41')](_0x5464ee['model'],_0x5464ee['query']);_0x246946['attributes']=_['intersection'](_0x5464ee[_0xb913('0x42')],qs[_0xb913('0x43')](_0x1e58a8['query'][_0xb913('0x43')]));_0x246946['attributes']=_0x246946[_0xb913('0x44')]['length']?_0x246946[_0xb913('0x44')]:_0x5464ee['model'];if(_0x1e58a8[_0xb913('0x3f')][_0xb913('0x55')]){_0x246946[_0xb913('0x51')]=[{'all':!![]}];}_0x246946=_[_0xb913('0x4d')]({},_0x246946,_0x1e58a8[_0xb913('0x4f')]);return db['WhatsappMessage'][_0xb913('0x56')](_0x246946)[_0xb913('0x21')](handleEntityNotFound(_0x50f20b,null))[_0xb913('0x21')](respondWithResult(_0x50f20b,null))[_0xb913('0x2b')](handleError(_0x50f20b,null));};exports['create']=function(_0x217f03,_0x52204e){return db['WhatsappMessage']['create'](_0x217f03[_0xb913('0x57')],{})[_0xb913('0x21')](respondWithResult(_0x52204e,0xc9))[_0xb913('0x2b')](handleError(_0x52204e,null));};exports['update']=function(_0x49af90,_0x477c71){if(_0x49af90['body']['id']){delete _0x49af90[_0xb913('0x57')]['id'];}return db[_0xb913('0x50')][_0xb913('0x56')]({'where':{'id':_0x49af90[_0xb913('0x54')]['id']}})[_0xb913('0x21')](handleEntityNotFound(_0x477c71,null))[_0xb913('0x21')](saveUpdates(_0x49af90[_0xb913('0x57')],null))[_0xb913('0x21')](respondWithResult(_0x477c71,null))['catch'](handleError(_0x477c71,null));};exports['destroy']=function(_0x3cd478,_0xb32deb){return db[_0xb913('0x50')]['find']({'where':{'id':_0x3cd478['params']['id']}})['then'](handleEntityNotFound(_0xb32deb,null))[_0xb913('0x21')](removeEntity(_0xb32deb,null))['catch'](handleError(_0xb32deb,null));};exports[_0xb913('0x58')]=function(_0x4510d7,_0x3d760c){return db['WhatsappMessage']['describe']()[_0xb913('0x21')](respondWithResult(_0x3d760c,null))['catch'](handleError(_0x3d760c,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports['accept']=function(_0x18d94a,_0x7d362c,_0x1290ec){var _0x41488c={'agent':{},'channel':_0xb913('0x59')};if(_0x18d94a['body']['id']){delete _0x18d94a[_0xb913('0x57')]['id'];}_0x18d94a['body'][_0xb913('0x5a')]=!![];_0x18d94a[_0xb913('0x57')][_0xb913('0x5b')]=moment()['format'](_0xb913('0x5c'));_0x18d94a[_0xb913('0x57')][_0xb913('0x5d')]=_0x18d94a[_0xb913('0x57')][_0xb913('0x5d')]||_0x18d94a[_0xb913('0x5e')]['id'];_0x41488c[_0xb913('0x5f')]['id']=_0x18d94a[_0xb913('0x57')]['UserId'];return db[_0xb913('0x50')][_0xb913('0x56')]({'where':{'id':_0x18d94a[_0xb913('0x54')]['id'],'UserId':null}})[_0xb913('0x21')](handleEntityNotFound(_0x7d362c,null))[_0xb913('0x21')](saveUpdates(_0x18d94a[_0xb913('0x57')],null))[_0xb913('0x21')](function(_0x706c90){if(_0x706c90){_0x41488c[_0xb913('0x2a')]=_0x706c90[_0xb913('0x60')]({'plain':!![]});return db[_0xb913('0x61')][_0xb913('0x56')]({'where':{'id':_0x706c90[_0xb913('0x62')]}});}return null;})[_0xb913('0x21')](handleEntityNotFound(_0x7d362c,null))['then'](function(_0x192fd7){if(_0x192fd7){return _0x192fd7[_0xb913('0x35')]({'UserId':_0x18d94a[_0xb913('0x57')][_0xb913('0x5d')],'read1stAt':_[_0xb913('0x63')](_0x192fd7[_0xb913('0x64')])?moment()[_0xb913('0x65')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xb913('0x21')](function(_0xdd18b){if(_0xdd18b){_0x41488c[_0xb913('0x66')]=_0xdd18b[_0xb913('0x60')]({'plain':!![]});interaction_log[_0xb913('0x22')](_0xb913('0x67'),_0x18d94a[_0xb913('0x5e')]['id'],_0x18d94a[_0xb913('0x5e')][_0xb913('0x37')],_0x18d94a[_0xb913('0x5e')][_0xb913('0x68')],_0x41488c[_0xb913('0x66')]['id'],_0x18d94a[_0xb913('0x57')]?JSON[_0xb913('0x26')](_0x18d94a['body']):_0xb913('0x69'));return respondWithRpcPromise(_0xb913('0x6a'),_0xb913('0x6b'),_0x41488c);}return null;})[_0xb913('0x21')](function(_0xd0206d){var _0x3e0ca9='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xd0206d[_0xb913('0x2a')][_0xb913('0x6c')];return db['sequelize']['query'](_0x3e0ca9,{'type':db[_0xb913('0x6d')][_0xb913('0x6e')][_0xb913('0x6f')],'raw':!![]})['then'](function(_0x117b99){return _0x117b99;});})[_0xb913('0x21')](function(_0x537b6a){if(_0x537b6a){_0x41488c[_0xb913('0x2a')][_0xb913('0x70')]=_0x537b6a[0x0];if(!_0x18d94a['body'][_0xb913('0x5d')])return;return db['User'][_0xb913('0x56')]({'where':{'id':_0x18d94a[_0xb913('0x57')]['UserId'],'role':_0xb913('0x5f')},'attributes':['id',_0xb913('0x37'),'fullname','email',_0xb913('0x71')],'raw':!![]});}return null;})[_0xb913('0x21')](function(_0x58d243){if(!_0x58d243)return null;_0x41488c[_0xb913('0x2a')]['agent']=_0x58d243;return _0x41488c;})['then'](function(_0x16deb0){if(_0x16deb0){if(_0x18d94a['body'][_0xb913('0x72')]){_0x41488c[_0xb913('0x2a')][_0xb913('0x73')]=util[_0xb913('0x65')]('SIP/%s',_0x18d94a['user'][_0xb913('0x37')]);_0x41488c['message'][_0xb913('0x74')]=_0x41488c[_0xb913('0x74')];_0x41488c['message'][_0xb913('0x75')]=_0x41488c[_0xb913('0x74')];_0x41488c['message'][_0xb913('0x76')]=_0xb913('0x77');return respondWithRpcPromise(_0xb913('0x78'),_0xb913('0x78'),{'event':_0xb913('0x79'),'message':_0x41488c[_0xb913('0x2a')]},client9002)[_0xb913('0x21')](function(){return _0x41488c;});}return _0x41488c;}return null;})[_0xb913('0x21')](respondWithResult(_0x7d362c,null))[_0xb913('0x2b')](handleError(_0x7d362c,null));};var interaction_log=require(_0xb913('0x7a'))('whatsapp-interactions');exports[_0xb913('0x7b')]=function(_0x2d70c2,_0x48cba0,_0x5de7aa){var _0x7d83d3={'agent':{},'channel':_0xb913('0x59')};if(_0x2d70c2[_0xb913('0x57')]['id']){delete _0x2d70c2[_0xb913('0x57')]['id'];}_0x2d70c2[_0xb913('0x57')][_0xb913('0x5d')]=_0x2d70c2[_0xb913('0x57')][_0xb913('0x5d')]||_0x2d70c2[_0xb913('0x5e')]['id'];_0x7d83d3['agent']['id']=_0x2d70c2[_0xb913('0x57')][_0xb913('0x5d')];return db[_0xb913('0x50')][_0xb913('0x56')]({'where':{'id':_0x2d70c2['params']['id'],'UserId':null}})[_0xb913('0x21')](handleEntityNotFound(_0x48cba0,null))[_0xb913('0x21')](function(_0x573aec){if(_0x573aec){_0x7d83d3[_0xb913('0x2a')]=_0x573aec['get']({'plain':!![]});return db[_0xb913('0x61')][_0xb913('0x56')]({'where':{'id':_0x573aec['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x48cba0,null))[_0xb913('0x21')](function(_0x144a99){if(_0x144a99){_0x7d83d3['interaction']=_0x144a99['get']({'plain':!![]});interaction_log[_0xb913('0x22')](_0xb913('0x7c'),_0x2d70c2[_0xb913('0x5e')]['id'],_0x2d70c2['user'][_0xb913('0x37')],_0x2d70c2['user'][_0xb913('0x68')],_0x7d83d3[_0xb913('0x66')]['id'],_0x2d70c2[_0xb913('0x57')]?JSON[_0xb913('0x26')](_0x2d70c2[_0xb913('0x57')]):_0xb913('0x69'));return respondWithRpcPromise('RejectMessage',_0xb913('0x7d'),_0x7d83d3);}return null;})[_0xb913('0x21')](function(_0x2cb8cc){var _0xe47ba7='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2cb8cc['message']['ContactId'];return db[_0xb913('0x7e')][_0xb913('0x3f')](_0xe47ba7,{'type':db[_0xb913('0x6d')]['QueryTypes']['SELECT'],'raw':!![]})[_0xb913('0x21')](function(_0x14dfcb){return _0x14dfcb;});})['then'](function(_0x39ee4f){if(_0x39ee4f){_0x7d83d3[_0xb913('0x2a')][_0xb913('0x70')]=_0x39ee4f[0x0];if(!_0x2d70c2[_0xb913('0x57')][_0xb913('0x5d')])return;return db[_0xb913('0x7f')][_0xb913('0x56')]({'where':{'id':_0x2d70c2[_0xb913('0x57')]['UserId'],'role':_0xb913('0x5f')},'attributes':['id','name',_0xb913('0x80'),_0xb913('0x81'),_0xb913('0x71')],'raw':!![]});}return null;})[_0xb913('0x21')](function(_0xf5cd29){if(!_0xf5cd29)return null;_0x7d83d3[_0xb913('0x2a')][_0xb913('0x5f')]=_0xf5cd29;return _0x7d83d3;})[_0xb913('0x21')](function(_0x4891fb){if(_0x4891fb){_0x4891fb['message']['interface']=util['format'](_0xb913('0x82'),_0x2d70c2[_0xb913('0x5e')][_0xb913('0x37')]);_0x4891fb[_0xb913('0x2a')][_0xb913('0x74')]=_0x7d83d3[_0xb913('0x74')];_0x4891fb[_0xb913('0x2a')][_0xb913('0x75')]=_0x7d83d3[_0xb913('0x74')];_0x4891fb[_0xb913('0x2a')][_0xb913('0x76')]=_0xb913('0x7b');respondWithRpcPromise(_0xb913('0x78'),'EventManager',{'event':'rejectmessage','message':_0x4891fb[_0xb913('0x2a')]},client9002);return _0x7d83d3;}return null;})['then'](respondWithResult(_0x48cba0,null))['catch'](handleError(_0x48cba0,null));};exports[_0xb913('0x2e')]=function(_0x22b05a,_0xc75a4f,_0x393151){if(_0x22b05a[_0xb913('0x57')]['id']){delete _0x22b05a[_0xb913('0x57')]['id'];}var _0x46a888;return db['WhatsappMessage'][_0xb913('0x56')]({'where':{'id':_0x22b05a[_0xb913('0x54')]['id']}})[_0xb913('0x21')](handleEntityNotFound(_0xc75a4f,null))[_0xb913('0x21')](function(_0x3652b3){if(_0x3652b3){_0x46a888=_0x3652b3;return db['WhatsappAccount'][_0xb913('0x56')]({'where':{'id':_0x3652b3[_0xb913('0x83')]}});}})[_0xb913('0x21')](handleEntityNotFound(_0xc75a4f,null))[_0xb913('0x21')](function(_0x4b476f){if(_0x4b476f){logger['debug']('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xb913('0x2e'),'received\x20delivery\x20report\x20from',_0x4b476f[_0xb913('0x3d')],util[_0xb913('0x84')](_0x22b05a[_0xb913('0x57')],{'showHidden':![],'depth':null}));switch(_0x4b476f[_0xb913('0x3d')]){case'twilio':if(_0x22b05a['body'][_0xb913('0x85')]&&_0x22b05a[_0xb913('0x57')]['MessageSid']===_0x46a888[_0xb913('0x86')]&&_0x22b05a['body'][_0xb913('0x87')]&&_0x22b05a[_0xb913('0x57')][_0xb913('0x87')]===_0xb913('0x5a')){return _0x46a888[_0xb913('0x35')]({'read':!![]});}else{logger['error'](_0xb913('0x88'),_0xb913('0x2e'),_0xb913('0x89'),util[_0xb913('0x84')](_0x22b05a[_0xb913('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x46a888;}})[_0xb913('0x21')](respondWithResult(_0xc75a4f,null))[_0xb913('0x2b')](handleError(_0xc75a4f,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 0ed4908..c59dfb6 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 _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 +var _0xbaf0=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappMessage'];(function(_0x3bc022,_0x398082){var _0x4a19c6=function(_0x1e3281){while(--_0x1e3281){_0x3bc022['push'](_0x3bc022['shift']());}};_0x4a19c6(++_0x398082);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x0baf('0x0'))['db'][_0x0baf('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x0baf('0x2')](0x0);var events={'afterCreate':_0x0baf('0x3'),'afterUpdate':_0x0baf('0x4'),'afterDestroy':_0x0baf('0x5')};function emitEvent(_0x5a3e42){return function(_0x232cc7,_0x1c383e,_0x2d3fa5){WhatsappMessageEvents[_0x0baf('0x6')](_0x5a3e42+':'+_0x232cc7['id'],_0x232cc7);WhatsappMessageEvents[_0x0baf('0x6')](_0x5a3e42,_0x232cc7);_0x2d3fa5(null);};}for(var e in events){if(events[_0x0baf('0x7')](e)){var event=events[e];WhatsappMessage[_0x0baf('0x8')](e,emitEvent(event));}}module[_0x0baf('0x9')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index aad99c5..c655593 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 _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 +var _0x9787=['out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','update','createdAt','catch','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','authToken','phone','accountSid','create','body','whatsapp:','remote','/api/whatsapp/messages/','sid','error','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','Bearer\x20','application/json','statuses','err','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','node-fetch','path','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models','get','direction','toLowerCase'];(function(_0x4e44db,_0x200c73){var _0x4a614f=function(_0x507b26){while(--_0x507b26){_0x4e44db['push'](_0x4e44db['shift']());}};_0x4a614f(++_0x200c73);}(_0x9787,0x122));var _0x7978=function(_0x3c3039,_0xd0a1dc){_0x3c3039=_0x3c3039-0x0;var _0xc9710d=_0x9787[_0x3c3039];return _0xc9710d;};'use strict';var _=require(_0x7978('0x0'));var util=require(_0x7978('0x1'));var logger=require(_0x7978('0x2'))(_0x7978('0x3'));var moment=require('moment');var BPromise=require(_0x7978('0x4'));var rp=require(_0x7978('0x5'));var fetch=require(_0x7978('0x6'));var fs=require('fs');var path=require(_0x7978('0x7'));var rimraf=require('rimraf');var config=require(_0x7978('0x8'));var attributes=require(_0x7978('0x9'));module['exports']=function(_0x46f605,_0x3b2c26){return _0x46f605[_0x7978('0xa')](_0x7978('0xb'),attributes,{'tableName':_0x7978('0xc'),'paranoid':![],'indexes':[{'name':_0x7978('0xd'),'fields':[_0x7978('0xd')]},{'name':_0x7978('0xe'),'fields':['body'],'type':_0x7978('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x58dd02,_0x50d0fc,_0x10b887){var _0x2d91ab=_0x46f605[_0x7978('0x10')];var _0x4f2a19=_0x58dd02[_0x7978('0x11')]({'plain':!![]});if(_0x4f2a19[_0x7978('0x12')]['toLowerCase']()==='in'||_0x4f2a19['direction'][_0x7978('0x13')]()===_0x7978('0x14')&&!_0x4f2a19[_0x7978('0x15')]&&!_[_0x7978('0x16')](_0x4f2a19[_0x7978('0x17')])){_0x2d91ab[_0x7978('0x18')][_0x7978('0x19')]({'where':{'id':_0x4f2a19[_0x7978('0x1a')]}})['then'](function(_0x37255a){if(_0x37255a){_0x37255a[_0x7978('0x1b')]({'lastMsgAt':_0x4f2a19[_0x7978('0x1c')],'lastMsgDirection':_0x4f2a19[_0x7978('0x12')][_0x7978('0x13')]()});}})[_0x7978('0x1d')](function(_0x3235b9){console['error'](_0x3235b9);});}if(_0x4f2a19[_0x7978('0x12')]===_0x7978('0x14')&&!_0x4f2a19[_0x7978('0x15')]){var _0x19b315;_0x2d91ab[_0x7978('0x1e')][_0x7978('0x1f')]({'where':{'id':_0x4f2a19[_0x7978('0x20')]},'raw':!![]})[_0x7978('0x21')](function(_0x2ecdf3){_0x19b315=_0x2ecdf3;if(_0x19b315&&_0x19b315[_0x7978('0x22')]){switch(_0x19b315[_0x7978('0x22')]){case _0x7978('0x23'):var _0x3459cd=require(_0x7978('0x23'));if(_0x19b315['accountSid']&&_0x19b315[_0x7978('0x24')]&&_0x19b315[_0x7978('0x25')]){var _0xd59243=new _0x3459cd(_0x19b315[_0x7978('0x26')],_0x19b315['authToken']);_0xd59243['messages'][_0x7978('0x27')]({'body':_0x4f2a19[_0x7978('0x28')],'to':_0x7978('0x29')+_0x4f2a19[_0x7978('0x25')],'from':_0x7978('0x29')+_0x19b315['phone'],'statusCallback':_0x19b315[_0x7978('0x2a')]+_0x7978('0x2b')+_0x4f2a19['id']+'/status?token='+_0x19b315['token']})[_0x7978('0x21')](function(_0xa15677){if(_0xa15677[_0x7978('0x2c')]){return _0x58dd02[_0x7978('0x1b')]({'messageId':_0xa15677[_0x7978('0x2c')]});}})[_0x7978('0x1d')](function(_0x1b6b6a){logger[_0x7978('0x2d')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x7978('0x2e'),_0x7978('0x23'),util[_0x7978('0x2f')](_0x1b6b6a,{'showHidden':![],'depth':null}));});}else{logger[_0x7978('0x2d')](_0x7978('0x30'),_0x7978('0x2e'),_0x7978('0x23'),_0x7978('0x31'));}break;case _0x7978('0x32'):var _0x4bdc06=_0x19b315[_0x7978('0x26')];var _0x1692a3=_0x19b315[_0x7978('0x24')];var _0x3b3c38=_0x19b315[_0x7978('0x33')]+_0x7978('0x34')+_0x4bdc06+_0x7978('0x35');var _0xd7cdd0={'to':[_0x4f2a19[_0x7978('0x25')]],'message':{'type':_0x7978('0x36'),'text':_0x4f2a19[_0x7978('0x28')]}};var _0x2c8416={'method':'POST','uri':_0x3b3c38,'headers':{'Authorization':_0x7978('0x37')+_0x1692a3,'Content-Type':_0x7978('0x38')},'body':_0xd7cdd0,'json':!![]};rp(_0x2c8416)[_0x7978('0x21')](function(_0x23fa03){if(_0x23fa03[_0x7978('0x39')][0x0]['message_id']){return _0x58dd02[_0x7978('0x1b')]({'messageId':_0x23fa03[_0x7978('0x39')][0x0]['message_id']});}})[_0x7978('0x1d')](function(_0x4c3321){logger[_0x7978('0x3a')](_0x7978('0x3b'),_0x4c3321);});break;}}})['finally'](function(){_0x10b887();});}else{_0x10b887();}}},'charset':_0x7978('0x3c'),'collate':_0x7978('0x3d')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 1253499..b035958 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 _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 +var _0x4e48=['request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','raw','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./whatsappMessage.socket','register'];(function(_0x3e9402,_0x130b9e){var _0x1f5996=function(_0x5ad15c){while(--_0x5ad15c){_0x3e9402['push'](_0x3e9402['shift']());}};_0x1f5996(++_0x130b9e);}(_0x4e48,0x1ed));var _0x84e4=function(_0x4d5058,_0x404e7c){_0x4d5058=_0x4d5058-0x0;var _0x43006a=_0x4e48[_0x4d5058];return _0x43006a;};'use strict';var _=require(_0x84e4('0x0'));var util=require(_0x84e4('0x1'));var moment=require(_0x84e4('0x2'));var BPromise=require(_0x84e4('0x3'));var rs=require(_0x84e4('0x4'));var fs=require('fs');var Redis=require(_0x84e4('0x5'));var db=require(_0x84e4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x84e4('0x7'))(_0x84e4('0x8'));var config=require(_0x84e4('0x9'));var jayson=require(_0x84e4('0xa'));var client=jayson[_0x84e4('0xb')]['http']({'port':0x232a});config[_0x84e4('0xc')]=_[_0x84e4('0xd')](config[_0x84e4('0xc')],{'host':_0x84e4('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x84e4('0xc')]));require(_0x84e4('0xf'))[_0x84e4('0x10')](socket);function respondWithRpcPromise(_0xa6cd7,_0x33d33a,_0x3eb3af){return new BPromise(function(_0x36ea52,_0x2f985f){return client[_0x84e4('0x11')](_0xa6cd7,_0x3eb3af)[_0x84e4('0x12')](function(_0x184cdf){logger[_0x84e4('0x13')](_0x84e4('0x14'),_0x33d33a,_0x84e4('0x15'));logger['debug'](_0x84e4('0x16'),_0x33d33a,_0x84e4('0x15'),JSON['stringify'](_0x184cdf));if(_0x184cdf[_0x84e4('0x17')]){if(_0x184cdf[_0x84e4('0x17')]['code']===0x1f4){logger[_0x84e4('0x17')](_0x84e4('0x14'),_0x33d33a,_0x184cdf['error']['message']);return _0x2f985f(_0x184cdf['error']['message']);}logger[_0x84e4('0x17')](_0x84e4('0x14'),_0x33d33a,_0x184cdf[_0x84e4('0x17')][_0x84e4('0x18')]);return _0x36ea52(_0x184cdf[_0x84e4('0x17')][_0x84e4('0x18')]);}else{logger[_0x84e4('0x13')](_0x84e4('0x14'),_0x33d33a,_0x84e4('0x15'));_0x36ea52(_0x184cdf[_0x84e4('0x19')]['message']);}})[_0x84e4('0x1a')](function(_0x4313c1){logger[_0x84e4('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x33d33a,_0x4313c1);_0x2f985f(_0x4313c1);});});}exports[_0x84e4('0x1b')]=function(_0x13704a){var _0x355527=this;return new Promise(function(_0x41c3c4,_0x15e2a8){return db[_0x84e4('0x1c')][_0x84e4('0x1d')](_0x13704a['body'],{'raw':_0x13704a[_0x84e4('0x1e')]?_0x13704a['options'][_0x84e4('0x1f')]===undefined?!![]:![]:!![]})[_0x84e4('0x12')](function(_0x2a8184){logger[_0x84e4('0x13')]('CreateWhatsappMessage',_0x13704a);logger[_0x84e4('0x20')](_0x84e4('0x1b'),_0x13704a,JSON[_0x84e4('0x21')](_0x2a8184));_0x41c3c4(_0x2a8184);})[_0x84e4('0x1a')](function(_0x4a78db){logger['error'](_0x84e4('0x1b'),_0x4a78db[_0x84e4('0x18')],_0x13704a);_0x15e2a8(_0x355527[_0x84e4('0x17')](0x1f4,_0x4a78db[_0x84e4('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 95d1bd8..3ad5119 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 _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 +var _0x8925=['length','./whatsappMessage.events','remove','update','emit','removeListener','register'];(function(_0x4fe111,_0x1fdbbd){var _0xe676b6=function(_0x47679d){while(--_0x47679d){_0x4fe111['push'](_0x4fe111['shift']());}};_0xe676b6(++_0x1fdbbd);}(_0x8925,0x15f));var _0x5892=function(_0x175a8c,_0x2d9212){_0x175a8c=_0x175a8c-0x0;var _0x37b0b0=_0x8925[_0x175a8c];return _0x37b0b0;};'use strict';var WhatsappMessageEvents=require(_0x5892('0x0'));var events=['save',_0x5892('0x1'),_0x5892('0x2')];function createListener(_0x18bf6e,_0x968314){return function(_0x40ea29){_0x968314[_0x5892('0x3')](_0x18bf6e,_0x40ea29);};}function removeListener(_0x3f2623,_0x46fdcc){return function(){WhatsappMessageEvents[_0x5892('0x4')](_0x3f2623,_0x46fdcc);};}exports[_0x5892('0x5')]=function(_0x344f36){for(var _0xdb3a36=0x0,_0x2a9014=events[_0x5892('0x6')];_0xdb3a36<_0x2a9014;_0xdb3a36++){var _0x1838ad=events[_0xdb3a36];var _0x4ba33a=createListener('whatsappMessage:'+_0x1838ad,_0x344f36);WhatsappMessageEvents['on'](_0x1838ad,_0x4ba33a);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 693ae3c..c2800ff 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 _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 +var _0x8eac=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','multer','path','connect-timeout'];(function(_0x363ffd,_0x4bfd50){var _0x448a7d=function(_0x16088a){while(--_0x16088a){_0x363ffd['push'](_0x363ffd['shift']());}};_0x448a7d(++_0x4bfd50);}(_0x8eac,0x133));var _0xc8ea=function(_0x5bdbfd,_0x3aaf24){_0x5bdbfd=_0x5bdbfd-0x0;var _0x5711c0=_0x8eac[_0x5bdbfd];return _0x5711c0;};'use strict';var multer=require(_0xc8ea('0x0'));var util=require('util');var path=require(_0xc8ea('0x1'));var timeout=require(_0xc8ea('0x2'));var express=require(_0xc8ea('0x3'));var router=express['Router']();var fs_extra=require(_0xc8ea('0x4'));var auth=require(_0xc8ea('0x5'));var interaction=require(_0xc8ea('0x6'));var config=require(_0xc8ea('0x7'));var controller=require(_0xc8ea('0x8'));router['get']('/',auth[_0xc8ea('0x9')](),controller[_0xc8ea('0xa')]);router[_0xc8ea('0xb')](_0xc8ea('0xc'),auth[_0xc8ea('0x9')](),controller[_0xc8ea('0xd')]);router[_0xc8ea('0xb')](_0xc8ea('0xe'),auth[_0xc8ea('0x9')](),controller[_0xc8ea('0xf')]);router[_0xc8ea('0xb')](_0xc8ea('0x10'),auth[_0xc8ea('0x9')](),controller[_0xc8ea('0x11')]);router[_0xc8ea('0xb')](_0xc8ea('0x12'),auth[_0xc8ea('0x9')](),controller[_0xc8ea('0x13')]);router[_0xc8ea('0xb')](_0xc8ea('0x14'),auth[_0xc8ea('0x9')](),controller['getAgents']);router[_0xc8ea('0x15')]('/',auth[_0xc8ea('0x9')](),controller[_0xc8ea('0x16')]);router[_0xc8ea('0x15')]('/:id/teams',auth[_0xc8ea('0x9')](),controller[_0xc8ea('0x17')]);router[_0xc8ea('0x15')](_0xc8ea('0x14'),auth['isAuthenticated'](),controller[_0xc8ea('0x18')]);router[_0xc8ea('0x19')]('/:id',auth[_0xc8ea('0x9')](),controller[_0xc8ea('0x1a')]);router[_0xc8ea('0x1b')]('/:id',auth[_0xc8ea('0x9')](),controller[_0xc8ea('0x1c')]);router[_0xc8ea('0x1b')](_0xc8ea('0x12'),auth['isAuthenticated'](),controller[_0xc8ea('0x1d')]);router['delete'](_0xc8ea('0x14'),auth[_0xc8ea('0x9')](),controller['removeAgents']);module[_0xc8ea('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 2f4a4a1..e022432 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 _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 +var _0xa477=['ENUM','rrmemory','beepall','roundrobin','STRING','sequelize','exports','name','INTEGER'];(function(_0x595444,_0x32d561){var _0x51cbac=function(_0x431ea9){while(--_0x431ea9){_0x595444['push'](_0x595444['shift']());}};_0x51cbac(++_0x32d561);}(_0xa477,0xe6));var _0x7a47=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xa477[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x7a47('0x0'));module[_0x7a47('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7a47('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x7a47('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7a47('0x4')](_0x7a47('0x5'),_0x7a47('0x6'),_0x7a47('0x7'))},'description':{'type':Sequelize[_0x7a47('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 04dafdf..37e82e8 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 _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 +var _0x6729=['params','model','keys','fields','attributes','length','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','filters','intersection','nolimit','limit','order','sort','pick','WhatsappQueueId','filter','UserWhatsappQueue','User','findAndCountAll','map','UserId','rows','name','format','SIP','whatsappPause','createdAt','updatedAt','getTeams','Team','hasOwnProperty','addTeams','ids','Agents','online','interface','sequelize','transaction','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','set','update','then','get','WhatsappQueues','UserProfileResource','destroy','error','stack','send','index','WhatsappQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','catch','show'];(function(_0x373b37,_0x201bbf){var _0x144a38=function(_0x367ab8){while(--_0x367ab8){_0x373b37['push'](_0x373b37['shift']());}};_0x144a38(++_0x201bbf);}(_0x6729,0x15b));var _0x9672=function(_0x213194,_0x306849){_0x213194=_0x213194-0x0;var _0x4b74f3=_0x6729[_0x213194];return _0x4b74f3;};'use strict';var BPromise=require('bluebird');var util=require(_0x9672('0x0'));var _=require(_0x9672('0x1'));var squel=require(_0x9672('0x2'));var Redis=require(_0x9672('0x3'));var qs=require(_0x9672('0x4'));var logger=require('../../config/logger')(_0x9672('0x5'));var config=require(_0x9672('0x6'));var db=require(_0x9672('0x7'))['db'];config[_0x9672('0x8')]=_[_0x9672('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9672('0xa'))(new Redis(config[_0x9672('0x8')]));require(_0x9672('0xb'))[_0x9672('0xc')](socket);function respondWithStatusCode(_0x4774ad,_0x260c97){_0x260c97=_0x260c97||0xcc;return function(_0x37cbf8){if(_0x37cbf8){return _0x4774ad[_0x9672('0xd')](_0x260c97);}return _0x4774ad[_0x9672('0xe')](_0x260c97)[_0x9672('0xf')]();};}function respondWithResult(_0x4dcb26,_0x1c5252){_0x1c5252=_0x1c5252||0xc8;return function(_0x21f63a){if(_0x21f63a){return _0x4dcb26[_0x9672('0xe')](_0x1c5252)[_0x9672('0x10')](_0x21f63a);}};}function respondWithFilteredResult(_0x1b5fca,_0x268456){return function(_0x1b0c0c){if(_0x1b0c0c){var _0x103af2=typeof _0x268456[_0x9672('0x11')]===_0x9672('0x12')&&typeof _0x268456['limit']==='undefined';var _0x241201=_0x1b0c0c[_0x9672('0x13')];var _0x23f6a3=_0x103af2?0x0:_0x268456[_0x9672('0x11')];var _0x26cc1f=_0x103af2?_0x1b0c0c[_0x9672('0x13')]:_0x268456['offset']+_0x268456['limit'];var _0x4344f2;if(_0x26cc1f>=_0x241201){_0x26cc1f=_0x241201;_0x4344f2=0xc8;}else{_0x4344f2=0xce;}_0x1b5fca[_0x9672('0xe')](_0x4344f2);return _0x1b5fca[_0x9672('0x14')]('Content-Range',_0x23f6a3+'-'+_0x26cc1f+'/'+_0x241201)[_0x9672('0x10')](_0x1b0c0c);}return null;};}function saveUpdates(_0x1ef6e7){return function(_0x2eda52){if(_0x2eda52){return _0x2eda52[_0x9672('0x15')](_0x1ef6e7)[_0x9672('0x16')](function(_0x2f7b04){return _0x2f7b04;});}return null;};}function removeEntity(_0x2afa0f){return function(_0x1f2f19){if(_0x1f2f19){return _0x1f2f19['destroy']()[_0x9672('0x16')](function(){var _0x4d9f60=_0x1f2f19[_0x9672('0x17')]({'plain':!![]});var _0x5d7b05=_0x9672('0x18');return db[_0x9672('0x19')][_0x9672('0x1a')]({'where':{'type':_0x5d7b05,'resourceId':_0x4d9f60['id']}})['then'](function(){return _0x1f2f19;});})[_0x9672('0x16')](function(){_0x2afa0f[_0x9672('0xe')](0xcc)[_0x9672('0xf')]();});}};}function handleEntityNotFound(_0xf11957){return function(_0x2ccf9b){if(!_0x2ccf9b){_0xf11957['sendStatus'](0x194);}return _0x2ccf9b;};}function handleError(_0x2c7b3b,_0x548588){_0x548588=_0x548588||0x1f4;return function(_0x46f3ca){logger[_0x9672('0x1b')](_0x46f3ca[_0x9672('0x1c')]);if(_0x46f3ca['name']){delete _0x46f3ca['name'];}_0x2c7b3b[_0x9672('0xe')](_0x548588)[_0x9672('0x1d')](_0x46f3ca);};}exports[_0x9672('0x1e')]=function(_0x2c4f2c,_0x2cdeb0){var _0x36dd79={};var _0x1acc49={'count':0x0,'rows':[]};var _0x2c1aea=_['map'](db[_0x9672('0x1f')][_0x9672('0x20')],function(_0x46939a){return{'name':_0x46939a[_0x9672('0x21')],'type':_0x46939a[_0x9672('0x22')][_0x9672('0x23')]};});_0x36dd79=qs[_0x9672('0x24')](_0x2c1aea,_0x2c4f2c);var _0x2680e0={'where':_0x36dd79[_0x9672('0x25')]};return db[_0x9672('0x1f')][_0x9672('0x13')](_0x2680e0)[_0x9672('0x16')](function(_0x2f9722){_0x1acc49['count']=_0x2f9722;_0x36dd79['include']=qs[_0x9672('0x26')](_0x2c4f2c[_0x9672('0x27')]);return db[_0x9672('0x1f')][_0x9672('0x28')](_0x36dd79);})[_0x9672('0x16')](function(_0xd88ac7){_0x1acc49['rows']=_0xd88ac7;return _0x1acc49;})[_0x9672('0x16')](respondWithFilteredResult(_0x2cdeb0,_0x36dd79))[_0x9672('0x29')](handleError(_0x2cdeb0,null));};exports[_0x9672('0x2a')]=function(_0x520c5e,_0x384efd){var _0x3f548e={'raw':!![],'where':{'id':_0x520c5e[_0x9672('0x2b')]['id']}},_0x367e23={};_0x367e23[_0x9672('0x2c')]=_[_0x9672('0x2d')](db[_0x9672('0x1f')][_0x9672('0x20')]);_0x367e23[_0x9672('0x27')]=_[_0x9672('0x2d')](_0x520c5e['query']);_0x367e23['filters']=_['intersection'](_0x367e23[_0x9672('0x2c')],_0x367e23[_0x9672('0x27')]);_0x3f548e['attributes']=_['intersection'](_0x367e23[_0x9672('0x2c')],qs[_0x9672('0x2e')](_0x520c5e['query'][_0x9672('0x2e')]));_0x3f548e[_0x9672('0x2f')]=_0x3f548e[_0x9672('0x2f')][_0x9672('0x30')]?_0x3f548e[_0x9672('0x2f')]:_0x367e23['model'];if(_0x520c5e[_0x9672('0x27')]['includeAll']){_0x3f548e[_0x9672('0x26')]=[{'all':!![]}];}_0x3f548e=_[_0x9672('0x31')]({},_0x3f548e,_0x520c5e[_0x9672('0x32')]);return db[_0x9672('0x1f')][_0x9672('0x33')](_0x3f548e)[_0x9672('0x16')](handleEntityNotFound(_0x384efd,null))[_0x9672('0x16')](respondWithResult(_0x384efd,null))['catch'](handleError(_0x384efd,null));};exports['create']=function(_0x66aa80,_0x463ccb){return db['WhatsappQueue'][_0x9672('0x34')](_0x66aa80[_0x9672('0x35')],{})[_0x9672('0x16')](function(_0x55a22b){var _0x187232=_0x66aa80[_0x9672('0x36')][_0x9672('0x17')]({'plain':!![]});if(!_0x187232)throw new Error(_0x9672('0x37'));if(_0x187232[_0x9672('0x38')]===_0x9672('0x36')){var _0x350954=_0x55a22b['get']({'plain':!![]});var _0x229f55='WhatsappQueues';return db[_0x9672('0x39')][_0x9672('0x33')]({'where':{'name':_0x229f55,'userProfileId':_0x187232[_0x9672('0x3a')]},'raw':!![]})[_0x9672('0x16')](function(_0x16d278){if(_0x16d278&&_0x16d278[_0x9672('0x3b')]===0x0){return db[_0x9672('0x19')]['create']({'name':_0x350954['name'],'resourceId':_0x350954['id'],'type':_0x16d278['name'],'sectionId':_0x16d278['id']},{})['then'](function(){return _0x55a22b;});}else{return _0x55a22b;}})['catch'](function(_0x5cd4e3){logger['error'](_0x9672('0x3c'),_0x5cd4e3);throw _0x5cd4e3;});}return _0x55a22b;})[_0x9672('0x16')](respondWithResult(_0x463ccb,0xc9))[_0x9672('0x29')](handleError(_0x463ccb,null));};exports[_0x9672('0x15')]=function(_0x4e609c,_0x59f2d){if(_0x4e609c[_0x9672('0x35')]['id']){delete _0x4e609c[_0x9672('0x35')]['id'];}return db['WhatsappQueue'][_0x9672('0x33')]({'where':{'id':_0x4e609c[_0x9672('0x2b')]['id']}})[_0x9672('0x16')](handleEntityNotFound(_0x59f2d,null))['then'](saveUpdates(_0x4e609c['body'],null))[_0x9672('0x16')](respondWithResult(_0x59f2d,null))[_0x9672('0x29')](handleError(_0x59f2d,null));};exports['destroy']=function(_0x4919bc,_0x1e5401){return db[_0x9672('0x1f')][_0x9672('0x33')]({'where':{'id':_0x4919bc['params']['id']}})[_0x9672('0x16')](handleEntityNotFound(_0x1e5401,null))[_0x9672('0x16')](removeEntity(_0x1e5401,null))[_0x9672('0x29')](handleError(_0x1e5401,null));};exports[_0x9672('0x3d')]=function(_0x2818d7,_0x578b59){return db['WhatsappQueue'][_0x9672('0x3d')]()[_0x9672('0x16')](respondWithResult(_0x578b59,null))[_0x9672('0x29')](handleError(_0x578b59,null));};exports[_0x9672('0x3e')]=function(_0x115342,_0x319c0f){var _0x3f7e7e={'raw':!![],'where':{}},_0x3fbf30={},_0x313360;return db['WhatsappQueue'][_0x9672('0x3f')]({'where':{'id':_0x115342[_0x9672('0x2b')]['id']}})[_0x9672('0x16')](handleEntityNotFound(_0x319c0f,null))['then'](function(_0xcaef76){if(_0xcaef76){_0x313360=_0xcaef76['get']({'plain':!![]});_0x3fbf30[_0x9672('0x2c')]=_[_0x9672('0x2d')](db['UserWhatsappQueue'][_0x9672('0x20')]);_0x3fbf30[_0x9672('0x27')]=_[_0x9672('0x2d')](_0x115342['query']);_0x3fbf30[_0x9672('0x40')]=_[_0x9672('0x41')](_0x3fbf30[_0x9672('0x2c')],_0x3fbf30[_0x9672('0x27')]);_0x3f7e7e[_0x9672('0x2f')]=_[_0x9672('0x41')](_0x3fbf30['model'],qs[_0x9672('0x2e')](_0x115342[_0x9672('0x27')]['fields']));_0x3f7e7e['attributes']=_0x3f7e7e[_0x9672('0x2f')][_0x9672('0x30')]?_0x3f7e7e['attributes']:_0x3fbf30[_0x9672('0x2c')];if(!_0x115342[_0x9672('0x27')]['hasOwnProperty'](_0x9672('0x42'))){_0x3f7e7e[_0x9672('0x43')]=qs[_0x9672('0x43')](_0x115342[_0x9672('0x27')][_0x9672('0x43')]);_0x3f7e7e['offset']=qs[_0x9672('0x11')](_0x115342[_0x9672('0x27')]['offset']);}_0x3f7e7e[_0x9672('0x44')]=qs[_0x9672('0x45')](_0x115342[_0x9672('0x27')][_0x9672('0x45')]);_0x3f7e7e[_0x9672('0x25')]=qs[_0x9672('0x40')](_[_0x9672('0x46')](_0x115342[_0x9672('0x27')],_0x3fbf30[_0x9672('0x40')]));_0x3f7e7e[_0x9672('0x25')][_0x9672('0x47')]=_0xcaef76['id'];if(_0x115342['query'][_0x9672('0x48')]){_0x3f7e7e[_0x9672('0x25')]=_[_0x9672('0x31')](_0x3f7e7e[_0x9672('0x25')],{'$or':_['map'](_0x3f7e7e[_0x9672('0x2f')],function(_0xec294b){var _0x3b968b={};_0x3b968b[_0xec294b]={'$like':'%'+_0x115342[_0x9672('0x27')][_0x9672('0x48')]+'%'};return _0x3b968b;})});}_0x3f7e7e=_['merge']({},_0x3f7e7e,_0x115342[_0x9672('0x32')]);return db[_0x9672('0x49')][_0x9672('0x28')](_0x3f7e7e);}})[_0x9672('0x16')](function(_0x4c8d6b){if(_0x4c8d6b){return db[_0x9672('0x4a')][_0x9672('0x4b')]({'where':{'id':_[_0x9672('0x4c')](_0x4c8d6b,_0x9672('0x4d')),'role':'agent'},'attributes':['id','name','whatsappPause','updatedAt','createdAt']});}})[_0x9672('0x16')](function(_0x459492){if(_0x459492){return{'count':_0x459492['count'],'rows':_['map'](_0x459492[_0x9672('0x4e')],function(_0x57e487){return{'membername':_0x57e487[_0x9672('0x4f')],'UserId':_0x57e487['id'],'queue_name':_0x313360['name'],'WhatsappQueueId':_0x313360['id'],'interface':util[_0x9672('0x50')]('%s/%s',_0x9672('0x51'),_0x57e487[_0x9672('0x4f')]),'penalty':0x0,'paused':_0x57e487[_0x9672('0x52')],'createdAt':_0x57e487[_0x9672('0x53')],'updatedAt':_0x57e487[_0x9672('0x54')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9672('0x16')](respondWithFilteredResult(_0x319c0f,_0x3f7e7e))[_0x9672('0x29')](handleError(_0x319c0f,null));};exports[_0x9672('0x55')]=function(_0x2b37f7,_0x2fba62){var _0x14b4c0={};var _0x432a40={};var _0x27c348;var _0x221fff;return db[_0x9672('0x1f')][_0x9672('0x3f')]({'where':{'id':_0x2b37f7[_0x9672('0x2b')]['id']}})[_0x9672('0x16')](handleEntityNotFound(_0x2fba62,null))['then'](function(_0x29855a){if(_0x29855a){_0x27c348=_0x29855a;_0x432a40[_0x9672('0x2c')]=_[_0x9672('0x2d')](db[_0x9672('0x56')][_0x9672('0x20')]);_0x432a40['query']=_[_0x9672('0x2d')](_0x2b37f7[_0x9672('0x27')]);_0x432a40['filters']=_[_0x9672('0x41')](_0x432a40[_0x9672('0x2c')],_0x432a40[_0x9672('0x27')]);_0x14b4c0['attributes']=_['intersection'](_0x432a40[_0x9672('0x2c')],qs['fields'](_0x2b37f7[_0x9672('0x27')]['fields']));_0x14b4c0[_0x9672('0x2f')]=_0x14b4c0[_0x9672('0x2f')]['length']?_0x14b4c0['attributes']:_0x432a40[_0x9672('0x2c')];_0x14b4c0[_0x9672('0x44')]=qs[_0x9672('0x45')](_0x2b37f7[_0x9672('0x27')][_0x9672('0x45')]);_0x14b4c0['where']=qs['filters'](_[_0x9672('0x46')](_0x2b37f7[_0x9672('0x27')],_0x432a40[_0x9672('0x40')]));if(_0x2b37f7[_0x9672('0x27')][_0x9672('0x48')]){_0x14b4c0[_0x9672('0x25')]=_[_0x9672('0x31')](_0x14b4c0['where'],{'$or':_[_0x9672('0x4c')](_0x14b4c0[_0x9672('0x2f')],function(_0x13a1cb){var _0x393cd5={};_0x393cd5[_0x13a1cb]={'$like':'%'+_0x2b37f7[_0x9672('0x27')][_0x9672('0x48')]+'%'};return _0x393cd5;})});}_0x14b4c0=_[_0x9672('0x31')]({},_0x14b4c0,_0x2b37f7[_0x9672('0x32')]);return _0x27c348[_0x9672('0x55')](_0x14b4c0);}})['then'](function(_0x12d350){if(_0x12d350){_0x221fff=_0x12d350[_0x9672('0x30')];if(!_0x2b37f7['query'][_0x9672('0x57')]('nolimit')){_0x14b4c0[_0x9672('0x43')]=qs[_0x9672('0x43')](_0x2b37f7[_0x9672('0x27')]['limit']);_0x14b4c0[_0x9672('0x11')]=qs[_0x9672('0x11')](_0x2b37f7[_0x9672('0x27')][_0x9672('0x11')]);}return _0x27c348['getTeams'](_0x14b4c0);}})['then'](function(_0xc46966){if(_0xc46966){return _0xc46966?{'count':_0x221fff,'rows':_0xc46966}:null;}})[_0x9672('0x16')](respondWithResult(_0x2fba62,null))['catch'](handleError(_0x2fba62,null));};exports[_0x9672('0x58')]=function(_0x59a207,_0x332763){var _0x486e18=_0x59a207[_0x9672('0x35')][_0x9672('0x59')];return db[_0x9672('0x56')][_0x9672('0x28')]({'where':{'id':_0x486e18},'attributes':['id'],'include':[{'model':db[_0x9672('0x4a')],'as':_0x9672('0x5a'),'attributes':['id',_0x9672('0x4f'),_0x9672('0x5b'),'voicePause',_0x9672('0x5c')],'raw':!![]}]})[_0x9672('0x16')](function(_0x467636){if(_0x467636){var _0x1a4471=_['flatMap'](_0x467636,function(_0x5adb99){var _0x2a99b8=_0x5adb99['get']({'plain':!![]});return _0x2a99b8[_0x9672('0x5a')];});return db['WhatsappQueue'][_0x9672('0x33')]({'where':{'id':_0x59a207[_0x9672('0x2b')]['id']}})[_0x9672('0x16')](function(_0x5e2ad9){return db[_0x9672('0x5d')][_0x9672('0x5e')](function(_0x4599be){return _0x5e2ad9[_0x9672('0x58')](_0x486e18,{'transaction':_0x4599be})[_0x9672('0x16')](function(){return BPromise[_0x9672('0x5f')](_0x1a4471,function(_0x23306a){return db[_0x9672('0x49')][_0x9672('0x60')]({'where':{'UserId':_0x23306a['id'],'WhatsappQueueId':_0x59a207['params']['id']},'transaction':_0x4599be});});})['then'](function(){_0x1a4471['forEach'](function(_0x471678){socket[_0x9672('0x61')](_0x9672('0x62'),{'UserId':_0x471678['id'],'WhatsappQueueId':_0x5e2ad9['id']});});});});});}})[_0x9672('0x16')](respondWithStatusCode(_0x332763,null))[_0x9672('0x29')](handleError(_0x332763,null));};exports[_0x9672('0x63')]=function(_0x3ba988,_0x575daf){return db['Team'][_0x9672('0x28')]({'where':{'id':_0x3ba988['query'][_0x9672('0x59')]},'attributes':['id'],'include':[{'model':db[_0x9672('0x4a')],'as':_0x9672('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x9672('0x16')](handleEntityNotFound(_0x575daf,null))['then'](function(_0x56edd0){var _0x3a8326=_['map'](_0x56edd0,'id');var _0x473a4d=[];var _0x3e06ea=[];var _0x40d98a=squel[_0x9672('0x64')]();_0x40d98a[_0x9672('0x65')](_0x9672('0x66'))[_0x9672('0x67')](_0x9672('0x68'),'tq')[_0x9672('0x69')](_0x9672('0x6a'),'ut',_0x9672('0x6b'))[_0x9672('0x25')](_0x9672('0x6c'),_0x3ba988[_0x9672('0x2b')]['id']);for(var _0x3edc08=0x0;_0x3edc08<_0x56edd0[_0x9672('0x30')];_0x3edc08+=0x1){let _0x2abdab=_0x56edd0[_0x3edc08];for(var _0x59abd9=0x0;_0x59abd9<_0x2abdab[_0x9672('0x5a')][_0x9672('0x30')];_0x59abd9+=0x1){let _0x400e0=_0x2abdab[_0x9672('0x5a')][_0x59abd9];var _0x2213c2=_0x40d98a[_0x9672('0x6d')]();_0x2213c2[_0x9672('0x25')](_0x9672('0x6e'),_0x400e0['id']);_0x3e06ea[_0x9672('0x6f')](db[_0x9672('0x5d')][_0x9672('0x27')](_0x2213c2[_0x9672('0x70')](),{'type':db[_0x9672('0x5d')][_0x9672('0x71')][_0x9672('0x72')]})['then'](function(_0x1c4dbe){if(_0x1c4dbe[_0x9672('0x30')]===0x1){return _0x400e0['id'];}else{var _0x4cd68e=_[_0x9672('0x73')](_['map'](_0x1c4dbe,_0x9672('0x74')),function(_0x1523ce){return _[_0x9672('0x75')](_0x3a8326,_0x1523ce);});if(_0x4cd68e){return _0x400e0['id'];}}}));}}return BPromise[_0x9672('0x76')](_0x3e06ea)[_0x9672('0x16')](function(_0x35b9ea){_0x473a4d=_(_0x473a4d)['union'](_0x35b9ea)[_0x9672('0x77')]()[_0x9672('0x78')]();return db[_0x9672('0x1f')][_0x9672('0x33')]({'where':{'id':_0x3ba988[_0x9672('0x2b')]['id']}})[_0x9672('0x16')](function(_0xc3418a){return db['sequelize'][_0x9672('0x5e')](function(_0x4411db){return _0xc3418a[_0x9672('0x63')](_0x3ba988[_0x9672('0x27')]['ids'],{'transaction':_0x4411db})[_0x9672('0x16')](function(){if(!_[_0x9672('0x79')](_0x473a4d)){return _0xc3418a[_0x9672('0x7a')](_0x473a4d,{'transaction':_0x4411db});}})[_0x9672('0x16')](function(){_0x473a4d[_0x9672('0x7b')](function(_0x3f692c){socket[_0x9672('0x61')](_0x9672('0x7c'),{'UserId':_0x3f692c,'WhatsappQueueId':_0xc3418a['id']});});});});});});})[_0x9672('0x16')](respondWithStatusCode(_0x575daf,null))[_0x9672('0x29')](handleError(_0x575daf,null));};exports[_0x9672('0x7d')]=function(_0x22eef9,_0x2f3c6e){return db['WhatsappQueue'][_0x9672('0x33')]({'where':{'id':_0x22eef9[_0x9672('0x2b')]['id']}})[_0x9672('0x16')](handleEntityNotFound(_0x2f3c6e,null))[_0x9672('0x16')](function(_0x3648cd){if(_0x3648cd){return _0x3648cd['addAgents'](_0x22eef9['body']['ids'],_[_0x9672('0x7e')](_0x22eef9[_0x9672('0x35')],[_0x9672('0x59'),'id'])||{})[_0x9672('0x7f')](function(_0x206f5a){for(var _0x394e9d=0x0;_0x394e9d<_0x22eef9['body'][_0x9672('0x59')][_0x9672('0x30')];_0x394e9d+=0x1){socket[_0x9672('0x61')]('userWhatsappQueue:save',{'UserId':Number(_0x22eef9[_0x9672('0x35')][_0x9672('0x59')][_0x394e9d]),'WhatsappQueueId':Number(_0x22eef9[_0x9672('0x2b')]['id'])});}return _0x206f5a;});}})[_0x9672('0x16')](respondWithResult(_0x2f3c6e,null))[_0x9672('0x29')](handleError(_0x2f3c6e,null));};exports[_0x9672('0x7a')]=function(_0x453337,_0x344114){return db[_0x9672('0x1f')]['find']({'where':{'id':_0x453337['params']['id']}})[_0x9672('0x16')](handleEntityNotFound(_0x344114,null))[_0x9672('0x16')](function(_0x1bb945){if(_0x1bb945){return _0x1bb945[_0x9672('0x7a')](_0x453337['query'][_0x9672('0x59')])[_0x9672('0x16')](function(){if(_[_0x9672('0x80')](_0x453337['query'][_0x9672('0x59')])){for(var _0xe9993b=0x0;_0xe9993b<_0x453337[_0x9672('0x27')][_0x9672('0x59')][_0x9672('0x30')];_0xe9993b+=0x1){socket['emit'](_0x9672('0x7c'),{'UserId':Number(_0x453337[_0x9672('0x27')][_0x9672('0x59')][_0xe9993b]),'WhatsappQueueId':Number(_0x453337[_0x9672('0x2b')]['id'])});}}else{socket[_0x9672('0x61')]('userWhatsappQueue:remove',{'UserId':Number(_0x453337[_0x9672('0x27')][_0x9672('0x59')]),'WhatsappQueueId':Number(_0x453337['params']['id'])});}});}})[_0x9672('0x16')](respondWithStatusCode(_0x344114,null))[_0x9672('0x29')](handleError(_0x344114,null));};exports['getAgents']=function(_0x4e5ad5,_0x5e2e60){var _0x4d2536={};var _0x13088d={};var _0x3c4878;var _0x5c3a96;return db[_0x9672('0x1f')][_0x9672('0x3f')]({'where':{'id':_0x4e5ad5[_0x9672('0x2b')]['id']}})[_0x9672('0x16')](handleEntityNotFound(_0x5e2e60,null))[_0x9672('0x16')](function(_0x1f2362){if(_0x1f2362){_0x3c4878=_0x1f2362;_0x13088d[_0x9672('0x2c')]=_[_0x9672('0x2d')](db[_0x9672('0x4a')][_0x9672('0x20')]);_0x13088d['query']=_[_0x9672('0x2d')](_0x4e5ad5[_0x9672('0x27')]);_0x13088d[_0x9672('0x40')]=_['intersection'](_0x13088d[_0x9672('0x2c')],_0x13088d[_0x9672('0x27')]);_0x4d2536[_0x9672('0x2f')]=_['intersection'](_0x13088d['model'],qs[_0x9672('0x2e')](_0x4e5ad5[_0x9672('0x27')][_0x9672('0x2e')]));_0x4d2536['attributes']=_0x4d2536[_0x9672('0x2f')]['length']?_0x4d2536['attributes']:_0x13088d[_0x9672('0x2c')];_0x4d2536[_0x9672('0x44')]=qs[_0x9672('0x45')](_0x4e5ad5[_0x9672('0x27')]['sort']);_0x4d2536[_0x9672('0x25')]=qs[_0x9672('0x40')](_[_0x9672('0x46')](_0x4e5ad5['query'],_0x13088d[_0x9672('0x40')]));if(_0x4e5ad5[_0x9672('0x27')][_0x9672('0x48')]){_0x4d2536['where']=_[_0x9672('0x31')](_0x4d2536[_0x9672('0x25')],{'$or':_[_0x9672('0x4c')](_0x4d2536['attributes'],function(_0x2e8c95){var _0x7ccd08={};_0x7ccd08[_0x2e8c95]={'$like':'%'+_0x4e5ad5[_0x9672('0x27')][_0x9672('0x48')]+'%'};return _0x7ccd08;})});}_0x4d2536=_[_0x9672('0x31')]({},_0x4d2536,_0x4e5ad5[_0x9672('0x32')]);return _0x3c4878[_0x9672('0x81')](_0x4d2536);}})[_0x9672('0x16')](function(_0x82180f){if(_0x82180f){_0x5c3a96=_0x82180f[_0x9672('0x30')];if(!_0x4e5ad5[_0x9672('0x27')][_0x9672('0x57')]('nolimit')){_0x4d2536[_0x9672('0x43')]=qs[_0x9672('0x43')](_0x4e5ad5[_0x9672('0x27')][_0x9672('0x43')]);_0x4d2536['offset']=qs[_0x9672('0x11')](_0x4e5ad5[_0x9672('0x27')][_0x9672('0x11')]);}return _0x3c4878[_0x9672('0x81')](_0x4d2536);}})[_0x9672('0x16')](function(_0x5a546b){if(_0x5a546b){return _0x5a546b?{'count':_0x5c3a96,'rows':_0x5a546b}:null;}})[_0x9672('0x16')](respondWithResult(_0x5e2e60,null))[_0x9672('0x29')](handleError(_0x5e2e60,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index d493271..a63bbde 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 _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 +var _0x4a27=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x41ea8b,_0x2842c4){var _0x4e3e6a=function(_0x5dab34){while(--_0x5dab34){_0x41ea8b['push'](_0x41ea8b['shift']());}};_0x4e3e6a(++_0x2842c4);}(_0x4a27,0x1b7));var _0x74a2=function(_0x2969a3,_0x801e59){_0x2969a3=_0x2969a3-0x0;var _0x40f909=_0x4a27[_0x2969a3];return _0x40f909;};'use strict';var EventEmitter=require(_0x74a2('0x0'));var WhatsappQueue=require(_0x74a2('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x74a2('0x2')](0x0);var events={'afterCreate':_0x74a2('0x3'),'afterUpdate':'update','afterDestroy':_0x74a2('0x4')};function emitEvent(_0x4944fe){return function(_0x32c502,_0x562007,_0x57edd6){WhatsappQueueEvents[_0x74a2('0x5')](_0x4944fe+':'+_0x32c502['id'],_0x32c502);WhatsappQueueEvents[_0x74a2('0x5')](_0x4944fe,_0x32c502);_0x57edd6(null);};}for(var e in events){if(events[_0x74a2('0x6')](e)){var event=events[e];WhatsappQueue[_0x74a2('0x7')](e,emitEvent(event));}}module[_0x74a2('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 4b57734..de9be73 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 _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 +var _0xbfca=['util','../../config/logger','moment','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','whatsapp_queues'];(function(_0xfbbc8b,_0xce223f){var _0x2a4175=function(_0x328a58){while(--_0x328a58){_0xfbbc8b['push'](_0xfbbc8b['shift']());}};_0x2a4175(++_0xce223f);}(_0xbfca,0x190));var _0xabfc=function(_0x238825,_0x5e1931){_0x238825=_0x238825-0x0;var _0x3724a4=_0xbfca[_0x238825];return _0x3724a4;};'use strict';var _=require('lodash');var util=require(_0xabfc('0x0'));var logger=require(_0xabfc('0x1'))('api');var moment=require(_0xabfc('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xabfc('0x3'));var rimraf=require(_0xabfc('0x4'));var config=require(_0xabfc('0x5'));var attributes=require(_0xabfc('0x6'));module[_0xabfc('0x7')]=function(_0x4d10d6,_0x53e0f7){return _0x4d10d6[_0xabfc('0x8')]('WhatsappQueue',attributes,{'tableName':_0xabfc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 53d13b7..1620d71 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 _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 +var _0x0201=['WhatsappQueue','options','raw','where','attributes','include','map','model','catch','find','then','ShowWhatsappQueue','lodash','bluebird','randomstring','../../config/utils','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','info','result','GetWhatsappQueue'];(function(_0x52be3a,_0x4c9e7a){var _0xc6a151=function(_0xcbd150){while(--_0xcbd150){_0x52be3a['push'](_0x52be3a['shift']());}};_0xc6a151(++_0x4c9e7a);}(_0x0201,0x182));var _0x1020=function(_0x512058,_0x2d1bfb){_0x512058=_0x512058-0x0;var _0x289456=_0x0201[_0x512058];return _0x289456;};'use strict';var _=require(_0x1020('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1020('0x1'));var rs=require(_0x1020('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1020('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x1020('0x4')]({'port':0x232a});config[_0x1020('0x5')]=_[_0x1020('0x6')](config[_0x1020('0x5')],{'host':_0x1020('0x7'),'port':0x18eb});var socket=require(_0x1020('0x8'))(new Redis(config[_0x1020('0x5')]));require(_0x1020('0x9'))[_0x1020('0xa')](socket);function respondWithRpcPromise(_0x5bd9cf,_0x28b991,_0x3f6a6d){return new BPromise(function(_0x2eebaf,_0x28cb06){return client['request'](_0x5bd9cf,_0x3f6a6d)['then'](function(_0x118a1a){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x28b991,_0x1020('0xb'));logger[_0x1020('0xc')](_0x1020('0xd'),_0x28b991,_0x1020('0xb'),JSON[_0x1020('0xe')](_0x118a1a));if(_0x118a1a[_0x1020('0xf')]){if(_0x118a1a[_0x1020('0xf')][_0x1020('0x10')]===0x1f4){logger[_0x1020('0xf')](_0x1020('0x11'),_0x28b991,_0x118a1a[_0x1020('0xf')][_0x1020('0x12')]);return _0x28cb06(_0x118a1a['error'][_0x1020('0x12')]);}logger[_0x1020('0xf')](_0x1020('0x11'),_0x28b991,_0x118a1a[_0x1020('0xf')]['message']);return _0x2eebaf(_0x118a1a[_0x1020('0xf')][_0x1020('0x12')]);}else{logger[_0x1020('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x28b991,_0x1020('0xb'));_0x2eebaf(_0x118a1a[_0x1020('0x14')][_0x1020('0x12')]);}})['catch'](function(_0x4a999b){logger[_0x1020('0xf')](_0x1020('0x11'),_0x28b991,_0x4a999b);_0x28cb06(_0x4a999b);});});}exports[_0x1020('0x15')]=function(_0x118a13){var _0x436b51=this;return new Promise(function(_0x15731d,_0x55c034){return db[_0x1020('0x16')]['findAll']({'raw':_0x118a13[_0x1020('0x17')]?_0x118a13[_0x1020('0x17')][_0x1020('0x18')]===undefined?!![]:![]:!![],'where':_0x118a13[_0x1020('0x17')]?_0x118a13[_0x1020('0x17')][_0x1020('0x19')]||null:null,'attributes':_0x118a13[_0x1020('0x17')]?_0x118a13['options'][_0x1020('0x1a')]||null:null,'limit':_0x118a13[_0x1020('0x17')]?_0x118a13['options']['limit']||null:null,'include':_0x118a13[_0x1020('0x17')]?_0x118a13['options'][_0x1020('0x1b')]?_[_0x1020('0x1c')](_0x118a13[_0x1020('0x17')][_0x1020('0x1b')],function(_0x36b58b){return{'model':db[_0x36b58b['model']],'as':_0x36b58b['as'],'attributes':_0x36b58b[_0x1020('0x1a')],'include':_0x36b58b['include']?_[_0x1020('0x1c')](_0x36b58b[_0x1020('0x1b')],function(_0x4bd38e){return{'model':db[_0x4bd38e[_0x1020('0x1d')]],'as':_0x4bd38e['as'],'attributes':_0x4bd38e[_0x1020('0x1a')],'include':_0x4bd38e[_0x1020('0x1b')]?_[_0x1020('0x1c')](_0x4bd38e[_0x1020('0x1b')],function(_0x5eed92){return{'model':db[_0x5eed92[_0x1020('0x1d')]],'as':_0x5eed92['as'],'attributes':_0x5eed92[_0x1020('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xfe81fa){logger[_0x1020('0x13')](_0x1020('0x15'),_0x118a13);logger['debug'](_0x1020('0x15'),_0x118a13,JSON[_0x1020('0xe')](_0xfe81fa));_0x15731d(_0xfe81fa);})[_0x1020('0x1e')](function(_0x167eca){logger[_0x1020('0xf')]('GetWhatsappQueue',_0x167eca[_0x1020('0x12')],_0x118a13);_0x55c034(_0x436b51[_0x1020('0xf')](0x1f4,_0x167eca[_0x1020('0x12')]));});});};exports['ShowWhatsappQueue']=function(_0x19973b){var _0x4ac15e=this;return new Promise(function(_0x3dc903,_0x30299c){return db[_0x1020('0x16')][_0x1020('0x1f')]({'raw':_0x19973b['options']?_0x19973b[_0x1020('0x17')][_0x1020('0x18')]===undefined?!![]:![]:!![],'where':_0x19973b[_0x1020('0x17')]?_0x19973b[_0x1020('0x17')][_0x1020('0x19')]||null:null,'attributes':_0x19973b[_0x1020('0x17')]?_0x19973b[_0x1020('0x17')][_0x1020('0x1a')]||null:null,'include':_0x19973b['options']?_0x19973b['options'][_0x1020('0x1b')]?_[_0x1020('0x1c')](_0x19973b[_0x1020('0x17')]['include'],function(_0x5ca493){return{'model':db[_0x5ca493[_0x1020('0x1d')]],'as':_0x5ca493['as'],'attributes':_0x5ca493['attributes'],'include':_0x5ca493[_0x1020('0x1b')]?_['map'](_0x5ca493[_0x1020('0x1b')],function(_0x4e2de2){return{'model':db[_0x4e2de2['model']],'as':_0x4e2de2['as'],'attributes':_0x4e2de2[_0x1020('0x1a')],'include':_0x4e2de2[_0x1020('0x1b')]?_['map'](_0x4e2de2['include'],function(_0x20c499){return{'model':db[_0x20c499['model']],'as':_0x20c499['as'],'attributes':_0x20c499[_0x1020('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1020('0x20')](function(_0x187ecb){logger[_0x1020('0x13')](_0x1020('0x21'),_0x19973b);logger[_0x1020('0xc')]('ShowWhatsappQueue',_0x19973b,JSON['stringify'](_0x187ecb));_0x3dc903(_0x187ecb);})['catch'](function(_0x1f3a04){logger['error']('ShowWhatsappQueue',_0x1f3a04[_0x1020('0x12')],_0x19973b);_0x30299c(_0x4ac15e['error'](0x1f4,_0x1f3a04[_0x1020('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 09b56cf..efe6d9f 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 _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 +var _0x5d19=['update','emit','removeListener','register','./whatsappQueue.events','save','remove'];(function(_0x4c6550,_0x15cea5){var _0x5dc57a=function(_0xe43ed4){while(--_0xe43ed4){_0x4c6550['push'](_0x4c6550['shift']());}};_0x5dc57a(++_0x15cea5);}(_0x5d19,0x1c4));var _0x95d1=function(_0x90a39a,_0x32020d){_0x90a39a=_0x90a39a-0x0;var _0x2b62f7=_0x5d19[_0x90a39a];return _0x2b62f7;};'use strict';var WhatsappQueueEvents=require(_0x95d1('0x0'));var events=[_0x95d1('0x1'),_0x95d1('0x2'),_0x95d1('0x3')];function createListener(_0x49f616,_0x2dd834){return function(_0x46abbe){_0x2dd834[_0x95d1('0x4')](_0x49f616,_0x46abbe);};}function removeListener(_0x425dd2,_0x11e49c){return function(){WhatsappQueueEvents[_0x95d1('0x5')](_0x425dd2,_0x11e49c);};}exports[_0x95d1('0x6')]=function(_0xc12798){for(var _0x560607=0x0,_0x538e6a=events['length'];_0x560607<_0x538e6a;_0x560607++){var _0x48320c=events[_0x560607];var _0x4856ca=createListener('whatsappQueue:'+_0x48320c,_0xc12798);WhatsappQueueEvents['on'](_0x48320c,_0x4856ca);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 33ae0c5..91dbcc6 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 _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 +var _0xbb56=['isAuthenticated','index','get','/describe','/:id','show','create','put','update','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller'];(function(_0xa9d39f,_0x4d85cd){var _0x4e306f=function(_0x52b7bc){while(--_0x52b7bc){_0xa9d39f['push'](_0xa9d39f['shift']());}};_0x4e306f(++_0x4d85cd);}(_0xbb56,0x13b));var _0x6bb5=function(_0x291086,_0x5b7274){_0x291086=_0x291086-0x0;var _0xe42533=_0xbb56[_0x291086];return _0xe42533;};'use strict';var multer=require(_0x6bb5('0x0'));var util=require('util');var path=require(_0x6bb5('0x1'));var timeout=require(_0x6bb5('0x2'));var express=require(_0x6bb5('0x3'));var router=express[_0x6bb5('0x4')]();var fs_extra=require(_0x6bb5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6bb5('0x6'));var config=require(_0x6bb5('0x7'));var controller=require(_0x6bb5('0x8'));router['get']('/',auth[_0x6bb5('0x9')](),controller[_0x6bb5('0xa')]);router[_0x6bb5('0xb')](_0x6bb5('0xc'),auth[_0x6bb5('0x9')](),controller['describe']);router[_0x6bb5('0xb')](_0x6bb5('0xd'),auth['isAuthenticated'](),controller[_0x6bb5('0xe')]);router['post']('/',auth[_0x6bb5('0x9')](),controller[_0x6bb5('0xf')]);router[_0x6bb5('0x10')](_0x6bb5('0xd'),auth[_0x6bb5('0x9')](),controller[_0x6bb5('0x11')]);router['delete'](_0x6bb5('0xd'),auth['isAuthenticated'](),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 f4651b9..92e608e 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(_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 +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x4f8c17,_0x187a28){var _0x239088=function(_0x4de7a5){while(--_0x4de7a5){_0x4f8c17['push'](_0x4f8c17['shift']());}};_0x239088(++_0x187a28);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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 d0d364d..74b1f10 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 _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 +var _0x9348=['save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','WhatsappQueueReport','count','include','findAll','show','params','includeAll','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject'];(function(_0x1ee44b,_0x2a6fbe){var _0x152037=function(_0x55816a){while(--_0x55816a){_0x1ee44b['push'](_0x1ee44b['shift']());}};_0x152037(++_0x2a6fbe);}(_0x9348,0x10d));var _0x8934=function(_0x5dd386,_0x5b27a6){_0x5dd386=_0x5dd386-0x0;var _0xc31bfb=_0x9348[_0x5dd386];return _0xc31bfb;};'use strict';var emlformat=require(_0x8934('0x0'));var rimraf=require(_0x8934('0x1'));var zipdir=require(_0x8934('0x2'));var jsonpatch=require(_0x8934('0x3'));var rp=require(_0x8934('0x4'));var moment=require('moment');var BPromise=require(_0x8934('0x5'));var Mustache=require(_0x8934('0x6'));var util=require('util');var path=require(_0x8934('0x7'));var sox=require(_0x8934('0x8'));var csv=require(_0x8934('0x9'));var ejs=require(_0x8934('0xa'));var fs=require('fs');var fs_extra=require(_0x8934('0xb'));var _=require(_0x8934('0xc'));var squel=require('squel');var crypto=require(_0x8934('0xd'));var jsforce=require(_0x8934('0xe'));var deskjs=require(_0x8934('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8934('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8934('0x11'));var hardwareService=require(_0x8934('0x12'));var logger=require(_0x8934('0x13'))(_0x8934('0x14'));var utils=require(_0x8934('0x15'));var config=require(_0x8934('0x16'));var licenseUtil=require(_0x8934('0x17'));var db=require(_0x8934('0x18'))['db'];function respondWithStatusCode(_0x4a999c,_0x68427d){_0x68427d=_0x68427d||0xcc;return function(_0x108eab){if(_0x108eab){return _0x4a999c[_0x8934('0x19')](_0x68427d);}return _0x4a999c[_0x8934('0x1a')](_0x68427d)[_0x8934('0x1b')]();};}function respondWithResult(_0xdf59f4,_0x5b560f){_0x5b560f=_0x5b560f||0xc8;return function(_0x254720){if(_0x254720){return _0xdf59f4[_0x8934('0x1a')](_0x5b560f)[_0x8934('0x1c')](_0x254720);}};}function respondWithFilteredResult(_0x94b948,_0x34d4dc){return function(_0x41e6a9){if(_0x41e6a9){var _0x2a5b04=typeof _0x34d4dc[_0x8934('0x1d')]==='undefined'&&typeof _0x34d4dc[_0x8934('0x1e')]===_0x8934('0x1f');var _0x261c78=_0x41e6a9['count'];var _0x47f25e=_0x2a5b04?0x0:_0x34d4dc['offset'];var _0x2ff9ce=_0x2a5b04?_0x41e6a9['count']:_0x34d4dc[_0x8934('0x1d')]+_0x34d4dc[_0x8934('0x1e')];var _0x14b4e4;if(_0x2ff9ce>=_0x261c78){_0x2ff9ce=_0x261c78;_0x14b4e4=0xc8;}else{_0x14b4e4=0xce;}_0x94b948[_0x8934('0x1a')](_0x14b4e4);return _0x94b948[_0x8934('0x20')]('Content-Range',_0x47f25e+'-'+_0x2ff9ce+'/'+_0x261c78)[_0x8934('0x1c')](_0x41e6a9);}return null;};}function patchUpdates(_0x5ae49f){return function(_0x476c6c){try{jsonpatch[_0x8934('0x21')](_0x476c6c,_0x5ae49f,!![]);}catch(_0x1ccbe5){return BPromise[_0x8934('0x22')](_0x1ccbe5);}return _0x476c6c[_0x8934('0x23')]();};}function saveUpdates(_0x331e18,_0x36fe20){return function(_0x4f4a9b){if(_0x4f4a9b){return _0x4f4a9b[_0x8934('0x24')](_0x331e18)[_0x8934('0x25')](function(_0x32020a){return _0x32020a;});}return null;};}function removeEntity(_0x343e09,_0x43b89a){return function(_0x5e593b){if(_0x5e593b){return _0x5e593b[_0x8934('0x26')]()[_0x8934('0x25')](function(){_0x343e09[_0x8934('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16cfc2,_0x561df2){return function(_0x14c5f0){if(!_0x14c5f0){_0x16cfc2[_0x8934('0x19')](0x194);}return _0x14c5f0;};}function handleError(_0x110f7f,_0x5ef0ed){_0x5ef0ed=_0x5ef0ed||0x1f4;return function(_0x1fd5eb){logger[_0x8934('0x27')](_0x1fd5eb[_0x8934('0x28')]);if(_0x1fd5eb[_0x8934('0x29')]){delete _0x1fd5eb['name'];}_0x110f7f[_0x8934('0x1a')](_0x5ef0ed)[_0x8934('0x2a')](_0x1fd5eb);};}exports[_0x8934('0x2b')]=function(_0x3d93c7,_0x44972b){var _0x20d448={},_0x3f328a={},_0x457634={'count':0x0,'rows':[]};var _0x9c6a71=_[_0x8934('0x2c')](db['WhatsappQueueReport'][_0x8934('0x2d')],function(_0x3e973e){return{'name':_0x3e973e['fieldName'],'type':_0x3e973e[_0x8934('0x2e')][_0x8934('0x2f')]};});_0x3f328a[_0x8934('0x30')]=_[_0x8934('0x2c')](_0x9c6a71,'name');_0x3f328a[_0x8934('0x31')]=_[_0x8934('0x32')](_0x3d93c7[_0x8934('0x31')]);_0x3f328a[_0x8934('0x33')]=_[_0x8934('0x34')](_0x3f328a['model'],_0x3f328a[_0x8934('0x31')]);_0x20d448['attributes']=_['intersection'](_0x3f328a[_0x8934('0x30')],qs[_0x8934('0x35')](_0x3d93c7[_0x8934('0x31')][_0x8934('0x35')]));_0x20d448['attributes']=_0x20d448[_0x8934('0x36')][_0x8934('0x37')]?_0x20d448[_0x8934('0x36')]:_0x3f328a[_0x8934('0x30')];if(!_0x3d93c7[_0x8934('0x31')]['hasOwnProperty'](_0x8934('0x38'))){_0x20d448[_0x8934('0x1e')]=qs['limit'](_0x3d93c7['query'][_0x8934('0x1e')]);_0x20d448[_0x8934('0x1d')]=qs['offset'](_0x3d93c7['query'][_0x8934('0x1d')]);}_0x20d448[_0x8934('0x39')]=qs[_0x8934('0x3a')](_0x3d93c7[_0x8934('0x31')][_0x8934('0x3a')]);_0x20d448[_0x8934('0x3b')]=qs[_0x8934('0x33')](_[_0x8934('0x3c')](_0x3d93c7[_0x8934('0x31')],_0x3f328a[_0x8934('0x33')]),_0x9c6a71);if(_0x3d93c7[_0x8934('0x31')]['filter']){_0x20d448[_0x8934('0x3b')]=_[_0x8934('0x3d')](_0x20d448['where'],{'$or':_[_0x8934('0x2c')](_0x9c6a71,function(_0x122ad1){if(_0x122ad1[_0x8934('0x2e')]!==_0x8934('0x3e')){var _0xb189f1={};_0xb189f1[_0x122ad1['name']]={'$like':'%'+_0x3d93c7['query']['filter']+'%'};return _0xb189f1;}})});}_0x20d448=_[_0x8934('0x3d')]({},_0x20d448,_0x3d93c7[_0x8934('0x3f')]);var _0x8814f6={'where':_0x20d448['where']};return db[_0x8934('0x40')]['count'](_0x8814f6)['then'](function(_0x332098){_0x457634[_0x8934('0x41')]=_0x332098;if(_0x3d93c7['query']['includeAll']){_0x20d448[_0x8934('0x42')]=[{'all':!![]}];}return db[_0x8934('0x40')][_0x8934('0x43')](_0x20d448);})['then'](function(_0x46bfe7){_0x457634['rows']=_0x46bfe7;return _0x457634;})[_0x8934('0x25')](respondWithFilteredResult(_0x44972b,_0x20d448))['catch'](handleError(_0x44972b,null));};exports[_0x8934('0x44')]=function(_0x476ed9,_0x83be9e){var _0x566d67={'raw':!![],'where':{'id':_0x476ed9[_0x8934('0x45')]['id']}},_0xefdfab={};_0xefdfab[_0x8934('0x30')]=_[_0x8934('0x32')](db['WhatsappQueueReport'][_0x8934('0x2d')]);_0xefdfab[_0x8934('0x31')]=_[_0x8934('0x32')](_0x476ed9[_0x8934('0x31')]);_0xefdfab[_0x8934('0x33')]=_[_0x8934('0x34')](_0xefdfab[_0x8934('0x30')],_0xefdfab[_0x8934('0x31')]);_0x566d67['attributes']=_['intersection'](_0xefdfab['model'],qs[_0x8934('0x35')](_0x476ed9[_0x8934('0x31')]['fields']));_0x566d67[_0x8934('0x36')]=_0x566d67['attributes'][_0x8934('0x37')]?_0x566d67[_0x8934('0x36')]:_0xefdfab['model'];if(_0x476ed9[_0x8934('0x31')][_0x8934('0x46')]){_0x566d67[_0x8934('0x42')]=[{'all':!![]}];}_0x566d67=_[_0x8934('0x3d')]({},_0x566d67,_0x476ed9['options']);return db[_0x8934('0x40')][_0x8934('0x47')](_0x566d67)['then'](handleEntityNotFound(_0x83be9e,null))[_0x8934('0x25')](respondWithResult(_0x83be9e,null))[_0x8934('0x48')](handleError(_0x83be9e,null));};exports[_0x8934('0x49')]=function(_0x2d5c6a,_0x406d0a){return db[_0x8934('0x40')][_0x8934('0x49')](_0x2d5c6a[_0x8934('0x4a')],{})[_0x8934('0x25')](respondWithResult(_0x406d0a,0xc9))[_0x8934('0x48')](handleError(_0x406d0a,null));};exports[_0x8934('0x24')]=function(_0xe212bc,_0x2c322d){if(_0xe212bc[_0x8934('0x4a')]['id']){delete _0xe212bc[_0x8934('0x4a')]['id'];}return db[_0x8934('0x40')][_0x8934('0x47')]({'where':{'id':_0xe212bc[_0x8934('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c322d,null))[_0x8934('0x25')](saveUpdates(_0xe212bc[_0x8934('0x4a')],null))['then'](respondWithResult(_0x2c322d,null))['catch'](handleError(_0x2c322d,null));};exports['destroy']=function(_0x4bc431,_0x3610a0){return db[_0x8934('0x40')][_0x8934('0x47')]({'where':{'id':_0x4bc431['params']['id']}})['then'](handleEntityNotFound(_0x3610a0,null))[_0x8934('0x25')](removeEntity(_0x3610a0,null))['catch'](handleError(_0x3610a0,null));};exports['describe']=function(_0xce93cd,_0x2778f9){return db[_0x8934('0x40')][_0x8934('0x4b')]()[_0x8934('0x25')](respondWithResult(_0x2778f9,null))[_0x8934('0x48')](handleError(_0x2778f9,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 1f9b41d..25e685a 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 _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 +var _0x3821=['rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x51a303,_0xe0cc5e){var _0x24f28d=function(_0x5ee8c5){while(--_0x5ee8c5){_0x51a303['push'](_0x51a303['shift']());}};_0x24f28d(++_0xe0cc5e);}(_0x3821,0xac));var _0x1382=function(_0x183ae8,_0x14edea){_0x183ae8=_0x183ae8-0x0;var _0x560c13=_0x3821[_0x183ae8];return _0x560c13;};'use strict';var _=require(_0x1382('0x0'));var util=require(_0x1382('0x1'));var logger=require(_0x1382('0x2'))(_0x1382('0x3'));var moment=require(_0x1382('0x4'));var BPromise=require(_0x1382('0x5'));var rp=require(_0x1382('0x6'));var fs=require('fs');var path=require(_0x1382('0x7'));var rimraf=require(_0x1382('0x8'));var config=require(_0x1382('0x9'));var attributes=require(_0x1382('0xa'));module[_0x1382('0xb')]=function(_0x59cff6,_0x828205){return _0x59cff6[_0x1382('0xc')](_0x1382('0xd'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x1382('0xe'),'fields':[_0x1382('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 84ac01e..ffc06cb 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 _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 +var _0x2930=['client','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','WhatsappQueueReport','create','options','raw','CreateWhatsappQueueReport','debug','stringify','catch','UpdateWhatsappQueueReport','update','where','attributes','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0xe37c84,_0x4559e7){var _0x51674a=function(_0x1b6e94){while(--_0x1b6e94){_0xe37c84['push'](_0xe37c84['shift']());}};_0x51674a(++_0x4559e7);}(_0x2930,0x120));var _0x0293=function(_0x10f6b9,_0x1221b7){_0x10f6b9=_0x10f6b9-0x0;var _0x224308=_0x2930[_0x10f6b9];return _0x224308;};'use strict';var _=require(_0x0293('0x0'));var util=require(_0x0293('0x1'));var moment=require(_0x0293('0x2'));var BPromise=require(_0x0293('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0293('0x4'));var db=require(_0x0293('0x5'))['db'];var utils=require(_0x0293('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x0293('0x7'));var jayson=require(_0x0293('0x8'));var client=jayson[_0x0293('0x9')][_0x0293('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xeaf019,_0x2c44d3,_0x5d10db){return new BPromise(function(_0x32042d,_0x3ee84a){return client[_0x0293('0xb')](_0xeaf019,_0x5d10db)[_0x0293('0xc')](function(_0x54e719){logger['info'](_0x0293('0xd'),_0x2c44d3,_0x0293('0xe'));logger['debug'](_0x0293('0xf'),_0x2c44d3,_0x0293('0xe'),JSON['stringify'](_0x54e719));if(_0x54e719[_0x0293('0x10')]){if(_0x54e719[_0x0293('0x10')][_0x0293('0x11')]===0x1f4){logger[_0x0293('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2c44d3,_0x54e719[_0x0293('0x10')][_0x0293('0x12')]);return _0x3ee84a(_0x54e719[_0x0293('0x10')][_0x0293('0x12')]);}logger[_0x0293('0x10')](_0x0293('0xd'),_0x2c44d3,_0x54e719[_0x0293('0x10')][_0x0293('0x12')]);return _0x32042d(_0x54e719[_0x0293('0x10')][_0x0293('0x12')]);}else{logger[_0x0293('0x13')](_0x0293('0xd'),_0x2c44d3,'request\x20sent');_0x32042d(_0x54e719[_0x0293('0x14')][_0x0293('0x12')]);}})['catch'](function(_0x4f2314){logger[_0x0293('0x10')](_0x0293('0xd'),_0x2c44d3,_0x4f2314);_0x3ee84a(_0x4f2314);});});}exports['CreateWhatsappQueueReport']=function(_0x1d216c){var _0x31d8d=this;return new Promise(function(_0x5703cf,_0x2714bb){return db[_0x0293('0x15')][_0x0293('0x16')](_0x1d216c['body'],{'raw':_0x1d216c['options']?_0x1d216c[_0x0293('0x17')][_0x0293('0x18')]===undefined?!![]:![]:!![]})[_0x0293('0xc')](function(_0x4da532){logger[_0x0293('0x13')](_0x0293('0x19'),_0x1d216c);logger[_0x0293('0x1a')](_0x0293('0x19'),_0x1d216c,JSON[_0x0293('0x1b')](_0x4da532));_0x5703cf(_0x4da532);})[_0x0293('0x1c')](function(_0x5ac69f){logger[_0x0293('0x10')](_0x0293('0x19'),_0x5ac69f[_0x0293('0x12')],_0x1d216c);_0x2714bb(_0x31d8d[_0x0293('0x10')](0x1f4,_0x5ac69f[_0x0293('0x12')]));});});};exports[_0x0293('0x1d')]=function(_0x1414b5){var _0x4bbaae=this;return new Promise(function(_0x221d55,_0x501505){return db[_0x0293('0x15')][_0x0293('0x1e')](_0x1414b5['body'],{'raw':_0x1414b5[_0x0293('0x17')]?_0x1414b5['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1414b5[_0x0293('0x17')]?_0x1414b5[_0x0293('0x17')][_0x0293('0x1f')]||null:null,'attributes':_0x1414b5['options']?_0x1414b5['options'][_0x0293('0x20')]||null:null,'limit':_0x1414b5[_0x0293('0x17')]?_0x1414b5['options']['limit']||null:null})[_0x0293('0xc')](function(_0x402512){logger[_0x0293('0x13')](_0x0293('0x1d'),_0x1414b5);logger[_0x0293('0x1a')]('UpdateWhatsappQueueReport',_0x1414b5,JSON[_0x0293('0x1b')](_0x402512));_0x221d55(_0x402512);})[_0x0293('0x1c')](function(_0x4a3dee){logger[_0x0293('0x10')]('UpdateWhatsappQueueReport',_0x4a3dee['message'],_0x1414b5);_0x501505(_0x4bbaae[_0x0293('0x10')](0x1f4,_0x4a3dee[_0x0293('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 2aedfd7..8cfc182 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 _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 +var _0x74e3=['exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy'];(function(_0x3ae2a9,_0x2b7b4c){var _0x4de542=function(_0x55af20){while(--_0x55af20){_0x3ae2a9['push'](_0x3ae2a9['shift']());}};_0x4de542(++_0x2b7b4c);}(_0x74e3,0x79));var _0x374e=function(_0x465b0c,_0x569d90){_0x465b0c=_0x465b0c-0x0;var _0x502ff0=_0x74e3[_0x465b0c];return _0x502ff0;};'use strict';var multer=require(_0x374e('0x0'));var util=require(_0x374e('0x1'));var path=require(_0x374e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x374e('0x3')]();var fs_extra=require(_0x374e('0x4'));var auth=require(_0x374e('0x5'));var interaction=require(_0x374e('0x6'));var config=require(_0x374e('0x7'));var controller=require('./whatsappTransferReport.controller');router[_0x374e('0x8')]('/',auth[_0x374e('0x9')](),controller[_0x374e('0xa')]);router[_0x374e('0x8')](_0x374e('0xb'),auth[_0x374e('0x9')](),controller[_0x374e('0xc')]);router['get'](_0x374e('0xd'),auth['isAuthenticated'](),controller[_0x374e('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x374e('0xf')]);router[_0x374e('0x10')]('/:id',auth[_0x374e('0x9')](),controller['update']);router[_0x374e('0x11')]('/:id',auth[_0x374e('0x9')](),controller[_0x374e('0x12')]);module[_0x374e('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index e5f4588..5bbfb92 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 _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 +var _0x4cdf=['exports','STRING','ENUM','account','agent','DATE','sequelize'];(function(_0x1de127,_0x28afde){var _0x4641fc=function(_0x149765){while(--_0x149765){_0x1de127['push'](_0x1de127['shift']());}};_0x4641fc(++_0x28afde);}(_0x4cdf,0x180));var _0xf4cd=function(_0x510986,_0x1992ce){_0x510986=_0x510986-0x0;var _0x5e896f=_0x4cdf[_0x510986];return _0x5e896f;};'use strict';var Sequelize=require(_0xf4cd('0x0'));module[_0xf4cd('0x1')]={'uniqueid':{'type':Sequelize[_0xf4cd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf4cd('0x3')](_0xf4cd('0x4'),_0xf4cd('0x5'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xf4cd('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index c685228..76af05c 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 _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 +var _0xf24b=['stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','keys','query','intersection','attributes','model','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','update','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','reject','then','destroy','error'];(function(_0x178a41,_0x551fb9){var _0xf74971=function(_0xb4a0f3){while(--_0xb4a0f3){_0x178a41['push'](_0x178a41['shift']());}};_0xf74971(++_0x551fb9);}(_0xf24b,0xad));var _0xbf24=function(_0x2fa1c6,_0x4a5b8d){_0x2fa1c6=_0x2fa1c6-0x0;var _0x5f3257=_0xf24b[_0x2fa1c6];return _0x5f3257;};'use strict';var emlformat=require(_0xbf24('0x0'));var rimraf=require(_0xbf24('0x1'));var zipdir=require(_0xbf24('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbf24('0x3'));var moment=require('moment');var BPromise=require(_0xbf24('0x4'));var Mustache=require(_0xbf24('0x5'));var util=require('util');var path=require(_0xbf24('0x6'));var sox=require(_0xbf24('0x7'));var csv=require(_0xbf24('0x8'));var ejs=require(_0xbf24('0x9'));var fs=require('fs');var fs_extra=require(_0xbf24('0xa'));var _=require('lodash');var squel=require(_0xbf24('0xb'));var crypto=require(_0xbf24('0xc'));var jsforce=require(_0xbf24('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbf24('0xe'));var Papa=require(_0xbf24('0xf'));var Redis=require(_0xbf24('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbf24('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbf24('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xbf24('0x13'));var config=require(_0xbf24('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xbf24('0x15'))['db'];function respondWithStatusCode(_0x582416,_0x3d5e1a){_0x3d5e1a=_0x3d5e1a||0xcc;return function(_0x131e4e){if(_0x131e4e){return _0x582416[_0xbf24('0x16')](_0x3d5e1a);}return _0x582416[_0xbf24('0x17')](_0x3d5e1a)['end']();};}function respondWithResult(_0x427955,_0xe8167d){_0xe8167d=_0xe8167d||0xc8;return function(_0x48b88a){if(_0x48b88a){return _0x427955['status'](_0xe8167d)[_0xbf24('0x18')](_0x48b88a);}};}function respondWithFilteredResult(_0x3bbe79,_0x57a64f){return function(_0x1c47f2){if(_0x1c47f2){var _0xadde70=typeof _0x57a64f[_0xbf24('0x19')]==='undefined'&&typeof _0x57a64f[_0xbf24('0x1a')]==='undefined';var _0x49bea9=_0x1c47f2[_0xbf24('0x1b')];var _0x1897fe=_0xadde70?0x0:_0x57a64f[_0xbf24('0x19')];var _0x4907b9=_0xadde70?_0x1c47f2[_0xbf24('0x1b')]:_0x57a64f[_0xbf24('0x19')]+_0x57a64f[_0xbf24('0x1a')];var _0x3ffac2;if(_0x4907b9>=_0x49bea9){_0x4907b9=_0x49bea9;_0x3ffac2=0xc8;}else{_0x3ffac2=0xce;}_0x3bbe79['status'](_0x3ffac2);return _0x3bbe79[_0xbf24('0x1c')](_0xbf24('0x1d'),_0x1897fe+'-'+_0x4907b9+'/'+_0x49bea9)['json'](_0x1c47f2);}return null;};}function patchUpdates(_0x4c849a){return function(_0xb8d31d){try{jsonpatch['apply'](_0xb8d31d,_0x4c849a,!![]);}catch(_0x451bbd){return BPromise[_0xbf24('0x1e')](_0x451bbd);}return _0xb8d31d['save']();};}function saveUpdates(_0x28cf58,_0x147032){return function(_0x23622a){if(_0x23622a){return _0x23622a['update'](_0x28cf58)[_0xbf24('0x1f')](function(_0x28a6bb){return _0x28a6bb;});}return null;};}function removeEntity(_0x1c5020,_0x375291){return function(_0x292646){if(_0x292646){return _0x292646[_0xbf24('0x20')]()[_0xbf24('0x1f')](function(){_0x1c5020['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38d51c,_0x225ea6){return function(_0x47289a){if(!_0x47289a){_0x38d51c[_0xbf24('0x16')](0x194);}return _0x47289a;};}function handleError(_0x35669c,_0x25c0dc){_0x25c0dc=_0x25c0dc||0x1f4;return function(_0x400a95){logger[_0xbf24('0x21')](_0x400a95[_0xbf24('0x22')]);if(_0x400a95[_0xbf24('0x23')]){delete _0x400a95[_0xbf24('0x23')];}_0x35669c[_0xbf24('0x17')](_0x25c0dc)[_0xbf24('0x24')](_0x400a95);};}exports[_0xbf24('0x25')]=function(_0x235985,_0x195750){var _0x182661={},_0x11ec9b={},_0x32fc32={'count':0x0,'rows':[]};var _0x53c150=_[_0xbf24('0x26')](db[_0xbf24('0x27')][_0xbf24('0x28')],function(_0x58eafa){return{'name':_0x58eafa[_0xbf24('0x29')],'type':_0x58eafa[_0xbf24('0x2a')]['key']};});_0x11ec9b['model']=_[_0xbf24('0x26')](_0x53c150,_0xbf24('0x23'));_0x11ec9b['query']=_[_0xbf24('0x2b')](_0x235985[_0xbf24('0x2c')]);_0x11ec9b['filters']=_[_0xbf24('0x2d')](_0x11ec9b['model'],_0x11ec9b['query']);_0x182661[_0xbf24('0x2e')]=_[_0xbf24('0x2d')](_0x11ec9b[_0xbf24('0x2f')],qs[_0xbf24('0x30')](_0x235985[_0xbf24('0x2c')][_0xbf24('0x30')]));_0x182661['attributes']=_0x182661[_0xbf24('0x2e')][_0xbf24('0x31')]?_0x182661[_0xbf24('0x2e')]:_0x11ec9b[_0xbf24('0x2f')];if(!_0x235985[_0xbf24('0x2c')]['hasOwnProperty'](_0xbf24('0x32'))){_0x182661[_0xbf24('0x1a')]=qs[_0xbf24('0x1a')](_0x235985[_0xbf24('0x2c')][_0xbf24('0x1a')]);_0x182661[_0xbf24('0x19')]=qs['offset'](_0x235985[_0xbf24('0x2c')]['offset']);}_0x182661['order']=qs[_0xbf24('0x33')](_0x235985[_0xbf24('0x2c')][_0xbf24('0x33')]);_0x182661[_0xbf24('0x34')]=qs[_0xbf24('0x35')](_[_0xbf24('0x36')](_0x235985[_0xbf24('0x2c')],_0x11ec9b['filters']),_0x53c150);if(_0x235985[_0xbf24('0x2c')][_0xbf24('0x37')]){_0x182661[_0xbf24('0x34')]=_[_0xbf24('0x38')](_0x182661['where'],{'$or':_[_0xbf24('0x26')](_0x53c150,function(_0x2f4833){if(_0x2f4833[_0xbf24('0x2a')]!==_0xbf24('0x39')){var _0x3a8b57={};_0x3a8b57[_0x2f4833[_0xbf24('0x23')]]={'$like':'%'+_0x235985[_0xbf24('0x2c')][_0xbf24('0x37')]+'%'};return _0x3a8b57;}})});}_0x182661=_[_0xbf24('0x38')]({},_0x182661,_0x235985[_0xbf24('0x3a')]);var _0x24d5e9={'where':_0x182661[_0xbf24('0x34')]};return db[_0xbf24('0x27')]['count'](_0x24d5e9)[_0xbf24('0x1f')](function(_0xaf80c8){_0x32fc32[_0xbf24('0x1b')]=_0xaf80c8;if(_0x235985[_0xbf24('0x2c')][_0xbf24('0x3b')]){_0x182661['include']=[{'all':!![]}];}return db[_0xbf24('0x27')][_0xbf24('0x3c')](_0x182661);})[_0xbf24('0x1f')](function(_0x154b6c){_0x32fc32['rows']=_0x154b6c;return _0x32fc32;})[_0xbf24('0x1f')](respondWithFilteredResult(_0x195750,_0x182661))[_0xbf24('0x3d')](handleError(_0x195750,null));};exports[_0xbf24('0x3e')]=function(_0x341bce,_0x19ebae){var _0x1cfdd0={'raw':!![],'where':{'id':_0x341bce[_0xbf24('0x3f')]['id']}},_0x5d0fc0={};_0x5d0fc0[_0xbf24('0x2f')]=_[_0xbf24('0x2b')](db[_0xbf24('0x27')]['rawAttributes']);_0x5d0fc0[_0xbf24('0x2c')]=_[_0xbf24('0x2b')](_0x341bce[_0xbf24('0x2c')]);_0x5d0fc0['filters']=_[_0xbf24('0x2d')](_0x5d0fc0[_0xbf24('0x2f')],_0x5d0fc0[_0xbf24('0x2c')]);_0x1cfdd0[_0xbf24('0x2e')]=_[_0xbf24('0x2d')](_0x5d0fc0[_0xbf24('0x2f')],qs[_0xbf24('0x30')](_0x341bce[_0xbf24('0x2c')][_0xbf24('0x30')]));_0x1cfdd0[_0xbf24('0x2e')]=_0x1cfdd0[_0xbf24('0x2e')][_0xbf24('0x31')]?_0x1cfdd0[_0xbf24('0x2e')]:_0x5d0fc0[_0xbf24('0x2f')];if(_0x341bce['query']['includeAll']){_0x1cfdd0[_0xbf24('0x40')]=[{'all':!![]}];}_0x1cfdd0=_[_0xbf24('0x38')]({},_0x1cfdd0,_0x341bce[_0xbf24('0x3a')]);return db[_0xbf24('0x27')][_0xbf24('0x41')](_0x1cfdd0)[_0xbf24('0x1f')](handleEntityNotFound(_0x19ebae,null))[_0xbf24('0x1f')](respondWithResult(_0x19ebae,null))['catch'](handleError(_0x19ebae,null));};exports['create']=function(_0x73c63e,_0x4a0670){return db[_0xbf24('0x27')]['create'](_0x73c63e['body'],{})[_0xbf24('0x1f')](respondWithResult(_0x4a0670,0xc9))['catch'](handleError(_0x4a0670,null));};exports[_0xbf24('0x42')]=function(_0x2796c2,_0x5aed65){if(_0x2796c2[_0xbf24('0x43')]['id']){delete _0x2796c2[_0xbf24('0x43')]['id'];}return db[_0xbf24('0x27')][_0xbf24('0x41')]({'where':{'id':_0x2796c2[_0xbf24('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5aed65,null))[_0xbf24('0x1f')](saveUpdates(_0x2796c2[_0xbf24('0x43')],null))[_0xbf24('0x1f')](respondWithResult(_0x5aed65,null))[_0xbf24('0x3d')](handleError(_0x5aed65,null));};exports[_0xbf24('0x20')]=function(_0x367c4e,_0x55d6f8){return db[_0xbf24('0x27')][_0xbf24('0x41')]({'where':{'id':_0x367c4e[_0xbf24('0x3f')]['id']}})[_0xbf24('0x1f')](handleEntityNotFound(_0x55d6f8,null))[_0xbf24('0x1f')](removeEntity(_0x55d6f8,null))['catch'](handleError(_0x55d6f8,null));};exports[_0xbf24('0x44')]=function(_0x50aae7,_0x2b6bb6){return db[_0xbf24('0x27')][_0xbf24('0x44')]()[_0xbf24('0x1f')](respondWithResult(_0x2b6bb6,null))['catch'](handleError(_0x2b6bb6,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 57aeea3..56a7a57 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 _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 +var _0x9b54=['define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x46b63f,_0x6a3b94){var _0x2fbced=function(_0x528094){while(--_0x528094){_0x46b63f['push'](_0x46b63f['shift']());}};_0x2fbced(++_0x6a3b94);}(_0x9b54,0x11c));var _0x49b5=function(_0x2c0aaa,_0x6e6d95){_0x2c0aaa=_0x2c0aaa-0x0;var _0x5b6b77=_0x9b54[_0x2c0aaa];return _0x5b6b77;};'use strict';var _=require(_0x49b5('0x0'));var util=require(_0x49b5('0x1'));var logger=require(_0x49b5('0x2'))(_0x49b5('0x3'));var moment=require(_0x49b5('0x4'));var BPromise=require(_0x49b5('0x5'));var rp=require(_0x49b5('0x6'));var fs=require('fs');var path=require(_0x49b5('0x7'));var rimraf=require(_0x49b5('0x8'));var config=require(_0x49b5('0x9'));var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0x3eec28,_0x34b4fb){return _0x3eec28[_0x49b5('0xa')](_0x49b5('0xb'),attributes,{'tableName':_0x49b5('0xc'),'paranoid':![],'indexes':[{'name':_0x49b5('0xd'),'fields':[_0x49b5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 4c0234f..ae7d255 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 _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 +var _0x20f4=['request\x20sent','code','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x4b79ce,_0x362343){var _0x13ac3e=function(_0x380569){while(--_0x380569){_0x4b79ce['push'](_0x4b79ce['shift']());}};_0x13ac3e(++_0x362343);}(_0x20f4,0x11a));var _0x420f=function(_0x164fdd,_0x571315){_0x164fdd=_0x164fdd-0x0;var _0x3735ea=_0x20f4[_0x164fdd];return _0x3735ea;};'use strict';var _=require(_0x420f('0x0'));var util=require('util');var moment=require(_0x420f('0x1'));var BPromise=require(_0x420f('0x2'));var rs=require(_0x420f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x420f('0x4'))['db'];var utils=require(_0x420f('0x5'));var logger=require(_0x420f('0x6'))(_0x420f('0x7'));var config=require(_0x420f('0x8'));var jayson=require(_0x420f('0x9'));var client=jayson['client'][_0x420f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ba935,_0x147437,_0x1b098e){return new BPromise(function(_0x16fd9a,_0x29f850){return client[_0x420f('0xb')](_0x5ba935,_0x1b098e)[_0x420f('0xc')](function(_0x28a5a2){logger[_0x420f('0xd')](_0x420f('0xe'),_0x147437,'request\x20sent');logger[_0x420f('0xf')](_0x420f('0x10'),_0x147437,_0x420f('0x11'),JSON['stringify'](_0x28a5a2));if(_0x28a5a2['error']){if(_0x28a5a2['error'][_0x420f('0x12')]===0x1f4){logger[_0x420f('0x13')](_0x420f('0xe'),_0x147437,_0x28a5a2[_0x420f('0x13')]['message']);return _0x29f850(_0x28a5a2[_0x420f('0x13')]['message']);}logger[_0x420f('0x13')](_0x420f('0xe'),_0x147437,_0x28a5a2[_0x420f('0x13')]['message']);return _0x16fd9a(_0x28a5a2[_0x420f('0x13')][_0x420f('0x14')]);}else{logger['info'](_0x420f('0xe'),_0x147437,_0x420f('0x11'));_0x16fd9a(_0x28a5a2[_0x420f('0x15')][_0x420f('0x14')]);}})[_0x420f('0x16')](function(_0x4b9333){logger[_0x420f('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0x147437,_0x4b9333);_0x29f850(_0x4b9333);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index c8851ad..b5056ab 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x0bde=['length','\x20processes\x20failed\x20at\x20startup:\x20','map','name','Online\x20apps:','online','join','Offline\x20apps:','status','None','App\x20Ready!','log','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','then','seedDB','default','listen','start','info','filter','exitCode'];(function(_0xed7322,_0x22ca67){var _0x5ac672=function(_0x52850f){while(--_0x52850f){_0xed7322['push'](_0xed7322['shift']());}};_0x5ac672(++_0x22ca67);}(_0x0bde,0xe7));var _0xe0bd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0bde[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var db=require(_0xe0bd('0x0'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0xe0bd('0x1'));var rpc=require(_0xe0bd('0x2'));var config=require(_0xe0bd('0x3'));var logger=require(_0xe0bd('0x4'))(_0xe0bd('0x5'));var pm2=require('./config/pm2');var pm2Config=require(_0xe0bd('0x6'));var schedule=require(_0xe0bd('0x7'));var chat=require(_0xe0bd('0x8'));var whatsapp=require(_0xe0bd('0x9'));var transcribe=require(_0xe0bd('0xa'));var provider=require(_0xe0bd('0xb'));function main(){return db[_0xe0bd('0xc')]['sync']()[_0xe0bd('0xd')](function(){if(config[_0xe0bd('0xe')]){return seedDb[_0xe0bd('0xf')]();}})[_0xe0bd('0xd')](function(){return checkLicense[_0xe0bd('0xf')]();})[_0xe0bd('0xd')](function(){return rpc[_0xe0bd('0x10')]();})[_0xe0bd('0xd')](function(_0x561b74){logger['info'](_0x561b74);return chat['start']();})[_0xe0bd('0xd')](function(){return whatsapp['start']();})['then'](function(){return schedule[_0xe0bd('0x11')]();})[_0xe0bd('0xd')](function(){return transcribe['start']();})[_0xe0bd('0xd')](function(){return provider['start']();})[_0xe0bd('0xd')](function(_0x436535){logger[_0xe0bd('0x12')](_0x436535);return pm2[_0xe0bd('0x11')](pm2Config);})[_0xe0bd('0xd')](function(_0x335f17){var _0x342a68=_0x335f17[_0xe0bd('0x13')](function(_0x4f63fa){return typeof _0x4f63fa['exitCode']==='number'&&_0x4f63fa[_0xe0bd('0x14')]>=0x0;});if(_0x342a68[_0xe0bd('0x15')]>0x0){throw new Error(_0x342a68[_0xe0bd('0x15')]+_0xe0bd('0x16')+_[_0xe0bd('0x17')](_0x342a68,function(_0x55f304){return'\x22'+_0x55f304['pm2_env'][_0xe0bd('0x18')]+'\x22';}));}logger['info'](_0xe0bd('0x19'),_[_0xe0bd('0x17')](_[_0xe0bd('0x13')](_0x335f17,{'status':_0xe0bd('0x1a')}),'name')[_0xe0bd('0x1b')]());logger[_0xe0bd('0x12')](_0xe0bd('0x1c'),_['map'](_[_0xe0bd('0x13')](_0x335f17,function(_0x25f595){return _0x25f595[_0xe0bd('0x1d')]!=='online';}),_0xe0bd('0x18'))[_0xe0bd('0x1b')]()||_0xe0bd('0x1e'));console['log'](_0xe0bd('0x1f'));})['catch'](function(_0x12e236){console[_0xe0bd('0x20')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x12e236);logger[_0xe0bd('0x21')](_0xe0bd('0x22'),_0x12e236);process[_0xe0bd('0x23')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 4ef206b..9be6f2c 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 _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 +var _0xdd4f=['allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockedAt','minutes','User\x20object\x20not\x20found.','getLicense','Forbidden','webrtc','isMiddleware','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','Sequelize','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','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','ValidationError','split','length','splice','unshift','encryptString','promisify','sign','secret','payload','options','verify','toString','hex','floor','now','HS512','../../mysqldb','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','secrets','session','fullname','internal','email','userpic','md5secret','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','findOne','params','disposition','then','closed','status','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','User','find','authenticate','pass','Wrong\x20credentials.','user','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x27d636,_0x23e82d){_0x27d636=_0x27d636-0x0;var _0x4dbf9e=_0xdd4f[_0x27d636];return _0x4dbf9e;};'use strict';var db=require(_0xfdd4('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require(_0xfdd4('0x1'));var _=require(_0xfdd4('0x2'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xfdd4('0x3'));var compose=require(_0xfdd4('0x4'));var basicAuth=require(_0xfdd4('0x5'));var crypto=require('crypto');var BPromise=require(_0xfdd4('0x6'));var util=require(_0xfdd4('0x7'));var moment=require(_0xfdd4('0x8'));var validateJwt=expressJwt({'secret':config[_0xfdd4('0x9')][_0xfdd4('0xa')]});var userAttributes=['id','role',_0xfdd4('0xb'),'name',_0xfdd4('0xc'),_0xfdd4('0xd'),_0xfdd4('0xe'),'permissions',_0xfdd4('0xf'),'voicePause',_0xfdd4('0x10'),_0xfdd4('0x11'),_0xfdd4('0x12'),_0xfdd4('0x13'),_0xfdd4('0x14'),_0xfdd4('0x15'),_0xfdd4('0x16'),_0xfdd4('0x17'),_0xfdd4('0x18'),_0xfdd4('0x19'),_0xfdd4('0x1a'),'passwordResetAt',_0xfdd4('0x1b'),_0xfdd4('0x1c'),_0xfdd4('0x1d'),'phoneBarDnd',_0xfdd4('0x1e'),'phoneBarEnableDtmfTone',_0xfdd4('0x1f'),_0xfdd4('0x20'),_0xfdd4('0x21'),_0xfdd4('0x22'),_0xfdd4('0x23'),'hotdesk','interface','userProfileId',_0xfdd4('0x24'),_0xfdd4('0x25'),_0xfdd4('0x26'),_0xfdd4('0x27'),_0xfdd4('0x28'),_0xfdd4('0x29'),_0xfdd4('0x2a'),_0xfdd4('0x2b'),_0xfdd4('0x2c'),'chatAutoanswerDelay',_0xfdd4('0x2d'),_0xfdd4('0x2e'),_0xfdd4('0x2f'),_0xfdd4('0x30'),_0xfdd4('0x31'),_0xfdd4('0x32'),_0xfdd4('0x33'),_0xfdd4('0x34'),'whatsappAutoanswer',_0xfdd4('0x35'),_0xfdd4('0x36')];exports[_0xfdd4('0x37')]=function(){return this[_0xfdd4('0x38')](!![])[_0xfdd4('0x39')](function(_0x144acd,_0x451767,_0x277ec1){if(_0x144acd['user']){_0x277ec1();}else{return db[_0xfdd4('0x3a')][_0xfdd4('0x3b')]({'where':{'id':_0x144acd[_0xfdd4('0x3c')]['id']},'attributes':['id','closed',_0xfdd4('0x3d')],'raw':!![]})[_0xfdd4('0x3e')](function(_0xf9c346){if(_0xf9c346&&_0xf9c346[_0xfdd4('0x3f')]){return _0x451767[_0xfdd4('0x40')](_0xf9c346['disposition']===_0xfdd4('0x41')?0x195:0x193)[_0xfdd4('0x42')]({'message':_0xf9c346[_0xfdd4('0x3d')]===_0xfdd4('0x41')?_0xfdd4('0x43'):_0xfdd4('0x44')});}else{_0x277ec1();}})[_0xfdd4('0x45')](function(_0x37b7a2){_0x277ec1(_0x37b7a2);});}});};exports['isAuthenticated']=function isAuthenticated(_0xcbd1fb){return compose()[_0xfdd4('0x39')](function(_0x385a68,_0xef012e,_0x2207ae){var _0x4a36a2;if(_0x385a68[_0xfdd4('0x46')][_0xfdd4('0x47')]){if(_[_0xfdd4('0x48')](_0x385a68[_0xfdd4('0x46')][_0xfdd4('0x47')],'Basic')){var _0x374e98=basicAuth(_0x385a68);db[_0xfdd4('0x49')][_0xfdd4('0x4a')]({'where':{'name':_0x374e98['name']}})[_0xfdd4('0x3e')](function(_0x502776){if(!_0x502776||!_0x502776[_0xfdd4('0x4b')](_0x374e98[_0xfdd4('0x4c')])){return _0xef012e['status'](0x191)['json']({'message':_0xfdd4('0x4d')});}_0x385a68[_0xfdd4('0x4e')]={'id':_0x502776['id']};_0x2207ae();})['catch'](function(_0x557d7b){_0x2207ae(_0x557d7b);});}else if(_[_0xfdd4('0x48')](_0x385a68[_0xfdd4('0x46')][_0xfdd4('0x47')],_0xfdd4('0x4f'))){validateJwt(_0x385a68,_0xef012e,_0x2207ae);}else{if(_0xcbd1fb){_0x2207ae();}else{return _0xef012e[_0xfdd4('0x40')](0x193)[_0xfdd4('0x42')]({'message':_0xfdd4('0x50')});}}}else if(_0x385a68[_0xfdd4('0x51')][_0xfdd4('0x52')]){try{var _0x457ab5={'audience':hardwareConf[_0xfdd4('0x53')](),'issuer':hardwareConf[_0xfdd4('0x53')]()};verifyJwt(_0x385a68[_0xfdd4('0x51')][_0xfdd4('0x52')],_0x457ab5)[_0xfdd4('0x3e')](function(_0x3f5c5a){return db[_0xfdd4('0x49')][_0xfdd4('0x4a')]({'where':{'id':_0x3f5c5a[_0xfdd4('0x54')]}})[_0xfdd4('0x3e')](function(_0xc9549b){_0x4a36a2=_0xc9549b;return db[_0xfdd4('0x55')][_0xfdd4('0x3b')]({'where':{'id':0x1},'attributes':[_0xfdd4('0x56'),_0xfdd4('0x57')],'raw':!![]});})[_0xfdd4('0x3e')](function(_0x5348a6){if(!_0x4a36a2||!_[_0xfdd4('0x58')](_0x4a36a2[_0xfdd4('0x59')],_0x3f5c5a[_0xfdd4('0x5a')])){return _0xef012e[_0xfdd4('0x40')](0x191)[_0xfdd4('0x42')]({'message':_0xfdd4('0x5b')});}if(_0x4a36a2['disabled']){return _0xef012e[_0xfdd4('0x40')](0x191)['json']({'message':_0xfdd4('0x5c')});}if(_0x4a36a2[_0xfdd4('0x5d')]){if(_0x5348a6[_0xfdd4('0x57')]>0x0){if(moment(_0x4a36a2[_0xfdd4('0x5e')])['add'](_0x5348a6[_0xfdd4('0x57')],_0xfdd4('0x5f'))>moment()){return _0xef012e[_0xfdd4('0x40')](0x191)[_0xfdd4('0x42')]({'message':_0xfdd4('0x5c')});}}else{return _0xef012e[_0xfdd4('0x40')](0x191)[_0xfdd4('0x42')]({'message':_0xfdd4('0x5c')});}}_0x385a68[_0xfdd4('0x4e')]={'id':_0x4a36a2['id']};_0x2207ae();});})[_0xfdd4('0x45')](function(){return _0xef012e['status'](0x191)[_0xfdd4('0x42')]({'message':_0xfdd4('0x5c')});});}catch(_0x210a15){_0x2207ae(_0x210a15);}}else if(_0xcbd1fb){_0x2207ae();}else{return _0xef012e[_0xfdd4('0x40')](0x193)['json']({'message':_0xfdd4('0x50')});}})[_0xfdd4('0x39')](function(_0x30524f,_0x2341e5,_0x362c4f){if(_0x30524f['user']){db[_0xfdd4('0x49')][_0xfdd4('0x4a')]({'where':{'id':_0x30524f[_0xfdd4('0x4e')]['id']},'attributes':userAttributes})[_0xfdd4('0x3e')](function(_0x912520){if(!_0x912520){return _0x2341e5[_0xfdd4('0x40')](0x194)[_0xfdd4('0x42')]({'message':'User\x20not\x20found.'});}_0x30524f[_0xfdd4('0x4e')]=_0x912520;_0x362c4f();})['catch'](function(_0x3a0de9){_0x362c4f(_0x3a0de9);});}else if(_0xcbd1fb){_0x362c4f();}else{return _0x2341e5[_0xfdd4('0x40')](0x194)[_0xfdd4('0x42')]({'message':_0xfdd4('0x60')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xfdd4('0x39')](function(_0x11e90a,_0x4d1dfe,_0x2916ea){return licenseUtil[_0xfdd4('0x61')]()['then'](function(_0x218ca5){if(_0x218ca5['update']){_0x2916ea();}else{return _0x4d1dfe['status'](0x193)['json']({'message':_0xfdd4('0x62')});}})[_0xfdd4('0x45')](function(_0xc3933e){_0x2916ea(_0xc3933e);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0xfdd4('0x39')](function(_0x169d72,_0x4d11d1,_0x25e3c9){return licenseUtil[_0xfdd4('0x61')]()[_0xfdd4('0x3e')](function(_0x2bb94a){if(_0x2bb94a[_0xfdd4('0x63')]){_0x25e3c9();}else{return _0x4d11d1[_0xfdd4('0x40')](0x193)[_0xfdd4('0x42')]({'message':_0xfdd4('0x62')});}})[_0xfdd4('0x45')](function(_0xe82eff){_0x25e3c9(_0xe82eff);});});};exports[_0xfdd4('0x64')]=function(_0x2aab84,_0x300965,_0x3c0ee1){_0x2aab84['isMiddleware']=!![];return _0x3c0ee1();};exports['signToken']=function signToken(_0x43e631){return signJwt(_0x43e631);};exports[_0xfdd4('0x65')]=function(_0x1296e6,_0x1932ef){if(!_0x1296e6['user']){return _0x1932ef[_0xfdd4('0x40')](0x194)[_0xfdd4('0x42')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x58cdab={'payload':{'id':_0x1296e6['user']['id'],'role':_0x1296e6['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x58cdab)[_0xfdd4('0x3e')](function(_0x88e9ef){_0x1932ef[_0xfdd4('0x66')](_0xfdd4('0x67'),_0x88e9ef);_0x1932ef[_0xfdd4('0x68')](_0xfdd4('0x69'));})['catch'](function(_0x17bbab){return _0x1932ef[_0xfdd4('0x40')](0x1f4)[_0xfdd4('0x6a')](_0x17bbab);});};exports[_0xfdd4('0x6b')]=function(_0x4e790d){if(_[_0xfdd4('0x6c')](_0x4e790d[_0xfdd4('0x59')])||_['isNil'](_0x4e790d[_0xfdd4('0x6d')])){return null;}else{return createJwt(_0x4e790d);}};exports[_0xfdd4('0x6e')]=function(_0x555e50){_0x555e50['apiKeyNonce']=generateNonce();_0x555e50[_0xfdd4('0x6d')]=generateIssuedAt();return createJwt(_0x555e50);};exports[_0xfdd4('0x6f')]=function(_0x18f071,_0x30ce95){var _0xce9f02=_0x18f071[_0xfdd4('0x51')][_0xfdd4('0x52')];if(_0xce9f02){var _0x3de4fd={'nonce':_0x30ce95['apiKeyNonce'],'iat':_0x30ce95[_0xfdd4('0x6d')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0xce9f02,_0x3de4fd)[_0xfdd4('0x3e')](function(){return generateApiKey(_0x30ce95);});}else{throw{'message':_0xfdd4('0x70')};}};exports['validatePasswordPattern']=function(_0x4f2160){var _0x4df9d4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x4df9d4[_0xfdd4('0x71')](_0x4f2160))throw new db[(_0xfdd4('0x72'))]['ValidationError'](_0xfdd4('0x73'));return;};exports[_0xfdd4('0x74')]=function(_0x466b75,_0xe6c601,_0x24d995){var _0x52887d=encryptor['decryptString'](_0xe6c601)['split'](',');for(var _0x5d0136=0x0;_0x5d0136<_0x24d995;_0x5d0136++){if(!_0x52887d[_0x5d0136])break;if(_0x466b75[_0xfdd4('0x75')]()===_0x52887d[_0x5d0136][_0xfdd4('0x75')]()){var _0x5ddc25=util[_0xfdd4('0x76')](_0xfdd4('0x77'),_0x24d995);if(_0x24d995===0x1){_0x5ddc25='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xfdd4('0x72'))][(_0xfdd4('0x78'))](_0x5ddc25);}}return;};exports['updatePasswordsHistory']=function(_0x1497ff,_0x2b7081){var _0xd4e5e4=_0x2b7081?encryptor['decryptString'](_0x2b7081)[_0xfdd4('0x79')](','):[];if(_0xd4e5e4[_0xfdd4('0x7a')]===0x5){_0xd4e5e4[_0xfdd4('0x7b')](-0x1,0x1);}_0xd4e5e4[_0xfdd4('0x7c')](_0x1497ff);return encryptor[_0xfdd4('0x7d')](_0xd4e5e4['join'](','));};function signJwt(_0x2cc3e2){var _0x2ee4b6=BPromise[_0xfdd4('0x7e')](jwt[_0xfdd4('0x7f')],{'context':jwt});var _0x3dd05c=_0x2cc3e2[_0xfdd4('0x80')]||config[_0xfdd4('0x9')][_0xfdd4('0xa')];return new BPromise(function(_0x38b58b,_0x5e0a1c){_0x2ee4b6(_0x2cc3e2[_0xfdd4('0x81')],_0x3dd05c,_0x2cc3e2[_0xfdd4('0x82')])[_0xfdd4('0x3e')](function(_0x2ad8e8){_0x38b58b(_0x2ad8e8);})[_0xfdd4('0x45')](function(_0x593f5c){_0x5e0a1c(_0x593f5c);});});}function verifyJwt(_0x46e7eb,_0x3b809a,_0x255175){var _0x12e917=BPromise[_0xfdd4('0x7e')](jwt[_0xfdd4('0x83')],{'context':jwt});var _0x180ad9=_0x255175||config[_0xfdd4('0x9')][_0xfdd4('0xa')];return new BPromise(function(_0x2a0dd8,_0x2fff30){_0x12e917(_0x46e7eb,_0x180ad9,_0x3b809a)[_0xfdd4('0x3e')](function(_0x1205b8){_0x2a0dd8(_0x1205b8);})['catch'](function(_0xb9d86a){_0x2fff30(_0xb9d86a);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xfdd4('0x84')](_0xfdd4('0x85'));}function generateIssuedAt(){return Math[_0xfdd4('0x86')](Date[_0xfdd4('0x87')]()/0x3e8)[_0xfdd4('0x84')]();}function createJwt(_0x3a89a4){var _0xea89a1={'payload':{'iat':_0x3a89a4[_0xfdd4('0x6d')],'nonce':_0x3a89a4[_0xfdd4('0x59')]},'options':{'algorithm':_0xfdd4('0x88'),'subject':_0x3a89a4['id'][_0xfdd4('0x84')](),'issuer':hardwareConf[_0xfdd4('0x53')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0xea89a1)['then'](function(_0x55a566){return{'iat':_0x3a89a4[_0xfdd4('0x6d')],'nonce':_0x3a89a4[_0xfdd4('0x59')],'token':_0x55a566};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 158930a..85a55e9 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 _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 +var _0x4d95=['parseQueryParameters','where','default','fields','filter','clause','checkListsRestrictions','tag','count','User','buildContactsQuery','catch','describe','CmContact','keys','startsWith','cf_','CmCustomField','findOne','all','length','fieldType','type','map','lodash','./sql-utils','../../mysqldb','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x4d95,0x183));var _0x54d9=function(_0x51cd13,_0x498761){_0x51cd13=_0x51cd13-0x0;var _0x282dc7=_0x4d95[_0x51cd13];return _0x282dc7;};'use strict';var _=require(_0x54d9('0x0'));var sqlUtils=require(_0x54d9('0x1'));var db=require(_0x54d9('0x2'))['db'];exports['findAll']=function(_0x2c6a8c,_0x5d41fb,_0x5b17c7,_0x20e355){var _0x2bd74a={'count':0x0,'rows':[]};var _0x5e8a96=sqlUtils[_0x54d9('0x3')](_0x5d41fb,_0x2c6a8c);if(_0x5e8a96){return Promise[_0x54d9('0x4')](_0x2bd74a);}var _0x2706e7=sqlUtils[_0x54d9('0x5')]();var _0x2529be={};var _0x1dd9de=![];var _0x2afafe=![];return Promise['resolve']()[_0x54d9('0x6')](function(){if(_0x2c6a8c[_0x54d9('0x7')]){return sqlUtils[_0x54d9('0x8')](_0x2c6a8c[_0x54d9('0x7')],_0x20e355);}else{return sqlUtils[_0x54d9('0x9')](_0x2c6a8c,_0x20e355);}})['then'](function(_0x1fa5f8){_0x2706e7[_0x54d9('0xa')](_0x1fa5f8[_0x54d9('0xb')]);_0x2706e7[_0x54d9('0xa')](_0x1fa5f8[_0x54d9('0xc')]);_0x2706e7[_0x54d9('0xa')](_0x1fa5f8[_0x54d9('0xd')]);_0x2706e7[_0x54d9('0xa')](_0x1fa5f8['user'][_0x54d9('0xe')]);_0x2529be=_0x1fa5f8['tags'];_0x2afafe=_0x1fa5f8['user']['skip'];return sqlUtils[_0x54d9('0xf')](_0x5d41fb,_0x2c6a8c,_0x2afafe);})[_0x54d9('0x6')](function(_0x48871d){_0x2706e7[_0x54d9('0xa')](_0x48871d);var _0x5a955b=_0x2c6a8c['search']?_0x2529be['ids']:_0x2c6a8c[_0x54d9('0x10')];_0x1dd9de=_0x5a955b?!![]:![];return sqlUtils['countFilteredContacts'](_0x2706e7,_0x5a955b);})['then'](function(_0x341db1){_0x2bd74a[_0x54d9('0x11')]=_0x341db1;if(_0x2bd74a[_0x54d9('0x11')]===0x0){return;}if(_0x2c6a8c[_0x54d9('0x12')]){_0x2afafe=!![];}return sqlUtils[_0x54d9('0x13')](_0x2706e7,_0x2c6a8c[_0x54d9('0xc')],_0x5b17c7,_0x1dd9de,_0x2529be[_0x54d9('0xe')],_0x2afafe);})[_0x54d9('0x6')](function(_0x1c1c2f){if(!_0x1c1c2f){return[];}return sqlUtils['getFilteredContacts'](_0x1c1c2f,_0x2c6a8c,_0x5b17c7);})[_0x54d9('0x6')](function(_0xbf1a9e){_0x2bd74a['rows']=_0xbf1a9e;return _0x2bd74a;})[_0x54d9('0x14')](function(_0x35df84){throw _0x35df84;});};exports[_0x54d9('0x15')]=function(){var _0x51c628={};var _0x50be0a=[];return db[_0x54d9('0x16')][_0x54d9('0x15')]()['then'](function(_0x5b0ab4){_0x51c628=_0x5b0ab4;var _0x17dc45=Object[_0x54d9('0x17')](_0x51c628)[_0x54d9('0xd')](function(_0x45684e){return _[_0x54d9('0x18')](_0x45684e,_0x54d9('0x19'))?_0x45684e:undefined;});var _0x51ef8c=_0x17dc45['map'](function(_0x4dcfdd){return db[_0x54d9('0x1a')][_0x54d9('0x1b')]({'where':{'id':_0x4dcfdd['slice'](0x3)},'raw':!![]});});return Promise[_0x54d9('0x1c')](_0x51ef8c);})[_0x54d9('0x6')](function(_0x49c1bc){for(var _0x4bf6ca=0x0;_0x4bf6ca<_0x49c1bc[_0x54d9('0x1d')];_0x4bf6ca++){if(_0x49c1bc[_0x4bf6ca]){var _0x50be8f=_0x54d9('0x19')+_0x49c1bc[_0x4bf6ca]['id'];_0x51c628[_0x50be8f][_0x54d9('0x1e')]=_0x49c1bc[_0x4bf6ca][_0x54d9('0x1f')];}}_0x50be0a=_[_0x54d9('0x20')](Object[_0x54d9('0x17')](_0x51c628),function(_0x586480){return{'name':_0x586480,'type':_0x51c628[_0x586480][_0x54d9('0x1f')]};});return _0x50be0a;})[_0x54d9('0x14')](function(_0x5c7cc6){throw _0x5c7cc6;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 8b8b57e..f95bf05 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 _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 +var _0x0b4b=['clause','skip','map','some','name','Contact','forEach','and','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','uc.UserId\x20=\x20?','\x20=\x20?','resolve','then','tag','filter','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','limit','offset','group','having','order','DESC','subqry.','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','sequelize','toString','Tags','clone','COUNT(*)','c.id','isEmpty','where','t.id\x20IN\x20?','lodash','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','select','cm_contacts','c.deletedAt\x20IS\x20NULL','subqry','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','ct.CmContactId\x20=\x20','left_join','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','fax','createdAt','updatedAt','deletedAt','TagIds','includes','push','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','dateOfBirth','fieldType','castTo','DATE','type','default','text','value','start','end','Tag','tags','ids','User','user'];(function(_0x67554c,_0x823180){var _0x23554d=function(_0x384ae1){while(--_0x384ae1){_0x67554c['push'](_0x67554c['shift']());}};_0x23554d(++_0x823180);}(_0x0b4b,0xfa));var _0xb0b4=function(_0x3430aa,_0x57cd92){_0x3430aa=_0x3430aa-0x0;var _0x2ac5c=_0x0b4b[_0x3430aa];return _0x2ac5c;};'use strict';var _=require(_0xb0b4('0x0'));var squel=require('squel');var as=require(_0xb0b4('0x1'));var qs=require(_0xb0b4('0x2'));var utils=require(_0xb0b4('0x3'));var db=require(_0xb0b4('0x4'))['db'];function skipContactsQuery(_0xb32891,_0x4e99d6){var _0x331889=![];if(_0xb32891[_0xb0b4('0x5')]===_0xb0b4('0x6')&&!_0x4e99d6[_0xb0b4('0x7')]&&!_0x4e99d6[_0xb0b4('0x8')]&&_0x4e99d6[_0xb0b4('0x9')]!=='true'){_0x331889=!![];}return _0x331889;}function getContactsSubquery(){return squel[_0xb0b4('0xa')]()['from'](_0xb0b4('0xb'),'c')['where'](_0xb0b4('0xc'));}function applyJoinClauses(_0x14833f,_0x246d20){var _0x39e407=_0x246d20?'c':_0xb0b4('0xd');_0x14833f['left_join'](_0xb0b4('0xe'),'uc',_0xb0b4('0xf')+_0x39e407+_0xb0b4('0x10'))['left_join']('cm_contact_has_tags','ct',_0xb0b4('0x11')+_0x39e407+_0xb0b4('0x10'))[_0xb0b4('0x12')]('tools_tags','t',_0xb0b4('0x13'));return _0x14833f;}function addFieldsToQuery(_0x4665e5,_0x526ca5,_0x24f1b4,_0x202f8c,_0x40aea8){var _0x18363f=_0x40aea8?'c':_0xb0b4('0xd');if(!_0x526ca5){_0x526ca5=['id',_0xb0b4('0x14'),_0xb0b4('0x15'),_0xb0b4('0x16'),_0xb0b4('0x17'),_0xb0b4('0x18'),'email',_0xb0b4('0x8'),'CompanyId',_0xb0b4('0x19'),_0xb0b4('0x1a'),_0xb0b4('0x1b'),_0xb0b4('0x1c')];}else if(!_0x526ca5[_0xb0b4('0x1d')]('id')){_0x526ca5[_0xb0b4('0x1e')]('id');}var _0x20dd30=_0x24f1b4&&_0x40aea8||!_0x24f1b4&&!_0x40aea8;if(_0x202f8c){_0x20dd30=_0x202f8c&&_0x40aea8||!_0x202f8c&&!_0x40aea8;}_0x526ca5['forEach'](function(_0x2ae90f){if(_0x2ae90f===_0xb0b4('0x1c')){if(_0x20dd30){_0x4665e5['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x2ae90f);}else if(_0x24f1b4||_0x202f8c){_0x4665e5[_0xb0b4('0x1f')](_0x18363f+'.'+_0x2ae90f);}}else{_0x4665e5['field'](_0x18363f+'.'+_0x2ae90f);}});return _0x4665e5;}function getSqlClauses(){var _0x2b2ace={'default':squel[_0xb0b4('0x20')](),'fields':squel[_0xb0b4('0x20')](),'filter':squel[_0xb0b4('0x20')](),'tags':{'clause':squel[_0xb0b4('0x20')](),'ids':null},'user':{'clause':squel[_0xb0b4('0x20')](),'skip':![]}};return _0x2b2ace;}function parseTagParameter(_0x5ba934){var _0x33c44c=squel[_0xb0b4('0x20')]();if(_0x5ba934){var _0x37b8f4=utils[_0xb0b4('0x21')](_0x5ba934);_0x37b8f4['forEach'](function(_0x4f9346){_0x33c44c['or'](_0xb0b4('0x22'),'%,'+_0x4f9346+',%');});}return _0x33c44c;}function parseSearchFilter(_0x19e7d6){var _0x210839=squel[_0xb0b4('0x20')]();if(_0x19e7d6){var _0x351b9f=_0x19e7d6[_0xb0b4('0x23')]('\x5c','\x5c\x5c')[_0xb0b4('0x23')](/'/g,'\x27\x27');if(_0x351b9f[_0xb0b4('0x24')]('\x20')[_0xb0b4('0x25')]>0x1){_0x210839['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb0b4('0x26')](_0x351b9f,!![]),null);}else{if(qs[_0xb0b4('0x27')](_0x351b9f)){_0x210839['or'](_0xb0b4('0x28'),_0x351b9f+'%');_0x210839['or'](_0xb0b4('0x29'),_0x351b9f+'%');_0x210839['or'](_0xb0b4('0x2a'),_0x351b9f+'%');_0x210839['or'](_0xb0b4('0x2b'),_0x351b9f+'%');}else if(qs['isEmail'](_0x351b9f)){_0x210839['or']('c.email\x20LIKE\x20?',_0x351b9f+'%');}else{_0x210839['or'](_0xb0b4('0x2c'),'%'+_0x351b9f+'%');_0x210839['or'](_0xb0b4('0x2d'),'%'+_0x351b9f+'%');_0x210839['or']('c.email\x20LIKE\x20?','%'+_0x351b9f+'%');}}}return _0x210839;}function parseAdvancedSearchFilter(_0x292530,_0x137a53){var _0xcd6988=getSqlClauses();var _0x3d9bb7=as[_0xb0b4('0x2e')](_0x292530);var _0x368588=_0x3d9bb7[_0xb0b4('0x2f')];for(var _0x258178=0x0;_0x258178<_0x3d9bb7['conditions'][_0xb0b4('0x25')];_0x258178++){var _0x2b14b3=_0x3d9bb7[_0xb0b4('0x30')][_0x258178];var _0x3769bc='c';var _0x58325a=_[_0xb0b4('0x31')](_0x137a53,['name',_0x2b14b3[_0xb0b4('0x1f')]]);if(_0x58325a){if(_0x2b14b3[_0xb0b4('0x1f')]===_0xb0b4('0x32')||_0x58325a[_0xb0b4('0x33')]==='datetime'){_0x2b14b3[_0xb0b4('0x34')]=_0xb0b4('0x35');}var _0x1ec03b=as['buildExpression'](_0x3769bc,_0x58325a[_0xb0b4('0x36')],_0x2b14b3);_0xcd6988[_0xb0b4('0x37')][_0x368588](_0x1ec03b[_0xb0b4('0x38')],_0x1ec03b[_0xb0b4('0x39')][_0xb0b4('0x3a')],_0x1ec03b[_0xb0b4('0x39')][_0xb0b4('0x3b')]);}else{if(_0x2b14b3[_0xb0b4('0x1f')]===_0xb0b4('0x3c')){var _0x4df370=_0x2b14b3[_0xb0b4('0x39')]['split'](',')['map'](function(_0x3b638c){return Number(_0x3b638c);});var _0x405be5=parseTagParameter(_0x4df370);_0xcd6988[_0xb0b4('0x3d')]['clause']['and'](_0x405be5);_0xcd6988[_0xb0b4('0x3d')][_0xb0b4('0x3e')]=_0x4df370;}else if(_0x2b14b3[_0xb0b4('0x1f')]===_0xb0b4('0x3f')){_0xcd6988[_0xb0b4('0x40')][_0xb0b4('0x41')]['and']('uc.UserId\x20=\x20?',_0x2b14b3[_0xb0b4('0x39')]);_0xcd6988['user'][_0xb0b4('0x42')]=!![];}}}return _0xcd6988;}function parseModelFields(_0x21ecd4,_0x1d8634){var _0xf96021=squel[_0xb0b4('0x20')]();var _0xcbdbe7=_(_0x21ecd4)['keys']()[_0xb0b4('0x43')](function(_0x471063){return _[_0xb0b4('0x44')](_0x1d8634,[_0xb0b4('0x45'),_0x471063])?_0x471063:undefined;})['compact']()[_0xb0b4('0x39')]();if(_0x21ecd4[_0xb0b4('0x46')]){_0xcbdbe7['push'](_0xb0b4('0x46'));}if(_0x21ecd4['User']){_0xcbdbe7[_0xb0b4('0x1e')]('User');}if(_0xcbdbe7[_0xb0b4('0x25')]>0x0){_0xcbdbe7[_0xb0b4('0x47')](function(_0xe09240){if(_0xe09240==='ListId'){_0xf96021[_0xb0b4('0x48')]('c.ListId\x20IN\x20?',[][_0xb0b4('0x49')](_0x21ecd4[_0xe09240]));}else if(_0xe09240==='Contact'){var _0xdd43f1='%'+_0x21ecd4[_0xe09240]+'%';_0xf96021['and'](_0xb0b4('0x4a'),_0xdd43f1);}else if(_0xe09240===_0xb0b4('0x3f')){_0xf96021[_0xb0b4('0x48')](_0xb0b4('0x4b'),_0x21ecd4[_0xe09240]);}else{_0xf96021[_0xb0b4('0x48')]('c.'+_0xe09240+_0xb0b4('0x4c'),_0x21ecd4[_0xe09240]);}});}return _0xf96021;}function parseQueryParameters(_0x1ac960,_0x21c819){var _0x5cd01b=getSqlClauses();return Promise[_0xb0b4('0x4d')]()[_0xb0b4('0x4e')](function(){return parseModelFields(_0x1ac960,_0x21c819);})['then'](function(_0x284479){_0x5cd01b['fields'][_0xb0b4('0x48')](_0x284479);return parseTagParameter(_0x1ac960[_0xb0b4('0x4f')]);})[_0xb0b4('0x4e')](function(_0x57e365){_0x5cd01b[_0xb0b4('0x3d')][_0xb0b4('0x41')][_0xb0b4('0x48')](_0x57e365);return parseSearchFilter(_0x1ac960[_0xb0b4('0x50')]);})['then'](function(_0x479f88){_0x5cd01b[_0xb0b4('0x50')]=_0x479f88;return _0x5cd01b;});}function checkListsRestrictions(_0x4466c5,_0x49d5ef,_0x48b2e9){var _0x2c9bf3=squel['expr']();return Promise[_0xb0b4('0x4d')]()[_0xb0b4('0x4e')](function(){if(_0x49d5ef[_0xb0b4('0x7')]&&_0x4466c5[_0xb0b4('0x5')]===_0xb0b4('0x6')&&!_0x48b2e9){return _0x4466c5['getLists']({'attributes':['id'],'raw':!![]});}})[_0xb0b4('0x4e')](function(_0x193606){if(_0x193606){if(_0x193606[_0xb0b4('0x25')]===0x0){_0x2c9bf3['and'](_0xb0b4('0x51'));}else{_0x2c9bf3[_0xb0b4('0x48')](_0xb0b4('0x52'),_[_0xb0b4('0x43')](_0x193606,'id'));}}})[_0xb0b4('0x4e')](function(){return _0x2c9bf3;});}function buildContactsQuery(_0x2554d6,_0x1e4b33,_0x124e31,_0x5b690f,_0x2742ce,_0x23ec4f){if(_0x1e4b33){_0x1e4b33=_0x124e31['attributes'];}_0x2554d6=addFieldsToQuery(_0x2554d6,_0x1e4b33,_0x5b690f,_0x23ec4f,!![]);var _0x4d967c=squel['select']();_0x4d967c=addFieldsToQuery(_0x4d967c,_0x1e4b33,_0x5b690f,_0x23ec4f,![]);if(_0x5b690f||_0x23ec4f){_0x2554d6=applyJoinClauses(_0x2554d6,!![]);_0x2554d6['group']('c.id');if(_0x124e31['limit']){_0x4d967c[_0xb0b4('0x53')](_0x124e31[_0xb0b4('0x53')]);}if(_0x124e31[_0xb0b4('0x54')]){_0x4d967c[_0xb0b4('0x54')](_0x124e31['offset']);}}else{_0x4d967c=applyJoinClauses(_0x4d967c,![]);_0x4d967c[_0xb0b4('0x55')]('subqry.id');if(_0x124e31[_0xb0b4('0x53')]){_0x2554d6[_0xb0b4('0x53')](_0x124e31[_0xb0b4('0x53')]);}if(_0x124e31[_0xb0b4('0x54')]){_0x2554d6[_0xb0b4('0x54')](_0x124e31[_0xb0b4('0x54')]);}}_0x4d967c[_0xb0b4('0x56')](_0x2742ce);if(_0x124e31[_0xb0b4('0x57')]){_0x124e31[_0xb0b4('0x57')][_0xb0b4('0x47')](function(_0x89b9a1){_0x2554d6[_0xb0b4('0x57')]('c.'+_0x89b9a1[0x0],_0x89b9a1[0x1]===_0xb0b4('0x58')?![]:!![]);_0x4d967c[_0xb0b4('0x57')](_0xb0b4('0x59')+_0x89b9a1[0x0],_0x89b9a1[0x1]===_0xb0b4('0x58')?![]:!![]);});}_0x4d967c['from'](_0x2554d6,'subqry');return _0x4d967c;}function getFilteredContacts(_0x1d1f16){var _0x2d69d2=[];return db[_0xb0b4('0x3c')][_0xb0b4('0x5a')]({'attributes':['id',_0xb0b4('0x45'),_0xb0b4('0x5b')],'raw':!![]})['then'](function(_0x57c10d){_0x2d69d2=_[_0xb0b4('0x5c')](_0x57c10d,'id');var _0x1462ca={'type':db[_0xb0b4('0x5d')][_0xb0b4('0x5e')][_0xb0b4('0x5f')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xb0b4('0x60')]['query'](_0x1d1f16[_0xb0b4('0x61')](),_0x1462ca);})['then'](function(_0xf56a5a){_0xf56a5a[_0xb0b4('0x47')](function(_0x440a95){if(_0x440a95[_0xb0b4('0x1c')]){_0x440a95[_0xb0b4('0x62')]=[];_0x440a95['TagIds'][_0xb0b4('0x24')](',')[_0xb0b4('0x47')](function(_0x50b968){_0x440a95[_0xb0b4('0x62')][_0xb0b4('0x1e')](_0x2d69d2[_0x50b968]);});}delete _0x440a95[_0xb0b4('0x1c')];});return _0xf56a5a;});}function countFilteredContacts(_0x24f6e9,_0x5b55d5){var _0x19f53a=_0x24f6e9[_0xb0b4('0x63')]();_0x19f53a[_0xb0b4('0x1f')](_0xb0b4('0x64'));_0x19f53a=applyJoinClauses(_0x19f53a,!![]);_0x24f6e9['group'](_0xb0b4('0x65'));var _0x54e99f=utils['getSelectedTags'](_0x5b55d5);if(!_[_0xb0b4('0x66')](_0x54e99f)){_0x19f53a[_0xb0b4('0x67')](_0xb0b4('0x68'),_0x54e99f);}var _0x39bdc5={'type':db[_0xb0b4('0x5d')][_0xb0b4('0x5e')][_0xb0b4('0x5f')],'raw':!![]};return db[_0xb0b4('0x60')]['query'](_0x19f53a[_0xb0b4('0x61')](),_0x39bdc5)['then'](function(_0x13392d){return _0x13392d[0x0][_0xb0b4('0x64')];});}module['exports']={'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 7243db2..b5d7a82 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 _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 +var _0x6dfa=['../../config/environment','session','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','createReadStream','createWriteStream','data','binary','write','close','unlink','decryptFile','createDecipher','end','final','update','utf8','base64','decryptString','secret','crypto','bluebird'];(function(_0x2d21d6,_0x30d4d4){var _0x4fe398=function(_0x1d7107){while(--_0x1d7107){_0x2d21d6['push'](_0x2d21d6['shift']());}};_0x4fe398(++_0x30d4d4);}(_0x6dfa,0x1de));var _0xa6df=function(_0x56c4cc,_0x2e9510){_0x56c4cc=_0x56c4cc-0x0;var _0x1d2067=_0x6dfa[_0x56c4cc];return _0x1d2067;};'use strict';var crypto=require(_0xa6df('0x0'));var fs=require('fs');var BPromise=require(_0xa6df('0x1'));var _=require('lodash');var config=require(_0xa6df('0x2'));var logger=require('../../config/logger')('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0xa6df('0x3')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0xa6df('0x4')};if(config[_0xa6df('0x5')]&&config['encrypt'][_0xa6df('0x6')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0xa6df('0x6')]);if(isSupported){fileOptions[_0xa6df('0x6')]=config[_0xa6df('0x5')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0xa6df('0x7')](',\x20');logger['error'](config['encrypt'][_0xa6df('0x6')],_0xa6df('0x8'),supportedAlgorithms);}}function isASupportedCipher(_0xe619c7){return AES_SUPPORTED_RX[_0xa6df('0x9')](_0xe619c7);}function getSupportedCiphers(){return crypto[_0xa6df('0xa')]()[_0xa6df('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x3dbb74){return getSupportedCiphers()[_0xa6df('0xc')](_0x3dbb74)>-0x1;}function combineOptions(_0x3a69e3){var _0x2de973={};for(var _0x4ce1e0 in fileOptions){if(fileOptions[_0xa6df('0xd')](_0x4ce1e0)){_0x2de973[_0x4ce1e0]=fileOptions[_0x4ce1e0];}}if(_0x3a69e3){for(var _0x5cf1be in _0x3a69e3){if(_0x3a69e3[_0xa6df('0xd')](_0x5cf1be)){_0x2de973[_0x5cf1be]=_0x3a69e3[_0x5cf1be];}}}return _0x2de973;}exports['encryptFile']=function(_0x524928,_0x3ec483,_0x15ed82,_0x335962){return new BPromise(function(_0x15ecb9,_0x276b6b){_0x335962=combineOptions(_0x335962);var _0x4d7a7d=new Buffer(_0x15ed82);var _0x293aa2=fs[_0xa6df('0xe')](_0x524928);var _0x4825a7=fs[_0xa6df('0xf')](_0x3ec483);var _0x28b1a4=crypto['createCipher'](_0x335962[_0xa6df('0x6')],_0x4d7a7d);_0x293aa2['on'](_0xa6df('0x10'),function(_0x4a6e7e){var _0x20f3a9=new Buffer(_0x28b1a4['update'](_0x4a6e7e),_0xa6df('0x11'));_0x4825a7[_0xa6df('0x12')](_0x20f3a9);});_0x293aa2['on']('end',function(){try{var _0x1d55d6=new Buffer(_0x28b1a4['final'](_0xa6df('0x11')),_0xa6df('0x11'));_0x4825a7[_0xa6df('0x12')](_0x1d55d6);_0x4825a7['end']();_0x4825a7['on'](_0xa6df('0x13'),function(){return _0x15ecb9(_0x3ec483);});}catch(_0x12bb71){fs[_0xa6df('0x14')](_0x3ec483);return _0x276b6b(_0x12bb71);}});});};exports[_0xa6df('0x15')]=function(_0x200040,_0x46db43,_0x1d217b,_0x463d63){return new BPromise(function(_0x4a9929,_0x258648){_0x463d63=combineOptions(_0x463d63);var _0x176868=new Buffer(_0x1d217b);var _0xed6c8f=fs[_0xa6df('0xe')](_0x200040);var _0x4401aa=fs[_0xa6df('0xf')](_0x46db43);var _0x50ea8d=crypto[_0xa6df('0x16')](_0x463d63[_0xa6df('0x6')],_0x176868);_0xed6c8f['on'](_0xa6df('0x10'),function(_0x59be92){var _0x3844a0=new Buffer(_0x50ea8d['update'](_0x59be92),'binary');_0x4401aa[_0xa6df('0x12')](_0x3844a0);});_0xed6c8f['on'](_0xa6df('0x17'),function(){try{var _0xf9c196=new Buffer(_0x50ea8d[_0xa6df('0x18')]('binary'),_0xa6df('0x11'));_0x4401aa[_0xa6df('0x12')](_0xf9c196);_0x4401aa[_0xa6df('0x17')]();_0x4401aa['on'](_0xa6df('0x13'),function(){return _0x4a9929(_0x46db43);});}catch(_0x3e4b90){fs[_0xa6df('0x14')](_0x46db43);return _0x258648(_0x3e4b90);}});});};exports['encryptString']=function(_0x3feaac,_0x542d72,_0x3708d2){var _0x122e8d=_0x3708d2||stringOptions['algorithm'];var _0x3ba348=_0x542d72||stringOptions['secret'];var _0x5bf5f3=crypto['createCipher'](_0x122e8d,_0x3ba348);var _0x3de1ac=_0x5bf5f3[_0xa6df('0x19')](_0x3feaac,_0xa6df('0x1a'),_0xa6df('0x1b'));_0x3de1ac+=_0x5bf5f3['final'](_0xa6df('0x1b'));return _0x3de1ac;};exports[_0xa6df('0x1c')]=function(_0x5a6cd6,_0x184f61,_0xa67df8){var _0x38607b=_0xa67df8||stringOptions['algorithm'];var _0x3c1401=_0x184f61||stringOptions[_0xa6df('0x1d')];var _0x3a9237=crypto['createDecipher'](_0x38607b,_0x3c1401);var _0x34b0ed=_0x3a9237[_0xa6df('0x19')](_0x5a6cd6,_0xa6df('0x1b'),_0xa6df('0x1a'));_0x34b0ed+=_0x3a9237[_0xa6df('0x18')](_0xa6df('0x1a'));return _0x34b0ed;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 38a38a0..426fbbe 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 _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 +var _0x3270=['lodash','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','length','range','isInteger','forEach','push','QueryTypes','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','join','mkdirSync','each','%s%d.%s','%s.%s','csv','writeFileSync','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path'];(function(_0x2a8b3b,_0x5efd92){var _0x546b6c=function(_0x38f46a){while(--_0x38f46a){_0x2a8b3b['push'](_0x2a8b3b['shift']());}};_0x546b6c(++_0x5efd92);}(_0x3270,0x171));var _0x0327=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x3270[_0x4e7d25];return _0x526fe6;};'use strict';var util=require(_0x0327('0x0'));var path=require(_0x0327('0x1'));var _=require(_0x0327('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x0327('0x3'));var zipdir=require(_0x0327('0x4'));var rimraf=require('rimraf');var db=require(_0x0327('0x5'))['db'];var dbH=require(_0x0327('0x5'))[_0x0327('0x6')];var logger=require(_0x0327('0x7'))(_0x0327('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x0327('0x9')][0x2]);var QUERY=process[_0x0327('0x9')][0x3];var PATH=process[_0x0327('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x183b37,_0x5b8d48){var _0x7cd64c={'status':_0x183b37};var _0x134c33={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5b8d48){_0x7cd64c[_0x0327('0xa')]=_0x5b8d48;}return db[_0x0327('0xb')][_0x0327('0xc')](_0x7cd64c,_0x134c33);}function main(){var _0x20bb6d=0x1388;var _0x4bb134;logger['info'](util[_0x0327('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x0327('0xe')));return db[_0x0327('0xf')][_0x0327('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0327('0x11'),_0x0327('0x12')]})[_0x0327('0x13')](function(_0x45ee34){if(_0x45ee34){_0x4bb134=_0x45ee34;_0x20bb6d=_0x4bb134[_0x0327('0x12')]||0x1388;}})[_0x0327('0x13')](function(){return dbH[_0x0327('0x14')]['query'](util['format'](_0x0327('0x15'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x0327('0x16')]});})['then'](function(_0x39172b){if(!_0x39172b[0x0][_0x0327('0x17')]){return analyticExtractedReport(_0x0327('0x18'));}var _0x250ea4=[];var _0x52af3f=0x0;if(_0x4bb134['split']){if(_0x39172b&&_0x39172b[_0x0327('0x19')]){var _0x3106cf=_[_0x0327('0x1a')](_0x39172b[0x0]['num']/_0x20bb6d);var _0x593364=Number[_0x0327('0x1b')](_0x39172b[0x0][_0x0327('0x17')]/_0x20bb6d)?_0x39172b[0x0][_0x0327('0x17')]%_0x20bb6d:0x0;_0x3106cf[_0x0327('0x1c')](function(_0x53a5c4){if(_0x53a5c4>0x0){_0x52af3f+=_0x20bb6d;}_0x250ea4[_0x0327('0x1d')](dbH[_0x0327('0x14')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x20bb6d,_0x52af3f),{'type':dbH[_0x0327('0x14')][_0x0327('0x1e')][_0x0327('0x16')]}));});if(_0x593364>0x0){_0x52af3f+=_0x20bb6d;_0x250ea4[_0x0327('0x1d')](dbH['sequelize'][_0x0327('0x1f')](util[_0x0327('0xd')](_0x0327('0x20'),QUERY,_0x593364,_0x52af3f),{'type':dbH[_0x0327('0x14')][_0x0327('0x1e')][_0x0327('0x16')]}));}}}else{_0x250ea4[_0x0327('0x1d')](dbH[_0x0327('0x14')][_0x0327('0x1f')](QUERY,{'type':dbH[_0x0327('0x14')][_0x0327('0x1e')][_0x0327('0x16')]}));}var _0x53a175=path[_0x0327('0x21')](PATH);var _0x13675a=path[_0x0327('0x22')](PATH,_0x0327('0x23'));var _0x502fcd=_0x4bb134[_0x0327('0x11')]&&_0x250ea4[_0x0327('0x19')]>0x1;var _0xb07d58=[];if(!fs['existsSync'](path[_0x0327('0x24')](_0x53a175,_0x13675a))&&_0x502fcd){fs[_0x0327('0x25')](path[_0x0327('0x24')](_0x53a175,_0x13675a));}return BPromise[_0x0327('0x26')](_0x250ea4,function(_0x287c88){_0xb07d58['push'](_0x287c88);})[_0x0327('0x13')](function(){for(var _0x5434b8=0x0;_0x5434b8<_0xb07d58['length'];_0x5434b8+=0x1){var _0x26c1f9;var _0x4ef27a=_0xb07d58[_0x5434b8];if(_0x502fcd){_0x26c1f9=path[_0x0327('0x24')](_0x53a175,_0x13675a,util[_0x0327('0xd')](_0x0327('0x27'),_0x13675a,_0x5434b8,'csv'));}else{_0x26c1f9=path[_0x0327('0x24')](_0x53a175,util[_0x0327('0xd')](_0x0327('0x28'),_0x13675a,_0x0327('0x29')));}fs[_0x0327('0x2a')](_0x26c1f9,csv(_0x4ef27a));}})['then'](function(){if(_0x502fcd){return new Promise(function(_0x50f244){zipdir(path[_0x0327('0x24')](_0x53a175,_0x13675a),{'saveTo':path[_0x0327('0x24')](_0x53a175,util[_0x0327('0xd')](_0x0327('0x28'),_0x13675a,_0x0327('0x2b')))},function(_0x47180a,_0x427182){rimraf(path[_0x0327('0x24')](_0x53a175,_0x13675a),function(){});_0x50f244(_0x0327('0x2c'));});});}})[_0x0327('0x13')](function(){logger[_0x0327('0x2d')](util['format'](_0x0327('0x2e'),EXTRACTED_REPORT_ID,_0x0327('0xe')));return analyticExtractedReport('Completed',_0x502fcd?util['format'](_0x0327('0x28'),_0x13675a,_0x502fcd?_0x0327('0x2b'):'csv'):null);});})[_0x0327('0x2f')](function(_0x23b4cf){logger['info'](util[_0x0327('0xd')](_0x0327('0x30'),EXTRACTED_REPORT_ID,_0x0327('0xe')),util[_0x0327('0x31')](_0x23b4cf,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x0327('0x32'));})[_0x0327('0x33')](function(){process[_0x0327('0x34')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index a87852a..63601ad 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 _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 +var _0x33c6=['%s%d.%s','%s.%s','pdf','all','zip','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','Failed','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','error','end','createPdfFromHTML','catch','lodash','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','tableHeader','pick','toString','value','fill','push','body','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','endDate','header','pageBreak','before','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','length','range','isInteger','query','sequelize','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','existsSync','mkdirSync','join','each','flatten','createPdfKitDocument'];(function(_0x202576,_0x194384){var _0x27dd3d=function(_0xa46bb5){while(--_0xa46bb5){_0x202576['push'](_0x202576['shift']());}};_0x27dd3d(++_0x194384);}(_0x33c6,0x73));var _0x633c=function(_0x5d5a02,_0x36fa21){_0x5d5a02=_0x5d5a02-0x0;var _0x30ff94=_0x33c6[_0x5d5a02];return _0x30ff94;};'use strict';var _=require(_0x633c('0x0'));var fs=require('fs');var util=require(_0x633c('0x1'));var path=require(_0x633c('0x2'));var moment=require(_0x633c('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x633c('0x4'));var zipdir=require(_0x633c('0x5'));var rimraf=require(_0x633c('0x6'));var JSDOM=require(_0x633c('0x7'))[_0x633c('0x8')];var window=new JSDOM('')[_0x633c('0x9')];var BPromise=require(_0x633c('0xa'));var db=require(_0x633c('0xb'))['db'];var dbH=require(_0x633c('0xb'))['dbH'];var logger=require(_0x633c('0xc'))(_0x633c('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0x633c('0xe')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x633c('0xe')][0x4];var NAME=process[_0x633c('0xe')][0x5];var FORMAT=_0x633c('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x92c4bc,_0x57966a){var _0x497f34={'status':_0x92c4bc};var _0x3d8d20={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x57966a){_0x497f34[_0x633c('0x10')]=_0x57966a;}return db['AnalyticExtractedReport'][_0x633c('0x11')](_0x497f34,_0x3d8d20);}function getHeaders(_0x326155){return _[_0x633c('0x12')](_0x326155,function(_0x57838b){return{'text':_0x57838b,'style':_0x633c('0x13')};});}function getRows(_0x746646,_0x48a601){return _[_0x633c('0x12')](_0x48a601,function(_0x1e9a9f){return _(_0x1e9a9f)[_0x633c('0x14')](_0x746646)[_0x633c('0x12')](function(_0x2077fd){return _0x2077fd?_[_0x633c('0x15')](_0x2077fd):'';})[_0x633c('0x16')]();});}function createTable(_0x3b43e3,_0x2b642e){var _0x1df647={'widths':_[_0x633c('0x17')](Array(_0x3b43e3['length']),0x91),'heights':function(_0x49dda9){return _0x49dda9===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x13fbc5=getHeaders(_0x3b43e3);_0x1df647['body'][_0x633c('0x18')](_0x13fbc5);var _0xa16afe=getRows(_0x3b43e3,_0x2b642e);_0x1df647[_0x633c('0x19')]=_0x1df647['body']['concat'](_0xa16afe);return _0x1df647;}function createTables(_0x527445){var _0x263df1=[];var _0x2b8c8b=_['chunk'](Object[_0x633c('0x1a')](_0x527445[0x0]),0x5);_0x2b8c8b[_0x633c('0x1b')](function(_0x19718d){_0x263df1[_0x633c('0x18')](createTable(_0x19718d,_0x527445));});return _0x263df1;}function getPDFDocDefinition(_0x573952){var _0x56e57b=util['format'](_0x633c('0x1c'),NAME,EXTRACTED_REPORT[_0x633c('0x1d')],moment(EXTRACTED_REPORT[_0x633c('0x1e')])[_0x633c('0x1f')](FORMAT),moment(EXTRACTED_REPORT[_0x633c('0x20')])['format'](FORMAT));var _0x54bbb2=[];for(var _0x336895=0x0;_0x336895<_0x573952['length'];_0x336895++){var _0x844356=[];if(_0x336895===0x0){_0x844356[_0x633c('0x18')]({'text':_0x56e57b,'style':_0x633c('0x21')});}var _0x1089db={'table':_0x573952[_0x336895]};if(_0x336895>0x0){_0x1089db[_0x633c('0x22')]=_0x633c('0x23');_0x1089db['margin']=[0x0,0x46,0x0,0x0];}_0x844356[_0x633c('0x18')](_0x1089db);_0x54bbb2[_0x633c('0x18')](_0x844356);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x54bbb2,'footer':function(_0x42be4b,_0x16a8d5){return{'text':_0x42be4b[_0x633c('0x15')]()+_0x633c('0x24')+_0x16a8d5,'style':_0x633c('0x25')};},'defaultStyle':{'font':_0x633c('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x633c('0x27')},'footer':{'alignment':_0x633c('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x2975f2){var _0x21b3ef=0x1388;var _0xdd6bf2;if(!_0x2975f2[0x0][_0x633c('0x29')]){return analyticExtractedReport(_0x633c('0x2a'));}return db[_0x633c('0x2b')][_0x633c('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x633c('0x2d'),_0x633c('0x2e')]})[_0x633c('0x2f')](function(_0x21e994){if(_0x21e994){_0xdd6bf2=_0x21e994;_0x21b3ef=_0xdd6bf2[_0x633c('0x2e')]||0x3e8;}})[_0x633c('0x2f')](function(){var _0x3c09ea=[];var _0x14d0ef=0x0;if(_0xdd6bf2['split']){if(_0x2975f2&&_0x2975f2[_0x633c('0x30')]){var _0x1ff11e=_[_0x633c('0x31')](_0x2975f2[0x0]['num']/_0x21b3ef);var _0x9480a5=Number[_0x633c('0x32')](_0x2975f2[0x0][_0x633c('0x29')]/_0x21b3ef)?_0x2975f2[0x0][_0x633c('0x29')]%_0x21b3ef:0x0;_0x1ff11e[_0x633c('0x1b')](function(_0x2bce17){if(_0x2bce17>0x0){_0x14d0ef+=_0x21b3ef;}_0x3c09ea[_0x633c('0x18')](dbH['sequelize'][_0x633c('0x33')](util[_0x633c('0x1f')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x21b3ef,_0x14d0ef),{'type':dbH[_0x633c('0x34')][_0x633c('0x35')][_0x633c('0x36')]}));});if(_0x9480a5>0x0){_0x14d0ef+=_0x21b3ef;_0x3c09ea['push'](dbH[_0x633c('0x34')]['query'](util[_0x633c('0x1f')](_0x633c('0x37'),QUERY,_0x9480a5,_0x14d0ef),{'type':dbH[_0x633c('0x34')]['QueryTypes'][_0x633c('0x36')]}));}}}else{_0x3c09ea[_0x633c('0x18')](dbH[_0x633c('0x34')][_0x633c('0x33')](QUERY,{'type':dbH[_0x633c('0x34')][_0x633c('0x35')][_0x633c('0x36')]}));}var _0x15f94c=path['dirname'](PATH);var _0x2e2696=path[_0x633c('0x38')](PATH,'.pdf');var _0x57ce7f=_0xdd6bf2['split']&&_0x3c09ea[_0x633c('0x30')]>0x1;var _0x3295cd=[];if(!fs[_0x633c('0x39')](path['join'](_0x15f94c,_0x2e2696))&&_0x57ce7f){fs[_0x633c('0x3a')](path[_0x633c('0x3b')](_0x15f94c,_0x2e2696));}return BPromise[_0x633c('0x3c')](_0x3c09ea,function(_0x2cf3d3){_0x3295cd['push'](_0x2cf3d3);})[_0x633c('0x2f')](function(){var _0xb7b593=[];for(var _0x31e77b=0x0;_0x31e77b<_0x3295cd[_0x633c('0x30')];_0x31e77b+=0x1){var _0x4de7a1=_0x3295cd[_0x31e77b];var _0x5193bd=createTables(_[_0x633c('0x3d')](_0x4de7a1));var _0x59b809;var _0x16037f=getPDFDocDefinition(_0x5193bd);var _0xbda1ff=getPDFPrinter();var _0x237b50=_0xbda1ff[_0x633c('0x3e')](_0x16037f);if(_0x57ce7f){_0x59b809=path[_0x633c('0x3b')](_0x15f94c,_0x2e2696,util[_0x633c('0x1f')](_0x633c('0x3f'),_0x2e2696,_0x31e77b,'pdf'));}else{_0x59b809=path[_0x633c('0x3b')](_0x15f94c,util[_0x633c('0x1f')](_0x633c('0x40'),_0x2e2696,_0x633c('0x41')));}_0xb7b593['push'](writePDFDocument(_0x237b50,_0x59b809));}return Promise[_0x633c('0x42')](_0xb7b593);})['then'](function(){if(_0x57ce7f){return new Promise(function(_0x390af8){zipdir(path[_0x633c('0x3b')](_0x15f94c,_0x2e2696),{'saveTo':path[_0x633c('0x3b')](_0x15f94c,util[_0x633c('0x1f')](_0x633c('0x40'),_0x2e2696,_0x633c('0x43')))},function(){rimraf(path[_0x633c('0x3b')](_0x15f94c,_0x2e2696),function(){});_0x390af8('zip\x20finished');});});}})[_0x633c('0x2f')](function(){if(!_0x57ce7f)return;rimraf(path[_0x633c('0x3b')](_0x15f94c,_0x2e2696),function(){});})[_0x633c('0x2f')](function(){logger['info'](util[_0x633c('0x1f')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x633c('0x44'),_0x57ce7f?util['format'](_0x633c('0x40'),_0x2e2696,_0x57ce7f?'zip':_0x633c('0x41')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x633c('0x45')](util[_0x633c('0x1f')](_0x633c('0x46'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x633c('0x47')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x633c('0x2f')](function(_0x3367aa){EXTRACTED_REPORT=_0x3367aa;return dbH[_0x633c('0x34')]['query'](util[_0x633c('0x1f')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x633c('0x34')][_0x633c('0x35')][_0x633c('0x36')]});})['then'](extractReport)['catch'](function(_0x11bdd5){logger[_0x633c('0x45')](util[_0x633c('0x1f')](_0x633c('0x48'),EXTRACTED_REPORT_ID,_0x633c('0x49')),util['inspect'](_0x11bdd5,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x633c('0x4a'));})['finally'](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x4b0614=new PdfPrinter({'Arial':{'normal':__dirname+_0x633c('0x4b'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x633c('0x4c'),'bolditalics':__dirname+_0x633c('0x4d')}});return _0x4b0614;}function getPDFDocDefinitionFromHTML(_0x15b62f,_0x6e41b){var _0x13bd16=util['format'](_0x633c('0x4e'),_0x6e41b['channel'],_0x6e41b[_0x633c('0x4f')]);var _0x57b544=moment()['format']('YYYY-MM-DD')[_0x633c('0x15')]();var _0x200633=htmlToPdfmake(_0x15b62f,{'window':window,'tableAutoSize':!![]});return{'content':[_0x200633],'defaultStyle':{'font':_0x633c('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x633c('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x633c('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x633c('0x50')}},'header':function(){return[{'text':_0x633c('0x51'),'style':'header'}];},'footer':function(_0x2d82e4,_0x541022){return[{'text':util['format'](_0x633c('0x52'),_0x13bd16,_0x2d82e4,_0x541022,_0x57b544),'style':_0x633c('0x25')}];}};}function writePDFDocument(_0x58258a,_0x4106f4){return new Promise(function(_0x42132c,_0x2106ad){var _0x4788ca=_0x58258a[_0x633c('0x53')](fs['createWriteStream'](_0x4106f4));_0x4788ca['on'](_0x633c('0x54'),function(){_0x42132c(_0x633c('0x54'));});_0x4788ca['on'](_0x633c('0x55'),function(_0x466070){_0x2106ad(_0x466070);});_0x58258a[_0x633c('0x56')]();});}exports[_0x633c('0x57')]=function(_0x5d01e9,_0x5b2700){var _0x46df64=getPDFPrinter();var _0x4a6ff4=getPDFDocDefinitionFromHTML(_0x5d01e9,_0x5b2700);var _0x436303=_0x46df64['createPdfKitDocument'](_0x4a6ff4);return writePDFDocument(_0x436303,_0x5b2700[_0x633c('0x2')])[_0x633c('0x58')](function(_0x10e686){throw _0x10e686;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 9b18686..4a780fb 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 _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 +var _0x13ea=['num','Empty','split','range','isInteger','forEach','push','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','basename','.xlsx','length','join','mkdirSync','each','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','lodash','json2xls','bluebird','rimraf','../../mysqldb','../../config/logger','analytics','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','splitSizeXlsx','then','query','format','QueryTypes'];(function(_0x16e491,_0x56fef6){var _0x38be44=function(_0x89d03e){while(--_0x89d03e){_0x16e491['push'](_0x16e491['shift']());}};_0x38be44(++_0x56fef6);}(_0x13ea,0xa9));var _0xa13e=function(_0x1cec84,_0x101ec2){_0x1cec84=_0x1cec84-0x0;var _0x12b7d3=_0x13ea[_0x1cec84];return _0x12b7d3;};'use strict';var util=require('util');var path=require('path');var _=require(_0xa13e('0x0'));var fs=require('fs');var json2xls=require(_0xa13e('0x1'));var BPromise=require(_0xa13e('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0xa13e('0x3'));var db=require('../../mysqldb')['db'];var dbH=require(_0xa13e('0x4'))['dbH'];var logger=require(_0xa13e('0x5'))(_0xa13e('0x6'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x53dceb,_0x72089){var _0x200db4={'status':_0x53dceb};var _0x2f2b68={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x72089){_0x200db4['savename']=_0x72089;}return db[_0xa13e('0x7')][_0xa13e('0x8')](_0x200db4,_0x2f2b68);}function main(){var _0x2f870a=0x1388;var _0x2aa20a;logger[_0xa13e('0x9')](util['format'](_0xa13e('0xa'),EXTRACTED_REPORT_ID,_0xa13e('0xb')));return db[_0xa13e('0xc')][_0xa13e('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xa13e('0xe')]})[_0xa13e('0xf')](function(_0x17a949){if(_0x17a949){_0x2aa20a=_0x17a949;_0x2f870a=_0x2aa20a[_0xa13e('0xe')]||0x1388;}})[_0xa13e('0xf')](function(){return dbH['sequelize'][_0xa13e('0x10')](util[_0xa13e('0x11')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0xa13e('0x12')]['SELECT']});})[_0xa13e('0xf')](function(_0x513019){if(!_0x513019[0x0][_0xa13e('0x13')]){return analyticExtractedReport(_0xa13e('0x14'));}var _0x1c5b14=[];var _0x35b021=0x0;if(_0x2aa20a[_0xa13e('0x15')]){if(_0x513019&&_0x513019['length']){var _0x74f9e0=_[_0xa13e('0x16')](_0x513019[0x0][_0xa13e('0x13')]/_0x2f870a);var _0x4f8af2=Number[_0xa13e('0x17')](_0x513019[0x0][_0xa13e('0x13')]/_0x2f870a)?_0x513019[0x0]['num']%_0x2f870a:0x0;_0x74f9e0[_0xa13e('0x18')](function(_0xa9e2d7){if(_0xa9e2d7>0x0){_0x35b021+=_0x2f870a;}_0x1c5b14[_0xa13e('0x19')](dbH[_0xa13e('0x1a')]['query'](util[_0xa13e('0x11')](_0xa13e('0x1b'),QUERY,_0x2f870a,_0x35b021),{'type':dbH[_0xa13e('0x1a')][_0xa13e('0x12')][_0xa13e('0x1c')]}));});if(_0x4f8af2>0x0){_0x35b021+=_0x2f870a;_0x1c5b14[_0xa13e('0x19')](dbH['sequelize'][_0xa13e('0x10')](util[_0xa13e('0x11')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4f8af2,_0x35b021),{'type':dbH['sequelize'][_0xa13e('0x12')][_0xa13e('0x1c')]}));}}}else{_0x1c5b14[_0xa13e('0x19')](dbH[_0xa13e('0x1a')][_0xa13e('0x10')](QUERY,{'type':dbH[_0xa13e('0x1a')]['QueryTypes'][_0xa13e('0x1c')]}));}var _0x364e70=path['dirname'](PATH);var _0x1dd290=path[_0xa13e('0x1d')](PATH,_0xa13e('0x1e'));var _0x27810c=_0x2aa20a[_0xa13e('0x15')]&&_0x1c5b14[_0xa13e('0x1f')]>0x1;var _0x348b7e=[];if(!fs['existsSync'](path[_0xa13e('0x20')](_0x364e70,_0x1dd290))&&_0x27810c){fs[_0xa13e('0x21')](path[_0xa13e('0x20')](_0x364e70,_0x1dd290));}return BPromise[_0xa13e('0x22')](_0x1c5b14,function(_0x4e8405){_0x348b7e[_0xa13e('0x19')](_0x4e8405);})[_0xa13e('0xf')](function(){for(var _0x1194eb=0x0;_0x1194eb<_0x348b7e[_0xa13e('0x1f')];_0x1194eb+=0x1){var _0x4bfc3f;var _0x4e89f5=_0x348b7e[_0x1194eb];if(_0x27810c){_0x4bfc3f=path[_0xa13e('0x20')](_0x364e70,_0x1dd290,util[_0xa13e('0x11')](_0xa13e('0x23'),_0x1dd290,_0x1194eb,'xlsx'));}else{_0x4bfc3f=path[_0xa13e('0x20')](_0x364e70,util[_0xa13e('0x11')]('%s.%s',_0x1dd290,_0xa13e('0x24')));}fs[_0xa13e('0x25')](_0x4bfc3f,json2xls(_0x4e89f5),_0xa13e('0x26'));}})[_0xa13e('0xf')](function(){if(_0x27810c){return new Promise(function(_0x2dcb20){zipdir(path[_0xa13e('0x20')](_0x364e70,_0x1dd290),{'saveTo':path['join'](_0x364e70,util[_0xa13e('0x11')](_0xa13e('0x27'),_0x1dd290,_0xa13e('0x28')))},function(_0x48cb94,_0x4fa170){rimraf(path[_0xa13e('0x20')](_0x364e70,_0x1dd290),function(){});_0x2dcb20('zip\x20finished');});});}})['then'](function(){logger[_0xa13e('0x9')](util[_0xa13e('0x11')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xa13e('0x29'),_0x27810c?util[_0xa13e('0x11')](_0xa13e('0x27'),_0x1dd290,_0x27810c?_0xa13e('0x28'):'xlsx'):null);});})['catch'](function(_0x1bd2a9){logger['info'](util['format'](_0xa13e('0x2a'),EXTRACTED_REPORT_ID,_0xa13e('0xb')),util[_0xa13e('0x2b')](_0x1bd2a9,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa13e('0x2c'));})[_0xa13e('0x2d')](function(){process[_0xa13e('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 3bb2c08..29c6834 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 _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 +var _0x48a9=['exten','CAST(priority\x20AS\x20UNSIGNED)','filter','playback','extensions','find','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','CDR(routeid)=','priority','outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','extension','CDR(prefix)=${EXTEN:0:','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','*,*,*,*','map','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','sortBy','catch','error','rewrite','lodash','util','models','findAll','intervals','VoiceExtension','IntervalId','then','uniq'];(function(_0x5ce038,_0x54cfc8){var _0x44f591=function(_0x480d75){while(--_0x480d75){_0x5ce038['push'](_0x5ce038['shift']());}};_0x44f591(++_0x54cfc8);}(_0x48a9,0x14b));var _0x948a=function(_0x414f67,_0x861aed){_0x414f67=_0x414f67-0x0;var _0x338537=_0x48a9[_0x414f67];return _0x338537;};'use strict';var _=require(_0x948a('0x0'));var util=require(_0x948a('0x1'));function rewrite(_0x481003,_0x275b25){var _0x5dab3a=this;return _0x481003[_0x948a('0x2')]['Interval'][_0x948a('0x3')]({'raw':!![]})['then'](function(_0x2393f9){_0x5dab3a[_0x948a('0x4')]=_0x2393f9;return _0x481003['models'][_0x948a('0x5')][_0x948a('0x3')]({'where':{'IntervalId':_0x275b25[_0x948a('0x6')]},'raw':!![]});})[_0x948a('0x7')](function(_0x461a53){return _0x481003[_0x948a('0x2')][_0x948a('0x5')][_0x948a('0x3')]({'where':{'exten':{'$in':_[_0x948a('0x8')](_['map'](_0x461a53,_0x948a('0x9')))}},'order':[{'raw':_0x948a('0xa')}],'raw':!![]});})[_0x948a('0x7')](function(_0x21595e){var _0x33be62=_[_0x948a('0xb')](_0x21595e,{'priority':'1'});var _0x4eb39d=_['filter'](_0x21595e,{'isApp':0x1});var _0x460e94=_['groupBy'](_0x4eb39d,'exten');var _0x27a0a6=['queue',_0x948a('0xc')];var _0x5c3a5f=[];var _0x578d21=[];for(var _0x4c310a in _0x460e94){if(_0x460e94['hasOwnProperty'](_0x4c310a)){_0x5dab3a['priority']=0x2;_0x5dab3a[_0x948a('0xd')]=[];_0x5dab3a['extension']=_[_0x948a('0xe')](_0x33be62,{'exten':_0x460e94[_0x4c310a][0x0][_0x948a('0x9')]});_0x5dab3a[_0x948a('0xd')][_0x948a('0xf')]({'type':_0x460e94[_0x4c310a][0x0][_0x948a('0x10')],'app':_0x948a('0x11'),'appdata':util[_0x948a('0x12')](_0x948a('0x13'),_0x460e94[_0x4c310a][0x0][_0x948a('0x10')]),'context':_0x460e94[_0x4c310a][0x0][_0x948a('0x14')],'exten':_0x460e94[_0x4c310a][0x0][_0x948a('0x9')],'priority':_0x5dab3a['priority']++,'VoiceExtensionId':_0x460e94[_0x4c310a][0x0][_0x948a('0x15')]});if(_0x460e94[_0x4c310a][0x0][_0x948a('0x10')]==='inbound'){_0x5dab3a[_0x948a('0xd')][_0x948a('0xf')]({'type':_0x460e94[_0x4c310a][0x0][_0x948a('0x10')],'app':'Set','appdata':_0x948a('0x16')+_0x460e94[_0x4c310a][0x0][_0x948a('0x15')],'context':_0x460e94[_0x4c310a][0x0]['context'],'exten':_0x460e94[_0x4c310a][0x0][_0x948a('0x9')],'priority':_0x5dab3a[_0x948a('0x17')]++,'VoiceExtensionId':_0x460e94[_0x4c310a][0x0][_0x948a('0x15')]});}else if(_0x460e94[_0x4c310a][0x0]['type']===_0x948a('0x18')){if(_0x5dab3a['extension']){_0x5dab3a[_0x948a('0xd')][_0x948a('0xf')]({'type':_0x460e94[_0x4c310a][0x0]['type'],'app':_0x948a('0x11'),'appdata':_0x948a('0x19')+(_0x5dab3a['extension']['cutdigits']?_0x948a('0x1a')+_0x5dab3a['extension'][_0x948a('0x1b')]+'}':_0x948a('0x1c')),'context':_0x460e94[_0x4c310a][0x0][_0x948a('0x14')],'exten':_0x460e94[_0x4c310a][0x0][_0x948a('0x9')],'priority':_0x5dab3a[_0x948a('0x17')]++,'VoiceExtensionId':_0x460e94[_0x4c310a][0x0][_0x948a('0x15')]});}_0x5dab3a['extensions']['push']({'type':_0x460e94[_0x4c310a][0x0]['type'],'app':_0x948a('0x11'),'appdata':'CDR(routeid)='+_0x460e94[_0x4c310a][0x0][_0x948a('0x15')],'context':_0x460e94[_0x4c310a][0x0][_0x948a('0x14')],'exten':_0x460e94[_0x4c310a][0x0][_0x948a('0x9')],'priority':_0x5dab3a['priority']++,'VoiceExtensionId':_0x460e94[_0x4c310a][0x0][_0x948a('0x15')]});var _0x69461d=_0x5dab3a['priority']++;_0x5dab3a[_0x948a('0xd')][_0x948a('0xf')]({'type':_0x460e94[_0x4c310a][0x0]['type'],'app':_0x948a('0x1d'),'appdata':_0x948a('0x1e')+(_0x69461d+0x2)+_0x948a('0x1f')+(_0x69461d+0x1)+')','context':_0x460e94[_0x4c310a][0x0][_0x948a('0x14')],'exten':_0x460e94[_0x4c310a][0x0][_0x948a('0x9')],'priority':_0x69461d,'VoiceExtensionId':_0x460e94[_0x4c310a][0x0][_0x948a('0x15')]});if(_0x5dab3a[_0x948a('0x20')]){_0x5dab3a[_0x948a('0xd')][_0x948a('0xf')]({'type':_0x460e94[_0x4c310a][0x0][_0x948a('0x10')],'app':'Set','appdata':_0x5dab3a[_0x948a('0x20')][_0x948a('0x1b')]?_0x948a('0x21')+_0x5dab3a[_0x948a('0x20')]['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x460e94[_0x4c310a][0x0][_0x948a('0x14')],'exten':_0x460e94[_0x4c310a][0x0][_0x948a('0x9')],'priority':_0x5dab3a[_0x948a('0x17')]++,'VoiceExtensionId':_0x460e94[_0x4c310a][0x0][_0x948a('0x15')]});}_0x5dab3a['extensions'][_0x948a('0xf')]({'type':_0x460e94[_0x4c310a][0x0][_0x948a('0x10')],'app':_0x948a('0x11'),'appdata':'outboundrouteid='+_0x460e94[_0x4c310a][0x0]['VoiceExtensionId'],'context':_0x460e94[_0x4c310a][0x0]['context'],'exten':_0x460e94[_0x4c310a][0x0][_0x948a('0x9')],'priority':_0x5dab3a[_0x948a('0x17')]++,'VoiceExtensionId':_0x460e94[_0x4c310a][0x0][_0x948a('0x15')]});if(_0x5dab3a[_0x948a('0x20')]&&_0x5dab3a[_0x948a('0x20')][_0x948a('0x22')]('recordingFormat')&&_0x5dab3a[_0x948a('0x20')][_0x948a('0x23')]!==_0x948a('0x24')){_0x5dab3a[_0x948a('0xd')][_0x948a('0xf')]({'type':_0x460e94[_0x4c310a][0x0][_0x948a('0x10')],'app':_0x948a('0x11'),'appdata':_0x948a('0x25'),'context':_0x460e94[_0x4c310a][0x0][_0x948a('0x14')],'exten':_0x460e94[_0x4c310a][0x0][_0x948a('0x9')],'priority':_0x5dab3a[_0x948a('0x17')]++,'VoiceExtensionId':_0x460e94[_0x4c310a][0x0][_0x948a('0x15')]});_0x5dab3a[_0x948a('0xd')][_0x948a('0xf')]({'type':_0x460e94[_0x4c310a][0x0][_0x948a('0x10')],'app':'Set','appdata':_0x948a('0x26')+_0x5dab3a['extension']['recordingFormat']||_0x948a('0x27'),'context':_0x460e94[_0x4c310a][0x0][_0x948a('0x14')],'exten':_0x460e94[_0x4c310a][0x0][_0x948a('0x9')],'priority':_0x5dab3a[_0x948a('0x17')]++,'VoiceExtensionId':_0x460e94[_0x4c310a][0x0]['VoiceExtensionId']});}}_0x5dab3a[_0x948a('0xd')][_0x948a('0xf')]({'type':_0x460e94[_0x4c310a][0x0]['type'],'app':_0x948a('0x11'),'appdata':_0x948a('0x28'),'context':_0x460e94[_0x4c310a][0x0][_0x948a('0x14')],'exten':_0x460e94[_0x4c310a][0x0]['exten'],'priority':_0x5dab3a[_0x948a('0x17')]++,'VoiceExtensionId':_0x460e94[_0x4c310a][0x0][_0x948a('0x15')]});_0x5dab3a['extensions'][_0x948a('0xf')]({'type':_0x460e94[_0x4c310a][0x0][_0x948a('0x10')],'app':_0x948a('0x11'),'appdata':_0x948a('0x29'),'context':_0x460e94[_0x4c310a][0x0][_0x948a('0x14')],'exten':_0x460e94[_0x4c310a][0x0][_0x948a('0x9')],'priority':_0x5dab3a[_0x948a('0x17')]++,'VoiceExtensionId':_0x460e94[_0x4c310a][0x0][_0x948a('0x15')]});_0x5dab3a[_0x948a('0xd')]['push']({'type':_0x460e94[_0x4c310a][0x0][_0x948a('0x10')],'app':_0x948a('0x11'),'appdata':_0x948a('0x2a'),'context':_0x460e94[_0x4c310a][0x0]['context'],'exten':_0x460e94[_0x4c310a][0x0]['exten'],'priority':_0x5dab3a[_0x948a('0x17')]++,'VoiceExtensionId':_0x460e94[_0x4c310a][0x0][_0x948a('0x15')]});for(var _0x27c05f=0x0,_0x14ac93=0x0;_0x27c05f<_0x460e94[_0x4c310a][_0x948a('0x2b')];_0x27c05f+=0x1,_0x14ac93=0x0){var _0x3006a1=_0x460e94[_0x4c310a][_0x27c05f];if(_0x3006a1[_0x948a('0x10')]){_0x3006a1[_0x948a('0x10')]=_0x3006a1[_0x948a('0x10')][_0x948a('0x2c')]();}var _0x48a274=[];var _0x4b3e60=[];delete _0x3006a1['id'];delete _0x3006a1[_0x948a('0x2d')];delete _0x3006a1['updatedAt'];var _0x4b8030=_0x3006a1[_0x948a('0x2e')]!==_0x948a('0x2f')?[_0x3006a1['interval']]:_0x3006a1[_0x948a('0x6')]?_[_0x948a('0x30')](_[_0x948a('0xb')](_0x5dab3a[_0x948a('0x4')],{'IntervalId':_0x3006a1[_0x948a('0x6')]}),_0x948a('0x2e')):[];if(_0x3006a1['hasOwnProperty']('tag')){if(_0x3006a1[_0x948a('0x31')]&&_0x3006a1['tag']!=='--'){_0x48a274[_0x948a('0xf')]({'type':_0x3006a1[_0x948a('0x10')],'app':_0x948a('0x11'),'appdata':'CDR(tag)='+_0x3006a1['tag'],'context':_0x3006a1[_0x948a('0x14')],'exten':_0x3006a1['exten'],'priority':_0x4b8030['length']+_0x5dab3a['priority']+_0x14ac93++,'VoiceExtensionId':_0x3006a1[_0x948a('0x15')]});}}if(_0x3006a1[_0x948a('0x10')]==='outbound'&&_0x3006a1[_0x948a('0x22')](_0x948a('0x32'))){if(_0x3006a1[_0x948a('0x32')]){_0x48a274['push']({'type':_0x3006a1['type'],'app':_0x948a('0x1d'),'appdata':_0x948a('0x33')+_0x3006a1['callerID']+')','context':_0x3006a1[_0x948a('0x14')],'exten':_0x3006a1['exten'],'priority':_0x4b8030[_0x948a('0x2b')]+_0x5dab3a[_0x948a('0x17')]+_0x14ac93++,'VoiceExtensionId':_0x3006a1[_0x948a('0x15')]});}else{_0x48a274[_0x948a('0xf')]({'type':_0x3006a1['type'],'app':_0x948a('0x1d'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x3006a1[_0x948a('0x14')],'exten':_0x3006a1[_0x948a('0x9')],'priority':_0x4b8030[_0x948a('0x2b')]+_0x5dab3a['priority']+_0x14ac93++,'VoiceExtensionId':_0x3006a1[_0x948a('0x15')]});}}if(_0x3006a1['hasOwnProperty'](_0x948a('0x34'))){if(_0x27a0a6[_0x948a('0x35')](_0x3006a1['app'][_0x948a('0x2c')]())>=0x0&&_0x3006a1['appType']!==_0x948a('0x36')){if(_0x3006a1[_0x948a('0x34')]){_0x48a274[_0x948a('0xf')]({'type':_0x3006a1[_0x948a('0x10')],'app':_0x948a('0x1d'),'appdata':_0x948a('0x37'),'context':_0x3006a1['context'],'exten':_0x3006a1[_0x948a('0x9')],'priority':_0x4b8030[_0x948a('0x2b')]+_0x5dab3a[_0x948a('0x17')]+_0x14ac93++,'VoiceExtensionId':_0x3006a1[_0x948a('0x15')]});_0x48a274[_0x948a('0xf')]({'type':_0x3006a1[_0x948a('0x10')],'app':_0x948a('0x11'),'appdata':_0x948a('0x38'),'context':_0x3006a1[_0x948a('0x14')],'exten':_0x3006a1['exten'],'priority':_0x4b8030[_0x948a('0x2b')]+_0x5dab3a[_0x948a('0x17')]+_0x14ac93++,'VoiceExtensionId':_0x3006a1[_0x948a('0x15')]});}else{_0x48a274['push']({'type':_0x3006a1[_0x948a('0x10')],'app':'ExecIf','appdata':_0x948a('0x39'),'context':_0x3006a1[_0x948a('0x14')],'exten':_0x3006a1['exten'],'priority':_0x4b8030[_0x948a('0x2b')]+_0x5dab3a['priority']+_0x14ac93++,'VoiceExtensionId':_0x3006a1[_0x948a('0x15')]});_0x48a274[_0x948a('0xf')]({'type':_0x3006a1['type'],'app':_0x948a('0x11'),'appdata':_0x948a('0x3a'),'context':_0x3006a1[_0x948a('0x14')],'exten':_0x3006a1[_0x948a('0x9')],'priority':_0x4b8030[_0x948a('0x2b')]+_0x5dab3a[_0x948a('0x17')]+_0x14ac93++,'VoiceExtensionId':_0x3006a1[_0x948a('0x15')]});}}}for(var _0x582ca3=0x0;_0x582ca3<_0x4b8030[_0x948a('0x2b')];_0x582ca3+=0x1){var _0x4f01cd=_0x5dab3a['priority']+_0x4b8030[_0x948a('0x2b')];var _0x2493a7=_0x582ca3===_0x4b8030['length']-0x1?_0x5dab3a[_0x948a('0x17')]+_0x48a274[_0x948a('0x2b')]+_0x4b3e60['length']+0x2:_0x5dab3a[_0x948a('0x17')]+_0x582ca3+0x1;_0x48a274[_0x948a('0x3b')](_0x582ca3,0x0,{'type':_0x3006a1['type'],'app':_0x948a('0x3c'),'appdata':_0x4b8030[_0x582ca3]+'?'+_0x3006a1[_0x948a('0x14')]+_0x948a('0x3d')+_0x4f01cd+':'+_0x3006a1[_0x948a('0x14')]+_0x948a('0x3d')+_0x2493a7,'exten':_0x3006a1[_0x948a('0x9')],'context':_0x3006a1[_0x948a('0x14')],'priority':_0x5dab3a['priority']+_0x582ca3,'VoiceExtensionId':_0x460e94[_0x4c310a][0x0][_0x948a('0x15')]});}_0x3006a1[_0x948a('0x17')]=_0x48a274['length']?_[_0x948a('0x3e')](_0x48a274)[_0x948a('0x17')]+0x1:_0x5dab3a[_0x948a('0x17')];_0x5dab3a[_0x948a('0x17')]=(_0x4b3e60['length']?_[_0x948a('0x3e')](_0x4b3e60)['priority']:_0x3006a1['priority'])+0x1;_0x5dab3a[_0x948a('0xd')]=_[_0x948a('0x3f')](_0x5dab3a[_0x948a('0xd')],_0x48a274,[_0x3006a1],_0x4b3e60);}_0x5dab3a['extensions'][_0x948a('0xf')]({'type':_0x460e94[_0x4c310a][0x0][_0x948a('0x10')],'app':'Hangup','exten':_0x460e94[_0x4c310a][0x0][_0x948a('0x9')],'context':_0x460e94[_0x4c310a][0x0][_0x948a('0x14')],'priority':_0x5dab3a[_0x948a('0x17')],'VoiceExtensionId':_0x460e94[_0x4c310a][0x0][_0x948a('0x15')]});_0x5c3a5f[_0x948a('0xf')](_0x460e94[_0x4c310a][0x0][_0x948a('0x15')]);_0x578d21=_['concat'](_0x578d21,_0x5dab3a[_0x948a('0xd')]);}}return _0x481003['transaction'](function(_0xbc6571){return _0x481003['models'][_0x948a('0x5')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x5c3a5f}},'transaction':_0xbc6571})[_0x948a('0x7')](function(_0x58e73a){return _0x481003[_0x948a('0x2')][_0x948a('0x5')]['bulkCreate'](_[_0x948a('0x40')](_0x578d21,'priority'),{'transaction':_0xbc6571});});});})[_0x948a('0x41')](function(_0x482da5){console[_0x948a('0x42')](_0x482da5);});}exports[_0x948a('0x43')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 7335775..c758419 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 _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 +var _0xbded=['fromQuery','scheduledAt','ContactId','ListId','updatedAt','select','field','NOW()','toString','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','createdAt','from','id\x20IN\x20?','str','calleridnum','\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','dialCheckDuplicateType','get','always','sequelize','query','VoiceQueueId','catch','onlyIfOpen','all','outbound','CmList','BlackLists','Campaign','Lists','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','stringify','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','undefined','argv','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','insert','into','cm_hopper'];(function(_0x5a0eff,_0x4e3613){var _0x40f4d6=function(_0x2eb934){while(--_0x2eb934){_0x5a0eff['push'](_0x5a0eff['shift']());}};_0x40f4d6(++_0x4e3613);}(_0xbded,0x194));var _0xdbde=function(_0x3bb0d4,_0xe492ec){_0x3bb0d4=_0x3bb0d4-0x0;var _0x269be3=_0xbded[_0x3bb0d4];return _0x269be3;};'use strict';var BPromise=require(_0xdbde('0x0'));var util=require(_0xdbde('0x1'));var _=require(_0xdbde('0x2'));var fs=require('fs');var squel=require(_0xdbde('0x3'));var Papa=require(_0xdbde('0x4'));var Redis=require(_0xdbde('0x5'));var db=require(_0xdbde('0x6'))['db'];var config=require(_0xdbde('0x7'));var logger=require('../../../config/logger')(_0xdbde('0x8'));config[_0xdbde('0x9')]=_[_0xdbde('0xa')](config['redis'],{'host':_0xdbde('0xb'),'port':0x18eb});var socket=require(_0xdbde('0xc'))(new Redis(config[_0xdbde('0x9')]));require(_0xdbde('0xd'))[_0xdbde('0xe')](socket);try{if(!process['argv'][0x2]||process['argv'][0x2]===_0xdbde('0xf')||process[_0xdbde('0x10')][0x2]==='null'){throw new Error(_0xdbde('0x11'));}var FILEPATH=process[_0xdbde('0x10')][0x2];if(!process['argv'][0x3]||process[_0xdbde('0x10')][0x3]==='undefined'||process[_0xdbde('0x10')][0x3]===_0xdbde('0x12')||!process['argv'][0x4]||process['argv'][0x4]===_0xdbde('0xf')||process[_0xdbde('0x10')][0x4]==='null'){throw new Error(_0xdbde('0x13'));}var FIELDS=_[_0xdbde('0x14')](process['argv'][0x3][_0xdbde('0x15')](','),process['argv'][0x4][_0xdbde('0x15')](','));if(!process[_0xdbde('0x10')][0x5]||process[_0xdbde('0x10')][0x5]==='undefined'||process[_0xdbde('0x10')][0x5]==='null'){throw new Error(_0xdbde('0x16'));}var LISTID=process[_0xdbde('0x10')][0x5];var COMPANYID=process[_0xdbde('0x10')][0x6]&&process['argv'][0x6]!==_0xdbde('0xf')&&process['argv'][0x6]!==_0xdbde('0x12')?process[_0xdbde('0x10')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0xdbde('0x10')][0x7]!==_0xdbde('0xf')&&process['argv'][0x7]!==_0xdbde('0x12')?process[_0xdbde('0x10')][0x7]:null;if(!process['argv'][0x8]||process[_0xdbde('0x10')][0x8]===_0xdbde('0xf')||process['argv'][0x8]===_0xdbde('0x12')){throw new Error(_0xdbde('0x17'));}var SOCKET_TIMESTAMP=process[_0xdbde('0x10')][0x8];}catch(_0x9d6d36){logger['error'](_0x9d6d36);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(_0x27f579,_0x254ab9,_0x42d8d4,_0x5d27e8){var _0x4833d2={'message':_0x254ab9};_0x4833d2[_0x27f579]=!![];if(_0x42d8d4){_0x4833d2[_0xdbde('0x18')]=_0x42d8d4;}if(_0x5d27e8){_0x4833d2[_0xdbde('0x19')]=_0x5d27e8;}return _0x4833d2;}function isEmail(_0x120bb3){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))*$/[_0xdbde('0x1a')](_0x120bb3);}function checkRow(_0xe1e2ae,_0x14af87,_0x500c71){return new BPromise(function(_0x2aa293,_0x3b4f76){if(_[_0xdbde('0x1b')](_0xe1e2ae)){return _0x3b4f76(handleCheckRowError(_0xdbde('0x1c'),_0xdbde('0x1d'),null,_0x500c71));}if(_0xe1e2ae[_0xdbde('0x1e')]&&_0xe1e2ae[_0xdbde('0x1e')][_0xdbde('0x1f')]){var _0x1518fa=_['map'](_0xe1e2ae[_0xdbde('0x1e')],_0xdbde('0x20'))['join'](';');return _0x3b4f76(handleCheckRowError(_0xdbde('0x1c'),_0x1518fa,null,_0x500c71));}var _0x34d0c8={};for(var _0x5ec888 in FIELDS){if(FIELDS[_0xdbde('0x21')](_0x5ec888)&&FIELDS[_0x5ec888]){_0x34d0c8[_0x5ec888]=_0xe1e2ae[_0xdbde('0x22')][0x0][FIELDS[_0x5ec888]]||_0xe1e2ae[_0xdbde('0x22')][0x0]['\ufeff'+FIELDS[_0x5ec888]];}}if(!_0x34d0c8[_0xdbde('0x23')]){return _0x3b4f76(handleCheckRowError('error',_0xdbde('0x24'),null,_0x500c71));}if(!_0x34d0c8[_0xdbde('0x25')]){return _0x3b4f76(handleCheckRowError('error',_0xdbde('0x26'),null,_0x500c71));}if(_0x34d0c8[_0xdbde('0x27')]){var _0x10c034=moment(_0x34d0c8[_0xdbde('0x27')],_0xdbde('0x28'));if(!_0x10c034[_0xdbde('0x29')]()){return _0x3b4f76(handleCheckRowError(_0xdbde('0x1c'),_0xdbde('0x2a'),null,_0x500c71));}}if(_0x34d0c8['email']){if(!isEmail(_0x34d0c8[_0xdbde('0x2b')])){return _0x3b4f76(handleCheckRowError(_0xdbde('0x1c'),'email\x20format\x20is\x20not\x20valid!',null,_0x500c71));}}_0x34d0c8['ListId']=LISTID;_0x34d0c8[_0xdbde('0x2c')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xdbde('0x1f')]&&_0x14af87){var _0x3fe663={};for(var _0x2e840a=0x0,_0x5614ba=DUPLICATES[_0xdbde('0x1f')];_0x2e840a<_0x5614ba;_0x2e840a+=0x1){_0x3fe663[DUPLICATES[_0x2e840a]]=_0x34d0c8[DUPLICATES[_0x2e840a]];}var _0x2d49b7=_[_0xdbde('0x2d')](_0x14af87,_0x3fe663);if(_0x2d49b7){return _0x3b4f76(handleCheckRowError(_0xdbde('0x2e'),_0xdbde('0x2f'),_0x2d49b7,_0x500c71));}}return db[_0xdbde('0x30')]['create'](_0x34d0c8,{'raw':!![],'hooks':![],'fields':_[_0xdbde('0x31')](_0x34d0c8)})[_0xdbde('0x32')](function(_0x42cecf){if(DUPLICATES&&DUPLICATES[_0xdbde('0x1f')]&&_0x14af87){_0x14af87[_0xdbde('0x33')](_[_0xdbde('0x34')](_0x34d0c8,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x42cecf['id'];return _0x2aa293();})['catch'](function(_0x3409b3){return _0x3b4f76(handleCheckRowError('error',_0xdbde('0x35')+(_0x3409b3[_0xdbde('0x20')]||JSON['stringify'](_0x3409b3)),null,_0x500c71));});});}function checkHopper(){function _0x2193e4(){return function(_0x4a8a0a){logger[_0xdbde('0x1c')](_0xdbde('0x36'),_0xdbde('0x37'),util[_0xdbde('0x38')](_0x4a8a0a,{'showHidden':![],'depth':null}));};}var _0x25772d=function(_0x3c81c6,_0x1b0402){var _0x4f5e88=squel[_0xdbde('0x39')]()[_0xdbde('0x3a')](_0xdbde('0x3b'))[_0xdbde('0x3c')]([_0xdbde('0x25'),_0xdbde('0x3d'),_0xdbde('0x3e'),_0xdbde('0x3f'),_0x1b0402,'createdAt',_0xdbde('0x40')],squel[_0xdbde('0x41')]()[_0xdbde('0x42')](_0xdbde('0x25'),'phone')['field'](_0xdbde('0x43'),'scheduledAt')[_0xdbde('0x42')]('id','ContactId')[_0xdbde('0x42')](LISTID[_0xdbde('0x44')](),_0xdbde('0x3f'))['field'](_0x3c81c6['id']['toString'](),_0x1b0402)[_0xdbde('0x42')](_0xdbde('0x43'),'createdAt')[_0xdbde('0x42')](_0xdbde('0x43'),_0xdbde('0x40'))['from'](_0xdbde('0x45'))[_0xdbde('0x46')](_0xdbde('0x47'))['where'](_0xdbde('0x48'),LISTID[_0xdbde('0x44')]())['where'](_0xdbde('0x49'))[_0xdbde('0x46')](_0xdbde('0x4a'),squel['select']()[_0xdbde('0x42')]('phone')['from'](_0xdbde('0x3b'))[_0xdbde('0x46')](_0x1b0402+'\x20=\x20?',_0x3c81c6['id'][_0xdbde('0x44')]())))[_0xdbde('0x44')]();return _0x4f5e88;};var _0x499742=function(_0x5e0a56,_0x287741){var _0x5131c6=squel[_0xdbde('0x39')]()[_0xdbde('0x3a')](_0xdbde('0x3b'))[_0xdbde('0x3c')]([_0xdbde('0x25'),_0xdbde('0x3d'),_0xdbde('0x3e'),_0xdbde('0x3f'),_0x287741,_0xdbde('0x4b'),_0xdbde('0x40')],squel[_0xdbde('0x41')]()[_0xdbde('0x42')](_0xdbde('0x25'),_0xdbde('0x25'))[_0xdbde('0x42')]('NOW()','scheduledAt')[_0xdbde('0x42')]('id',_0xdbde('0x3e'))[_0xdbde('0x42')](LISTID[_0xdbde('0x44')](),_0xdbde('0x3f'))[_0xdbde('0x42')](_0x5e0a56['id'][_0xdbde('0x44')](),_0x287741)[_0xdbde('0x42')](_0xdbde('0x43'),'createdAt')[_0xdbde('0x42')](_0xdbde('0x43'),'updatedAt')[_0xdbde('0x4c')]('cm_contacts')[_0xdbde('0x46')](_0xdbde('0x47'))[_0xdbde('0x46')](_0xdbde('0x48'),LISTID[_0xdbde('0x44')]())[_0xdbde('0x46')](_0xdbde('0x4d'),squel[_0xdbde('0x4e')](hopperContacts))['where'](_0xdbde('0x49'))[_0xdbde('0x46')](_0xdbde('0x4a'),squel[_0xdbde('0x41')]()[_0xdbde('0x42')](_0xdbde('0x4f'))[_0xdbde('0x4c')]('cm_hopper_final')[_0xdbde('0x46')](_0x287741+_0xdbde('0x50'),_0x5e0a56['id'][_0xdbde('0x44')]()))[_0xdbde('0x46')](_0xdbde('0x4a'),squel[_0xdbde('0x41')]()[_0xdbde('0x42')](_0xdbde('0x25'))[_0xdbde('0x4c')](_0xdbde('0x3b'))['where'](_0x287741+_0xdbde('0x50'),_0x5e0a56['id'][_0xdbde('0x44')]())))[_0xdbde('0x44')]();return _0x5131c6;};function _0x53cc4a(_0x19c402,_0x5568f5){var _0x235739=squel[_0xdbde('0x39')]()[_0xdbde('0x3a')]('cm_hopper')['fromQuery'](['phone',_0xdbde('0x3d'),'ContactId',_0xdbde('0x3f'),_0x5568f5,_0xdbde('0x4b'),_0xdbde('0x40')],squel[_0xdbde('0x41')]()[_0xdbde('0x42')]('phone',_0xdbde('0x25'))[_0xdbde('0x42')](_0xdbde('0x43'),_0xdbde('0x3d'))[_0xdbde('0x42')]('id','ContactId')[_0xdbde('0x42')](LISTID['toString'](),'ListId')[_0xdbde('0x42')](_0x19c402['id'][_0xdbde('0x44')](),_0x5568f5)[_0xdbde('0x42')](_0xdbde('0x43'),_0xdbde('0x4b'))[_0xdbde('0x42')](_0xdbde('0x43'),_0xdbde('0x40'))[_0xdbde('0x4c')](_0xdbde('0x45'))[_0xdbde('0x46')](_0xdbde('0x47'))[_0xdbde('0x46')](_0xdbde('0x48'),LISTID[_0xdbde('0x44')]())['where']('id\x20IN\x20?',squel['str'](hopperContacts))[_0xdbde('0x46')](_0xdbde('0x49')))[_0xdbde('0x44')]();return _0x235739;}function _0x4ee335(_0x2a5e94,_0x35f153){var _0x45ca9c=squel['insert']()[_0xdbde('0x3a')](_0xdbde('0x51'))[_0xdbde('0x3c')]([_0xdbde('0x25'),_0xdbde('0x3e'),'ListId',_0x35f153,'createdAt',_0xdbde('0x40')],squel['select']()[_0xdbde('0x42')](_0xdbde('0x25'),_0xdbde('0x25'))['field']('id',_0xdbde('0x3e'))[_0xdbde('0x42')](LISTID[_0xdbde('0x44')](),_0xdbde('0x3f'))[_0xdbde('0x42')](_0x2a5e94['id'][_0xdbde('0x44')](),_0x35f153)[_0xdbde('0x42')](_0xdbde('0x43'),_0xdbde('0x4b'))[_0xdbde('0x42')](_0xdbde('0x43'),'updatedAt')[_0xdbde('0x4c')](_0xdbde('0x45'))[_0xdbde('0x46')](_0xdbde('0x47'))[_0xdbde('0x46')](_0xdbde('0x48'),LISTID[_0xdbde('0x44')]())[_0xdbde('0x46')]('id\x20IN\x20?',squel[_0xdbde('0x4e')](hopperContacts))[_0xdbde('0x46')](_0xdbde('0x49')))[_0xdbde('0x44')]();return _0x45ca9c;}return db[_0xdbde('0x52')][_0xdbde('0x53')]({'where':{'type':'outbound'},'attributes':['id',_0xdbde('0x54')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0xdbde('0x32')](function(_0x10e507){var _0x1f5e28=[];if(_0x10e507){var _0x44433e;for(var _0x38e76d=0x0,_0xf658f4;_0x38e76d<_0x10e507['length'];_0x38e76d+=0x1){_0xf658f4=_0x10e507[_0x38e76d][_0xdbde('0x55')]({'plain':!![]});switch(_0xf658f4['dialCheckDuplicateType']){case _0xdbde('0x56'):_0x1f5e28[_0xdbde('0x33')](db[_0xdbde('0x57')][_0xdbde('0x58')](_0x499742(_0xf658f4,_0xdbde('0x59')))['then'](function(){})[_0xdbde('0x5a')](_0x2193e4()));break;case _0xdbde('0x5b'):_0x1f5e28[_0xdbde('0x33')](db[_0xdbde('0x57')]['query'](_0x25772d(_0xf658f4,_0xdbde('0x59')))['then'](function(){})[_0xdbde('0x5a')](_0x2193e4()));break;default:_0x1f5e28[_0xdbde('0x33')](db[_0xdbde('0x57')][_0xdbde('0x58')](_0x53cc4a(_0xf658f4,_0xdbde('0x59')))['then'](function(){})['catch'](_0x2193e4()));}}}return _0x1f5e28;})[_0xdbde('0x5c')]()[_0xdbde('0x32')](function(){return db[_0xdbde('0x52')][_0xdbde('0x53')]({'where':{'type':_0xdbde('0x5d')},'attributes':['id'],'include':[{'model':db[_0xdbde('0x5e')],'as':_0xdbde('0x5f'),'where':{'id':LISTID}}]})[_0xdbde('0x32')](function(_0x4145f0){var _0x53ce46=[];if(_0x4145f0){var _0x32ebc2;for(var _0x853b8a=0x0,_0x29beff;_0x853b8a<_0x4145f0[_0xdbde('0x1f')];_0x853b8a+=0x1){_0x29beff=_0x4145f0[_0x853b8a][_0xdbde('0x55')]({'plain':!![]});_0x53ce46[_0xdbde('0x33')](db[_0xdbde('0x57')][_0xdbde('0x58')](_0x4ee335(_0x29beff,_0xdbde('0x59')))[_0xdbde('0x32')](function(){})[_0xdbde('0x5a')](_0x2193e4()));}}return _0x53ce46;})[_0xdbde('0x5c')]();})[_0xdbde('0x32')](function(){return db[_0xdbde('0x60')][_0xdbde('0x53')]({'attributes':['id',_0xdbde('0x54')],'include':[{'model':db[_0xdbde('0x5e')],'as':_0xdbde('0x61'),'where':{'id':LISTID}}]})[_0xdbde('0x32')](function(_0x35a62e){var _0x5ff885=[];if(_0x35a62e){for(var _0x24300a=0x0,_0x48e2e4;_0x24300a<_0x35a62e['length'];_0x24300a+=0x1){_0x48e2e4=_0x35a62e[_0x24300a][_0xdbde('0x55')]({'plain':!![]});switch(_0x48e2e4[_0xdbde('0x54')]){case _0xdbde('0x56'):_0x5ff885[_0xdbde('0x33')](db[_0xdbde('0x57')][_0xdbde('0x58')](_0x499742(_0x48e2e4,_0xdbde('0x62')))[_0xdbde('0x32')](function(){})[_0xdbde('0x5a')](_0x2193e4()));break;case'onlyIfOpen':_0x5ff885[_0xdbde('0x33')](db[_0xdbde('0x57')]['query'](_0x25772d(_0x48e2e4,_0xdbde('0x62')))[_0xdbde('0x32')](function(){})[_0xdbde('0x5a')](_0x2193e4()));break;default:_0x5ff885[_0xdbde('0x33')](db[_0xdbde('0x57')][_0xdbde('0x58')](_0x53cc4a(_0x48e2e4,_0xdbde('0x62')))[_0xdbde('0x32')](function(){})[_0xdbde('0x5a')](_0x2193e4()));}}}return _0x5ff885;})[_0xdbde('0x5c')]();})['then'](function(){return db[_0xdbde('0x60')][_0xdbde('0x53')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xdbde('0x5f'),'where':{'id':LISTID}}]})[_0xdbde('0x32')](function(_0xe614cd){var _0x1dacfe=[];if(_0xe614cd){for(var _0x4c8238=0x0,_0x186ba5;_0x4c8238<_0xe614cd['length'];_0x4c8238+=0x1){_0x186ba5=_0xe614cd[_0x4c8238][_0xdbde('0x55')]({'plain':!![]});_0x1dacfe['push'](db[_0xdbde('0x57')][_0xdbde('0x58')](_0x4ee335(_0x186ba5,_0xdbde('0x62')))[_0xdbde('0x32')](function(){})[_0xdbde('0x5a')](_0x2193e4()));}}return _0x1dacfe;})[_0xdbde('0x5c')]();})[_0xdbde('0x5a')](function(_0x47a645){logger[_0xdbde('0x1c')](_0xdbde('0x63'),'generalCheckHopper',_0x47a645[_0xdbde('0x20')]);});}var processPromises=function(_0x4ed10d){return BPromise['all'](promises)[_0xdbde('0x32')](function(_0x31e226){})[_0xdbde('0x5a')](function(_0x3f5ef6){logger['error'](_0xdbde('0x64'),JSON[_0xdbde('0x65')](_0x3f5ef6));})[_0xdbde('0x66')](function(){socket[_0xdbde('0x67')](_0xdbde('0x68')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4ed10d){return _0x4ed10d[_0xdbde('0x69')]();}});};var endCsv=function(){return BPromise[_0xdbde('0x6a')]()[_0xdbde('0x32')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xdbde('0x67')](_0xdbde('0x68')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xdbde('0x6b')](FILEPATH);}catch(_0xccdd75){logger[_0xdbde('0x1c')](_0xdbde('0x6c'),JSON[_0xdbde('0x65')](_0xccdd75));}finally{process['exit'](0x0);}});};process['on'](_0xdbde('0x6d'),function(){logger[_0xdbde('0x6e')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xdbde('0x6a')]()[_0xdbde('0x32')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xdbde('0x15')](',');return db['CmContact'][_0xdbde('0x53')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x40c2c8){var _0x566f92=fs[_0xdbde('0x6f')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xdbde('0x70')](_0x566f92,{'header':!![],'skipEmptyLines':!![],'step':function(_0x365118,_0x2943ce){total+=0x1;var _0x3900ac=total;promises[_0xdbde('0x33')](checkRow(_0x365118,_0x40c2c8,_0x3900ac)[_0xdbde('0x32')](function(){success+=0x1;})['catch'](function(_0x5c2016){if(_0x5c2016[_0xdbde('0x1c')]){errors+=0x1;delete _0x5c2016['error'];}else if(_0x5c2016[_0xdbde('0x2e')]){duplicates+=0x1;delete _0x5c2016[_0xdbde('0x2e')];}rows['push'](_0x5c2016);}));if(total%0xc8===0x0){_0x2943ce[_0xdbde('0x71')]();return processPromises(_0x2943ce);}},'complete':function(){return processPromises()[_0xdbde('0x32')](function(){logger[_0xdbde('0x6e')](_0xdbde('0x72'));endCsv();});},'error':function(_0x5f2655,_0x4fffdb){logger[_0xdbde('0x6e')]('CSV\x20parse\x20error',JSON['stringify'](_0x5f2655));endCsv();}});})[_0xdbde('0x5a')](function(_0x10c3ab){logger[_0xdbde('0x1c')](_0xdbde('0x73'),JSON[_0xdbde('0x65')](_0x10c3ab));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index e4a458a..ff4c361 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 _0xc00b=['test','select','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','length','all','split','filter','CmContactHasItem','findOne','update','updated','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.UserId','into','cm_hopper','fromQuery','phone','scheduledat','ContactId','createdAt','updatedAt','priority','UserId','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.createdAt','insert','cm_hopper_black','ListId','cm_contacts.createdAt\x20=\x20?','field','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.priority','\x22onlyIfOpen\x22','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','code','query','spread','push','catch','campaigns.id','campaigns.dialTimezone','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','sequelize','timezones','dialTimezone','isNil','utcOffset','set','offset','main','binding','clone','root','server/files/tmp','.csv','keys','includes','header','name','_description','parse','data','rows','find','hasOwnProperty','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','email','YYYY-MM-DD','firstName','\x20not\x20specified','trim','itemTypeId','description','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','campaigns_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','orderBy','voice_queues','VoiceQueueId','CampaignId','campaigns_has_cm_blacklists','campaigns','voice_queues_has_cm_blacklists','finish','affectedRows','emit','unlink','complete','argv','arguments\x20\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\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','binding','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','lodash','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/environment/shared','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','CmContact','AdditionalPhones','then','length','push','split','all','filter','CmContactHasItem','findOne','update','updated','PHONE','inserted','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','insert','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','UserId','fields','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_hopper_black','cm_contacts','cm_contacts.ListId\x20=\x20','.id\x20=\x20','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.updatedAt','scheduledat','priority','recallme','into','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_hopper_additional_phones'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9012,0x6c));var _0x2901=function(_0x13b330,_0x297092){_0x13b330=_0x13b330-0x0;var _0x1f666c=_0x9012[_0x13b330];return _0x1f666c;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x2901('0x0'));var Papa=require('papaparse');var util=require('util');var BPromise=require(_0x2901('0x1'));var moment=require(_0x2901('0x2'));var squel=require(_0x2901('0x3'));var Redis=require(_0x2901('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x2901('0x5'));var shared=require(_0x2901('0x6'));var logger=require('../../../config/logger')(_0x2901('0x7'));config[_0x2901('0x8')]=_[_0x2901('0x9')](config[_0x2901('0x8')],{'host':_0x2901('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2901('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x2901('0xb')](_0x2901('0xc'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x2901('0xb')](_0x2901('0xc'));function isEmail(_0x4a5291){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'](_0x4a5291);}function selectNotIn(_0x28a3e3,_0x13dd39,_0x16bfd9,_0x416444,_0xe09588){return squel[_0x2901('0xd')]()[_0x2901('0xe')](_0x2901('0xf'))[_0x2901('0x10')](_0x416444)['join'](_0x13dd39,null,_0x13dd39+'.id\x20=\x20'+_0x416444+'.'+_0x16bfd9)[_0x2901('0x11')](_0x416444+'.'+_0x16bfd9+_0x2901('0x12')+_0x28a3e3+'.'+_0x16bfd9)['where'](_0x13dd39+_0x2901('0x13')+_0xe09588[_0x2901('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4bad33,_0x4ef76f){promisesAdditionalPhones=[];return db[_0x2901('0x15')]['findAll']({'raw':!![],'attributes':['id',_0x2901('0x16')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x2901('0x17')](function(_0x401593){if(_0x401593!==null){var _0x1ae9d5=[];for(var _0x49fba3=0x0;_0x49fba3<_0x401593[_0x2901('0x18')];_0x49fba3++){var _0x1a5c2e=_0x401593[_0x49fba3];_0x1ae9d5[_0x2901('0x19')](insertAdditionalPhones(_0x1a5c2e));}}Promise['all'](_0x1ae9d5)[_0x2901('0x17')](function(){_0x4bad33({'val':0x1});});});});}function insertAdditionalPhones(_0x54a829){return new Promise(function(_0x5ed38a,_0x394384){var _0x458202=_0x54a829['AdditionalPhones'];var _0x217aaf=_0x458202[_0x2901('0x1a')](';');var _0x4eeb71=[];orderBy=0x0;for(var _0xa98927=0x0;_0xa98927<_0x217aaf[_0x2901('0x18')];_0xa98927++){_0x4eeb71[_0x2901('0x19')](splitAdditionalPhone(_0x54a829['id'],_0x217aaf[_0xa98927]));}Promise[_0x2901('0x1b')](_0x4eeb71)[_0x2901('0x17')](function(){_0x5ed38a({'val':_0x217aaf[_0x2901('0x18')]});});});}function splitAdditionalPhone(_0x464b84,_0x142350){return new Promise(function(_0xf3530e,_0x169352){var _0x1e6745=_0x142350['split'](':');var _0x4a76f6=_0x1e6745[0x0];var _0x4b5058=_0x1e6745[0x1];if(!_['isNil'](_0x4b5058)){var _0xabf58f=_0x4b5058['split']('|');var _0x35ecb7=[];for(var _0x2fadae=0x0;_0x2fadae<_0xabf58f['length'];_0x2fadae++){if(_0xabf58f[_0x2fadae]!==''){var _0x4ee893=_[_0x2901('0x1c')](promisesAdditionalPhones,{'contactId':_0x464b84,'phone':_0xabf58f[_0x2fadae]});if(_0x4ee893[_0x2901('0x18')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x464b84,'contactTypeId':_0x4a76f6,'phone':_0xabf58f[_0x2fadae],'orderBy':orderBy});}}}_0xf3530e({'ok':0x1});}else _0xf3530e({'res':0x0});});}function createAdditionalPhone(_0x915be1,_0x26d033,_0x4eb595,_0x4f7302){var _0x2c5e0a='';var _0x10e47e='';var _0x5d7d8f=_0x4eb595[_0x2901('0x1a')]('§');_0x2c5e0a=_0x5d7d8f[0x0];if(_0x5d7d8f[_0x2901('0x18')]==0x2)_0x10e47e=_0x5d7d8f[0x1];return new Promise(function(_0x41fdbf,_0x539e4e){return db[_0x2901('0x1d')][_0x2901('0x1e')]({'where':{'CmContactId':_0x915be1,'item':_0x2c5e0a}})['then'](function(_0x1174e5){if(_0x1174e5){return db[_0x2901('0x1d')][_0x2901('0x1f')]({'ItemTypeId':_0x26d033,'description':_0x10e47e,'OrderBy':_0x4f7302},{'where':{'CmContactId':_0x915be1,'item':_0x2c5e0a}})[_0x2901('0x17')](function(_0xee1838){_0x41fdbf({'res':_0x2901('0x20')});});}else{return db[_0x2901('0x1d')]['create']({'CmContactId':_0x915be1,'item':_0x2c5e0a,'description':_0x10e47e,'ItemTypeId':_0x26d033,'OrderBy':_0x4f7302,'ItemClass':_0x2901('0x21')})[_0x2901('0x17')](function(_0xda953c){_0x41fdbf({'res':_0x2901('0x22')});});}});});}function insertCmHopper(_0x2a46f1,_0x548161,_0xc51d8c,_0x2b1869,_0x254802){var _0x12fbdb=[_0x2901('0x23'),'cm_contacts.scheduledat',_0x2901('0x24'),_0x2901('0x25'),_0x548161+'.'+_0x2b1869,_0x2901('0x26'),'cm_contacts.updatedAt',_0x2901('0x27'),'cm_contacts.UserId','\x22'+_0x254802+'\x22'];return squel[_0x2901('0x28')]()['into'](_0x2901('0x29'))[_0x2901('0x2a')]([_0x2901('0xf'),'scheduledat',_0x2901('0x2b'),_0x2901('0x2c'),_0x2b1869,_0x2901('0x2d'),_0x2901('0x2e'),'priority',_0x2901('0x2f'),'recallme'],squel[_0x2901('0xd')]()[_0x2901('0x30')](_0x12fbdb)[_0x2901('0x10')](_0x548161)[_0x2901('0x14')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x548161+_0x2901('0x31'))[_0x2901('0x14')](_0xc51d8c,null,_0xc51d8c+'.id\x20=\x20'+_0x548161+'.'+_0x2b1869)['where'](_0x548161+_0x2901('0x32'),_0x2a46f1)[_0x2901('0x11')](_0x2901('0x33'),NOW)[_0x2901('0x11')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x548161,_0xc51d8c,_0x2b1869,_0x2901('0x29'),['\x22always\x22',_0x2901('0x34')]))['where'](_0x2901('0x35'),selectNotIn(_0x548161,_0xc51d8c,_0x2b1869,_0x2901('0x29'),[_0x2901('0x36')])))[_0x2901('0x37')]();}function insertCmHopperBlack(_0x27530b,_0x1cd725,_0x31f51e,_0x54b017){var _0x2e82a3=['cm_contacts.phone','cm_contacts.id',_0x2901('0x25'),_0x1cd725+'.'+_0x54b017,_0x2901('0x26'),'cm_contacts.updatedAt'];return squel[_0x2901('0x28')]()['into'](_0x2901('0x38'))['fromQuery']([_0x2901('0xf'),'ContactId',_0x2901('0x2c'),_0x54b017,'createdAt',_0x2901('0x2e')],squel[_0x2901('0xd')]()[_0x2901('0x30')](_0x2e82a3)[_0x2901('0x10')](_0x1cd725)[_0x2901('0x14')](_0x2901('0x39'),null,_0x2901('0x3a')+_0x1cd725+_0x2901('0x31'))['join'](_0x31f51e,null,_0x31f51e+_0x2901('0x3b')+_0x1cd725+'.'+_0x54b017)['where'](_0x1cd725+_0x2901('0x32'),_0x27530b)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x2901('0x11')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x2901('0xe')](_0x2901('0xf'))[_0x2901('0x10')](_0x2901('0x38'))['where'](_0x2901('0x3c'),_0x27530b)['where'](_0x54b017+_0x2901('0x12')+_0x1cd725+'.'+_0x54b017)))[_0x2901('0x37')]();}function insertTzCmHopper(_0x2f9b27,_0x3a87e9,_0x842b53,_0x3180d6,_0x2ccced,_0x302bd5){var _0x59a60f=[_0x2901('0x23'),_0x2901('0x3d')+_0x302bd5+_0x2901('0x3e'),'cm_contacts.id',_0x2901('0x25'),_0x3a87e9+'.'+_0x3180d6,_0x2901('0x26'),_0x2901('0x3f'),_0x2901('0x27'),'cm_contacts.UserId','\x22'+_0x2ccced+'\x22'];var _0x2373e7=squel['insert']()['into'](_0x2901('0x29'))[_0x2901('0x2a')]([_0x2901('0xf'),_0x2901('0x40'),_0x2901('0x2b'),_0x2901('0x2c'),_0x3180d6,_0x2901('0x2d'),_0x2901('0x2e'),_0x2901('0x41'),_0x2901('0x2f'),_0x2901('0x42')],squel[_0x2901('0xd')]()[_0x2901('0x30')](_0x59a60f)[_0x2901('0x10')](_0x3a87e9)[_0x2901('0x14')]('cm_contacts',null,_0x2901('0x3a')+_0x3a87e9+'.CmListId')[_0x2901('0x14')](_0x842b53,null,_0x842b53+_0x2901('0x3b')+_0x3a87e9+'.'+_0x3180d6)[_0x2901('0x14')](_0x302bd5,null,_0x302bd5+_0x2901('0x3b')+_0x3a87e9+'.'+_0x3180d6)['where'](_0x3a87e9+'.CmListId\x20=\x20?',_0x2f9b27)[_0x2901('0x11')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x2901('0x11')](_0x2901('0x35'),selectNotIn(_0x3a87e9,_0x842b53,_0x3180d6,_0x2901('0x29'),[_0x2901('0x36'),_0x2901('0x34')]))[_0x2901('0x11')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3a87e9,_0x842b53,_0x3180d6,'cm_hopper',[_0x2901('0x36')])))['toString']();return _0x2373e7;}function insertTzCmHopperBlack(_0xd298a7,_0x1b82f3,_0x9909f0,_0x1590ed){var _0x1a2d27=[_0x2901('0x23'),'cm_contacts.id',_0x2901('0x25'),_0x1b82f3+'.'+_0x1590ed,_0x2901('0x26'),_0x2901('0x3f')];return squel['insert']()[_0x2901('0x43')](_0x2901('0x38'))[_0x2901('0x2a')]([_0x2901('0xf'),_0x2901('0x2b'),_0x2901('0x2c'),_0x1590ed,'createdAt',_0x2901('0x2e')],squel['select']()[_0x2901('0x30')](_0x1a2d27)[_0x2901('0x10')](_0x1b82f3)['join'](_0x2901('0x39'),null,_0x2901('0x3a')+_0x1b82f3+'.CmListId')['join'](_0x9909f0,null,_0x9909f0+_0x2901('0x3b')+_0x1b82f3+'.'+_0x1590ed)[_0x2901('0x11')](_0x1b82f3+_0x2901('0x32'),_0xd298a7)['where'](_0x2901('0x33'),NOW)[_0x2901('0x11')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x2901('0xe')](_0x2901('0xf'))['from'](_0x2901('0x38'))[_0x2901('0x11')](_0x2901('0x3c'),_0xd298a7)[_0x2901('0x11')](_0x1590ed+_0x2901('0x12')+_0x1b82f3+'.'+_0x1590ed)))[_0x2901('0x37')]();}function insertCmHopperAdditionalPhones(_0x4a1444){var _0x3b99c4=['cm_hopper.id',_0x2901('0x44'),'cm_contact_has_items.OrderBy',_0x2901('0x45'),'cm_contact_has_items.updatedAt'];return squel[_0x2901('0x28')]()[_0x2901('0x43')](_0x2901('0x46'))[_0x2901('0x2a')]([_0x2901('0x47'),'phone','OrderBy','createdAt',_0x2901('0x2e')],squel[_0x2901('0xd')]()[_0x2901('0x30')](_0x3b99c4)['from'](_0x2901('0x29'))[_0x2901('0x14')](_0x2901('0x39'),null,_0x2901('0x48'))[_0x2901('0x14')](_0x2901('0x49'),null,_0x2901('0x4a'))['where'](_0x2901('0x4b'),_0x4a1444)[_0x2901('0x11')](_0x2901('0x33'),NOW))['toString']();}function insertCmContact(_0x5aca03,_0x329d61,_0x1c1e05,_0x58c18d){var _0x477781=_[_0x2901('0x4c')](_[_0x2901('0x4d')](_0x58c18d),['ListId',_0x2901('0x4e'),_0x2901('0x2d'),'updatedAt','scheduledAt']);return squel[_0x2901('0x28')]()[_0x2901('0x43')](_0x2901('0x39'))['fromQuery'](_0x477781,squel[_0x2901('0xd')]()[_0x2901('0x30')](_0x477781)[_0x2901('0x10')](_0x329d61)[_0x2901('0x11')]('('+_0x1c1e05['join'](',')+_0x2901('0x4f'),squel[_0x2901('0xd')]()['fields'](_0x1c1e05)['from']('cm_contacts')[_0x2901('0x11')](_0x2901('0x3c'),_0x5aca03)[_0x2901('0x11')](_0x2901('0x50')))['where'](_0x2901('0x51'),squel[_0x2901('0xd')]()['field'](_0x2901('0x52'),'min_id')[_0x2901('0x10')](_0x329d61)[_0x2901('0x53')](_0x1c1e05[_0x2901('0x14')](','))))['toString']();}function handleStop(){logger[_0x2901('0x54')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x5bbedd){logger[_0x2901('0x55')](_0x5bbedd[_0x2901('0x56')]);process['exit'](0x1);}function handleError(_0x2929bd,_0x2f228f){stats[_0x2901('0x57')][_0x2901('0x19')]({'name':_0x2f228f[_0x2901('0x58')],'message':_0x2f228f[_0x2901('0x56')],'row':_0x2929bd});}function handleQuery(_0x306957){logger[_0x2901('0x54')](_0x306957);return db[_0x2901('0x59')][_0x2901('0x5a')](_0x306957)['spread'](function(_0x186632){results[_0x2901('0x19')](_0x186632);})[_0x2901('0x5b')](function(_0x480b57){logger[_0x2901('0x55')](_0x480b57[_0x2901('0x56')]);});}function updateTzCampaigns(_0x57d8ed){return new Promise(function(_0x14ae2e,_0x55b364){var _0x2d0287=squel[_0x2901('0xd')]()[_0x2901('0x30')]([_0x2901('0x5c'),_0x2901('0x5d')])[_0x2901('0x10')]('campaigns')[_0x2901('0x14')](_0x2901('0x5e'),null,_0x2901('0x5f'))[_0x2901('0x11')](_0x2901('0x60')+_0x57d8ed);db[_0x2901('0x59')]['query'](_0x2d0287[_0x2901('0x37')]())[_0x2901('0x61')](function(_0x1c8f93){var _0x116d6f=[];for(var _0x149b6a=0x0;_0x149b6a<_0x1c8f93[_0x2901('0x18')];_0x149b6a++){_0x116d6f['push'](getTimezoneData(_0x1c8f93[_0x149b6a],tmp_campaigns));}BPromise[_0x2901('0x1b')](_0x116d6f)[_0x2901('0x17')](function(){_0x14ae2e({'val':0x1});});})['catch'](function(_0x78c30e){logger[_0x2901('0x55')](_0x78c30e[_0x2901('0x56')]);_0x14ae2e({'val':0x0});});});}function updateTzVoiceQueues(_0x4510f4){return new Promise(function(_0x270851,_0x40ff93){var _0x156646=squel[_0x2901('0xd')]()[_0x2901('0x30')]([_0x2901('0x62'),_0x2901('0x63')])[_0x2901('0x10')](_0x2901('0x64'))[_0x2901('0x14')](_0x2901('0x65'),null,_0x2901('0x66'))[_0x2901('0x11')](_0x2901('0x67')+_0x4510f4);db[_0x2901('0x59')][_0x2901('0x5a')](_0x156646[_0x2901('0x37')]())[_0x2901('0x61')](function(_0x24ef7e){var _0x26b596=[];for(var _0x567816=0x0;_0x567816<_0x24ef7e[_0x2901('0x18')];_0x567816++){_0x26b596[_0x2901('0x19')](getTimezoneData(_0x24ef7e[_0x567816],tmp_voice_queues));}BPromise['all'](_0x26b596)[_0x2901('0x17')](function(){_0x270851({'val':0x1});});})[_0x2901('0x5b')](function(_0x54ab7b){logger['error'](_0x54ab7b[_0x2901('0x56')]);_0x270851({'val':0x0});});});}function getTimezoneData(_0x49cad3,_0x15345b){return new Promise(function(_0x3d4c62,_0x532c6b){var _0x41ae19=shared[_0x2901('0x68')];var _0x5558c4=_0x41ae19[_0x49cad3[_0x2901('0x69')]];if(_[_0x2901('0x6a')](_0x5558c4)){_0x3d4c62({'ret':0x1});}else{var _0x5005e1=_0x5558c4[_0x2901('0x6b')];var _0x3cf00e=squel['insert']()[_0x2901('0x43')](_0x15345b)[_0x2901('0x6c')]('id',_0x49cad3['id'])[_0x2901('0x6c')](_0x2901('0x6d'),_0x5005e1)[_0x2901('0x6c')]('dialTimezone',_0x49cad3['dialTimezone'])[_0x2901('0x37')]();return db['sequelize'][_0x2901('0x5a')](_0x3cf00e)['spread'](function(_0x2aa87f){_0x3d4c62({'ret':0x1});})['catch'](function(_0x466a41){logger[_0x2901('0x55')](_0x466a41['message']);_0x532c6b({'ret':0x1});});}});}function handleTZQuery(_0x16fa7a){logger[_0x2901('0x54')](_0x16fa7a);return db['sequelize'][_0x2901('0x5a')](_0x16fa7a)[_0x2901('0x61')](function(_0x339cb3){})[_0x2901('0x5b')](function(_0x25ad70){logger[_0x2901('0x55')](_0x25ad70[_0x2901('0x56')]);});}function main(_0x2a68ad,_0x26a877,_0x27f9ef,_0x424deb){logger['info'](_0x2901('0x6e'),_0x2a68ad,JSON['stringify'](_0x26a877));process[_0x2901('0x6f')](_0x2901('0x70'));var _0x6e6854=_0x26a877['binding'];var _0x35947c=_[_0x2901('0x71')](_0x6e6854);var _0x52f985=_0x26a877[_0x2901('0x72')];var _0x79739c=path['join'](config['root'],_0x2901('0x73'),_0x52f985+'.csv');hasTZ=_[_0x2901('0x4d')](_0x6e6854)[_0x2901('0x74')]('dialTimezone');var _0x21df4b=_[_0x2901('0x4d')](_0x6e6854)[_0x2901('0x14')]();logger[_0x2901('0x54')]('header',_0x21df4b);db[_0x2901('0x75')]['findAll']({'raw':!![],'attributes':['id',_0x2901('0x76')]})[_0x2901('0x17')](function(_0x37f8c2){for(var _0x132e6b=0x0;_0x132e6b<_0x37f8c2[_0x2901('0x18')];_0x132e6b++){if(_0x37f8c2[_0x132e6b][_0x2901('0x76')]in _0x6e6854){contactItemTypes[_0x2901('0x19')](_0x37f8c2[_0x132e6b]);delete _0x35947c[_0x37f8c2[_0x132e6b][_0x2901('0x76')]];hasAdditionalPhones=!![];}for(var _0x12de32 in _0x6e6854){if(_0x37f8c2[_0x132e6b][_0x2901('0x76')]+_0x2901('0x77')===_0x12de32){phoneDescriptions[_0x2901('0x19')]({'itemTypeId':_0x37f8c2[_0x132e6b]['id'],'description':_0x12de32});delete _0x35947c[_0x12de32];}}}if(hasAdditionalPhones)_0x35947c[_0x2901('0x16')]='';var _0x364e43=_[_0x2901('0x4d')](_0x35947c)[_0x2901('0x14')]();logger[_0x2901('0x54')](_0x2901('0x78'),_0x364e43);fs[_0x2901('0x79')](_0x79739c,_0x364e43+'\x0a');Papa['parse'](fs['createReadStream'](_0x2a68ad),{'header':!![],'skipEmptyLines':!![],'step':function(_0x137652,_0x17f991){try{for(var _0x56ceb3=0x0,_0x53239f=[];_0x56ceb3<_0x137652[_0x2901('0x7a')][_0x2901('0x18')];_0x56ceb3++){stats[_0x2901('0x7b')]+=0x1;if(_0x137652[_0x2901('0x57')][_0x56ceb3]){handleError(_0x137652['data'][_0x56ceb3],_0x137652[_0x2901('0x57')][_0x56ceb3]);}else{var _0x37bd7a=[];var _0x319a72=[];var _0x5c5842={};for(var _0x554ffb in _0x6e6854){let _0x4ff4dd=contactItemTypes[_0x2901('0x7c')](_0x5c148f=>_0x5c148f[_0x2901('0x76')]===_0x554ffb);let _0x5e9931=contactItemTypes[_0x2901('0x7c')](_0x5af174=>_0x5af174['name']+_0x2901('0x77')===_0x554ffb);if(_[_0x2901('0x6a')](_0x4ff4dd)&&_[_0x2901('0x6a')](_0x5e9931)){if(_0x6e6854['hasOwnProperty'](_0x554ffb)){if(_0x137652['data'][_0x56ceb3][_0x6e6854[_0x554ffb]]){var _0x29f1e8=_[_0x2901('0x7d')](_0x137652[_0x2901('0x7a')][_0x56ceb3][_0x6e6854[_0x554ffb]][_0x2901('0x7e')](/"/g,'\x27'));switch(_0x554ffb){case _0x2901('0x40'):var _0x445c39=moment(_0x29f1e8,_0x2901('0xc'),!![]);if(_0x445c39[_0x2901('0x7f')]()){_0x53239f[_0x2901('0x19')]('\x22'+_0x29f1e8+'\x22');}else{_0x37bd7a[_0x2901('0x19')](_0x2901('0x80'));}break;case _0x2901('0x41'):var _0x4b7636=parseInt(_0x29f1e8);_0x29f1e8=_[_0x2901('0x81')](_0x4b7636)||_0x4b7636<0x0||_0x4b7636>0x4?_0x424deb?0x3:0x2:_0x4b7636;_0x53239f[_0x2901('0x19')]('\x22'+_0x29f1e8+'\x22');break;case _0x2901('0x2f'):var _0x2bff09=parseInt(_0x29f1e8);if(_[_0x2901('0x82')](_0x2bff09)&&_[_0x2901('0x74')](_0x27f9ef,_0x2bff09)){_0x53239f[_0x2901('0x19')]('\x22'+_0x2bff09+'\x22');}else{_0x37bd7a[_0x2901('0x19')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x29f1e8)){_0x53239f[_0x2901('0x19')]('\x22'+_0x29f1e8+'\x22');}else{_0x37bd7a['push'](_0x2901('0x83'));}break;case _0x2901('0x84'):var _0x4ab137=moment(_0x29f1e8,_0x2901('0x85'),!![]);if(_0x4ab137['isValid']()){_0x53239f[_0x2901('0x19')]('\x22'+_0x29f1e8+'\x22');}else{_0x37bd7a['push'](_0x2901('0x86'));}break;case _0x2901('0x69'):var _0x405652=shared['timezones'];var _0x516b2f=_0x405652[_0x29f1e8];if(!_[_0x2901('0x6a')](_0x516b2f)){var _0x24ede0=_0x516b2f[_0x2901('0x6b')];_0x53239f[_0x2901('0x19')]('\x22'+_0x29f1e8+'\x22');_0x53239f['push']('\x22'+_0x24ede0+'\x22');}break;default:_0x53239f[_0x2901('0x19')]('\x22'+_0x29f1e8+'\x22');}}else{switch(_0x554ffb){case _0x2901('0x87'):case _0x2901('0xf'):_0x37bd7a['push'](_0x554ffb+_0x2901('0x88'));break;default:_0x53239f[_0x2901('0x19')]('\x22\x22');}}}}else{var _0x4a7847='';if(!_[_0x2901('0x6a')](_0x4ff4dd)){if(!_0x5c5842['hasOwnProperty'](_0x4ff4dd['id'])){if(!_[_0x2901('0x6a')](_0x137652[_0x2901('0x7a')][_0x56ceb3][_0x6e6854[_0x554ffb]])){var _0x29f1e8=_['trim'](_0x137652['data'][_0x56ceb3][_0x6e6854[_0x554ffb]][_0x2901('0x7e')](/"/g,'\x27'));var _0x1a887a=phoneDescriptions[_0x2901('0x7c')](_0x3239d6=>_0x3239d6['itemTypeId']===_0x4ff4dd['id']);if(!_[_0x2901('0x6a')](_0x1a887a)){var _0x10de5d=_[_0x2901('0x7d')](_0x137652['data'][_0x56ceb3][_0x6e6854[_0x1a887a[_0x2901('0x89')]]][_0x2901('0x7e')](/"/g,'\x27'));if(!_['isNil'](_0x10de5d))_0x29f1e8=_0x29f1e8+'§'+_0x10de5d;}if(_0x4a7847=='')_0x4a7847=_0x29f1e8;else _0x4a7847+='|'+_0x29f1e8;}_0x319a72[_0x2901('0x19')](_0x4ff4dd['id']+':'+_0x4a7847);_0x5c5842[_0x4ff4dd['id']]=0x1;}}}}if(hasAdditionalPhones){_0x53239f['push']('\x22'+_0x319a72['join'](';')+'\x22');}if(_0x37bd7a[_0x2901('0x18')]){handleError(_0x137652[_0x2901('0x7a')][_0x56ceb3],{'code':'SystemRow','message':_0x37bd7a[_0x2901('0x14')]()});}else{fs[_0x2901('0x8a')](_0x79739c,_0x53239f[_0x2901('0x14')]()+'\x0a');}_0x53239f=[];}if(!(stats[_0x2901('0x7b')]%0xc8)){socket[_0x2901('0x8b')](_0x2901('0x8c')+_0x52f985,stats);stats[_0x2901('0x57')]=[];}}if(stopped){logger[_0x2901('0x54')](_0x2901('0x8d'));_0x17f991[_0x2901('0x8e')]();}}catch(_0x6c952a){handleError(_0x137652[_0x2901('0x7a')][_0x56ceb3],{'code':'SystemError','message':_0x6c952a[_0x2901('0x56')]});logger[_0x2901('0x55')](_0x2901('0x8f'),_0x6c952a[_0x2901('0x56')]);}},'complete':function(){try{var _0x4ae550=[];var _0x3b3c5f=[];var _0x17cc5a=_0x2901('0x39');if(_0x26a877[_0x2901('0x90')]&&_0x26a877[_0x2901('0x90')][_0x2901('0x18')]){_0x17cc5a='cm_contacts_'+_0x52f985;_0x4ae550[_0x2901('0x19')](_0x2901('0x91')+_0x17cc5a+_0x2901('0x92'));}tmp_campaigns='campaigns_'+_0x52f985;tmp_voice_queues=_0x2901('0x93')+_0x52f985;_0x3b3c5f['push'](_0x2901('0x91')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x3b3c5f[_0x2901('0x19')](_0x2901('0x91')+tmp_voice_queues+_0x2901('0x94'));BPromise[_0x2901('0x95')](_0x3b3c5f,handleTZQuery)[_0x2901('0x17')](function(_0x554fbd){updateTzCampaigns(_0x26a877[_0x2901('0x2c')])[_0x2901('0x17')](function(_0x5638d7){updateTzVoiceQueues(_0x26a877[_0x2901('0x2c')])[_0x2901('0x17')](function(_0x1cc4b0){if(hasTZ)_0x364e43=_0x364e43[_0x2901('0x7e')](_0x2901('0x69'),_0x2901('0x96'));var _0x59652e=util[_0x2901('0xb')](_0x2901('0x97'),_0x79739c,_0x17cc5a,_0x364e43,_0x26a877[_0x2901('0x2c')],_0x26a877[_0x2901('0x4e')]||null,NOW,NOW);if(_[_0x2901('0x6a')](_0x6e6854[_0x2901('0x40')])){_0x59652e+=_0x2901('0x98');}_0x4ae550['push'](_0x59652e);if(_0x26a877[_0x2901('0x90')]&&_0x26a877[_0x2901('0x90')]['length']){_0x4ae550['push'](insertCmContact(_0x26a877[_0x2901('0x2c')],_0x17cc5a,_0x26a877[_0x2901('0x90')],_0x6e6854));_0x4ae550[_0x2901('0x19')](_0x2901('0x99')+_0x17cc5a+';');}BPromise[_0x2901('0x95')](_0x4ae550,handleQuery)[_0x2901('0x17')](function(_0x19cb05){BPromise['all']([handleAdditionalPhones()])[_0x2901('0x17')](function(){_0x4ae550=[];for(var _0x497a79=0x0;_0x497a79_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 +var _0x3fce=['localhost','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','format','YYYYMMDDHHmmss','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','query','select\x20*\x20from\x20','length','isNil','push','all','error','message','AdditionalPhones','split','then','filter','CmContactHasItem','findOne','updated','create','PHONE','inserted','CmContact','CmHopper','update','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','scheduledat','ListId','createdAt','updatedAt','priority','UserId','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone','cm_contacts.id','cm_hopper_black','fields','ListId\x20=\x20?','\x20=\x20?','toString','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_hopper_additional_phones','fromQuery','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys','CompanyId','id\x20IN\x20?','exit','code','info','sequelize','spread','catch','main','stringify','send','binding','server/files/tmp','.csv','body','findAll','name','_description','header','writeFileSync','parse','createReadStream','data','errors','find','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','includes','agent\x20not\x20exists','email','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','description','appendFileSync','emit','Abort\x20parser','abort','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','finish','affectedRows','contact:import:','unlink','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','util','bluebird','moment','squel','ioredis','redis','defaults'];(function(_0x3dc538,_0x4f7702){var _0x72c2fd=function(_0x5a7260){while(--_0x5a7260){_0x3dc538['push'](_0x3dc538['shift']());}};_0x72c2fd(++_0x4f7702);}(_0x3fce,0x121));var _0xe3fc=function(_0x2a99e2,_0x1803e4){_0x2a99e2=_0x2a99e2-0x0;var _0x23fb5f=_0x3fce[_0x2a99e2];return _0x23fb5f;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xe3fc('0x0'));var Papa=require(_0xe3fc('0x1'));var util=require(_0xe3fc('0x2'));var BPromise=require(_0xe3fc('0x3'));var moment=require(_0xe3fc('0x4'));var squel=require(_0xe3fc('0x5'));var Redis=require(_0xe3fc('0x6'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')('import');config[_0xe3fc('0x7')]=_[_0xe3fc('0x8')](config['redis'],{'host':_0xe3fc('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe3fc('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0xe3fc('0xa'));var tempTableName=_0xe3fc('0xb')+moment()[_0xe3fc('0xc')](_0xe3fc('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x182656){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'](_0x182656);}function selectNotIn(_0x52b9ee,_0x339045,_0x37514d,_0x2c66e1,_0x5aeab2){return squel[_0xe3fc('0xe')]()[_0xe3fc('0xf')](_0xe3fc('0x10'))[_0xe3fc('0x11')](_0x2c66e1)[_0xe3fc('0x12')](_0x339045,null,_0x339045+_0xe3fc('0x13')+_0x2c66e1+'.'+_0x37514d)[_0xe3fc('0x14')](_0x2c66e1+'.'+_0x37514d+'\x20=\x20'+_0x52b9ee+'.'+_0x37514d)[_0xe3fc('0x14')](_0x339045+_0xe3fc('0x15')+_0x5aeab2['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3f7ae2,_0x3d437f){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0xe3fc('0x16')](_0xe3fc('0x17')+tempTableName)['spread'](function(_0x4fa4d4){if(_0x4fa4d4!==null){var _0x5953ac=[];for(var _0x27b618=0x0;_0x27b618<_0x4fa4d4[_0xe3fc('0x18')];_0x27b618++){var _0x2f8cc9=_0x4fa4d4[_0x27b618];if(!_['isNil'](_0x2f8cc9['phone'])){if(!_[_0xe3fc('0x19')](_0x2f8cc9['AdditionalPhones']))_0x5953ac[_0xe3fc('0x1a')](insertAdditionalPhones(_0x2f8cc9));promisesContact[_0xe3fc('0x1a')]({'contact':_0x2f8cc9});}}}Promise[_0xe3fc('0x1b')](_0x5953ac)['then'](function(){_0x3f7ae2({'val':0x1});});})['catch'](function(_0x42140f){logger[_0xe3fc('0x1c')](_0x42140f[_0xe3fc('0x1d')]);});});}function insertAdditionalPhones(_0x5e74ab){return new Promise(function(_0x4472f7,_0xfac19f){var _0x498bd3=_0x5e74ab[_0xe3fc('0x1e')];if(_[_0xe3fc('0x19')](_0x498bd3))_0xfac19f({'val':0x0});else{var _0x55bc5a=_0x498bd3[_0xe3fc('0x1f')](';');var _0x457cef=[];orderBy=0x0;for(var _0x1e307a=0x0;_0x1e307a<_0x55bc5a['length'];_0x1e307a++){_0x457cef['push'](splitAdditionalPhone(_0x5e74ab['id'],_0x55bc5a[_0x1e307a]));}Promise[_0xe3fc('0x1b')](_0x457cef)[_0xe3fc('0x20')](function(){_0x4472f7({'val':_0x55bc5a['length']});});}});}function splitAdditionalPhone(_0x383f19,_0x2e9322){return new Promise(function(_0x3a8071,_0x177a14){var _0x47b2d6=_0x2e9322[_0xe3fc('0x1f')](':');var _0x54e294=_0x47b2d6[0x0];var _0x507656=_0x47b2d6[0x1];if(_0x507656!==''){var _0x5abdb3=_0x507656['split']('|');var _0x51dc35=[];for(var _0x16045e=0x0;_0x16045e<_0x5abdb3[_0xe3fc('0x18')];_0x16045e++){if(_0x5abdb3[_0x16045e]!==''){var _0x5d1cc3=_[_0xe3fc('0x21')](promisesAdditionalPhones,{'contactId':_0x383f19,'phone':_0x5abdb3[_0x16045e]});if(_0x5d1cc3[_0xe3fc('0x18')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x383f19,'contactTypeId':_0x54e294,'phone':_0x5abdb3[_0x16045e],'orderBy':orderBy});}}}_0x3a8071({'ok':0x1});}else _0x3a8071({'res':0x0});});}function createAdditionalPhone(_0x46f549,_0xc40376,_0x1ecb86,_0x3bc101){var _0x3d173e='';var _0x21ccdd='';var _0x396685=_0x1ecb86[_0xe3fc('0x1f')]('§');_0x3d173e=_0x396685[0x0];if(_0x396685[_0xe3fc('0x18')]==0x2)_0x21ccdd=_0x396685[0x1];return new Promise(function(_0xbb0f17,_0x30a897){return db[_0xe3fc('0x22')][_0xe3fc('0x23')]({'where':{'CmContactId':_0x46f549,'item':_0x3d173e}})[_0xe3fc('0x20')](function(_0x38ab54){if(_0x38ab54){return db[_0xe3fc('0x22')]['update']({'ItemTypeId':_0xc40376,'description':_0x21ccdd,'OrderBy':_0x3bc101},{'where':{'CmContactId':_0x46f549,'item':_0x3d173e}})[_0xe3fc('0x20')](function(_0x2f910e){_0xbb0f17({'res':_0xe3fc('0x24')});});}else{return db['CmContactHasItem'][_0xe3fc('0x25')]({'CmContactId':_0x46f549,'item':_0x3d173e,'ItemTypeId':_0xc40376,'description':_0x21ccdd,'OrderBy':_0x3bc101,'ItemClass':_0xe3fc('0x26')})[_0xe3fc('0x20')](function(_0x4a6202){_0xbb0f17({'res':_0xe3fc('0x27')});});}});});}function updateContact(_0x30c178){return new Promise(function(_0x41927b,_0x20ac90){var _0x3ebd5d=_0x30c178['id'];delete _0x30c178['id'];return db[_0xe3fc('0x28')]['update'](_0x30c178,{'where':{'id':_0x3ebd5d}})[_0xe3fc('0x20')](function(_0x3bb70d){updatedRows+=0x1;return db[_0xe3fc('0x29')][_0xe3fc('0x2a')]({'phone':_0x30c178[_0xe3fc('0x10')]},{'where':{'ContactId':_0x3ebd5d}})[_0xe3fc('0x20')](function(_0x411086){_0x41927b({'ret':'OK'});});});});}function insertCmHopper(_0x888634,_0x260cd3,_0x11c271,_0x794f2,_0x25edfd){var _0x24dae1=['cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id',_0xe3fc('0x2b'),_0x260cd3+'.'+_0x794f2,_0xe3fc('0x2c'),_0xe3fc('0x2d'),_0xe3fc('0x2e'),_0xe3fc('0x2f'),'\x22'+_0x25edfd+'\x22'];return squel[_0xe3fc('0x30')]()[_0xe3fc('0x31')](_0xe3fc('0x32'))['fromQuery']([_0xe3fc('0x10'),_0xe3fc('0x33'),'ContactId',_0xe3fc('0x34'),_0x794f2,_0xe3fc('0x35'),_0xe3fc('0x36'),_0xe3fc('0x37'),_0xe3fc('0x38'),'recallme'],squel[_0xe3fc('0xe')]()['fields'](_0x24dae1)['from'](_0x260cd3)[_0xe3fc('0x12')](_0xe3fc('0x39'),null,'cm_contacts.ListId\x20=\x20'+_0x260cd3+_0xe3fc('0x3a'))[_0xe3fc('0x12')](_0x11c271,null,_0x11c271+_0xe3fc('0x13')+_0x260cd3+'.'+_0x794f2)[_0xe3fc('0x14')](_0x260cd3+_0xe3fc('0x3b'),_0x888634)[_0xe3fc('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xe3fc('0x14')](_0xe3fc('0x3c'),selectNotIn(_0x260cd3,_0x11c271,_0x794f2,_0xe3fc('0x32'),[_0xe3fc('0x3d'),_0xe3fc('0x3e')]))['where'](_0xe3fc('0x3c'),selectNotIn(_0x260cd3,_0x11c271,_0x794f2,_0xe3fc('0x32'),[_0xe3fc('0x3d')])))['toString']();}function insertCmHopperBlack(_0x4506e5,_0x5c7518,_0x38aed5,_0x3bf7da){var _0x428116=[_0xe3fc('0x3f'),_0xe3fc('0x40'),'cm_contacts.ListId',_0x5c7518+'.'+_0x3bf7da,_0xe3fc('0x2c'),_0xe3fc('0x2d')];return squel[_0xe3fc('0x30')]()[_0xe3fc('0x31')](_0xe3fc('0x41'))['fromQuery']([_0xe3fc('0x10'),'ContactId','ListId',_0x3bf7da,'createdAt',_0xe3fc('0x36')],squel[_0xe3fc('0xe')]()[_0xe3fc('0x42')](_0x428116)[_0xe3fc('0x11')](_0x5c7518)[_0xe3fc('0x12')](_0xe3fc('0x39'),null,'cm_contacts.ListId\x20=\x20'+_0x5c7518+_0xe3fc('0x3a'))['join'](_0x38aed5,null,_0x38aed5+_0xe3fc('0x13')+_0x5c7518+'.'+_0x3bf7da)[_0xe3fc('0x14')](_0x5c7518+_0xe3fc('0x3b'),_0x4506e5)[_0xe3fc('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xe3fc('0x14')](_0xe3fc('0x3c'),squel[_0xe3fc('0xe')]()[_0xe3fc('0xf')](_0xe3fc('0x10'))[_0xe3fc('0x11')]('cm_hopper_black')['where'](_0xe3fc('0x43'),_0x4506e5)[_0xe3fc('0x14')](_0x3bf7da+_0xe3fc('0x44'),_0x5c7518+'.'+_0x3bf7da)))[_0xe3fc('0x45')]();}function insertCmHopperAdditionalPhones(_0x2910aa){var _0x3a14cc=['cm_hopper.id',_0xe3fc('0x46'),'cm_contact_has_items.OrderBy',_0xe3fc('0x47'),'cm_contact_has_items.updatedAt'];return squel['insert']()['into'](_0xe3fc('0x48'))[_0xe3fc('0x49')](['CmHopperId',_0xe3fc('0x10'),'OrderBy',_0xe3fc('0x35'),_0xe3fc('0x36')],squel[_0xe3fc('0xe')]()[_0xe3fc('0x42')](_0x3a14cc)[_0xe3fc('0x11')](_0xe3fc('0x32'))['join']('cm_contacts',null,_0xe3fc('0x4a'))[_0xe3fc('0x12')](_0xe3fc('0x4b'),null,_0xe3fc('0x4c'))[_0xe3fc('0x14')](_0xe3fc('0x4d'),_0x2910aa)[_0xe3fc('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xe3fc('0x45')]();}function insertCmContact(_0x7f7d82,_0x4454a0,_0x270a78,_0x5bcd1c){var _0x51faad=_['concat'](_[_0xe3fc('0x4e')](_0x5bcd1c),[_0xe3fc('0x34'),_0xe3fc('0x4f'),_0xe3fc('0x35'),_0xe3fc('0x36')]);return squel[_0xe3fc('0x30')]()[_0xe3fc('0x31')](_0xe3fc('0x39'))[_0xe3fc('0x49')](_0x51faad,squel[_0xe3fc('0xe')]()[_0xe3fc('0x42')](_0x51faad)[_0xe3fc('0x11')](_0x4454a0)[_0xe3fc('0x14')]('('+_0x270a78['join'](',')+')\x20NOT\x20IN\x20?',squel['select']()[_0xe3fc('0x42')](_0x270a78)[_0xe3fc('0x11')](_0xe3fc('0x39'))['where']('ListId\x20=\x20?',_0x7f7d82))[_0xe3fc('0x14')](_0xe3fc('0x50'),squel[_0xe3fc('0xe')]()['field']('MIN(id)','min_id')[_0xe3fc('0x11')](_0x4454a0)['group'](_0x270a78['join'](','))))[_0xe3fc('0x45')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x5ed9be){logger[_0xe3fc('0x1c')](_0x5ed9be[_0xe3fc('0x1d')]);process[_0xe3fc('0x51')](0x1);}function handleError(_0x2303df,_0x1bec32){stats['errors'][_0xe3fc('0x1a')]({'name':_0x1bec32[_0xe3fc('0x52')],'message':_0x1bec32['message'],'row':_0x2303df});}function handleQuery(_0x2a95e1){logger[_0xe3fc('0x53')](_0x2a95e1);return db[_0xe3fc('0x54')][_0xe3fc('0x16')](_0x2a95e1)[_0xe3fc('0x55')](function(_0x8661ce){results[_0xe3fc('0x1a')](_0x8661ce);})[_0xe3fc('0x56')](function(_0x3dbf21){logger[_0xe3fc('0x1c')](_0x3dbf21[_0xe3fc('0x1d')]);});}function main(_0xd08412,_0x27fa3a,_0x25f7bb,_0x10d3b6){logger[_0xe3fc('0x53')](_0xe3fc('0x57'),_0xd08412,JSON[_0xe3fc('0x58')](_0x27fa3a));process[_0xe3fc('0x59')]('start');var _0x2541a1=_0x27fa3a[_0xe3fc('0x5a')];var _0x3ae3bd=_['clone'](_0x2541a1);var _0x137d5e=_0x27fa3a['socket_timestamp'];var _0xb09348=path['join'](config['root'],_0xe3fc('0x5b'),_0x137d5e+_0xe3fc('0x5c'));logger[_0xe3fc('0x53')](_0xe3fc('0x5d'),_0x27fa3a);db['ContactItemType'][_0xe3fc('0x5e')]({'raw':!![],'attributes':['id',_0xe3fc('0x5f')]})[_0xe3fc('0x20')](function(_0x434c54){for(var _0x2c299d=0x0;_0x2c299d<_0x434c54[_0xe3fc('0x18')];_0x2c299d++){if(_0x434c54[_0x2c299d][_0xe3fc('0x5f')]in _0x2541a1){contactItemTypes['push'](_0x434c54[_0x2c299d]);delete _0x3ae3bd[_0x434c54[_0x2c299d][_0xe3fc('0x5f')]];hasAdditionalPhones=!![];}for(var _0x4f8ab3 in _0x2541a1){if(_0x434c54[_0x2c299d][_0xe3fc('0x5f')]+_0xe3fc('0x60')===_0x4f8ab3){phoneDescriptions[_0xe3fc('0x1a')]({'itemTypeId':_0x434c54[_0x2c299d]['id'],'description':_0x4f8ab3});delete _0x3ae3bd[_0x4f8ab3];}}}if(hasAdditionalPhones)_0x3ae3bd[_0xe3fc('0x1e')]='';var _0x17b0e7=_['keys'](_0x3ae3bd)[_0xe3fc('0x12')]();logger[_0xe3fc('0x53')](_0xe3fc('0x61'),_0x17b0e7);fs[_0xe3fc('0x62')](_0xb09348,_0x17b0e7+'\x0a');Papa[_0xe3fc('0x63')](fs[_0xe3fc('0x64')](_0xd08412),{'header':!![],'skipEmptyLines':!![],'step':function(_0x50cabf,_0x3c33de){try{for(var _0x3f4a05=0x0,_0x39a97c=[];_0x3f4a05<_0x50cabf[_0xe3fc('0x65')][_0xe3fc('0x18')];_0x3f4a05++){stats['rows']+=0x1;if(_0x50cabf[_0xe3fc('0x66')][_0x3f4a05]){handleError(_0x50cabf[_0xe3fc('0x65')][_0x3f4a05],_0x50cabf[_0xe3fc('0x66')][_0x3f4a05]);}else{var _0x59c5f9=[];var _0x15c834=[];var _0x84dcd0={};for(var _0x5d396f in _0x2541a1){let _0x44529b=contactItemTypes[_0xe3fc('0x67')](_0x46568c=>_0x46568c['name']===_0x5d396f);let _0x1d584b=contactItemTypes[_0xe3fc('0x67')](_0x544a62=>_0x544a62[_0xe3fc('0x5f')]+_0xe3fc('0x60')===_0x5d396f);if(_[_0xe3fc('0x19')](_0x44529b)&&_[_0xe3fc('0x19')](_0x1d584b)){if(_0x2541a1[_0xe3fc('0x68')](_0x5d396f)){if(_0x50cabf['data'][_0x3f4a05][_0x2541a1[_0x5d396f]]){var _0x1ee350=_[_0xe3fc('0x69')](_0x50cabf[_0xe3fc('0x65')][_0x3f4a05][_0x2541a1[_0x5d396f]][_0xe3fc('0x6a')](/"/g,'\x27'));switch(_0x5d396f){case'scheduledat':var _0x491bf5=moment(_0x1ee350,_0xe3fc('0xa'),!![]);if(_0x491bf5[_0xe3fc('0x6b')]()){_0x39a97c[_0xe3fc('0x1a')]('\x22'+_0x1ee350+'\x22');}else{_0x59c5f9[_0xe3fc('0x1a')](_0xe3fc('0x6c'));}break;case _0xe3fc('0x37'):var _0x1179ca=parseInt(_0x1ee350);_0x1ee350=_[_0xe3fc('0x6d')](_0x1179ca)||_0x1179ca<0x0||_0x1179ca>0x4?_0x10d3b6?0x3:0x2:_0x1179ca;_0x39a97c[_0xe3fc('0x1a')]('\x22'+_0x1ee350+'\x22');break;case _0xe3fc('0x38'):var _0x3550e9=parseInt(_0x1ee350);if(_['isNumber'](_0x3550e9)&&_[_0xe3fc('0x6e')](_0x25f7bb,_0x3550e9)){_0x39a97c[_0xe3fc('0x1a')]('\x22'+_0x3550e9+'\x22');}else{_0x59c5f9[_0xe3fc('0x1a')](_0xe3fc('0x6f'));}break;case _0xe3fc('0x70'):if(isEmail(_0x1ee350)){_0x39a97c[_0xe3fc('0x1a')]('\x22'+_0x1ee350+'\x22');}else{_0x59c5f9[_0xe3fc('0x1a')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x1d41d1=moment(_0x1ee350,_0xe3fc('0x71'),!![]);if(_0x1d41d1[_0xe3fc('0x6b')]()){_0x39a97c['push']('\x22'+_0x1ee350+'\x22');}else{_0x59c5f9[_0xe3fc('0x1a')](_0xe3fc('0x72'));}break;default:_0x39a97c[_0xe3fc('0x1a')]('\x22'+_0x1ee350+'\x22');}}else{switch(_0x5d396f){case _0xe3fc('0x73'):case'phone':_0x59c5f9['push'](_0x5d396f+_0xe3fc('0x74'));break;default:_0x39a97c[_0xe3fc('0x1a')]('\x22\x22');}}}}else{var _0x136360='';if(!_[_0xe3fc('0x19')](_0x44529b)){if(!_0x84dcd0[_0xe3fc('0x68')](_0x44529b['id'])){for(var _0x5c2c5d=0x0;_0x5c2c5d<_0x2541a1[_0x5d396f][_0xe3fc('0x18')];_0x5c2c5d++){var _0x1ee350=_['trim'](_0x50cabf[_0xe3fc('0x65')][_0x3f4a05][_0x2541a1[_0x5d396f][_0x5c2c5d]][_0xe3fc('0x6a')](/"/g,'\x27'));var _0x3b0b0f=phoneDescriptions[_0xe3fc('0x67')](_0x2d8ff5=>_0x2d8ff5[_0xe3fc('0x75')]===_0x44529b['id']);if(!_[_0xe3fc('0x19')](_0x3b0b0f)){var _0xb29841=_['trim'](_0x50cabf[_0xe3fc('0x65')][_0x3f4a05][_0x2541a1[_0x3b0b0f[_0xe3fc('0x76')]][0x0]][_0xe3fc('0x6a')](/"/g,'\x27'));if(!_[_0xe3fc('0x19')](_0xb29841))_0x1ee350=_0x1ee350+'§'+_0xb29841;}if(_0x136360=='')_0x136360=_0x1ee350;else _0x136360+='|'+_0x1ee350;}_0x15c834[_0xe3fc('0x1a')](_0x44529b['id']+':'+_0x136360);_0x84dcd0[_0x44529b['id']]=0x1;}}}}if(hasAdditionalPhones){_0x39a97c[_0xe3fc('0x1a')]('\x22'+_0x15c834[_0xe3fc('0x12')](';')+'\x22');}if(_0x59c5f9['length']){handleError(_0x50cabf[_0xe3fc('0x65')][_0x3f4a05],{'code':'SystemRow','message':_0x59c5f9['join']()});}else{fs[_0xe3fc('0x77')](_0xb09348,_0x39a97c[_0xe3fc('0x12')]()+'\x0a');}_0x39a97c=[];}if(!(stats['rows']%0xc8)){socket[_0xe3fc('0x78')]('contact:import:'+_0x137d5e,stats);stats[_0xe3fc('0x66')]=[];}}if(stopped){logger[_0xe3fc('0x53')](_0xe3fc('0x79'));_0x3c33de[_0xe3fc('0x7a')]();}}catch(_0x749800){handleError(_0x50cabf[_0xe3fc('0x65')][_0x3f4a05],{'code':'SystemError','message':_0x749800['message']});logger['error'](_0xe3fc('0x7b'),_0x749800['message']);}},'complete':function(){try{var _0x347e2f=[];var _0x588019=tempTableName;_0x347e2f[_0xe3fc('0x1a')](_0xe3fc('0x7c')+_0x588019+_0xe3fc('0x7d'));logger[_0xe3fc('0x53')]('CIS\x20len',contactItemTypes['length']);var _0x4ddf58=util[_0xe3fc('0xc')](_0xe3fc('0x7e'),_0xb09348,_0x588019,_0x17b0e7,_0x27fa3a[_0xe3fc('0x34')],_0x27fa3a[_0xe3fc('0x4f')]||null,NOW,NOW);if(_[_0xe3fc('0x19')](_0x2541a1[_0xe3fc('0x33')])){_0x4ddf58+=_0xe3fc('0x7f');}_0x347e2f['push'](_0x4ddf58);BPromise[_0xe3fc('0x80')](_0x347e2f,handleQuery)[_0xe3fc('0x20')](function(_0x22124c){BPromise[_0xe3fc('0x1b')]([handleAdditionalPhones()])[_0xe3fc('0x20')](function(){_0x347e2f=[];for(var _0x114185=0x0;_0x114185\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 +var _0x7d94=['left_join','users','u.id\x20=\x20ui.UserId','where','\x20IN\x20?','map','getInteractionsTables','from','interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','it.','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','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','length','find','buildExpression','type','text','start','value','end','unreadMessages','and','operator','$substring','split','contact','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','tags','clause','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','plainBody','keys','some','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','then','fields','read','tag','filter','get','chat','Websites','resolve','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','keyBy','a.key','Account.key','Account.mandatoryDisposition','Account.email','contactName','i.id','i.updatedAt','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.ContactId','i.MailAccountId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','limit','offset','groupBy','findOne','enableEmailPreview','all','COUNT(*)','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','isEmpty','exports','lodash','../parsers/advancedSearch','../parsers/qs','./utils','getAccountFK','role','agent','select','field','name','color','tools_tags','getInteractionFK','user_has_','u.id','u.fullname','ui.'];(function(_0x20add0,_0x2fe127){var _0x44e35a=function(_0x5a815d){while(--_0x5a815d){_0x20add0['push'](_0x20add0['shift']());}};_0x44e35a(++_0x2fe127);}(_0x7d94,0x8c));var _0x47d9=function(_0x2becba,_0x4ea656){_0x2becba=_0x2becba-0x0;var _0x90b5dd=_0x7d94[_0x2becba];return _0x90b5dd;};'use strict';var _=require(_0x47d9('0x0'));var squel=require('squel');var as=require(_0x47d9('0x1'));var qs=require(_0x47d9('0x2'));var updateInteraction=require('./update-interaction')['updateInteraction'];var utils=require(_0x47d9('0x3'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x960595,_0x1081e9,_0x25f0ef){var _0x3fbdbd=![];var _0xe871f8=utils[_0x47d9('0x4')](_0x960595);if(_0x1081e9[_0x47d9('0x5')]===_0x47d9('0x6')&&!_0x25f0ef['search']&&!_0x25f0ef[_0xe871f8]){_0x3fbdbd=!![];}return _0x3fbdbd;}function getTagsQuery(){return squel[_0x47d9('0x7')]()[_0x47d9('0x8')]('id')['field'](_0x47d9('0x9'))[_0x47d9('0x8')](_0x47d9('0xa'))['from'](_0x47d9('0xb'));}function getUsersQuery(_0x56e8ab,_0x308d78){var _0x10f59e=utils[_0x47d9('0xc')](_0x56e8ab);var _0x5dd917=_0x47d9('0xd')+_0x56e8ab+'_interactions';var _0x4bdeac=squel[_0x47d9('0x7')]()[_0x47d9('0x8')](_0x47d9('0xe'))['field'](_0x47d9('0xf'))[_0x47d9('0x8')](_0x47d9('0x10')+_0x10f59e)['from'](_0x5dd917,'ui')[_0x47d9('0x11')](_0x47d9('0x12'),'u',_0x47d9('0x13'));if(_0x308d78['length']>0x0){_0x4bdeac[_0x47d9('0x14')](_0x47d9('0x10')+_0x10f59e+_0x47d9('0x15'),_[_0x47d9('0x16')](_0x308d78,'id'));}return _0x4bdeac;}function getInteractionsQuery(_0x518433){var _0x50d2d0=utils[_0x47d9('0x17')](_0x518433);var _0x5bdbcb=utils[_0x47d9('0x4')](_0x518433);var _0x2ad8eb=utils['getInteractionFK'](_0x518433);return squel[_0x47d9('0x7')]()[_0x47d9('0x18')](_0x50d2d0[_0x47d9('0x19')],'i')[_0x47d9('0x11')]('cm_contacts','c',_0x47d9('0x1a'))[_0x47d9('0x11')](_0x47d9('0x12'),'o',_0x47d9('0x1b'))[_0x47d9('0x11')](_0x50d2d0[_0x47d9('0x1c')],'a',_0x47d9('0x1d')+_0x5bdbcb)['left_join'](_0x50d2d0[_0x47d9('0x1e')],'me',_0x47d9('0x1f')+_0x2ad8eb+_0x47d9('0x20'))['left_join'](_0x50d2d0[_0x47d9('0x21')],'it',_0x47d9('0x22')+_0x2ad8eb+'\x20=\x20i.id')[_0x47d9('0x11')](_0x47d9('0xb'),'t',_0x47d9('0x23'));}function getSqlClauses(){var _0x2ce602={'body':squel[_0x47d9('0x24')](),'contact':squel[_0x47d9('0x24')](),'default':squel['expr'](),'fields':squel[_0x47d9('0x24')](),'filter':squel[_0x47d9('0x24')](),'read':squel[_0x47d9('0x24')](),'tags':{'clause':squel[_0x47d9('0x24')](),'ids':null},'user':squel[_0x47d9('0x24')]()};return _0x2ce602;}function parseTagParameter(_0x12e32a){var _0x5a4492=squel[_0x47d9('0x24')]();if(_0x12e32a){var _0x1bd1a7=utils[_0x47d9('0x25')](_0x12e32a);_0x1bd1a7[_0x47d9('0x26')](function(_0x14442d){_0x5a4492['or'](_0x47d9('0x27'),'%,'+_0x14442d+',%');});}return _0x5a4492;}function parseReadParameter(_0x524b9c){var _0x1ec7b9='';if(_0x524b9c){_0x1ec7b9=_0x47d9('0x28');if(_0x524b9c==='1'){_0x1ec7b9=_0x1ec7b9[_0x47d9('0x29')](_0x47d9('0x2a'),'=');}else{_0x1ec7b9=_0x1ec7b9[_0x47d9('0x29')](_0x47d9('0x2a'),'>');}}return _0x1ec7b9;}function parseSearchFilter(_0x48b22c,_0x3c7230){var _0x5127d3=squel['expr']();if(_0x3c7230){var _0x3a6ece=_0x3c7230[_0x47d9('0x29')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x47d9('0x2b')](_0x3a6ece)){_0x5127d3['or'](_0x47d9('0x2c'),_0x3a6ece+'%');if([_0x47d9('0x2d'),_0x47d9('0x2e')][_0x47d9('0x2f')](_0x48b22c)){_0x5127d3['or'](_0x47d9('0x30'),_0x3a6ece+'%');}else if(_0x48b22c===_0x47d9('0x31')){_0x5127d3['or']('i.fax\x20LIKE\x20?',_0x3a6ece+'%');}else if(_0x48b22c===_0x47d9('0x32')){_0x5127d3['or'](_0x47d9('0x33'),_0x3a6ece+'%');}}else if(_0x48b22c===_0x47d9('0x34')&&qs[_0x47d9('0x35')](_0x3a6ece)){_0x5127d3['or'](_0x47d9('0x36'),_0x3a6ece+'%');}else{if(_0x48b22c==='mail'){_0x5127d3['or'](_0x47d9('0x37'),qs['getFullTextValue'](_0x3a6ece,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x3a6ece));}else if(_0x48b22c!==_0x47d9('0x31')){_0x5127d3['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x3a6ece));}_0x5127d3['or'](_0x47d9('0x38'),qs['getFullTextValue'](_0x3a6ece,!![]),null);}}return _0x5127d3;}function parseAdvancedSearchFilter(_0x489cc3,_0x1c2751){var _0x3d562e=getSqlClauses();var _0x3fb733=as[_0x47d9('0x39')](_0x489cc3);var _0x46dc85=_0x3fb733[_0x47d9('0x3a')];for(var _0x48f019=0x0;_0x48f019<_0x3fb733['conditions'][_0x47d9('0x3b')];_0x48f019++){var _0x803cf0=_0x3fb733['conditions'][_0x48f019];var _0x1732e5='i';var _0x427d6d=_[_0x47d9('0x3c')](_0x1c2751,[_0x47d9('0x9'),_0x803cf0[_0x47d9('0x8')]]);if(_0x427d6d){var _0x4715f0=as[_0x47d9('0x3d')](_0x1732e5,_0x427d6d[_0x47d9('0x3e')],_0x803cf0);_0x3d562e['default'][_0x46dc85](_0x4715f0[_0x47d9('0x3f')],_0x4715f0['value'][_0x47d9('0x40')],_0x4715f0[_0x47d9('0x41')][_0x47d9('0x42')]);}else{switch(_0x803cf0['field']){case _0x47d9('0x43'):var _0x3808e7=parseReadParameter(_0x803cf0[_0x47d9('0x41')]);_0x3d562e['read'][_0x47d9('0x44')](_0x3808e7);break;case'Contact':if(_0x803cf0[_0x47d9('0x45')]===_0x47d9('0x46')){if(_0x803cf0[_0x47d9('0x41')][_0x47d9('0x47')]('\x20')['length']>0x1){_0x3d562e[_0x47d9('0x48')][_0x46dc85](_0x47d9('0x38'),qs[_0x47d9('0x49')](_0x803cf0[_0x47d9('0x41')],!![]),null);}else{var _0x3b87c2='%'+_0x803cf0[_0x47d9('0x41')]+'%';_0x3d562e[_0x47d9('0x48')][_0x46dc85](_0x47d9('0x4a'),_0x3b87c2,_0x3b87c2,_0x3b87c2);}}else{_0x427d6d=_[_0x47d9('0x3c')](_0x1c2751,[_0x47d9('0x9'),_0x47d9('0x4b')]);_0x803cf0[_0x47d9('0x8')]='ContactId';_0x4715f0=as['buildExpression'](_0x1732e5,_0x427d6d['type'],_0x803cf0);_0x3d562e[_0x47d9('0x48')][_0x46dc85](_0x4715f0[_0x47d9('0x3f')],_0x4715f0[_0x47d9('0x41')][_0x47d9('0x40')],_0x4715f0['value'][_0x47d9('0x42')]);}break;case'Tag':var _0xaf379d=_0x803cf0[_0x47d9('0x41')][_0x47d9('0x47')](',')[_0x47d9('0x16')](function(_0x3b5f0a){return Number(_0x3b5f0a);});var _0x1ccaaf=parseTagParameter(_0xaf379d);_0x3d562e[_0x47d9('0x4c')][_0x47d9('0x4d')][_0x47d9('0x44')](_0x1ccaaf);_0x3d562e[_0x47d9('0x4c')][_0x47d9('0x4e')]=_0xaf379d;break;case _0x47d9('0x4f'):if(_0x803cf0[_0x47d9('0x45')]===_0x47d9('0x46')){_0x3d562e[_0x47d9('0x50')][_0x46dc85](_0x47d9('0x51'),'%'+_0x803cf0[_0x47d9('0x41')]+'%',null);}else{_0x427d6d=_[_0x47d9('0x3c')](_0x1c2751,[_0x47d9('0x9'),_0x47d9('0x52')]);_0x803cf0[_0x47d9('0x8')]='UserId';_0x4715f0=as['buildExpression'](_0x1732e5,_0x427d6d['type'],_0x803cf0);_0x3d562e['user'][_0x46dc85](_0x4715f0[_0x47d9('0x3f')],_0x4715f0[_0x47d9('0x41')][_0x47d9('0x40')],_0x4715f0[_0x47d9('0x41')]['end']);}break;case _0x47d9('0x53'):case _0x47d9('0x54'):_0x4715f0=as['buildExpression']('me',null,_0x803cf0);_0x3d562e[_0x47d9('0x53')][_0x46dc85](_0x4715f0[_0x47d9('0x3f')],_0x4715f0[_0x47d9('0x41')][_0x47d9('0x40')],_0x4715f0[_0x47d9('0x41')][_0x47d9('0x42')]);break;}}}return _0x3d562e;}function parseModelFields(_0x55335a,_0x389566,_0x12c6c9){var _0x4b389c=utils[_0x47d9('0x4')](_0x55335a);var _0x7e468=squel[_0x47d9('0x24')]();var _0x5f4056=_(_0x389566)[_0x47d9('0x55')]()[_0x47d9('0x16')](function(_0x33cd7d){return _[_0x47d9('0x56')](_0x12c6c9,[_0x47d9('0x9'),_0x33cd7d])?_0x33cd7d:undefined;})['compact']()[_0x47d9('0x41')]();if(_0x5f4056[_0x47d9('0x3b')]>0x0){_0x5f4056[_0x47d9('0x26')](function(_0x4f88a8){if(_0x4f88a8===_0x4b389c){_0x7e468[_0x47d9('0x44')]('i.'+_0x4b389c+_0x47d9('0x15'),[][_0x47d9('0x57')](_0x389566[_0x4f88a8]));}else if(_0x4f88a8===_0x47d9('0x58')){var _0x3811a1=JSON['parse'](_0x389566[_0x4f88a8])[_0x47d9('0x59')];var _0x591a6a=JSON['parse'](_0x389566[_0x4f88a8])[_0x47d9('0x5a')];_0x7e468[_0x47d9('0x44')](_0x47d9('0x5b'),_0x3811a1,_0x591a6a);}else{if(_0x389566[_0x4f88a8]==='null'){_0x7e468['and']('i.'+_0x4f88a8+_0x47d9('0x5c'));}else{_0x7e468[_0x47d9('0x44')]('i.'+_0x4f88a8+_0x47d9('0x5d'),_0x389566[_0x4f88a8]);}}});}return _0x7e468;}function parseQueryParameters(_0x2d6a5f,_0x315eef,_0x16f26e){var _0x5d0438=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x2d6a5f,_0x315eef,_0x16f26e);})[_0x47d9('0x5e')](function(_0x469059){_0x5d0438[_0x47d9('0x5f')][_0x47d9('0x44')](_0x469059);return parseReadParameter(_0x315eef['read']);})[_0x47d9('0x5e')](function(_0x37f16b){_0x5d0438[_0x47d9('0x60')]['and'](_0x37f16b);return parseTagParameter(_0x315eef[_0x47d9('0x61')]);})[_0x47d9('0x5e')](function(_0x273969){_0x5d0438[_0x47d9('0x4c')]['clause'][_0x47d9('0x44')](_0x273969);return parseSearchFilter(_0x2d6a5f,_0x315eef[_0x47d9('0x62')]);})[_0x47d9('0x5e')](function(_0x3952a3){_0x5d0438['filter']=_0x3952a3;return _0x5d0438;});}function checkAccountsRestrictions(_0x5424b3,_0x152b8d,_0x50f79d){var _0x5c4d9f=utils[_0x47d9('0x4')](_0x5424b3);var _0x38238c=_0x47d9('0x63')+_['capitalize'](_0x5424b3)+(_0x5424b3===_0x47d9('0x64')?_0x47d9('0x65'):'Accounts');var _0x1ebb63=squel[_0x47d9('0x24')]();return Promise[_0x47d9('0x66')]()[_0x47d9('0x5e')](function(){if(_0x50f79d['search']&&_0x152b8d[_0x47d9('0x5')]===_0x47d9('0x6')){return _0x152b8d[_0x38238c]({'attributes':['id'],'raw':!![]});}})[_0x47d9('0x5e')](function(_0xa4c575){if(_0xa4c575){if(_0xa4c575[_0x47d9('0x3b')]===0x0){_0x1ebb63[_0x47d9('0x44')]('i.'+_0x5c4d9f+_0x47d9('0x5c'));}else{_0x1ebb63[_0x47d9('0x44')]('i.'+_0x5c4d9f+'\x20IN\x20?',_[_0x47d9('0x16')](_0xa4c575,'id'));}}else if(!_0x50f79d[_0x5c4d9f]){_0x1ebb63['and']('i.'+_0x5c4d9f+_0x47d9('0x67'));}})[_0x47d9('0x5e')](function(){return _0x1ebb63;});}function getClosedOrderClause(_0x441f61,_0x4d9bce){var _0x44c0ad='';var _0x32fa0a=['i.thirdDisposition',_0x47d9('0x68'),_0x47d9('0x69')];if(_0x441f61===_0x47d9('0x34')){_0x32fa0a[_0x47d9('0x6a')]('i.substatus');}if(_0x4d9bce['closed']==='0'&&_0x441f61===_0x47d9('0x34')){_0x44c0ad=_0x47d9('0x6b');}else{if(_0x4d9bce[_0x47d9('0x6c')]==='1'){_0x32fa0a[_0x47d9('0x6d')]();}_0x44c0ad=_0x47d9('0x6e')+_0x32fa0a[_0x47d9('0x6f')](',\x20')+')';}return _0x44c0ad;}function getFilteredInteractions(_0x319383,_0x4d4066,_0x34d1b7,_0x3e1561){var _0x500aaa=utils['getInteractionFK'](_0x319383);var _0x57c1c3=_['capitalize'](_0x319383)+_0x47d9('0x70');var _0x27b4ac=[];var _0x407d60=getTagsQuery();var _0x12bb99={'type':db[_0x47d9('0x71')][_0x47d9('0x72')][_0x47d9('0x73')],'raw':!![]};var _0x2acb85=[];var _0x7b2a11=[];return db[_0x47d9('0x74')][_0x47d9('0x75')](_0x407d60[_0x47d9('0x76')](),_0x12bb99)['then'](function(_0x216ad7){_0x27b4ac=_[_0x47d9('0x77')](_0x216ad7,'id');_0x12bb99=_['merge'](_0x12bb99,{'model':db[_0x57c1c3],'mapToModel':!![],'nest':!![]});if(_0x34d1b7[_0x47d9('0x5f')]){_0x3e1561['attributes'][_0x47d9('0x26')](function(_0xf74e55){_0x4d4066['field']('i.'+_0xf74e55);});}else{_0x4d4066['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x4d4066[_0x47d9('0x8')](_0x47d9('0x78'),_0x47d9('0x79'));_0x4d4066[_0x47d9('0x8')]('a.mandatoryDisposition',_0x47d9('0x7a'));if(_0x319383===_0x47d9('0x34')){_0x4d4066[_0x47d9('0x8')]('a.email',_0x47d9('0x7b'));_0x4d4066[_0x47d9('0x8')]('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',_0x47d9('0x7c'));_0x4d4066['field'](_0x47d9('0x7d'));_0x4d4066[_0x47d9('0x8')]('i.createdAt');_0x4d4066['field'](_0x47d9('0x7e'));_0x4d4066['field']('i.closed');_0x4d4066['field'](_0x47d9('0x7f'));_0x4d4066[_0x47d9('0x8')]('i.attach');_0x4d4066[_0x47d9('0x8')](_0x47d9('0x80'));_0x4d4066[_0x47d9('0x8')](_0x47d9('0x81'));_0x4d4066[_0x47d9('0x8')]('i.subject');_0x4d4066['field'](_0x47d9('0x69'));_0x4d4066[_0x47d9('0x8')](_0x47d9('0x68'));_0x4d4066[_0x47d9('0x8')]('i.thirdDisposition');_0x4d4066['field'](_0x47d9('0x6b'));_0x4d4066[_0x47d9('0x8')]('i.to');_0x4d4066[_0x47d9('0x8')](_0x47d9('0x82'));_0x4d4066[_0x47d9('0x8')](_0x47d9('0x83'));_0x4d4066[_0x47d9('0x8')]('i.UserId');}else if(_0x319383===_0x47d9('0x32')){_0x4d4066[_0x47d9('0x8')](_0x47d9('0x84'),_0x47d9('0x7c'));}else{_0x4d4066[_0x47d9('0x8')](_0x47d9('0x85'),'contactName');}if(_0x319383!==_0x47d9('0x34')){_0x4d4066[_0x47d9('0x8')](_0x47d9('0x86'));}_0x4d4066[_0x47d9('0x8')](_0x47d9('0x87'),_0x47d9('0x88'));_0x4d4066[_0x47d9('0x8')]('c.lastName','Contact.lastName');_0x4d4066['field'](_0x47d9('0x89'),_0x47d9('0x8a'));_0x4d4066[_0x47d9('0x8')](_0x47d9('0x8b'),_0x47d9('0x8c'));_0x4d4066[_0x47d9('0x8')](_0x47d9('0x8d'),_0x47d9('0x8e'));_0x4d4066['field']('c.fax','Contact.fax');_0x4d4066[_0x47d9('0x8')](_0x47d9('0x8f'),_0x47d9('0x90'));_0x4d4066[_0x47d9('0x8')](_0x47d9('0x91'),_0x47d9('0x92'));_0x4d4066[_0x47d9('0x8')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x3e1561[_0x47d9('0x93')]){_0x4d4066[_0x47d9('0x93')](_0x3e1561[_0x47d9('0x93')]);}if(_0x3e1561['offset']){_0x4d4066[_0x47d9('0x94')](_0x3e1561[_0x47d9('0x94')]);}return db[_0x47d9('0x74')][_0x47d9('0x75')](_0x4d4066['toString'](),_0x12bb99);})[_0x47d9('0x5e')](function(_0x97226d){_0x2acb85=_0x97226d;var _0x2b8179=getUsersQuery(_0x319383,_0x2acb85);return db[_0x47d9('0x74')][_0x47d9('0x75')](_0x2b8179[_0x47d9('0x76')](),_0x12bb99);})[_0x47d9('0x5e')](function(_0x7159a4){_0x7b2a11=_[_0x47d9('0x95')](_0x7159a4,_0x500aaa);if(_0x319383===_0x47d9('0x34')){return db['Setting'][_0x47d9('0x96')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0x47d9('0x5e')](function(_0x3e8af7){var _0x467c77=_0x3e8af7?_0x3e8af7[_0x47d9('0x97')]:undefined;var _0x43ad53=_0x2acb85[_0x47d9('0x16')](function(_0x53aba2){return updateInteraction(_0x53aba2,_0x27b4ac,_0x7b2a11,_0x467c77);});return Promise[_0x47d9('0x98')](_0x43ad53);});}function countFilteredInteractions(_0x1a7ebc,_0x519531){var _0x233845=_0x1a7ebc['clone']();_0x233845[_0x47d9('0x8')](_0x47d9('0x99'));_0x233845[_0x47d9('0x8')](_0x47d9('0x9a'),'unreadMessages');var _0x3e0ef4=utils[_0x47d9('0x25')](_0x519531);if(!_[_0x47d9('0x9b')](_0x3e0ef4)){_0x233845[_0x47d9('0x14')]('t.id\x20IN\x20?',_0x3e0ef4);}var _0x56f006={'type':db[_0x47d9('0x71')][_0x47d9('0x72')][_0x47d9('0x73')],'raw':!![]};return db['sequelize'][_0x47d9('0x75')](_0x233845[_0x47d9('0x76')](),_0x56f006);}module[_0x47d9('0x9c')]={'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 a0e79e9..6102d4d 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 _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 +var _0x636f=['plainBody','-id','then','lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','Tags','fullname','forEach','push','waiting','talking','answered','unmanaged','abandoned','total','closed','disposition','UserId','MailMessage','findOne','out'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x636f,0x1e5));var _0xf636=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x636f[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x536f4a,_0x57f573){return new Promise(function(_0x5ba271,_0x2a8614){try{var _0xcde100=[];if(_0x57f573[_0x536f4a]){_0xcde100=_0x57f573[_0x536f4a]['map'](function(_0x42d746){return{'id':_0x42d746['id'],'fullname':_0x42d746[_0xf636('0x0')]};});}return _0x5ba271(_0xcde100);}catch(_0x2a9d24){_0x2a8614(_0x2a9d24);}});}function getInteractionTags(_0x1f3701,_0x521e15){var _0x21f703=[];if(_0x1f3701){_0x1f3701['split'](',')[_0xf636('0x1')](function(_0xe4cc12){_0x21f703[_0xf636('0x2')](_0x521e15[_0xe4cc12]);});}return _0x21f703;}function updateWaitingCounter(_0x30effc){if(_0x30effc[_0xf636('0x3')]){_0x30effc['waiting']-=0x1;}}function updateInteractionCounters(_0x4ffdd1){_0x4ffdd1[_0xf636('0x3')]=0x0;_0x4ffdd1[_0xf636('0x4')]=0x0;_0x4ffdd1[_0xf636('0x5')]=0x0;_0x4ffdd1[_0xf636('0x6')]=0x0;_0x4ffdd1[_0xf636('0x7')]=0x0;_0x4ffdd1[_0xf636('0x8')]=0x0;if(_0x4ffdd1[_0xf636('0x9')]){if(_0x4ffdd1[_0xf636('0xa')]===_0xf636('0x7')){_0x4ffdd1[_0xf636('0x7')]+=0x1;updateWaitingCounter(_0x4ffdd1);}if(_0x4ffdd1['UserId']){_0x4ffdd1['answered']+=0x1;if(_0x4ffdd1[_0xf636('0x4')]){_0x4ffdd1[_0xf636('0x4')]-=0x1;}}else{if(_0x4ffdd1[_0xf636('0xa')]){_0x4ffdd1[_0xf636('0x6')]+=0x1;updateWaitingCounter(_0x4ffdd1);}}}else{if(!_0x4ffdd1[_0xf636('0xb')]){_0x4ffdd1[_0xf636('0x3')]+=0x1;}if(_0x4ffdd1['UserId']){_0x4ffdd1[_0xf636('0x4')]+=0x1;updateWaitingCounter(_0x4ffdd1);}}_0x4ffdd1[_0xf636('0x8')]+=0x1;return _0x4ffdd1;}function getLastMessageText(_0x637da3){return db[_0xf636('0xc')][_0xf636('0xd')]({'where':{'$and':[{'MailInteractionId':_0x637da3['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xf636('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xf636('0xf')],'order':_0xf636('0x10'),'raw':!![]})[_0xf636('0x11')](function(_0x2aa761){if(_0x2aa761&&_0x2aa761[_0xf636('0xf')]){_0x637da3[_0xf636('0x12')]=_[_0xf636('0x13')](_0x2aa761['plainBody']);}return _0x637da3;})[_0xf636('0x14')](function(_0x55389a){throw _0x55389a;});}exports[_0xf636('0x15')]=function(_0x37ee56,_0x356cf1,_0x4501e4,_0x27b457){return new Promise(function(_0x5d6329,_0x24f47c){return getInteractionUsers(_0x37ee56['id'],_0x4501e4)[_0xf636('0x11')](function(_0x34ce6d){_0x37ee56[_0xf636('0x16')]=_0x34ce6d;return getInteractionTags(_0x37ee56[_0xf636('0x17')],_0x356cf1);})[_0xf636('0x11')](function(_0x127959){_0x37ee56[_0xf636('0x18')]=_0x127959;delete _0x37ee56[_0xf636('0x17')];return updateInteractionCounters(_0x37ee56);})['then'](function(_0x2f18a7){if(_0x27b457){return getLastMessageText(_0x2f18a7);}else{return _0x2f18a7;}})['then'](function(_0x2f855c){_0x5d6329(_0x2f855c);})['catch'](function(_0x51af15){_0x24f47c(_0x51af15);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 2c7bd44..b80da7a 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 _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 +var _0x2b61=['accounts','_interaction_has_tags','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','update','then','info','error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','websites'];(function(_0xaf9071,_0x2173b8){var _0x349556=function(_0x43afe0){while(--_0x43afe0){_0xaf9071['push'](_0xaf9071['shift']());}};_0x349556(++_0x2173b8);}(_0x2b61,0x1ed));var _0x12b6=function(_0x24942b,_0x4310e2){_0x24942b=_0x24942b-0x0;var _0x335545=_0x2b61[_0x24942b];return _0x335545;};'use strict';var _=require(_0x12b6('0x0'));var db=require(_0x12b6('0x1'))['db'];var loggers={'openchannel':require(_0x12b6('0x2'))(_0x12b6('0x3')),'mail':require('../../config/logger')(_0x12b6('0x4')),'fax':require(_0x12b6('0x2'))(_0x12b6('0x5')),'sms':require('../../config/logger')(_0x12b6('0x6')),'chat':require(_0x12b6('0x2'))(_0x12b6('0x7')),'whatsapp':require(_0x12b6('0x2'))(_0x12b6('0x8'))};function getAccountFK(_0x11f6f3){return _[_0x12b6('0x9')](_0x11f6f3)+(_0x11f6f3===_0x12b6('0xa')?_0x12b6('0xb'):_0x12b6('0xc'))+'Id';}function getInteractionFK(_0x5b10d1){return _[_0x12b6('0x9')](_0x5b10d1)+_0x12b6('0xd');}function getInteractionId(_0xf2ad40,_0x2a5a68,_0x4c0cf9){if(_0xf2ad40&&_0xf2ad40[_[_0x12b6('0xe')](_0x4c0cf9)+_0x12b6('0xd')]){return _0xf2ad40[_[_0x12b6('0xe')](_0x4c0cf9)+'InteractionId'];}else if(_0xf2ad40&&_0xf2ad40['id']){return _0xf2ad40['id'];}else if(_0x2a5a68&&_0x2a5a68['id']){return _0x2a5a68['id'];}else{return _0x12b6('0xf');}}function getInteractionsTables(_0x4d25c4){return{'accounts':_0x4d25c4+'_'+(_0x4d25c4===_0x12b6('0xa')?_0x12b6('0x10'):_0x12b6('0x11')),'interactions':_0x4d25c4+'_interactions','interactionsTags':_0x4d25c4+_0x12b6('0x12'),'messages':_0x4d25c4+'_messages','userInteractions':'user_has_'+_0x4d25c4+'_interactions'};}function getSelectedTags(_0x4f564e){var _0xf7fcc7=[];if(_0x4f564e){_0xf7fcc7=Array[_0x12b6('0x13')](_0x4f564e)?_0x4f564e:[_0x4f564e];}return _0xf7fcc7;}function log(_0x1f1207,_0x21f623,_0x20a132,_0x45525b,_0xe0dc90,_0x23f872){loggers[_0xe0dc90[_0x12b6('0x14')]()][_0x1f1207](_0x12b6('0x15'),_0x23f872[_0x12b6('0x16')](),_0x21f623?_0x21f623['id']:null,_0x21f623?_0x21f623[_0x12b6('0x17')]:null,_0x21f623?_0x21f623[_0x12b6('0x18')]:null,getInteractionId(_0x20a132,_0x45525b,_0xe0dc90),_0x20a132?JSON[_0x12b6('0x19')](_0x20a132):_0x12b6('0x1a'));}function updateUser(_0x5354b6,_0x248295,_0x8c0821,_0x59a894,_0x10405a){db[_['upperFirst'](_0x59a894)+_0x12b6('0x1b')][_0x12b6('0x1c')]({'where':{'id':getInteractionId(_0x248295,_0x8c0821,_0x59a894)}})['then'](function(_0x5da035){if(_0x5da035){return _0x5da035[_0x12b6('0x1d')]({'UserId':_0x5354b6?_0x5354b6['id']:null});}})[_0x12b6('0x1e')](function(_0x11152b){if(_0x11152b){log(_0x12b6('0x1f'),_0x5354b6,_0x248295,_0x8c0821,_0x59a894,_0x10405a);}})['catch'](function(){log(_0x12b6('0x20'),_0x5354b6,_0x248295,_0x8c0821,_0x59a894,_0x10405a);});}module[_0x12b6('0x21')]={'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 14bc2bd..2111894 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 _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 +var _0x9c15=['users','User','admin','isUserLimit','crypto','util','composable-middleware','../../config/environment','data1','license','split','aes-256-ctr','format','%s:%s:%s','update','parse','hasOwnProperty','use','findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch'];(function(_0x583394,_0x127bfd){var _0x591c6f=function(_0x21f6a5){while(--_0x21f6a5){_0x583394['push'](_0x583394['shift']());}};_0x591c6f(++_0x127bfd);}(_0x9c15,0x7c));var _0x59c1=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9c15[_0x3947c9];return _0x2e7871;};'use strict';var crypto=require(_0x59c1('0x0'));var util=require(_0x59c1('0x1'));var compose=require(_0x59c1('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x59c1('0x3'));function getValueFromLicense(_0x315248,_0x322a2f){if(_0x315248&&_0x322a2f){if(_0x322a2f['data1']&&_0x322a2f['license']){var _0x3961ee=_0x322a2f[_0x59c1('0x4')];var _0x22341b=_0x322a2f[_0x59c1('0x5')];var _0x5da562=_0x3961ee[_0x59c1('0x6')]('-')[0x4];var _0x50315d=_0x3961ee[_0x59c1('0x6')]('-')[0x0];var _0x32952c=crypto['createDecipher'](_0x59c1('0x7'),util[_0x59c1('0x8')](_0x59c1('0x9'),_0x5da562,_0x3961ee,_0x50315d));var _0x4968ce=_0x32952c[_0x59c1('0xa')](_0x22341b,'base64','utf8');_0x4968ce+=_0x32952c['final']('utf8');var _0x45940f=JSON[_0x59c1('0xb')](_0x4968ce);return _0x45940f[_0x59c1('0xc')](_0x315248)?_0x45940f[_0x315248]:null;}}return null;}function isLimit(_0x5377f2,_0x2bb3c0,_0x4867af,_0x4e7cc0){var _0x202b54=_0x2bb3c0;return compose()[_0x59c1('0xd')](function(_0x3d0198,_0x2abb4d,_0x34c3b1){return db['License'][_0x59c1('0xe')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x88d3e9){var _0x1c0464=getValueFromLicense(_0x5377f2,_0x88d3e9);return _0x1c0464?_0x1c0464:_0x202b54;})[_0x59c1('0xf')](function(_0x43306a){_0x202b54=_0x43306a;return _0x4867af['count'](_0x4e7cc0);})['then'](function(_0x3bd2c2){if(_0x3bd2c2>=_0x202b54){return _0x2abb4d[_0x59c1('0x10')](0x193)[_0x59c1('0x11')]({'message':util[_0x59c1('0x8')](_0x59c1('0x12'),_0x5377f2)});}_0x34c3b1();})[_0x59c1('0x13')](function(_0x35de71){_0x34c3b1(_0x35de71);});});}function isUserLimit(){return isLimit(_0x59c1('0x14'),0x1,db[_0x59c1('0x15')],{'where':{'$or':[{'role':_0x59c1('0x16')},{'role':'user'}]}});}exports[_0x59c1('0x17')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 1da43e4..a6e04c1 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 _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 +var _0x114d=['\x20IS\x20NULL)','$in','$notIn','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','$gt','>\x20?','$lte','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$between','pop','DATE','utcOffset','add','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','[$and]','replace','split','slice','shift','forEach','filter','indexOf','map','push','buildExpression','$eq','operator','value','includes','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','\x20OR\x20'];(function(_0x13b9b5,_0x298e69){var _0x154263=function(_0x3c7442){while(--_0x3c7442){_0x13b9b5['push'](_0x13b9b5['shift']());}};_0x154263(++_0x298e69);}(_0x114d,0xc1));var _0xd114=function(_0x18c197,_0x21eaf2){_0x18c197=_0x18c197-0x0;var _0x3424b2=_0x114d[_0x18c197];return _0x3424b2;};'use strict';var _=require(_0xd114('0x0'));var moment=require(_0xd114('0x1'));exports[_0xd114('0x2')]=function(_0x5ece9f){var _0x1ca0ed={'conditions':[]};_0x1ca0ed[_0xd114('0x3')]=_[_0xd114('0x4')](_0x5ece9f,_0xd114('0x5'))?'or':_0xd114('0x6');var _0x3faff6=_0x5ece9f['replace'](_0xd114('0x7'),'')[_0xd114('0x8')](_0xd114('0x5'),'')[_0xd114('0x9')]('||');for(var _0x4c4de2=0x0;_0x4c4de2<_0x3faff6['length'];_0x4c4de2++){var _0x33c715=_0x3faff6[_0x4c4de2][_0xd114('0x9')](':=');var _0xef359a=_0x33c715[0x0];var _0x581017=_0x33c715[_0xd114('0xa')](0x1);_0x581017['forEach'](function(_0x505ceb){var _0x464d92=_0x505ceb[_0xd114('0x9')]('[')[_0xd114('0xb')]();var _0x49e426=_0x505ceb['match'](/\[(.*?)\]/g);_0x49e426[_0xd114('0xc')](function(_0x3f1629){var _0x5bd3d4=_0x3f1629[_0xd114('0x9')]('[')[_0xd114('0xd')](function(_0x5cfde8){return _0x5cfde8[_0xd114('0xe')](']')>-0x1;})[_0xd114('0xf')](function(_0x55b511){return _0x55b511[_0xd114('0x9')](']')[0x0];})[0x0];_0x1ca0ed['conditions'][_0xd114('0x10')]({'field':_0xef359a,'operator':_0x464d92,'value':_0x5bd3d4});});});}return _0x1ca0ed;};exports[_0xd114('0x11')]=function(_0x2b4cb9,_0x5eefce,_0x1e7cf0){var _0x581ca8={};if(_0x5eefce==='DATE'){if(_0x1e7cf0['operator']===_0xd114('0x12')){_0x1e7cf0[_0xd114('0x13')]='$between';_0x1e7cf0[_0xd114('0x14')]+=','+_0x1e7cf0[_0xd114('0x14')];}else if(_[_0xd114('0x15')](['$gt','$lte'],_0x1e7cf0[_0xd114('0x13')])){_0x1e7cf0[_0xd114('0x14')]=moment(_0x1e7cf0['value'])['add'](0x1,'days')[_0xd114('0x16')](_0xd114('0x17'));}}if(_0x1e7cf0[_0xd114('0x18')]){_0x5eefce=_0x1e7cf0[_0xd114('0x18')];_0x581ca8[_0xd114('0x19')]=_0xd114('0x1a')+_0x2b4cb9+'.'+_0x1e7cf0[_0xd114('0x1b')]+_0xd114('0x1c')+_0x1e7cf0[_0xd114('0x18')]+')\x20'+parseOperator(_0x1e7cf0[_0xd114('0x13')]);}else{_0x581ca8[_0xd114('0x19')]=_0x2b4cb9+'.'+_0x1e7cf0['field']+'\x20'+parseOperator(_0x1e7cf0[_0xd114('0x13')]);}if(_['includes']([_0xd114('0x1d'),'$notIn'],_0x1e7cf0[_0xd114('0x13')]))_0x581ca8['text']='('+_0x581ca8['text']+_0xd114('0x1e')+_0x2b4cb9+'.'+_0x1e7cf0['field']+_0xd114('0x1f');_0x581ca8[_0xd114('0x14')]=parseValue(_0x5eefce,_0x1e7cf0[_0xd114('0x13')],_0x1e7cf0[_0xd114('0x14')]);return _0x581ca8;};function parseOperator(_0xd540b7){var _0x1d93f6;switch(_0xd540b7){case _0xd114('0x20'):_0x1d93f6='IN\x20?';break;case _0xd114('0x21'):_0x1d93f6='NOT\x20IN\x20?';break;case _0xd114('0x12'):_0x1d93f6=_0xd114('0x22');break;case _0xd114('0x1d'):_0x1d93f6=_0xd114('0x23');break;case _0xd114('0x24'):case _0xd114('0x25'):case _0xd114('0x26'):_0x1d93f6=_0xd114('0x27');break;case _0xd114('0x28'):_0x1d93f6='<\x20?';break;case _0xd114('0x29'):_0x1d93f6=_0xd114('0x2a');break;case _0xd114('0x2b'):_0x1d93f6=_0xd114('0x2c');break;case _0xd114('0x2d'):_0x1d93f6=_0xd114('0x2e');break;case'$between':_0x1d93f6=_0xd114('0x2f');break;}return _0x1d93f6;}function parseValue(_0x1226fa,_0x2618ab,_0x1bf65c){var _0xe619b6={'start':undefined,'end':undefined};switch(_0x2618ab){case'$in':case _0xd114('0x21'):_0xe619b6[_0xd114('0x30')]=_0x1bf65c[_0xd114('0x9')](',');break;case _0xd114('0x24'):_0xe619b6['start']='%'+_0x1bf65c+'%';break;case _0xd114('0x25'):_0xe619b6['start']=_0x1bf65c+'%';break;case'$endsWith':_0xe619b6[_0xd114('0x30')]='%'+_0x1bf65c;break;case _0xd114('0x31'):var _0xe8181a=_0x1bf65c[_0xd114('0x9')](',');var _0x1bf65c=_0xe8181a[_0xd114('0xb')]();var _0x3fec57=_0xe8181a[_0xd114('0x32')]();if(_0x1226fa===_0xd114('0x33')){_0x1bf65c=moment(_0x1bf65c)[_0xd114('0x34')](0x0,!![])[_0xd114('0x16')]();_0x3fec57=moment(_0x3fec57)[_0xd114('0x34')](0x0,!![])[_0xd114('0x35')](0x17,'hours')['add'](0x3b,_0xd114('0x36'))['add'](0x3b,_0xd114('0x37'))[_0xd114('0x16')]();}_0xe619b6={'start':_0x1bf65c,'end':_0x3fec57};break;default:_0xe619b6[_0xd114('0x30')]=_0x1bf65c;break;}return _0xe619b6;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index ee11bfa..b9886f9 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 _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 +var _0x88cf=['uniqueid','isArray','offset','map','indexOf','priority','cast','col','substr','DESC','unsigned','ASC','length','isObject','isString','hasOwnProperty','omit','^[+]?[0-9]*$','match','\x22{EXPR}\x22','{EXPR}','forEach','replace','push','join','getOptions','query','$id','filters','intersection','attributes','nolimit','limit','order','sort','where','pick','filter','object','value','merge','VIRTUAL','lower','options','include','includeAll','lodash','sequelize','moment','../../mysqldb','parse','keys','includes','model','alias','fields','raw','split','isEmpty','forOwn','find','type','DATE','$gte','format','YYYY-MM-DD','utc','name'];(function(_0xcca7a0,_0x303572){var _0x3ed88e=function(_0x1a07ae){while(--_0x1a07ae){_0xcca7a0['push'](_0xcca7a0['shift']());}};_0x3ed88e(++_0x303572);}(_0x88cf,0x1c6));var _0xf88c=function(_0x3d8d7e,_0x2eebd){_0x3d8d7e=_0x3d8d7e-0x0;var _0x476c55=_0x88cf[_0x3d8d7e];return _0x476c55;};'use strict';var _=require(_0xf88c('0x0'));var sequelize=require(_0xf88c('0x1'));var moment=require(_0xf88c('0x2'));var db=require(_0xf88c('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2040c5){var _0x112ab7=['ne'];try{var _0x59f610=JSON[_0xf88c('0x4')](_0x2040c5);var _0x574ecc=Object[_0xf88c('0x5')](_0x59f610)[0x0];return _0x112ab7[_0xf88c('0x6')](_0x574ecc);}catch(_0xc7159d){return![];}}function getOperatorValue(_0x2ca1bd){var _0x570395=JSON[_0xf88c('0x4')](_0x2ca1bd);var _0x5426c0=Object[_0xf88c('0x5')](_0x570395)[0x0];var _0xddd64d=_0x570395[_0x5426c0];return{['$'+_0x5426c0]:_0xddd64d};}function parseIncludeModel(_0x257dd9){var _0x4eca06=JSON[_0xf88c('0x4')](_0x257dd9);return{'model':db[_0x4eca06[_0xf88c('0x7')]],'as':_0x4eca06[_0xf88c('0x8')],'attributes':_0x4eca06[_0xf88c('0x9')],'raw':_0x4eca06[_0xf88c('0xa')]};}exports['fields']=function(_0x5d9d10){var _0x1eb646=null;if(_0x5d9d10){_0x1eb646=_0x5d9d10[_0xf88c('0xb')](',');}return _0x1eb646;};exports['filters']=function(_0x91be0b,_0x726e9f){var _0x225430={};if(!_[_0xf88c('0xc')](_0x91be0b)){_[_0xf88c('0xd')](_0x91be0b,function(_0x3312df,_0x2d8af7){try{if(_0x726e9f){var _0x2fbef8=_[_0xf88c('0xe')](_0x726e9f,{'name':_0x2d8af7})||{};if(hasSequelizeOperator(_0x3312df)){_0x225430[_0x2d8af7]=getOperatorValue(_0x3312df);}else if(_0x2fbef8[_0xf88c('0xf')]===_0xf88c('0x10')&&_['isPlainObject'](_0x3312df)){var _0x197b1e=JSON[_0xf88c('0x4')](_0x3312df);var _0x53bc28={'$gte':moment(moment(_0x197b1e[_0xf88c('0x11')])[_0xf88c('0x12')](_0xf88c('0x13')))[_0xf88c('0x14')]()[_0xf88c('0x12')](),'$lte':moment(moment(_0x197b1e['$lte'])[_0xf88c('0x12')](_0xf88c('0x13')))['utc']()['subtract'](0x1,'s')[_0xf88c('0x12')]()};_0x225430[_0x2d8af7]=_0x53bc28;}else if(_0x2fbef8[_0xf88c('0x15')]===_0xf88c('0x16')){_0x225430[_0x2d8af7]=_0x3312df;}else{_0x225430[_0x2d8af7]=_['isArray'](_0x3312df)?_0x3312df:JSON[_0xf88c('0x4')](_0x3312df);}}else{_0x225430[_0x2d8af7]=_[_0xf88c('0x17')](_0x3312df)?_0x3312df:JSON[_0xf88c('0x4')](_0x3312df);}}catch(_0x3c87fe){_0x225430[_0x2d8af7]=_0x3312df[_0xf88c('0xb')](',');}});}return _0x225430;};exports['limit']=function(_0x264fca){_0x264fca=parseInt(_0x264fca,0xa);if(!_0x264fca||_0x264fca<0x0){_0x264fca=LIMIT_VALUE;}return _0x264fca;};exports[_0xf88c('0x18')]=function(_0x3bfa2b){_0x3bfa2b=parseInt(_0x3bfa2b,0xa);if(!_0x3bfa2b||_0x3bfa2b<0x0){_0x3bfa2b=0x0;}return _0x3bfa2b;};exports['sort']=function(_0x15e868){var _0x3aee46,_0x1cad8e=null;if(_0x15e868){_0x3aee46=_0x15e868[_0xf88c('0xb')](',');_0x1cad8e=_[_0xf88c('0x19')](_0x3aee46,function(_0x150704){if(_0x150704[_0xf88c('0x1a')]('-')===0x0){return[_0x150704===_0xf88c('0x1b')?sequelize[_0xf88c('0x1c')](sequelize[_0xf88c('0x1d')](_0xf88c('0x1b')),'unsigned'):_0x150704[_0xf88c('0x1e')](0x1),_0xf88c('0x1f')];}else{return[_0x150704==='priority'?sequelize['cast'](sequelize[_0xf88c('0x1d')]('priority'),_0xf88c('0x20')):_0x150704,_0xf88c('0x21')];}});}return _0x1cad8e;};exports['omit']=function(_0x39b0ba,_0x365d76){if(_['isEmpty'](_0x39b0ba)){return _0x39b0ba;}if(_[_0xf88c('0x17')](_0x39b0ba)){for(var _0x4cc7ac=0x0;_0x4cc7ac<_0x39b0ba[_0xf88c('0x22')];_0x4cc7ac+=0x1){_0x39b0ba[_0x4cc7ac]=this['omit'](_0x39b0ba[_0x4cc7ac],_0x365d76);}return _0x39b0ba;}if(!_[_0xf88c('0x23')](_0x39b0ba)){return _0x39b0ba;}if(_[_0xf88c('0x24')](_0x365d76)){_0x365d76=[_0x365d76];}if(!_[_0xf88c('0x17')](_0x365d76)){return _0x39b0ba;}for(var _0xba7be=0x0;_0xba7be<_0x365d76[_0xf88c('0x22')];_0xba7be+=0x1){_['unset'](_0x39b0ba,_0x365d76[_0xba7be]);}for(var _0x46c384 in _0x39b0ba){if(_0x39b0ba[_0xf88c('0x25')](_0x46c384)){_0x39b0ba[_0x46c384]=this[_0xf88c('0x26')](_0x39b0ba[_0x46c384],_0x365d76);}}return _0x39b0ba;};exports['isNumeric']=function(_0x3ede23){return _0x3ede23['match'](RegExp(_0xf88c('0x27')))?!![]:![];};exports['isEmail']=function(_0x376eab){return _0x376eab[_0xf88c('0x28')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x46ec1e,_0x2922d9){var _0x4a9a01=[];var _0x3de374=/[ `!@#$%^&*()_\-?~]/;var _0x5dfeae=_0x2922d9?_0xf88c('0x29'):_0xf88c('0x2a');_0x46ec1e['split'](/[ ,]+/)[_0xf88c('0x2b')](function(_0x11c8b9){_0x11c8b9=_0x11c8b9[_0xf88c('0x2c')](/([^:]")"+/g,'$1');_0x11c8b9='+'+_0x11c8b9+'*';var _0xa6d3d5=_0x11c8b9[_0xf88c('0x28')](_0x3de374);if(_0xa6d3d5){_0x11c8b9='\x22'+_0x11c8b9+'\x22';}_0x4a9a01[_0xf88c('0x2d')](_0x11c8b9);});_0x5dfeae=_0x5dfeae[_0xf88c('0x2c')]('{EXPR}',_0x4a9a01[_0xf88c('0x2e')]('\x20'));return _0x5dfeae;};exports[_0xf88c('0x2f')]=function(_0x5e3a50,_0x2e3328,_0x39fce3){var _0x5ef49d={},_0x23e41c={};if(_0x2e3328['query']['$id']){_0x2e3328[_0xf88c('0x30')]['id']=_0x2e3328[_0xf88c('0x30')][_0xf88c('0x31')];delete _0x2e3328[_0xf88c('0x30')]['$id'];}_0x5ef49d['model']=_[_0xf88c('0x19')](_0x5e3a50,_0xf88c('0x15'));_0x5ef49d[_0xf88c('0x30')]=_['keys'](_0x2e3328[_0xf88c('0x30')]);_0x5ef49d[_0xf88c('0x32')]=_[_0xf88c('0x33')](_0x5ef49d[_0xf88c('0x7')],_0x5ef49d[_0xf88c('0x30')]);_0x23e41c[_0xf88c('0x34')]=_[_0xf88c('0x33')](_0x5ef49d['model'],this[_0xf88c('0x9')](_0x2e3328['query'][_0xf88c('0x9')]));_0x23e41c[_0xf88c('0x34')]=_0x23e41c[_0xf88c('0x34')][_0xf88c('0x22')]?_0x23e41c[_0xf88c('0x34')]:_0x5ef49d['model'];if(!_0x2e3328[_0xf88c('0x30')][_0xf88c('0x25')](_0xf88c('0x35'))){_0x23e41c['limit']=this['limit'](_0x2e3328[_0xf88c('0x30')][_0xf88c('0x36')]);_0x23e41c['offset']=this[_0xf88c('0x18')](_0x2e3328[_0xf88c('0x30')][_0xf88c('0x18')]);}_0x23e41c[_0xf88c('0x37')]=this[_0xf88c('0x38')](_0x2e3328[_0xf88c('0x30')][_0xf88c('0x38')]);_0x23e41c[_0xf88c('0x39')]=this[_0xf88c('0x32')](_[_0xf88c('0x3a')](_0x2e3328['query'],_0x5ef49d[_0xf88c('0x32')]),_0x5e3a50);if(_0x2e3328[_0xf88c('0x30')][_0xf88c('0x3b')]){var _0x3f20cc=_0x5e3a50;var _0x957125=_0x2e3328['query'][_0xf88c('0x3b')];if(typeof _0x957125===_0xf88c('0x3c')){_0x3f20cc=_['filter'](_0x5e3a50,function(_0x530223){return _[_0xf88c('0x6')](_0x957125['columns'],_0x530223['name']);});_0x957125=_0x957125[_0xf88c('0x3d')];}_0x23e41c[_0xf88c('0x39')]=_[_0xf88c('0x3e')](_0x23e41c[_0xf88c('0x39')],{'$or':_[_0xf88c('0x19')](_0x3f20cc,function(_0xeff2c1){if(_0xeff2c1['type']!==_0xf88c('0x3f')){if(_0x39fce3){return sequelize['where'](sequelize['fn'](_0xf88c('0x40'),sequelize['col'](_0xeff2c1[_0xf88c('0x15')])),{'$like':sequelize['fn'](_0xf88c('0x40'),'%'+_0x2e3328[_0xf88c('0x30')]['filter']+'%')});}else{var _0x2ae5e5={};_0x2ae5e5[_0xeff2c1[_0xf88c('0x15')]]={'$like':'%'+_0x2e3328[_0xf88c('0x30')][_0xf88c('0x3b')]+'%'};return _0x2ae5e5;}}})});}_0x23e41c=_[_0xf88c('0x3e')]({},_0x23e41c,_0x2e3328[_0xf88c('0x41')]);return _0x23e41c;};exports[_0xf88c('0x42')]=function(_0x2eed9d){var _0x17cbe1=[];if(_0x2eed9d[_0xf88c('0x43')]){_0x17cbe1[_0xf88c('0x2d')]({'all':!![]});}else if(_0x2eed9d[_0xf88c('0x42')]){if(Array[_0xf88c('0x17')](_0x2eed9d[_0xf88c('0x42')])){_0x17cbe1=Object['keys'](_0x2eed9d[_0xf88c('0x42')])[_0xf88c('0x19')](function(_0x12bb9d){return parseIncludeModel(_0x2eed9d['include'][_0x12bb9d]);});}else{var _0x884917=parseIncludeModel(_0x2eed9d[_0xf88c('0x42')]);_0x17cbe1['push'](_0x884917);}}return _0x17cbe1;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 11258ae..957bcb8 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 _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 +var _0x9b05=['smsCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','smsStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','filterAgentAttributes','../../mysqldb','client','http','openchannelPause','smsPause','voicePause','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','pause','every','chatStatus','faxStatus','mailStatus','openchannelStatus','whatsappStatus','request','error','result','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','catch','busy','isArray','startCase','Queue','map','findOne','getAgents','all','flatten','getAgentIdsByQueues','includes','User','name','fullname','chatPause','faxPause','mailPause','pauseType','find','merge','globalStatus','getSortedAgentsIdsByStatus','split','order','startsWith','ASC','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','validateSortParameter','sort','DESC','toLowerCase','sortAgentsByStatus','userpic','online','lastPauseAt','address','whatsappPause','chatCapacity','mailCapacity','whatsappCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity'];(function(_0x1d9a5c,_0x25cdee){var _0x6966d9=function(_0x56e9da){while(--_0x56e9da){_0x1d9a5c['push'](_0x1d9a5c['shift']());}};_0x6966d9(++_0x25cdee);}(_0x9b05,0x121));var _0x59b0=function(_0x53056c,_0x1d56a9){_0x53056c=_0x53056c-0x0;var _0x5cec88=_0x9b05[_0x53056c];return _0x5cec88;};'use strict';var _=require('lodash');var jayson=require('jayson/promise');var db=require(_0x59b0('0x0'))['db'];var amiClient=jayson[_0x59b0('0x1')][_0x59b0('0x2')]({'port':0x232a});var routingClient=jayson[_0x59b0('0x1')][_0x59b0('0x2')]({'port':0x232c});function isAgentPaused(_0x5eb6ee,_0x59873f){var _0xc1c5d5=[_0x5eb6ee['chatPause'],_0x5eb6ee['faxPause'],_0x5eb6ee['mailPause'],_0x5eb6ee[_0x59b0('0x3')],_0x5eb6ee[_0x59b0('0x4')],_0x5eb6ee[_0x59b0('0x5')],_0x5eb6ee['whatsappPause']];if(!_0x59873f)return _['every'](_0xc1c5d5);var _0x3cfe58=_[_0x59b0('0x6')](_0xc1c5d5);return _0x3cfe58[_0x59b0('0x7')]>0x0&&_0x3cfe58[_0x59b0('0x7')]<_0xc1c5d5['length']?!![]:![];}function isIdle(_0x45a10f){return _0x45a10f===_0x59b0('0x8')||_0x45a10f===_0x59b0('0x9')||_0x45a10f===_0x59b0('0xa')||_0x45a10f===_0x59b0('0xb')||_[_0x59b0('0xc')](_0x45a10f);}function isAgentIdle(_0x567a1e){if(_0x567a1e['voiceStatus']!==_0x59b0('0x8')&&_0x567a1e[_0x59b0('0x5')]){_0x567a1e[_0x59b0('0xd')]=_0x59b0('0xe');return![];}return _[_0x59b0('0xf')]([_0x567a1e[_0x59b0('0x10')],_0x567a1e[_0x59b0('0x11')],_0x567a1e[_0x59b0('0x12')],_0x567a1e[_0x59b0('0x13')],_0x567a1e['smsStatus'],_0x567a1e[_0x59b0('0xd')],_0x567a1e[_0x59b0('0x14')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x59b0('0x15')]('Agents',{})['then'](function(_0x184078){if(_0x184078[_0x59b0('0x16')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x4e7af8=_0x184078[_0x59b0('0x17')];return routingClient[_0x59b0('0x15')](_0x59b0('0x18'),{})[_0x59b0('0x19')](function(_0x43e3d5){if(_0x43e3d5[_0x59b0('0x16')]){throw new Error(_0x59b0('0x1a'));}var _0x541e00=_0x43e3d5['result'];return _['merge']({},_0x4e7af8,_0x541e00);});})[_0x59b0('0x1b')](function(_0x1e0a12){throw _0x1e0a12;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x2e5e9f){var _0xdd75c6=_0x59b0('0x9');if(isAgentPaused(_0x2e5e9f))_0xdd75c6=_0x59b0('0xe');else if(isAgentPaused(_0x2e5e9f,!![]))_0xdd75c6='*pause';else if(isAgentIdle(_0x2e5e9f))_0xdd75c6='idle';else _0xdd75c6=_0x59b0('0x1c');return _0xdd75c6;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x502b80,_0x4d7106){var _0x260fc8=_[_0x59b0('0x1d')](_0x502b80)?_0x502b80:[_0x502b80];var _0x13b0e1=_[_0x59b0('0x1e')](_0x4d7106)+_0x59b0('0x1f');var _0x38b2ed=_[_0x59b0('0x20')](_0x260fc8,function(_0x48416c){return db[_0x13b0e1][_0x59b0('0x21')]({'where':{'id':_0x48416c}})[_0x59b0('0x19')](function(_0x157d1a){if(!_0x157d1a)return[];return _0x157d1a[_0x59b0('0x22')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x59b0('0x23')](_0x38b2ed)['then'](function(_0x37fcbd){var _0x13fdd8=_(_0x37fcbd)[_0x59b0('0x24')]()['map']('id')['uniq']()['value']();return _0x13fdd8;});}exports[_0x59b0('0x25')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x29f1d3,_0x35442c,_0x4d867a){try{if(_0x35442c['length']>0x0){_0x29f1d3=_0x29f1d3[_0x59b0('0x6')](function(_0x450f0c){return _0x35442c[_0x59b0('0x26')](_0x450f0c['id']);});}var _0x1d7429=_0x29f1d3[_0x59b0('0x6')](function(_0x336ca4){var _0x2d501f=_0x59b0('0x1c');if(isAgentIdle(_0x336ca4)){_0x2d501f='idle';}return _0x2d501f===_0x4d867a;});return _[_0x59b0('0x20')](_0x1d7429,'id');}catch(_0x41972d){throw _0x41972d;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x2b9f70,_0x1fee75,_0x2c8aa4){return Promise['resolve']()[_0x59b0('0x19')](function(){if(_0x1fee75[_0x59b0('0x7')]>0x0){_0x2b9f70=_0x2b9f70[_0x59b0('0x6')](function(_0x318d82){return _0x1fee75['includes'](_0x318d82['id']);});}return _0x2b9f70;})[_0x59b0('0x19')](function(){return db[_0x59b0('0x27')]['findAll']({'attributes':['id',_0x59b0('0x28'),_0x59b0('0x29'),_0x59b0('0x2a'),_0x59b0('0x2b'),_0x59b0('0x2c'),_0x59b0('0x3'),_0x59b0('0x4'),_0x59b0('0x5'),'whatsappPause',_0x59b0('0x2d')],'where':{'id':{'$in':_[_0x59b0('0x20')](_0x2b9f70,'id')}},'raw':!![]});})[_0x59b0('0x19')](function(_0x2bb66b){return _0x2bb66b[_0x59b0('0x20')](function(_0x44de7e){var _0x2cfc8c=_[_0x59b0('0x2e')](_0x2b9f70,['id',_0x44de7e['id']]);var _0x5a9610=filterAgentAttributes(_0x2cfc8c);_[_0x59b0('0x2f')](_0x44de7e,_0x5a9610);_0x44de7e[_0x59b0('0x30')]=getAgentStatus(_0x44de7e);return _0x44de7e;});})['then'](function(_0x3defed){var _0x3c4c8a=sortAgentsByStatus(_0x3defed,_0x2c8aa4);return _['map'](_0x3c4c8a,'id');})[_0x59b0('0x1b')](function(_0x2654b1){throw _0x2654b1;});}exports[_0x59b0('0x31')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x440c28){var _0x287e26={'fields':[],'order':null};var _0x5192dc=_0x440c28[_0x59b0('0x32')](',');_0x287e26['fields']=_['filter'](_0x5192dc,function(_0x126e02){if(!_0x126e02[_0x59b0('0x26')](_0x59b0('0x30'))){return!![];}_0x287e26[_0x59b0('0x33')]=_[_0x59b0('0x34')](_0x126e02,'-')?'DESC':_0x59b0('0x35');return![];});return _0x287e26;}exports[_0x59b0('0x36')]=getUpdatedSortOptions;function validateSortParameter(_0x4a4e6e){if(!_0x4a4e6e){_0x4a4e6e=_0x59b0('0x37');}if(_0x4a4e6e[_0x59b0('0x26')](_0x59b0('0x29'))&&!_0x4a4e6e[_0x59b0('0x26')](_0x59b0('0x38'))){var _0x1ccca9=_0x4a4e6e[_0x59b0('0x39')](0x0,_0x4a4e6e[_0x59b0('0x3a')](_0x59b0('0x29')));_0x4a4e6e+=','+_0x1ccca9+_0x59b0('0x38');}return _0x4a4e6e;}exports[_0x59b0('0x3b')]=validateSortParameter;function sortAgentsByStatus(_0x245528,_0x323fdb){var _0x34a9fd=_0x245528[_0x59b0('0x3c')](function(_0x1758a7,_0x2c32a2){if(_0x1758a7['globalStatus']===_0x2c32a2['globalStatus']){if(_0x1758a7[_0x59b0('0x30')]===_0x59b0('0xe')){if(_0x323fdb===_0x59b0('0x3d')){return(_0x1758a7['pauseType']||'')<(_0x2c32a2[_0x59b0('0x2d')]||'')||_0x1758a7[_0x59b0('0x29')]['toLowerCase']()>_0x2c32a2[_0x59b0('0x29')][_0x59b0('0x3e')]()?0x1:-0x1;}else{return(_0x1758a7[_0x59b0('0x2d')]||'')<(_0x2c32a2['pauseType']||'')||_0x1758a7[_0x59b0('0x29')][_0x59b0('0x3e')]()>_0x2c32a2['fullname'][_0x59b0('0x3e')]()?-0x1:0x1;}}else{if(_0x323fdb===_0x59b0('0x3d')){return _0x1758a7[_0x59b0('0x29')]['toLowerCase']()<_0x2c32a2[_0x59b0('0x29')][_0x59b0('0x3e')]()?0x1:-0x1;}else{return _0x1758a7[_0x59b0('0x29')]['toLowerCase']()<_0x2c32a2[_0x59b0('0x29')][_0x59b0('0x3e')]()?-0x1:0x1;}}}else{if(_0x323fdb==='DESC'){return _0x1758a7[_0x59b0('0x30')]<_0x2c32a2['globalStatus']?0x1:-0x1;}else{return _0x1758a7[_0x59b0('0x30')]<_0x2c32a2[_0x59b0('0x30')]?-0x1:0x1;}}});return _0x34a9fd;}exports[_0x59b0('0x3f')]=sortAgentsByStatus;function filterAgentAttributes(_0x15638b){var _0x21c90d=[_0x59b0('0x40'),_0x59b0('0x41'),'lastLoginAt',_0x59b0('0x42'),_0x59b0('0x2d'),'lastPauseAt','internal',_0x59b0('0x43'),'chatPause',_0x59b0('0x3'),_0x59b0('0x2c'),'smsPause',_0x59b0('0x44'),_0x59b0('0x2b'),_0x59b0('0x5'),_0x59b0('0x45'),'openchannelCapacity',_0x59b0('0x46'),'smsCapacity',_0x59b0('0x47'),'faxCapacity',_0x59b0('0x48'),_0x59b0('0x49'),_0x59b0('0x4a'),_0x59b0('0x4b'),'whatsappCurrentCapacity',_0x59b0('0x4c'),_0x59b0('0x10'),_0x59b0('0x13'),'mailStatus','smsStatus',_0x59b0('0x14'),_0x59b0('0x11'),'voiceStatus',_0x59b0('0x4d'),_0x59b0('0x4e'),'mailStatusTime',_0x59b0('0x4f'),'whatsappStatusTime',_0x59b0('0x50'),_0x59b0('0x51'),_0x59b0('0x52'),_0x59b0('0x53'),_0x59b0('0x54'),_0x59b0('0x55'),_0x59b0('0x56'),_0x59b0('0x57')];var _0x52e874=[_0x59b0('0x2a'),'openchannelPause',_0x59b0('0x2c'),_0x59b0('0x4'),_0x59b0('0x44'),_0x59b0('0x2b'),_0x59b0('0x5'),_0x59b0('0x41')];var _0x862ea4=_(_0x15638b)[_0x59b0('0x58')](_0x52e874)[_0x59b0('0x59')](_0x21c90d)['value']();return _0x862ea4;}exports[_0x59b0('0x5a')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 21be4e9..5ba1d29 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 _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 +var _0x298e=['startCase','Queues','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','get','loggedIn','outbound','pTalking','originated','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','paused','waiting','busy','inUse','loggedInDb','onHold','ringing','talking','unavailable','unknown','statusMessage','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice'];(function(_0x221888,_0x1d2891){var _0x18bc6c=function(_0x485060){while(--_0x485060){_0x221888['push'](_0x221888['shift']());}};_0x18bc6c(++_0x1d2891);}(_0x298e,0x1ef));var _0xe298=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x298e[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xe298('0x0'));var jayson=require(_0xe298('0x1'));var util=require(_0xe298('0x2'));var amiClient=jayson[_0xe298('0x3')][_0xe298('0x4')]({'port':0x232a});var routingClient=jayson[_0xe298('0x3')][_0xe298('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xe298('0x5'),'loggedIn',_0xe298('0x6'),_0xe298('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0xe298('0x8'),_0xe298('0x9'),'invalid',_0xe298('0xa'),'notInUse',_0xe298('0xb'),_0xe298('0xc'),'ringInUse',_0xe298('0xd'),_0xe298('0xe'),_0xe298('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking','originated','message',_0xe298('0x10'),_0xe298('0x11'),_0xe298('0x12'),_0xe298('0x13'),_0xe298('0x14'),_0xe298('0x15'),'erlangCalls','erlangCallToSecond',_0xe298('0x16'),_0xe298('0x17'),_0xe298('0x18'),_0xe298('0x19'),_0xe298('0x1a'),_0xe298('0x1b'),_0xe298('0x1c'),_0xe298('0x1d'),_0xe298('0x1e'),_0xe298('0x1f'),_0xe298('0x20'),_0xe298('0x21')];function getRealtimeQueues(_0x4aa75e,_0x35b313){var _0xf24fc0=_0x35b313===_0xe298('0x22')?amiClient:routingClient;return _0xf24fc0['request'](_[_0xe298('0x23')](_0x35b313)+_0xe298('0x24'),_0x4aa75e)[_0xe298('0x25')](function(_0x5ed73d){if(_0x5ed73d['error'])throw new Error(util[_0xe298('0x26')](_0xe298('0x27'),_0x35b313));return _0x5ed73d[_0xe298('0x28')];})[_0xe298('0x29')](function(_0x212e4a){throw _0x212e4a;});}exports[_0xe298('0x2a')]=getRealtimeQueues;function initializeQueues(_0x33f9c9,_0x34169f,_0x4006e1,_0x2dfca3){var _0x1a056f=DEFAULT_QUEUE_ATTRIBUTES;if(_0x4006e1===_0xe298('0x22')){if(_0x2dfca3===_0xe298('0x2b')){_0x1a056f=_0x1a056f[_0xe298('0x2c')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x2dfca3==='outbound'){_0x1a056f=_0x1a056f[_0xe298('0x2c')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x33f9c9['map'](function(_0x169c2e){var _0xf63556=_0x169c2e[_0xe298('0x2d')]({'plain':!![]});_0xf63556['paused']=0x0;_0xf63556[_0xe298('0xa')]=0x0;_0xf63556[_0xe298('0x2e')]=0x0;_0xf63556['available']=0x0;_0xf63556[_0xe298('0x7')]=0x0;if(_0x4006e1===_0xe298('0x22')){_0xf63556[_0xe298('0xd')]=0x0;_0xf63556[_0xe298('0x8')]=0x0;if(_0x2dfca3===_0xe298('0x2f')){_0xf63556[_0xe298('0x30')]=0x0;_0xf63556[_0xe298('0x31')]=0x0;}}var _0x15389a=_['find'](_0x34169f,['id',_0xf63556['id']]);if(_0x15389a){_[_0xe298('0x32')](_0xf63556,_[_0xe298('0x33')](_0x15389a,_0x1a056f));}return _0xf63556;});}exports[_0xe298('0x34')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 8c918c9..e6759a4 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(_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 +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x4fd109,_0x33c503){var _0x30f0a6=function(_0xc11c0d){while(--_0xc11c0d){_0x4fd109['push'](_0x4fd109['shift']());}};_0x30f0a6(++_0x33c503);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 21a4118..a901a01 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 _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 +var _0x668f=['substring','lodash','crypto','bimedia-machine-uuid','child_process','../environment','networkInterfaces','keys','internal','concat','head','mac','00:00:00:00:00:00','address','cpus','map','createHash','digest','hex','getUuid','platform','licenseToken','dmidecode\x20--string\x20system-uuid','hostname','macAddress','ipAddress','md5','update'];(function(_0x471cec,_0x5394b6){var _0x166300=function(_0xca113e){while(--_0xca113e){_0x471cec['push'](_0x471cec['shift']());}};_0x166300(++_0x5394b6);}(_0x668f,0x1dd));var _0xf668=function(_0x1e4df1,_0x208905){_0x1e4df1=_0x1e4df1-0x0;var _0x584edf=_0x668f[_0x1e4df1];return _0x584edf;};'use strict';var _=require(_0xf668('0x0'));var os=require('os');var crypto=require(_0xf668('0x1'));var machine=require(_0xf668('0x2'));var exec=require(_0xf668('0x3'))['execSync'];var config=require(_0xf668('0x4'));function getInterfaces(){var _0x1e9917=[];var _0x1387b3=os[_0xf668('0x5')]();var _0x54fb5a=_['orderBy'](_[_0xf668('0x6')](_0x1387b3));for(var _0x1aaa17=0x0;_0x1aaa17<_0x54fb5a['length'];_0x1aaa17++){var _0x59996c=_0x1387b3[_0x54fb5a[_0x1aaa17]]['filter'](function(_0xc46f15){return _0xc46f15['family']==='IPv4'&&_0xc46f15[_0xf668('0x7')]===![];});_0x1e9917=_0x1e9917[_0xf668('0x8')](_0x59996c);}return _0x1e9917;}function getFirstInterface(){var _0x5bab95=_[_0xf668('0x9')](getInterfaces());return{'macAddress':_0x5bab95&&_0x5bab95['mac']?_0x5bab95[_0xf668('0xa')]:_0xf668('0xb'),'ipAddress':_0x5bab95&&_0x5bab95[_0xf668('0xc')]?_0x5bab95[_0xf668('0xc')]:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x4a4117=_['orderBy'](os[_0xf668('0xd')]()[_0xf668('0xe')](function(_0x418b6a){return _0x418b6a['model'];}))['join'](':');return crypto[_0xf668('0xf')]('md5')['update'](_0x4a4117)[_0xf668('0x10')](_0xf668('0x11'));}exports[_0xf668('0x12')]=function(){var _0x4ff54e=os[_0xf668('0x13')]();var _0x4fd8c=/[0-9a-f-]{36}/;if(config[_0xf668('0x14')]&&_0x4fd8c['test'](config[_0xf668('0x14')])){return config[_0xf668('0x14')];}else if(_0x4ff54e==='win32'){return exec(_0xf668('0x15'),{'encoding':'utf8'})['replace']('\x0d\x0a','');}else{var _0x57377c=getFirstInterface();var _0x89453e=getCPUhash();var _0x72952d=_0x89453e+'|'+os[_0xf668('0x16')]()+'|'+_0x57377c[_0xf668('0x17')]+'|'+_0x57377c[_0xf668('0x18')];var _0x280eab=crypto[_0xf668('0xf')](_0xf668('0x19'))[_0xf668('0x1a')](_0x72952d)[_0xf668('0x10')]('hex');return _0x280eab['substring'](0x0,0x8)+'-'+_0x280eab[_0xf668('0x1b')](0x8,0xc)+'-'+_0x280eab[_0xf668('0x1b')](0xc,0x10)+'-'+_0x280eab['substring'](0x10,0x14)+'-'+_0x280eab[_0xf668('0x1b')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 0653dbc..e02c848 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 _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 +var _0x7371=['%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','decryptString','days','DEMO\x20START\x20AT\x20%s','getUuid','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','message','util','moment','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','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'];(function(_0x58965a,_0x2e71db){var _0x254efc=function(_0xf14fb4){while(--_0xf14fb4){_0x58965a['push'](_0x58965a['shift']());}};_0x254efc(++_0x2e71db);}(_0x7371,0x14c));var _0x1737=function(_0x5012c3,_0x45c477){_0x5012c3=_0x5012c3-0x0;var _0xfded74=_0x7371[_0x5012c3];return _0xfded74;};'use strict';var util=require(_0x1737('0x0'));var moment=require(_0x1737('0x1'));var rp=require('request-promise');var BPromise=require(_0x1737('0x2'));var pkginfo=require(_0x1737('0x3'))(module,_0x1737('0x4'));var db=require(_0x1737('0x5'))['db'];var encryptor=require(_0x1737('0x6'));var hardware=require('./hardware');var logger=require(_0x1737('0x7'))(_0x1737('0x8'));var HOST=_0x1737('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x593f16){return new BPromise(function(_0x526564,_0xabd7be){var _0x45bc50=util[_0x1737('0xa')](_0x1737('0xb'),HOST,_0x593f16,module[_0x1737('0xc')][_0x1737('0x4')]);if(oldToken){_0x45bc50=util[_0x1737('0xa')](_0x1737('0xd'),HOST,_0x593f16,module[_0x1737('0xc')][_0x1737('0x4')],oldToken);}var _0x7b3e48={'uri':_0x45bc50,'method':_0x1737('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x7b3e48)[_0x1737('0xf')](function(_0x255edc){_0x526564(_0x255edc);})[_0x1737('0x10')](function(_0x5dc2f8){_0xabd7be(_0x5dc2f8);});});}function manageLicense(_0x24be43,_0x597de6){var _0x28f571=_0x597de6[_0x1737('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x28f571[_0x1737('0x12')]!==_0x24be43&&!_0x28f571[_0x1737('0x13')]){oldToken=_0x28f571[_0x1737('0x12')];}httpRequest(_0x24be43)[_0x1737('0xf')](function(_0x4ac727){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4ac727['active']){isOldTokenSent=![];if(!_0x28f571[_0x1737('0x8')]&&_0x28f571[_0x1737('0x8')]!=_0x4ac727[_0x1737('0x8')]||_0x28f571[_0x1737('0x8')]&&_0x28f571['data2']){logger[_0x1737('0x14')](_0x1737('0x15'));}if(_0x28f571[_0x1737('0x8')]&&!_0x28f571[_0x1737('0x13')]&&_0x28f571['license']!=_0x4ac727[_0x1737('0x8')]){logger[_0x1737('0x14')](_0x1737('0x16'));}if(_0x28f571[_0x1737('0x8')]&&!_0x28f571[_0x1737('0x13')]&&_0x28f571[_0x1737('0x8')]==_0x4ac727[_0x1737('0x8')]){return _0x597de6;}return _0x597de6[_0x1737('0x17')]({'data1':_0x24be43,'data2':null,'license':_0x4ac727[_0x1737('0x8')]});}else{if(_0x4ac727['license']||_0x28f571[_0x1737('0x8')]){if(!_0x28f571['data2']){if(_0x28f571[_0x1737('0x12')]==_0x24be43){GRAY_PERIOD_REASON=_0x1737('0x18');logger[_0x1737('0x14')](_0x1737('0x19'));}else{GRAY_PERIOD_REASON=_0x1737('0x1a');logger[_0x1737('0x14')](_0x1737('0x1b'),_0x28f571[_0x1737('0x12')],_0x24be43);}logger[_0x1737('0x14')](_0x1737('0x1c'),GRAY_PERIOD_REASON[_0x1737('0x1d')](),moment()[_0x1737('0xa')]('YYYY-MM-DD\x20HH:mm'));return _0x597de6[_0x1737('0x17')]({'data2':encryptor[_0x1737('0x1e')](moment()[_0x1737('0xa')](_0x1737('0x1f')))});}else{if(moment()['diff'](encryptor[_0x1737('0x20')](_0x28f571['data2']),_0x1737('0x21'))>DAYS){logger[_0x1737('0x14')](_0x1737('0x22'),moment()[_0x1737('0xa')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x597de6[_0x1737('0x17')]({'data1':_0x24be43,'data2':null,'license':null});}}}else{if(_0x28f571['data1']!=_0x24be43){logger['info'](_0x1737('0x1b'),_0x28f571['data1'],_0x24be43);return _0x597de6[_0x1737('0x17')]({'data1':_0x24be43,'data2':null,'license':null});}}}return _0x597de6;})[_0x1737('0xf')](function(_0x50a0a8){_0x597de6=_0x50a0a8;})[_0x1737('0x10')](function(_0x4d52c4){logger['error'](_0x4d52c4['message']);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x1737('0x23')](),_0x597de6);},TIME);});}function defaultLicense(){var _0x30ed8d=hardware[_0x1737('0x23')]();if(_0x30ed8d){return db['License']['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x30ed8d}})[_0x1737('0x24')](function(_0xc4c5df,_0x4cfa86){logger['info'](_0x1737('0x25'),_0x30ed8d);manageLicense(_0x30ed8d,_0xc4c5df);})[_0x1737('0x10')](function(_0x1ec716){logger[_0x1737('0x26')](_0x1ec716[_0x1737('0x27')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 0c05e41..6e9cd5d 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 _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 +var _0x3546=['split','%s:%s:%s','demo','uuid','machineUuid','gray','add','days','format','changed','disabled','message','User','role','COUNT','sequelize','col','count','admin','forEach','user','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x3546,0x1dd));var _0x6354=function(_0x5e2cb4,_0x592c64){_0x5e2cb4=_0x5e2cb4-0x0;var _0x282902=_0x3546[_0x5e2cb4];return _0x282902;};'use strict';var util=require(_0x6354('0x0'));var _=require(_0x6354('0x1'));var moment=require('moment');var BPromise=require('bluebird');var hardware=require(_0x6354('0x2'));var encryptor=require(_0x6354('0x3'));var db=require(_0x6354('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6354('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x6354('0x6'),'machineUuid':hardware[_0x6354('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6354('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x6354('0x8'),'machineUuid':hardware[_0x6354('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x3c4880){return new BPromise(function(_0x26162e,_0x4d920e){return db[_0x6354('0x9')][_0x6354('0xa')](_[_0x6354('0xb')](_0x3c4880,{'raw':!![],'where':{'id':0x1}}))[_0x6354('0xc')](function(_0x5faa9d){return checkLicense(_0x5faa9d,null);})[_0x6354('0xc')](function(_0x12c065){_0x26162e(_0x12c065);return;})[_0x6354('0xd')](function(_0x2a0b0f){_0x4d920e(_0x2a0b0f);});});}function checkLicense(_0x1a1450,_0x3a4a2e){if(!_0x1a1450){demoLicense['uuid']=_0x1a1450[_0x6354('0xe')];return demoLicense;}try{var _0x2fb2c0=_0x3a4a2e||_0x1a1450[_0x6354('0xf')];if(_[_0x6354('0x10')](_0x2fb2c0)){throw new Error(_0x6354('0x11'));}var _0x5d822c=_0x1a1450['data1'];var _0x34be40=_0x1a1450['data2'];var _0x251dd6=_0x5d822c[_0x6354('0x12')]('-')[0x4];var _0x5d823f=_0x5d822c[_0x6354('0x12')]('-')[0x0];var _0x53883c=encryptor['decryptString'](_0x2fb2c0,util['format'](_0x6354('0x13'),_0x251dd6,_0x5d822c,_0x5d823f));var _0x373b49=JSON['parse'](_0x53883c);_0x373b49[_0x6354('0x14')]=![];_0x373b49[_0x6354('0x15')]=_0x5d822c;_0x373b49[_0x6354('0x16')]=hardware[_0x6354('0x7')]();if(_0x34be40){var _0x35d7cf=encryptor['decryptString'](_0x34be40);_0x373b49[_0x6354('0x17')]=_0x35d7cf;_0x373b49['deadline']=moment(_0x35d7cf)[_0x6354('0x18')](0x7,_0x6354('0x19'))[_0x6354('0x1a')]();_0x373b49['grayReason']=_0x373b49['uuid']!=_0x373b49[_0x6354('0x16')]?_0x6354('0x1b'):_0x6354('0x1c');}return _0x373b49;}catch(_0x390291){breakingLicense[_0x6354('0x15')]=_0x1a1450['data1'];breakingLicense[_0x6354('0x1d')]=_0x390291[_0x6354('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2e911e,_0x6dd1c1){getLicense()[_0x6354('0xc')](function(_0x46ed10){return db[_0x6354('0x1e')]['findAll']({'attributes':[_0x6354('0x1f'),[db['sequelize']['fn'](_0x6354('0x20'),db[_0x6354('0x21')][_0x6354('0x22')](_0x6354('0x1f'))),_0x6354('0x23')]],'group':'role','where':{'role':{'$or':[_0x6354('0x24'),'user','telephone']}},'raw':!![]})['then'](function(_0x10d39e){var _0xefb8cb={'user':_0x46ed10['users']||0x0,'telephone':_0x46ed10['telephones']||0x0};_0x10d39e[_0x6354('0x25')](function(_0x492f00){var _0x108289=_0x492f00['role']===_0x6354('0x24')?_0x6354('0x26'):_0x492f00['role'];_0xefb8cb[_0x108289]-=_0x492f00[_0x6354('0x23')];if(_0xefb8cb[_0x108289]<0x0)_0xefb8cb[_0x108289]=0x0;});_0x2e911e(_0xefb8cb);return;});})['catch'](function(_0xa65c71){_0x6dd1c1(_0xa65c71);});});}function checkUserLimits(_0x6ccc47){return new BPromise(function(_0x208926,_0x3c9032){getLimits()['then'](function(_0x58270b){var _0x5027b1=_[_0x6354('0x27')](_[_0x6354('0x28')](_0x6ccc47,'role'),[_0x6354('0x24'),_0x6354('0x26'),'telephone']);var _0x5c59b1=(_0x5027b1[_0x6354('0x24')]||0x0)+(_0x5027b1[_0x6354('0x26')]||0x0);var _0x34640d=_0x5027b1[_0x6354('0x29')]||0x0;if(_0x5c59b1>_0x58270b[_0x6354('0x26')])return _0x3c9032(_0x6354('0x2a'));if(_0x34640d>_0x58270b[_0x6354('0x29')])return _0x3c9032(_0x6354('0x2b'));return _0x208926();})[_0x6354('0xd')](function(_0x2fd288){_0x3c9032(_0x2fd288);});});}module[_0x6354('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 c6ac66b..6ccf1a5 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 _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 +var _0xb62e=['myappanuglar-secret','app-id','exports','http://localhost:9000'];(function(_0x1e32b6,_0x4ec835){var _0x197e59=function(_0x11339c){while(--_0x11339c){_0x1e32b6['push'](_0x1e32b6['shift']());}};_0x197e59(++_0x4ec835);}(_0xb62e,0x1de));var _0xeb62=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb62e[_0x167cc1];return _0x10bc4b;};'use strict';module[_0xeb62('0x0')]={'DOMAIN':_0xeb62('0x1'),'SESSION_SECRET':_0xeb62('0x2'),'GOOGLE_ID':_0xeb62('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 90ecddb..13dfa8a 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x070a=['fileLogger','exports','../utils/loggers'];(function(_0x41c7a5,_0x3fbcdc){var _0x5ecfb4=function(_0x20cedf){while(--_0x20cedf){_0x41c7a5['push'](_0x41c7a5['shift']());}};_0x5ecfb4(++_0x3fbcdc);}(_0x070a,0x1e5));var _0xa070=function(_0x461631,_0x54a85d){_0x461631=_0x461631-0x0;var _0x526ff8=_0x070a[_0x461631];return _0x526ff8;};'use strict';var fileLogger=require(_0xa070('0x0'))[_0xa070('0x1')];module[_0xa070('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 25b5eba..59bae70 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 _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 +var _0x0429=['../../services/routing/index.js','../../services/xdr/index.js','exports','path','../../config/environment','join','root','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0429,0x7b));var _0x9042=function(_0x1a9742,_0x4384e0){_0x1a9742=_0x1a9742-0x0;var _0x17ece0=_0x0429[_0x1a9742];return _0x17ece0;};'use strict';var path=require(_0x9042('0x0'));var cfg=require(_0x9042('0x1'));var env={'NODE_PATH':path['resolve'](path[_0x9042('0x2')](cfg[_0x9042('0x3')],'legacy-libs'))};var pm2config={'apps':[{'name':'express','script':path[_0x9042('0x2')](__dirname,_0x9042('0x4')),'env':env},{'name':_0x9042('0x5'),'script':path[_0x9042('0x2')](__dirname,_0x9042('0x6')),'env':env},{'name':_0x9042('0x7'),'script':path[_0x9042('0x2')](__dirname,_0x9042('0x8')),'env':env},{'name':'email','script':path[_0x9042('0x2')](__dirname,'../../services/email/index.js'),'env':env},{'name':'routing','script':path['join'](__dirname,_0x9042('0x9')),'env':env},{'name':'xdr','script':path[_0x9042('0x2')](__dirname,_0x9042('0xa')),'env':env}]};module[_0x9042('0xb')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 4acb912..edde2d2 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 _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 +var _0x43c2=['describe','delete','dump','saved','bluebird','./config','connect','connected','start','disconnect','stop','restart','then','list'];(function(_0x1fb233,_0x31d02c){var _0x1b1a0f=function(_0x9915fa){while(--_0x9915fa){_0x1fb233['push'](_0x1fb233['shift']());}};_0x1b1a0f(++_0x31d02c);}(_0x43c2,0x19a));var _0x243c=function(_0x547e0d,_0x464ccf){_0x547e0d=_0x547e0d-0x0;var _0x18a63b=_0x43c2[_0x547e0d];return _0x18a63b;};'use strict';var pm2=require('pm2');var BPromise=require(_0x243c('0x0'));var config=require(_0x243c('0x1'));function connect(){return new BPromise(function(_0x59b545,_0x1375c4){return pm2[_0x243c('0x2')](function(_0x1ea535){if(_0x1ea535){return _0x1375c4(_0x1ea535);}return _0x59b545(_0x243c('0x3'));});});};exports[_0x243c('0x4')]=function(_0x2fb278){return connect()['then'](function(){return new BPromise(function(_0x5792a0,_0x34eaa9){return pm2[_0x243c('0x4')](_0x2fb278,function(_0xb2e080,_0x2427fe){if(_0xb2e080){return _0x34eaa9(_0xb2e080);}pm2[_0x243c('0x5')]();return _0x5792a0(_0x2427fe);});});});};exports[_0x243c('0x6')]=function(_0x270d46){return connect()['then'](function(){return new BPromise(function(_0x40161d,_0x256239){return pm2[_0x243c('0x6')](_0x270d46,function(_0x5de306,_0x5a5278){if(_0x5de306){return _0x256239(_0x5de306);}pm2[_0x243c('0x5')]();return _0x40161d(_0x5a5278);});});});};exports[_0x243c('0x7')]=function(_0x3b19f7){return connect()[_0x243c('0x8')](function(){return new BPromise(function(_0x5f367a,_0x3fff38){return pm2[_0x243c('0x7')](_0x3b19f7,function(_0xd7c8fa,_0x784020){if(_0xd7c8fa){return _0x3fff38(_0xd7c8fa);}pm2[_0x243c('0x5')]();return _0x5f367a(_0x784020);});});});};exports['list']=function(){return connect()[_0x243c('0x8')](function(){return new BPromise(function(_0x34c3ab,_0x380efb){return pm2[_0x243c('0x9')](function(_0x2c78a6,_0x425116){if(_0x2c78a6){return _0x380efb(_0x2c78a6);}pm2[_0x243c('0x5')]();return _0x34c3ab(_0x425116);});});});};exports[_0x243c('0xa')]=function(_0x6f3dd4){return connect()[_0x243c('0x8')](function(){return new BPromise(function(_0x7938c2,_0x389b61){return pm2[_0x243c('0xa')](_0x6f3dd4,function(_0x2ad4d7,_0x239164){if(_0x2ad4d7){return _0x389b61(_0x2ad4d7);}pm2[_0x243c('0x5')]();return _0x7938c2(_0x239164);});});});};exports[_0x243c('0xb')]=function(_0x13417a){return connect()[_0x243c('0x8')](function(){return new BPromise(function(_0x5b068a,_0x3d904e){return pm2[_0x243c('0xb')](_0x13417a,function(_0x45acaf,_0x4274cd){if(_0x45acaf){return _0x3d904e(_0x45acaf);}pm2[_0x243c('0x5')]();return _0x5b068a(_0x4274cd);});});});};exports[_0x243c('0xc')]=function(){return connect()[_0x243c('0x8')](function(){return new BPromise(function(_0x1b1a53,_0x5c4c4f){return pm2[_0x243c('0xc')](function(_0x1ff9a3){if(_0x1ff9a3){return _0x5c4c4f(_0x1ff9a3);}return _0x1b1a53(_0x243c('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index c9b4904..801de97 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 _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 +var _0xd87b=['chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','then','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','update','system','timeout','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','moment','util','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','Setting'];(function(_0x35c450,_0x8d5276){var _0x32a622=function(_0x5486d2){while(--_0x5486d2){_0x35c450['push'](_0x35c450['shift']());}};_0x32a622(++_0x8d5276);}(_0xd87b,0x196));var _0xbd87=function(_0x1bfed0,_0x15afe8){_0x1bfed0=_0x1bfed0-0x0;var _0x4b6350=_0xd87b[_0x1bfed0];return _0x4b6350;};'use strict';var _=require(_0xbd87('0x0'));var moment=require(_0xbd87('0x1'));var Redis=require('ioredis');var util=require(_0xbd87('0x2'));var config=require('../../config/environment');var db=require(_0xbd87('0x3'))['db'];var logger=require(_0xbd87('0x4'))(_0xbd87('0x5'));config[_0xbd87('0x6')]=_[_0xbd87('0x7')](config[_0xbd87('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xbd87('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x3f0da0=0x0;var _0x1c47c4=[];return db[_0xbd87('0x9')]['find']({'raw':!![],'attributes':['id',_0xbd87('0xa')],'where':{'id':0x1}})['then'](function(_0x9112bb){_0x3f0da0=_0x9112bb[_0xbd87('0xa')];if(_0x3f0da0){return db[_0xbd87('0xb')][_0xbd87('0xc')]({'raw':!![],'attributes':['id',_0xbd87('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xbd87('0xe')](_0x9112bb[_0xbd87('0xa')],_0xbd87('0xf'))}}});}else{return[];}})[_0xbd87('0x10')](function(_0x4cdf9f){if(_0x4cdf9f&&_0x4cdf9f[_0xbd87('0x11')]){_0x1c47c4=_[_0xbd87('0x12')](_0x4cdf9f||[],'id');logger[_0xbd87('0x13')](_0xbd87('0x14'),_0x1c47c4['join']());return db[_0xbd87('0xb')][_0xbd87('0x15')]({'closeReason':_0xbd87('0x16'),'disposition':_0xbd87('0x17'),'closed':!![],'closedAt':moment()[_0xbd87('0x18')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x1c47c4}});}})[_0xbd87('0x10')](function(){if(_0x1c47c4&&_0x1c47c4[_0xbd87('0x11')]){logger[_0xbd87('0x13')](_0xbd87('0x19'),_0x1c47c4['join']());for(var _0x1ef6b0=0x0;_0x1ef6b0<_0x1c47c4[_0xbd87('0x11')];_0x1ef6b0++){io[_0xbd87('0x1a')](_0xbd87('0x1b'),{'id':_0x1c47c4[_0x1ef6b0],'closed':!![]});}}})[_0xbd87('0x1c')](function(_0x26e800){logger[_0xbd87('0x1d')](_0xbd87('0x1e'),_0x26e800?util[_0xbd87('0x1f')](_0x26e800,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 338486b..514ae95 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 _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 +'use strict';function start(){var _0x4e04a7=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x4e04a7['startAllRefreshIntervals']();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 1588b75..b78a055 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 _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 +var _0x5fbd=['error\x20mail','stringify','catch','data','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','difference','length','exists','stop','delete\x20cron','toRun','index','my\x20id','resolve','cron','active','isBetween','startAt','add','deleteJob','endAt','update','update\x20cron','start','moment','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','%s.%s','savename','extname','zip','existsSync','status','Sent','message','attachments','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error'];(function(_0x14f959,_0x47f64d){var _0x31de4c=function(_0x3d2dc3){while(--_0x3d2dc3){_0x14f959['push'](_0x14f959['shift']());}};_0x31de4c(++_0x47f64d);}(_0x5fbd,0x1af));var _0xd5fb=function(_0x5ad74d,_0x2ee9b1){_0x5ad74d=_0x5ad74d-0x0;var _0x31c0ff=_0x5fbd[_0x5ad74d];return _0x31c0ff;};'use strict';var fs=require('fs');var util=require('util');var path=require('path');var _=require('lodash');var moment=require(_0xd5fb('0x0'));var CronJobManager=require('cron-job-manager');var jayson=require('jayson/promise');var BPromise=require(_0xd5fb('0x1'));var logger=require(_0xd5fb('0x2'))(_0xd5fb('0x3'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xd5fb('0x4'));var analyticDefaultReportController=require(_0xd5fb('0x5'));var client=jayson['client']['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5a8239,_0x241757){return function(){logger[_0xd5fb('0x6')](_0xd5fb('0x7'),_0x5a8239[_0xd5fb('0x8')]);var _0x485783=!![];var _0x483814=_0x5a8239[_0xd5fb('0x9')][_0xd5fb('0xa')]();var _0x3186e2={'account':_0x483814,'message':{'from':util['format'](_0xd5fb('0xb'),_0x5a8239['MailAccount'][_0xd5fb('0xc')],_0x5a8239['MailAccount'][_0xd5fb('0x8')]||_0x5a8239[_0xd5fb('0x9')][_0xd5fb('0xd')][_0xd5fb('0xe')]),'to':_0x5a8239['email'],'cc':_0x5a8239['cc'],'bcc':_0x5a8239[_0xd5fb('0xf')],'subject':util[_0xd5fb('0x10')](_0xd5fb('0x11'),_0x241757[_0xd5fb('0xc')],_0x5a8239[_0xd5fb('0x12')],_0x5a8239[_0xd5fb('0x13')])}};var _0x4321b2=path[_0xd5fb('0x14')](__dirname,'../../files/reports');var _0x138300=_0x241757['savename'];var _0x40093d=util['format'](_0xd5fb('0x15'),path['basename'](_0x241757[_0xd5fb('0x16')],path[_0xd5fb('0x17')](_0x241757[_0xd5fb('0x16')])),_0xd5fb('0x18'));var _0x4a22e2=path[_0xd5fb('0x14')](_0x4321b2,_0x138300);var _0x824275=path[_0xd5fb('0x14')](_0x4321b2,_0x40093d);if(fs[_0xd5fb('0x19')](_0x4a22e2)){_0x241757[_0xd5fb('0x1a')]=_0xd5fb('0x1b');_0x3186e2[_0xd5fb('0x1c')][_0xd5fb('0x1d')]=[{'filename':_0x138300,'path':_0x4a22e2}];_0x3186e2['message']['text']=util[_0xd5fb('0x10')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON['stringify'](_0x241757,null,0x2));}else if(fs[_0xd5fb('0x19')](_0x824275)){_0x241757[_0xd5fb('0x1a')]='Sent';_0x3186e2[_0xd5fb('0x1c')][_0xd5fb('0x1d')]=[{'filename':_0x40093d,'path':_0x824275}];}else{_0x3186e2[_0xd5fb('0x1c')][_0xd5fb('0x1e')]=_0xd5fb('0x1f');if(!_0x5a8239[_0xd5fb('0x20')]){_0x485783=![];logger['info'](_0xd5fb('0x21'));}}if(_0x485783){return client['request'](_0xd5fb('0x22'),_0x3186e2)[_0xd5fb('0x23')](function(_0x5066a8){if(_0x5066a8[_0xd5fb('0x24')]){return logger[_0xd5fb('0x24')](_0xd5fb('0x25'),JSON[_0xd5fb('0x26')](_0x5066a8));}return logger[_0xd5fb('0x6')]('email\x20sent');})[_0xd5fb('0x27')](function(_0x3423f8){return logger['error']('error\x20mail',JSON[_0xd5fb('0x26')](_0x3423f8));});}};}function handleError(){return function(_0x2fa9c0){return logger['error'](JSON[_0xd5fb('0x26')](_0x2fa9c0));};}function handleResult(_0x49d57f){return function(_0x3731cf){logger[_0xd5fb('0x6')](_0xd5fb('0x28'),JSON[_0xd5fb('0x26')](_0x3731cf));if(_0x49d57f['MailAccount']&&_0x49d57f[_0xd5fb('0x9')][_0xd5fb('0xd')]&&!_[_0xd5fb('0x29')](_0x49d57f[_0xd5fb('0x8')])){setTimeout(handleSendEmail(_0x49d57f,_0x3731cf),0x3c*0x3e8);}};}function handleJob(_0x133fc2){return function(){try{if(_[_0xd5fb('0x29')](_0x133fc2[_0xd5fb('0x12')])){return logger[_0xd5fb('0x6')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xd5fb('0x29')](_0x133fc2[_0xd5fb('0x13')])){return logger[_0xd5fb('0x6')](_0xd5fb('0x2a'));}var _0x491754={'startDate':moment()[_0xd5fb('0x2b')](_0x133fc2[_0xd5fb('0x12')],_0x133fc2[_0xd5fb('0x13')])[_0xd5fb('0x10')](_0xd5fb('0x2c')),'endDate':moment()[_0xd5fb('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xd5fb('0x2d'),'output':_0x133fc2[_0xd5fb('0x2e')],'name':_0x133fc2['name']};if(!_[_0xd5fb('0x29')](_0x133fc2[_0xd5fb('0x2f')])){logger[_0xd5fb('0x6')]('exec\x20defaul\x20report\x20id:%s',_0x133fc2['DefaultReportId']);return analyticDefaultReportController[_0xd5fb('0x30')]({'id':_0x133fc2[_0xd5fb('0x2f')]},_0x491754)[_0xd5fb('0x23')](handleResult(_0x133fc2))[_0xd5fb('0x27')](handleError());}if(!_[_0xd5fb('0x29')](_0x133fc2[_0xd5fb('0x31')])){logger['info'](_0xd5fb('0x32'),_0x133fc2[_0xd5fb('0x31')]);return analyticCustomReportController[_0xd5fb('0x30')]({'id':_0x133fc2[_0xd5fb('0x31')]},_0x491754)[_0xd5fb('0x23')](handleResult(_0x133fc2))[_0xd5fb('0x27')](handleError());}}catch(_0x3743cc){logger[_0xd5fb('0x24')](JSON[_0xd5fb('0x26')](_0x3743cc));}return logger[_0xd5fb('0x6')]('no\x20report\x20id');};}function getJobs(_0x676ad3){var _0xb5633b={};if(_0x676ad3){_0xb5633b['id']=_0x676ad3;}return db['Schedule'][_0xd5fb('0x33')]({'where':_0xb5633b,'include':[{'model':db['MailAccount'],'attributes':['id',_0xd5fb('0xc'),_0xd5fb('0x8')],'include':[{'model':db[_0xd5fb('0x34')],'as':_0xd5fb('0xd'),'include':[{'model':db[_0xd5fb('0x35')],'as':_0xd5fb('0x35')}]}]}]})[_0xd5fb('0x23')](function(_0x5b9deb){var _0x453986=_[_0xd5fb('0x36')](manager[_0xd5fb('0x37')]);var _0x3fff84=_[_0xd5fb('0x38')](_0x5b9deb,function(_0x3777ed){return _0x3777ed['id'][_0xd5fb('0x39')]();});var _0x35255e=_[_0xd5fb('0x3a')](_0x5b9deb,function(_0x3a967f){return _0x3a967f['id']['toString']();});var _0x5343ea=_0x676ad3?_0x3fff84:_[_0xd5fb('0x3b')](_0x3fff84,_0x453986);var _0x106107=_['intersection'](_0x3fff84,_0x453986);var _0x3e850c=_[_0xd5fb('0x3b')](_0x453986,_0x3fff84);var _0x1b23dc;var _0x2a3df7;for(_0x1b23dc=0x0;_0x1b23dc<_0x3e850c[_0xd5fb('0x3c')]&&!_0x676ad3;_0x1b23dc+=0x1){_0x2a3df7=_0x3e850c[_0x1b23dc][_0xd5fb('0x39')]();if(manager[_0xd5fb('0x3d')](_0x2a3df7)){manager[_0xd5fb('0x3e')](_0x2a3df7);manager['deleteJob'](_0x2a3df7);logger['info'](_0xd5fb('0x3f'),_0x2a3df7);}}logger[_0xd5fb('0x6')](_0xd5fb('0x40'),JSON['stringify'](_0x5343ea));for(_0x1b23dc=0x0;_0x1b23dc<_0x5343ea['length'];_0x1b23dc+=0x1){_0x2a3df7=_0x5343ea[_0x1b23dc]['toString']();logger['info'](_0xd5fb('0x41'),_0x2a3df7);if(_0x676ad3){logger[_0xd5fb('0x6')](_0xd5fb('0x42'),_0x676ad3);logger[_0xd5fb('0x6')](JSON[_0xd5fb('0x26')](_0x35255e[_0x2a3df7]));BPromise[_0xd5fb('0x43')]()[_0xd5fb('0x23')](handleJob(_0x35255e[_0x2a3df7]));logger[_0xd5fb('0x6')]('run\x20job',_0x35255e[_0x2a3df7][_0xd5fb('0xc')],_0x35255e[_0x2a3df7][_0xd5fb('0x44')]);}else if(_0x35255e[_0x2a3df7][_0xd5fb('0x44')]&&_0x35255e[_0x2a3df7][_0xd5fb('0x45')]&&moment()[_0xd5fb('0x46')](_0x35255e[_0x2a3df7][_0xd5fb('0x47')],_0x35255e[_0x2a3df7]['endAt'])){manager[_0xd5fb('0x48')](_0x2a3df7,_0x35255e[_0x2a3df7][_0xd5fb('0x44')],handleJob(_0x35255e[_0x2a3df7]));manager['start'](_0x2a3df7);logger[_0xd5fb('0x6')]('add\x20cron',_0x35255e[_0x2a3df7][_0xd5fb('0xc')],_0x35255e[_0x2a3df7]['cron']);}else if(manager[_0xd5fb('0x3d')](_0x2a3df7)){manager['stop'](_0x2a3df7);manager[_0xd5fb('0x49')](_0x2a3df7);logger[_0xd5fb('0x6')]('stop\x20cron',_0x35255e[_0x2a3df7][_0xd5fb('0xc')],_0x35255e[_0x2a3df7][_0xd5fb('0x44')]);}}for(_0x1b23dc=0x0,_0x2a3df7;_0x1b23dc<_0x106107['length']&&!_0x676ad3;_0x1b23dc+=0x1){_0x2a3df7=_0x106107[_0x1b23dc][_0xd5fb('0x39')]();if(manager[_0xd5fb('0x3d')](_0x2a3df7)){if(_0x35255e[_0x2a3df7][_0xd5fb('0x44')]&&_0x35255e[_0x2a3df7]['active']&&moment()[_0xd5fb('0x46')](_0x35255e[_0x2a3df7]['startAt'],_0x35255e[_0x2a3df7][_0xd5fb('0x4a')])){manager[_0xd5fb('0x4b')](_0x2a3df7,_0x35255e[_0x2a3df7][_0xd5fb('0x44')],handleJob(_0x35255e[_0x2a3df7]));logger[_0xd5fb('0x6')](_0xd5fb('0x4c'),_0x35255e[_0x2a3df7][_0xd5fb('0xc')],_0x35255e[_0x2a3df7][_0xd5fb('0x44')]);}else{manager[_0xd5fb('0x3e')](_0x2a3df7);manager[_0xd5fb('0x49')](_0x2a3df7);logger[_0xd5fb('0x6')]('stop\x20cron',_0x35255e[_0x2a3df7][_0xd5fb('0xc')],_0x35255e[_0x2a3df7][_0xd5fb('0x44')]);}}}})[_0xd5fb('0x27')](function(_0x1c8675){logger[_0xd5fb('0x24')](JSON[_0xd5fb('0x26')](_0x1c8675));});}exports['run']=function(_0x44e4d9){return getJobs(_0x44e4d9);};exports[_0xd5fb('0x4d')]=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 ccb4f21..8447d7c 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 _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 +var _0x065e=['length','transcript','update','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','sentimentAccountId','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','Sentiment','Positive','SentimentScore','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','bucket','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','all','lodash','bluebird','../../mysqldb','../../config/logger','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','data2','transcribeRegion','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts'];(function(_0x20e81e,_0x2ad41f){var _0x3e6654=function(_0x3f2904){while(--_0x3f2904){_0x20e81e['push'](_0x20e81e['shift']());}};_0x3e6654(++_0x2ad41f);}(_0x065e,0x1a7));var _0xe065=function(_0x367759,_0x3ccdb9){_0x367759=_0x367759-0x0;var _0x3c8b9f=_0x065e[_0x367759];return _0x3c8b9f;};var _=require(_0xe065('0x0'));var AWS=require('aws-sdk');var rp=require('request-promise');var util=require('util');var BPromise=require(_0xe065('0x1'));var db=require(_0xe065('0x2'))['db'];var logger=require(_0xe065('0x3'))('transcribe');function getTranscriptionJob(_0x4964fa,_0x4610a3,_0x2f90aa,_0x5b099e){return new Promise(function(_0x10b45f,_0x1e7e69){var _0x189d72=new AWS['TranscribeService']({'accessKeyId':_0x4610a3,'secretAccessKey':_0x4964fa,'region':_0x2f90aa});_0x189d72[_0xe065('0x4')]({'TranscriptionJobName':_0x5b099e},function(_0x5afbd4,_0x273e22){if(_0x5afbd4){return _0x1e7e69(_0x5afbd4);}else{return _0x10b45f(_0x273e22);}});});}function sentiment(_0x2f072e,_0x3bacf3,_0x114497,_0x85001e,_0x531ebd){return new Promise(function(_0x43827c,_0x6c9117){var _0x3f59d3=new AWS[(_0xe065('0x5'))]({'accessKeyId':_0x3bacf3,'secretAccessKey':_0x2f072e,'region':_0x114497});_0x3f59d3[_0xe065('0x6')]({'Text':_0x85001e,'LanguageCode':_0x531ebd[_0xe065('0x7')](0x0,0x2)},function(_0x4f8c4e,_0x595907){if(_0x4f8c4e){return _0x6c9117(_0x4f8c4e);}else{return _0x43827c(_0x595907);}});});}function checkTranscribeJob(_0xd2fdc7,_0x13b697,_0xf5ab44){var _0x5bd30f;return new BPromise(function(_0x3aa3be,_0x40cc6b){logger[_0xe065('0x8')](util[_0xe065('0x9')](_0xe065('0xa'),_0xd2fdc7['id'],_0xd2fdc7['transcribeName']));return getTranscriptionJob(_0xf5ab44[_0xe065('0xb')],_0xf5ab44[_0xe065('0xc')],_0x13b697[_0xe065('0xd')],_0xd2fdc7[_0xe065('0xe')])[_0xe065('0xf')](function(_0x352206){logger[_0xe065('0x8')](util['format'](_0xe065('0x10'),_0xd2fdc7['id'],_0xd2fdc7[_0xe065('0xe')],_0x352206['TranscriptionJob'][_0xe065('0x11')]));if(!_0xd2fdc7[_0xe065('0x12')]){switch(_0x352206[_0xe065('0x13')][_0xe065('0x11')]){case _0xe065('0x14'):var _0x302adf={'transcribeStatus':_0x352206[_0xe065('0x13')]['TranscriptionJobStatus'],'fileUri':_0x352206[_0xe065('0x13')]['Transcript'][_0xe065('0x15')]};logger[_0xe065('0x8')](util['format'](_0xe065('0x16'),_0xd2fdc7['id']));return rp({'uri':_0x352206['TranscriptionJob'][_0xe065('0x17')][_0xe065('0x15')],'json':!![]})[_0xe065('0xf')](function(_0x110556){logger[_0xe065('0x8')](util[_0xe065('0x9')](_0xe065('0x18'),_0xd2fdc7['id']));if(_0x110556&&_0x110556[_0xe065('0x19')]&&_0x110556[_0xe065('0x19')]['transcripts']&&_0x110556[_0xe065('0x19')][_0xe065('0x1a')][_0xe065('0x1b')]){_0x302adf[_0xe065('0x12')]='';for(var _0x5e8b60=0x0;_0x5e8b60<_0x110556['results'][_0xe065('0x1a')]['length'];_0x5e8b60++){_0x302adf[_0xe065('0x12')]+=_0x110556[_0xe065('0x19')][_0xe065('0x1a')][_0x5e8b60][_0xe065('0x1c')]+'';}}return _0xd2fdc7[_0xe065('0x1d')](_0x302adf);})[_0xe065('0xf')](function(){logger[_0xe065('0x8')](util[_0xe065('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xd2fdc7['id']));if(!_0xd2fdc7['tempSentiment']){throw new db[(_0xe065('0x1e'))][(_0xe065('0x1f'))](_0xe065('0x20'));}if(!_0x13b697[_0xe065('0x21')]||!_0x13b697['sentimentAccountId']||!_0x13b697[_0xe065('0x22')]||!_0x13b697['language']||!_0x13b697['bucket']){throw new db[(_0xe065('0x1e'))][(_0xe065('0x1f'))](_0xe065('0x23'));}if(!_0x302adf['fileText']){throw new Error(_0xe065('0x24'));}if(_0x13b697['sentimentAccountId']===_0xf5ab44['id']){return _0xf5ab44;}else{return db[_0xe065('0x25')][_0xe065('0x26')]({'where':{'id':_settings[_0xe065('0x27')]}});}})[_0xe065('0xf')](function(_0x58c49b){if(!_0x58c49b){throw new db[(_0xe065('0x1e'))]['ValidationError'](_0xe065('0x28'));}if(!_0x58c49b[_0xe065('0xb')]||!_0x58c49b['data2']){throw new db[(_0xe065('0x1e'))]['ValidationError'](_0xe065('0x29'));}_0x5bd30f=_0x58c49b;logger['info'](util[_0xe065('0x9')](_0xe065('0x2a'),_0xd2fdc7['id']));return sentiment(_0x5bd30f[_0xe065('0xb')],_0x5bd30f[_0xe065('0xc')],_0x13b697['sentimentRegion'],_0x302adf[_0xe065('0x12')],_0x13b697[_0xe065('0x2b')]);})[_0xe065('0xf')](function(_0x2532f8){logger[_0xe065('0x8')](util[_0xe065('0x9')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0xd2fdc7['id']));return _0xd2fdc7[_0xe065('0x1d')]({'sentiment':_0x2532f8[_0xe065('0x2c')],'sPositive':_0x2532f8['SentimentScore'][_0xe065('0x2d')],'sNegative':_0x2532f8[_0xe065('0x2e')][_0xe065('0x2f')],'sMixed':_0x2532f8[_0xe065('0x2e')][_0xe065('0x30')],'sNeutral':_0x2532f8[_0xe065('0x2e')][_0xe065('0x31')]});})['then'](function(){logger[_0xe065('0x8')](util['format'](_0xe065('0x32'),_0xd2fdc7['id']));_0x3aa3be();});case _0xe065('0x33'):return _0xd2fdc7[_0xe065('0x1d')]({'transcribeStatus':_0xe065('0x33'),'failureReason':_0x352206[_0xe065('0x13')][_0xe065('0x34')]})['then'](function(){logger[_0xe065('0x8')](util[_0xe065('0x9')](_0xe065('0x32'),_0xd2fdc7['id']));_0x3aa3be();});default:logger['info'](util[_0xe065('0x9')](_0xe065('0x35'),_0xd2fdc7['id']));break;}}else{return BPromise[_0xe065('0x36')]()[_0xe065('0xf')](function(){if(!_0xd2fdc7[_0xe065('0x37')]){throw new db['Sequelize'][(_0xe065('0x1f'))](_0xe065('0x20'));}if(!_0x13b697['sentiment']||!_0x13b697[_0xe065('0x27')]||!_0x13b697['sentimentRegion']||!_0x13b697[_0xe065('0x2b')]||!_0x13b697[_0xe065('0x38')]){throw new db['Sequelize'][(_0xe065('0x1f'))](_0xe065('0x23'));}if(!_0xd2fdc7['fileText']){throw new Error(_0xe065('0x24'));}if(_0x13b697[_0xe065('0x27')]===_0xf5ab44['id']){return _0xf5ab44;}else{return db[_0xe065('0x25')][_0xe065('0x26')]({'where':{'id':_settings[_0xe065('0x27')]}});}})[_0xe065('0xf')](function(_0x395cc2){if(!_0x395cc2){throw new db[(_0xe065('0x1e'))][(_0xe065('0x1f'))](_0xe065('0x28'));}if(!_0x395cc2[_0xe065('0xb')]||!_0x395cc2[_0xe065('0xc')]){throw new db[(_0xe065('0x1e'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x5bd30f=_0x395cc2;logger[_0xe065('0x8')](util[_0xe065('0x9')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0xd2fdc7['id']));return sentiment(_0x5bd30f[_0xe065('0xb')],_0x5bd30f[_0xe065('0xc')],_0x13b697[_0xe065('0x22')],_0xd2fdc7[_0xe065('0x12')],_0x13b697[_0xe065('0x2b')]);})[_0xe065('0xf')](function(_0x39440c){logger[_0xe065('0x8')](util[_0xe065('0x9')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0xd2fdc7['id']));return _0xd2fdc7[_0xe065('0x1d')]({'sentiment':_0x39440c[_0xe065('0x2c')],'sPositive':_0x39440c[_0xe065('0x2e')]['Positive'],'sNegative':_0x39440c[_0xe065('0x2e')][_0xe065('0x2f')],'sMixed':_0x39440c[_0xe065('0x2e')][_0xe065('0x30')],'sNeutral':_0x39440c['SentimentScore'][_0xe065('0x31')],'transcribeStatus':_0xe065('0x14')});})[_0xe065('0xf')](function(){logger[_0xe065('0x8')](util[_0xe065('0x9')](_0xe065('0x32'),_0xd2fdc7['id']));_0x3aa3be();});}})[_0xe065('0x39')](function(_0x50b031){if(_0x50b031){if(!_0x50b031[_0xe065('0x3a')]||_0x50b031[_0xe065('0x3a')]!==_0xe065('0x3b')){logger[_0xe065('0x3c')](util[_0xe065('0x9')](_0xe065('0x3d'),_0xd2fdc7['id']),util[_0xe065('0x3e')](_0x50b031,{'showHidden':![],'depth':null}));}}_0x3aa3be();});});}function checkTranscribe(){var _0x4c0b32;var _0x1b51f9;var _0x5a2360;return db[_0xe065('0x3f')][_0xe065('0x40')]({'where':{'transcribeStatus':_0xe065('0x41')}})['then'](function(_0xbc1ba5){if(!_0xbc1ba5||!_0xbc1ba5[_0xe065('0x1b')]){throw new db[(_0xe065('0x1e'))][(_0xe065('0x1f'))](_0xe065('0x42'));}_0x4c0b32=_0xbc1ba5;return db[_0xe065('0x43')][_0xe065('0x26')]({'where':{'id':0x1}});})[_0xe065('0xf')](function(_0x3095c8){if(!_0x3095c8){throw new db[(_0xe065('0x1e'))][(_0xe065('0x1f'))](_0xe065('0x44'));}_0x1b51f9=_0x3095c8;if(!_0x1b51f9[_0xe065('0x45')]||!_0x1b51f9['transcribeAccountId']||!_0x1b51f9['transcribeRegion']||!_0x1b51f9['language']||!_0x1b51f9[_0xe065('0x38')]){throw new db['Sequelize'][(_0xe065('0x1f'))](_0xe065('0x46'));}return db[_0xe065('0x25')]['findOne']({'where':{'id':_0x1b51f9[_0xe065('0x47')]}});})[_0xe065('0xf')](function(_0x5cce78){if(!_0x5cce78){throw new db[(_0xe065('0x1e'))][(_0xe065('0x1f'))](_0xe065('0x28'));}if(!_0x5cce78[_0xe065('0xb')]||!_0x5cce78[_0xe065('0xc')]){throw new db[(_0xe065('0x1e'))][(_0xe065('0x1f'))](_0xe065('0x29'));}_0x5a2360=_0x5cce78;var _0x43480d=[];_0x4c0b32[_0xe065('0x48')](function(_0x49a367){_0x43480d[_0xe065('0x49')](checkTranscribeJob(_0x49a367,_0x1b51f9,_0x5a2360));});return BPromise[_0xe065('0x4a')](_0x43480d);})[_0xe065('0x39')](function(_0x392778){if(_0x392778){if(!_0x392778['name']||_0x392778[_0xe065('0x3a')]!==_0xe065('0x3b')){logger[_0xe065('0x3c')](util[_0xe065('0x3e')](_0x392778,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index ae227a8..9281cc9 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 _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 +var _0x5728=['start','lodash','moment','ioredis','../../config/environment','../../mysqldb','schedule','redis','defaults','localhost','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','[WHATSAPP]\x20Interactions\x20to\x20close:','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','join','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5728,0xb5));var _0x8572=function(_0x19c6e4,_0x45dadb){_0x19c6e4=_0x19c6e4-0x0;var _0x31ead6=_0x5728[_0x19c6e4];return _0x31ead6;};'use strict';var _=require(_0x8572('0x0'));var moment=require(_0x8572('0x1'));var Redis=require(_0x8572('0x2'));var util=require('util');var config=require(_0x8572('0x3'));var db=require(_0x8572('0x4'))['db'];var logger=require('../logger')(_0x8572('0x5'));config[_0x8572('0x6')]=_[_0x8572('0x7')](config[_0x8572('0x6')],{'host':_0x8572('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x523f40=[];return db[_0x8572('0x9')][_0x8572('0xa')]({'raw':!![],'attributes':['id',_0x8572('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x8572('0xc')](0x18,_0x8572('0xd'))}}})[_0x8572('0xe')](function(_0x1d0f23){if(_0x1d0f23&&_0x1d0f23[_0x8572('0xf')]){_0x523f40=_['map'](_0x1d0f23||[],'id');logger['info'](_0x8572('0x10'),_0x523f40['join']());return db['WhatsappInteraction'][_0x8572('0x11')]({'closeReason':_0x8572('0x12'),'disposition':_0x8572('0x13'),'closed':!![],'closedAt':moment()[_0x8572('0x14')](_0x8572('0x15'))},{'where':{'id':_0x523f40}});}})[_0x8572('0xe')](function(){if(_0x523f40&&_0x523f40[_0x8572('0xf')]){logger[_0x8572('0x16')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x523f40[_0x8572('0x17')]());for(var _0x1055c8=0x0;_0x1055c8<_0x523f40['length'];_0x1055c8++){io[_0x8572('0x18')](_0x8572('0x19'),{'id':_0x523f40[_0x1055c8],'closed':!![]});}}})[_0x8572('0x1a')](function(_0x3036a2){logger['error'](_0x8572('0x1b'),_0x3036a2?util[_0x8572('0x1c')](_0x3036a2,{'showHidden':![],'depth':null}):'');});}exports[_0x8572('0x1d')]=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 fe2e04e..3e0da57 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x73de=['bulkCreate','log','finished\x20populating','contacts1','CmHopper','destroy','contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','innocenzo.biondo','now','Biondo','then','CmContact'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x73de,0x75));var _0xe73d=function(_0x207605,_0x4fe3d0){_0x207605=_0x207605-0x0;var _0x49578c=_0x73de[_0x207605];return _0x49578c;};'use strict';var util=require(_0xe73d('0x0'));var db=require(_0xe73d('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xe73d('0x2')]({'id':i,'firstName':_0xe73d('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xe73d('0x4')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xe73d('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe73d('0x5')](),'updatedAt':Date[_0xe73d('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xe73d('0x2')]({'id':i,'firstName':_0xe73d('0x3')+i,'lastName':_0xe73d('0x6')+i,'phone':0xf879fb460+i,'email':_0xe73d('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xe73d('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe73d('0x5')](),'updatedAt':Date[_0xe73d('0x5')]()});}db['CmContact']['destroy']({'where':{}})[_0xe73d('0x7')](function(){return db[_0xe73d('0x8')][_0xe73d('0x9')](contacts);})[_0xe73d('0x7')](function(){console[_0xe73d('0xa')](_0xe73d('0xb'),_0xe73d('0xc'));return db[_0xe73d('0xd')][_0xe73d('0xe')]({'where':{}});})[_0xe73d('0x7')](function(){return db[_0xe73d('0xd')][_0xe73d('0x9')](hopper);})[_0xe73d('0x7')](function(){console[_0xe73d('0xa')](_0xe73d('0xb'),'hopper1');return db[_0xe73d('0x8')][_0xe73d('0x9')](contacts2);})[_0xe73d('0x7')](function(){console['log'](_0xe73d('0xb'),_0xe73d('0xf'));return db[_0xe73d('0xd')][_0xe73d('0x9')](hopper2);})[_0xe73d('0x7')](function(){console[_0xe73d('0xa')](_0xe73d('0xb'),_0xe73d('0x10'));})[_0xe73d('0x11')](function(_0x5f2a56){console[_0xe73d('0xa')](_0x5f2a56);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 29deb95..a9de7f4 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x3c43=['add\x20user','util','../mysqldb','push','%s%s','agent','format','%s%s@xcally.com','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','bulkCreate','then'];(function(_0x2467b8,_0x584199){var _0x5d3095=function(_0x8e8bc0){while(--_0x8e8bc0){_0x2467b8['push'](_0x2467b8['shift']());}};_0x5d3095(++_0x584199);}(_0x3c43,0xc7));var _0x33c4=function(_0x3fe287,_0x10df91){_0x3fe287=_0x3fe287-0x0;var _0xcd863a=_0x3c43[_0x3fe287];return _0xcd863a;};'use strict';var util=require(_0x33c4('0x0'));var db=require(_0x33c4('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x33c4('0x2')]({'name':util['format'](_0x33c4('0x3'),_0x33c4('0x4'),i),'fullname':util[_0x33c4('0x5')]('%s%s',_0x33c4('0x4'),i),'email':util[_0x33c4('0x5')](_0x33c4('0x6'),_0x33c4('0x4'),i),'role':'agent','password':'password','internal':0xfa0+i,'type':_0x33c4('0x7'),'transport':[_0x33c4('0x8'),'ws',_0x33c4('0x9')],'disallow':[_0x33c4('0xa')],'allow':[_0x33c4('0xb')],'defaultuser':util[_0x33c4('0x5')](_0x33c4('0x3'),_0x33c4('0x4'),i),'encryption':_0x33c4('0xc'),'avpf':_0x33c4('0xc'),'force_avp':_0x33c4('0xc'),'icesupport':'yes','dtlsenable':_0x33c4('0xc'),'dtlsverify':'no','dtlscertfile':_0x33c4('0xd'),'dtlsprivatekey':_0x33c4('0xe'),'dtlssetup':'actpass','callerid':util[_0x33c4('0x5')]('\x22%s\x22\x20<%s>',util['format'](_0x33c4('0x3'),'agent',i),0xfa0+i)});}db['User'][_0x33c4('0xf')](users)[_0x33c4('0x10')](function(){console['log'](_0x33c4('0x11'));})['catch'](function(_0x388728){console['log'](_0x388728);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 8fa9d71..14286bf 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0xf562=['find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','user:%s','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','Trunk','user','VoiceQueue','FaxQueues','MailQueue','OpenchannelQueue','WhatsappQueue','getVoiceQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','fax','sms','whatsapp','telephone:%s','leave','user_has_chat_interactions:remove','emit','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','setMaxListeners','address','remoteAddress','request','connectedAt','log','nsp','disconnect','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','agent','telephone','type','ivr','UserProfileSection','then','VoiceQueues','ChatQueues','SmsQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','role','Campaign','format','%s:queue:%s','length','handshake'];(function(_0x671e0,_0x351057){var _0x2d58c5=function(_0x17f07a){while(--_0x17f07a){_0x671e0['push'](_0x671e0['shift']());}};_0x2d58c5(++_0x351057);}(_0xf562,0x100));var _0x2f56=function(_0x720607,_0x1831f6){_0x720607=_0x720607-0x0;var _0x41cdf9=_0xf562[_0x720607];return _0x41cdf9;};'use strict';var _=require(_0x2f56('0x0'));var util=require(_0x2f56('0x1'));var BPromise=require(_0x2f56('0x2'));var db=require(_0x2f56('0x3'))['db'];var config=require(_0x2f56('0x4'));var queryQueues={'attributes':['id',_0x2f56('0x5')],'include':[{'as':_0x2f56('0x6'),'model':db[_0x2f56('0x7')],'attributes':['id',_0x2f56('0x5'),'role'],'raw':!![],'where':{'role':_0x2f56('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x2f56('0x9')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x2f56('0x5')],'where':{'role':_0x2f56('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x2f56('0x5'),_0x2f56('0xa')],'where':{'type':_0x2f56('0xb')}};function getAssociatedResources(_0x2975c2,_0x176c49,_0x2d549e){return db[_0x2f56('0xc')]['findOne']({'where':{'name':_0x2975c2,'userProfileId':_0x176c49},'raw':!![]})[_0x2f56('0xd')](function(_0x39572f){if(_0x39572f){if(_0x39572f['autoAssociation']){switch(_0x2975c2){case _0x2f56('0xe'):case _0x2f56('0xf'):case'FaxQueues':case _0x2f56('0x10'):case'MailQueues':case _0x2f56('0x11'):case'WhatsappQueues':return db[_0x2d549e][_0x2f56('0x12')](queryQueues);case _0x2f56('0x13'):return db[_0x2d549e][_0x2f56('0x12')](queryTelephones);case _0x2f56('0x14'):return db[_0x2d549e][_0x2f56('0x12')](queryTrunks);case _0x2f56('0x15'):return db[_0x2d549e][_0x2f56('0x12')](queryCampaigns);}}else{return db[_0x2f56('0x16')]['findAll']({'attributes':[_0x2f56('0x17')],'where':{'sectionId':_0x39572f['id']},'raw':!![]})[_0x2f56('0xd')](function(_0x11dd1e){if(_0x11dd1e){var _0x1d2463={'where':{'id':_[_0x2f56('0x18')](_0x11dd1e,'resourceId')},'raw':!![]};switch(_0x2d549e){case _0x2f56('0x7'):_0x1d2463[_0x2f56('0x19')][_0x2f56('0x1a')]=_0x2f56('0x9');break;case _0x2f56('0x1b'):_0x1d2463['where'][_0x2f56('0xa')]=_0x2f56('0xb');break;}return db[_0x2d549e][_0x2f56('0x12')](_0x1d2463);}else{return[];}});}}else{return[];}})[_0x2f56('0xd')](function(_0x45ad8c){return _0x45ad8c;});}function joinOrLeaveQueues(_0x562cea,_0x3a3161,_0x19ab8c,_0x22e2e6){_0x562cea[_0x3a3161](util[_0x2f56('0x1c')](_0x2f56('0x1d'),_0x19ab8c,_0x22e2e6[_0x2f56('0x5')]));if(_0x22e2e6[_0x2f56('0x6')]){for(var _0x349d55=0x0;_0x349d55<_0x22e2e6['Agents'][_0x2f56('0x1e')];_0x349d55+=0x1){_0x562cea[_0x3a3161](util['format']('user:%s',_0x22e2e6[_0x2f56('0x6')][_0x349d55][_0x2f56('0x5')]));}}}function joinOrLeave(_0x26d5d1,_0x4ee4c9,_0x21f4b0){var _0x433f0b;if(_0x26d5d1[_0x2f56('0x1f')]['query']['id']){db['User'][_0x2f56('0x20')]({'attributes':['id',_0x2f56('0x5'),_0x2f56('0x1a'),_0x2f56('0x21')],'where':{'id':_0x26d5d1[_0x2f56('0x1f')]['query']['id']},'include':[{'model':db[_0x2f56('0x22')],'as':_0x2f56('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x2f56('0x24')],'as':_0x2f56('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x2f56('0x26')],'as':_0x2f56('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x2f56('0x28')],'as':_0x2f56('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x2f56('0x2a')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x2f56('0x2b')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})['then'](function(_0x284252){if(_0x284252){_0x433f0b=_0x284252;_0x26d5d1[_0x4ee4c9](util[_0x2f56('0x1c')](_0x2f56('0x2c'),_0x284252['name']));var _0x55685d=[];switch(_0x284252['role']){case _0x2f56('0x2d'):_0x26d5d1[_0x4ee4c9](_0x2f56('0x2e'));_0x26d5d1[_0x4ee4c9](_0x2f56('0x2f'));if(queryQueues[_0x2f56('0x30')](_0x2f56('0x31'))){delete queryQueues[_0x2f56('0x31')];}_0x55685d[_0x2f56('0x32')](db['VoiceQueue'][_0x2f56('0x12')](queryQueues));_0x55685d[_0x2f56('0x32')](db[_0x2f56('0x33')]['findAll'](queryQueues));_0x55685d[_0x2f56('0x32')](db[_0x2f56('0x34')][_0x2f56('0x12')](queryQueues));_0x55685d[_0x2f56('0x32')](db[_0x2f56('0x35')][_0x2f56('0x12')](queryQueues));_0x55685d[_0x2f56('0x32')](db['MailQueue'][_0x2f56('0x12')](queryQueues));_0x55685d[_0x2f56('0x32')](db['OpenchannelQueue'][_0x2f56('0x12')](queryQueues));_0x55685d[_0x2f56('0x32')](db['WhatsappQueue'][_0x2f56('0x12')](queryQueues));_0x55685d['push'](db['User'][_0x2f56('0x12')](queryTelephones));_0x55685d[_0x2f56('0x32')](db[_0x2f56('0x36')]['findAll'](queryTrunks));_0x55685d[_0x2f56('0x32')](db['Campaign'][_0x2f56('0x12')](queryCampaigns));_0x55685d['push'](db[_0x2f56('0x7')][_0x2f56('0x12')](queryAgents));break;case _0x2f56('0x37'):_0x26d5d1[_0x4ee4c9]('voice:inbound');_0x26d5d1[_0x4ee4c9](_0x2f56('0x2f'));_0x55685d[_0x2f56('0x32')](getAssociatedResources(_0x2f56('0xe'),_0x284252[_0x2f56('0x21')],_0x2f56('0x38')));_0x55685d[_0x2f56('0x32')](getAssociatedResources('ChatQueues',_0x284252[_0x2f56('0x21')],_0x2f56('0x33')));_0x55685d[_0x2f56('0x32')](getAssociatedResources(_0x2f56('0x39'),_0x284252[_0x2f56('0x21')],_0x2f56('0x34')));_0x55685d[_0x2f56('0x32')](getAssociatedResources(_0x2f56('0x10'),_0x284252[_0x2f56('0x21')],'SmsQueue'));_0x55685d[_0x2f56('0x32')](getAssociatedResources('MailQueues',_0x284252[_0x2f56('0x21')],_0x2f56('0x3a')));_0x55685d[_0x2f56('0x32')](getAssociatedResources(_0x2f56('0x11'),_0x284252[_0x2f56('0x21')],_0x2f56('0x3b')));_0x55685d[_0x2f56('0x32')](getAssociatedResources('WhatsappQueues',_0x284252['userProfileId'],_0x2f56('0x3c')));_0x55685d['push'](getAssociatedResources(_0x2f56('0x13'),_0x284252[_0x2f56('0x21')],_0x2f56('0x7')));_0x55685d[_0x2f56('0x32')](getAssociatedResources(_0x2f56('0x14'),_0x284252[_0x2f56('0x21')],_0x2f56('0x36')));_0x55685d[_0x2f56('0x32')](getAssociatedResources(_0x2f56('0x15'),_0x284252['userProfileId'],'Campaign'));_0x55685d[_0x2f56('0x32')](db['User'][_0x2f56('0x12')](queryAgents));break;case _0x2f56('0x8'):_0x26d5d1[_0x4ee4c9](_0x2f56('0x2e'));_0x26d5d1[_0x4ee4c9](_0x2f56('0x2f'));_0x55685d[_0x2f56('0x32')](_0x284252[_0x2f56('0x3d')]({'attributes':['id','name']}));_0x55685d['push'](_0x284252['getChatQueues']({'attributes':['id',_0x2f56('0x5')]}));_0x55685d['push'](_0x284252[_0x2f56('0x3e')]({'attributes':['id',_0x2f56('0x5')]}));_0x55685d['push'](_0x284252[_0x2f56('0x3f')]({'attributes':['id','name']}));_0x55685d[_0x2f56('0x32')](_0x284252['getMailQueues']({'attributes':['id',_0x2f56('0x5')]}));_0x55685d[_0x2f56('0x32')](_0x284252[_0x2f56('0x40')]({'attributes':['id',_0x2f56('0x5')]}));_0x55685d['push'](_0x284252[_0x2f56('0x41')]({'attributes':['id',_0x2f56('0x5')]}));break;}return BPromise[_0x2f56('0x42')](_0x55685d);}})[_0x2f56('0xd')](function(_0x274343){if(_0x274343&&_0x274343['length']){for(var _0x1deea1=0x0;_0x1deea1<_0x274343[_0x2f56('0x1e')];_0x1deea1+=0x1){for(var _0x349f6b=0x0;_0x349f6b<_0x274343[_0x1deea1]['length'];_0x349f6b+=0x1){switch(_0x1deea1){case 0x0:joinOrLeaveQueues(_0x26d5d1,_0x4ee4c9,_0x2f56('0x43'),_0x274343[_0x1deea1][_0x349f6b]);break;case 0x1:joinOrLeaveQueues(_0x26d5d1,_0x4ee4c9,'chat',_0x274343[_0x1deea1][_0x349f6b]);break;case 0x2:joinOrLeaveQueues(_0x26d5d1,_0x4ee4c9,_0x2f56('0x44'),_0x274343[_0x1deea1][_0x349f6b]);break;case 0x3:joinOrLeaveQueues(_0x26d5d1,_0x4ee4c9,_0x2f56('0x45'),_0x274343[_0x1deea1][_0x349f6b]);break;case 0x4:joinOrLeaveQueues(_0x26d5d1,_0x4ee4c9,'mail',_0x274343[_0x1deea1][_0x349f6b]);break;case 0x5:joinOrLeaveQueues(_0x26d5d1,_0x4ee4c9,'openchannel',_0x274343[_0x1deea1][_0x349f6b]);break;case 0x6:joinOrLeaveQueues(_0x26d5d1,_0x4ee4c9,_0x2f56('0x46'),_0x274343[_0x1deea1][_0x349f6b]);break;case 0x7:if(_0x433f0b[_0x2f56('0x1a')]!==_0x2f56('0x8'))_0x26d5d1[_0x4ee4c9](util[_0x2f56('0x1c')](_0x2f56('0x47'),_0x274343[_0x1deea1][_0x349f6b]['name']));break;case 0x8:if(_0x433f0b[_0x2f56('0x1a')]!==_0x2f56('0x8'))_0x26d5d1[_0x4ee4c9](util[_0x2f56('0x1c')]('trunk:%s',_0x274343[_0x1deea1][_0x349f6b][_0x2f56('0x5')]));break;case 0x9:if(_0x433f0b[_0x2f56('0x1a')]!==_0x2f56('0x8'))_0x26d5d1[_0x4ee4c9](util[_0x2f56('0x1c')]('campaign:%s:%s',_0x274343[_0x1deea1][_0x349f6b][_0x2f56('0xa')],_0x274343[_0x1deea1][_0x349f6b][_0x2f56('0x5')]));break;case 0xa:_0x26d5d1[_0x4ee4c9](util[_0x2f56('0x1c')](_0x2f56('0x2c'),_0x274343[_0x1deea1][_0x349f6b][_0x2f56('0x5')]));break;}}}}})[_0x2f56('0xd')](function(){if(_0x4ee4c9===_0x2f56('0x48')){var _0x5a9c12=_[_0x2f56('0x18')](_0x433f0b[_0x2f56('0x23')],'id');return _0x433f0b['removeChatInteractions'](_0x5a9c12)['then'](function(){for(var _0x11ad65=0x0;_0x11ad65<_0x5a9c12[_0x2f56('0x1e')];_0x11ad65+=0x1){_0x21f4b0['emit'](_0x2f56('0x49'),{'ChatInteractionId':Number(_0x5a9c12[_0x11ad65]),'UserId':Number(_0x433f0b['id'])});}});}})['then'](function(){if(_0x4ee4c9===_0x2f56('0x48')){var _0x47e765=_[_0x2f56('0x18')](_0x433f0b['MailInteractions'],'id');return _0x433f0b['removeMailInteractions'](_0x47e765)[_0x2f56('0xd')](function(){for(var _0x3f3009=0x0;_0x3f3009<_0x47e765[_0x2f56('0x1e')];_0x3f3009+=0x1){_0x21f4b0[_0x2f56('0x4a')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x47e765[_0x3f3009]),'UserId':Number(_0x433f0b['id'])});}});}})[_0x2f56('0xd')](function(){if(_0x4ee4c9==='leave'){var _0x3074d0=_[_0x2f56('0x18')](_0x433f0b[_0x2f56('0x27')],'id');return _0x433f0b[_0x2f56('0x4b')](_0x3074d0)[_0x2f56('0xd')](function(){for(var _0x4c7bb4=0x0;_0x4c7bb4<_0x3074d0['length'];_0x4c7bb4+=0x1){_0x21f4b0[_0x2f56('0x4a')](_0x2f56('0x4c'),{'FaxInteractionId':Number(_0x3074d0[_0x4c7bb4]),'UserId':Number(_0x433f0b['id'])});}});}})['then'](function(){if(_0x4ee4c9===_0x2f56('0x48')){var _0x3ba3b5=_[_0x2f56('0x18')](_0x433f0b[_0x2f56('0x29')],'id');return _0x433f0b[_0x2f56('0x4d')](_0x3ba3b5)[_0x2f56('0xd')](function(){for(var _0x468585=0x0;_0x468585<_0x3ba3b5[_0x2f56('0x1e')];_0x468585+=0x1){_0x21f4b0[_0x2f56('0x4a')](_0x2f56('0x4e'),{'SmsInteractionId':Number(_0x3ba3b5[_0x468585]),'UserId':Number(_0x433f0b['id'])});}});}})[_0x2f56('0xd')](function(){if(_0x4ee4c9===_0x2f56('0x48')){var _0x270981=_[_0x2f56('0x18')](_0x433f0b[_0x2f56('0x4f')],'id');return _0x433f0b[_0x2f56('0x50')](_0x270981)[_0x2f56('0xd')](function(){for(var _0x2fb548=0x0;_0x2fb548<_0x270981[_0x2f56('0x1e')];_0x2fb548+=0x1){_0x21f4b0[_0x2f56('0x4a')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x270981[_0x2fb548]),'UserId':Number(_0x433f0b['id'])});}});}})['then'](function(){if(_0x4ee4c9===_0x2f56('0x48')){var _0x1a918b=_[_0x2f56('0x18')](_0x433f0b[_0x2f56('0x51')],'id');return _0x433f0b[_0x2f56('0x52')](_0x1a918b)[_0x2f56('0xd')](function(){for(var _0x4c05a3=0x0;_0x4c05a3<_0x1a918b[_0x2f56('0x1e')];_0x4c05a3+=0x1){_0x21f4b0['emit'](_0x2f56('0x53'),{'WhatsappInteractionId':Number(_0x1a918b[_0x4c05a3]),'UserId':Number(_0x433f0b['id'])});}});}})[_0x2f56('0x54')](function(_0x39c4fa){_0x26d5d1['log'](_0x39c4fa);});}}function onDisconnect(_0x3988a1,_0x323fef){joinOrLeave(_0x3988a1,'leave',_0x323fef);}function onConnect(_0x4fe1d2){joinOrLeave(_0x4fe1d2,_0x2f56('0x55'));}exports[_0x2f56('0x56')]=function(_0x5d8adf){_0x5d8adf['on'](_0x2f56('0x57'),function(_0x4d503a){_0x4d503a[_0x2f56('0x58')](0x0);_0x4d503a[_0x2f56('0x59')]=_0x4d503a['request']['connection'][_0x2f56('0x5a')]+':'+_0x4d503a[_0x2f56('0x5b')]['connection']['remotePort'];_0x4d503a[_0x2f56('0x5c')]=new Date();_0x4d503a[_0x2f56('0x5d')]=function(_0x77c6ee){console[_0x2f56('0x5d')]('SocketIO\x20'+_0x4d503a[_0x2f56('0x5e')][_0x2f56('0x5')]+'['+_0x4d503a[_0x2f56('0x59')]+']',_0x77c6ee);};_0x4d503a['on'](_0x2f56('0x5f'),function(){onDisconnect(_0x4d503a,_0x5d8adf);_0x4d503a[_0x2f56('0x5d')]('DISCONNECTED');});onConnect(_0x4d503a);_0x4d503a[_0x2f56('0x5d')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 88d7372..001168d 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 _0x8d7d=['incomingmessage','outgoingmessage','get','offlineMessage','AfterCreate','changed','closed','substatus','query','AfterUpdate','User','find','fullname','email','internal','default','length','hasOwnProperty','callback','toLowerCase','condition','util','jayson/promise','../logger','triggers','client','Chat','ChatInteraction','afterCreate','newinteraction','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','SmsInteraction','Sms','SmsMessage','WhatsappInteraction','Whatsapp','afterUpdate','WhatsappMessage','Fax','FaxInteraction','FaxMessage','MailInteraction','Mail','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','then','info','Trigger,\x20%s','error','code','EventManager','catch','channel','motionChannel','event','direction','resolve','ContactId','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','UserId','undefined','interface','format','SIP/%s','name','agent'];(function(_0x42dd53,_0xec94a){var _0x3d77cb=function(_0x3d29c7){while(--_0x3d29c7){_0x42dd53['push'](_0x42dd53['shift']());}};_0x3d77cb(++_0xec94a);}(_0x8d7d,0xfc));var _0xd8d7=function(_0x1e7416,_0x548d6d){_0x1e7416=_0x1e7416-0x0;var _0x3073a8=_0x8d7d[_0x1e7416];return _0x3073a8;};'use strict';var util=require(_0xd8d7('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd8d7('0x1'));var logger=require(_0xd8d7('0x2'))(_0xd8d7('0x3'));var client=jayson[_0xd8d7('0x4')]['http']({'port':0x232a});var triggers=[{'channel':_0xd8d7('0x5'),'model':_0xd8d7('0x6'),'event':_0xd8d7('0x7'),'condition':_0xd8d7('0x8'),'callback':afterCreate},{'channel':_0xd8d7('0x5'),'model':_0xd8d7('0x6'),'event':'afterUpdate','condition':_0xd8d7('0x9'),'callback':afterUpdate},{'channel':_0xd8d7('0x5'),'model':_0xd8d7('0xa'),'event':_0xd8d7('0x7'),'condition':_0xd8d7('0xb'),'callback':afterCreateMessage},{'channel':_0xd8d7('0x5'),'model':_0xd8d7('0xc'),'event':'afterCreate','condition':_0xd8d7('0xb'),'callback':afterCreateOfflineMessage},{'channel':'Sms','model':_0xd8d7('0xd'),'event':_0xd8d7('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xd8d7('0xe'),'model':'SmsInteraction','event':'afterUpdate','condition':_0xd8d7('0x9'),'callback':afterUpdate},{'channel':_0xd8d7('0xe'),'model':_0xd8d7('0xf'),'event':_0xd8d7('0x7'),'condition':_0xd8d7('0xb'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0xd8d7('0x10'),'event':'afterCreate','condition':_0xd8d7('0x8'),'callback':afterCreate},{'channel':_0xd8d7('0x11'),'model':_0xd8d7('0x10'),'event':_0xd8d7('0x12'),'condition':_0xd8d7('0x9'),'callback':afterUpdate},{'channel':_0xd8d7('0x11'),'model':_0xd8d7('0x13'),'event':_0xd8d7('0x7'),'condition':_0xd8d7('0xb'),'callback':afterCreateMessage},{'channel':_0xd8d7('0x14'),'model':_0xd8d7('0x15'),'event':_0xd8d7('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xd8d7('0x14'),'model':_0xd8d7('0x15'),'event':'afterUpdate','condition':_0xd8d7('0x9'),'callback':afterUpdate},{'channel':_0xd8d7('0x14'),'model':_0xd8d7('0x16'),'event':_0xd8d7('0x7'),'condition':_0xd8d7('0xb'),'callback':afterCreateMessage},{'channel':'Mail','model':_0xd8d7('0x17'),'event':_0xd8d7('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xd8d7('0x18'),'model':_0xd8d7('0x17'),'event':_0xd8d7('0x12'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xd8d7('0x18'),'model':_0xd8d7('0x19'),'event':_0xd8d7('0x7'),'condition':_0xd8d7('0xb'),'callback':afterCreateMessage},{'channel':_0xd8d7('0x1a'),'model':_0xd8d7('0x1b'),'event':'afterCreate','condition':_0xd8d7('0x8'),'callback':afterCreate},{'channel':_0xd8d7('0x1a'),'model':_0xd8d7('0x1b'),'event':_0xd8d7('0x12'),'condition':_0xd8d7('0x9'),'callback':afterUpdate},{'channel':_0xd8d7('0x1a'),'model':_0xd8d7('0x1c'),'event':_0xd8d7('0x7'),'condition':_0xd8d7('0xb'),'callback':afterCreateMessage}];function request(_0x581542){return client[_0xd8d7('0x1d')]('EventManager',_0x581542)[_0xd8d7('0x1e')](function(_0x5d0767){logger[_0xd8d7('0x1f')](_0xd8d7('0x20'),'EventManager',_0x5d0767);if(_0x5d0767['error']){if(_0x5d0767[_0xd8d7('0x21')][_0xd8d7('0x22')]===0x1f4){logger[_0xd8d7('0x21')](_0xd8d7('0x20'),_0xd8d7('0x23'),_0x5d0767[_0xd8d7('0x21')]);}}})[_0xd8d7('0x24')](function(_0x1bbbf2){logger[_0xd8d7('0x21')](_0xd8d7('0x20'),_0xd8d7('0x23'),_0x1bbbf2);});}function afterCreateMessage(_0xcbda90){return function(_0x295133){_0x295133=_0x295133['get']({'plain':!![]});_0x295133[_0xd8d7('0x25')]=_0xcbda90;_0x295133[_0xd8d7('0x26')]=_0xcbda90;_0x295133[_0xd8d7('0x27')]=_0x295133[_0xd8d7('0x28')];Promise[_0xd8d7('0x29')]()[_0xd8d7('0x1e')](function(){if(typeof _0x295133[_0xd8d7('0x2a')]==='undefined')return null;var _0x1f9cfe=_0xd8d7('0x2b')+_0x295133[_0xd8d7('0x2a')];return db[_0xd8d7('0x2c')]['query'](_0x1f9cfe,{'type':db[_0xd8d7('0x2d')][_0xd8d7('0x2e')][_0xd8d7('0x2f')],'raw':!![]});})['then'](function(_0xd3001b){if(_0xd3001b){_0x295133[_0xd8d7('0x30')]=_0xd3001b[0x0];}if(typeof _0x295133[_0xd8d7('0x31')]===_0xd8d7('0x32'))return;return getAgent(_0x295133['UserId']);})['then'](function(_0x2e6ace){if(_0x2e6ace){_0x295133[_0xd8d7('0x33')]=util[_0xd8d7('0x34')](_0xd8d7('0x35'),_0x2e6ace[_0xd8d7('0x36')]);_0x295133[_0xd8d7('0x37')]=_0x2e6ace;_0x295133[_0xd8d7('0x25')]=_0xcbda90;return request({'event':_0xd8d7('0x38'),'message':_0x295133});}else{return request({'event':_0xd8d7('0x39'),'message':_0x295133});}})['catch'](function(_0x313660){logger[_0xd8d7('0x21')](_0xd8d7('0x20'),'AfterCreateMessage',_0x313660);});};}function afterCreateOfflineMessage(_0x52baa5){return function(_0x5cffb2){_0x5cffb2=_0x5cffb2[_0xd8d7('0x3a')]({'plain':!![]});_0x5cffb2[_0xd8d7('0x25')]=_0x52baa5;_0x5cffb2['motionChannel']=_0x52baa5;_0x5cffb2[_0xd8d7('0x27')]=_0xd8d7('0x3b');return request({'event':_0x5cffb2[_0xd8d7('0x27')],'message':_0x5cffb2});};}function afterCreate(_0x83352b,_0x8daa35){return function(_0x167107){_0x167107=_0x167107['get']({'plain':!![]});_0x167107[_0xd8d7('0x25')]=_0x83352b;_0x167107[_0xd8d7('0x26')]=_0x83352b;_0x167107['event']='opened';Promise[_0xd8d7('0x29')]()['then'](function(){var _0x7f1549=_0xd8d7('0x2b')+_0x167107[_0xd8d7('0x2a')];return db[_0xd8d7('0x2c')]['query'](_0x7f1549,{'type':db['Sequelize'][_0xd8d7('0x2e')][_0xd8d7('0x2f')],'raw':!![]});})[_0xd8d7('0x1e')](function(_0x1f612c){if(_0x1f612c){_0x167107[_0xd8d7('0x30')]=_0x1f612c[0x0];}if(typeof _0x167107['UserId']==='undefined')return;return getAgent(_0x167107[_0xd8d7('0x31')]);})['then'](function(_0x16fa29){if(_0x16fa29){_0x167107[_0xd8d7('0x33')]=util[_0xd8d7('0x34')](_0xd8d7('0x35'),_0x16fa29['name']);_0x167107[_0xd8d7('0x37')]=_0x16fa29;}return request({'event':_0x8daa35,'message':_0x167107});})[_0xd8d7('0x24')](function(_0xf53725){logger[_0xd8d7('0x21')]('Trigger,\x20%s',_0xd8d7('0x3c'),_0xf53725);});};}function afterUpdate(_0xc61ee4){return function(_0x320346){var _0x24c3b3=_0x320346[_0xd8d7('0x3d')](_0xd8d7('0x3e'))&&_0x320346[_0xd8d7('0x3e')];var _0x486734=_0x320346[_0xd8d7('0x3d')](_0xd8d7('0x3f'));if(_0x24c3b3||_0x486734){var _0x2cab6d=_0x24c3b3?_0xd8d7('0x9'):'substatus';var _0x181f5f=_0x320346[_0xd8d7('0x3a')]({'plain':!![]});_0x181f5f[_0xd8d7('0x25')]=_0xc61ee4;_0x181f5f['motionChannel']=_0xc61ee4;_0x181f5f[_0xd8d7('0x27')]=_0x24c3b3?_0xd8d7('0x3e'):'substatus';var _0x47382a=_0xd8d7('0x2b')+_0x181f5f['ContactId'];return db[_0xd8d7('0x2c')][_0xd8d7('0x40')](_0x47382a,{'type':db['Sequelize'][_0xd8d7('0x2e')][_0xd8d7('0x2f')],'raw':!![]})[_0xd8d7('0x1e')](function(_0x52a708){if(_0x52a708){_0x181f5f[_0xd8d7('0x30')]=_0x52a708[0x0];}if(typeof _0x181f5f[_0xd8d7('0x31')]===_0xd8d7('0x32'))return;return getAgent(_0x181f5f[_0xd8d7('0x31')]);})[_0xd8d7('0x1e')](function(_0x50f0fd){if(_0x50f0fd){_0x181f5f[_0xd8d7('0x33')]=util[_0xd8d7('0x34')](_0xd8d7('0x35'),_0x50f0fd[_0xd8d7('0x36')]);_0x181f5f[_0xd8d7('0x37')]=_0x50f0fd;}return request({'event':_0x2cab6d,'message':_0x181f5f});})[_0xd8d7('0x24')](function(_0x292cc5){logger['error']('Trigger,\x20%s',_0xd8d7('0x41'),_0x292cc5);});}};}function getAgent(_0x26b8af){return db[_0xd8d7('0x42')][_0xd8d7('0x43')]({'where':{'id':_0x26b8af},'attributes':['id',_0xd8d7('0x36'),_0xd8d7('0x44'),_0xd8d7('0x45'),_0xd8d7('0x46')],'raw':!![]})[_0xd8d7('0x1e')](function(_0x41e787){return _0x41e787;});}exports[_0xd8d7('0x47')]=function(){for(var _0x1792d5=0x0;_0x1792d5=_0x40d499[_0x1a35('0x15')]){throw Error(_0x1a35('0x16'));}_0x5b7c8b(_0x1daaed);})[_0x1a35('0x17')](function(_0x4f2d80){_0x2d74bf(_0x4f2d80);});});}; \ No newline at end of file +var _0xd930=['isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','getLicense','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','voice','mail','chat','fax','sms','whatsapp','openchannel','getChannels'];(function(_0x219dfe,_0xfec2b9){var _0x2d9fb8=function(_0x4daebd){while(--_0x4daebd){_0x219dfe['push'](_0x219dfe['shift']());}};_0x2d9fb8(++_0xfec2b9);}(_0xd930,0x1d0));var _0x0d93=function(_0x2c514f,_0x5413f8){_0x2c514f=_0x2c514f-0x0;var _0x37cd8c=_0xd930[_0x2c514f];return _0x37cd8c;};'use strict';var _=require(_0x0d93('0x0'));var BPromise=require(_0x0d93('0x1'));var db=require(_0x0d93('0x2'))['db'];var util=require('./license/util');var channels=[_0x0d93('0x3'),_0x0d93('0x4'),_0x0d93('0x5'),_0x0d93('0x6'),_0x0d93('0x7'),_0x0d93('0x8'),_0x0d93('0x9')];exports[_0x0d93('0xa')]=function(){return channels;};exports[_0x0d93('0xb')]=function(_0xecb4b3){_0xecb4b3=_0xecb4b3[_0x0d93('0xc')]();return _[_0x0d93('0xd')](channels,_0xecb4b3);};exports[_0x0d93('0xe')]=function(_0x341850,_0x189581,_0x5e52cc,_0x4ac36c){var _0x335e41={'loginAttempts':_0x189581,'blocked':_0x5e52cc};if(!_[_0x0d93('0xf')](_0x4ac36c)){_0x335e41[_0x0d93('0x10')]=_0x4ac36c;}return _0x341850['updateAttributes'](_0x335e41);};exports[_0x0d93('0x11')]=function(_0x5a5ccf){return new BPromise(function(_0x270e47,_0x598572){var _0x275690=0x0;if(_0x5a5ccf['role']!==_0x0d93('0x12')){_0x270e47(_0x5a5ccf);}db[_0x0d93('0x13')][_0x0d93('0x14')]({'where':{'role':_0x0d93('0x12'),'online':!![],'id':{'$ne':_0x5a5ccf['id']}}})['then'](function(_0x3ab22c){_0x275690=_0x3ab22c;return util['getLicense']();})[_0x0d93('0x15')](function(_0x45eacb){if(_0x45eacb&&_0x45eacb[_0x0d93('0x16')]&&_0x275690>=_0x45eacb[_0x0d93('0x16')]){throw Error(_0x0d93('0x17'));}_0x270e47(_0x5a5ccf);})[_0x0d93('0x18')](function(_0x1dac0b){_0x598572(_0x1dac0b);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index d34a401..2cf8c60 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0xadb5=['Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error','statusMessage','status','send','exports','../config/logger','message','name','Error','inherits','Bad\x20Request','Entity\x20not\x20found'];(function(_0x502eb0,_0x6d0814){var _0x4f78e4=function(_0x237787){while(--_0x237787){_0x502eb0['push'](_0x502eb0['shift']());}};_0x4f78e4(++_0x6d0814);}(_0xadb5,0xad));var _0x5adb=function(_0x46aa90,_0x7345e5){_0x46aa90=_0x46aa90-0x0;var _0x2857fd=_0xadb5[_0x46aa90];return _0x2857fd;};'use strict';var util=require('util');var logger=require(_0x5adb('0x0'))('api');var APIError=function(_0x3d6340,_0x38f67f){this[_0x5adb('0x1')]=_0x3d6340||'Internal\x20Server\x20Error';this[_0x5adb('0x2')]=_0x38f67f||_0x5adb('0x3');util[_0x5adb('0x4')](APIError,Error);};var APIBadRequestError=function(_0x4cb1d1){this[_0x5adb('0x1')]=_0x4cb1d1||_0x5adb('0x5');this[_0x5adb('0x2')]=_0x5adb('0x5');util[_0x5adb('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x353885){this[_0x5adb('0x1')]=_0x353885||_0x5adb('0x6');this[_0x5adb('0x2')]=_0x5adb('0x7');util[_0x5adb('0x4')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x336bad){this[_0x5adb('0x1')]=_0x336bad||_0x5adb('0x8');this['name']='Out\x20Of\x20Interval';util[_0x5adb('0x4')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x1ea238){switch(_0x1ea238){case _0x5adb('0x5'):return 0x190;case'Forbidden',_0x5adb('0x9'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x2a0b70){if(_0x2a0b70==='Out\x20Of\x20Interval')return _0x2a0b70;return null;}function handleError(_0x8cfcc6){return function(_0x39a0b3){logger[_0x5adb('0xa')](_0x39a0b3['stack']);var _0x2a545b=getStatusCode(_0x39a0b3[_0x5adb('0x2')]);var _0xf82f72=getCustomStatusMessage(_0x39a0b3['name']);if(_0x39a0b3[_0x5adb('0x2')])delete _0x39a0b3['name'];if(_0xf82f72)_0x8cfcc6[_0x5adb('0xb')]=_0xf82f72;return _0x8cfcc6[_0x5adb('0xc')](_0x2a545b)[_0x5adb('0xd')](_0x39a0b3);};}module[_0x5adb('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 9d6b11b..9c8a54f 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x5269=['exports','status','json','send'];(function(_0x1da19a,_0x391a10){var _0x5bdd7c=function(_0x2a6900){while(--_0x2a6900){_0x1da19a['push'](_0x1da19a['shift']());}};_0x5bdd7c(++_0x391a10);}(_0x5269,0x150));var _0x9526=function(_0x4cdbfd,_0x31641a){_0x4cdbfd=_0x4cdbfd-0x0;var _0x57b83e=_0x5269[_0x4cdbfd];return _0x57b83e;};'use strict';module[_0x9526('0x0')][0x194]=function pageNotFound(_0x562841,_0x562750){var _0x47d306='404';var _0x4499e9=0x194;var _0x228b77={'status':_0x4499e9};_0x562750[_0x9526('0x1')](_0x228b77['status']);_0x562750['render'](_0x47d306,{},function(_0x2eb571,_0x59bf4c){if(_0x2eb571){return _0x562750[_0x9526('0x1')](_0x228b77[_0x9526('0x1')])[_0x9526('0x2')](_0x228b77);}_0x562750[_0x9526('0x3')](_0x59bf4c);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index ea0f09d..d85b0d8 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(_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 +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(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 100164d..d02d6dd 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x1c42=['./api/authLocal','/api/auth/google','./api/authGoogle','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','/api/pm2','./api/pm2','/api/webbar','/api/logs','static','join','root','/apidoc','/www','/demo','snippet','3.5.0','/:url(api|auth|components|app|bower_components|assets)/*','route','sendFile','resolve','get','appPath','/index.html','express','./errors','./config/environment','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueueReport','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowField','/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/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/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/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/userProfile','/api/userProfile/resources','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0x1c42,0x13a));var _0x21c4=function(_0x4e35b9,_0x52bee7){_0x4e35b9=_0x4e35b9-0x0;var _0x522167=_0x1c42[_0x4e35b9];return _0x522167;};'use strict';var path=require('path');var express=require(_0x21c4('0x0'));var errors=require(_0x21c4('0x1'));var config=require(_0x21c4('0x2'));var setupLoggers=require('./utils/client-side-logger')[_0x21c4('0x3')];var clientSideLogs=require(_0x21c4('0x4'));exports[_0x21c4('0x5')]=function(_0xd7340){return setupLoggers(_0xd7340)[_0x21c4('0x6')](function(){_0xd7340[_0x21c4('0x7')](_0x21c4('0x8'),require(_0x21c4('0x9')));_0xd7340['use'](_0x21c4('0xa'),require(_0x21c4('0xb')));_0xd7340['use'](_0x21c4('0xc'),require('./api/voiceContext'));_0xd7340[_0x21c4('0x7')](_0x21c4('0xd'),require(_0x21c4('0xe')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xf'),require(_0x21c4('0x10')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x11'),require(_0x21c4('0x12')));_0xd7340['use'](_0x21c4('0x13'),require('./api/voiceRecording'));_0xd7340[_0x21c4('0x7')]('/api/screen/recordings',require(_0x21c4('0x14')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x15'),require(_0x21c4('0x16')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x17'),require(_0x21c4('0x18')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x19'),require(_0x21c4('0x1a')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x1b'),require(_0x21c4('0x1c')));_0xd7340['use']('/api/voice/agents/reports',require(_0x21c4('0x1d')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x1e'),require(_0x21c4('0x1f')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x20'),require(_0x21c4('0x21')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x22'),require(_0x21c4('0x23')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x24'),require(_0x21c4('0x25')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x26'),require(_0x21c4('0x27')));_0xd7340['use']('/api/mail/accounts',require(_0x21c4('0x28')));_0xd7340[_0x21c4('0x7')]('/api/mail/queues',require(_0x21c4('0x29')));_0xd7340['use'](_0x21c4('0x2a'),require(_0x21c4('0x2b')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x2c'),require(_0x21c4('0x2d')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x2e'),require(_0x21c4('0x2f')));_0xd7340[_0x21c4('0x7')]('/api/mail/applications',require('./api/mailApplication'));_0xd7340[_0x21c4('0x7')]('/api/mail/reports/queue',require(_0x21c4('0x30')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x31'),require(_0x21c4('0x32')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x33'),require('./api/dashboardItem'));_0xd7340[_0x21c4('0x7')](_0x21c4('0x34'),require('./api/faxAccount'));_0xd7340[_0x21c4('0x7')](_0x21c4('0x35'),require(_0x21c4('0x36')));_0xd7340['use']('/api/fax/interactions',require(_0x21c4('0x37')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x38'),require(_0x21c4('0x39')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x3a'),require('./api/faxQueue'));_0xd7340['use']('/api/fax/reports/queue',require(_0x21c4('0x3b')));_0xd7340['use']('/api/sms/accounts',require('./api/smsAccount'));_0xd7340[_0x21c4('0x7')](_0x21c4('0x3c'),require('./api/smsApplication'));_0xd7340[_0x21c4('0x7')](_0x21c4('0x3d'),require(_0x21c4('0x3e')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x3f'),require(_0x21c4('0x40')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x41'),require('./api/smsQueue'));_0xd7340['use'](_0x21c4('0x42'),require(_0x21c4('0x43')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x44'),require(_0x21c4('0x45')));_0xd7340[_0x21c4('0x7')]('/api/openchannel/interactions',require(_0x21c4('0x46')));_0xd7340['use'](_0x21c4('0x47'),require(_0x21c4('0x48')));_0xd7340['use'](_0x21c4('0x49'),require(_0x21c4('0x4a')));_0xd7340[_0x21c4('0x7')]('/api/chat/websites',require(_0x21c4('0x4b')));_0xd7340['use'](_0x21c4('0x4c'),require(_0x21c4('0x4d')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x4e'),require('./api/chatApplication'));_0xd7340['use'](_0x21c4('0x4f'),require(_0x21c4('0x50')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x51'),require(_0x21c4('0x52')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x53'),require(_0x21c4('0x54')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x55'),require(_0x21c4('0x56')));_0xd7340[_0x21c4('0x7')]('/api/chat/groups',require(_0x21c4('0x57')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x58'),require(_0x21c4('0x59')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x5a'),require('./api/cmCompany'));_0xd7340[_0x21c4('0x7')](_0x21c4('0x5b'),require(_0x21c4('0x5c')));_0xd7340['use'](_0x21c4('0x5d'),require(_0x21c4('0x5e')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x5f'),require(_0x21c4('0x60')));_0xd7340['use'](_0x21c4('0x61'),require(_0x21c4('0x62')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x63'),require(_0x21c4('0x64')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x65'),require(_0x21c4('0x66')));_0xd7340[_0x21c4('0x7')]('/api/actions',require(_0x21c4('0x67')));_0xd7340['use']('/api/automations',require('./api/automation'));_0xd7340['use'](_0x21c4('0x68'),require(_0x21c4('0x69')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x6a'),require(_0x21c4('0x6b')));_0xd7340['use'](_0x21c4('0x6c'),require(_0x21c4('0x6d')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x6e'),require(_0x21c4('0x6f')));_0xd7340['use'](_0x21c4('0x70'),require(_0x21c4('0x71')));_0xd7340['use'](_0x21c4('0x72'),require(_0x21c4('0x73')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x74'),require(_0x21c4('0x75')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x76'),require(_0x21c4('0x77')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x78'),require('./api/sound'));_0xd7340['use'](_0x21c4('0x79'),require('./api/tag'));_0xd7340[_0x21c4('0x7')](_0x21c4('0x7a'),require(_0x21c4('0x7b')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x7c'),require(_0x21c4('0x7d')));_0xd7340['use'](_0x21c4('0x7e'),require(_0x21c4('0x7f')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x80'),require('./api/template'));_0xd7340[_0x21c4('0x7')](_0x21c4('0x81'),require(_0x21c4('0x82')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x83'),require(_0x21c4('0x84')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x85'),require(_0x21c4('0x86')));_0xd7340['use']('/api/integrations/reports',require('./api/integrationReport'));_0xd7340['use'](_0x21c4('0x87'),require(_0x21c4('0x88')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x89'),require('./api/analyticDefaultReport'));_0xd7340[_0x21c4('0x7')](_0x21c4('0x8a'),require(_0x21c4('0x8b')));_0xd7340['use'](_0x21c4('0x8c'),require('./api/analyticMetric'));_0xd7340['use'](_0x21c4('0x8d'),require(_0x21c4('0x8e')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x8f'),require('./api/analyticTreeReport'));_0xd7340[_0x21c4('0x7')](_0x21c4('0x90'),require(_0x21c4('0x91')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x92'),require(_0x21c4('0x93')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x94'),require(_0x21c4('0x95')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x96'),require('./api/intSugarcrmAccount'));_0xd7340['use'](_0x21c4('0x97'),require(_0x21c4('0x98')));_0xd7340['use']('/api/integrations/sugarcrm/fields',require(_0x21c4('0x99')));_0xd7340[_0x21c4('0x7')]('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0xd7340[_0x21c4('0x7')](_0x21c4('0x9a'),require(_0x21c4('0x9b')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x9c'),require(_0x21c4('0x9d')));_0xd7340['use'](_0x21c4('0x9e'),require(_0x21c4('0x9f')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xa0'),require(_0x21c4('0xa1')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xa2'),require(_0x21c4('0xa3')));_0xd7340[_0x21c4('0x7')]('/api/integrations/zendesk/accounts',require(_0x21c4('0xa4')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xa5'),require(_0x21c4('0xa6')));_0xd7340['use'](_0x21c4('0xa7'),require(_0x21c4('0xa8')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xa9'),require(_0x21c4('0xaa')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xab'),require(_0x21c4('0xac')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xad'),require(_0x21c4('0xae')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xaf'),require('./api/intVtigerAccount'));_0xd7340[_0x21c4('0x7')](_0x21c4('0xb0'),require('./api/intVtigerConfiguration'));_0xd7340['use'](_0x21c4('0xb1'),require(_0x21c4('0xb2')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xb3'),require(_0x21c4('0xb4')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xb5'),require('./api/intServicenowConfiguration'));_0xd7340[_0x21c4('0x7')]('/api/integrations/servicenow/fields',require(_0x21c4('0xb6')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xb7'),require(_0x21c4('0xb8')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xb9'),require(_0x21c4('0xba')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xbb'),require(_0x21c4('0xbc')));_0xd7340['use'](_0x21c4('0xbd'),require(_0x21c4('0xbe')));_0xd7340['use'](_0x21c4('0xbf'),require(_0x21c4('0xc0')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xc1'),require(_0x21c4('0xc2')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xc3'),require('./api/network'));_0xd7340[_0x21c4('0x7')](_0x21c4('0xc4'),require(_0x21c4('0xc5')));_0xd7340['use'](_0x21c4('0xc6'),require(_0x21c4('0xc7')));_0xd7340[_0x21c4('0x7')]('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0xd7340[_0x21c4('0x7')]('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0xd7340[_0x21c4('0x7')](_0x21c4('0xc8'),require(_0x21c4('0xc9')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xca'),require(_0x21c4('0xcb')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xcc'),require(_0x21c4('0xcd')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xce'),require(_0x21c4('0xcf')));_0xd7340['use'](_0x21c4('0xd0'),require(_0x21c4('0xd1')));_0xd7340['use'](_0x21c4('0xd2'),require(_0x21c4('0xd3')));_0xd7340[_0x21c4('0x7')]('/api/square/odbc',require(_0x21c4('0xd4')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xd5'),require(_0x21c4('0xd6')));_0xd7340['use'](_0x21c4('0xd7'),require(_0x21c4('0xd8')));_0xd7340[_0x21c4('0x7')]('/api/square/messages',require(_0x21c4('0xd9')));_0xd7340['use']('/api/teams',require(_0x21c4('0xda')));_0xd7340['use'](_0x21c4('0xdb'),require(_0x21c4('0xdc')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xdd'),require(_0x21c4('0xde')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xdf'),require(_0x21c4('0xe0')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xe1'),require(_0x21c4('0xe2')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xe3'),require(_0x21c4('0xe4')));_0xd7340['use']('/api/mail/reports/transfer',require(_0x21c4('0xe5')));_0xd7340['use'](_0x21c4('0xe6'),require(_0x21c4('0xe7')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xe8'),require(_0x21c4('0xe9')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xea'),require(_0x21c4('0xeb')));_0xd7340['use'](_0x21c4('0xec'),require(_0x21c4('0xed')));_0xd7340['use'](_0x21c4('0xee'),require('./api/cmList'));_0xd7340[_0x21c4('0x7')]('/api/voice/prefixes',require('./api/voicePrefix'));_0xd7340['use']('/api/userProfiles',require(_0x21c4('0xef')));_0xd7340[_0x21c4('0x7')]('/api/userProfile/sections',require('./api/userProfileSection'));_0xd7340[_0x21c4('0x7')](_0x21c4('0xf0'),require('./api/userProfileResource'));_0xd7340[_0x21c4('0x7')]('/api/userNotifications',require('./api/userNotification'));_0xd7340[_0x21c4('0x7')](_0x21c4('0xf1'),require('./api/whatsappAccount'));_0xd7340[_0x21c4('0x7')](_0x21c4('0xf2'),require(_0x21c4('0xf3')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xf4'),require('./api/whatsappInteraction'));_0xd7340['use']('/api/whatsapp/messages',require(_0x21c4('0xf5')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xf6'),require(_0x21c4('0xf7')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xf8'),require(_0x21c4('0xf9')));_0xd7340[_0x21c4('0x7')]('/api/whatsapp/queues',require(_0x21c4('0xfa')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xfb'),require(_0x21c4('0xfc')));_0xd7340['use'](_0x21c4('0xfd'),require(_0x21c4('0xfe')));_0xd7340[_0x21c4('0x7')](_0x21c4('0xff'),require(_0x21c4('0x100')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x101'),require(_0x21c4('0x102')));_0xd7340['use'](_0x21c4('0x103'),require(_0x21c4('0x104')));_0xd7340[_0x21c4('0x7')]('/api/auth/activedirectory',require(_0x21c4('0x105')));_0xd7340['use'](_0x21c4('0x106'),require(_0x21c4('0x107')));_0xd7340[_0x21c4('0x7')](_0x21c4('0x108'),require(_0x21c4('0x109')));_0xd7340['use'](_0x21c4('0x10a'),require('./api/version'));_0xd7340[_0x21c4('0x7')]('/api/system',require('./api/system'));_0xd7340[_0x21c4('0x7')](_0x21c4('0x10b'),require(_0x21c4('0x10c')));_0xd7340['use'](_0x21c4('0x10d'),require('./api/webbar'));_0xd7340[_0x21c4('0x7')](_0x21c4('0x10e'),clientSideLogs);_0xd7340['use']('/apidoc',express[_0x21c4('0x10f')](path[_0x21c4('0x110')](config[_0x21c4('0x111')],_0x21c4('0x112'))));_0xd7340['use'](_0x21c4('0x113'),express[_0x21c4('0x10f')](path['join'](config['root'],_0x21c4('0x113'))));_0xd7340['use']('/demo',express[_0x21c4('0x10f')](path['join'](config[_0x21c4('0x111')],_0x21c4('0x114'))));_0xd7340['use']('/snippet',express[_0x21c4('0x10f')](path[_0x21c4('0x110')](config[_0x21c4('0x111')],_0x21c4('0x115'),_0x21c4('0x116'))));_0xd7340[_0x21c4('0x7')]('/plugins',express[_0x21c4('0x10f')](path['join'](config['root'],'/server/files/plugins')));_0xd7340['route'](_0x21c4('0x117'))['get'](errors[0x194]);_0xd7340[_0x21c4('0x118')]('/*')['get'](function(_0x415dbd,_0x32011d){_0x32011d[_0x21c4('0x119')](path[_0x21c4('0x11a')](_0xd7340[_0x21c4('0x11b')](_0x21c4('0x11c'))+_0x21c4('0x11d')));});return _0xd7340;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 3172386..2c09336 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x1fd1=['../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','../config/environment','listen','merge','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc'];(function(_0x9860e6,_0x238ca3){var _0x49ec8f=function(_0x3c41cd){while(--_0x3c41cd){_0x9860e6['push'](_0x9860e6['shift']());}};_0x49ec8f(++_0x238ca3);}(_0x1fd1,0xaa));var _0x11fd=function(_0x4ef308,_0x6d0531){_0x4ef308=_0x4ef308-0x0;var _0x1f3af2=_0x1fd1[_0x4ef308];return _0x1f3af2;};'use strict';var jayson=require('jayson/promise');var _=require(_0x11fd('0x0'));var config=require(_0x11fd('0x1'));exports[_0x11fd('0x2')]=function(){return new Promise(function(_0x117b4d,_0x5d9036){var _0x4bc4a4={};_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/user/user.rpc'));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/voiceExtension/voiceExtension.rpc'));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/voiceQueue/voiceQueue.rpc'));_0x4bc4a4=_['merge'](_0x4bc4a4,require(_0x11fd('0x4')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x5')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x6')));_0x4bc4a4=_['merge'](_0x4bc4a4,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x4bc4a4=_['merge'](_0x4bc4a4,require(_0x11fd('0x7')));_0x4bc4a4=_['merge'](_0x4bc4a4,require('../api/memberReport/memberReport.rpc'));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/trunk/trunk.rpc'));_0x4bc4a4=_['merge'](_0x4bc4a4,require(_0x11fd('0x8')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x9')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/mailServerIn/mailServerIn.rpc'));_0x4bc4a4=_['merge'](_0x4bc4a4,require(_0x11fd('0xa')));_0x4bc4a4=_['merge'](_0x4bc4a4,require('../api/mailQueue/mailQueue.rpc'));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0xb')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0xc')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0xd')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0xe')));_0x4bc4a4=_['merge'](_0x4bc4a4,require(_0x11fd('0xf')));_0x4bc4a4=_['merge'](_0x4bc4a4,require(_0x11fd('0x10')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/faxInteraction/faxInteraction.rpc'));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x11')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/faxQueue/faxQueue.rpc'));_0x4bc4a4=_['merge'](_0x4bc4a4,require(_0x11fd('0x12')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x13')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/smsInteraction/smsInteraction.rpc'));_0x4bc4a4=_['merge'](_0x4bc4a4,require(_0x11fd('0x14')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x15')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x16')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x17')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x18')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x19')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x1a')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x1b')));_0x4bc4a4=_['merge'](_0x4bc4a4,require('../api/chatMessage/chatMessage.rpc'));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x1c')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x1d')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/cmHopper/cmHopper.rpc'));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x1e')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x1f')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x20')));_0x4bc4a4=_['merge'](_0x4bc4a4,require('../api/pause/pause.rpc'));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x21')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x22')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/template/template.rpc'));_0x4bc4a4=_['merge'](_0x4bc4a4,require('../api/trigger/trigger.rpc'));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x23')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x24')));_0x4bc4a4=_['merge'](_0x4bc4a4,require(_0x11fd('0x25')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x26')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x27')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x28')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x29')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x4bc4a4=_['merge'](_0x4bc4a4,require(_0x11fd('0x2a')));_0x4bc4a4=_['merge'](_0x4bc4a4,require(_0x11fd('0x2b')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x2c')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x2d')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x2e')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x2f')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/squareOdbc/squareOdbc.rpc'));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x30')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x31')));_0x4bc4a4=_['merge'](_0x4bc4a4,require(_0x11fd('0x32')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x33')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x34')));_0x4bc4a4=_['merge'](_0x4bc4a4,require(_0x11fd('0x35')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x36')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x4bc4a4=_['merge'](_0x4bc4a4,require(_0x11fd('0x37')));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x4bc4a4=_[_0x11fd('0x3')](_0x4bc4a4,require(_0x11fd('0x38')));var _0xaff737=jayson[_0x11fd('0x39')](_0x4bc4a4)['http']();var _0x23165d=config[_0x11fd('0x3a')][_0x11fd('0x3b')]||config['port']+0x1;var _0x21a66a=config[_0x11fd('0x3a')]['ip']||_0x11fd('0x3c');_0xaff737['on'](_0x11fd('0x3d'),function(_0x3ce080){return _0x5d9036(_0x3ce080);});_0xaff737[_0x11fd('0x2')](_0x23165d,_0x21a66a,function(){console['log'](_0x11fd('0x3e'),_0x21a66a,_0x23165d);require(_0x11fd('0x3f'))[_0x11fd('0x40')]();return _0x117b4d(_0x11fd('0x41')+_0x21a66a+':'+_0x23165d);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index bfaa332..0b3507c 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 _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 +var _0x14b2=['sendRequest','sync','answer','ANSWER','getData','beep','format','noop','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','setExtension','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','EventEmitter','./reply','./error','setEncoding','utf8','setTimeout','headers','ready','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','startsWith','length','error','code','close','emit','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','command','write','destroy','prototype'];(function(_0x33593e,_0x22ddd3){var _0x53db1a=function(_0x499ee5){while(--_0x499ee5){_0x33593e['push'](_0x33593e['shift']());}};_0x53db1a(++_0x22ddd3);}(_0x14b2,0x1a1));var _0x214b=function(_0x3859be,_0x65cb87){_0x3859be=_0x3859be-0x0;var _0x5d7246=_0x14b2[_0x3859be];return _0x5d7246;};'use strict';var util=require(_0x214b('0x0'));var _=require(_0x214b('0x1'));var EventEmitter=require('events')[_0x214b('0x2')];var AGIReply=require(_0x214b('0x3'));var AGIError=require(_0x214b('0x4'));function AGIChannel(_0x10fe02){var _0x51ec4f=this,_0x1f27f5=new AGIReply(),_0x445396=![],_0x51b647={};EventEmitter['call'](_0x51ec4f);_0x10fe02[_0x214b('0x5')](_0x214b('0x6'));_0x10fe02[_0x214b('0x7')](0x8*0x3c*0x3c*0x3e8);_0x1f27f5[_0x214b('0x5')](_0x214b('0x6'));_0x1f27f5['on'](_0x214b('0x8'),function(_0x4cd18e){for(var _0x3dff9b in _0x4cd18e){_0x51ec4f[_0x3dff9b]=_0x4cd18e[_0x3dff9b];}_0x51ec4f['emit'](_0x214b('0x9'));});_0x1f27f5['on']('line',function(_0x322c4c){if(_0x322c4c['toLowerCase']()=='hangup'){_0x51ec4f['emit'](_0x214b('0xa'));return;}if(_0x322c4c[_0x214b('0xb')](0x0,0xb)=='520-Invalid'){_0x445396=!![];}if(_0x445396){_0x51b647['rx']+=_0x322c4c+'\x0a';if(_0x322c4c[_0x214b('0xc')](_0x214b('0xd'))!=-0x1){_0x445396=![];}}else{_0x51b647['rx']=_0x322c4c;}if(_0x445396){return;}if(typeof _0x51b647['cb']==_0x214b('0xe')){var _0x5f3d32=_0x51b647['rx']['substring'](0x0,0x3),_0x2af1df=null,_0x5e65ae=null;_0x5f3d32=parseInt(_0x5f3d32);if(isNaN(_0x5f3d32)){_0x51b647['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x214b('0xf')});return;}if(_0x5f3d32!=0xc8){_0x51b647['cb'](null,{'code':_0x5f3d32,'result':-0x1,'extra':'KO'});return;}_0x2af1df=_0x51b647['rx'][_0x214b('0xb')](0x4)[_0x214b('0x10')](_0x214b('0x11'),'');if(_0x2af1df[_0x214b('0x12')]('\x20')!=-0x1){_0x2af1df=_0x2af1df[_0x214b('0x13')](0x0,_0x2af1df['indexOf']('\x20'));}if(_[_0x214b('0x14')](_0x2af1df,'-1')){_0x2af1df=parseInt(_0x2af1df);}_0x5e65ae=_0x51b647['rx']['split']('\x20');if(_0x5e65ae[_0x214b('0x15')]==0x3){_0x5e65ae=_0x5e65ae[0x2][_0x214b('0xb')](0x1,_0x5e65ae[0x2][_0x214b('0x15')]-0x1);}else if(_0x5e65ae['length']>0x3){var _0x4d2557=/\((.+)\)/;var _0x395f35=_0x51b647['rx']['match'](_0x4d2557);if(_0x395f35){_0x5e65ae=_0x395f35[0x1];}else{_0x5e65ae=null;}}else{_0x5e65ae=null;}_0x51b647['cb'](null,{'code':_0x5f3d32,'result':_0x2af1df,'extra':_0x5e65ae});}});_0x10fe02['on'](_0x214b('0x16'),function(_0xbe4932){_0x51ec4f['emit'](_0x214b('0x16'),new AGIError('E_AGI_SOCKET_ERROR',_0xbe4932[_0x214b('0x17')]));});_0x10fe02['on'](_0x214b('0x18'),function(){_0x51ec4f[_0x214b('0x19')]('close',new AGIError(_0x214b('0x1a')));});_0x10fe02['on'](_0x214b('0x1b'),function(){_0x51ec4f[_0x214b('0x19')](_0x214b('0x1b'),new AGIError(_0x214b('0x1c')));_0x10fe02['destroy']();});_0x10fe02['pipe'](_0x1f27f5);this[_0x214b('0x1d')]=function(_0x369dea,_0x23b470){var _0x369dea=_0x369dea||'',_0x23b470=typeof _0x23b470==_0x214b('0xe')?_0x23b470:new Function();_0x51b647={'tx':_0x369dea,'rx':'','cb':_0x23b470};_0x10fe02[_0x214b('0x1e')](_0x369dea+'\x0a');},this[_0x214b('0x18')]=function(){_0x10fe02[_0x214b('0x1f')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x214b('0x20')][_0x214b('0x21')]=function(_0x7ad1cc){return this[_0x214b('0x1d')][_0x214b('0x22')](this,_0x7ad1cc);};AGIChannel[_0x214b('0x20')][_0x214b('0x23')]=function(){return this[_0x214b('0x21')](_0x214b('0x24'));};AGIChannel[_0x214b('0x20')][_0x214b('0x25')]=function(_0x5a0aea,_0x5e82cb,_0x454bff){_0x5a0aea=_0x5a0aea===undefined?_0x214b('0x26'):_0x5a0aea;_0x5e82cb=_0x5e82cb===undefined?'5':_0x5e82cb;_0x454bff=_0x454bff===undefined?'1':_0x454bff;return this[_0x214b('0x21')](util[_0x214b('0x27')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x5a0aea,_0x5e82cb*0x3e8,_0x454bff));};AGIChannel[_0x214b('0x20')][_0x214b('0x28')]=function(_0x586879){_0x586879=_0x586879||'NO\x20MESSAGE';return this[_0x214b('0x21')](util[_0x214b('0x27')](_0x214b('0x29'),_0x586879));};AGIChannel['prototype'][_0x214b('0x2a')]=function(_0x4f449f,_0x59d6d9){if(_[_0x214b('0x2b')](_0x59d6d9)){return this[_0x214b('0x21')](util[_0x214b('0x27')](_0x214b('0x2c'),_0x4f449f,_0x59d6d9[_0x214b('0x2d')](',')));}return this[_0x214b('0x21')](util[_0x214b('0x27')](_0x214b('0x2c'),_0x4f449f,_0x59d6d9));};AGIChannel['prototype']['setContext']=function(_0x170bbc){return this[_0x214b('0x21')](util[_0x214b('0x27')](_0x214b('0x2e'),_0x170bbc));};AGIChannel['prototype']['setExtension']=function(_0x32381a){return this[_0x214b('0x21')](util['format'](_0x214b('0x2f'),_0x32381a));};AGIChannel[_0x214b('0x20')][_0x214b('0x30')]=function(_0xec2cd5){return this[_0x214b('0x21')](util['format'](_0x214b('0x31'),_0xec2cd5));};AGIChannel[_0x214b('0x20')]['hangup']=function(){return this[_0x214b('0x21')]('HANGUP');};AGIChannel['prototype'][_0x214b('0x32')]=function(_0x4832fb,_0x1fd14b){var _0x5c11a4=_[_0x214b('0x33')](_0x1fd14b)||_[_0x214b('0x34')](_0x1fd14b)?_0x1fd14b[_0x214b('0x35')]():_0x1fd14b;return this['sendRequest'](util[_0x214b('0x27')](_0x214b('0x36'),_0x4832fb,_0x5c11a4?_0x5c11a4[_0x214b('0x35')]()[_0x214b('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x214b('0x20')]['sayNumber']=function(_0x4613e5,_0x11b171){return this[_0x214b('0x21')](util[_0x214b('0x27')](_0x214b('0x37'),_0x4613e5,_0x11b171));};AGIChannel[_0x214b('0x20')][_0x214b('0x38')]=function(_0x599270,_0x2e0c69){return this[_0x214b('0x21')](util[_0x214b('0x27')](_0x214b('0x39'),_0x599270,_0x2e0c69));};AGIChannel[_0x214b('0x20')]['sayPhonetic']=function(_0x5af434,_0x509a3b){return this[_0x214b('0x21')](util[_0x214b('0x27')](_0x214b('0x3a'),_0x5af434,_0x509a3b));};AGIChannel[_0x214b('0x20')][_0x214b('0x3b')]=function(_0x49aef2,_0x3d0540,_0x1b36be){_0x3d0540=_0x3d0540||this[_0x214b('0x3c')];_0x1b36be=_0x1b36be||0x1;this[_0x214b('0x3d')](_0x49aef2);this[_0x214b('0x3e')](_0x3d0540);this[_0x214b('0x30')](_0x1b36be);return this['noop'](util[_0x214b('0x27')](_0x214b('0x3f'),_0x49aef2,_0x3d0540,_0x1b36be));};AGIChannel[_0x214b('0x20')][_0x214b('0x40')]=function(_0x4f06cc){return this[_0x214b('0x21')](util['format']('GET\x20VARIABLE\x20\x22%s\x22',_0x4f06cc));};AGIChannel[_0x214b('0x20')][_0x214b('0x41')]=function(_0x451ed0,_0x3457a1,_0x3162a6,_0x33f2e2,_0x565e0a,_0x48c54f){_0x3457a1=_0x3457a1||_0x214b('0x42');_0x3162a6=_0x3162a6||'';_0x33f2e2=_0x33f2e2===undefined?-0x1:_0x33f2e2==='-1'?-0x1:_0x33f2e2*0x3e8;_0x565e0a=_0x565e0a===undefined?'':'s='+_0x565e0a;_0x48c54f=_0x48c54f?_0x214b('0x43'):'';return this[_0x214b('0x21')](util[_0x214b('0x27')](_0x214b('0x44'),_0x451ed0,_0x3457a1,_0x3162a6,_0x33f2e2,_0x48c54f,_0x565e0a));};AGIChannel[_0x214b('0x20')][_0x214b('0x45')]=function(_0xfe3a26,_0x2ffec0){_0x2ffec0=_0x2ffec0||'';return this[_0x214b('0x21')](util[_0x214b('0x27')](_0x214b('0x46'),_0xfe3a26,_0x2ffec0));};AGIChannel['prototype'][_0x214b('0x47')]=function(_0x282cce){return this['exec']('AGI',_0x282cce);};AGIChannel[_0x214b('0x20')]['wait']=function(_0xaab10f){return this['exec'](_0x214b('0x48'),_0xaab10f);};AGIChannel[_0x214b('0x20')][_0x214b('0x16')]=function(_0x22e38c,_0x47ff5d){this[_0x214b('0x28')](util[_0x214b('0x27')](_0x214b('0x49'),_0x22e38c['id'],_0x22e38c[_0x214b('0x4a')],_0x47ff5d));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index ec4723b..0857be8 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 _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 +var _0xfb18=['Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','format','apply','message','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.'];(function(_0x42184d,_0x264f92){var _0x144722=function(_0x4926d8){while(--_0x4926d8){_0x42184d['push'](_0x42184d['shift']());}};_0x144722(++_0x264f92);}(_0xfb18,0xf7));var _0x8fb1=function(_0x6f1a87,_0x5d5bcf){_0x6f1a87=_0x6f1a87-0x0;var _0x2495c7=_0xfb18[_0x6f1a87];return _0x2495c7;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x8fb1('0x0'),'E_AGI_ARGUMENT_PORT':_0x8fb1('0x1'),'E_AGI_SERVER_ERROR':_0x8fb1('0x2'),'E_AGI_SERVER_CLOSE':_0x8fb1('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x8fb1('0x4'),'E_AGI_SOCKET_CLOSE':_0x8fb1('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x8fb1('0x6'),'E_AGI_COMMAND_EMPTY':_0x8fb1('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x8fb1('0x8')};function AGIError(_0x3811db){var _0x3811db=_0x3811db||null,_0x279514=_0x279514||[],_0x173afe=0x1,_0x12a6f3='';if(!error[_0x3811db]){_0x3811db=_0x8fb1('0x9');}_0x279514['push'](error[_0x3811db]);while(arguments[_0x173afe]){_0x279514['push'](arguments[_0x173afe]);_0x173afe++;}_0x12a6f3=util[_0x8fb1('0xa')][_0x8fb1('0xb')](util,_0x279514);this[_0x8fb1('0xc')]=_0x12a6f3;this[_0x8fb1('0xd')]=_0x3811db;}module[_0x8fb1('0xe')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 593aa4b..cf9c9fa 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 _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 +var _0x54ae=['projectUpdate','E_AGI_SERVER_ERROR','lodash','EventEmitter','ioredis','../../config/environment','defaults','localhost','subscribe','emit','error','message','parse'];(function(_0x3fa2c6,_0xe09fe1){var _0x4a2f3b=function(_0x4de419){while(--_0x4de419){_0x3fa2c6['push'](_0x3fa2c6['shift']());}};_0x4a2f3b(++_0xe09fe1);}(_0x54ae,0x1bc));var _0xe54a=function(_0x5ebc04,_0x14a363){_0x5ebc04=_0x5ebc04-0x0;var _0x17845c=_0x54ae[_0x5ebc04];return _0x17845c;};'use strict';var _=require(_0xe54a('0x0'));var EventEmitter=require('events')[_0xe54a('0x1')];var Redis=require(_0xe54a('0x2'));var AGIError=require('./error');var config=require(_0xe54a('0x3'));config['redis']=_[_0xe54a('0x4')](config['redis'],{'host':_0xe54a('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0xe54a('0x6')]('agi',function(_0xe1edf2){if(_0xe1edf2)return eventEmitter[_0xe54a('0x7')](_0xe54a('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0xe1edf2));});sub['on'](_0xe54a('0x9'),function(_0x5bb77b,_0x56bc6e){if(_0x5bb77b!=='agi')return;try{var _0x453052=JSON[_0xe54a('0xa')](_0x56bc6e);eventEmitter['emit'](_0xe54a('0xb'),_0x453052);}catch(_0x2f13ce){eventEmitter['emit'](_0xe54a('0x8'),new AGIError(_0xe54a('0xc'),_0x2f13ce));}});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 6a41c61..d6a09ab 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 _0xeeb6=['relations','getVertex','traverseBFS','info','stop\x20traverse','length','condition','agicommand','vswitch','default','target','invalid','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','numberOfEdges','prototype','addVertex','edges','push','size'];(function(_0x347c3e,_0x19727c){var _0x432b42=function(_0xd5f123){while(--_0xd5f123){_0x347c3e['push'](_0x347c3e['shift']());}};_0x432b42(++_0x19727c);}(_0xeeb6,0x1eb));var _0x6eeb=function(_0x70588,_0x2e21dd){_0x70588=_0x70588-0x0;var _0x1981d8=_0xeeb6[_0x70588];return _0x1981d8;};'use strict';var _=require(_0x6eeb('0x0'));var logger=require(_0x6eeb('0x1'))(_0x6eeb('0x2'));var verticesWithRetry=[_0x6eeb('0x3'),_0x6eeb('0x4'),_0x6eeb('0x5')];var Graph=function(){this[_0x6eeb('0x6')]={};this['edges']={};this[_0x6eeb('0x7')]=0x0;};Graph[_0x6eeb('0x8')][_0x6eeb('0x9')]=function(_0x269e0f){this[_0x6eeb('0x6')][_0x269e0f['id']]=_0x269e0f;this[_0x6eeb('0xa')][_0x269e0f['id']]=[];};Graph[_0x6eeb('0x8')]['addEdge']=function(_0x58bf65,_0x5bd6e9,_0x1bda57){this[_0x6eeb('0xa')][_0x58bf65][_0x6eeb('0xb')]({'target':_0x5bd6e9,'condition':_0x1bda57});this[_0x6eeb('0x7')]+=0x1;};Graph['prototype'][_0x6eeb('0xc')]=function(){return _[_0x6eeb('0xc')](this[_0x6eeb('0x6')]);};Graph[_0x6eeb('0x8')][_0x6eeb('0xd')]=function(){return this[_0x6eeb('0x7')];};Graph[_0x6eeb('0x8')][_0x6eeb('0xe')]=function(_0x53e448){return this[_0x6eeb('0x6')][_0x53e448];};Graph[_0x6eeb('0x8')][_0x6eeb('0xf')]=function(_0x194169,_0x4572b1){if(!this[_0x6eeb('0x6')][_0x194169]){return logger[_0x6eeb('0x10')]('no\x20vertex\x20found');}var _0x4fd642=_0x4572b1(this[_0x6eeb('0x6')][_0x194169]);if(!_0x4fd642){return logger[_0x6eeb('0x10')](_0x6eeb('0x11'));}if(this[_0x6eeb('0xa')][_0x194169][_0x6eeb('0x12')]===0x0){return logger[_0x6eeb('0x10')]('no\x20edge/s\x20available');}for(var _0x1c6d52=0x0,_0x4fcb59=[],_0x17006d=![];_0x1c6d52\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 +var _0x9f3d=['callysquare','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','./server','listening','connection','lodash','../../config/environment','../../config/logger','../../config/license/util','./project','EventEmitter','defaults','agi','127.0.0.1','projectUpdate','nextTick','error','stack','findIndex','deleted','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','indexOf','agi_','substring','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','handleNotFound','production','handleUnpublished','initialize','voice'];(function(_0x1f6952,_0x54ee78){var _0x2e59ee=function(_0x398e0a){while(--_0x398e0a){_0x1f6952['push'](_0x1f6952['shift']());}};_0x2e59ee(++_0x54ee78);}(_0x9f3d,0x124));var _0xd9f3=function(_0x51c513,_0x39e49b){_0x51c513=_0x51c513-0x0;var _0x476a7c=_0x9f3d[_0x51c513];return _0x476a7c;};'use strict';var _=require(_0xd9f3('0x0'));var syncho=require('syncho');var util=require('util');var config=require(_0xd9f3('0x1'));var logger=require(_0xd9f3('0x2'))('agi');var utilLicense=require(_0xd9f3('0x3'));var rpc=require('./rpc');var Project=require(_0xd9f3('0x4'));var AGIEmitter=require('./events')[_0xd9f3('0x5')];var projects=[];config['agi']=_[_0xd9f3('0x6')](config[_0xd9f3('0x7')],{'ip':_0xd9f3('0x8'),'port':0x11dd});AGIEmitter['on'](_0xd9f3('0x9'),projectUpdateHandler);function connectionHandler(_0x4211dc){process[_0xd9f3('0xa')](function(){syncho(function(){try{setChannelVariables(_0x4211dc);agiHandler(_0x4211dc);}catch(_0x8f8659){logger[_0xd9f3('0xb')](_0x8f8659[_0xd9f3('0xc')]);}});});}function projectUpdateHandler(_0x2dd94f){try{var _0x48c1c9=_[_0xd9f3('0xd')](projects,['id',_0x2dd94f['id']]);if(_0x48c1c9>-0x1){if(_0x2dd94f[_0xd9f3('0xe')]===!![]){projects['splice'](_0x48c1c9,0x1);}else{projects[_0x48c1c9]=_0x2dd94f;}}else{projects[_0xd9f3('0xf')](_0x2dd94f);}}catch(_0x2859f2){logger[_0xd9f3('0xb')](_0x2859f2[_0xd9f3('0xc')]);}}function listeningHandler(){console[_0xd9f3('0x10')](_0xd9f3('0x11'),config[_0xd9f3('0x7')][_0xd9f3('0x12')]);logger[_0xd9f3('0x13')](util[_0xd9f3('0x14')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config['agi']['ip'],config[_0xd9f3('0x7')]['port']));}function errorHandler(_0x14168b){if(_0x14168b&&_0x14168b[_0xd9f3('0x15')]&&_0x14168b[_0xd9f3('0x16')]){logger['error'](util[_0xd9f3('0x14')](_0xd9f3('0x17'),_0x14168b['name'],_0x14168b['message']));}else{logger[_0xd9f3('0xb')](util['format'](_0xd9f3('0x18'),_0x14168b[_0xd9f3('0xc')]));}}function closeHandler(){logger[_0xd9f3('0x13')](util['format'](_0xd9f3('0x19'),this['arg_1'],this[_0xd9f3('0x1a')],this[_0xd9f3('0x1b')],this[_0xd9f3('0x1c')],this[_0xd9f3('0x1d')]));try{createSquareReport(this);}catch(_0x46b98b){logger['error'](_0x46b98b[_0xd9f3('0xc')]);}}function timeoutHandler(){logger['info'](util[_0xd9f3('0x14')](_0xd9f3('0x1e'),this[_0xd9f3('0x1f')],this[_0xd9f3('0x1a')],this[_0xd9f3('0x1b')],this['dnid'],this[_0xd9f3('0x1d')]));}function hangupHandler(){logger[_0xd9f3('0x13')](util['format'](_0xd9f3('0x20'),this['arg_1'],this[_0xd9f3('0x1a')],this['callerid'],this['dnid'],this[_0xd9f3('0x1d')]));this[_0xd9f3('0x21')]=!![];}function createSquareReport(_0x58f3d8,_0x508efb){rpc[_0xd9f3('0x22')](_0x58f3d8)[_0xd9f3('0x23')](function(_0x4ce91d){if(_0x508efb){_0x508efb(null,_0x4ce91d);}})[_0xd9f3('0x24')](function(_0x1745f4){if(_0x508efb){_0x508efb(null,_0x1745f4);}});}function setChannelVariables(_0x41b22b){for(var _0x5ea94c in _0x41b22b){if(_0x41b22b['hasOwnProperty'](_0x5ea94c)){if(_0x5ea94c[_0xd9f3('0x25')](_0xd9f3('0x26'))===0x0){_0x41b22b[_0x5ea94c[_0xd9f3('0x27')](0x4)]=_0x41b22b[_0x5ea94c];delete _0x41b22b[_0x5ea94c];}}}}function agiHandler(_0x2753ef){logger[_0xd9f3('0x28')](_0xd9f3('0x29'),JSON['stringify'](_0x2753ef,null,0x2));logger[_0xd9f3('0x13')](util[_0xd9f3('0x14')](_0xd9f3('0x2a'),_0x2753ef[_0xd9f3('0x1f')],_0x2753ef['calleridname'],_0x2753ef['callerid'],_0x2753ef['dnid'],_0x2753ef['uniqueid']));_0x2753ef['on'](_0xd9f3('0xb'),errorHandler);_0x2753ef['on'](_0xd9f3('0x2b'),closeHandler);_0x2753ef['on'](_0xd9f3('0x2c'),timeoutHandler);_0x2753ef['evtHangup']=![];_0x2753ef['on']('hangup',hangupHandler);var _0x36de6b=_['find'](projects,[_0xd9f3('0x15'),_0x2753ef[_0xd9f3('0x1f')]]);if(!_0x36de6b)return Project[_0xd9f3('0x2d')](_0x2753ef);if(!_0x36de6b[_0xd9f3('0x2e')])return Project[_0xd9f3('0x2f')](_0x2753ef);return Project[_0xd9f3('0x30')](_0x36de6b,_0x2753ef);}function main(){var _0x4411eb;return utilLicense['getLicense']()[_0xd9f3('0x23')](function(_0x58323e){if(!_0x58323e)return;if(_0x58323e[_0xd9f3('0x31')]){if(_0x58323e['callysquare']&&_0x58323e['callysquare']>0x0){logger[_0xd9f3('0x13')](util[_0xd9f3('0x14')]('[LICENSE]\x20CHANNELS:\x20%s',_0x58323e[_0xd9f3('0x32')]));_0x4411eb=_0x58323e[_0xd9f3('0x32')];}else{logger[_0xd9f3('0x13')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xd9f3('0x13')](_0xd9f3('0x33'));_0x4411eb=-0x1;}})[_0xd9f3('0x23')](function(){return Project[_0xd9f3('0x34')]();})['then'](function(_0x2a98ff){projects=_0x2a98ff;return;})[_0xd9f3('0x24')](function(_0x29c4bd){logger[_0xd9f3('0xb')](_0xd9f3('0x35'),_0x29c4bd[_0xd9f3('0xc')]);})['finally'](function(){var _0x40614f=require(_0xd9f3('0x36'))(config[_0xd9f3('0x7')][_0xd9f3('0x12')],config['agi']['ip'],_0x4411eb);_0x40614f['on'](_0xd9f3('0xb'),errorHandler);_0x40614f['on'](_0xd9f3('0x37'),listeningHandler);_0x40614f['on'](_0xd9f3('0x38'),connectionHandler);_0x40614f['on'](_0xd9f3('0x2b'),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 b64b514..957538c 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 _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 +var _0xb1b0=['request','then','error','message','result','catch','sendMailMessage','SendMail','jayson/promise','client','http'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb1b0,0x1cb));var _0x0b1b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb1b0[_0x57b54c];return _0x59cc19;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x0b1b('0x0'));var client=jayson[_0x0b1b('0x1')][_0x0b1b('0x2')]({'port':0x232b});function request(_0x58b8b0,_0x3fd938){return new BPromise(function(_0x51c141,_0x1541a9){return client[_0x0b1b('0x3')](_0x58b8b0,_0x3fd938)[_0x0b1b('0x4')](function(_0x32f3ff){if(_0x32f3ff[_0x0b1b('0x5')]){return _0x1541a9(_0x32f3ff[_0x0b1b('0x5')][_0x0b1b('0x6')]);}else{return _0x51c141(_0x32f3ff[_0x0b1b('0x7')]);}})[_0x0b1b('0x8')](function(_0x224a62){return _0x1541a9(_0x224a62);});});}exports[_0x0b1b('0x9')]=function(_0x5889d6,_0x2e914a){return request(_0x0b1b('0xa'),{'account':_0x5889d6,'message':_0x2e914a});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index f80bbd0..6063761 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 _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 +var _0x304d=['agicommand','hasOwnProperty','retry','maxRetry','addVertex','mxCell','length','source','target','addEdge','toJson','root','inspect','start','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined','error','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','vertex','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','exports','lodash','moment','xml2json','util','agi','./graph','./vertices','getSquareProjects','catch','Unable\x20to\x20download\x20CallySquare\x20projects','stack'];(function(_0x46fca9,_0x5e6e9e){var _0x40327a=function(_0x2582f6){while(--_0x2582f6){_0x46fca9['push'](_0x46fca9['shift']());}};_0x40327a(++_0x5e6e9e);}(_0x304d,0x121));var _0xd304=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x304d[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xd304('0x0'));var moment=require(_0xd304('0x1'));var parser=require(_0xd304('0x2'));var util=require(_0xd304('0x3'));var logger=require('../../config/logger')(_0xd304('0x4'));var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require(_0xd304('0x5'));var Vertices=require(_0xd304('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xd304('0x7')]()[_0xd304('0x8')](function(_0x3b1df9){logger['error'](_0xd304('0x9'),_0x3b1df9[_0xd304('0xa')]);return[];});}function addVertex(_0x4b956,_0x32ce0b,_0x44be28){_0x32ce0b[_0xd304('0xb')]=_0x44be28;if(_0x32ce0b[_0xd304('0xc')](_0xd304('0xd'))){_0x32ce0b[_0xd304('0xe')]=parseInt(_0x32ce0b[_0xd304('0xd')],0xa);}_0x4b956[_0xd304('0xf')](_['omit'](_0x32ce0b,_0xd304('0x10')));}function initGraph(_0x4968de,_0x3ad8e6){var _0x2002b0=new Graph();for(var _0x438303 in _0x4968de){if(_0x4968de['hasOwnProperty'](_0x438303)){if(_['isArray'](_0x4968de[_0x438303])){for(var _0x82b2a1=0x0;_0x82b2a1<_0x4968de[_0x438303][_0xd304('0x11')];_0x82b2a1+=0x1){addVertex(_0x2002b0,_0x4968de[_0x438303][_0x82b2a1],_0x438303);}}else{addVertex(_0x2002b0,_0x4968de[_0x438303],_0x438303);}}}for(var _0x57ce35=0x0;_0x57ce35<_0x3ad8e6[_0xd304('0x11')];_0x57ce35+=0x1){if(_0x3ad8e6[_0x57ce35][_0xd304('0x12')]&&_0x3ad8e6[_0x57ce35][_0xd304('0x13')]){_0x2002b0[_0xd304('0x14')](_0x3ad8e6[_0x57ce35]['source'],_0x3ad8e6[_0x57ce35]['target'],_0x3ad8e6[_0x57ce35]['value']);}}return _0x2002b0;}function getRoot(_0x1aa55a){return parser[_0xd304('0x15')](_0x1aa55a,{'object':!![]})['mxGraphModel'][_0xd304('0x16')];}function inspect(_0x237d29){return util[_0xd304('0x17')](_0x237d29,{'showHidden':![],'depth':null});}function initialize(_0x12fe57,_0xa7482e){var _0x182075=getRoot(_0x12fe57['production']);if(!_0x182075||!_0x182075[_0xd304('0x18')])return;var _0x493214,_0x2c309c,_0x4a7e8e;logger[_0xd304('0x19')](_0xd304('0x16'),JSON[_0xd304('0x1a')](_0x182075,null,0x2));_0xa7482e[_0xd304('0x1b')]=moment()[_0xd304('0x1c')](_0xd304('0x1d'));_0x493214=initGraph(_['omit'](_0x182075,_0xd304('0x10')),_0x182075['mxCell']);_0x2c309c=new Vertices(_0xa7482e,rpc,mailRpc);logger[_0xd304('0x1e')](util[_0xd304('0x1c')](_0xd304('0x1f'),_0xa7482e[_0xd304('0x20')],_0xa7482e[_0xd304('0x21')],_0xa7482e[_0xd304('0x22')],_0xa7482e[_0xd304('0x23')],_0xa7482e[_0xd304('0x24')]));_0x493214[_0xd304('0x25')](_0x182075[_0xd304('0x18')]['id'],function(_0x5c91a6){try{_0x5c91a6=_0x2c309c[_0xd304('0x26')](_0x5c91a6);logger['debug']('vertex',JSON[_0xd304('0x1a')](_0x5c91a6,null,0x2));if(_0x5c91a6[_0xd304('0xb')]==='gotoc'){logger[_0xd304('0x1e')](_0xd304('0x27'));_0xa7482e[_0xd304('0x28')]=_0x5c91a6[_0xd304('0x28')]||_0xa7482e[_0xd304('0x28')];_0xa7482e[_0xd304('0x29')]=_0x5c91a6['extension'];_0xa7482e[_0xd304('0x2a')]=_0x5c91a6[_0xd304('0x2a')]?_0x5c91a6[_0xd304('0x2a')]-0x1:0x1;return null;}else if(_0x5c91a6&&_0x2c309c[_0x5c91a6[_0xd304('0xb')]]){_0x4a7e8e=_0x2c309c[_0x5c91a6[_0xd304('0xb')]](_0x5c91a6);logger[_0xd304('0x1e')](_0xd304('0x2b'),JSON['stringify'](_0x4a7e8e,null,0x2));if(_0x4a7e8e&&_0x4a7e8e[_0xd304('0x2c')]===AGI_CODE_SUCCESS&&_0x4a7e8e[_0xd304('0x2d')]!==AGI_RESULT_ERROR&&!_0xa7482e[_0xd304('0x2e')]){logger[_0xd304('0x19')]('response',inspect(_0x4a7e8e));return _[_0xd304('0x2f')](_0x4a7e8e[_0xd304('0x2d')])?null:_0x4a7e8e[_0xd304('0x2d')]['toString']();}else{logger['error'](_0xd304('0x2b'),inspect(_0x4a7e8e));return null;}}else{logger[_0xd304('0x30')](_0xd304('0x31'));return null;}}catch(_0x3d02de){logger[_0xd304('0x30')](_0x3d02de[_0xd304('0xa')]);return null;}});if(_0x182075[_0xd304('0x32')]){logger['info'](util['format'](_0xd304('0x33'),_0xa7482e[_0xd304('0x20')],_0xa7482e[_0xd304('0x21')],_0xa7482e[_0xd304('0x22')],_0xa7482e[_0xd304('0x23')],_0xa7482e['uniqueid']));_0x493214[_0xd304('0x25')](_0x182075[_0xd304('0x32')]['id'],function(_0x46e0c6){try{_0x46e0c6=_0x2c309c[_0xd304('0x26')](_0x46e0c6);logger[_0xd304('0x19')](_0xd304('0x34'),JSON[_0xd304('0x1a')](_0x46e0c6,null,0x2));if(_0x46e0c6&&_0x2c309c[_0x46e0c6[_0xd304('0xb')]]){_0x4a7e8e=_0x2c309c[_0x46e0c6[_0xd304('0xb')]](_0x46e0c6);if(_0x4a7e8e){logger[_0xd304('0x19')](_0xd304('0x2b'),inspect(_0x4a7e8e));return _[_0xd304('0x2f')](_0x4a7e8e[_0xd304('0x2d')])?null:_0x4a7e8e['result'][_0xd304('0x35')]();}else{logger[_0xd304('0x30')](_0xd304('0x2b'),inspect(_0x4a7e8e));return null;}}else{logger[_0xd304('0x30')](_0xd304('0x31'));return null;}}catch(_0x2f8e7c){logger[_0xd304('0x30')](_0x2f8e7c[_0xd304('0xa')]);return null;}});}logger[_0xd304('0x1e')](util[_0xd304('0x1c')](_0xd304('0x36'),_0xa7482e['arg_1'],_0xa7482e[_0xd304('0x21')],_0xa7482e[_0xd304('0x22')],_0xa7482e[_0xd304('0x23')],_0xa7482e[_0xd304('0x24')]));logger['info'](util[_0xd304('0x1c')](_0xd304('0x37'),_0xa7482e['context'],_0xa7482e[_0xd304('0x29')],parseInt(_0xa7482e[_0xd304('0x2a')],0xa)+0x1));_0xa7482e[_0xd304('0x38')](_0xa7482e[_0xd304('0x28')],_0xa7482e['extension'],parseInt(_0xa7482e[_0xd304('0x2a')],0xa)+0x1);_0xa7482e[_0xd304('0x39')]();}function handleNotFound(_0x4ab210){logger[_0xd304('0x30')](util[_0xd304('0x1c')](_0xd304('0x3a'),_0x4ab210['arg_1']));_0x4ab210['continueAt'](_0x4ab210[_0xd304('0x28')],_0x4ab210['extension'],parseInt(_0x4ab210[_0xd304('0x2a')],0xa)+0x1);_0x4ab210[_0xd304('0x39')]();}function handleUnpublished(_0x1a4699){logger[_0xd304('0x30')](util[_0xd304('0x1c')]('Project\x20%s\x20not\x20published',_0x1a4699['arg_1']));_0x1a4699['continueAt'](_0x1a4699[_0xd304('0x28')],_0x1a4699['extension'],parseInt(_0x1a4699['priority'],0xa)+0x1);_0x1a4699[_0xd304('0x39')]();}module[_0xd304('0x3b')]={'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 83836e7..d9ea652 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 _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 +var _0x417f=['indexOf','substring','length','slice','trim','headers','emit','line','exports','stream','call','_localBuffer','_inBody','inherits','prototype','\x0d\x0a\x0d\x0a','toString'];(function(_0x1adab0,_0x4da95){var _0x4320b8=function(_0x4757a0){while(--_0x4757a0){_0x1adab0['push'](_0x1adab0['shift']());}};_0x4320b8(++_0x4da95);}(_0x417f,0x91));var _0xf417=function(_0x486fe0,_0x2ee124){_0x486fe0=_0x486fe0-0x0;var _0x5c7539=_0x417f[_0x486fe0];return _0x5c7539;};'use strict';var util=require('util');var Transform=require(_0xf417('0x0'))['Transform'];function AGIReply(_0x4d3b76){Transform[_0xf417('0x1')](this,_0x4d3b76);this[_0xf417('0x2')]='';this[_0xf417('0x3')]=![];}util[_0xf417('0x4')](AGIReply,Transform);AGIReply[_0xf417('0x5')]['_transform']=function(_0x58da0a,_0x4b42d2,_0x4b920a){var _0x389e25='\x0a',_0x4f9722=['\x0a\x0a',_0xf417('0x6')],_0x3a3cb3=-0x1,_0xf67ea4=-0x1,_0x3d9fd5='',_0x3f3396=0x0,_0x315f8a='',_0x2378c2='';this[_0xf417('0x2')]+=_0x58da0a[_0xf417('0x7')]();_0x315f8a=this[_0xf417('0x2')];if(!this[_0xf417('0x3')]){_0x3f3396=0x0;while(_0x4f9722[_0x3f3396]){while((_0xf67ea4=_0x315f8a[_0xf417('0x8')](_0x4f9722[_0x3f3396]))!=-0x1){_0x3d9fd5=_0x4f9722[_0x3f3396];_0x2378c2=_0x315f8a[_0xf417('0x9')](0x0,_0xf67ea4);_0x315f8a=_0x315f8a[_0xf417('0x9')](_0xf67ea4+_0x3d9fd5[_0xf417('0xa')]);var _0xca4a50=_0x2378c2['split'](_0x389e25),_0x23ffa1=0x0,_0x1ea4f7={},_0x39c65c='',_0x1f0300='',_0x2489ea=-0x1;while(_0xca4a50[_0x23ffa1]){_0x2489ea=_0xca4a50[_0x23ffa1][_0xf417('0x8')](':');if(_0x2489ea!=-0x1){_0x39c65c=_0xca4a50[_0x23ffa1][_0xf417('0xb')](0x0,_0x2489ea)[_0xf417('0xc')]();_0x1f0300=_0xca4a50[_0x23ffa1][_0xf417('0xb')](_0x2489ea+0x1)[_0xf417('0xc')]();if(_0x39c65c['length']>0x0){_0x1ea4f7[_0x39c65c]=_0x1f0300;}}else{}_0x23ffa1++;}this['emit'](_0xf417('0xd'),_0x1ea4f7);this['_inBody']=!![];}_0x3f3396++;}this[_0xf417('0x2')]=_0x315f8a;}else{while((_0x3a3cb3=_0x315f8a[_0xf417('0x8')](_0x389e25))!=-0x1){_0x2378c2=_0x315f8a['substring'](0x0,_0x3a3cb3);this[_0xf417('0xe')](_0xf417('0xf'),_0x2378c2);_0x315f8a=_0x315f8a[_0xf417('0x9')](_0x3a3cb3+_0x389e25[_0xf417('0xa')]);}this[_0xf417('0x2')]=_0x315f8a;}_0x4b920a();};module[_0xf417('0x10')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index ffcf0bc..6526cc2 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 _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 +var _0x34e5=['CloudProvider','name','email','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','dsn','getUserById','ShowUser','getContactByPhone','phone','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','merge','arg_1','arg_2','format','createSquareRecording','createCmContact','ShowCmHopper','ListId','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','moment','client','http','request','then','error','message','result','getSquareProjects','GetSquareProjects','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','Smtp'];(function(_0x4189cf,_0x33d5b9){var _0xe9b93d=function(_0x1717e7){while(--_0x1717e7){_0x4189cf['push'](_0x4189cf['shift']());}};_0xe9b93d(++_0x33d5b9);}(_0x34e5,0x172));var _0x534e=function(_0x424ffd,_0x3ad04d){_0x424ffd=_0x424ffd-0x0;var _0x5e0e89=_0x34e5[_0x424ffd];return _0x5e0e89;};'use strict';var _=require('lodash');var moment=require(_0x534e('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x534e('0x1')][_0x534e('0x2')]({'port':0x2329});function request(_0x425ae8,_0x246650){return new Promise(function(_0x83eb2d,_0x50b790){return client[_0x534e('0x3')](_0x425ae8,_0x246650)[_0x534e('0x4')](function(_0x3c772f){if(_0x3c772f[_0x534e('0x5')]){return _0x50b790(_0x3c772f[_0x534e('0x5')][_0x534e('0x6')]);}else{return _0x83eb2d(_0x3c772f[_0x534e('0x7')]);}})['catch'](function(_0x24d562){return _0x50b790(_0x24d562);});});}exports[_0x534e('0x8')]=function(){return request(_0x534e('0x9'),{'options':{'raw':![],'attributes':['id','name','production']}});};exports[_0x534e('0xa')]=function(_0x4c495c){return request(_0x534e('0xb'),{'options':{'raw':![],'where':{'name':_0x4c495c},'attributes':['production']}});};exports[_0x534e('0xc')]=function(_0x310b6d){return request(_0x534e('0xd'),{'options':{'raw':![],'where':{'id':_0x310b6d},'include':[{'model':'MailServerOut','as':_0x534e('0xe'),'include':[{'model':_0x534e('0xf'),'as':_0x534e('0xf')}]}],'attributes':['id',_0x534e('0x10'),_0x534e('0x11')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x31d764){return request(_0x534e('0xb'),{'options':{'where':{'id':_0x31d764},'attributes':[_0x534e('0x10')]}});};exports[_0x534e('0x12')]=function(_0x359565){return request(_0x534e('0x13'),{'options':{'where':{'id':_0x359565},'attributes':[_0x534e('0x10')]}});};exports[_0x534e('0x14')]=function(_0x536c9e){return request('ShowVariable',{'options':{'where':{'id':_0x536c9e},'attributes':[_0x534e('0x10')]}});};exports[_0x534e('0x15')]=function(_0x5bdae2){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x5bdae2},'attributes':[_0x534e('0x16')]}});};exports[_0x534e('0x17')]=function(_0x9297b6){return request(_0x534e('0x18'),{'options':{'where':{'id':_0x9297b6},'attributes':[_0x534e('0x10')]}});};exports[_0x534e('0x19')]=function(_0x100751){return request('GetContactByPhone',{'options':{'where':{'phone':_0x100751[_0x534e('0x1a')]},'attributes':['id']}});};exports[_0x534e('0x1b')]=function(_0x466d74){return request(_0x534e('0x1c'),{'options':{'where':{'id':_0x466d74},'attributes':[_0x534e('0x10')]}});};exports['getSoundById']=function(_0x3f1697){return request(_0x534e('0x1d'),{'options':{'where':{'id':_0x3f1697},'attributes':[_0x534e('0x1e')]}});};exports[_0x534e('0x1f')]=function(_0x4724f9){return request(_0x534e('0x20'),{'options':{'raw':![],'where':{'id':_0x4724f9},'include':[{'model':_0x534e('0x21'),'as':_0x534e('0x22')}]}});};exports[_0x534e('0x23')]=function(_0x5e086a){return request(_0x534e('0x24'),{'options':{'where':{'id':_0x5e086a},'attributes':['id',_0x534e('0x10')]}});};exports[_0x534e('0x25')]=function(_0x4a09ed){return request(_0x534e('0x26'),{'body':_0x4a09ed});};exports[_0x534e('0x27')]=function(_0xf60d40){return request(_0x534e('0x28'),{'body':_0xf60d40});};exports['createSquareReport']=function(_0x42beee){return request('CreateSquareReport',{'body':_[_0x534e('0x29')](_0x42beee,{'project_name':_0x42beee[_0x534e('0x2a')],'prev_project_name':_0x42beee[_0x534e('0x2b')]||'','is_subproject':_0x42beee[_0x534e('0x2b')]?!![]:![],'leaveAt':moment()[_0x534e('0x2c')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x534e('0x2d')]=function(_0x443f85){return request('CreateSquareRecording',{'body':_0x443f85});};exports['createSquareMessage']=function(_0x3abacf){return request('CreateSquareMessage',{'body':_0x3abacf});};exports[_0x534e('0x2e')]=function(_0x3c5c11){return request(_0x534e('0x2f'),{'options':{'raw':![],'where':{'phone':_0x3c5c11[_0x534e('0x1a')],'ListId':_0x3c5c11[_0x534e('0x30')]}}})[_0x534e('0x4')](function(_0x5253b5){if(_0x5253b5){return _0x5253b5;}return request('CreateCmContact',{'body':_0x3c5c11});});};exports['getPauseById']=function(_0x32ae10){return request(_0x534e('0x31'),{'options':{'where':{'id':_0x32ae10},'attributes':[_0x534e('0x10')]}});};exports[_0x534e('0x32')]=function(_0x423502,_0x1efb5b){return request(_0x534e('0x33'),{'body':{'interface':_0x1efb5b},'options':{'where':_0x423502}});};exports[_0x534e('0x34')]=function(_0x533d62,_0x312744,_0x2867c9){return request(_0x534e('0x35'),{'body':{'type':_0x312744,'uniqueid':_0x2867c9},'options':{'where':_0x533d62}});};exports['agentUnpause']=function(_0x170ff6){return request(_0x534e('0x36'),{'body':{},'options':{'where':_0x170ff6}});};exports['agentLogout']=function(_0x2c01a0){return request('LogoutUser',{'body':{},'options':{'where':_0x2c01a0}});}; \ 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 5074c90..78bc215 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 _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 +var _0x5e8d=['./polly','./lex','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5e8d,0x11a));var _0xd5e8=function(_0x870f88,_0x3612ef){_0x870f88=_0x870f88-0x0;var _0x3d3ec9=_0x5e8d[_0x870f88];return _0x3d3ec9;};var polly=require(_0xd5e8('0x0'));var lex=require(_0xd5e8('0x1'));module[_0xd5e8('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index b1a1653..5c362ec 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 _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 +var _0x96cc=['./lib/api'];(function(_0x342d20,_0x28a8be){var _0x502ef7=function(_0x4b8868){while(--_0x4b8868){_0x342d20['push'](_0x342d20['shift']());}};_0x502ef7(++_0x28a8be);}(_0x96cc,0x16c));var _0xc96c=function(_0x37e85e,_0x5bc431){_0x37e85e=_0x37e85e-0x0;var _0x160915=_0x96cc[_0x37e85e];return _0x160915;};'use strict';var lex=require(_0xc96c('0x0'));module['exports']=function(_0x15025f,_0x5f11f2,_0x30bf8a,_0x3e7a95,_0x107043,_0x421701){return lex(_0x15025f,_0x5f11f2,_0x30bf8a,_0x3e7a95,_0x107043,_0x421701);}; \ 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 d07f947..a907e33 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(_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 +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x2ddd31,_0x31f22d){var _0x414fb6=function(_0x122ee9){while(--_0x122ee9){_0x2ddd31['push'](_0x2ddd31['shift']());}};_0x414fb6(++_0x31f22d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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 2ecafb2..79e0d1f 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. * // * * // ************************************************************************* -'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 +var _0x9d0a=['./lib/api','exports'];(function(_0x516e99,_0x509258){var _0x5802f4=function(_0x11f8fe){while(--_0x11f8fe){_0x516e99['push'](_0x516e99['shift']());}};_0x5802f4(++_0x509258);}(_0x9d0a,0x114));var _0xa9d0=function(_0x18ae8f,_0x25f684){_0x18ae8f=_0x18ae8f-0x0;var _0x43e219=_0x9d0a[_0x18ae8f];return _0x43e219;};'use strict';var polly=require(_0xa9d0('0x0'));module[_0xa9d0('0x1')]=function(_0x2641bd,_0x41b9ef,_0x4f70df,_0x2bd438,_0x373172,_0x1ab37e,_0xbf7efd){return polly(_0x2641bd,_0x41b9ef,_0x4f70df,_0x2bd438,_0x373172,_0x1ab37e,_0xbf7efd);}; \ 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 cf9d5b1..553454f 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 _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 +var _0xa82c=['path','bluebird','randomstring','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','mp3'];(function(_0x4e8286,_0x4eaeb4){var _0x44a440=function(_0x5e0907){while(--_0x5e0907){_0x4e8286['push'](_0x4e8286['shift']());}};_0x44a440(++_0x4eaeb4);}(_0xa82c,0x1b9));var _0xca82=function(_0x2fc5a3,_0x54973f){_0x2fc5a3=_0x2fc5a3-0x0;var _0x12302b=_0xa82c[_0x2fc5a3];return _0x12302b;};'use strict';var fs=require('fs');var path=require(_0xca82('0x0'));var BPromise=require(_0xca82('0x1'));var rs=require(_0xca82('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x2143f2,_0x1c2404,_0x4d23cd){return new BPromise(function(_0x31f13c,_0x352bcb){_0x2143f2[_0xca82('0x3')](_0x1c2404,function(_0x266084,_0xe503c9){if(_0x266084){_0x352bcb(_0x266084);}else if(_0xe503c9){if(_0xe503c9[_0xca82('0x4')]instanceof Buffer){fs['writeFile'](_0x4d23cd,_0xe503c9[_0xca82('0x4')],function(_0x2ebbdd){if(_0x2ebbdd){_0x352bcb(_0x2ebbdd);}else{_0x31f13c();}});}else{_0x352bcb(new Error(_0xca82('0x5')));}}else{_0x352bcb(new Error(_0xca82('0x6')));}});});}module['exports']=function(_0xea0187,_0x5872e6,_0x1c311b,_0x4c6343,_0x2e4272,_0x1aebaf,_0x11c6de){var _0x1d378b=new AWS[(_0xca82('0x7'))]({'accessKeyId':_0xea0187,'secretAccessKey':_0x5872e6,'region':_0x1c311b});var _0x4fcfd0={'Text':_0x2e4272,'TextType':_0x1aebaf||'text','OutputFormat':_0xca82('0x8'),'VoiceId':_0x4c6343};return pollyResult(_0x1d378b,_0x4fcfd0,_0x11c6de);}; \ 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 daecd77..03b6761 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 _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 +var _0x1d84=['./lib/api','exports'];(function(_0xcd5a3d,_0x3c5b33){var _0xd43207=function(_0x17d976){while(--_0x17d976){_0xcd5a3d['push'](_0xcd5a3d['shift']());}};_0xd43207(++_0x3c5b33);}(_0x1d84,0xf4));var _0x41d8=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x1d84[_0x5f309e];return _0x487b5e;};'use strict';var asr=require(_0x41d8('0x0'));module[_0x41d8('0x1')]=function(_0x3a755a,_0x315312,_0x585877,_0x211be4){return asr(_0x3a755a,_0x315312,_0x585877);}; \ 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 679cc6e..de9266a 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 _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 +var _0xa7b4=['string','filepath\x20should\x20be\x20a\x20string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','LINEAR16','bluebird','https://speech.googleapis.com'];(function(_0x11bc49,_0x4d9761){var _0x23820f=function(_0x5a520f){while(--_0x5a520f){_0x11bc49['push'](_0x11bc49['shift']());}};_0x23820f(++_0x4d9761);}(_0xa7b4,0x8d));var _0x4a7b=function(_0x802fe1,_0x15435e){_0x802fe1=_0x802fe1-0x0;var _0x3f5fe1=_0xa7b4[_0x802fe1];return _0x3f5fe1;};'use strict';var url=require('url');var BPromise=require(_0x4a7b('0x0'));var fs=require('fs');var host=_0x4a7b('0x1');module['exports']=function(_0xb93675,_0x30092d,_0x56f161){return new BPromise(function(_0x5de6a2,_0x4cadbf){var _0x8c0229;if(typeof _0xb93675!==_0x4a7b('0x2')||_0xb93675['length']===0x0){return _0x4cadbf(_0x4a7b('0x3'));}if(typeof _0x30092d!==_0x4a7b('0x2')||_0x30092d[_0x4a7b('0x4')]===0x0){return _0x4cadbf(_0x4a7b('0x5'));}if(typeof _0x56f161!==_0x4a7b('0x6')&&(typeof _0x56f161!==_0x4a7b('0x2')||_0x56f161[_0x4a7b('0x4')]===0x0)){return _0x4cadbf(_0x4a7b('0x7'));}try{_0x8c0229=fs[_0x4a7b('0x8')](_0xb93675)[_0x4a7b('0x9')](_0x4a7b('0xa'));}catch(_0x3eb79b){return _0x4cadbf(_0x3eb79b);}return _0x5de6a2({'method':_0x4a7b('0xb'),'uri':host+'/v1/speech:recognize?key='+_0x30092d,'body':{'config':{'encoding':_0x4a7b('0xc'),'sampleRateHertz':'8000','languageCode':_0x56f161},'audio':{'content':_0x8c0229}},'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 5944f6d..b1af4c1 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 _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 +var _0x2705=['exports','./asr'];(function(_0x548657,_0x479937){var _0x8e3ae5=function(_0x552d84){while(--_0x552d84){_0x548657['push'](_0x548657['shift']());}};_0x8e3ae5(++_0x479937);}(_0x2705,0xf7));var _0x5270=function(_0x54098d,_0x37543e){_0x54098d=_0x54098d-0x0;var _0x5a7174=_0x2705[_0x54098d];return _0x5a7174;};var asr=require(_0x5270('0x0'));module[_0x5270('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 9cf2826..1845fe1 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 _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 +var _0x372b=['toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','writeFile','.wav','googleCloudTTS\x20path','split','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','slice','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','googleASR','asr','results','alternatives','transcript','confidence','join','googleASR\x20transcription','name','googleDialogflow','textRequest','source','resolvedQuery','result','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','length','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','apiai-promise','dialogflow','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','host','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','unlink','error','download\x20error','pipe','protocol','data','end','transcode','wav','error\x20convert','info','finish\x20to\x20convert','start','resolve','tmp','generate','writeFileSync','then','chmodSync','777','readFileSync'];(function(_0x11f731,_0x5e822e){var _0x3a9fb7=function(_0x14c1d0){while(--_0x14c1d0){_0x11f731['push'](_0x11f731['shift']());}};_0x3a9fb7(++_0x5e822e);}(_0x372b,0x1f3));var _0xb372=function(_0x4e7d41,_0x4b9296){_0x4e7d41=_0x4e7d41-0x0;var _0x1a9382=_0x372b[_0x4e7d41];return _0x1a9382;};'use strict';var apiai=require(_0xb372('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0xb372('0x1'));var fs=require('fs');var http=require('http');var https=require(_0xb372('0x2'));var md5=require(_0xb372('0x3'));var path=require(_0xb372('0x4'));var querystring=require(_0xb372('0x5'));var rp=require(_0xb372('0x6'));var rs=require(_0xb372('0x7'));var sox=require(_0xb372('0x8'));var tts=require(_0xb372('0x9'));var urlParse=require(_0xb372('0xa'))[_0xb372('0xb')];var util=require('util');var aws=require(_0xb372('0xc'));var google=require(_0xb372('0xd'));var sestek=require(_0xb372('0xe'));var tilde=require(_0xb372('0xf'));var logger=require(_0xb372('0x10'))(_0xb372('0x11'));var ISPEECH_API=_0xb372('0x12');function downloadFile(_0x221c62,_0x47b715){return new BPromise(function(_0x15b86e,_0x69b271){var _0x5886b9=urlParse(_0x221c62);var _0x376b3b=_0x5886b9['protocol']===_0xb372('0x13')?https:http;var _0x387f3b={'host':_0x5886b9[_0xb372('0x14')],'path':_0x5886b9[_0xb372('0x4')],'headers':{'user-agent':_0xb372('0x15')}};_0x376b3b[_0xb372('0x16')](_0x387f3b,function(_0x5c0bb7){if(_0x5c0bb7[_0xb372('0x17')]!==0xc8){logger['error'](_0xb372('0x18')+_0x221c62+_0xb372('0x19')+_0x5c0bb7['statusCode']+'\x20('+_0x5c0bb7[_0xb372('0x1a')]+')');_0x69b271(new Error(_0xb372('0x18')+_0x221c62+_0xb372('0x19')+_0x5c0bb7['statusCode']+'\x20('+_0x5c0bb7[_0xb372('0x1a')]+')'));return;}var _0x2d8017=fs[_0xb372('0x1b')](_0x47b715);_0x2d8017['on']('finish',function(){logger['info']('finish\x20download\x20file');_0x2d8017['close'](_0x15b86e);});_0x2d8017['on']('error',function(_0xceb078){fs[_0xb372('0x1c')](_0x47b715);logger[_0xb372('0x1d')](_0xb372('0x1e'),_0xceb078);_0x69b271(_0xceb078);});_0x5c0bb7[_0xb372('0x1f')](_0x2d8017);})['on'](_0xb372('0x1d'),function(_0x563645){logger['error'](_0x563645);_0x69b271(_0x563645);})['end']();});}function uploadFile(_0x3cbdc4){return new BPromise(function(_0xc4373b,_0x422797){var _0x5512b9=urlParse(_0x3cbdc4);var _0x15be22=_0x5512b9[_0xb372('0x20')]===_0xb372('0x13')?https:http;var _0x1e12b4={'host':_0x5512b9[_0xb372('0x14')],'path':_0x5512b9['path'],'headers':{'user-agent':_0xb372('0x15')}};_0x15be22['get'](_0x1e12b4,function(_0x538587){if(_0x538587['statusCode']!==0xc8){_0x422797(new Error('request\x20to\x20'+_0x3cbdc4+'\x20failed,\x20status\x20code\x20=\x20'+_0x538587[_0xb372('0x17')]+'\x20('+_0x538587[_0xb372('0x1a')]+')'));return;}var _0x2fdcd5='';_0x538587['on'](_0xb372('0x21'),function(_0x5207c6){_0x2fdcd5+=_0x5207c6;});_0x538587['on'](_0xb372('0x22'),function(){_0xc4373b(_0x2fdcd5);});})['on']('error',function(_0x29c4be){_0x422797(_0x29c4be);})[_0xb372('0x22')]();});}function convertFile(_0x269240,_0x375e7a){return new BPromise(function(_0x2cb201,_0x3a7564){var _0x2e98d5=sox[_0xb372('0x23')](_0x269240,_0x375e7a,{'sampleRate':0x1f40,'format':_0xb372('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2e98d5['on'](_0xb372('0x1d'),function(_0x230914){logger[_0xb372('0x1d')](_0xb372('0x25'),_0x230914);_0x3a7564(_0x230914);});_0x2e98d5['on'](_0xb372('0x22'),function(){logger[_0xb372('0x26')](_0xb372('0x27'));_0x2cb201();});_0x2e98d5[_0xb372('0x28')]();});}function base64Decode(_0x19cb2b,_0x1cb409){var _0x3c1fc0=path[_0xb372('0x29')](__dirname,_0xb372('0x2a'),rs[_0xb372('0x2b')](0x4)+'.wav');fs[_0xb372('0x2c')](_0x3c1fc0,_0x19cb2b,'base64');return convertFile(_0x3c1fc0,_0x1cb409)[_0xb372('0x2d')](function(){try{fs[_0xb372('0x1c')](_0x3c1fc0);fs[_0xb372('0x2e')](_0x1cb409,_0xb372('0x2f'));}catch(_0x1be445){logger[_0xb372('0x1d')](_0x1be445);}return _0x1cb409['split']('.')[0x0];});}function base64Encode(_0x3f3be9){var _0x4187a9=fs[_0xb372('0x30')](_0x3f3be9);return new Buffer(_0x4187a9)[_0xb372('0x31')](_0xb372('0x32'));}exports[_0xb372('0x33')]=function(_0x42d509,_0x371258,_0x460549,_0x2cbcbc,_0x530ea7,_0x1b33b7){var _0x29ce69,_0x25af01;var _0x1c9c6e=_0xb372('0x34');var _0xc351d7='?key='+_0x42d509;var _0x18b397={};if(_0x371258===_0xb372('0x35')){_0x18b397[_0xb372('0x36')]={'ssml':_0x460549};}else{_0x18b397[_0xb372('0x36')]={'text':_0x460549};};_0x18b397[_0xb372('0x37')]={'languageCode':_0x2cbcbc,'ssmlGender':_0x530ea7};_0x18b397[_0xb372('0x38')]={'audioEncoding':_0xb372('0x39'),'sampleRateHertz':0x1f40};var _0x3dd9db={'url':_0x1c9c6e+_0xb372('0x3a')+_0xc351d7,'method':_0xb372('0x3b'),'json':!![],'body':_0x18b397};return rp(_0x3dd9db)[_0xb372('0x2d')](function(_0x23099a){return new BPromise(function(_0x52258d,_0x5a5631){_0x29ce69=path[_0xb372('0x29')](__dirname,_0xb372('0x2a'),rs[_0xb372('0x2b')](0x4)+_0xb372('0x3c'));var _0x4a5c74=Buffer[_0xb372('0x3d')](_0x23099a[_0xb372('0x3e')],'base64');return fs[_0xb372('0x3f')](_0x29ce69,_0x4a5c74,function(_0x145e86){_0x5a5631(_0x145e86);},function(_0xe61d9a){fs['chmodSync'](_0x29ce69,_0xb372('0x2f'));_0x52258d(_0xe61d9a);});});})[_0xb372('0x2d')](function(_0x1e95da){_0x25af01=path[_0xb372('0x29')](__dirname,'tmp',rs[_0xb372('0x2b')](0x4)+_0xb372('0x40'));return convertFile(_0x29ce69,_0x25af01);})['then'](function(){try{fs[_0xb372('0x1c')](_0x29ce69);fs[_0xb372('0x2e')](_0x25af01,_0xb372('0x2f'));}catch(_0x3b8b23){logger['error'](_0x3b8b23);}logger[_0xb372('0x26')](_0xb372('0x41'),_0x25af01[_0xb372('0x42')]('.')[0x0]);return _0x25af01['split']('.')[0x0];});};exports['googleTTS']=function(_0x4e6166,_0x133921){var _0x1d4f9b='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x18b594,_0x53886b;var _0x172dfe;var _0x4db2a0={'encoding':_0xb372('0x43'),'method':'POST','timeout':0x2710,'url':_0x1d4f9b,'headers':{'Content-Type':_0xb372('0x44')},'body':_0xb372('0x45')+encodeURIComponent(JSON[_0xb372('0x46')]([[[_0xb372('0x47'),JSON[_0xb372('0x46')]([_0x4e6166,_0x133921||'en',![],_0xb372('0x48')]),null,'generic']]]))};return rp(_0x4db2a0)[_0xb372('0x2d')](function(_0x263006){try{_0x172dfe=eval(_0x263006[_0xb372('0x49')](0x5))[0x0][0x2];}catch(_0xba1c31){throw new Error(_0xb372('0x4a')+_0x263006[_0xb372('0x21')]);}if(!_0x172dfe){if(_0x4e6166['length']>0xc8){throw new Error(_0xb372('0x4b'));}else{throw new Error(_0xb372('0x4c')+_0x133921+_0xb372('0x4d'));}}try{_0x172dfe=eval(_0x172dfe)[0x0];}catch(_0x5c16e0){throw new Error(_0xb372('0x4a')+res[_0xb372('0x21')]);}const _0x1e3ce0=_0x172dfe;_0x18b594=path[_0xb372('0x29')](__dirname,_0xb372('0x2a'),rs[_0xb372('0x2b')](0x4)+_0xb372('0x3c'));fs[_0xb372('0x2c')](_0x18b594,_0x172dfe,{'encoding':'base64'});_0x53886b=path[_0xb372('0x29')](__dirname,'tmp',rs[_0xb372('0x2b')](0x4)+_0xb372('0x40'));return convertFile(_0x18b594,_0x53886b);})[_0xb372('0x2d')](function(){try{fs['unlink'](_0x18b594);fs[_0xb372('0x2e')](_0x53886b,_0xb372('0x2f'));}catch(_0x30ce0d){logger[_0xb372('0x1d')](_0x30ce0d);}logger[_0xb372('0x26')]('goggleTTS\x20path',_0x53886b[_0xb372('0x42')]('.')[0x0]);return _0x53886b[_0xb372('0x42')]('.')[0x0];});};exports[_0xb372('0x4e')]=function(_0x2883b1,_0x154031,_0x30cb7c){return google[_0xb372('0x4f')](_0x2883b1,_0x154031,_0x30cb7c)[_0xb372('0x2d')](function(_0x5a6348){logger[_0xb372('0x26')](_0x5a6348['uri']);return rp(_0x5a6348);})[_0xb372('0x2d')](function(_0xacad64){var _0x1d1eb5='';var _0x1c00d9=0x0;try{fs[_0xb372('0x1c')](_0x2883b1);}catch(_0x466e49){logger[_0xb372('0x1d')](_0x466e49);}if(_0xacad64&&_0xacad64[_0xb372('0x50')]){_0x1d1eb5=_0xacad64[_0xb372('0x50')]['map'](function(_0x519caf){return _0x519caf&&_0x519caf['alternatives'][0x0]&&_0x519caf[_0xb372('0x51')][0x0]['transcript']?_0x519caf[_0xb372('0x51')][0x0][_0xb372('0x52')]:'';})['join']('\x0a');_0x1c00d9=_0xacad64[_0xb372('0x50')]['map'](function(_0x42c1d8){return _0x42c1d8&&_0x42c1d8['alternatives'][0x0]&&_0x42c1d8['alternatives'][0x0][_0xb372('0x53')]?_0x42c1d8['alternatives'][0x0][_0xb372('0x53')]:0x0;})[_0xb372('0x54')]('\x0a');}logger[_0xb372('0x26')](_0xb372('0x55'),_0x1d1eb5);logger[_0xb372('0x26')]('googleASR\x20confidence',_0x1c00d9);return{'transcript':_0x1d1eb5,'confidence':_0x1c00d9};})['catch'](function(_0x182761){logger['error']('[%s]\x20%s:%s',_0x182761[_0xb372('0x17')],_0x182761[_0xb372('0x56')],_0x182761['message']);});};exports[_0xb372('0x57')]=function(_0x49c07b,_0xc67225,_0x1b172f,_0x5352ec){var _0x508923=apiai(_0xc67225,{'language':_0x5352ec||'en'});return _0x508923[_0xb372('0x58')](_0x1b172f,{'sessionId':md5(_0x49c07b)})['then'](function(_0x4f6934){logger[_0xb372('0x26')](JSON[_0xb372('0x46')](_0x4f6934));return{'source':_0x4f6934['result'][_0xb372('0x59')],'resolvedQuery':_0x4f6934['result'][_0xb372('0x5a')],'action':_0x4f6934[_0xb372('0x5b')][_0xb372('0x5c')],'actionIncomplete':_0x4f6934['result'][_0xb372('0x5d')],'speech':_0x4f6934[_0xb372('0x5b')][_0xb372('0x5e')][_0xb372('0x5f')],'score':_0x4f6934[_0xb372('0x5b')][_0xb372('0x60')],'statusCode':_0x4f6934['status'][_0xb372('0x61')],'endConversation':_0x4f6934[_0xb372('0x5b')][_0xb372('0x62')][_0xb372('0x63')]||![],'isFallbackIntent':_0x4f6934[_0xb372('0x5b')][_0xb372('0x62')][_0xb372('0x64')]};});};exports[_0xb372('0x65')]=function(_0xe8e4f,_0x3ac053,_0x2bb5f7,_0x9b48a7,_0x4d9e1a,_0x21cc7e){var _0x3517cd=_0x9b48a7[_0xb372('0x66')](/\\n/g,'\x0a');var _0x590282={'credentials':{'private_key':_0x3517cd,'client_email':_0x2bb5f7}};var _0x548905=new dialogflow[(_0xb372('0x67'))](_0x590282);var _0x5e8c6a=_0x548905[_0xb372('0x68')](_0x3ac053,md5(_0xe8e4f));var _0x42b990={'session':_0x5e8c6a,'queryInput':{'text':{'text':_0x4d9e1a,'languageCode':_0x21cc7e}}};return _0x548905[_0xb372('0x69')](_0x42b990)[_0xb372('0x2d')](function(_0x1720cb){if(_0x1720cb&&_0x1720cb[_0xb372('0x6a')]){logger[_0xb372('0x26')]('Dialogflow\x20V2\x20response:',JSON[_0xb372('0x46')](_0x1720cb));var _0x9fdc35=_0x1720cb[0x0];if(_0x9fdc35){var _0x2969b3={'action':_0x9fdc35['queryResult'][_0xb372('0x5c')],'allRequiredParamsPresent':_0x9fdc35[_0xb372('0x6b')][_0xb372('0x6c')],'endConversation':_0x9fdc35[_0xb372('0x6b')][_0xb372('0x6d')]&&_0x9fdc35[_0xb372('0x6b')]['diagnosticInfo'][_0xb372('0x6e')]?_0x9fdc35['queryResult'][_0xb372('0x6d')]['fields'][_0xb372('0x6f')][_0xb372('0x70')]:![],'fulfillmentText':_0x9fdc35[_0xb372('0x6b')][_0xb372('0x71')],'intentName':_0x9fdc35[_0xb372('0x6b')][_0xb372('0x72')][_0xb372('0x56')],'intentDisplayName':_0x9fdc35[_0xb372('0x6b')][_0xb372('0x72')][_0xb372('0x73')],'isFallbackIntent':_0x9fdc35[_0xb372('0x6b')][_0xb372('0x72')][_0xb372('0x74')],'languageCode':_0x9fdc35[_0xb372('0x6b')][_0xb372('0x75')],'queryText':_0x9fdc35[_0xb372('0x6b')]['queryText'],'responseId':_0x9fdc35[_0xb372('0x76')],'score':_0x9fdc35[_0xb372('0x6b')][_0xb372('0x77')],'speech':_0x9fdc35[_0xb372('0x6b')][_0xb372('0x71')],'providerResponse':JSON[_0xb372('0x46')](_0x1720cb)};return _0x2969b3;}}});};exports[_0xb372('0x78')]=function(_0xb6eb4d,_0x1c1149,_0x3de42d,_0x10b96b){return tilde[_0xb372('0x4f')](_0xb6eb4d,_0x1c1149,_0x3de42d,_0x10b96b)[_0xb372('0x2d')](function(_0x3276d7){try{fs['unlink'](_0xb6eb4d);}catch(_0x464db8){logger['error'](_0x464db8);}logger[_0xb372('0x26')]('Tilde\x20ASR\x20transcription',_0x3276d7[_0xb372('0x52')]);logger['info'](_0xb372('0x79'),_0x3276d7[_0xb372('0x53')]);return _0x3276d7;});};exports[_0xb372('0x7a')]=function(_0x1b5645,_0x4471de,_0x2060c5,_0x3290e8,_0x2b560b,_0x4f51c3){var _0xc46fde=path[_0xb372('0x29')](__dirname,_0xb372('0x2a'),rs[_0xb372('0x2b')](0x4)+_0xb372('0x3c'));var _0x12a209;return aws[_0xb372('0x7b')](_0x1b5645,_0x4471de,_0x2060c5,_0x3290e8,_0x2b560b,_0x4f51c3,_0xc46fde)[_0xb372('0x2d')](function(){_0x12a209=path[_0xb372('0x29')](__dirname,'tmp',rs[_0xb372('0x2b')](0x4)+'.wav');return convertFile(_0xc46fde,_0x12a209);})['then'](function(){try{fs[_0xb372('0x1c')](_0xc46fde);fs['chmodSync'](_0x12a209,_0xb372('0x2f'));}catch(_0x16108b){logger[_0xb372('0x1d')](_0x16108b);}return _0x12a209[_0xb372('0x42')]('.')[0x0];});};exports[_0xb372('0x7c')]=function(_0x1d71e7,_0x500ab2,_0x24a0dd,_0x76d6dd,_0x4f0311,_0x1519ee){return aws[_0xb372('0x7d')](_0x1d71e7,_0x500ab2,_0x24a0dd,_0x76d6dd,_0x4f0311,_0x1519ee)[_0xb372('0x2d')](function(_0x262d48){logger[_0xb372('0x26')](JSON[_0xb372('0x46')](_0x262d48));return _0x262d48;});};exports[_0xb372('0x7e')]=function(_0x561cd9,_0x462f33,_0x457c07,_0x520644){var _0x57c9bc=util[_0xb372('0x7f')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x561cd9,encodeURIComponent(_0x462f33),_0x457c07,_0x520644);var _0x3d227a=path[_0xb372('0x29')](__dirname,'tmp',rs[_0xb372('0x2b')](0x4)+_0xb372('0x3c'));var _0xe95a74;return downloadFile(_0x57c9bc,_0x3d227a)[_0xb372('0x2d')](function(){_0xe95a74=path[_0xb372('0x29')](__dirname,'tmp',rs[_0xb372('0x2b')](0x4)+_0xb372('0x40'));return convertFile(_0x3d227a,_0xe95a74);})[_0xb372('0x2d')](function(){try{fs[_0xb372('0x1c')](_0x3d227a);fs[_0xb372('0x2e')](_0xe95a74,_0xb372('0x2f'));}catch(_0xca44b5){logger['error'](_0xca44b5);}return _0xe95a74[_0xb372('0x42')]('.')[0x0];});};exports[_0xb372('0x80')]=function(_0x1cc834,_0x3e334c,_0x82d618,_0x4864df){var _0x2cc4c9=util[_0xb372('0x7f')](_0xb372('0x81'),ISPEECH_API,_0x3e334c,_0x82d618,base64Encode(_0x1cc834),_0x4864df?util['format']('model=%s',encodeURIComponent(_0x4864df)):'freeform=3');return uploadFile(_0x2cc4c9)[_0xb372('0x2d')](function(_0x37b604){return querystring[_0xb372('0xb')](_0x37b604);});};exports['sestekNDA']=function(_0x41ffcd,_0x21fae9){return sestek[_0xb372('0x82')](_0x41ffcd,_0x21fae9)['then'](function(_0x3f2fc9){logger[_0xb372('0x26')](JSON['stringify'](_0x3f2fc9));var _0x69b1cc={'speech':_0x3f2fc9[_0xb372('0x83')],'action':_0x3f2fc9['channelData']?_0x3f2fc9[_0xb372('0x84')][_0xb372('0x85')]:undefined,'actiondata':_0x3f2fc9[_0xb372('0x84')]?_0x3f2fc9[_0xb372('0x84')]['CustomActionData']:undefined};if(_0x3f2fc9[_0xb372('0x84')]&&_0x3f2fc9[_0xb372('0x84')][_0xb372('0x86')]){return base64Decode(_0x3f2fc9[_0xb372('0x84')]['AudioFromTts'][_0xb372('0x87')],path['resolve'](__dirname,_0xb372('0x2a'),rs[_0xb372('0x2b')](0x4)+_0xb372('0x40')))['then'](function(_0x1b091){_0x69b1cc[_0xb372('0x88')]=_0x1b091;return _0x69b1cc;});}return _0x69b1cc;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 29a6d74..423c1dc 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 _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 +var _0x76d7=['./nda'];(function(_0x167a28,_0x3a056f){var _0x2314f9=function(_0x2b8a0a){while(--_0x2b8a0a){_0x167a28['push'](_0x167a28['shift']());}};_0x2314f9(++_0x3a056f);}(_0x76d7,0x1c3));var _0x776d=function(_0x21a44e,_0x203f07){_0x21a44e=_0x21a44e-0x0;var _0x5f1638=_0x76d7[_0x21a44e];return _0x5f1638;};var nda=require(_0x776d('0x0'));module['exports']={'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 0208633..ac21af1 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 _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 +var _0x851a=['text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','CustomActionData','custom_action_data','info','request-promise','../../../../../config/logger','agi','exports','POST','resolve','/token','username','password','then','ndassistant_url','ndaactivity_type','message','uniqueid','callerid','calleridname','dnid','extension'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x851a,0x19b));var _0xa851=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x851a[_0x57b54c];return _0x59cc19;};'use strict';var rp=require(_0xa851('0x0'));var url=require('url');var logger=require(_0xa851('0x1'))(_0xa851('0x2'));module[_0xa851('0x3')]=function(_0x52489c,_0xd7442b){var _0x1af5fd={'method':_0xa851('0x4'),'uri':url[_0xa851('0x5')](_0xd7442b['ndauth_url'],_0xa851('0x6')),'form':{'grant_type':'password','username':_0xd7442b[_0xa851('0x7')],'password':_0xd7442b[_0xa851('0x8')]},'json':!![]};return rp(_0x1af5fd)[_0xa851('0x9')](function(_0x551e16){var _0x3e1e9d={'method':_0xa851('0x4'),'uri':url[_0xa851('0x5')](_0xd7442b[_0xa851('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0xd7442b[_0xa851('0xb')]||_0xa851('0xc'),'channelId':'Nda','conversation':{'id':_0x52489c[_0xa851('0xd')]},'from':{'id':_0x52489c[_0xa851('0xe')],'name':_0x52489c[_0xa851('0xf')]},'recipient':{'id':_0x52489c[_0xa851('0x10')],'name':_0x52489c[_0xa851('0x11')]},'text':_0xd7442b[_0xa851('0x12')],'channelData':{}},'headers':{'Authorization':_0xa851('0x13')+_0x551e16[_0xa851('0x14')]},'json':!![]};if(_0xd7442b[_0xa851('0x15')]){_0x3e1e9d[_0xa851('0x16')][_0xa851('0x17')][_0xa851('0x18')]=_0xd7442b[_0xa851('0x15')];}if(_0xd7442b[_0xa851('0x19')]=='1'){_0x3e1e9d[_0xa851('0x16')][_0xa851('0x17')][_0xa851('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xa851('0x1b')};}if(_0xd7442b['custom_action']){_0x3e1e9d[_0xa851('0x16')][_0xa851('0x17')][_0xa851('0x1c')]=_0xd7442b[_0xa851('0x1d')];if(_0xd7442b['custom_action_data']){_0x3e1e9d[_0xa851('0x16')][_0xa851('0x17')][_0xa851('0x1e')]=_0xd7442b[_0xa851('0x1f')];}}logger[_0xa851('0x20')](JSON['stringify'](_0x3e1e9d));return rp(_0x3e1e9d);});}; \ 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 c652e74..b7795b7 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. * // * * // ************************************************************************* -'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 +var _0x7857=['exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7857,0x140));var _0x7785=function(_0x5c58b8,_0x3101d3){_0x5c58b8=_0x5c58b8-0x0;var _0x19264e=_0x7857[_0x5c58b8];return _0x19264e;};'use strict';var asr=require('./lib/api');module[_0x7785('0x0')]=function(_0x3705b3,_0x57d1e8,_0x7bab53,_0x35d344){return asr(_0x3705b3,_0x57d1e8,_0x7bab53,_0x35d344);}; \ 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 578fd27..d00b345 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 _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 +var _0x6dc9=['unix','send','stringify','createReadStream','data','EOS','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','close','bluebird','lodash','crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','info'];(function(_0x1b1a41,_0x37fdba){var _0x2ef3b7=function(_0x4ee4e0){while(--_0x4ee4e0){_0x1b1a41['push'](_0x1b1a41['shift']());}};_0x2ef3b7(++_0x37fdba);}(_0x6dc9,0x16b));var _0x96dc=function(_0x43d887,_0x56462c){_0x43d887=_0x43d887-0x0;var _0x5bbfb7=_0x6dc9[_0x43d887];return _0x5bbfb7;};'use strict';var BPromise=require(_0x96dc('0x0'));var _=require(_0x96dc('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x96dc('0x2'));var logger=require(_0x96dc('0x3'))(_0x96dc('0x4'));module[_0x96dc('0x5')]=function(_0x135b38,_0x3533f2,_0x28a588,_0x1669d3){return new BPromise(function(_0x3a1808,_0x5104bf){logger['info'](_0x96dc('0x6'),_0x1669d3||_0x96dc('0x7'));var _0x1712b5=new WebSocket(_0x1669d3||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x54fa6a='';var _0x36e4ad='0';var _0x15f8d1='1';var _0x4b9716=_0x96dc('0x8');function _0x293a93(_0x457532){var _0x44ea13=crypto[_0x96dc('0x9')](_0x96dc('0xa'));_0x44ea13[_0x96dc('0xb')](_0x457532);return _0x44ea13[_0x96dc('0xc')](_0x96dc('0xd'));}function _0x5c8a6d(){try{logger[_0x96dc('0xe')]('Open\x20Tilde\x20ASR\x20socket');var _0x464c0e=moment()[_0x96dc('0xf')]();var _0x1ef4c2=_0x293a93(_0x464c0e+_0x3533f2+_0x28a588);_0x1712b5[_0x96dc('0x10')](JSON[_0x96dc('0x11')]({'appID':_0x3533f2,'timestamp':_0x464c0e,'appKey':_0x1ef4c2}));var _0x3f32e1=fs[_0x96dc('0x12')](_0x135b38);_0x3f32e1['on'](_0x96dc('0x13'),function(_0x218963){_0x1712b5[_0x96dc('0x10')](_0x218963);});_0x3f32e1['on']('close',function(){_0x1712b5[_0x96dc('0x10')](_0x96dc('0x14'));});}catch(_0x431eb4){logger['error'](_0x96dc('0x15'),JSON[_0x96dc('0x11')](_0x431eb4));_0x1712b5[_0x96dc('0x16')]();}}function _0x3caaa0(_0x37a83c){try{if(_0x37a83c){var _0x41e8a7=JSON[_0x96dc('0x17')](_0x37a83c);switch(_0x41e8a7[_0x96dc('0x18')]){case 0x0:if(_0x41e8a7[_0x96dc('0x19')]){if(_0x41e8a7[_0x96dc('0x19')][_0x96dc('0x1a')]){logger['info']('Tilde\x20ASR\x20hypoteses',JSON[_0x96dc('0x11')](_0x41e8a7[_0x96dc('0x19')][_0x96dc('0x1b')]));_0x54fa6a=_0x41e8a7[_0x96dc('0x19')][_0x96dc('0x1b')][0x0]['transcript'];_0x36e4ad=_0x41e8a7['result']['hypotheses'][0x0][_0x96dc('0x1c')];_0x15f8d1='0';_0x4b9716=_0x96dc('0x1d');_0x1712b5['terminate']();}}break;case 0x1:logger[_0x96dc('0xe')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x15f8d1='1';_0x4b9716=_0x96dc('0x8');break;case 0x2:logger['info']('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x15f8d1='2';_0x4b9716=_0x96dc('0x1e');break;case 0x9:logger[_0x96dc('0xe')](_0x96dc('0x1f'));_0x15f8d1='9';_0x4b9716=_0x96dc('0x1f');break;case 0xa:logger['info'](_0x96dc('0x20'));_0x15f8d1='10';_0x4b9716=_0x96dc('0x20');break;case 0xb:logger['info'](_0x96dc('0x21'));_0x15f8d1='11';_0x4b9716=_0x96dc('0x21');}}}catch(_0x126a8a){logger['error'](_0x96dc('0x22'),JSON[_0x96dc('0x11')](_0x126a8a));_0x1712b5[_0x96dc('0x16')]();}}function _0xade7b9(){logger[_0x96dc('0xe')](_0x96dc('0x23'));_0x3a1808({'transcript':_0x54fa6a,'confidence':_0x36e4ad,'status':_0x15f8d1,'status_message':_0x4b9716});}function _0x16bd1a(_0xc0f180){logger[_0x96dc('0x24')](_0x96dc('0x25'));if(!_[_0x96dc('0x26')](_0xc0f180)){logger[_0x96dc('0x24')](_[_0x96dc('0x27')](_0xc0f180)?JSON[_0x96dc('0x11')](_0xc0f180):_0xc0f180);}}_0x1712b5['on'](_0x96dc('0x28'),_0x5c8a6d);_0x1712b5['on']('message',_0x3caaa0);_0x1712b5['on'](_0x96dc('0x29'),_0xade7b9);_0x1712b5['on'](_0x96dc('0x24'),_0x16bd1a);});}; \ 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 0ca5b46..65c389f 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 _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 +var _0x1725=['./asr'];(function(_0x5e7991,_0x58639b){var _0x41cb40=function(_0x164f53){while(--_0x164f53){_0x5e7991['push'](_0x5e7991['shift']());}};_0x41cb40(++_0x58639b);}(_0x1725,0xdb));var _0x5172=function(_0x22bd32,_0x3df5b2){_0x22bd32=_0x22bd32-0x0;var _0x15715c=_0x1725[_0x22bd32];return _0x15715c;};var asr=require(_0x5172('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 315cf01..37950bb 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_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 +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(_0x2b9e8a,_0x7b21d4){var _0x520e67=function(_0x22bce8){while(--_0x22bce8){_0x2b9e8a['push'](_0x2b9e8a['shift']());}};_0x520e67(++_0x7b21d4);}(_0xe706,0xa3));var _0x6e70=function(_0x59db19,_0x30c1c6){_0x59db19=_0x59db19-0x0;var _0x5f0f09=_0xe706[_0x59db19];return _0x5f0f09;};'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 3b148c0..c5d0252 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 _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 +var _0x99c9=['google_asr_language','tildeASR','appid','appsecret','clone','hasOwnProperty','isString','replaceObjectAllVariables','isPlainObject','recursiveNodeIndex','isArray','replaceAllVariables','saveRestApiResult','%s.%s','length','setVariable','split','replaceAll','extra','getAndSetVariable','getVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','sync','retry','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','MRCPSynth','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','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','Executed\x20command\x20MRCPSynth\x20%s','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','dialogflowV2','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','out','DialogflowV2\x20is\x20unreachable','sesteknda','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','getTrunk','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','true','false','condition','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','beep','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','toLowerCase','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','escape_digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','user','subject','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','mailRpc','prototype','rpc','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunkById','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','IntervalId','interval','map','Intervals','format','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','query','Error\x20executing\x20query\x20%s','info','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','dnid','file','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','list_id','scheduledAt','callback','toString','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','LOCAL','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','url','timeout','number','includes','POST','PUT','method','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','uri','parse','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_text_type','awsLex','aws_bot_name','googleASR'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x99c9,0x13c));var _0x999c=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x99c9[_0x413feb];return _0x40ee88;};'use strict';var fs=require('fs');var util=require(_0x999c('0x0'));var _=require(_0x999c('0x1'));var sh=require(_0x999c('0x2'));var odbc=require(_0x999c('0x3'))();var rs=require(_0x999c('0x4'));var moment=require(_0x999c('0x5'));var Mustache=require(_0x999c('0x6'));var rp=require('request-promise');var logger=require(_0x999c('0x7'))(_0x999c('0x8'));var config=require(_0x999c('0x9'));var scripts=require(_0x999c('0xa'));var FILES_PATH=_0x999c('0xb');var recursiveMapAttributes=[_0x999c('0xc'),_0x999c('0xd')];var verticesWithRetry=[_0x999c('0xe'),_0x999c('0xf'),_0x999c('0x10')];var AGIVertices=function(_0x329252,_0x3c58ba,_0x32984f){this[_0x999c('0x11')]=_0x329252;this['rpc']=_0x3c58ba;this[_0x999c('0x12')]=_0x32984f;};AGIVertices[_0x999c('0x13')]['getVariable']=function(_0x5b5436,_0x140c4b){this[_0x999c('0x14')][_0x999c('0x15')](_0x5b5436)[_0x999c('0x16')](function(_0xc334b2){_0x140c4b(null,_0xc334b2?_0xc334b2[_0x999c('0x17')]:![]);})[_0x999c('0x18')](function(_0x2e5f7e){_0x140c4b(_0x2e5f7e);});};AGIVertices[_0x999c('0x13')][_0x999c('0x19')]=function(_0x85f4a0,_0x4c3209){this[_0x999c('0x14')][_0x999c('0x1a')](_0x85f4a0)['then'](function(_0x54a2fa){_0x4c3209(null,_0x54a2fa?_0x54a2fa['name']:![]);})[_0x999c('0x18')](function(_0xb3e981){_0x4c3209(_0xb3e981);});};AGIVertices[_0x999c('0x13')][_0x999c('0x1b')]=function(_0x2a6667,_0x5d5d12){this[_0x999c('0x14')][_0x999c('0x1c')](_0x2a6667)[_0x999c('0x16')](function(_0xc05363){_0x5d5d12(null,_0xc05363?_0xc05363[_0x999c('0x17')]:![]);})['catch'](function(_0x1b327f){_0x5d5d12(_0x1b327f);});};AGIVertices[_0x999c('0x13')][_0x999c('0x1d')]=function(_0xd63ef8,_0x32c66c){this['rpc'][_0x999c('0x1e')](_0xd63ef8)[_0x999c('0x16')](function(_0x26abbb){_0x32c66c(null,_0x26abbb?_0x26abbb[_0x999c('0x1f')]:![]);})[_0x999c('0x18')](function(_0x1219d6){_0x32c66c(_0x1219d6);});};AGIVertices['prototype'][_0x999c('0x20')]=function(_0x200392,_0x24f637){this[_0x999c('0x14')][_0x999c('0x21')](_0x200392)[_0x999c('0x16')](function(_0x12d8f3){_0x24f637(null,_0x12d8f3?_0x12d8f3[_0x999c('0x17')]:![]);})[_0x999c('0x18')](function(_0x281720){_0x24f637(_0x281720);});};AGIVertices[_0x999c('0x13')]['getTrunk']=function(_0x448682,_0x1862ee){this[_0x999c('0x14')][_0x999c('0x22')](_0x448682)[_0x999c('0x16')](function(_0x15d102){_0x1862ee(null,_0x15d102?_0x15d102['name']:![]);})[_0x999c('0x18')](function(_0x43293f){_0x1862ee(_0x43293f);});};AGIVertices[_0x999c('0x13')]['getSound']=function(_0x1abac6,_0x4413c5){var _0x53953d=this;this[_0x999c('0x14')]['getSoundById'](_0x1abac6)['then'](function(_0xedf57d){_0x4413c5(null,_0xedf57d?_0x53953d[_0x999c('0x23')](_0xedf57d[_0x999c('0x24')]):![]);})[_0x999c('0x18')](function(_0x3737e9){_0x4413c5(_0x3737e9);});};AGIVertices[_0x999c('0x13')][_0x999c('0x25')]=function(_0x76dc32,_0x352c25){this[_0x999c('0x14')]['getMailAccountById'](_0x76dc32)[_0x999c('0x16')](function(_0x192976){_0x352c25(null,_0x192976?_0x192976:![]);})[_0x999c('0x18')](function(_0x361501){_0x352c25(_0x361501);});};AGIVertices[_0x999c('0x13')][_0x999c('0x26')]=function(_0x4427b4,_0x362735,_0x538221){this['mailRpc'][_0x999c('0x26')](_0x4427b4,_0x362735)[_0x999c('0x16')](function(){_0x538221(null);})[_0x999c('0x18')](function(_0x3872b7){_0x538221(_0x3872b7);});};AGIVertices['prototype'][_0x999c('0x27')]=function(_0xe28e45,_0x46815d){this[_0x999c('0x14')]['getIntervalById'](_0xe28e45)['then'](function(_0x21d6df){if(_0x21d6df){if(_0x21d6df[_0x999c('0x28')]){_0x46815d(null,[_0x21d6df[_0x999c('0x29')]]);}else{_0x46815d(null,_[_0x999c('0x2a')](_0x21d6df[_0x999c('0x2b')],_0x999c('0x29')));}}else{_0x46815d(null,![]);}})[_0x999c('0x18')](function(_0x4d5060){_0x46815d(_0x4d5060);});};AGIVertices['prototype']['getSoundPath']=function(_0x604646){return util[_0x999c('0x2c')]('%s/sounds/converted/%s',FILES_PATH,_0x604646);};AGIVertices['prototype']['getQueryOdbc']=function(_0x3d5534,_0x10fcf3,_0x15dc10){odbc[_0x999c('0x2d')](_0x3d5534,function(_0x5b5b2a){if(_0x5b5b2a){logger[_0x999c('0x2e')](_0x999c('0x2f'),_0x5b5b2a);_0x15dc10(_0x5b5b2a);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0x999c('0x30')](_0x10fcf3,function(_0x5ac869,_0x2878f5){if(_0x5ac869){logger['info'](_0x999c('0x31'),_0x10fcf3);_0x15dc10(_0x5ac869);}else{logger[_0x999c('0x32')](_0x999c('0x33'),_0x10fcf3);odbc[_0x999c('0x34')](function(_0x59029b){if(_0x59029b){logger['error'](_0x999c('0x35'),_0x59029b);}_0x15dc10(null,_0x2878f5);});}});}});};AGIVertices[_0x999c('0x13')][_0x999c('0x36')]=function(_0xf26ba3,_0x5e21b6){this[_0x999c('0x14')][_0x999c('0x37')](_0xf26ba3)[_0x999c('0x16')](function(_0x5fa1de){_0x5e21b6(null,_0x5fa1de?_0x5fa1de:![]);})['catch'](function(_0x192e50){_0x5e21b6(_0x192e50);});};AGIVertices['prototype'][_0x999c('0x38')]=function(_0x1513b2,_0x4829ab){this[_0x999c('0x14')][_0x999c('0x38')](_0x1513b2)[_0x999c('0x16')](function(_0x224251){_0x4829ab(null,_0x224251);})[_0x999c('0x18')](function(_0x2de6c7){_0x4829ab(_0x2de6c7);});};AGIVertices[_0x999c('0x13')][_0x999c('0x39')]=function(_0x4ef478,_0x563e11,_0x499095){this['rpc'][_0x999c('0x39')]({'uniqueid':this[_0x999c('0x11')][_0x999c('0x3a')],'node':_0x4ef478[_0x999c('0x3b')],'application':_0x4ef478[_0x999c('0x3c')],'data':_0x563e11||null,'project_name':this['channel'][_0x999c('0x3d')],'callerid':this[_0x999c('0x11')][_0x999c('0x3e')]})[_0x999c('0x16')](function(_0x9d708e){if(_0x499095){_0x499095(null,_0x9d708e);}})['catch'](function(_0x40fca1){if(_0x499095){_0x499095(_0x40fca1);}});};AGIVertices[_0x999c('0x13')][_0x999c('0x3f')]=function(_0x30e226,_0x28b9de,_0x3edb17,_0x3bfffb){this[_0x999c('0x14')][_0x999c('0x3f')]({'uniqueid':this['channel']['uniqueid'],'callerid':this[_0x999c('0x11')][_0x999c('0x3e')],'calleridname':this[_0x999c('0x11')][_0x999c('0x40')],'context':this[_0x999c('0x11')][_0x999c('0x41')],'extension':this[_0x999c('0x11')][_0x999c('0x42')],'priority':this[_0x999c('0x11')][_0x999c('0x43')],'accountcode':this[_0x999c('0x11')]['accountcode'],'dnid':this[_0x999c('0x11')][_0x999c('0x44')],'projectName':this[_0x999c('0x11')][_0x999c('0x3d')],'saveName':_0x28b9de,'filename':_0x30e226[_0x999c('0x45')]||_0x28b9de,'savePath':_0x3edb17})[_0x999c('0x16')](function(_0x11f3bf){_0x3bfffb(null,_0x11f3bf);})[_0x999c('0x18')](function(_0x55eb16){_0x3bfffb(_0x55eb16);});};AGIVertices[_0x999c('0x13')][_0x999c('0x46')]=function(_0x39a0bb,_0x20500c,_0x331d5d,_0x2db35a,_0x12eb3d){this['rpc']['createSquareMessage']({'uniqueid':this[_0x999c('0x11')][_0x999c('0x3a')],'body':_0x39a0bb,'direction':_0x20500c,'providerName':_0x331d5d,'providerResponse':_0x2db35a})[_0x999c('0x16')](function(_0x30aeec){if(_0x12eb3d){_0x12eb3d(null,_0x30aeec);}})[_0x999c('0x18')](function(_0x57327c){if(_0x12eb3d){_0x12eb3d(_0x57327c);}});};AGIVertices[_0x999c('0x13')][_0x999c('0x47')]=function(_0x38b75a,_0x11cc72){this['rpc'][_0x999c('0x47')]({'firstName':_['isEmpty'](_0x38b75a[_0x999c('0x17')])||_[_0x999c('0x48')](_0x38b75a[_0x999c('0x17')])?_0x999c('0x49')+Math[_0x999c('0x4a')]():_0x38b75a[_0x999c('0x17')],'lastName':_[_0x999c('0x4b')](_0x38b75a['lastName'])||_[_0x999c('0x48')](_0x38b75a[_0x999c('0x4c')])?null:_0x38b75a[_0x999c('0x4c')],'phone':_0x38b75a['phone'],'ListId':_0x38b75a[_0x999c('0x4d')],'scheduledat':_0x38b75a[_0x999c('0x4e')],'callbackUniqueid':this[_0x999c('0x11')]['uniqueid'],'tags':_0x999c('0x4f'),'description':'Callback\x20scheduled\x20at\x20'+_0x38b75a[_0x999c('0x4e')][_0x999c('0x50')](),'priority':_0x38b75a[_0x999c('0x51')]})[_0x999c('0x16')](function(_0x565fdb){_0x11cc72(null,_0x565fdb);})[_0x999c('0x18')](function(_0x5420bd){_0x11cc72(_0x5420bd);});};AGIVertices['prototype'][_0x999c('0x52')]=function(_0x117502,_0x5410ec){this[_0x999c('0x14')]['getPauseById'](_0x117502)[_0x999c('0x16')](function(_0xe89a71){_0x5410ec(null,_0xe89a71?_0xe89a71['name']:![]);})[_0x999c('0x18')](function(_0x1fd7c6){_0x5410ec(_0x1fd7c6);});};AGIVertices[_0x999c('0x13')][_0x999c('0x53')]=function(_0x237524,_0x2da455,_0xfb30cc){var _0x3fce90={'role':_0x999c('0x54')};_0x3fce90[_0x237524]=this['channel'][_0x999c('0x3e')];this[_0x999c('0x14')][_0x999c('0x53')](_0x3fce90,_0x2da455,this[_0x999c('0x11')][_0x999c('0x3a')])[_0x999c('0x16')](function(_0x536494){_0xfb30cc(null,_['isNil'](_0x536494)?![]:!![]);})['catch'](function(_0x4a6b73){logger[_0x999c('0x2e')](_0x4a6b73);_0xfb30cc(null,![]);});};AGIVertices[_0x999c('0x13')][_0x999c('0x55')]=function(_0x4d4236,_0x3569e8){var _0x5a2033={'role':_0x999c('0x54')};_0x5a2033[_0x4d4236]=this['channel'][_0x999c('0x3e')];this[_0x999c('0x14')][_0x999c('0x55')](_0x5a2033)[_0x999c('0x16')](function(_0x1988ef){_0x3569e8(null,_['isNil'](_0x1988ef)?![]:!![]);})[_0x999c('0x18')](function(_0x2e2976){logger[_0x999c('0x2e')](_0x2e2976);_0x3569e8(null,![]);});};AGIVertices[_0x999c('0x13')][_0x999c('0x56')]=function(_0x24fdcf,_0x1907f4){var _0x4d4c33={'role':_0x999c('0x54')};_0x4d4c33[_0x24fdcf]=this[_0x999c('0x11')][_0x999c('0x3e')];this[_0x999c('0x14')][_0x999c('0x56')](_0x4d4c33)[_0x999c('0x16')](function(_0x3a9a0d){_0x1907f4(null,_['isNil'](_0x3a9a0d)?![]:!![]);})[_0x999c('0x18')](function(_0xd2d105){logger['error'](_0xd2d105);_0x1907f4(null,![]);});};AGIVertices['prototype'][_0x999c('0x57')]=function(_0x141a60,_0x3c233c){var _0x5e57d0={'role':_0x999c('0x54')};_0x5e57d0[_0x141a60]=this[_0x999c('0x11')][_0x999c('0x3e')];var _0x251b3f=_0x141a60!=_0x999c('0x58')?util[_0x999c('0x2c')]('%s/%s@from-sip/n',_0x999c('0x59'),this['channel'][_0x999c('0x3e')]):undefined;this[_0x999c('0x14')][_0x999c('0x57')](_0x5e57d0,_0x251b3f)[_0x999c('0x16')](function(_0x1e034e){_0x3c233c(null,_[_0x999c('0x48')](_0x1e034e)?![]:!![]);})[_0x999c('0x18')](function(_0x39aa48){logger[_0x999c('0x2e')](_0x39aa48);_0x3c233c(null,![]);});};AGIVertices[_0x999c('0x13')][_0x999c('0x5a')]=function(_0x3905f1,_0xb1178c){sh['exec'](_[_0x999c('0x5b')](_0x3905f1),function(_0x1c9a78,_0x55ce3a){var _0x1066c8=_0x55ce3a[_0x999c('0x5c')](/(\r\n|\n|\r)/gm,'');_0xb1178c(null,_0x1066c8);});};AGIVertices[_0x999c('0x13')]['googleCloudTTS']=function(_0x2e0a60,_0xd83bc6){scripts[_0x999c('0x5d')](_0x2e0a60[_0x999c('0x5e')],_0x2e0a60[_0x999c('0x5f')]||'text',_0x2e0a60[_0x999c('0x60')],_0x2e0a60[_0x999c('0x61')]||_0x999c('0x62'),_0x2e0a60[_0x999c('0x63')]||_0x999c('0x64'),_0x2e0a60[_0x999c('0x65')]||_0x999c('0x66'))[_0x999c('0x16')](function(_0x4f99ad){_0xd83bc6(null,_0x4f99ad);})[_0x999c('0x18')](function(_0x3b6ce6){_0xd83bc6(_0x3b6ce6);});};AGIVertices['prototype']['googleTTS']=function(_0x2ac0be,_0x1c8e89){scripts[_0x999c('0x67')](_0x2ac0be[_0x999c('0x60')],_0x2ac0be['google_tts_language']||'en',0x1)[_0x999c('0x16')](function(_0x38c05f){_0x1c8e89(null,_0x38c05f);})[_0x999c('0x18')](function(_0x480e91){_0x1c8e89(_0x480e91);});};AGIVertices[_0x999c('0x13')]['restAPI']=function(_0x2c1b7d,_0x90eb9a){var _0x5d3c9f={'uri':_0x2c1b7d[_0x999c('0x68')],'method':_0x2c1b7d['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2c1b7d[_0x999c('0x69')])===_0x999c('0x6a')&&parseInt(_0x2c1b7d[_0x999c('0x69')])>=0x1?parseInt(_0x2c1b7d[_0x999c('0x69')])*0x3e8:0x5*0x3e8};if(_[_0x999c('0x6b')]([_0x999c('0x6c'),_0x999c('0x6d')],_0x5d3c9f[_0x999c('0x6e')][_0x999c('0x6f')]())){try{_0x5d3c9f[_0x999c('0x70')]=_0x2c1b7d[_0x999c('0xd')]?JSON['parse'](_0x2c1b7d[_0x999c('0xd')]):{};}catch(_0x22b391){logger[_0x999c('0x2e')](_0x999c('0x71'),_0x22b391);}}try{_0x5d3c9f[_0x999c('0x72')]=_0x2c1b7d[_0x999c('0xc')]?JSON['parse'](_0x2c1b7d['rawHeaders']):{};}catch(_0x21dbbc){logger[_0x999c('0x2e')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x21dbbc);}if(_0x2c1b7d[_0x999c('0x73')]){try{var _0x2714f9=require(_0x2c1b7d[_0x999c('0x73')])['sync'](this,_0x5d3c9f);_0x5d3c9f[_0x999c('0x74')]=Mustache['render'](_0x2c1b7d[_0x999c('0x68')],_0x2714f9,{},['$$','$$']);if(_0x5d3c9f[_0x999c('0x72')]){_0x5d3c9f[_0x999c('0x72')]=JSON[_0x999c('0x75')](Mustache[_0x999c('0x76')](JSON[_0x999c('0x77')](_0x5d3c9f[_0x999c('0x72')]),_0x2714f9,{},['$$','$$']));}if(_0x5d3c9f[_0x999c('0x70')]){_0x5d3c9f['body']=JSON['parse'](Mustache['render'](JSON[_0x999c('0x77')](_0x5d3c9f[_0x999c('0x70')]),_0x2714f9,{},['$$','$$']));}}catch(_0x179493){logger[_0x999c('0x2e')](_0x999c('0x78'),_0x179493);}}rp(_0x5d3c9f)[_0x999c('0x16')](function(_0x462bea){var _0x482164={'statusCode':_0x462bea[_0x999c('0x79')]||0xc8,'statusMessage':_0x462bea[_0x999c('0x7a')]||'OK','headers':_0x462bea[_0x999c('0x72')]||{},'body':_0x462bea[_0x999c('0x70')]||{}};_0x90eb9a(null,_0x482164);})[_0x999c('0x18')](function(_0x5493fb){var _0x2bfb6e={'statusCode':_0x5493fb['statusCode']||0x1f4,'statusMessage':_0x5493fb[_0x999c('0x7b')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x5493fb['options']['headers']||{},'body':_0x5493fb[_0x999c('0x7c')]['body']||{}};_0x90eb9a(null,_0x2bfb6e);});};AGIVertices[_0x999c('0x13')][_0x999c('0x7d')]=function(_0xebac9f,_0x57c1c6){scripts[_0x999c('0x7d')](this[_0x999c('0x11')][_0x999c('0x3a')],_0xebac9f[_0x999c('0x7e')],_0xebac9f[_0x999c('0x60')],_0xebac9f[_0x999c('0x7f')]||'en')[_0x999c('0x16')](function(_0x20676c){_0x57c1c6(null,_0x20676c);})[_0x999c('0x18')](function(_0xf38234){_0x57c1c6(_0xf38234);});};AGIVertices['prototype'][_0x999c('0x80')]=function(_0x353d2b,_0x59d43e){scripts[_0x999c('0x80')](this['channel'][_0x999c('0x3a')],_0x353d2b['dialogflowV2_project_id'],_0x353d2b[_0x999c('0x81')],_0x353d2b['private_key'],_0x353d2b[_0x999c('0x60')],_0x353d2b[_0x999c('0x82')]||'en')[_0x999c('0x16')](function(_0x599283){_0x59d43e(null,_0x599283);})[_0x999c('0x18')](function(_0x119a3a){_0x59d43e(_0x119a3a);});};AGIVertices[_0x999c('0x13')][_0x999c('0x83')]=function(_0x5c958a,_0x3ceb51){scripts[_0x999c('0x83')](this['channel'],_0x5c958a)['then'](function(_0x5e4ea8){_0x3ceb51(null,_0x5e4ea8);})['catch'](function(_0x498567){_0x3ceb51(_0x498567);});};AGIVertices[_0x999c('0x13')][_0x999c('0x84')]=function(_0x38765b,_0x192fa4){scripts[_0x999c('0x84')](_0x38765b[_0x999c('0x7e')],_0x38765b['text'],_0x38765b[_0x999c('0x85')]||'en-US',_0x38765b[_0x999c('0x86')])[_0x999c('0x16')](function(_0x41b2a7){_0x192fa4(null,_0x41b2a7);})[_0x999c('0x18')](function(_0x59ac21){_0x192fa4(_0x59ac21);});};AGIVertices[_0x999c('0x13')]['ispeechASR']=function(_0x5e2064,_0x36ff56,_0xdadb6f){scripts[_0x999c('0x87')](_0x36ff56,_0x5e2064[_0x999c('0x7e')],_0x5e2064[_0x999c('0x88')]||_0x999c('0x62'),this[_0x999c('0x89')](_0x5e2064[_0x999c('0x8a')])?_0x5e2064[_0x999c('0x8a')]:undefined)['then'](function(_0x5490f4){_0xdadb6f(null,_0x5490f4);})[_0x999c('0x18')](function(_0x53809e){_0xdadb6f(_0x53809e);});};AGIVertices[_0x999c('0x13')][_0x999c('0x8b')]=function(_0x1d27d6,_0x566fab){scripts[_0x999c('0x8b')](_0x1d27d6[_0x999c('0x8c')],_0x1d27d6[_0x999c('0x8d')],_0x1d27d6[_0x999c('0x8e')],_0x1d27d6['aws_polly_voice']||'Amy',_0x1d27d6['text'],_0x1d27d6[_0x999c('0x8f')]||_0x999c('0x60'))[_0x999c('0x16')](function(_0x22afef){_0x566fab(null,_0x22afef);})[_0x999c('0x18')](function(_0x123a8f){_0x566fab(_0x123a8f);});};AGIVertices[_0x999c('0x13')][_0x999c('0x90')]=function(_0x30f80f,_0x532ce4){scripts[_0x999c('0x90')](this[_0x999c('0x11')]['uniqueid'],_0x30f80f[_0x999c('0x8c')],_0x30f80f[_0x999c('0x8d')],_0x30f80f['aws_lex_region'],_0x30f80f[_0x999c('0x60')],_0x30f80f[_0x999c('0x91')])['then'](function(_0xe1b93e){_0x532ce4(null,_0xe1b93e);})[_0x999c('0x18')](function(_0x1e1ee4){_0x532ce4(_0x1e1ee4);});};AGIVertices[_0x999c('0x13')][_0x999c('0x92')]=function(_0x3a23b6,_0x31d350,_0x5852f3){scripts['googleASR'](_0x31d350,_0x3a23b6[_0x999c('0x7e')],_0x3a23b6[_0x999c('0x93')]||_0x999c('0x62'))[_0x999c('0x16')](function(_0x1a72f1){_0x5852f3(null,_0x1a72f1);})['catch'](function(_0x5bce18){_0x5852f3(_0x5bce18);});};AGIVertices[_0x999c('0x13')][_0x999c('0x94')]=function(_0x505039,_0x352c27,_0x5127ae){scripts[_0x999c('0x94')](_0x352c27,_0x505039[_0x999c('0x95')],_0x505039[_0x999c('0x96')],_0x505039[_0x999c('0x74')])['then'](function(_0x4bcdc7){_0x5127ae(null,_0x4bcdc7);})[_0x999c('0x18')](function(_0x487912){_0x5127ae(_0x487912);});};AGIVertices[_0x999c('0x13')]['clear']=function(_0x42121d){var _0x591266=_['includes'](verticesWithRetry,_0x42121d['agicommand'])?_0x42121d:_[_0x999c('0x97')](_0x42121d);for(var _0x3031ee in _0x591266){if(_0x591266[_0x999c('0x98')](_0x3031ee)){if(_0x591266[_0x3031ee]&&_[_0x999c('0x99')](_0x591266[_0x3031ee])){if(_[_0x999c('0x6b')](recursiveMapAttributes,_0x3031ee)){_0x591266[_0x3031ee]=this[_0x999c('0x9a')](_0x591266[_0x3031ee]);}else{_0x591266[_0x3031ee]=this['replaceAllVariables'](_0x591266[_0x3031ee]);}}}}return _0x591266;};AGIVertices[_0x999c('0x13')]['recursiveNodeIndex']=function(_0x2605f2){for(var _0x3051e8 in _0x2605f2){if(_0x2605f2['hasOwnProperty'](_0x3051e8)){if(_[_0x999c('0x9b')](_0x2605f2[_0x3051e8])){this[_0x999c('0x9c')](_0x2605f2[_0x3051e8]);}else if(_[_0x999c('0x9d')](_0x2605f2[_0x3051e8])){for(var _0x1f68dd=0x0;_0x1f68dd<_0x2605f2[_0x3051e8]['length'];_0x1f68dd++){this['recursiveNodeIndex'](_0x2605f2[_0x3051e8][_0x1f68dd]);}}else if(_[_0x999c('0x99')](_0x2605f2[_0x3051e8])){_0x2605f2[_0x3051e8]=this[_0x999c('0x9e')](_0x2605f2[_0x3051e8]);}}}};AGIVertices[_0x999c('0x13')][_0x999c('0x9f')]=function(_0x172181,_0x9f5a0a){for(var _0x4821ff in _0x172181){if(_0x172181[_0x999c('0x98')](_0x4821ff)){if(_['isPlainObject'](_0x172181[_0x4821ff])){if(!_[_0x999c('0x4b')](_0x172181[_0x4821ff])){this[_0x999c('0x9f')](_0x172181[_0x4821ff],util[_0x999c('0x2c')](_0x999c('0xa0'),_0x9f5a0a,_0x4821ff));}}else if(_[_0x999c('0x9d')](_0x172181[_0x4821ff])){for(var _0xaefb8a=0x0;_0xaefb8a<_0x172181[_0x4821ff][_0x999c('0xa1')];_0xaefb8a++){this[_0x999c('0x9f')](_0x172181[_0x4821ff][_0xaefb8a],util['format'](_0x999c('0xa0'),_0x9f5a0a,_0x4821ff+'['+_0xaefb8a+']'));}}else{if(!_[_0x999c('0x48')](_0x172181[_0x4821ff])){this[_0x999c('0x11')][_0x999c('0xa2')](util[_0x999c('0x2c')](_0x999c('0xa0'),_0x9f5a0a,_0x4821ff),_0x172181[_0x4821ff]);}}}}};AGIVertices[_0x999c('0x13')][_0x999c('0x9a')]=function(_0x49fbef){try{var _0xa77743=JSON[_0x999c('0x75')](_0x49fbef);this['recursiveNodeIndex'](_0xa77743);return JSON[_0x999c('0x77')](_0xa77743);}catch(_0x32520d){return this[_0x999c('0x9e')](_0x49fbef);}};AGIVertices['prototype'][_0x999c('0x9e')]=function(_0x3286f9){var _0x5c30e7=_0x3286f9[_0x999c('0xa3')]('{');for(var _0x47a5d3=0x1;_0x47a5d3<_0x5c30e7['length'];_0x47a5d3+=0x1){var _0x5e5adc=_0x5c30e7[_0x47a5d3][_0x999c('0xa3')]('}');if(_0x5e5adc[_0x999c('0xa1')]>0x1){_0x3286f9=_0x3286f9[_0x999c('0xa4')]('{'+_0x5e5adc[0x0]+'}',this[_0x999c('0x11')]['getVariable'](_0x5e5adc[0x0])[_0x999c('0xa5')]||_0x5e5adc[0x0]);}}if(_0x5c30e7['length']===0x1){return _0x3286f9[_0x999c('0x50')]();}return this[_0x999c('0x9e')](_0x3286f9);};AGIVertices[_0x999c('0x13')][_0x999c('0xa6')]=function(_0x73f91,_0x3e12fc){var _0x2cc2c6=this['channel'][_0x999c('0xa7')](_0x73f91);if(_0x2cc2c6[_0x999c('0xa8')]===-0x1){return _0x2cc2c6;}logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0xa9'),_0x3e12fc,_0x2cc2c6[_0x999c('0xa5')]));return this[_0x999c('0x11')][_0x999c('0xa2')](_0x3e12fc,_0x2cc2c6[_0x999c('0xa5')]);};AGIVertices['prototype']['isConfigured']=function(_0x1b8cd2){return _0x1b8cd2&&_0x1b8cd2!=='0'&&_0x1b8cd2!=='-1'&&_0x1b8cd2!=='';};AGIVertices['prototype']['maxRetry']=function(_0x183e6c){this[_0x999c('0x39')][_0x999c('0xaa')](this,_0x183e6c,'-');_0x183e6c[_0x999c('0xab')]=_0x183e6c[_0x999c('0xac')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x999c('0x13')][_0x999c('0xad')]=function(_0x1a0316){logger[_0x999c('0x32')](util['format'](_0x999c('0xae'),_0x1a0316['label']));if(!this[_0x999c('0x89')](_0x1a0316[_0x999c('0x60')])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0xb0'));}var _0x10306c='\x22'+_0x1a0316[_0x999c('0x60')]+'\x22';if(this[_0x999c('0x89')](_0x1a0316[_0x999c('0x7c')])){_0x10306c+=','+_0x1a0316[_0x999c('0x7c')];}var _0x12cce3=this[_0x999c('0x11')][_0x999c('0xb1')](_0x999c('0xb2'),_0x10306c);if(_0x12cce3[_0x999c('0xa8')]===-0x1){return _0x12cce3;}return this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')]('Executed\x20command\x20MRCPSynth\x20%s',_0x10306c));};AGIVertices[_0x999c('0x13')][_0x999c('0xb3')]=function(_0x5035f5){logger[_0x999c('0x32')](util['format'](_0x999c('0xb4'),_0x5035f5[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x5035f5[_0x999c('0xb5')])){return this[_0x999c('0x11')][_0x999c('0xaf')]('no\x20grammar\x20configured');}var _0x5ab1db=_0x5035f5[_0x999c('0xb5')];if(this[_0x999c('0x89')](_0x5035f5['options'])){_0x5ab1db+=','+_0x5035f5['options'];}var _0x14dfe2=this[_0x999c('0x11')]['exec'](_0x999c('0xb6'),_0x5ab1db);if(_0x14dfe2[_0x999c('0xa8')]===-0x1){return _0x14dfe2;}var _0x328b02=this[_0x999c('0xa6')](_0x999c('0xb7'),_0x999c('0xb8'));if(_0x328b02[_0x999c('0xa8')]===-0x1){return _0x328b02;}var _0x3d2c9c=this[_0x999c('0xa6')](_0x999c('0xb9'),'MRCP_RECOG_TRANSCRIPT');if(_0x3d2c9c['result']===-0x1){return _0x3d2c9c;}var _0x101cab=this[_0x999c('0xa6')](_0x999c('0xba'),_0x999c('0xbb'));if(_0x101cab[_0x999c('0xa8')]===-0x1){return _0x101cab;}return this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0xbc'),_0x5ab1db));};AGIVertices[_0x999c('0x13')][_0x999c('0x8')]=function(_0x6a8c16){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0xbd'),_0x6a8c16[_0x999c('0x3b')]));return this[_0x999c('0x11')]['agi']([_0x6a8c16[_0x999c('0xbe')],_0x6a8c16['args']]);};AGIVertices[_0x999c('0x13')][_0x999c('0xbf')]=function(_0x5457a8){logger[_0x999c('0x32')](util['format'](_0x999c('0xc0'),_0x5457a8[_0x999c('0x3b')]));if(this[_0x999c('0x89')](_0x5457a8['timeout'])){logger['info'](util[_0x999c('0x2c')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x5457a8['timeout']));var _0x3fdba4=this['channel'][_0x999c('0xc1')](_0x5457a8['timeout']);if(_0x3fdba4[_0x999c('0xa8')]===-0x1){return _0x3fdba4;}}return this['channel']['answer']();};AGIVertices[_0x999c('0x13')][_0x999c('0x4f')]=function(_0x19c379){logger[_0x999c('0x32')](util['format'](_0x999c('0xc2'),_0x19c379['label']));if(!this[_0x999c('0x89')](_0x19c379['list_id'])){return this[_0x999c('0x11')][_0x999c('0x2e')](_0x19c379,'no\x20list\x20selected');}_0x19c379[_0x999c('0x4e')]=moment();if(this[_0x999c('0x89')](_0x19c379['delay'])){_0x19c379['scheduledAt']=moment()['add'](_0x19c379[_0x999c('0xc3')],_0x999c('0xc4'));}if(!this[_0x999c('0x89')](_0x19c379['callback_priority'])){_0x19c379[_0x999c('0x51')]=0x2;}this[_0x999c('0x47')][_0x999c('0xaa')](this,_0x19c379);return this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0xc5'),_0x19c379['phone'],_0x19c379[_0x999c('0x4d')],_0x19c379['scheduledAt']));};AGIVertices['prototype'][_0x999c('0xc6')]=function(_0xcd7120){logger[_0x999c('0x32')](util['format'](_0x999c('0xc7'),_0xcd7120[_0x999c('0x3b')]));var _0x4714c6=this[_0x999c('0x11')][_0x999c('0xb1')](_0xcd7120[_0x999c('0xc8')],_0xcd7120[_0x999c('0x7c')]);if(_0x4714c6[_0x999c('0xa8')]===-0x1){return _0x4714c6;}return this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0xc9'),_0xcd7120[_0x999c('0xc8')],_0xcd7120[_0x999c('0x7c')]));};AGIVertices['prototype'][_0x999c('0xca')]=function(_0x4855b3){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0xcb'),_0x4855b3[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x4855b3[_0x999c('0x60')])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0xb0'));}var _0x397459='\x22'+_0x4855b3['text']+'\x22';if(this[_0x999c('0x89')](_0x4855b3['options'])){_0x397459+=','+_0x4855b3[_0x999c('0x7c')];}var _0xdbfafa=this['channel'][_0x999c('0xb1')](_0x999c('0xb2'),_0x397459);if(_0xdbfafa[_0x999c('0xa8')]===-0x1){return _0xdbfafa;}return this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')]('Executed\x20command\x20MRCPSynth\x20%s',_0x397459));};AGIVertices['prototype'][_0x999c('0xcc')]=function(_0x2bdb8b){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0xcd'),_0x2bdb8b[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x2bdb8b['text'])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0xb0'));}var _0x16c7ea='\x22'+_0x2bdb8b['text']+'\x22';if(this[_0x999c('0x89')](_0x2bdb8b[_0x999c('0x7c')])){_0x16c7ea+=','+_0x2bdb8b[_0x999c('0x7c')];}var _0x388bc9=this[_0x999c('0x11')]['exec'](_0x999c('0xb2'),_0x16c7ea);if(_0x388bc9['result']===-0x1){return _0x388bc9;}return this['channel'][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0xce'),_0x16c7ea));};AGIVertices[_0x999c('0x13')][_0x999c('0xcf')]=function(_0x209bdf){logger['info'](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x209bdf['label']));if(!this[_0x999c('0x89')](_0x209bdf[_0x999c('0xb5')])){return this['channel']['noop']('no\x20grammar\x20configured');}var _0x2541ab=_0x209bdf[_0x999c('0xb5')];if(this['isConfigured'](_0x209bdf[_0x999c('0x7c')])){_0x2541ab+=','+_0x209bdf[_0x999c('0x7c')];}var _0x3492e1=this[_0x999c('0x11')]['exec'](_0x999c('0xb6'),_0x2541ab);if(_0x3492e1['result']===-0x1){return _0x3492e1;}var _0x4d738b=this[_0x999c('0xa6')](_0x999c('0xb7'),_0x999c('0xd0'));if(_0x4d738b[_0x999c('0xa8')]===-0x1){return _0x4d738b;}var _0x18de3a=this[_0x999c('0xa6')](_0x999c('0xb9'),_0x999c('0xd1'));if(_0x18de3a['result']===-0x1){return _0x18de3a;}var _0x3b0c37=this[_0x999c('0xa6')]('RECOG_INSTANCE()',_0x999c('0xd2'));if(_0x3b0c37[_0x999c('0xa8')]===-0x1){return _0x3b0c37;}return this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0xbc'),_0x2541ab));};AGIVertices[_0x999c('0x13')][_0x999c('0xd3')]=function(_0x55797f){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0xd4'),_0x55797f[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x55797f['grammar'])){return this['channel'][_0x999c('0xaf')]('no\x20grammar\x20configured');}var _0x11be94=_0x55797f[_0x999c('0xb5')];if(this['isConfigured'](_0x55797f[_0x999c('0x7c')])){_0x11be94+=','+_0x55797f[_0x999c('0x7c')];}var _0x2054ea=this[_0x999c('0x11')][_0x999c('0xb1')](_0x999c('0xb6'),_0x11be94);if(_0x2054ea[_0x999c('0xa8')]===-0x1){return _0x2054ea;}var _0x47e529=this[_0x999c('0xa6')]('RECOG_CONFIDENCE()',_0x999c('0xd5'));if(_0x47e529['result']===-0x1){return _0x47e529;}var _0x158ad6=this[_0x999c('0xa6')](_0x999c('0xb9'),'SESTEK_ASR_TRANSCRIPT');if(_0x158ad6['result']===-0x1){return _0x158ad6;}var _0x343835=this[_0x999c('0xa6')](_0x999c('0xba'),_0x999c('0xd6'));if(_0x343835[_0x999c('0xa8')]===-0x1){return _0x343835;}return this[_0x999c('0x11')]['noop'](util[_0x999c('0x2c')](_0x999c('0xbc'),_0x11be94));};AGIVertices['prototype'][_0x999c('0xd7')]=function(_0x478000){logger[_0x999c('0x32')](util[_0x999c('0x2c')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x478000[_0x999c('0x3b')]));if(!this['isConfigured'](_0x478000['odbc_id'])){return this['channel'][_0x999c('0x2e')](_0x478000,_0x999c('0xd8'));}var _0x5d56da=this['getSquareOdbc']['sync'](this,_0x478000['odbc_id']);if(!_0x5d56da){return this['channel'][_0x999c('0x2e')](_0x478000,_0x999c('0xd9'));}if(!this['isConfigured'](_0x478000[_0x999c('0x30')])){return this[_0x999c('0x11')][_0x999c('0x2e')](_0x478000,_0x999c('0xda'));}var _0x2ba1e3=_0x478000[_0x999c('0x30')][_0x999c('0x5c')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x999c('0xaf')](util['format']('query:\x20%s',_0x2ba1e3));var _0x251819=this[_0x999c('0xdb')][_0x999c('0xaa')](this,_0x5d56da,_0x2ba1e3);this[_0x999c('0x39')][_0x999c('0xaa')](this,_0x478000,_0x2ba1e3);if(!this[_0x999c('0x89')](_0x478000[_0x999c('0xdc')])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0xdd'));}var _0xd2bb81=this[_0x999c('0xa7')][_0x999c('0xaa')](this,_0x478000['variable_id']);if(!_0xd2bb81){return this[_0x999c('0x11')][_0x999c('0x2e')](_0x478000,_0x999c('0xde'));}var _0x946492=this;_0x251819[_0x999c('0xdf')](function(_0x2e04c3,_0x175f22){Object[_0x999c('0xe0')](_0x2e04c3)['forEach'](function(_0x1298e1){_0x946492['channel'][_0x999c('0xa2')](util[_0x999c('0x2c')](_0x999c('0xe1'),_0xd2bb81,_0x175f22,_0x1298e1),_0x2e04c3[_0x1298e1]);});});this['channel'][_0x999c('0xa2')](util['format'](_0x999c('0xe2'),_0xd2bb81),_0x251819[_0x999c('0xa1')]);return this['channel']['noop'](util[_0x999c('0x2c')](_0x999c('0xe3'),_0xd2bb81));};AGIVertices[_0x999c('0x13')][_0x999c('0xe4')]=function(_0x44fb81){logger[_0x999c('0xe5')](util[_0x999c('0x2c')](_0x999c('0xe6'),_0x44fb81[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x44fb81[_0x999c('0xe7')])){return this['channel']['error'](_0x44fb81,_0x999c('0xe8'));}var _0x21652b=this['getUser'][_0x999c('0xaa')](this,_0x44fb81[_0x999c('0xe7')]);if(!_0x21652b){return this[_0x999c('0x11')][_0x999c('0x2e')](_0x44fb81,'no\x20user\x20found');}var _0x218e7d=this[_0x999c('0x11')]['exec'](_0x999c('0xe9'),[util[_0x999c('0x2c')](_0x999c('0xea'),_0x21652b),_0x44fb81['timeout'],_0x44fb81[_0x999c('0xeb')],_0x44fb81[_0x999c('0x68')]]);if(_0x218e7d['result']===-0x1){return _0x218e7d;}return this['channel'][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0xec'),'DIAL'));};AGIVertices['prototype']['dialogflow']=function(_0x40d747){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0xed'),_0x40d747[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x40d747[_0x999c('0x7e')])){return this[_0x999c('0x11')]['noop'](_0x999c('0xee'));}if(!this[_0x999c('0x89')](_0x40d747[_0x999c('0x60')])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0xb0'));}this[_0x999c('0x11')][_0x999c('0xef')]=!![];this[_0x999c('0x39')](_0x40d747);this['createSquareMessage'](_0x40d747[_0x999c('0x60')],'in','','');this[_0x999c('0x11')]['noop'](util['format'](_0x999c('0xf0'),_0x40d747['text']));var _0x18bb3b=this[_0x999c('0x7d')][_0x999c('0xaa')](this,_0x40d747);if(_0x18bb3b){for(var _0x2a13c3 in _0x18bb3b){if(_0x18bb3b[_0x999c('0x98')](_0x2a13c3)){this[_0x999c('0x11')][_0x999c('0xa2')](util[_0x999c('0x2c')](_0x999c('0xf1'),_0x2a13c3[_0x999c('0x6f')]()),_0x18bb3b[_0x2a13c3]);}}this[_0x999c('0x46')](_0x18bb3b[_0x999c('0xf2')],'out','dialogflow','');return this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0xf3'),_0x18bb3b[_0x999c('0xf2')]));}return this[_0x999c('0x11')]['error'](_0x40d747,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x999c('0x13')][_0x999c('0xf4')]=function(_0x8b0662){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0xf5'),_0x8b0662[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x8b0662['dialogflowV2_project_id'])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0xf6'));}if(!this[_0x999c('0x89')](_0x8b0662[_0x999c('0x81')])){return this[_0x999c('0x11')][_0x999c('0xaf')]('no\x20client_email\x20configured');}if(!this[_0x999c('0x89')](_0x8b0662[_0x999c('0xf7')])){return this['channel'][_0x999c('0xaf')](_0x999c('0xf8'));}if(!this[_0x999c('0x89')](_0x8b0662[_0x999c('0x82')])){return this['channel'][_0x999c('0xaf')](_0x999c('0xf9'));}if(!this[_0x999c('0x89')](_0x8b0662[_0x999c('0x60')])){return this[_0x999c('0x11')][_0x999c('0xaf')]('no\x20text\x20configured');}this[_0x999c('0x11')][_0x999c('0xef')]=!![];this[_0x999c('0x39')](_0x8b0662);this[_0x999c('0x46')](_0x8b0662[_0x999c('0x60')],'in','','');this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0xfa'),_0x8b0662[_0x999c('0x60')]));var _0x3477ee=this[_0x999c('0x80')][_0x999c('0xaa')](this,_0x8b0662);if(_0x3477ee){for(var _0x1dbe76 in _0x3477ee){if(_0x3477ee['hasOwnProperty'](_0x1dbe76)){if(_0x1dbe76!==_0x999c('0xfb')){this['channel'][_0x999c('0xa2')](util[_0x999c('0x2c')](_0x999c('0xf1'),_0x1dbe76[_0x999c('0x6f')]()),_0x3477ee[_0x1dbe76]);}}}this['createSquareMessage'](_0x3477ee[_0x999c('0xf2')],_0x999c('0xfc'),_0x999c('0xf4'),_0x3477ee['providerResponse']);return this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')]('DialogflowV2\x20Result\x20%s',_0x3477ee['speech']));}return this[_0x999c('0x11')][_0x999c('0x2e')](_0x8b0662,_0x999c('0xfd'));};AGIVertices[_0x999c('0x13')][_0x999c('0xfe')]=function(_0x3d622a){logger[_0x999c('0x32')](util[_0x999c('0x2c')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x3d622a[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x3d622a['ndauth_url'])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0xff'));}if(!this[_0x999c('0x89')](_0x3d622a['username'])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0x100'));}if(!this['isConfigured'](_0x3d622a['password'])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0x101'));}if(!this[_0x999c('0x89')](_0x3d622a[_0x999c('0x102')])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0xb0'));}this[_0x999c('0x11')][_0x999c('0xef')]=!![];this['createSquareDetailsReport'](_0x3d622a);this[_0x999c('0x46')](_0x3d622a[_0x999c('0x60')],'in','','');this['channel'][_0x999c('0xaf')](util['format'](_0x999c('0x103'),_0x3d622a[_0x999c('0x60')]));var _0x23ea9e=this[_0x999c('0x83')][_0x999c('0xaa')](this,_0x3d622a);if(_0x23ea9e){for(var _0x43481a in _0x23ea9e){if(_0x23ea9e[_0x999c('0x98')](_0x43481a)){this[_0x999c('0x11')]['setVariable'](util[_0x999c('0x2c')](_0x999c('0x104'),_0x43481a[_0x999c('0x6f')]()),_0x23ea9e[_0x43481a]);}}this['createSquareMessage'](_0x23ea9e[_0x999c('0xf2')],_0x999c('0xfc'),_0x999c('0xfe'),'');if(_0x23ea9e['audiofile']){this[_0x999c('0x11')]['noop'](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x23ea9e[_0x999c('0x105')]));var _0x3788d6=this['channel']['streamFile'](_0x23ea9e['audiofile']);try{fs[_0x999c('0x106')](_0x23ea9e['audiofile']+'.wav');}catch(_0x3274df){logger[_0x999c('0x2e')](_0x3274df);}return _0x3788d6;}else{return this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0x107'),_0x23ea9e[_0x999c('0xf2')]));}}return this['channel'][_0x999c('0x2e')](_0x3d622a,_0x999c('0x108'));};AGIVertices[_0x999c('0x13')][_0x999c('0x109')]=function(_0x392b34){logger['info'](util[_0x999c('0x2c')](_0x999c('0x10a'),_0x392b34[_0x999c('0x3b')]));return this[_0x999c('0x11')]['noop']('end');};AGIVertices[_0x999c('0x13')][_0x999c('0x10b')]=function(_0x5bf09c){logger['info'](util[_0x999c('0x2c')](_0x999c('0x10c'),_0x5bf09c[_0x999c('0x3b')]));var _0x6fed01='';if(_0x5bf09c['trunk_id']){if(!this[_0x999c('0x89')](_0x5bf09c['trunk_id'])){return this[_0x999c('0x11')][_0x999c('0x2e')](_0x5bf09c,'no\x20trunk\x20selected');}else{var _0x506ee9=parseInt(_0x5bf09c['trunk_id'],0xa);if(isNaN(_0x506ee9)){_0x6fed01=_0x5bf09c[_0x999c('0x10d')];}else{_0x6fed01=this[_0x999c('0x10e')][_0x999c('0xaa')](this,_0x5bf09c[_0x999c('0x10d')]);if(!_0x6fed01){return this['channel'][_0x999c('0x2e')](_0x5bf09c,_0x999c('0x10f'));}}}}else if(_0x5bf09c['trunk_name']){_0x6fed01=_0x5bf09c[_0x999c('0x110')];}else{return this[_0x999c('0x11')]['error'](_0x5bf09c,_0x999c('0x111'));}var _0xc24259=this[_0x999c('0x11')][_0x999c('0xb1')](_0x999c('0xe9'),[util[_0x999c('0x2c')](_0x999c('0x112'),_0x6fed01,_0x5bf09c['phone']),_0x5bf09c['timeout'],_0x5bf09c[_0x999c('0xeb')],_0x5bf09c[_0x999c('0x68')]]);if(_0xc24259['result']===-0x1){return _0xc24259;}return this[_0x999c('0x11')]['noop'](util[_0x999c('0x2c')](_0x999c('0xec'),_0x999c('0xe9')));};AGIVertices[_0x999c('0x13')][_0x999c('0x113')]=function(_0x1bdefa){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x114'),_0x1bdefa['label']));return this['channel'][_0x999c('0xaf')](_0x999c('0x113'));};AGIVertices[_0x999c('0x13')][_0x999c('0xf')]=function(_0x102815){logger[_0x999c('0x32')](util['format']('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x102815[_0x999c('0x3b')]));if(_0x102815['retry']===0x0){return this[_0x999c('0xac')](_0x102815);}_0x102815[_0x999c('0xab')]-=0x1;if(!this[_0x999c('0x89')](_0x102815[_0x999c('0x115')])){return this['channel']['error'](_0x102815,_0x999c('0x116'));}var _0x22c70f=this[_0x999c('0x117')]['sync'](this,_0x102815[_0x999c('0x115')]);if(!_0x22c70f){return this['channel'][_0x999c('0x2e')](_0x102815,_0x999c('0x118'));}if(!this['isConfigured'](_0x102815['variable_id'])){return this[_0x999c('0x11')][_0x999c('0x2e')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x29d9c6=this[_0x999c('0x11')][_0x999c('0x119')](_0x22c70f,_0x102815[_0x999c('0x11a')],_0x102815[_0x999c('0x11b')]);var _0x3fdf8a=_0x29d9c6['result']?_0x29d9c6['result'][_0x999c('0x50')]():'';logger['info'](_0x999c('0x11c'),JSON[_0x999c('0x77')](_0x29d9c6));if(_0x29d9c6[_0x999c('0xa8')]===-0x1){this[_0x999c('0x39')][_0x999c('0xaa')](this,_0x102815,_0x3fdf8a);return _0x29d9c6;}else if(_0x29d9c6[_0x999c('0xa5')]===_0x999c('0x69')){_0x29d9c6[_0x999c('0xa8')]=_0x3fdf8a['length']>=parseInt(_0x102815[_0x999c('0x11d')])?'x':'i';}else{_0x29d9c6['result']=_0x3fdf8a['length']>=parseInt(_0x102815[_0x999c('0x11d')])&&_0x3fdf8a[_0x999c('0xa1')]<=parseInt(_0x102815[_0x999c('0x11b')])?'x':'i';}var _0x26b57b=this[_0x999c('0xa7')][_0x999c('0xaa')](this,_0x102815[_0x999c('0xdc')]);if(!_0x26b57b){return this[_0x999c('0x11')][_0x999c('0x2e')](_0x102815,_0x999c('0xde'));}this[_0x999c('0x11')][_0x999c('0xa2')](_0x26b57b,_0x3fdf8a);if(this[_0x999c('0x89')](_0x102815['hiddendigitsnum'])){var _0x4ddb18=parseInt(_0x102815[_0x999c('0x11e')],0xa);var _0x2859d2=rs[_0x999c('0x11f')]({'charset':'*','length':_0x4ddb18});var _0x172766=_0x3fdf8a[_0x999c('0xa1')];if(_0x172766>0x0){if(_0x172766>_0x4ddb18){this[_0x999c('0x39')][_0x999c('0xaa')](this,_0x102815,_0x102815[_0x999c('0x120')]===_0x999c('0x121')?_0x2859d2+_0x3fdf8a[_0x999c('0x122')](_0x4ddb18):_0x3fdf8a[_0x999c('0x122')](0x0,_0x172766-_0x4ddb18)+_0x2859d2);}else{this[_0x999c('0x39')][_0x999c('0xaa')](this,_0x102815,rs['generate']({'charset':'*','length':_0x172766}));}}else{this['createSquareDetailsReport']['sync'](this,_0x102815,'');}}else{this[_0x999c('0x39')][_0x999c('0xaa')](this,_0x102815,_0x3fdf8a);}return _0x29d9c6;};AGIVertices['prototype'][_0x999c('0x10')]=function(_0x26cd3f){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x123'),_0x26cd3f[_0x999c('0x3b')]));return this[_0x999c('0xf')](_0x26cd3f);};AGIVertices[_0x999c('0x13')][_0x999c('0x124')]=function(_0x5b95d4){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x125'),_0x5b95d4[_0x999c('0x3b')]));this[_0x999c('0x39')]['sync'](this,_0x5b95d4,_0x5b95d4['goalname']);return this[_0x999c('0x11')]['noop'](util['format'](_0x999c('0x126'),_0x5b95d4[_0x999c('0x127')]));};AGIVertices['prototype'][_0x999c('0x128')]=function(_0x452ae4){logger['info'](util[_0x999c('0x2c')](_0x999c('0x129'),_0x452ae4[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x452ae4[_0x999c('0x8c')])||!this[_0x999c('0x89')](_0x452ae4[_0x999c('0x8d')])){return this[_0x999c('0x11')]['noop'](_0x999c('0x12a'));}if(!this['isConfigured'](_0x452ae4[_0x999c('0x60')])){return this['channel'][_0x999c('0xaf')]('no\x20text\x20configured');}this['channel']['noop'](util[_0x999c('0x2c')](_0x999c('0x12b'),_0x452ae4[_0x999c('0x60')]));var _0x46ba24=this[_0x999c('0x8b')][_0x999c('0xaa')](this,_0x452ae4);if(_0x46ba24){this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0x12c'),_0x46ba24));var _0xe17572=this[_0x999c('0x11')][_0x999c('0x12d')](_0x46ba24);try{fs[_0x999c('0x106')](_0x46ba24+_0x999c('0x12e'));}catch(_0x8c0153){logger[_0x999c('0x2e')](_0x8c0153);}return _0xe17572;}return this['channel'][_0x999c('0x2e')](_0x452ae4,_0x999c('0x12f'));};AGIVertices[_0x999c('0x13')][_0x999c('0x130')]=function(_0xf67038){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x131'),_0xf67038['label']));if(!this[_0x999c('0x89')](_0xf67038[_0x999c('0x8c')])||!this[_0x999c('0x89')](_0xf67038[_0x999c('0x8d')])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0x12a'));}if(!this[_0x999c('0x89')](_0xf67038[_0x999c('0x91')])){return this[_0x999c('0x11')]['noop'](_0x999c('0x132'));}if(!this['isConfigured'](_0xf67038[_0x999c('0x60')])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0xb0'));}this[_0x999c('0x11')][_0x999c('0xef')]=!![];this[_0x999c('0x39')](_0xf67038);this[_0x999c('0x46')](_0xf67038[_0x999c('0x60')],'in','','');this['channel']['noop'](util[_0x999c('0x2c')](_0x999c('0x133'),_0xf67038[_0x999c('0x60')]));var _0x285222=this[_0x999c('0x90')][_0x999c('0xaa')](this,_0xf67038);if(_0x285222){for(var _0x19c26e in _0x285222){if(_0x285222[_0x999c('0x98')](_0x19c26e)&&_[_0x999c('0x99')](_0x285222[_0x19c26e])){this[_0x999c('0x11')][_0x999c('0xa2')](util[_0x999c('0x2c')](_0x999c('0x134'),_0x19c26e[_0x999c('0x6f')]()),_0x285222[_0x19c26e]);}}if(_[_0x999c('0x48')](_0x285222[_0x999c('0x7b')])){return this[_0x999c('0x11')][_0x999c('0xaf')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x285222[_0x999c('0x7b')],_0x999c('0xfc'),'amazonlex','');return this[_0x999c('0x11')]['noop'](util['format'](_0x999c('0x135'),_0x285222[_0x999c('0x7b')]));}}return this[_0x999c('0x11')]['error'](_0xf67038,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x999c('0x13')][_0x999c('0x136')]=function(_0x331057){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x137'),_0x331057['label'],_0x331057['timeout']));if(!this[_0x999c('0x89')](_0x331057[_0x999c('0x7e')])){return this['channel'][_0x999c('0xaf')](_0x999c('0xee'));}var _0x45bdcd=_0x999c('0x138');var _0x57222b=util[_0x999c('0x2c')](_0x999c('0x139'),FILES_PATH,rs[_0x999c('0x11f')](0x4));var _0x212dee=util[_0x999c('0x2c')](_0x999c('0xa0'),_0x57222b,_0x45bdcd);var _0x585f91=!![];if(_0x331057['beep']===_0x999c('0x13a')){_0x585f91=![];}var _0x48a090=this[_0x999c('0x11')][_0x999c('0x13b')](_0x57222b,_0x45bdcd,_0x331057[_0x999c('0x13c')],_0x331057[_0x999c('0x69')],undefined,_0x585f91);if(_0x48a090[_0x999c('0xa8')]!==-0x1){this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0x13d'),_0x212dee));var _0x54eee0=this[_0x999c('0x92')][_0x999c('0xaa')](this,_0x331057,_0x212dee);if(_0x54eee0){for(var _0x2d523e in _0x54eee0){if(_0x54eee0[_0x999c('0x98')](_0x2d523e)){this['channel'][_0x999c('0xa2')](util[_0x999c('0x2c')](_0x999c('0x13e'),_0x2d523e['toUpperCase']()),_0x54eee0[_0x2d523e]);}}return this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0x13f'),JSON[_0x999c('0x77')](_0x54eee0)));}}return _0x48a090;};AGIVertices['prototype'][_0x999c('0x140')]=function(_0x41c534){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x141'),_0x41c534['label']));if(!this[_0x999c('0x89')](_0x41c534[_0x999c('0x95')])){return this['channel'][_0x999c('0xaf')](_0x999c('0x142'));}if(!this['isConfigured'](_0x41c534['appsecret'])){return this[_0x999c('0x11')]['noop'](_0x999c('0x143'));}var _0xcd56ee=_0x999c('0x138');var _0x15aabb=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x999c('0x11f')](0x4));var _0x549161=util[_0x999c('0x2c')](_0x999c('0xa0'),_0x15aabb,_0xcd56ee);var _0x26888e=!![];if(_0x41c534['beep']===_0x999c('0x13a')){_0x26888e=![];}var _0x130614=this[_0x999c('0x11')]['recordFile'](_0x15aabb,_0xcd56ee,_0x41c534[_0x999c('0x13c')],_0x41c534['timeout'],undefined,_0x26888e);if(_0x130614[_0x999c('0xa8')]!==-0x1){this[_0x999c('0x11')][_0x999c('0xaf')](util['format'](_0x999c('0x144'),_0x549161));var _0x2c7542=this[_0x999c('0x94')][_0x999c('0xaa')](this,_0x41c534,_0x549161);if(_0x2c7542){for(var _0x1cb9ac in _0x2c7542){if(_0x2c7542[_0x999c('0x98')](_0x1cb9ac)){this[_0x999c('0x11')][_0x999c('0xa2')](util[_0x999c('0x2c')](_0x999c('0x145'),_0x1cb9ac[_0x999c('0x6f')]()),_0x2c7542[_0x1cb9ac]);}}return this[_0x999c('0x11')][_0x999c('0xaf')](util['format'](_0x999c('0x146'),JSON[_0x999c('0x77')](_0x2c7542)));}}return _0x130614;};AGIVertices[_0x999c('0x13')][_0x999c('0x147')]=function(_0x544e1e){logger[_0x999c('0x32')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x544e1e[_0x999c('0x3b')]));return this[_0x999c('0x11')][_0x999c('0x148')](_0x544e1e[_0x999c('0x41')],_0x544e1e[_0x999c('0x42')],_0x544e1e[_0x999c('0x43')]);};AGIVertices[_0x999c('0x13')][_0x999c('0x149')]=function(_0x312b4a){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x14a'),_0x312b4a[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x312b4a['condition'])){return this[_0x999c('0x11')]['error'](_0x312b4a,'no\x20condition\x20configured');}try{var _0x3b1e51=eval(_0x312b4a['condition'])?_0x999c('0x14b'):_0x999c('0x14c');this[_0x999c('0x11')][_0x999c('0xaf')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x312b4a[_0x999c('0x14d')],_0x3b1e51));return{'code':0xc8,'result':_0x3b1e51};}catch(_0x28c944){return{'code':0xc8,'result':_0x999c('0x14c')};}};AGIVertices[_0x999c('0x13')][_0x999c('0x14e')]=function(_0x266c10){logger['info'](util[_0x999c('0x2c')](_0x999c('0x14f'),_0x266c10[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x266c10[_0x999c('0x150')])){return this[_0x999c('0x11')]['error'](_0x266c10,_0x999c('0x151'));}var _0x50540a=this[_0x999c('0x27')]['sync'](this,_0x266c10['interval_id']);if(!_0x50540a){return this[_0x999c('0x11')][_0x999c('0x2e')](_0x266c10,_0x999c('0x152'));}for(var _0x3400a9=0x0;_0x3400a9<_0x50540a[_0x999c('0xa1')];_0x3400a9+=0x1){var _0x3c2b33=this[_0x999c('0x11')][_0x999c('0xa7')](util[_0x999c('0x2c')]('IFTIME(%s?true:false)',_0x50540a[_0x3400a9]));if(_0x3c2b33[_0x999c('0xa8')]===-0x1){return _0x3c2b33;}logger['info'](util[_0x999c('0x2c')](_0x999c('0x153'),_0x50540a[_0x3400a9],_0x3c2b33['extra']));if(_0x3c2b33[_0x999c('0xa5')]===_0x999c('0x14b')){logger['info'](util[_0x999c('0x2c')](_0x999c('0x153'),_0x50540a[_0x3400a9],_0x999c('0x14b')));this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0x153'),_0x50540a[_0x3400a9],'true'));return{'code':0xc8,'result':_0x999c('0x14b')};}else{logger[_0x999c('0x32')](util[_0x999c('0x2c')]('IFTIME\x20%s\x20%s',_0x50540a[_0x3400a9],_0x999c('0x14c')));this['channel'][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0x153'),_0x50540a[_0x3400a9],'false'));}}return{'code':0xc8,'result':_0x999c('0x14c')};};AGIVertices[_0x999c('0x13')][_0x999c('0x154')]=function(_0x28404c){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x155'),_0x28404c[_0x999c('0x3b')]));return this[_0x999c('0x11')][_0x999c('0x154')]();};AGIVertices[_0x999c('0x13')]['ispeechasr']=function(_0x334749){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x156'),_0x334749[_0x999c('0x3b')]));if(!this['isConfigured'](_0x334749[_0x999c('0x7e')])){return this[_0x999c('0x11')][_0x999c('0xaf')]('no\x20key\x20configured');}var _0x4964ad=_0x999c('0x138');var _0xe82c1a=util['format'](_0x999c('0x139'),FILES_PATH,rs[_0x999c('0x11f')](0x4));var _0x512b41=util[_0x999c('0x2c')](_0x999c('0xa0'),_0xe82c1a,_0x4964ad);var _0x982e0b=!![];if(_0x334749[_0x999c('0x157')]===_0x999c('0x13a')){_0x982e0b=![];}var _0x577985=this[_0x999c('0x11')]['recordFile'](_0xe82c1a,_0x4964ad,_0x334749[_0x999c('0x13c')],_0x334749[_0x999c('0x69')],undefined,_0x982e0b);if(_0x577985[_0x999c('0xa8')]!==-0x1){this[_0x999c('0x11')]['noop'](util[_0x999c('0x2c')](_0x999c('0x158'),_0x512b41));var _0x28758e=this['ispeechASR'][_0x999c('0xaa')](this,_0x334749,_0x512b41);if(_0x28758e){for(var _0x564753 in _0x28758e){if(_0x28758e[_0x999c('0x98')](_0x564753)){this[_0x999c('0x11')][_0x999c('0xa2')](util[_0x999c('0x2c')]('ISPEECH_ASR_%s',_0x564753['toUpperCase']()),_0x28758e[_0x564753]);}}return this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0x159'),JSON[_0x999c('0x77')](_0x28758e)));}}return _0x577985;};AGIVertices[_0x999c('0x13')]['ispeechtts']=function(_0x22657){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x15a'),_0x22657['label']));if(!this[_0x999c('0x89')](_0x22657['key'])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0xee'));}if(!this['isConfigured'](_0x22657[_0x999c('0x60')])){return this[_0x999c('0x11')]['noop'](_0x999c('0xb0'));}this[_0x999c('0x11')]['noop'](util[_0x999c('0x2c')](_0x999c('0x15b'),_0x22657['text']));var _0x5c1242=this['ispeechTTS'][_0x999c('0xaa')](this,_0x22657);if(_0x5c1242){this[_0x999c('0x11')][_0x999c('0xaf')](util['format'](_0x999c('0x158'),_0x5c1242));var _0x3e2781=this[_0x999c('0x11')]['streamFile'](_0x5c1242,_0x22657[_0x999c('0x13c')]);try{fs[_0x999c('0x106')](_0x5c1242+_0x999c('0x12e'));}catch(_0x2fa34c){logger['error'](_0x2fa34c);}return _0x3e2781;}return this[_0x999c('0x11')]['error'](_0x22657,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x999c('0x13')][_0x999c('0x15c')]=function(_0x4adff5){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x15d'),_0x4adff5[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x4adff5[_0x999c('0x15e')])){return this['channel'][_0x999c('0x2e')](_0x4adff5,_0x999c('0x15f'));}logger[_0x999c('0x32')](util['format'](_0x999c('0x160'),this[_0x999c('0x11')][_0x999c('0x3e')],_0x4adff5[_0x999c('0x15e')]));var _0x351c77=this['agentLogin'][_0x999c('0xaa')](this,_0x4adff5[_0x999c('0x15e')]);if(_0x351c77){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x161'),this[_0x999c('0x11')][_0x999c('0x3e')],_0x4adff5[_0x999c('0x15e')]));this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x999c('0x11')][_0x999c('0x3e')],_0x4adff5[_0x999c('0x15e')]));return{'code':0xc8,'result':_0x999c('0x162')};}else{logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x163'),this[_0x999c('0x11')][_0x999c('0x3e')],_0x4adff5[_0x999c('0x15e')]));this['channel'][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0x163'),this[_0x999c('0x11')][_0x999c('0x3e')],_0x4adff5[_0x999c('0x15e')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x999c('0x164')]=function(_0x46b0b6){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x165'),_0x46b0b6[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x46b0b6[_0x999c('0x15e')])){return this[_0x999c('0x11')]['error'](_0x46b0b6,_0x999c('0x15f'));}logger['info'](util['format'](_0x999c('0x160'),this[_0x999c('0x11')][_0x999c('0x3e')],_0x46b0b6[_0x999c('0x15e')]));var _0x3f353a=this[_0x999c('0x56')][_0x999c('0xaa')](this,_0x46b0b6[_0x999c('0x15e')]);if(_0x3f353a){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x161'),this[_0x999c('0x11')]['callerid'],_0x46b0b6['findBy']));this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x999c('0x11')][_0x999c('0x3e')],_0x46b0b6[_0x999c('0x15e')]));return{'code':0xc8,'result':_0x999c('0x162')};}else{logger[_0x999c('0x32')](util[_0x999c('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x999c('0x11')][_0x999c('0x3e')],_0x46b0b6['findBy']));this[_0x999c('0x11')]['noop'](util[_0x999c('0x2c')](_0x999c('0x163'),this[_0x999c('0x11')][_0x999c('0x3e')],_0x46b0b6[_0x999c('0x15e')]));return{'code':0xc8,'result':_0x999c('0x166')};}};AGIVertices['prototype'][_0x999c('0x167')]=function(_0x3c10ff){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x168'),_0x3c10ff['label']));if(!this['isConfigured'](_0x3c10ff[_0x999c('0x169')])){return this[_0x999c('0x11')][_0x999c('0x2e')](_0x3c10ff,'no\x20operation\x20configured');}this['channel'][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0x16a'),_0x3c10ff['operation']));var _0x50dba8=eval(_0x3c10ff[_0x999c('0x169')]);if(!this['isConfigured'](_0x3c10ff[_0x999c('0xdc')])){return this['channel'][_0x999c('0xaf')](_0x999c('0xdd'));}var _0x249e27=this[_0x999c('0xa7')][_0x999c('0xaa')](this,_0x3c10ff[_0x999c('0xdc')]);if(!_0x249e27){return this[_0x999c('0x11')][_0x999c('0x2e')](_0x3c10ff,_0x999c('0xde'));}if(_[_0x999c('0x9d')](_0x50dba8)){var _0x580e2e=this;_0x50dba8['forEach'](function(_0x1d0db7,_0x26d854){_0x580e2e[_0x999c('0x11')][_0x999c('0xa2')](util[_0x999c('0x2c')](_0x999c('0x16b'),_0x249e27,_0x26d854),_0x1d0db7);});return this[_0x999c('0x11')]['noop'](util[_0x999c('0x2c')](_0x999c('0x16c'),_0x249e27));}else{return this[_0x999c('0x11')]['setVariable'](_0x249e27,_0x50dba8);}};AGIVertices['prototype'][_0x999c('0xe')]=function(_0x2cf44d){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x16d'),_0x2cf44d[_0x999c('0x3b')]));if(_0x2cf44d[_0x999c('0xab')]===0x0){return this['maxRetry'](_0x2cf44d);}_0x2cf44d[_0x999c('0xab')]-=0x1;if(!this[_0x999c('0x89')](_0x2cf44d['file_id'])){return this[_0x999c('0x11')][_0x999c('0x2e')](_0x2cf44d,_0x999c('0x116'));}var _0x3c5ca7=this[_0x999c('0x117')][_0x999c('0xaa')](this,_0x2cf44d[_0x999c('0x115')]);if(!_0x3c5ca7){return this[_0x999c('0x11')]['error'](_0x2cf44d,_0x999c('0x118'));}var _0x51e31d=this['channel'][_0x999c('0x119')](_0x3c5ca7,_0x2cf44d[_0x999c('0x11a')],_0x2cf44d[_0x999c('0x16e')]);var _0x2f7e4a=_0x51e31d[_0x999c('0xa8')];if(_0x51e31d['result']===-0x1){this['createSquareDetailsReport'][_0x999c('0xaa')](this,_0x2cf44d,'-1');return _0x51e31d;}else if(_0x51e31d[_0x999c('0xa5')]===_0x999c('0x69')){_0x51e31d[_0x999c('0xa8')]=_0x51e31d['result'][_0x999c('0xa1')]>0x0?_0x51e31d[_0x999c('0xa8')]:'t';}else if(_[_0x999c('0x4b')](_0x51e31d[_0x999c('0xa8')])){_0x51e31d[_0x999c('0xa8')]='#';_0x2f7e4a='#';}if(!this[_0x999c('0x89')](_0x2cf44d[_0x999c('0xdc')])){this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0xdd'));}else{var _0x34d861=this[_0x999c('0xa7')][_0x999c('0xaa')](this,_0x2cf44d[_0x999c('0xdc')]);if(!_0x34d861){return this['channel']['error'](_0x2cf44d,_0x999c('0xde'));}this[_0x999c('0x11')]['setVariable'](_0x34d861,_0x2f7e4a);}this[_0x999c('0x39')]['sync'](this,_0x2cf44d,_0x2f7e4a);return _0x51e31d;};AGIVertices['prototype'][_0x999c('0xaf')]=function(_0x1a5a09){logger['info'](util['format'](_0x999c('0x16f'),_0x1a5a09[_0x999c('0x3b')]));return this[_0x999c('0x11')][_0x999c('0xaf')](_0x1a5a09['output']||_0x1a5a09['label']);};AGIVertices[_0x999c('0x13')][_0x999c('0x170')]=function(_0x1b17c4){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x171'),_0x1b17c4[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x1b17c4['findBy'])){return this[_0x999c('0x11')][_0x999c('0x2e')](_0x1b17c4,_0x999c('0x15f'));}logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x160'),this[_0x999c('0x11')]['callerid'],_0x1b17c4[_0x999c('0x15e')]));var _0x243102=this[_0x999c('0x52')][_0x999c('0xaa')](this,_0x1b17c4[_0x999c('0x172')]);var _0x48c61c=this['agentPause'][_0x999c('0xaa')](this,_0x1b17c4[_0x999c('0x15e')],_0x243102);if(_0x48c61c){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x999c('0x11')][_0x999c('0x3e')],_0x1b17c4[_0x999c('0x15e')]));this[_0x999c('0x11')]['noop'](util['format'](_0x999c('0x161'),this['channel'][_0x999c('0x3e')],_0x1b17c4[_0x999c('0x15e')]));return{'code':0xc8,'result':_0x999c('0x162')};}else{logger['info'](util['format'](_0x999c('0x163'),this['channel'][_0x999c('0x3e')],_0x1b17c4[_0x999c('0x15e')]));this[_0x999c('0x11')]['noop'](util[_0x999c('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x999c('0x11')][_0x999c('0x3e')],_0x1b17c4[_0x999c('0x15e')]));return{'code':0xc8,'result':_0x999c('0x166')};}};AGIVertices[_0x999c('0x13')][_0x999c('0x173')]=function(_0x56dad0){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x174'),_0x56dad0[_0x999c('0x3b')]));if(!this['isConfigured'](_0x56dad0[_0x999c('0x115')])){return this[_0x999c('0x11')]['error'](_0x56dad0,_0x999c('0x116'));}var _0x61d278=this[_0x999c('0x117')][_0x999c('0xaa')](this,_0x56dad0[_0x999c('0x115')]);if(!_0x61d278){return this['channel']['error'](_0x56dad0,_0x999c('0x118'));}var _0x1784f8=this[_0x999c('0x11')]['exec'](_0x999c('0x175'),[_0x61d278,_0x56dad0[_0x999c('0xeb')]]);if(_0x1784f8[_0x999c('0xa8')]===-0x1){return _0x1784f8;}return this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')]('Executed\x20command\x20%s\x20%s',_0x999c('0x175'),_0x61d278));};AGIVertices[_0x999c('0x13')][_0x999c('0x176')]=function(_0x34d590){logger[_0x999c('0x32')](util['format'](_0x999c('0x177'),_0x34d590[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x34d590['queue_id'])){return this[_0x999c('0x11')][_0x999c('0x2e')](_0x34d590,_0x999c('0x178'));}var _0xd62ace='';var _0x56ebc7=parseInt(_0x34d590[_0x999c('0x179')],0xa);if(isNaN(_0x56ebc7)){_0xd62ace=_0x34d590[_0x999c('0x179')];}else{_0xd62ace=this[_0x999c('0x19')]['sync'](this,_0x34d590[_0x999c('0x179')]);if(!_0xd62ace){return this[_0x999c('0x11')][_0x999c('0x2e')](_0x34d590,_0x999c('0x17a'));}}var _0x5159c8='';if(this[_0x999c('0x89')](_0x34d590['file_id'])){var _0xb53ab1=this['getSound'][_0x999c('0xaa')](this,_0x34d590[_0x999c('0x115')]);if(_0xb53ab1){_0x5159c8=_0xb53ab1;}}this[_0x999c('0x39')][_0x999c('0xaa')](this,_0x34d590,_0xd62ace);if(_0x34d590[_0x999c('0xeb')]['indexOf']('x')<0x0){_0x34d590['opts']+='x';}if(_0x34d590[_0x999c('0xeb')]['indexOf']('X')<0x0){_0x34d590[_0x999c('0xeb')]+='X';}this['channel']['setVariable']('XMCS-QUEUE',_0xd62ace?_0xd62ace[_0x999c('0x17b')]():'');var _0x52c0ad=this[_0x999c('0x11')][_0x999c('0xb1')](_0x999c('0x17c'),[_0xd62ace,_0x34d590[_0x999c('0xeb')],_0x34d590[_0x999c('0x68')],_0x5159c8,_0x34d590[_0x999c('0x69')],_0x34d590[_0x999c('0x8')],_0x34d590[_0x999c('0x17d')],_0x34d590[_0x999c('0x17e')],'',_0x34d590['position']]);if(_0x52c0ad[_0x999c('0xa8')]===-0x1){return _0x52c0ad;}return this['channel'][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0xc9'),_0x999c('0x17c'),_0xd62ace));};AGIVertices[_0x999c('0x13')][_0x999c('0x17f')]=function(_0x44a84a){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x180'),_0x44a84a[_0x999c('0x3b')]));var _0x23d66e=_0x44a84a['recordingFormat']||_0x999c('0x138');var _0x1286b9=util[_0x999c('0x2c')](_0x999c('0x181'),this[_0x999c('0x11')][_0x999c('0x3a')],rs[_0x999c('0x11f')](0x5));var _0x3c5773=util[_0x999c('0x2c')](_0x999c('0x182'),FILES_PATH,_0x1286b9,_0x23d66e);var _0x3648a4=util['format'](_0x999c('0x139'),FILES_PATH,_0x1286b9);this[_0x999c('0x3f')][_0x999c('0xaa')](this,_0x44a84a,_0x1286b9,_0x3c5773);this[_0x999c('0x11')][_0x999c('0xa2')](_0x999c('0x183'),_0x1286b9);logger[_0x999c('0x32')](_0x999c('0x184'),_0x3648a4,_0x23d66e,_0x44a84a['escape_digits'],_0x44a84a['timeout']);return this[_0x999c('0x11')][_0x999c('0x13b')](_0x3648a4,_0x23d66e,_0x44a84a['escape_digits'],_0x44a84a['timeout'],undefined,!![]);};AGIVertices[_0x999c('0x13')][_0x999c('0x185')]=function(_0x3e388f){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x186'),_0x3e388f[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x3e388f[_0x999c('0x68')])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0x187'));}var _0x5e49ff=this[_0x999c('0x188')][_0x999c('0xaa')](this,_0x3e388f);logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x189'),util[_0x999c('0x18a')](_0x5e49ff,{'showHidden':![],'depth':null})));if(!this[_0x999c('0x89')](_0x3e388f['variable_id'])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0x18b'));}var _0x172017=this[_0x999c('0xa7')][_0x999c('0xaa')](this,_0x3e388f[_0x999c('0xdc')]);if(!_0x172017){return this[_0x999c('0x11')][_0x999c('0x2e')](_0x3e388f,_0x999c('0xde'));}this[_0x999c('0x11')][_0x999c('0xa2')](util[_0x999c('0x2c')](_0x999c('0x18c'),_0x172017),_0x5e49ff[_0x999c('0x79')]?_0x5e49ff[_0x999c('0x79')]:_0x999c('0x18d'));this[_0x999c('0x11')]['setVariable'](util[_0x999c('0x2c')](_0x999c('0x18e'),_0x172017),_0x5e49ff[_0x999c('0x7a')]?_0x5e49ff[_0x999c('0x7a')]:'OK');if(_0x5e49ff['body']){try{this[_0x999c('0x9f')](_0x5e49ff[_0x999c('0x70')],_0x172017);}catch(_0x95500b){logger[_0x999c('0x2e')](util[_0x999c('0x2c')](_0x999c('0x18f'),_0x172017));}}return this[_0x999c('0x11')]['noop'](util[_0x999c('0x2c')](_0x999c('0xe3'),_0x172017));};AGIVertices[_0x999c('0x13')]['saydigits']=function(_0x3309f9){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x190'),_0x3309f9[_0x999c('0x3b')]));return this[_0x999c('0x11')][_0x999c('0x191')](_0x3309f9[_0x999c('0x192')][_0x999c('0x5c')](/\s+/g,''),_0x3309f9[_0x999c('0x193')]);};AGIVertices[_0x999c('0x13')][_0x999c('0x194')]=function(_0x439345){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x195'),_0x439345['label']));return this[_0x999c('0x11')][_0x999c('0x196')](_0x439345[_0x999c('0x6a')][_0x999c('0x5c')](/\s+/g,''),_0x439345[_0x999c('0x193')]);};AGIVertices[_0x999c('0x13')][_0x999c('0x197')]=function(_0x1cb4dc){logger['info'](util[_0x999c('0x2c')](_0x999c('0x198'),_0x1cb4dc[_0x999c('0x3b')]));return this[_0x999c('0x11')][_0x999c('0x199')](_0x1cb4dc[_0x999c('0x60')],_0x1cb4dc[_0x999c('0x193')]);};AGIVertices[_0x999c('0x13')][_0x999c('0x19a')]=function(_0x4081c0){logger[_0x999c('0x32')](util['format']('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x4081c0[_0x999c('0x3b')]));if(!this['isConfigured'](_0x4081c0[_0x999c('0x19b')])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0x19c'));}var _0x43225a=this[_0x999c('0x25')][_0x999c('0xaa')](this,_0x4081c0[_0x999c('0x19b')]);if(!_0x43225a||!_0x43225a[_0x999c('0x19d')]){return this[_0x999c('0x11')]['error'](_0x4081c0,'no\x20mail\x20account\x20found');}var _0x2ceb53={'from':util[_0x999c('0x2c')](_0x999c('0x19e'),_0x43225a[_0x999c('0x17')],_0x43225a[_0x999c('0x19f')]||_0x43225a['Smtp'][_0x999c('0x1a0')]),'to':_0x4081c0['to']||'','cc':_0x4081c0['cc']||'','bcc':_0x4081c0['bcc']||'','subject':_0x4081c0[_0x999c('0x1a1')],'html':_0x4081c0[_0x999c('0x60')],'text':_0x4081c0[_0x999c('0x60')]};if(this[_0x999c('0x89')](_0x4081c0['template_id'])){}logger[_0x999c('0xe5')](_0x999c('0x1a2'),JSON[_0x999c('0x77')](_0x2ceb53));this['createSquareDetailsReport'][_0x999c('0xaa')](this,_0x4081c0,_0x4081c0[_0x999c('0x19b')]);this[_0x999c('0x11')]['noop'](util[_0x999c('0x2c')](_0x999c('0x1a3'),_0x43225a[_0x999c('0x17')]));this[_0x999c('0x26')][_0x999c('0xaa')](this,_0x43225a['smtpOptions'],_0x2ceb53);return this[_0x999c('0x11')][_0x999c('0xaf')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x999c('0x13')][_0x999c('0x1a4')]=function(_0xedf544){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x1a5'),_0xedf544['label']));return this['channel'][_0x999c('0xaf')](_0x999c('0x1a6'));};AGIVertices[_0x999c('0x13')]['sendSMS']=function(_0x5f0d48){logger[_0x999c('0x32')](util['format'](_0x999c('0x1a7'),_0x5f0d48[_0x999c('0x3b')]));if(!this['isConfigured'](_0x5f0d48[_0x999c('0x1a8')])){return this['channel'][_0x999c('0xaf')]('no\x20sms\x20account\x20configured');}var _0x573dea=this['getSmsAccount']['sync'](this,_0x5f0d48['sms_account_id']);if(!_0x573dea){return this['channel']['error'](_0x5f0d48,_0x999c('0x1a9'));}var _0xb094bf={'body':_0x5f0d48[_0x999c('0x1aa')],'phone':_0x5f0d48['to']||'','SmsAccountId':_0x573dea['id']};logger['debug'](_0x999c('0x1ab'),JSON['stringify'](_0xb094bf));this[_0x999c('0x39')]['sync'](this,_0x5f0d48,_0x5f0d48['sms_account_id']);this['channel']['noop'](util[_0x999c('0x2c')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x573dea[_0x999c('0x17')]));this[_0x999c('0x38')][_0x999c('0xaa')](this,_0xb094bf);return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0x1ac'));};AGIVertices[_0x999c('0x13')]['set']=function(_0x25086e){logger['info'](util[_0x999c('0x2c')](_0x999c('0x1ad'),_0x25086e[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x25086e[_0x999c('0xdc')])){return this[_0x999c('0x11')][_0x999c('0x2e')](_0x25086e,_0x999c('0x1ae'));}var _0x1aa957=this['getVariable'][_0x999c('0xaa')](this,_0x25086e[_0x999c('0xdc')]);if(!_0x1aa957){return this[_0x999c('0x11')]['error'](_0x25086e,_0x999c('0xde'));}return this[_0x999c('0x11')][_0x999c('0xa2')](_0x1aa957,_0x25086e['variable_value']);};AGIVertices[_0x999c('0x13')][_0x999c('0x1af')]=function(_0x31dbc4){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x1b0'),_0x31dbc4['label']));this['channel'][_0x999c('0xaf')](_0x999c('0x1b1'));var _0x37d49b=this[_0x999c('0x11')][_0x999c('0xa7')](_0x999c('0x1b2'));if(!_[_0x999c('0x4b')](_0x37d49b[_0x999c('0xa5')])){this[_0x999c('0x11')][_0x999c('0x3a')]=_0x37d49b[_0x999c('0xa5')];}if(_0x31dbc4[_0x999c('0xbf')]===_0x999c('0x1b3')){this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0x1b4'));return this['channel'][_0x999c('0xbf')]();}return this[_0x999c('0x11')][_0x999c('0xaf')]('Skipped\x20Answer');};AGIVertices[_0x999c('0x13')][_0x999c('0x1b5')]=function(_0xc55237){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x1b6'),_0xc55237[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0xc55237[_0x999c('0x1b7')])){return this['channel']['error'](_0xc55237,_0x999c('0x1b8'));}var _0x4f52f9=this['getSquareProject'][_0x999c('0xaa')](this,_0xc55237[_0x999c('0x1b7')]);if(!this['isConfigured'](_0x4f52f9)){return this[_0x999c('0x11')][_0x999c('0x2e')](_0xc55237,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0xc55237[_0x999c('0x1b7')]));}if(_0x4f52f9===this[_0x999c('0x11')]['arg_1']){return this['channel'][_0x999c('0x2e')](_0xc55237,_0x999c('0x1b9'));}this[_0x999c('0x39')][_0x999c('0xaa')](this,_0xc55237,_0x4f52f9);var _0x38f992=this[_0x999c('0x11')]['exec'](_0x999c('0x1ba'),util[_0x999c('0x2c')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x999c('0x8')][_0x999c('0x1bb')]||'127.0.0.1',_0x4f52f9,this[_0x999c('0x11')]['arg_1']));if(_0x38f992[_0x999c('0xa8')]===-0x1){return _0x38f992;}return this['channel'][_0x999c('0xaf')](util['format'](_0x999c('0xc9'),_0x999c('0x1ba'),_0x4f52f9));};AGIVertices[_0x999c('0x13')]['system']=function(_0xa4b49b){logger[_0x999c('0x32')](util[_0x999c('0x2c')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0xa4b49b['label']));var _0x4f96e5=this[_0x999c('0x5a')][_0x999c('0xaa')](this,_0xa4b49b[_0x999c('0xbe')]);this[_0x999c('0x39')][_0x999c('0xaa')](this,_0xa4b49b,_0xa4b49b[_0x999c('0xbe')]);if(this['isConfigured'](_0xa4b49b['variable_id'])){var _0x2b6f06=this[_0x999c('0xa7')][_0x999c('0xaa')](this,_0xa4b49b['variable_id']);if(_0x2b6f06){this[_0x999c('0x11')]['setVariable'](_0x2b6f06,_0x4f96e5);return this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0x1bc'),_0xa4b49b[_0x999c('0xbe')],_0x2b6f06));}}return this[_0x999c('0x11')][_0x999c('0xaf')](util['format'](_0x999c('0x1bd'),_0xa4b49b[_0x999c('0xbe')]));};AGIVertices[_0x999c('0x13')][_0x999c('0x1be')]=function(_0x4a3f5d){logger['info'](util[_0x999c('0x2c')](_0x999c('0x1bf'),_0x4a3f5d[_0x999c('0x3b')]));_0x4a3f5d[_0x999c('0x60')]=_0x4a3f5d[_0x999c('0x60')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x4a3f5d[_0x999c('0x5e')])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0x1c0'));}if(!this[_0x999c('0x89')](_0x4a3f5d['text'])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0xb0'));}this['channel']['noop'](util[_0x999c('0x2c')](_0x999c('0x1c1'),_0x4a3f5d['text']));var _0x1d953e=this['googleCloudTTS'][_0x999c('0xaa')](this,_0x4a3f5d);if(_0x1d953e){this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0x1c2'),_0x1d953e));var _0x275ffa=this[_0x999c('0x11')][_0x999c('0x12d')](_0x1d953e);try{fs['unlink'](_0x1d953e+_0x999c('0x12e'));}catch(_0x258147){logger[_0x999c('0x2e')](_0x258147);}return _0x275ffa;}return this['channel'][_0x999c('0x2e')](_0x4a3f5d,_0x999c('0x1c3'));};AGIVertices[_0x999c('0x13')]['tts']=function(_0x4fe562){logger[_0x999c('0x32')](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x4fe562['label']));_0x4fe562['text']=_0x4fe562['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x999c('0x89')](_0x4fe562['text'])){return this[_0x999c('0x11')][_0x999c('0xaf')](_0x999c('0xb0'));}this['channel'][_0x999c('0xaf')](util[_0x999c('0x2c')](_0x999c('0x1c4'),_0x4fe562[_0x999c('0x60')]));var _0x456af8=this[_0x999c('0x67')][_0x999c('0xaa')](this,_0x4fe562);if(_0x456af8){this[_0x999c('0x11')]['noop'](util['format'](_0x999c('0x1c5'),_0x456af8));var _0xdeef9b=this[_0x999c('0x11')][_0x999c('0x12d')](_0x456af8);try{fs[_0x999c('0x106')](_0x456af8+_0x999c('0x12e'));}catch(_0x20e56e){logger[_0x999c('0x2e')](_0x20e56e);}return _0xdeef9b;}return this['channel'][_0x999c('0x2e')](_0x4fe562,_0x999c('0x1c6'));};AGIVertices[_0x999c('0x13')][_0x999c('0x1c7')]=function(_0x1567b8){logger[_0x999c('0x32')](util[_0x999c('0x2c')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x1567b8[_0x999c('0x3b')]));if(!this[_0x999c('0x89')](_0x1567b8[_0x999c('0x15e')])){return this['channel'][_0x999c('0x2e')](_0x1567b8,'no\x20find\x20by\x20configured');}logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x160'),this['channel'][_0x999c('0x3e')],_0x1567b8[_0x999c('0x15e')]));var _0x11c683=this[_0x999c('0x55')]['sync'](this,_0x1567b8[_0x999c('0x15e')]);if(_0x11c683){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x161'),this[_0x999c('0x11')][_0x999c('0x3e')],_0x1567b8[_0x999c('0x15e')]));this[_0x999c('0x11')]['noop'](util[_0x999c('0x2c')](_0x999c('0x161'),this['channel']['callerid'],_0x1567b8['findBy']));return{'code':0xc8,'result':_0x999c('0x162')};}else{logger[_0x999c('0x32')](util[_0x999c('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x999c('0x3e')],_0x1567b8[_0x999c('0x15e')]));this[_0x999c('0x11')][_0x999c('0xaf')](util[_0x999c('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x999c('0x11')]['callerid'],_0x1567b8[_0x999c('0x15e')]));return{'code':0xc8,'result':_0x999c('0x166')};}};AGIVertices[_0x999c('0x13')]['voicemail']=function(_0x36ca62){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x1c8'),_0x36ca62['label']));var _0x1dc7a4=this[_0x999c('0x11')][_0x999c('0xb1')](_0x999c('0x1c9'),[_0x36ca62[_0x999c('0x1ca')],_0x36ca62['options']]);if(_0x1dc7a4[_0x999c('0xa8')]===-0x1){return _0x1dc7a4;}return this[_0x999c('0x11')]['noop'](util['format'](_0x999c('0xc9'),_0x999c('0x1c9'),_0x36ca62[_0x999c('0x1ca')]));};AGIVertices[_0x999c('0x13')][_0x999c('0x1cb')]=function(_0x342fb2){logger[_0x999c('0x32')](util[_0x999c('0x2c')](_0x999c('0x1cc'),_0x342fb2['label']));if(!this[_0x999c('0x89')](_0x342fb2[_0x999c('0xdc')])){return this['channel'][_0x999c('0x2e')](_0x342fb2,_0x999c('0x1ae'));}var _0x1b1c51=this[_0x999c('0xa7')]['sync'](this,_0x342fb2['variable_id']);if(!_0x1b1c51){return this['channel'][_0x999c('0x2e')](_0x342fb2,_0x999c('0xde'));}var _0x1215ac=this[_0x999c('0x11')][_0x999c('0xa7')](_0x1b1c51);return{'code':0xc8,'result':_0x1215ac[_0x999c('0xa5')]?_0x1215ac['extra']:'-'};};String[_0x999c('0x13')]['replaceAll']=function(_0xa5faf8,_0x25d1a2){return this[_0x999c('0xa3')](_0xa5faf8)[_0x999c('0x1cd')](_0x25d1a2);};module[_0x999c('0x1ce')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 14c74f2..e959253 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 _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 +var _0x0a6b=['syncAgentConnect','bind','hangup','syncHangup','agentringnoanswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','updateAcw','timer','update','then','info','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','finally','prototype','startAcw','interface','channels','queue','mandatoryDisposition','mandatoryDispositionPause','name','resolve','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','error','[ACW][START]\x20%s','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','message','[ACW][syncHangup]\x20%s','transfereeuniqueid','transfertargetuniqueid','secondtransfereruniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect'];(function(_0x39c12e,_0x585534){var _0x58dbf4=function(_0xd35390){while(--_0xd35390){_0x39c12e['push'](_0x39c12e['shift']());}};_0x58dbf4(++_0x585534);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x29b7a6,_0x71a735){_0x29b7a6=_0x29b7a6-0x0;var _0x1add01=_0x0a6b[_0x29b7a6];return _0x1add01;};'use strict';var _=require(_0xb0a6('0x0'));var moment=require('moment');var ami=require('../ami');var logger=require('../../../config/logger')(_0xb0a6('0x1'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xb0a6('0x2'));function Acw(_0x13dc41){this[_0xb0a6('0x3')]=_0x13dc41['voiceQueues'];this[_0xb0a6('0x4')]=_0x13dc41['agents'];this[_0xb0a6('0x5')]=_0x13dc41[_0xb0a6('0x5')];this['channels']={};ami['on'](_0xb0a6('0x6'),this[_0xb0a6('0x7')][_0xb0a6('0x8')](this));ami['on']('hanguprequest',this['syncHangupRequest']['bind'](this));ami['on'](_0xb0a6('0x9'),this[_0xb0a6('0xa')][_0xb0a6('0x8')](this));ami['on'](_0xb0a6('0xb'),this['syncAgentRingNoAnswer'][_0xb0a6('0x8')](this));ami['on'](_0xb0a6('0xc'),this['syncAttendedTransfer'][_0xb0a6('0x8')](this));ami['on'](_0xb0a6('0xd'),this[_0xb0a6('0xe')][_0xb0a6('0x8')](this));ami['on'](_0xb0a6('0xf'),this[_0xb0a6('0x10')][_0xb0a6('0x8')](this));}function getDiff(_0x425b97){var _0x392f48=moment()[_0xb0a6('0x11')](0x0);var _0x513853=moment(_0x425b97)[_0xb0a6('0x11')](0x0);return _0x392f48['diff'](_0x513853,_0xb0a6('0x12'));}Acw['prototype'][_0xb0a6('0x13')]=function(_0x59730e,_0x1d837f){var _0x382c2f=this;var _0x93243e=getDiff(_0x382c2f['timers'][_0x59730e]['lastPauseAt']);clearTimeout(_0x382c2f[_0xb0a6('0x5')][_0x59730e][_0xb0a6('0x14')]);_0x382c2f[_0xb0a6('0x5')][_0x59730e][_0xb0a6('0x14')]=![];return RpcVoiceAgentReport[_0xb0a6('0x15')]({'acwtime':_0x93243e},_0x382c2f[_0xb0a6('0x5')][_0x59730e]['uniqueid'],_0x59730e)[_0xb0a6('0x16')](function(_0x883503){logger[_0xb0a6('0x17')](_0xb0a6('0x18'),_0x1d837f,_0x93243e,_0x883503);})[_0xb0a6('0x19')](function(_0x30ac04){logger['error'](_0xb0a6('0x1a'),_0x1d837f,_0x30ac04);})[_0xb0a6('0x1b')](function(){delete _0x382c2f[_0xb0a6('0x5')][_0x59730e];});};Acw[_0xb0a6('0x1c')][_0xb0a6('0x1d')]=function(_0x10e56b){try{var _0x27db00=this;var _0x16e053=this['channels'][_0x10e56b][_0xb0a6('0x1e')];var _0x5c6e66=this[_0xb0a6('0x1f')][_0x10e56b][_0xb0a6('0x20')];var _0x4997df=this['voiceQueues'][_0x5c6e66];var _0x10d753=![];var _0x14993f='ACW';if(_0x4997df[_0xb0a6('0x21')]&&_0x4997df[_0xb0a6('0x22')][_0xb0a6('0x23')]){_0x10d753=!![];_0x14993f=_0x4997df[_0xb0a6('0x22')]['name'];}if(!_0x27db00['agents'][_0x16e053]){return Promise[_0xb0a6('0x24')]();}return RpcUser[_0xb0a6('0x25')](_0x27db00[_0xb0a6('0x4')][_0x16e053]['id'])['then'](function(_0x23bec3){if(!_0x23bec3||_0x23bec3[_0xb0a6('0x26')]){logger[_0xb0a6('0x17')](_0xb0a6('0x27'),_0x10e56b,_0x16e053,_0x5c6e66);return;}logger[_0xb0a6('0x17')](_0xb0a6('0x28'),_0x10e56b,_0x16e053,_0x5c6e66);var _0x94d47f=_0x27db00[_0xb0a6('0x1f')][_0x10e56b][_0xb0a6('0x29')]&&_0x27db00['channels'][_0x10e56b][_0xb0a6('0x2a')]?_0x27db00[_0xb0a6('0x1f')][_0x10e56b][_0xb0a6('0x2a')]:_0x10e56b;return RpcUser['savePause'](_0x27db00[_0xb0a6('0x4')][_0x16e053],_0x14993f,_0x94d47f);})['then'](function(_0x131e46){if(_0x10d753||!_0x131e46){return;}_0x27db00[_0xb0a6('0x5')][_0x16e053]={};logger[_0xb0a6('0x17')](_0xb0a6('0x2b'),_0x10e56b,_0x27db00[_0xb0a6('0x3')][_0x5c6e66][_0xb0a6('0x2c')],_0x16e053,_0x5c6e66);_0x27db00[_0xb0a6('0x5')][_0x16e053][_0xb0a6('0x14')]=setTimeout(_0x27db00[_0xb0a6('0x2d')][_0xb0a6('0x8')](_0x27db00,_0x16e053),_0x27db00['voiceQueues'][_0x5c6e66]['acwTimeout']*0x3e8);_0x27db00[_0xb0a6('0x5')][_0x16e053][_0xb0a6('0x2e')]=moment()[_0xb0a6('0x2f')](_0xb0a6('0x30'));_0x27db00[_0xb0a6('0x5')][_0x16e053][_0xb0a6('0x31')]=_0x10e56b;_0x27db00[_0xb0a6('0x5')][_0x16e053][_0xb0a6('0x20')]=_0x5c6e66;_0x27db00['timers'][_0x16e053][_0xb0a6('0x13')]=_0x27db00[_0xb0a6('0x13')]['bind'](_0x27db00,_0x16e053,_0x10e56b);})[_0xb0a6('0x19')](function(){logger[_0xb0a6('0x32')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x10e56b,_0x27db00['voiceQueues'][_0x5c6e66][_0xb0a6('0x2c')],_0x16e053,_0x5c6e66);})[_0xb0a6('0x1b')](function(){delete _0x27db00[_0xb0a6('0x1f')][_0x10e56b];});}catch(_0x13ebd8){logger[_0xb0a6('0x32')](_0xb0a6('0x33'),_0x13ebd8['message']);}};Acw[_0xb0a6('0x1c')]['stopAcw']=function(_0x317143){try{var _0x29b609=this;if(_0x29b609['timers'][_0x317143]){_0x29b609['timers'][_0x317143]['timer']=![];var _0x3c4f52=_0x29b609[_0xb0a6('0x5')][_0x317143][_0xb0a6('0x31')];var _0x236cc4=_0x29b609[_0xb0a6('0x5')][_0x317143]['queue'];var _0x40b3de=_0x29b609[_0xb0a6('0x3')][_0x236cc4][_0xb0a6('0x2c')];logger[_0xb0a6('0x17')]('[%s][TIMER][STOP][AGENT:%s]',_0x3c4f52,_0x317143);RpcUser[_0xb0a6('0x34')](this[_0xb0a6('0x4')][_0x317143]);RpcVoiceAgentReport[_0xb0a6('0x15')]({'acwtime':_0x40b3de,'agentacw':!![]},_0x3c4f52,_0x317143)[_0xb0a6('0x16')](function(_0x1366fd){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x3c4f52,_0x40b3de,_0x1366fd);})[_0xb0a6('0x19')](function(_0x1ae542){logger[_0xb0a6('0x32')](_0xb0a6('0x1a'),_0x3c4f52,_0x1ae542);});}else{logger[_0xb0a6('0x32')](_0xb0a6('0x35'),_0x317143);if(_0x29b609[_0xb0a6('0x5')]){logger[_0xb0a6('0x17')]('[ACW][TIMERS]',JSON[_0xb0a6('0x36')](_0x29b609[_0xb0a6('0x5')]));}}}catch(_0x381067){logger[_0xb0a6('0x32')](_0xb0a6('0x37'),_0x381067['message']);}};Acw[_0xb0a6('0x1c')]['syncAgentConnect']=function(_0xaf5ef8){try{if(this['voiceQueues'][_0xaf5ef8[_0xb0a6('0x20')]]&&(this['voiceQueues'][_0xaf5ef8[_0xb0a6('0x20')]][_0xb0a6('0x1')]||this[_0xb0a6('0x3')][_0xaf5ef8[_0xb0a6('0x20')]][_0xb0a6('0x21')])){if(this[_0xb0a6('0x4')][_0xaf5ef8[_0xb0a6('0x1e')]]){this[_0xb0a6('0x1f')][_0xaf5ef8[_0xb0a6('0x31')]]={'queue':_0xaf5ef8[_0xb0a6('0x20')],'interface':_0xaf5ef8[_0xb0a6('0x1e')],'destlinkedid':_0xaf5ef8[_0xb0a6('0x2a')]};}}}catch(_0x4fa815){logger[_0xb0a6('0x32')](_0xb0a6('0x38'),_0x4fa815['message']);}};Acw[_0xb0a6('0x1c')]['syncAgentConnectPreview']=function(_0x3334e9){try{if(this[_0xb0a6('0x3')][_0x3334e9[_0xb0a6('0x20')]]&&(this['voiceQueues'][_0x3334e9[_0xb0a6('0x20')]][_0xb0a6('0x1')]||this[_0xb0a6('0x3')][_0x3334e9[_0xb0a6('0x20')]][_0xb0a6('0x21')])){if(this[_0xb0a6('0x4')][_0x3334e9[_0xb0a6('0x1e')]]){this[_0xb0a6('0x1f')][_0x3334e9['uniqueid']]={'queue':_0x3334e9[_0xb0a6('0x20')],'interface':_0x3334e9[_0xb0a6('0x1e')]};}}}catch(_0x47645a){logger[_0xb0a6('0x32')]('[ACW][syncAgentConnectPreview]\x20%s',_0x47645a['message']);}};Acw['prototype']['syncHangupRequest']=function(_0x4fb43a){try{if(this['channels'][_0x4fb43a['uniqueid']]&&_[_0xb0a6('0x39')](this[_0xb0a6('0x1f')][_0x4fb43a[_0xb0a6('0x31')]][_0xb0a6('0x29')])){logger[_0xb0a6('0x17')](_0xb0a6('0x3a'),_0x4fb43a[_0xb0a6('0x31')]);this[_0xb0a6('0x1d')](_0x4fb43a[_0xb0a6('0x31')]);}else if(this[_0xb0a6('0x1f')][_0x4fb43a[_0xb0a6('0x3b')]]&&_[_0xb0a6('0x39')](this[_0xb0a6('0x1f')][_0x4fb43a[_0xb0a6('0x3b')]][_0xb0a6('0x29')])){logger[_0xb0a6('0x17')]('[%s][HANGUP:LINKEDID]',_0x4fb43a[_0xb0a6('0x3b')]);this[_0xb0a6('0x1d')](_0x4fb43a[_0xb0a6('0x3b')]);}}catch(_0x272176){logger[_0xb0a6('0x32')](_0xb0a6('0x3c'),_0x272176[_0xb0a6('0x3d')]);}};Acw[_0xb0a6('0x1c')][_0xb0a6('0xa')]=function(_0x516e0c){try{if(this['channels'][_0x516e0c[_0xb0a6('0x31')]]&&this[_0xb0a6('0x1f')][_0x516e0c[_0xb0a6('0x31')]]['attended']){logger[_0xb0a6('0x17')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x516e0c[_0xb0a6('0x31')]);this[_0xb0a6('0x1d')](_0x516e0c['uniqueid']);}else if(this[_0xb0a6('0x1f')][_0x516e0c[_0xb0a6('0x3b')]]&&this['channels'][_0x516e0c[_0xb0a6('0x3b')]]['attended']){logger[_0xb0a6('0x17')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x516e0c[_0xb0a6('0x3b')]);this[_0xb0a6('0x1d')](_0x516e0c['linkedid']);}}catch(_0x329524){logger[_0xb0a6('0x32')](_0xb0a6('0x3e'),_0x329524[_0xb0a6('0x3d')]);}};Acw[_0xb0a6('0x1c')]['syncAttendedTransfer']=function(_0x3251dc){try{if(!_['isNil'](this[_0xb0a6('0x1f')][_0x3251dc['transfereeuniqueid']])){this['startAcw'](_0x3251dc[_0xb0a6('0x3f')]);if(this[_0xb0a6('0x1f')][_0x3251dc['secondtransfereruniqueid']]){this[_0xb0a6('0x1f')][_0x3251dc['secondtransfereruniqueid']][_0xb0a6('0x29')]=!![];this[_0xb0a6('0x1f')][_0x3251dc[_0xb0a6('0x40')]]=this[_0xb0a6('0x1f')][_0x3251dc['secondtransfereruniqueid']];delete this[_0xb0a6('0x1f')][_0x3251dc[_0xb0a6('0x41')]];}}else if(!_[_0xb0a6('0x42')](this[_0xb0a6('0x1f')][_0x3251dc[_0xb0a6('0x40')]])){this[_0xb0a6('0x1d')](_0x3251dc['transfertargetuniqueid']);if(this['channels'][_0x3251dc[_0xb0a6('0x43')]]){this['channels'][_0x3251dc[_0xb0a6('0x43')]][_0xb0a6('0x29')]=!![];this[_0xb0a6('0x1f')][_0x3251dc['transfereeuniqueid']]=this[_0xb0a6('0x1f')][_0x3251dc[_0xb0a6('0x43')]];delete this['channels'][_0x3251dc[_0xb0a6('0x43')]];}}}catch(_0x2164bf){logger[_0xb0a6('0x32')](_0xb0a6('0x44'),_0x2164bf[_0xb0a6('0x3d')]);}};Acw['prototype'][_0xb0a6('0xe')]=function(_0x1e317b){try{if(this['channels'][_0x1e317b[_0xb0a6('0x45')]]){logger[_0xb0a6('0x17')](_0xb0a6('0x46'),JSON[_0xb0a6('0x36')](_0x1e317b[_0xb0a6('0x45')]));this[_0xb0a6('0x1d')](_0x1e317b[_0xb0a6('0x45')]);}else if(this[_0xb0a6('0x1f')][_0x1e317b[_0xb0a6('0x47')]]){logger[_0xb0a6('0x17')](_0xb0a6('0x48'),JSON[_0xb0a6('0x36')](_0x1e317b['transfererlinkedid']));this[_0xb0a6('0x1d')](_0x1e317b['transfererlinkedid']);}}catch(_0x2fb107){logger[_0xb0a6('0x32')](_0xb0a6('0x49'),_0x2fb107[_0xb0a6('0x3d')]);}};Acw['prototype'][_0xb0a6('0x4a')]=function(_0x1363e9){try{if(this[_0xb0a6('0x3')][_0x1363e9[_0xb0a6('0x20')]]&&this[_0xb0a6('0x3')][_0x1363e9[_0xb0a6('0x20')]][_0xb0a6('0x4b')]===_0xb0a6('0x4c')){if(this[_0xb0a6('0x4')][_0x1363e9[_0xb0a6('0x1e')]]){logger[_0xb0a6('0x17')](_0xb0a6('0x4d'),_0x1363e9[_0xb0a6('0x31')],_0x1363e9[_0xb0a6('0x1e')],_0x1363e9[_0xb0a6('0x20')]);return RpcUser[_0xb0a6('0x4e')](this[_0xb0a6('0x4')][_0x1363e9[_0xb0a6('0x1e')]],'Auto-Pause',_0x1363e9[_0xb0a6('0x31')]);}}}catch(_0x2aabb1){logger[_0xb0a6('0x32')](_0xb0a6('0x4f'),_0x2aabb1[_0xb0a6('0x3d')]);}};module[_0xb0a6('0x50')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index c434967..deca96d 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 _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 +var _0xcc90=['keepConnected','Action','promisify','action','format','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','once','close','connect','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','actionSipShowRegistry','then','actionQueueSummary','catch','[ami.js][fullybooted]','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','port','username','password'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcc90,0x69));var _0x0cc9=function(_0x2e7a54,_0x35254a){_0x2e7a54=_0x2e7a54-0x0;var _0x18b127=_0xcc90[_0x2e7a54];return _0x18b127;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x0cc9('0x0'));var util=require(_0x0cc9('0x1'));var logger=require(_0x0cc9('0x2'))(_0x0cc9('0x3'));var config=require(_0x0cc9('0x4'));var ami=new Manager(config[_0x0cc9('0x5')][_0x0cc9('0x6')],config['asterisk']['ip'],config[_0x0cc9('0x5')][_0x0cc9('0x7')],config[_0x0cc9('0x5')][_0x0cc9('0x8')],!![]);ami[_0x0cc9('0x9')]();ami[_0x0cc9('0xa')]=BPromise[_0x0cc9('0xb')](ami[_0x0cc9('0xc')]);function error(_0x3f2140){logger['error'](util[_0x0cc9('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x0cc9('0x5')][_0x0cc9('0x7')],config[_0x0cc9('0x5')]['ip'],config[_0x0cc9('0x5')]['port'],util[_0x0cc9('0xe')](_0x3f2140,![],null)));}function close(){logger[_0x0cc9('0xf')](util[_0x0cc9('0xd')](_0x0cc9('0x10'),config[_0x0cc9('0x5')][_0x0cc9('0x7')],config[_0x0cc9('0x5')]['ip'],config[_0x0cc9('0x5')][_0x0cc9('0x6')]));}ami['actionSipShowRegistry']=function(){return function(){return ami['Action']({'action':_0x0cc9('0x11')});};};ami[_0x0cc9('0x12')]=function(){return function(){return ami['Action']({'action':'devicestatelist'});};};ami[_0x0cc9('0x13')]=function(){return function(){return ami[_0x0cc9('0xa')]({'action':_0x0cc9('0x14')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x0cc9('0xa')]({'action':_0x0cc9('0x15')});};};ami[_0x0cc9('0x16')]=function(){return function(){return ami[_0x0cc9('0xa')]({'action':_0x0cc9('0x17')});};};function connect(){logger['info'](util['format']('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config['asterisk'][_0x0cc9('0x7')],config['asterisk']['ip'],config[_0x0cc9('0x5')][_0x0cc9('0x6')]));ami[_0x0cc9('0x18')]('error',error);ami[_0x0cc9('0x18')](_0x0cc9('0x19'),close);}ami['on'](_0x0cc9('0x1a'),connect);ami['on'](_0x0cc9('0x1b'),function(_0x594023){logger[_0x0cc9('0x1c')](util[_0x0cc9('0xd')](_0x0cc9('0x1d'),config[_0x0cc9('0x5')][_0x0cc9('0x7')],config['asterisk']['ip'],config['asterisk']['port'],util[_0x0cc9('0xe')](_0x594023,![],null)));});ami['on'](_0x0cc9('0x1e'),function(){logger['info'](util[_0x0cc9('0xd')](_0x0cc9('0x1f'),config['asterisk'][_0x0cc9('0x7')],config[_0x0cc9('0x5')]['ip'],config[_0x0cc9('0x5')][_0x0cc9('0x6')]));return Promise[_0x0cc9('0x20')]()['then'](ami[_0x0cc9('0x21')]())[_0x0cc9('0x22')](ami[_0x0cc9('0x12')]())[_0x0cc9('0x22')](ami[_0x0cc9('0x13')]())['then'](ami[_0x0cc9('0x23')]())[_0x0cc9('0x22')](ami[_0x0cc9('0x16')]())[_0x0cc9('0x24')](function(_0xa35736){logger['error'](_0x0cc9('0x25'),util[_0x0cc9('0xe')](_0xa35736,{'showHidden':![],'depth':null}));});});ami[_0x0cc9('0x18')](_0x0cc9('0xf'),error);ami[_0x0cc9('0x18')]('close',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 af1cad2..8cd33f9 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 _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 +var _0xf4eb=['rpc','error','message','result','exports','jayson/promise','http','request','then','debug','memberReport'];(function(_0x4aa741,_0x5134c1){var _0x272370=function(_0x1aa778){while(--_0x1aa778){_0x4aa741['push'](_0x4aa741['shift']());}};_0x272370(++_0x5134c1);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5dbc41,_0x4ccc71){_0x5dbc41=_0x5dbc41-0x0;var _0x2238be=_0xf4eb[_0x5dbc41];return _0x2238be;};'use strict';var jayson=require(_0xbf4e('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('ami');var client=jayson['client'][_0xbf4e('0x1')]({'port':0x2329});client['Request']=function(_0x4e7fa7,_0x2e3070){return new BPromise(function(_0x1c7606,_0x32d1d7){return client[_0xbf4e('0x2')](_0x4e7fa7,_0x2e3070)[_0xbf4e('0x3')](function(_0x2fcfed){logger[_0xbf4e('0x4')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x2e3070,_0x2fcfed);if(_0x2fcfed['error']){logger['error'](_0xbf4e('0x6'),_0xbf4e('0x5'),_0x4e7fa7,_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')],_0x2e3070);return _0x32d1d7(_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')]);}else{return _0x1c7606(_0x2fcfed[_0xbf4e('0x9')]);}})['catch'](function(_0x4d9a07){logger[_0xbf4e('0x7')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x4d9a07,_0x2e3070);return _0x32d1d7(_0x4d9a07);});});};module[_0xbf4e('0xa')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 4be1b79..65951d8 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 _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 +var _0xe1d3=['phone','contact\x20is\x20undefine','getCaller','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','isOutboundQueue','\x22%s,%s%s,,,%s\x22','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','originate','SIP/%s/%s%s','dialPrefix','dialCutDigit','trim','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','originate\x20action\x20Error','checkRetriveMax','countnoanswerretry','countnosuchnumberretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','[rescheduleContact][Machine]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','NoSuchNumber','custom:agentnosuchnumber','callAdditionalPhoneAfterMin','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','busy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','Abandoned','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','erlangAbandonmentRate','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','avgHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','milliseconds','[handlePredictive]','UserId','queueStatusComplete:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','QUEUE_RECALL','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','limitCalls','getContactDialerIvr','RUNNING','ivrTotalCallsDays','checkIsBlackListIvr','[getContactCampaign2]','dialLimitQueue','pTalking','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','checkIsBlackList','checkContactBlack','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','checkContactEmpty','[actionOriginatePredictive]\x20','abandonmentRate','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]','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]','Ts\x20=\x20','p\x20=\x20','exports','moment','./utils','../preview/util/util','dialer','../../../config/logger','predictive','predictiveCalls','syncQueueSummary','redis','defaults','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/interval','./models/action','./models/queueCallerAbandon','env','XCALLY_IP_AGI','enqueue','tail','finally','sequence','preview','voiceQueues','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','hangup','syncHangup','newexten','syncNewExten','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','previewRecallmeReminderInterval','isUndefined','emit','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','getSeconds','startProgressive\x20value\x20cleared','name','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','temp','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','statedesc','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','\x20NOT\x20Active','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','INACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','prototype','isTrunkReachable','active','SIP/%s','status','reachable','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','command','iftime\x20%s,%s','interval','then','content','indexOf','Action','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','catch','resetActiveCalls','syncCampaigns','campaigns','isIVRCampaign','resolve','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','dialPowerLevel','booked','Queue','method\x20not\x20recognized','silly','Voice\x20Queue\x20%s\x20$s','intervalIftime','Timezone:\x20','AMI\x20IfTime','syncAgentConnect','queue','uniqueId','uniqueid','type','updateOriginated','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','moveContactManagedDialer','[syncAgentComplete]','ivr','droptime','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','state','dropreason','TIMEOUT','countdropretry','dialDropRetryFrequency','verifyAdditionalPhones','additional','dialDropMaxRetry','rescheduleContact','add','minutes','ContactId','ListId','CampaignId','[rescheduleContact][Drop]','Drop','starttime','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','countabandonedretry','countglobal','voiceQueue','dialAbandonedRetryFrequency','VoiceQueueId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','swapAdditionalPhones','channel','actionid','strategy','rrmemory','isNil','locked','paused','stateinterface','pick','idHopper','roundrobin','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','responsetime','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','dialAMDActive','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','countmachineretry','createStateFinal','dialMachineRetryFrequency','[syncHangupInAMDIvr]','Machine','membername','reason\x2019\x20machine....','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','outboundUnknownCallsDay','cause-txt','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','talking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','assign','throttle','filter','map','user:%s','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','undefined','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','[emptyContact][createHistory]','[emptyContact]','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','Agent','user:dialPreviewRecallReminder','handleIvr','actionOriginate','object','voiceQueue\x20is\x20undefine'];(function(_0x1e6e4e,_0x2b1b09){var _0x3d746b=function(_0x4483dd){while(--_0x4483dd){_0x1e6e4e['push'](_0x1e6e4e['shift']());}};_0x3d746b(++_0x2b1b09);}(_0xe1d3,0xc7));var _0x3e1d=function(_0x5c85fb,_0x3ee344){_0x5c85fb=_0x5c85fb-0x0;var _0x17df0d=_0xe1d3[_0x5c85fb];return _0x17df0d;};'use strict';var util=require('util');var _=require('lodash');var uuid=require('uuid');var moment=require(_0x3e1d('0x0'));var rr=require('rr');var Redis=require('ioredis');var utils=require(_0x3e1d('0x1'));var hopperUtils=require('./utils/hopper');var ut=require(_0x3e1d('0x2'));var config=require('../../../config/environment/');var logger=require('../../../config/logger')(_0x3e1d('0x3'));var loggerBooked=require(_0x3e1d('0x4'))('booked');var loggerPredictive=require(_0x3e1d('0x4'))(_0x3e1d('0x5'));var loggerPredictiveCalls=require(_0x3e1d('0x4'))(_0x3e1d('0x6'));var loggerSyncQueueSummary=require(_0x3e1d('0x4'))(_0x3e1d('0x7'));var ami=require('../ami');config[_0x3e1d('0x8')]=_[_0x3e1d('0x9')](config[_0x3e1d('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3e1d('0x8')]));var cmHopper=require(_0x3e1d('0xa'));var voiceQueueRt=require(_0x3e1d('0xb'));var RpcSetting=require('../rpc/setting');var Interval=require(_0x3e1d('0xc'));var Action=require(_0x3e1d('0xd'));var History=require('./models/history');var Final=require('./models/final');var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0x3e1d('0xe'));var Hangup=require('./models/hangup');var ipAgi=process[_0x3e1d('0xf')][_0x3e1d('0x10')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x3e1d('0x11')]=function(_0x2b4bef){this[_0x3e1d('0x12')]=this[_0x3e1d('0x12')]?this[_0x3e1d('0x12')][_0x3e1d('0x13')](_0x2b4bef):_0x2b4bef();};function Dialer(_0x14f791,_0x3c4161){this[_0x3e1d('0x14')]=new Sequence();this[_0x3e1d('0x15')]=_0x3c4161;this[_0x3e1d('0x16')]=_0x14f791[_0x3e1d('0x16')];this['campaigns']=_0x14f791['campaigns'];this['agents']=_0x14f791[_0x3e1d('0x17')];this['trunks']=_0x14f791[_0x3e1d('0x18')];this[_0x3e1d('0x19')]=config[_0x3e1d('0x19')]||0x2;this[_0x3e1d('0x1a')]={};this[_0x3e1d('0x1b')]={};this[_0x3e1d('0x1c')]={};this['uniqueId']={};this[_0x3e1d('0x1d')]={};this[_0x3e1d('0x1e')]={};this[_0x3e1d('0x1f')]={};this[_0x3e1d('0x20')]={};this[_0x3e1d('0x21')]={};this[_0x3e1d('0x22')]={};this[_0x3e1d('0x23')]={};ami['on'](_0x3e1d('0x24'),this['syncAgentConnect'][_0x3e1d('0x25')](this));ami['on'](_0x3e1d('0x26'),this[_0x3e1d('0x27')][_0x3e1d('0x25')](this));ami['on'](_0x3e1d('0x28'),this[_0x3e1d('0x29')][_0x3e1d('0x25')](this));ami['on'](_0x3e1d('0x2a'),this[_0x3e1d('0x2b')]['bind'](this));ami['on'](_0x3e1d('0x2c'),this['syncQueueSummary'][_0x3e1d('0x25')](this));ami['on'](_0x3e1d('0x2d'),this['syncQueueSummaryComplete']['bind'](this));ami['on'](_0x3e1d('0x2e'),this[_0x3e1d('0x2f')][_0x3e1d('0x25')](this));ami['on'](_0x3e1d('0x30'),this[_0x3e1d('0x31')][_0x3e1d('0x25')](this));ami['on']('varset',this['syncVarSet'][_0x3e1d('0x25')](this));ami['on']('queuemember',this[_0x3e1d('0x32')][_0x3e1d('0x25')](this));ami['on'](_0x3e1d('0x33'),this[_0x3e1d('0x34')][_0x3e1d('0x25')](this));this[_0x3e1d('0x35')]();this[_0x3e1d('0x36')]();RpcSetting['getSettings']()['then'](function(_0x33854e){previewRecallmeReminderInterval=_0x33854e[_0x3e1d('0x37')];});}function isNotNull(_0x34f258){return _0x34f258!==null&&!_[_0x3e1d('0x38')](_0x34f258);}function msgResponse(_0x513e6f,_0x1a753b,_0x3b6b8b){return{'action':_0x513e6f,'response':_0x1a753b,'message':_0x3b6b8b,'stack':_0x3b6b8b};}function emit(_0x4dd1e9,_0x3c8e4e,_0x30369a){io['to'](_0x4dd1e9)[_0x3e1d('0x39')](_0x3c8e4e,_0x30369a);}function emitOutboundVoiceQueueSummary(_0x216eb0){if(_0x216eb0['type']==='outbound'){logger[_0x3e1d('0x3a')](_0x3e1d('0x3b'),util[_0x3e1d('0x3c')](_0x216eb0,{'showHidden':![],'depth':null}));emit(util[_0x3e1d('0x3d')](_0x3e1d('0x3e'),_0x216eb0['name']),'voice_queue:save',_0x216eb0);}}function checkGetDataPredictive(_0x2e85a2){if(isNotNull(_0x2e85a2)&&!_[_0x3e1d('0x3f')](_0x2e85a2)){loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x41'));loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x42'),_0x2e85a2[_0x3e1d('0x43')]);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x44'),_0x2e85a2[_0x3e1d('0x45')]);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x46'),_0x2e85a2[_0x3e1d('0x47')]);loggerPredictive['info'](_0x3e1d('0x48'),_0x2e85a2[_0x3e1d('0x49')]);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x4a'),_0x2e85a2[_0x3e1d('0x4b')]);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x4c'),_0x2e85a2[_0x3e1d('0x4d')]);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x4e'));if(_0x2e85a2[_0x3e1d('0x43')]>0x0){if(!_['isUndefined'](_0x2e85a2['predictiveIntervalAvgTalktime'])&&_0x2e85a2[_0x3e1d('0x4d')]>0x0){return!![];}loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x4f'));if(!_[_0x3e1d('0x38')](_0x2e85a2['predictiveIntervalAvgHoldtime'])&&_0x2e85a2[_0x3e1d('0x4b')]>0x0){return!![];}loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x50'));}else{loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x51'));}}else{loggerPredictive[_0x3e1d('0x40')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x19ee97){return function(_0x12b9da){loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x52'));loggerPredictive['info'](_0x3e1d('0x53'),_0x12b9da[_0x3e1d('0x54')]);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x55'),_0x12b9da[_0x3e1d('0x56')]);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x57'),_0x12b9da['erlangAbandonmentRate']);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x58'),_0x12b9da['erlangBusyFactor']);loggerPredictive['info'](_0x3e1d('0x57'),_0x12b9da['erlangAbandonmentRate']);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x4e'));_[_0x3e1d('0x59')](_0x19ee97,_0x12b9da);};}function ifInterval(_0x27a615,_0x1774f){if(_[_0x3e1d('0x38')](_0x1774f)){return![];}return utils[_0x3e1d('0x5a')](undefined,_0x1774f)<_0x27a615*0x3c;}function clearPredictiveAttributes(_0x5b5f8f){if(_0x5b5f8f[_0x3e1d('0x1f')]){_0x5b5f8f[_0x3e1d('0x1f')]=undefined;loggerPredictive[_0x3e1d('0x3a')](_0x5b5f8f['name'],_0x3e1d('0x5b'));}if(_0x5b5f8f[_0x3e1d('0x1e')]){_0x5b5f8f['startPredictive']=undefined;loggerPredictive[_0x3e1d('0x3a')](_0x5b5f8f[_0x3e1d('0x5c')],'startPredictive\x20value\x20cleared');}if(_0x5b5f8f[_0x3e1d('0x5d')]){clearInterval(_0x5b5f8f[_0x3e1d('0x5d')]);_0x5b5f8f[_0x3e1d('0x5d')]=undefined;loggerPredictive[_0x3e1d('0x3a')](_0x5b5f8f[_0x3e1d('0x5c')],_0x3e1d('0x5e'));}}function loggerCatchPredictive(_0x326aa6,_0x4b977b){return function(_0x2218d7){loggerPredictive[_0x3e1d('0x5f')](_0x4b977b[_0x3e1d('0x5c')],_0x326aa6);loggerPredictive[_0x3e1d('0x5f')](_0x2218d7[_0x3e1d('0x60')]);clearPredictiveAttributes(_0x4b977b);};}function loggerCatch(_0x3e45cd){return function(_0x3d79f2){logger[_0x3e1d('0x5f')](_0x3e45cd,util[_0x3e1d('0x3c')](_0x3d79f2,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x1b50fd,_0x27d045,_0x5edb5e){return function(_0x4b3029){utils[_0x3e1d('0x61')](_0x27d045,_0x5edb5e,0x0);_0x27d045[_0x3e1d('0x62')]=0x0;logger[_0x3e1d('0x5f')](_0x1b50fd,util[_0x3e1d('0x3c')](_0x4b3029,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5341a5){return function(_0xa31683){if(isNotNull(_0xa31683)&&isNotNull(_0xa31683[0x0])){if(_0xa31683[0x0][_0x3e1d('0x63')]>0x0){_0x5341a5[_0x3e1d('0x64')]=utils[_0x3e1d('0x65')][_0x3e1d('0x66')];logger[_0x3e1d('0x40')](_0x3e1d('0x67')+_0x5341a5[_0x3e1d('0x5c')],_0xa31683[0x0][_0x3e1d('0x63')],_0x3e1d('0x68'));}else{_0x5341a5[_0x3e1d('0x64')]=utils[_0x3e1d('0x65')][_0x3e1d('0x69')];logger[_0x3e1d('0x40')]('[getContactDialer2][Empty]'+_0x5341a5[_0x3e1d('0x5c')]);}}};}function createObjHistory(_0x4c7dee,_0x55afb8,_0x22973e,_0x2631d2,_0x234b2b){_0x4c7dee[_0x3e1d('0x64')]=_0x22973e;var _0x30f59e=new Action(_0x4c7dee,_0x55afb8);var _0x481a08=new History(_0x30f59e);_0x481a08['state']=_0x2631d2;_0x481a08[_0x3e1d('0x6a')]=_0x234b2b;_0x481a08['endtime']=_0x30f59e['starttime'];return _0x481a08;}function unlockQueueStatus(_0x10de34,_0x2cf19b){setTimeout(function(){if(_[_0x3e1d('0x38')](_0x10de34[_0x3e1d('0x6b')])){loggerBooked[_0x3e1d('0x5f')](_0x3e1d('0x6c'),_0x2cf19b);}_0x10de34['queueStatusComplete']=!![];loggerBooked[_0x3e1d('0x40')](_0x3e1d('0x6d'),_0x2cf19b,JSON[_0x3e1d('0x6e')](_['pick'](_0x10de34,[_0x3e1d('0x5c'),_0x3e1d('0x6b')])));},0x1f3);}function checkInterval(_0x4e3293){return function(){if(!isNotNull(_0x4e3293[_0x3e1d('0x6f')])){_0x4e3293[_0x3e1d('0x64')]=utils['CAMPAIGN_STATUS'][_0x3e1d('0x70')];throw _0x4e3293[_0x3e1d('0x5c')]+_0x3e1d('0x71');}if(!isNotNull(_0x4e3293[_0x3e1d('0x6f')][_0x3e1d('0x72')])){_0x4e3293[_0x3e1d('0x64')]=utils[_0x3e1d('0x65')][_0x3e1d('0x70')];throw _0x4e3293['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x3e1d('0x3f')](_0x4e3293[_0x3e1d('0x6f')][_0x3e1d('0x72')]))){_0x4e3293[_0x3e1d('0x64')]=utils[_0x3e1d('0x65')][_0x3e1d('0x70')];throw _0x4e3293[_0x3e1d('0x5c')]+_0x3e1d('0x71');}};}function checkIsIVRCampaignActive(_0x57c8aa){return function(){if(!utils[_0x3e1d('0x73')](_0x57c8aa)){_0x57c8aa[_0x3e1d('0x64')]=utils[_0x3e1d('0x65')]['INACTIVE'];throw _0x57c8aa[_0x3e1d('0x5c')]+_0x3e1d('0x74');}};}function emitCampaignSummary(_0x35d2d6){if(utils['isIVRCampaign'](_0x35d2d6)){emit(util[_0x3e1d('0x3d')](_0x3e1d('0x75'),_0x35d2d6['name']),_0x3e1d('0x76'),_0x35d2d6);}}function loggerCatchQueueSummary(_0x1ba805,_0x256ccc){return function(_0xa761ff){clearPredictiveAttributes(_0x256ccc);emitCampaignSummary(_0x256ccc);loggerSyncQueueSummary[_0x3e1d('0x3a')](_0x1ba805,util[_0x3e1d('0x3c')](_0xa761ff,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x4c0ea2){if(_0x4c0ea2[_0x3e1d('0x77')]){if(_0x4c0ea2[_0x3e1d('0x78')]===0x0){_0x4c0ea2[_0x3e1d('0x77')]=![];_0x4c0ea2[_0x3e1d('0x64')]=utils[_0x3e1d('0x65')][_0x3e1d('0x79')];loggerSyncQueueSummary[_0x3e1d('0x3a')](_0x3e1d('0x7a'),_0x4c0ea2['name'],_0x3e1d('0x7b'));}else{_0x4c0ea2[_0x3e1d('0x64')]=utils[_0x3e1d('0x65')][_0x3e1d('0x7c')];loggerSyncQueueSummary[_0x3e1d('0x3a')](_0x3e1d('0x7a'),_0x4c0ea2['name'],_0x3e1d('0x7d'));}emitCampaignSummary(_0x4c0ea2);}}function myreject(_0x50b4e3){return function(_0x52ef07){return _0x50b4e3(msgResponse(_0x3e1d('0x7e'),_0x3e1d('0x7f'),JSON['stringify'](_0x52ef07)));};}Dialer[_0x3e1d('0x80')][_0x3e1d('0x81')]=function(_0x3d5e79){return!_[_0x3e1d('0x38')](_0x3d5e79)&&_0x3d5e79&&!_[_0x3e1d('0x38')](_0x3d5e79[_0x3e1d('0x5c')])&&!_['isUndefined'](_0x3d5e79['active'])&&_0x3d5e79[_0x3e1d('0x82')]&&(this[_0x3e1d('0x18')][util[_0x3e1d('0x3d')](_0x3e1d('0x83'),_0x3d5e79[_0x3e1d('0x5c')])][_0x3e1d('0x84')]===_0x3e1d('0x85')||this['trunks'][util['format'](_0x3e1d('0x83'),_0x3d5e79['name'])][_0x3e1d('0x84')]==='unmonitored');};Dialer[_0x3e1d('0x80')][_0x3e1d('0x86')]=function(_0x21c9e9){var _0xf40a7f=this;return function(){if(!_0xf40a7f[_0x3e1d('0x81')](_0x21c9e9[_0x3e1d('0x87')])){if(!_0xf40a7f[_0x3e1d('0x81')](_0x21c9e9[_0x3e1d('0x88')])){_0x21c9e9[_0x3e1d('0x64')]=utils[_0x3e1d('0x65')][_0x3e1d('0x89')];throw _0x21c9e9[_0x3e1d('0x5c')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer['prototype'][_0x3e1d('0x8a')]=function(_0x2b6ce5,_0x53e33e,_0x45ca3b,_0x34d261){var _0x34b4db=this;return function(){var _0x1c46e3=!![];return _0x34b4db[_0x3e1d('0x8b')](_0x2b6ce5,_0x53e33e,_0x45ca3b,_0x34d261,_0x1c46e3);};};Dialer[_0x3e1d('0x80')][_0x3e1d('0x8c')]=function(_0x1f824e,_0x282f25,_0x31b735,_0x3e13db){var _0x43fe5e=this;return function(){var _0x30b650=![];return _0x43fe5e[_0x3e1d('0x8b')](_0x1f824e['Intervals'],_0x282f25,_0x31b735,_0x3e13db,_0x30b650);};};Dialer[_0x3e1d('0x80')]['ifTimeIvr']=function(_0x4edc2b,_0x42d026,_0x254409,_0x5dc634,_0x373456){var _0xccaa93=[];return new Promise(function(_0x4b9062,_0xb3016c){if(!isNotNull(_0x4edc2b)){_0x5dc634[_0x3e1d('0x64')]=utils[_0x3e1d('0x65')][_0x3e1d('0x70')];return _0xb3016c(msgResponse(_0x3e1d('0x8d'),_0x3e1d('0x8e'),_0x254409+_0x3e1d('0x8f')));}if(_['isEmpty'](_0x4edc2b)){_0x5dc634[_0x3e1d('0x64')]=utils[_0x3e1d('0x65')][_0x3e1d('0x90')];return _0xb3016c(msgResponse(_0x3e1d('0x8d'),'Failure',_0x254409+_0x3e1d('0x91')));}if(_0x42d026&&_[_0x3e1d('0x38')](config[_0x3e1d('0x92')][_0x42d026])){_0x5dc634[_0x3e1d('0x64')]=utils[_0x3e1d('0x65')][_0x3e1d('0x93')];return _0xb3016c(msgResponse(_0x3e1d('0x8d'),_0x3e1d('0x8e'),_0x254409+_0x3e1d('0x94')+_0x42d026));}if(_[_0x3e1d('0x95')](_0x4edc2b)){for(var _0x4ecff3=0x0;_0x4ecff3<_0x4edc2b[_0x3e1d('0x96')];_0x4ecff3+=0x1){_0xccaa93[_0x3e1d('0x97')](ami['Action']({'action':_0x3e1d('0x98'),'command':util[_0x3e1d('0x3d')](_0x3e1d('0x99'),_0x4edc2b[_0x4ecff3][_0x3e1d('0x9a')],!_[_0x3e1d('0x38')](config['timezones'][_0x42d026])?_0x42d026:'')})[_0x3e1d('0x9b')](function(_0x4f1c0e){return _0x4f1c0e[_0x3e1d('0x9c')][_0x3e1d('0x9d')]('true')>=0x0;})['catch'](myreject(_0xb3016c)));}}else{_0xccaa93[_0x3e1d('0x97')](ami[_0x3e1d('0x9e')]({'action':_0x3e1d('0x98'),'command':util[_0x3e1d('0x3d')](_0x3e1d('0x99'),_0x4edc2b,!_['isUndefined'](config[_0x3e1d('0x92')][_0x42d026])?_0x42d026:'')})['then'](function(_0x3a2685){return _0x3a2685[_0x3e1d('0x9c')][_0x3e1d('0x9d')]('true')>=0x0;})['catch'](myreject(_0xb3016c)));}Promise[_0x3e1d('0x9f')](_0xccaa93)[_0x3e1d('0x9b')](function(_0x10160e){var _0x4517db=_[_0x3e1d('0xa0')](_0x10160e);if(_0x4517db){return _0x4b9062(_0x4517db);}else{_0x5dc634['message']=_0x373456?utils['CAMPAIGN_STATUS'][_0x3e1d('0xa1')]:utils['CAMPAIGN_STATUS'][_0x3e1d('0xa2')];return _0xb3016c(msgResponse(_0x3e1d('0xa3'),_0x3e1d('0x8e'),_0x3e1d('0xa4')+_0x373456+'\x20'+_0x254409+_0x3e1d('0xa5')+util[_0x3e1d('0x3c')](_0x4edc2b,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x42d026));}})[_0x3e1d('0xa6')](function(_0x2da611){return _0xb3016c(msgResponse('ifTime',_0x3e1d('0x8e'),JSON[_0x3e1d('0x6e')](_0x2da611)));});});};Dialer[_0x3e1d('0x80')]['loopCampaigns']=function(){var _0x313fab=this;return cmHopper[_0x3e1d('0xa7')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x313fab[_0x3e1d('0xa8')]();},0x3e8);});};Dialer[_0x3e1d('0x80')][_0x3e1d('0xa8')]=function(){var _0xf0a345=this;var _0x15080b;for(var _0x138c4f in this[_0x3e1d('0xa9')]){if(typeof this[_0x3e1d('0xa9')][_0x138c4f]!=='undefined'){_0x15080b=this[_0x3e1d('0xa9')][_0x138c4f];if(utils[_0x3e1d('0xaa')](_0x15080b)&&utils[_0x3e1d('0x73')](_0x15080b)){_0x15080b[_0x3e1d('0x77')]=!![];Promise[_0x3e1d('0xab')]()['then'](checkIsIVRCampaignActive(_0x15080b))['then'](checkInterval(_0x15080b))[_0x3e1d('0x9b')](_0xf0a345[_0x3e1d('0x86')](_0x15080b))[_0x3e1d('0x9b')](_0xf0a345[_0x3e1d('0x8a')](_0x15080b['dialGlobalInterval'],_0x15080b[_0x3e1d('0xac')],_0x15080b['name'],_0x15080b))[_0x3e1d('0x9b')](_0xf0a345['checkIfTimeIntervals'](_0x15080b['Interval'],_0x15080b[_0x3e1d('0xac')],_0x15080b[_0x3e1d('0x5c')],_0x15080b))['then'](_0xf0a345[_0x3e1d('0xad')](_0x15080b))[_0x3e1d('0xa6')](loggerCatchQueueSummary(_0x3e1d('0xae'),_0x15080b));}else{notSendMessagesCampaign(_0x15080b);}}}};Dialer[_0x3e1d('0x80')][_0x3e1d('0xaf')]=function(_0x4707ba){if(_0x4707ba['dialMethod']!==_0x3e1d('0x5')){clearPredictiveAttributes(_0x4707ba);}switch(_0x4707ba[_0x3e1d('0xb0')]){case _0x3e1d('0xb1'):this[_0x3e1d('0xb2')](_0x4707ba,0x1);break;case'power':this[_0x3e1d('0xb2')](_0x4707ba,_0x4707ba[_0x3e1d('0xb3')]);break;case'predictive':this[_0x3e1d('0x5')](_0x4707ba);break;case _0x3e1d('0xb4'):this['handlePower'](_0x4707ba,0x1);break;default:logger[_0x3e1d('0x5f')](_0x3e1d('0xb5'),_0x4707ba[_0x3e1d('0x5c')],_0x3e1d('0xb6'));}};Dialer[_0x3e1d('0x80')][_0x3e1d('0x8d')]=function(_0x54370d,_0x51fce7){var _0xad2575=_0x54370d[_0x3e1d('0xac')];var _0x529ca7=_0x51fce7?_0x54370d['dialGlobalInterval']:_0x54370d[_0x3e1d('0x6f')][_0x3e1d('0x72')];logger[_0x3e1d('0xb7')]('Dialer::ifTime()',_0x529ca7,_0xad2575,_0x54370d[_0x3e1d('0x5c')],util['format'](_0x3e1d('0xb8'),_0x54370d['name'],_0x54370d['id']));var _0x7de256=null;return Interval[_0x3e1d('0xb9')](_0x529ca7,_0xad2575)['then'](function(_0x228b9f){if(_0x228b9f===!![]){return _0x228b9f;}else{_0x54370d[_0x3e1d('0x64')]=_0x51fce7?utils[_0x3e1d('0x65')][_0x3e1d('0xa1')]:utils[_0x3e1d('0x65')][_0x3e1d('0xa2')];_0x7de256=msgResponse('[ifTime][promiseAll]',_0x3e1d('0x8e'),'Global:\x20'+_0x51fce7+'\x20'+_0x54370d[_0x3e1d('0x5c')]+_0x3e1d('0xa5')+util['inspect'](_0x529ca7,{'showHidden':![],'depth':null})+_0x3e1d('0xba')+_0xad2575);}if(_0x7de256!==null){logger[_0x3e1d('0xb7')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x7de256);_0x7de256['isGlobal']=_0x51fce7;throw _0x7de256;}})[_0x3e1d('0xa6')](function(_0x2661bf){logger[_0x3e1d('0x5f')](_0x3e1d('0xbb'),_0x2661bf);throw msgResponse(_0x3e1d('0x7e'),_0x3e1d('0x7f'),util[_0x3e1d('0x3c')](_0x2661bf,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0x3e1d('0xbc')]=function(_0x1f19fe){if(this['voiceQueues'][_0x1f19fe[_0x3e1d('0xbd')]]){if(this[_0x3e1d('0xbe')][_0x1f19fe[_0x3e1d('0xbf')]]&&this[_0x3e1d('0xbe')][_0x1f19fe[_0x3e1d('0xbf')]][_0x3e1d('0xc0')]!=='ivr'){this[_0x3e1d('0xc1')](this[_0x3e1d('0x16')][_0x1f19fe['queue']]);this[_0x3e1d('0xbe')][_0x1f19fe['uniqueid']]['answertime']=moment()['format'](_0x3e1d('0xc2'));}}};Dialer[_0x3e1d('0x80')][_0x3e1d('0x2b')]=function(_0x472094){var _0x2e5c3f=this[_0x3e1d('0xbe')][_0x472094[_0x3e1d('0xbf')]];if(this[_0x3e1d('0x16')][_0x472094[_0x3e1d('0xbd')]]){if(_0x2e5c3f&&_0x2e5c3f['type']!=='ivr'){delete this[_0x3e1d('0xbe')][_0x472094[_0x3e1d('0xbf')]];this[_0x3e1d('0x16')][_0x472094[_0x3e1d('0xbd')]][_0x3e1d('0xc3')]+=0x1;var _0x1f3746=new AgentComplete(_0x2e5c3f,_0x472094);if(_0x472094['reason']==='agent'){_0x1f3746[_0x3e1d('0xc4')]=this['voiceQueues'][_0x472094[_0x3e1d('0xbd')]][_0x3e1d('0xc5')]&&this[_0x3e1d('0x16')][_0x472094[_0x3e1d('0xbd')]][_0x3e1d('0xc6')]?moment()[_0x3e1d('0x3d')](_0x3e1d('0xc2')):undefined;}hopperUtils[_0x3e1d('0xc7')](_0x1f3746)[_0x3e1d('0xa6')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x3e1d('0xc8')](_0x1f3746)[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0xc9')));}}};Dialer['prototype'][_0x3e1d('0x27')]=function(_0x87d050){var _0x56286b=this[_0x3e1d('0xbe')][_0x87d050[_0x3e1d('0xbf')]];var _0x2b7138=this;var _0x32eadb=![];var _0x309e24;var _0x11e878;if(this[_0x3e1d('0x16')][_0x87d050['queue']]){if(_0x56286b&&_0x56286b['type']!==_0x3e1d('0xca')){delete this['uniqueId'][_0x87d050[_0x3e1d('0xbf')]];this[_0x3e1d('0xc1')](this[_0x3e1d('0x16')][_0x87d050[_0x3e1d('0xbd')]]);_0x56286b['droptime']=moment()[_0x3e1d('0x3d')](_0x3e1d('0xc2'));var _0x3863e7=new QueueCallerAbandon(_0x56286b,_0x87d050);if(utils['getSeconds'](_0x56286b[_0x3e1d('0xcb')],_0x56286b['responsetime'])>=_0x56286b['dialQueueTimeout']){this['voiceQueues'][_0x87d050['queue']][_0x3e1d('0x47')]+=0x1;this[_0x3e1d('0x16')][_0x87d050[_0x3e1d('0xbd')]][_0x3e1d('0xcc')]+=0x1;this[_0x3e1d('0x16')][_0x87d050[_0x3e1d('0xbd')]][_0x3e1d('0xcd')]+=0x1;_0x3863e7[_0x3e1d('0xce')]=0xa;_0x3863e7[_0x3e1d('0x6a')]='Drop';_0x3863e7[_0x3e1d('0xcf')]=_0x3e1d('0xd0');_0x3863e7[_0x3e1d('0xc4')]=this[_0x3e1d('0x16')][_0x87d050[_0x3e1d('0xbd')]][_0x3e1d('0xc5')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x3863e7[_0x3e1d('0xd1')]+=0x1;_0x3863e7['countglobal']+=0x1;_0x309e24=this[_0x3e1d('0x16')][_0x87d050[_0x3e1d('0xbd')]][_0x3e1d('0xd2')];_0x11e878=this[_0x3e1d('0x16')][_0x87d050['queue']]['callAdditionalPhoneAfterMin'];hopperUtils[_0x3e1d('0xd3')](_0x3863e7,_0x3863e7[_0x3e1d('0xce')],_0x56286b['voiceQueue'])['then'](function(_0x211758){_0x32eadb=_0x211758[_0x3e1d('0xd4')]==0x1;if(_0x3863e7[_0x3e1d('0xd1')]>=_0x2b7138[_0x3e1d('0x16')][_0x87d050[_0x3e1d('0xbd')]][_0x3e1d('0xd5')]){_0x2b7138['queueCallerAbandonCreateState'](_0x3863e7,_0x211758['additional']);}else{hopperUtils[_0x3e1d('0xd6')]({'active':![],'countdropretry':_0x3863e7['countdropretry'],'scheduledat':moment()[_0x3e1d('0xd7')](_0x2b7138[_0x3e1d('0x16')][_0x87d050['queue']]['dialDropRetryFrequency'],_0x3e1d('0xd8'))[_0x3e1d('0x3d')](_0x3e1d('0xc2')),'ContactId':_0x56286b[_0x3e1d('0xd9')],'ListId':_0x56286b[_0x3e1d('0xda')],'VoiceQueueId':_0x56286b['VoiceQueueId']||undefined,'CampaignId':_0x56286b[_0x3e1d('0xdb')]||undefined})[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0xdc')));var _0x3e1303=new History(_0x3863e7);_0x3e1303[_0x3e1d('0xce')]=0xa;_0x3e1303[_0x3e1d('0x6a')]=_0x3e1d('0xdd');_0x3e1303[_0x3e1d('0xde')]=moment()[_0x3e1d('0x3d')]('YYYY-MM-DD\x20HH:mm:ss');_0x3e1303[_0x3e1d('0xdf')]=_0x3e1303[_0x3e1d('0xde')];_0x3e1303[_0x3e1d('0xe0')]=_0x3863e7['calleridname'];_0x3e1303[_0x3e1d('0xe1')]=_0x3863e7['calleridnum'];hopperUtils[_0x3e1d('0xc7')](_0x3e1303)[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0xe2')));}})[_0x3e1d('0x9b')](function(){if(_0x32eadb)hopperUtils['swapAdditionalPhones'](_0x3863e7,_0x309e24,_0x11e878)[_0x3e1d('0x9b')](function(){return 0x1;});});}else{this['voiceQueues'][_0x87d050[_0x3e1d('0xbd')]][_0x3e1d('0x49')]+=0x1;this[_0x3e1d('0x16')][_0x87d050[_0x3e1d('0xbd')]]['outboundDropCallsDayCallersExit']+=0x1;_0x3863e7['state']=0xb;_0x3863e7[_0x3e1d('0x6a')]='Abandoned';_0x3863e7[_0x3e1d('0xcf')]='CALLEREXIT';_0x3863e7[_0x3e1d('0xe3')]+=0x1;_0x3863e7[_0x3e1d('0xe4')]+=0x1;_0x309e24=this[_0x3e1d('0x16')][_0x87d050[_0x3e1d('0xbd')]]['dialAbandonedRetryFrequency'];_0x11e878=this[_0x3e1d('0x16')][_0x87d050['queue']]['callAdditionalPhoneAfterMin'];hopperUtils['verifyAdditionalPhones'](_0x3863e7,_0x3863e7[_0x3e1d('0xce')],_0x56286b[_0x3e1d('0xe5')])['then'](function(_0x376652){if(_0x3863e7[_0x3e1d('0xe3')]>=_0x2b7138['voiceQueues'][_0x87d050[_0x3e1d('0xbd')]]['dialAbandonedMaxRetry']){_0x2b7138['queueCallerAbandonCreateState'](_0x3863e7,_0x376652[_0x3e1d('0xd4')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x3863e7[_0x3e1d('0xe3')],'scheduledat':moment()[_0x3e1d('0xd7')](_0x2b7138[_0x3e1d('0x16')][_0x87d050[_0x3e1d('0xbd')]][_0x3e1d('0xe6')],'minutes')[_0x3e1d('0x3d')](_0x3e1d('0xc2')),'ContactId':_0x56286b[_0x3e1d('0xd9')],'ListId':_0x56286b[_0x3e1d('0xda')],'VoiceQueueId':_0x56286b[_0x3e1d('0xe7')]||undefined,'CampaignId':_0x56286b['CampaignId']||undefined})[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0xe8')));var _0x32a265=new History(_0x3863e7);_0x32a265[_0x3e1d('0xce')]=0xb;_0x32a265['statedesc']='Abandoned';_0x32a265[_0x3e1d('0xde')]=moment()[_0x3e1d('0x3d')](_0x3e1d('0xc2'));_0x32a265[_0x3e1d('0xdf')]=_0x32a265['starttime'];_0x32a265[_0x3e1d('0xe0')]=_0x3863e7[_0x3e1d('0xe0')];_0x32a265[_0x3e1d('0xe1')]=_0x3863e7['calleridnum'];hopperUtils[_0x3e1d('0xc7')](_0x32a265)['catch'](loggerCatch(_0x3e1d('0xe9')));}})[_0x3e1d('0x9b')](function(){if(_0x32eadb)hopperUtils[_0x3e1d('0xea')](_0x3863e7,_0x309e24,_0x11e878)[_0x3e1d('0x9b')](function(){return 0x1;});});}}}};Dialer[_0x3e1d('0x80')]['syncNewExten']=function(_0x1a75ce){if(this[_0x3e1d('0x1b')][_0x1a75ce[_0x3e1d('0xbf')]]){this[_0x3e1d('0x1b')][_0x1a75ce[_0x3e1d('0xbf')]][_0x3e1d('0xeb')]=_0x1a75ce['channel'];}if(this[_0x3e1d('0xbe')][_0x1a75ce[_0x3e1d('0xbf')]]){this[_0x3e1d('0xbe')][_0x1a75ce[_0x3e1d('0xbf')]][_0x3e1d('0xeb')]=_0x1a75ce[_0x3e1d('0xeb')];}};Dialer[_0x3e1d('0x80')][_0x3e1d('0x32')]=function(_0x26766a){if(!this[_0x3e1d('0x1b')][_0x26766a['actionid']]){return;}var _0x284fdf=this[_0x3e1d('0x16')][this[_0x3e1d('0x1b')][_0x26766a[_0x3e1d('0xec')]][_0x3e1d('0xbd')]][_0x3e1d('0xed')]||_0x3e1d('0xee');if(_0x284fdf==='roundrobin'){if(this['actions'][_0x26766a[_0x3e1d('0xec')]]&&_[_0x3e1d('0xef')](this[_0x3e1d('0x1b')][_0x26766a[_0x3e1d('0xec')]][_0x3e1d('0xf0')])&&_0x26766a['status']==='1'&&_0x26766a[_0x3e1d('0xf1')]==='0'){if(this['agents'][_0x26766a['stateinterface']]){if(!this[_0x3e1d('0x17')][_0x26766a['stateinterface']][_0x3e1d('0xf0')]){this[_0x3e1d('0x17')][_0x26766a['stateinterface']][_0x3e1d('0xf0')]=!![];this[_0x3e1d('0x1b')][_0x26766a['actionid']][_0x3e1d('0xf0')]=!![];this[_0x3e1d('0x1b')][_0x26766a[_0x3e1d('0xec')]][_0x3e1d('0xf2')]=_0x26766a[_0x3e1d('0xf2')];}}}}else if(_0x284fdf===_0x3e1d('0xee')){if(this['actions'][_0x26766a[_0x3e1d('0xec')]]){if(this[_0x3e1d('0x17')][_0x26766a[_0x3e1d('0xf2')]]){this['actions'][_0x26766a['actionid']]['stateinterface']=_0x26766a['stateinterface'];if(_['isNil'](this['queueBooked'][this[_0x3e1d('0x1b')][_0x26766a[_0x3e1d('0xec')]][_0x3e1d('0xbd')]])){this[_0x3e1d('0x21')][this[_0x3e1d('0x1b')][_0x26766a[_0x3e1d('0xec')]][_0x3e1d('0xbd')]]=[];}this['queueBooked'][this['actions'][_0x26766a[_0x3e1d('0xec')]]['queue']][_0x3e1d('0x97')](_[_0x3e1d('0x59')](_[_0x3e1d('0xf3')](this[_0x3e1d('0x1b')][_0x26766a[_0x3e1d('0xec')]],[_0x3e1d('0xf4'),_0x3e1d('0xf2')]),{'status':_0x26766a[_0x3e1d('0x84')],'paused':_0x26766a['paused']}));}}}};Dialer[_0x3e1d('0x80')][_0x3e1d('0x34')]=function(_0x2068ab){if(!this[_0x3e1d('0x1b')][_0x2068ab[_0x3e1d('0xec')]]){return;}var _0x22d434=this;var _0x2e5c86=this['voiceQueues'][this['actions'][_0x2068ab['actionid']][_0x3e1d('0xbd')]];var _0x411473=_0x2e5c86['strategy']||_0x3e1d('0xee');if(_0x411473===_0x3e1d('0xf5')){if(this['actions'][_0x2068ab['actionid']]&&this[_0x3e1d('0x1b')][_0x2068ab[_0x3e1d('0xec')]][_0x3e1d('0xf2')]){this['preview'][_0x3e1d('0xf6')](this[_0x3e1d('0x1b')][_0x2068ab['actionid']][_0x3e1d('0xf4')],this['actions'][_0x2068ab[_0x3e1d('0xec')]][_0x3e1d('0xf2')])[_0x3e1d('0xa6')](function(_0xf51727){logger[_0x3e1d('0x5f')](_0x3e1d('0xf7'),util['inspect'](_0xf51727,{'showHidden':![],'depth':null}));})[_0x3e1d('0x13')](function(){_0x22d434[_0x3e1d('0xc1')](_0x22d434[_0x3e1d('0x16')][_0x22d434[_0x3e1d('0x1b')][_0x2068ab[_0x3e1d('0xec')]][_0x3e1d('0xbd')]]);_0x22d434['agents'][_0x22d434[_0x3e1d('0x1b')][_0x2068ab['actionid']]['stateinterface']]['locked']=![];delete _0x22d434[_0x3e1d('0x1b')][_0x2068ab[_0x3e1d('0xec')]];unlockQueueStatus(_0x2e5c86);});}else{this['updateOriginated'](this[_0x3e1d('0x16')][this[_0x3e1d('0x1b')][_0x2068ab['actionid']][_0x3e1d('0xbd')]]);hopperUtils[_0x3e1d('0xd6')]({'active':![],'ContactId':this[_0x3e1d('0x1b')][_0x2068ab['actionid']][_0x3e1d('0xd9')],'ListId':this['actions'][_0x2068ab['actionid']][_0x3e1d('0xda')],'VoiceQueueId':this[_0x3e1d('0x1b')][_0x2068ab['actionid']][_0x3e1d('0xe7')]||undefined,'CampaignId':this[_0x3e1d('0x1b')][_0x2068ab['actionid']]['CampaignId']||undefined})[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0xf8')));delete this[_0x3e1d('0x1b')][_0x2068ab[_0x3e1d('0xec')]];unlockQueueStatus(_0x2e5c86);}}else if(_0x411473===_0x3e1d('0xee')){var _0x492dda;if(this[_0x3e1d('0x1b')][_0x2068ab[_0x3e1d('0xec')]]&&!_[_0x3e1d('0x3f')](this[_0x3e1d('0x21')][this[_0x3e1d('0x1b')][_0x2068ab['actionid']][_0x3e1d('0xbd')]])){if(this[_0x3e1d('0x22')][_0x22d434[_0x3e1d('0x1b')][_0x2068ab[_0x3e1d('0xec')]][_0x3e1d('0xbd')]]){this[_0x3e1d('0x22')][_0x22d434[_0x3e1d('0x1b')][_0x2068ab[_0x3e1d('0xec')]][_0x3e1d('0xbd')]]=this['queueBookedRR'][this[_0x3e1d('0x1b')][_0x2068ab[_0x3e1d('0xec')]]['queue']]?this[_0x3e1d('0x22')][this[_0x3e1d('0x1b')][_0x2068ab[_0x3e1d('0xec')]][_0x3e1d('0xbd')]]:this[_0x3e1d('0x21')][this[_0x3e1d('0x1b')][_0x2068ab[_0x3e1d('0xec')]][_0x3e1d('0xbd')]]?this['queueBooked'][this[_0x3e1d('0x1b')][_0x2068ab[_0x3e1d('0xec')]][_0x3e1d('0xbd')]][_0x3e1d('0xf9')]||0x0:0x0;}this[_0x3e1d('0x21')][this[_0x3e1d('0x1b')][_0x2068ab['actionid']][_0x3e1d('0xbd')]][_0x3e1d('0xf9')]=this[_0x3e1d('0x22')][this[_0x3e1d('0x1b')][_0x2068ab[_0x3e1d('0xec')]]['queue']];for(var _0x33915e=0x0;_0x33915e=_0x589afe[_0x3e1d('0x11c')]){_0x354fd6[_0x3e1d('0x11d')](_0x57cd6c,_0x32ea7a,_0x20c599,_0x3e1d('0x11e'));}else{if(_0x57cd6c[_0x3e1d('0x11f')]>=_0x589afe['dialMachineMaxRetry']){_0x354fd6[_0x3e1d('0x120')](_0x57cd6c,_0x32ea7a,_0x20c599,'reason\x2019\x20machine....');}else{hopperUtils[_0x3e1d('0xd6')]({'active':![],'countmachineretry':_0x57cd6c[_0x3e1d('0x11f')],'scheduledat':moment()[_0x3e1d('0xd7')](_0x589afe[_0x3e1d('0x121')],_0x3e1d('0xd8'))[_0x3e1d('0x3d')](_0x3e1d('0xc2')),'ContactId':_0x57cd6c['ContactId'],'ListId':_0x57cd6c[_0x3e1d('0xda')],'VoiceQueueId':_0x57cd6c[_0x3e1d('0xe7')]||undefined,'CampaignId':_0x57cd6c[_0x3e1d('0xdb')]||undefined})[_0x3e1d('0xa6')](loggerCatch('[rescheduleContact][Machine]'));_0x32ea7a({'reschedule':0x1});}}});}if(_0x4ffe01[_0x3e1d('0xc0')]===_0x3e1d('0xca')&&this[_0x3e1d('0xa9')][_0x4ffe01[_0x3e1d('0xbd')]][_0x3e1d('0x10c')]&&_0x4e5458[_0x3e1d('0x117')]==='HANGUP'){delete this[_0x3e1d('0xbe')][_0x4e5458[_0x3e1d('0xbf')]];this[_0x3e1d('0xc1')](this[_0x3e1d('0xa9')][_0x4ffe01[_0x3e1d('0xbd')]]);_0x507078=new Hangup(_0x4ffe01,_0x4e5458);_0x507078[_0x3e1d('0xce')]=0x12;_0x507078['statedesc']=_0x3e1d('0x10f');_0x507078['membername']=_0x3e1d('0x110');ami[_0x3e1d('0x39')](_0x3e1d('0x111'),ut['buildObj'](_0x507078,_0x3e1d('0x113')));this['saveInDb'](_0x507078,'[syncHangupInAMDIvr][createHistory]',_0x3e1d('0x122'));}if(_0x4ffe01[_0x3e1d('0xc0')]==='ivr'&&this[_0x3e1d('0xa9')][_0x4ffe01[_0x3e1d('0xbd')]]['dialAMDActive']&&_0x4e5458[_0x3e1d('0x117')]==='MACHINE'){return new Promise(function(_0x3a4080,_0x294b4d){delete _0x354fd6[_0x3e1d('0xbe')][_0x4e5458[_0x3e1d('0xbf')]];_0x354fd6[_0x3e1d('0xc1')](_0x354fd6['campaigns'][_0x4ffe01['queue']]);_0x354fd6[_0x3e1d('0xa9')][_0x4ffe01[_0x3e1d('0xbd')]][_0x3e1d('0xc3')]+=0x1;_0x354fd6[_0x3e1d('0xa9')][_0x4ffe01[_0x3e1d('0xbd')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x19069a=_0x354fd6[_0x3e1d('0xa9')][_0x4ffe01[_0x3e1d('0xbd')]];var _0x2fa1d1=new Hangup(_0x4ffe01,_0x4e5458);_0x2fa1d1[_0x3e1d('0xce')]=0x13;_0x2fa1d1[_0x3e1d('0x6a')]=_0x3e1d('0x123');_0x2fa1d1[_0x3e1d('0x124')]=_0x3e1d('0x110');_0x2fa1d1['countmachineretry']+=0x1;_0x2fa1d1[_0x3e1d('0xe4')]+=0x1;_0x2fa1d1[_0x3e1d('0x113')]=!![];ami[_0x3e1d('0x39')](_0x3e1d('0x111'),ut[_0x3e1d('0x112')](_0x2fa1d1,_0x3e1d('0x113')));hopperUtils[_0x3e1d('0xc7')](_0x2fa1d1)[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x118')));if(_0x2fa1d1['countbusyretry']+_0x2fa1d1[_0x3e1d('0x11a')]+_0x2fa1d1['countnoanswerretry']+_0x2fa1d1['countnosuchnumberretry']+_0x2fa1d1['countdropretry']+_0x2fa1d1[_0x3e1d('0xe3')]+_0x2fa1d1[_0x3e1d('0x11f')]+_0x2fa1d1[_0x3e1d('0x11b')]>=_0x19069a[_0x3e1d('0x11c')]){_0x354fd6['stateGlobal'](_0x2fa1d1,_0x3a4080,_0x294b4d,_0x3e1d('0x11e'));}else{if(_0x2fa1d1[_0x3e1d('0x11f')]>=_0x19069a['dialMachineMaxRetry']){_0x354fd6['createStateFinal'](_0x2fa1d1,_0x3a4080,_0x294b4d,_0x3e1d('0x125'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x2fa1d1[_0x3e1d('0x11f')],'scheduledat':moment()[_0x3e1d('0xd7')](_0x19069a[_0x3e1d('0x121')],_0x3e1d('0xd8'))['format'](_0x3e1d('0xc2')),'ContactId':_0x2fa1d1[_0x3e1d('0xd9')],'ListId':_0x2fa1d1['ListId'],'VoiceQueueId':_0x2fa1d1[_0x3e1d('0xe7')]||undefined,'CampaignId':_0x2fa1d1[_0x3e1d('0xdb')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x3a4080({'reschedule':0x1});}}});}}};Dialer[_0x3e1d('0x80')][_0x3e1d('0x2f')]=function(_0x63e443){var _0xd8db0e=this[_0x3e1d('0xbe')][_0x63e443[_0x3e1d('0xbf')]];var _0x306124;if(_0xd8db0e&&_0xd8db0e[_0x3e1d('0xc0')]===_0x3e1d('0xca')){delete this[_0x3e1d('0xbe')][_0x63e443[_0x3e1d('0xbf')]];this[_0x3e1d('0xc1')](this[_0x3e1d('0xa9')][_0xd8db0e[_0x3e1d('0xbd')]]);this['campaigns'][_0xd8db0e[_0x3e1d('0xbd')]][_0x3e1d('0x126')]+=0x1;_0x306124=new Hangup(_0xd8db0e,_0x63e443);hopperUtils['createHistory'](_0x306124)[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x127')));hopperUtils[_0x3e1d('0xc8')](_0x306124)['catch'](loggerCatch(_0x3e1d('0x128')));}if(_0xd8db0e&&_0xd8db0e['type']!==_0x3e1d('0xca')&&isNotNull(this[_0x3e1d('0x16')][_0xd8db0e[_0x3e1d('0xbd')]]['dialQueueProject'])){delete this['uniqueId'][_0x63e443[_0x3e1d('0xbf')]];this[_0x3e1d('0xc1')](this[_0x3e1d('0x16')][_0xd8db0e['queue']]);this['voiceQueues'][_0xd8db0e['queue']][_0x3e1d('0xc3')]+=0x1;this[_0x3e1d('0x16')][_0xd8db0e['queue']][_0x3e1d('0x10e')]+=0x1;_0x306124=new Hangup(_0xd8db0e,_0x63e443);_0x306124['state']=0x10;_0x306124[_0x3e1d('0x6a')]=_0x3e1d('0x129');_0x306124['membername']='AGI';hopperUtils[_0x3e1d('0xc7')](_0x306124)[_0x3e1d('0xa6')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x3e1d('0xc8')](_0x306124)[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x128')));}if(_0xd8db0e&&_0xd8db0e[_0x3e1d('0xc0')]!==_0x3e1d('0xca')&&!isNotNull(this[_0x3e1d('0x16')][_0xd8db0e[_0x3e1d('0xbd')]]['dialQueueProject'])){delete this[_0x3e1d('0xbe')][_0x63e443[_0x3e1d('0xbf')]];this[_0x3e1d('0xc1')](this[_0x3e1d('0x16')][_0xd8db0e[_0x3e1d('0xbd')]]);this['voiceQueues'][_0xd8db0e[_0x3e1d('0xbd')]][_0x3e1d('0x12a')]+=0x1;_0x306124=new Hangup(_0xd8db0e,_0x63e443);_0x306124['state']=0xc;_0x306124[_0x3e1d('0x6a')]=_0x63e443[_0x3e1d('0x12b')];_0x306124[_0x3e1d('0x124')]=_0x3e1d('0x12c');hopperUtils[_0x3e1d('0xc7')](_0x306124)[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x127')));hopperUtils[_0x3e1d('0xc8')](_0x306124)[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x128')));}};Dialer['prototype'][_0x3e1d('0x7')]=function(_0x30f20f){var _0x2938ab=this;if(!_0x2938ab[_0x3e1d('0x23')][_0x30f20f['name']]){_0x2938ab[_0x3e1d('0x23')][_0x30f20f[_0x3e1d('0x5c')]]={'running':![]};}else if(_0x2938ab[_0x3e1d('0x23')][_0x30f20f[_0x3e1d('0x5c')]]['running']===!![]){return;}else if(_0x2938ab['queuesSummary'][_0x30f20f['name']][_0x3e1d('0x12d')]===![]){_0x2938ab[_0x3e1d('0x23')][_0x30f20f[_0x3e1d('0x5c')]][_0x3e1d('0x12d')]=!![];}var _0x16003d=_0x2938ab['voiceQueues'][_0x30f20f[_0x3e1d('0x5c')]];var _0x54034b=_0x16003d[_0x3e1d('0x64')]!==utils['CAMPAIGN_STATUS']['INACTIVE'];var _0x5441e0=utils[_0x3e1d('0x12e')](_0x16003d);_0x16003d[_0x3e1d('0x12f')]=utils[_0x3e1d('0x130')](_0x16003d,_0x2938ab[_0x3e1d('0x18')]);Promise[_0x3e1d('0xab')]()[_0x3e1d('0x9b')](function(){if(_0x16003d['statusMessage']===utils[_0x3e1d('0x65')][_0x3e1d('0x79')]){if(_0x54034b){clearPredictiveAttributes(_0x16003d);_0x30f20f[_0x3e1d('0x1e')]=undefined;_0x30f20f[_0x3e1d('0x1f')]=undefined;}if(_0x16003d[_0x3e1d('0x12f')]===utils['CAMPAIGN_STATUS']['INACTIVE']){_0x30f20f[_0x3e1d('0x131')]=0x0;_0x30f20f[_0x3e1d('0xf1')]=0x0;_0x30f20f[_0x3e1d('0x132')]=0x0;_0x30f20f[_0x3e1d('0x133')]=0x0;_0x30f20f['pTalking']=0x0;}}else if(_0x16003d[_0x3e1d('0x12f')]===utils[_0x3e1d('0x65')][_0x3e1d('0x134')]&&!_0x5441e0){return _0x2938ab[_0x3e1d('0x8d')](_0x16003d,!![])['then'](function(){return _0x2938ab[_0x3e1d('0x8d')](_0x16003d,![]);})['then'](function(){return _0x2938ab[_0x3e1d('0xaf')](_0x16003d);})[_0x3e1d('0xa6')](function(_0x1ded6d){loggerSyncQueueSummary[_0x3e1d('0x3a')](_0x3e1d('0x135'),util[_0x3e1d('0x3c')](_0x1ded6d,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x16003d);});}else{clearPredictiveAttributes(_0x16003d);}})[_0x3e1d('0x9b')](function(){var _0x1173bf=_0x30f20f[_0x3e1d('0x136')](_0x16003d);if(_0x1173bf||_0x16003d[_0x3e1d('0x137')]){_0x16003d['queueSummaryCountersUpdated']=![];_0x30f20f['updateReportFromOutboundQueue'](_0x16003d);Object[_0x3e1d('0x138')](_0x16003d,_0x30f20f);emitOutboundVoiceQueueSummary(_0x30f20f);}_0x2938ab[_0x3e1d('0x23')][_0x16003d[_0x3e1d('0x5c')]][_0x3e1d('0x12d')]=![];})[_0x3e1d('0xa6')](function(_0x2d259e){logger[_0x3e1d('0x5f')](_0x3e1d('0x135'),util[_0x3e1d('0x3c')](_0x2d259e,{'showHidden':![],'depth':null}));_0x2938ab[_0x3e1d('0x23')][_0x16003d[_0x3e1d('0x5c')]][_0x3e1d('0x12d')]=![];});};Dialer[_0x3e1d('0x80')]['syncQueueSummaryComplete']=_[_0x3e1d('0x139')](function(){var _0x3846a3=_[_0x3e1d('0x13a')](this[_0x3e1d('0x16')],function(_0x495c66){return _0x495c66['dialPreviewRecallmeReminder'];});var _0x3c4ce2=_[_0x3e1d('0x13a')](this[_0x3e1d('0x17')],function(_0x4cb2cf){return _0x4cb2cf['online']&&_0x4cb2cf[_0x3e1d('0x84')]===_0x3e1d('0x85');});if(_0x3846a3[_0x3e1d('0x96')]>0x0&&_0x3c4ce2['length']>0x0){return Promise[_0x3e1d('0xab')]()[_0x3e1d('0x9b')](cmHopper['handlePreviewRecallNotifications'](_[_0x3e1d('0x13b')](_0x3846a3,'id'),previewRecallmeReminderInterval,_[_0x3e1d('0x13b')](_0x3c4ce2,'id')))[_0x3e1d('0x9b')](function(_0x4ee34a){for(var _0x4565b2=0x0;_0x4565b2<_0x4ee34a[_0x3e1d('0x96')];_0x4565b2++){var _0x3b0521=_0x4ee34a[_0x4565b2]['Agent'][_0x3e1d('0x5c')];if(_0x3b0521)io['to'](util[_0x3e1d('0x3d')](_0x3e1d('0x13c'),_0x3b0521))[_0x3e1d('0x39')]('user:dialPreviewRecallReminder',{'hopper':_0x4ee34a[_0x4565b2]});}})[_0x3e1d('0xa6')](function(_0x172259){logger[_0x3e1d('0x5f')](_0x3e1d('0x13d'),_0x172259);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x3e1d('0x80')]['loopClearZombieChannels']=function(){var _0x31de54=this;setInterval(function(){_0x31de54[_0x3e1d('0x13e')](_0x31de54[_0x3e1d('0xbe')],_0x3e1d('0x13f'));_0x31de54['clearZombieChannels'](_0x31de54[_0x3e1d('0x1b')],'[actions]');},0x32c8);};Dialer[_0x3e1d('0x80')][_0x3e1d('0x13e')]=function(_0x59ea5d,_0x40cdb4){var _0x5bd565=this;for(var _0x478481 in _0x59ea5d){if(typeof _0x59ea5d[_0x478481]!==_0x3e1d('0x140')){this[_0x3e1d('0x14')]['enqueue'](function(){if(!_[_0x3e1d('0xef')](_0x59ea5d[_0x478481])){return ami['Action']({'action':_0x3e1d('0x84'),'channel':_0x59ea5d[_0x478481][_0x3e1d('0xeb')]})[_0x3e1d('0xa6')](function(_0x362811){if(_0x362811[_0x3e1d('0x64')]===_0x3e1d('0x141')){setTimeout(function(){if(_0x59ea5d[_0x478481]&&_0x59ea5d[_0x478481][_0x3e1d('0xc0')]!=='ivr'){_0x5bd565[_0x3e1d('0xc1')](_0x5bd565[_0x3e1d('0x16')][_0x59ea5d[_0x478481][_0x3e1d('0xbd')]]);logger[_0x3e1d('0x5f')](_0x3e1d('0x142'),_0x40cdb4,_0x478481,_0x59ea5d[_0x478481][_0x3e1d('0xbd')]);delete _0x59ea5d[_0x478481];}if(_0x59ea5d[_0x478481]&&_0x59ea5d[_0x478481][_0x3e1d('0xc0')]===_0x3e1d('0xca')){_0x5bd565['updateOriginated'](_0x5bd565['campaigns'][_0x59ea5d[_0x478481][_0x3e1d('0xbd')]]);logger[_0x3e1d('0x5f')](_0x3e1d('0x143'),_0x40cdb4,_0x478481,_0x59ea5d[_0x478481]['queue']);delete _0x59ea5d[_0x478481];}},0x2328);}});}});}}};Dialer[_0x3e1d('0x80')][_0x3e1d('0x144')]=function(_0x259c11){return Promise[_0x3e1d('0xab')]()['then'](voiceQueueRt[_0x3e1d('0x144')](_0x259c11))['catch'](loggerCatch(_0x3e1d('0x145')));};Dialer[_0x3e1d('0x80')][_0x3e1d('0xc1')]=function(_0x2a8d8a){if(!_[_0x3e1d('0x38')](_0x2a8d8a)&&_0x2a8d8a!==null){if(typeof _0x2a8d8a['originated']!==_0x3e1d('0x140')){if(_0x2a8d8a[_0x3e1d('0x78')]>0x0){_0x2a8d8a['originated']-=0x1;}else{logger[_0x3e1d('0x5f')](_0x3e1d('0x146'));}}}else{logger[_0x3e1d('0x5f')](_0x3e1d('0x147'));}};Dialer[_0x3e1d('0x80')][_0x3e1d('0x148')]=function(_0x22ffa0,_0x51378a){var _0x364961=this;return function(_0x983ef9){_0x364961[_0x3e1d('0xc1')](_0x51378a);logger[_0x3e1d('0x5f')](_0x22ffa0,util[_0x3e1d('0x3c')](_0x983ef9,{'showHidden':![],'depth':null}));};};Dialer[_0x3e1d('0x80')][_0x3e1d('0x149')]=function(_0x3bbb41,_0x3285f1,_0x36581a){var _0x31fc2e={'state':0x19,'statedesc':_0x3e1d('0x14a')};this[_0x3e1d('0xc1')](_0x3285f1);this[_0x3e1d('0x114')](_['merge'](_0x31fc2e,_['pick'](_0x36581a,[_0x3e1d('0xd9'),'ListId','UserId',_0x3e1d('0xe7'),'CampaignId'])),_0x3e1d('0x14b'),_0x3e1d('0x14c'));logger[_0x3e1d('0x5f')](_0x3bbb41);};Dialer[_0x3e1d('0x80')][_0x3e1d('0x114')]=function(_0x35710a,_0x17c08c,_0x346c51){hopperUtils[_0x3e1d('0xc7')](_0x35710a)[_0x3e1d('0xa6')](loggerCatch(_0x17c08c));hopperUtils['moveContactManagedDialer'](_0x35710a)[_0x3e1d('0xa6')](loggerCatch(_0x346c51));};Dialer[_0x3e1d('0x80')][_0x3e1d('0x14d')]=function(_0x11823b,_0x5b10d9){hopperUtils['createHistory'](_0x11823b)[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x14e')));if(_0x5b10d9==0x0){hopperUtils[_0x3e1d('0xc8')](_0x11823b)[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x14f')));}};Dialer['prototype']['checkPreviewRecallReminder']=function(_0x1df70f){return Promise[_0x3e1d('0xab')]()[_0x3e1d('0x9b')](cmHopper['handlePreviewRecallNotifications'](_0x1df70f['id'],previewRecallmeReminderInterval))[_0x3e1d('0x9b')](function(_0x40101d){for(var _0x4087de=0x0;_0x4087de<_0x40101d['length'];_0x4087de++){var _0x40acd8=_0x40101d[_0x4087de][_0x3e1d('0x150')][_0x3e1d('0x5c')];if(_0x40acd8)io['to'](util['format'](_0x3e1d('0x13c'),_0x40acd8))['emit'](_0x3e1d('0x151'),{'hopper':_0x40101d[_0x4087de]});}})[_0x3e1d('0xa6')](function(){});};Dialer[_0x3e1d('0x80')][_0x3e1d('0xad')]=function(_0x1237f2){var _0x4872d2=this;return function(){_0x4872d2[_0x3e1d('0x152')](_0x1237f2);};};Dialer[_0x3e1d('0x80')][_0x3e1d('0x153')]=function(_0x27dc7b,_0x1e77d7){var _0x17593c=this;var _0x3adeb4=uuid['v4']();this[_0x3e1d('0x1b')][_0x3adeb4]=new Action(_0x27dc7b,_0x1e77d7,_0x3adeb4);return new Promise(function(_0x218f09,_0x3b7b81){if(_[_0x3e1d('0x38')](_0x27dc7b)&&typeof _0x27dc7b!==_0x3e1d('0x154')){return _0x3b7b81(msgResponse('originate',_0x3e1d('0x8e'),_0x3e1d('0x155')));}if(_[_0x3e1d('0x38')](_0x1e77d7[_0x3e1d('0x156')])||_0x1e77d7[_0x3e1d('0x156')]===null){return _0x3b7b81(msgResponse('originate',_0x3e1d('0x8e'),_0x3e1d('0x157')));}var _0x488cdc={'XMD-CALLERID':_0x17593c[_0x3e1d('0x1b')][_0x3adeb4][_0x3e1d('0x158')](),'XMD-AGI':_0x27dc7b[_0x3e1d('0x159')]?util[_0x3e1d('0x3d')]('\x22agi://%s/square,%s\x22',ipAgi,_0x27dc7b[_0x3e1d('0x159')]):_0x3e1d('0x15a'),'XMD-AGIAFTER':_0x27dc7b[_0x3e1d('0xc5')]?util['format'](_0x3e1d('0x15b'),ipAgi,_0x27dc7b[_0x3e1d('0xc5')]):_0x3e1d('0x15a'),'XMD-QUEUE':utils[_0x3e1d('0x15c')](_0x27dc7b)?util[_0x3e1d('0x3d')](_0x3e1d('0x15d'),_0x27dc7b[_0x3e1d('0x5c')],_0x27dc7b['dialQueueOptions']||'',_0x27dc7b['dialAgiAfterHangupAgent']?'c':'',_0x27dc7b['dialQueueTimeout']||0x3):_0x3e1d('0x15a'),'XMD-CONTACTID':_0x1e77d7['ContactId'],'XMD-CDRTYPE':_0x3e1d('0x3'),'CALLERID(all)':_0x17593c[_0x3e1d('0x1b')][_0x3adeb4][_0x3e1d('0x158')](),'XMD-AMD':_0x27dc7b[_0x3e1d('0x10c')]?'ACTIVE':'NONE','XMD-DESTINATION':_0x3e1d('0x15e')};if(_0x27dc7b[_0x3e1d('0x10c')]){_0x488cdc[_0x3e1d('0x15f')]=_0x27dc7b[_0x3e1d('0x160')]||0x9c4;_0x488cdc[_0x3e1d('0x161')]=_0x27dc7b[_0x3e1d('0x162')]||0x5dc;_0x488cdc[_0x3e1d('0x163')]=_0x27dc7b[_0x3e1d('0x164')]||0x320;_0x488cdc[_0x3e1d('0x165')]=_0x27dc7b[_0x3e1d('0x166')]||0x1388;_0x488cdc[_0x3e1d('0x167')]=_0x27dc7b[_0x3e1d('0x168')]||0x64;_0x488cdc[_0x3e1d('0x169')]=_0x27dc7b[_0x3e1d('0x16a')]||0x32;_0x488cdc[_0x3e1d('0x16b')]=_0x27dc7b[_0x3e1d('0x16c')]||0x3;_0x488cdc['XMD-AMDSILENCETHRESHOLD']=_0x27dc7b[_0x3e1d('0x16d')]||0x100;_0x488cdc['XMD-AMDMAXIMUMWORDLENGTH']=_0x27dc7b[_0x3e1d('0x16e')]||0x1388;}if(utils['isOutboundQueue'](_0x27dc7b)){_0x488cdc[_0x3e1d('0x16f')]=_0x1e77d7[_0x3e1d('0xe7')];}else{_0x488cdc[_0x3e1d('0x170')]=_0x1e77d7[_0x3e1d('0xdb')];}var _0x3b3194=utils[_0x3e1d('0x171')](_0x1e77d7[_0x3e1d('0x172')]);Object['assign'](_0x488cdc,_0x3b3194);var _0x510a93=_0x17593c[_0x3e1d('0x81')](_0x27dc7b[_0x3e1d('0x87')])?utils[_0x3e1d('0x173')](_0x27dc7b[_0x3e1d('0x87')]['callerid'],_0x27dc7b[_0x3e1d('0x174')],_0x27dc7b[_0x3e1d('0x175')]>0x0?utils[_0x3e1d('0x176')](_0x27dc7b[_0x3e1d('0x177')],_0x27dc7b[_0x3e1d('0x175')]):_0x27dc7b[_0x3e1d('0x177')]):utils[_0x3e1d('0x173')](_[_0x3e1d('0xef')](_0x27dc7b['TrunkBackup'])?_0x27dc7b[_0x3e1d('0x87')][_0x3e1d('0x178')]:_0x27dc7b[_0x3e1d('0x88')]['callerid'],_0x27dc7b[_0x3e1d('0x174')],_0x27dc7b[_0x3e1d('0x175')]>0x0?utils[_0x3e1d('0x176')](_0x27dc7b[_0x3e1d('0x177')],_0x27dc7b[_0x3e1d('0x175')]):_0x27dc7b[_0x3e1d('0x177')]);if(_0x510a93){_0x488cdc[_0x3e1d('0x179')]=_0x17593c[_0x3e1d('0x1b')][_0x3adeb4][_0x3e1d('0x17a')]=utils[_0x3e1d('0x17b')](_0x510a93);_0x488cdc[_0x3e1d('0x17c')]=_0x1e77d7[_0x3e1d('0x156')];}_0x27dc7b[_0x3e1d('0x17d')]=_0x488cdc;return ami[_0x3e1d('0x9e')]({'actionid':_0x3adeb4,'action':_0x3e1d('0x17e'),'channel':_0x17593c[_0x3e1d('0x81')](_0x27dc7b[_0x3e1d('0x87')])?util[_0x3e1d('0x3d')](_0x3e1d('0x17f'),_0x27dc7b[_0x3e1d('0x87')][_0x3e1d('0x5c')],isNotNull(_0x27dc7b[_0x3e1d('0x180')])?_0x27dc7b[_0x3e1d('0x180')]['trim']()||'':'',_0x27dc7b[_0x3e1d('0x181')]>0x0?_0x1e77d7['phone']['substring'](_0x27dc7b[_0x3e1d('0x181')]):_0x1e77d7[_0x3e1d('0x156')]):util['format'](_0x3e1d('0x17f'),_['isNil'](_0x27dc7b[_0x3e1d('0x88')])?_0x27dc7b['Trunk'][_0x3e1d('0x5c')]:_0x27dc7b[_0x3e1d('0x88')][_0x3e1d('0x5c')],isNotNull(_0x27dc7b[_0x3e1d('0x180')])?_0x27dc7b[_0x3e1d('0x180')][_0x3e1d('0x182')]()||'':'',_0x27dc7b[_0x3e1d('0x181')]>0x0?_0x1e77d7[_0x3e1d('0x156')]['substring'](_0x27dc7b['dialCutDigit']):_0x1e77d7[_0x3e1d('0x156')]),'callerid':_0x510a93,'Exten':_0x3e1d('0x15e'),'Context':'from-sip','Priority':'1','variable':_0x488cdc,'timeout':(_0x27dc7b[_0x3e1d('0x183')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3adeb4})[_0x3e1d('0x9b')](function(_0x3ecfc4){return _0x218f09(_0x3ecfc4);})['catch'](function(_0x2ebfe5){_0x27dc7b[_0x3e1d('0x184')]+=0x1;var _0x113ac9=new History(_0x17593c[_0x3e1d('0x1b')][_0x3adeb4]);logger['error'](util[_0x3e1d('0x3d')](_0x3e1d('0x185'),JSON[_0x3e1d('0x6e')](_0x2ebfe5)));_0x113ac9[_0x3e1d('0xce')]=0xe;_0x113ac9['statedesc']='OriginateError';_0x113ac9[_0x3e1d('0xde')]=moment()[_0x3e1d('0x3d')](_0x3e1d('0xc2'));_0x113ac9[_0x3e1d('0xdf')]=_0x113ac9[_0x3e1d('0xde')];hopperUtils[_0x3e1d('0xc7')](_0x113ac9)[_0x3e1d('0xa6')](loggerCatch('[originate][error]'));_0x17593c[_0x3e1d('0xc8')](_0x113ac9)[_0x3e1d('0xa6')](loggerCatch('[originate][error]'))[_0x3e1d('0x13')](function(){delete _0x17593c[_0x3e1d('0x1b')][_0x3adeb4];return _0x3b7b81(msgResponse(_0x3e1d('0x17e'),_0x3e1d('0x7f'),_0x3e1d('0x186')));});});});};Dialer[_0x3e1d('0x80')][_0x3e1d('0x187')]=function(_0x42edd0,_0x1dd21c,_0x505636){var _0x502c68=new History(_0x1dd21c);if(_0x502c68[_0x3e1d('0x119')]+_0x502c68[_0x3e1d('0x11a')]+_0x502c68[_0x3e1d('0x188')]+_0x502c68[_0x3e1d('0x189')]+_0x502c68[_0x3e1d('0xd1')]+_0x502c68[_0x3e1d('0xe3')]+_0x502c68[_0x3e1d('0x11f')]+_0x502c68['countagentrejectretry']>=_0x505636[_0x3e1d('0x11c')]-0x1){return!![];}switch(_0x42edd0){case 0x3:if(_0x502c68[_0x3e1d('0x188')]>=_0x505636[_0x3e1d('0x18a')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x502c68[_0x3e1d('0x188')]+=0x1,'scheduledat':moment()[_0x3e1d('0xd7')](_0x505636[_0x3e1d('0x18b')],_0x3e1d('0xd8'))[_0x3e1d('0x3d')](_0x3e1d('0xc2')),'ContactId':_0x502c68[_0x3e1d('0xd9')],'ListId':_0x502c68['ListId'],'VoiceQueueId':_0x502c68[_0x3e1d('0xe7')]||undefined,'CampaignId':_0x502c68[_0x3e1d('0xdb')]||undefined})[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x18c')));break;case 0x5:if(_0x502c68[_0x3e1d('0x119')]>=_0x505636['dialBusyMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x502c68[_0x3e1d('0x119')]+=0x1,'scheduledat':moment()[_0x3e1d('0xd7')](_0x505636['dialBusyRetryFrequency'],_0x3e1d('0xd8'))[_0x3e1d('0x3d')](_0x3e1d('0xc2')),'ContactId':_0x502c68[_0x3e1d('0xd9')],'ListId':_0x502c68[_0x3e1d('0xda')],'VoiceQueueId':_0x502c68[_0x3e1d('0xe7')]||undefined,'CampaignId':_0x502c68['CampaignId']||undefined})[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x18d')));break;case 0x8:if(_0x502c68[_0x3e1d('0x11a')]>=_0x505636['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0x3e1d('0xd6')]({'active':![],'countcongestionretry':_0x502c68['countcongestionretry']+=0x1,'scheduledat':moment()[_0x3e1d('0xd7')](_0x505636[_0x3e1d('0x18e')],_0x3e1d('0xd8'))[_0x3e1d('0x3d')](_0x3e1d('0xc2')),'ContactId':_0x502c68[_0x3e1d('0xd9')],'ListId':_0x502c68[_0x3e1d('0xda')],'VoiceQueueId':_0x502c68[_0x3e1d('0xe7')]||undefined,'CampaignId':_0x502c68['CampaignId']||undefined})[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x18f')));break;case 0x0:if(_0x502c68['countnosuchnumberretry']>=_0x505636[_0x3e1d('0x190')]-0x1){return!![];}else{hopperUtils[_0x3e1d('0xd6')]({'active':![],'countnosuchnumberretry':_0x502c68['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x3e1d('0xd7')](_0x505636[_0x3e1d('0x191')],_0x3e1d('0xd8'))[_0x3e1d('0x3d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x502c68[_0x3e1d('0xd9')],'ListId':_0x502c68[_0x3e1d('0xda')],'VoiceQueueId':_0x502c68[_0x3e1d('0xe7')]||undefined,'CampaignId':_0x502c68[_0x3e1d('0xdb')]||undefined})[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x192')));}break;case 0xa:if(_0x502c68[_0x3e1d('0xd1')]>=_0x505636['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0x3e1d('0xd6')]({'active':![],'countdropretry':_0x502c68[_0x3e1d('0xd1')]+=0x1,'scheduledat':moment()['add'](_0x505636['dialDropRetryFrequency'],_0x3e1d('0xd8'))['format'](_0x3e1d('0xc2')),'ContactId':_0x502c68[_0x3e1d('0xd9')],'ListId':_0x502c68[_0x3e1d('0xda')],'VoiceQueueId':_0x502c68[_0x3e1d('0xe7')]||undefined,'CampaignId':_0x502c68[_0x3e1d('0xdb')]||undefined})[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0xdc')));break;case 0xb:if(_0x502c68[_0x3e1d('0xe3')]>=_0x505636[_0x3e1d('0x193')]-0x1){return!![];}hopperUtils[_0x3e1d('0xd6')]({'active':![],'countabandonedretry':_0x502c68['countabandonedretry']+=0x1,'scheduledat':moment()[_0x3e1d('0xd7')](_0x505636[_0x3e1d('0xe6')],_0x3e1d('0xd8'))[_0x3e1d('0x3d')](_0x3e1d('0xc2')),'ContactId':_0x502c68[_0x3e1d('0xd9')],'ListId':_0x502c68['ListId'],'VoiceQueueId':_0x502c68[_0x3e1d('0xe7')]||undefined,'CampaignId':_0x502c68[_0x3e1d('0xdb')]||undefined})[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0xe8')));break;case 0x13:if(_0x502c68['countmachineretry']>=_0x505636['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x3e1d('0xd6')]({'active':![],'countmachineretry':_0x502c68[_0x3e1d('0x11f')]+=0x1,'scheduledat':moment()[_0x3e1d('0xd7')](_0x505636[_0x3e1d('0x121')],_0x3e1d('0xd8'))[_0x3e1d('0x3d')](_0x3e1d('0xc2')),'ContactId':_0x502c68['ContactId'],'ListId':_0x502c68[_0x3e1d('0xda')],'VoiceQueueId':_0x502c68[_0x3e1d('0xe7')]||undefined,'CampaignId':_0x502c68[_0x3e1d('0xdb')]||undefined})[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x194')));break;case 0x14:if(_0x502c68[_0x3e1d('0x11b')]>=_0x505636[_0x3e1d('0x195')]-0x1){return!![];}hopperUtils[_0x3e1d('0xd6')]({'active':![],'countagentrejectretry':_0x502c68['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x3e1d('0xd7')](_0x505636[_0x3e1d('0x196')],_0x3e1d('0xd8'))['format'](_0x3e1d('0xc2')),'ContactId':_0x502c68['ContactId'],'ListId':_0x502c68[_0x3e1d('0xda')],'VoiceQueueId':_0x502c68[_0x3e1d('0xe7')]||undefined,'CampaignId':_0x502c68['CampaignId']||undefined})[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x197')));break;default:return!![];}};Dialer['prototype'][_0x3e1d('0x107')]=function(_0x412b94,_0x286814,_0x5717a0){var _0x58ed05=this;var _0x980cec=new History(_0x412b94);var _0x4cd3a5=![];var _0x2d960c;var _0x19992f;return new Promise(function(_0x608e52,_0x2f5b02){if(_['isUndefined'](_0x286814)&&typeof _0x286814!==_0x3e1d('0x154')){return _0x2f5b02(msgResponse(_0x3e1d('0x198'),_0x3e1d('0x8e'),_0x3e1d('0x199')));}if(_['isUndefined'](_0x5717a0)&&typeof _0x5717a0!==_0x3e1d('0x154')){return _0x2f5b02(msgResponse(_0x3e1d('0x198'),_0x3e1d('0x8e'),_0x3e1d('0x19a')));}hopperUtils['verifyAdditionalPhones'](_0x980cec,_0x5717a0[_0x3e1d('0x19b')],_0x286814)['then'](function(_0x57778c){if(_0x57778c[_0x3e1d('0xd4')]==0x1)_0x4cd3a5=!![];switch(_0x5717a0[_0x3e1d('0x19b')]){case'0':_0x286814['outboundNoSuchCallsDay']+=0x1;_0x980cec[_0x3e1d('0xce')]=0x0;_0x980cec['statedesc']=_0x3e1d('0x19c');_0x980cec[_0x3e1d('0x189')]+=0x1;_0x980cec[_0x3e1d('0xe4')]+=0x1;ami['emit'](_0x3e1d('0x19d'),ut[_0x3e1d('0x112')](_0x412b94,'nosuchnumber'));_0x2d960c=_0x286814[_0x3e1d('0x191')];_0x19992f=_0x286814[_0x3e1d('0x19e')];hopperUtils['createHistory'](_0x980cec)['catch'](loggerCatch(_0x3e1d('0x118')));if(_0x58ed05[_0x3e1d('0x187')](0x0,_0x412b94,_0x286814)&&!_0x4cd3a5){if(_0x980cec[_0x3e1d('0x189')]>=_0x286814['dialNoSuchNumberMaxRetry']){_0x58ed05[_0x3e1d('0x120')](_0x980cec,_0x608e52,_0x2f5b02,_0x3e1d('0x19f'));}else{_0x58ed05['stateGlobal'](_0x980cec,_0x608e52,_0x2f5b02,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x286814[_0x3e1d('0x1a0')]+=0x1;_0x980cec[_0x3e1d('0xce')]=0x3;_0x980cec[_0x3e1d('0x6a')]='NoAnswer';_0x980cec[_0x3e1d('0x188')]+=0x1;_0x980cec['countglobal']+=0x1;var _0xb8388a=ut[_0x3e1d('0x1a1')](_0x412b94,_0x286814);ami['emit'](_0x3e1d('0x1a2'),_0xb8388a);_0x2d960c=_0x286814[_0x3e1d('0x18b')];_0x19992f=_0x286814[_0x3e1d('0x19e')];hopperUtils[_0x3e1d('0xc7')](_0x980cec)[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x1a3')));if(_0x58ed05['checkRetriveMax'](0x3,_0x412b94,_0x286814)&&!_0x4cd3a5){if(_0x980cec[_0x3e1d('0x188')]>=_0x286814['dialNoAnswerMaxRetry']){_0x58ed05[_0x3e1d('0x120')](_0x980cec,_0x608e52,_0x2f5b02,_0x3e1d('0x1a4'));}else{_0x58ed05[_0x3e1d('0x11d')](_0x980cec,_0x608e52,_0x2f5b02,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x286814[_0x3e1d('0x1a5')]+=0x1;_0x980cec[_0x3e1d('0xce')]=0x5;_0x980cec[_0x3e1d('0x6a')]='Busy';_0x980cec['countbusyretry']+=0x1;_0x980cec['countglobal']+=0x1;ami[_0x3e1d('0x39')]('custom:agentbusy',ut[_0x3e1d('0x112')](_0x412b94,_0x3e1d('0x1a6')));_0x2d960c=_0x286814[_0x3e1d('0x1a7')];_0x19992f=_0x286814[_0x3e1d('0x19e')];hopperUtils['createHistory'](_0x980cec)[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x1a8')));if(_0x58ed05['checkRetriveMax'](0x5,_0x412b94,_0x286814)&&!_0x4cd3a5){if(_0x980cec[_0x3e1d('0x119')]>=_0x286814[_0x3e1d('0x1a9')]){_0x58ed05[_0x3e1d('0x120')](_0x980cec,_0x608e52,_0x2f5b02,_0x3e1d('0x1aa'));}else{_0x58ed05[_0x3e1d('0x11d')](_0x980cec,_0x608e52,_0x2f5b02,_0x3e1d('0x1aa'));}}break;case'8':_0x286814[_0x3e1d('0x1ab')]+=0x1;_0x980cec[_0x3e1d('0xce')]=0x8;_0x980cec[_0x3e1d('0x6a')]=_0x3e1d('0x1ac');_0x980cec['countcongestionretry']+=0x1;_0x980cec[_0x3e1d('0xe4')]+=0x1;_0x2d960c=_0x286814[_0x3e1d('0x18e')];_0x19992f=_0x286814[_0x3e1d('0x19e')];ami[_0x3e1d('0x39')]('custom:agentcongestion',ut[_0x3e1d('0x112')](_0x412b94,_0x3e1d('0x1ad')));hopperUtils[_0x3e1d('0xc7')](_0x980cec)['catch'](loggerCatch(_0x3e1d('0x1ae')));if(_0x58ed05[_0x3e1d('0x187')](0x8,_0x412b94,_0x286814)&&!_0x4cd3a5){if(_0x980cec['countcongestionretry']>=_0x286814['dialCongestionMaxRetry']){_0x58ed05[_0x3e1d('0x120')](_0x980cec,_0x608e52,_0x2f5b02,_0x3e1d('0x1af'));}else{_0x58ed05[_0x3e1d('0x11d')](_0x980cec,_0x608e52,_0x2f5b02,'reason\x208\x20congestion');}}break;case'11':_0x286814[_0x3e1d('0x1b0')]+=0x1;_0x980cec[_0x3e1d('0xce')]=0xb;_0x980cec[_0x3e1d('0x6a')]=_0x3e1d('0x1b1');_0x980cec[_0x3e1d('0xe3')]+=0x1;_0x980cec[_0x3e1d('0xe4')]+=0x1;_0x2d960c=_0x286814[_0x3e1d('0xe6')];_0x19992f=_0x286814[_0x3e1d('0x19e')];hopperUtils[_0x3e1d('0xc7')](_0x980cec)[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0xe9')));if(_0x58ed05[_0x3e1d('0x187')](0xb,_0x412b94,_0x286814)&&!_0x4cd3a5){if(_0x980cec[_0x3e1d('0xe3')]>=_0x286814[_0x3e1d('0x193')]){_0x58ed05[_0x3e1d('0x120')](_0x980cec,_0x608e52,_0x2f5b02,_0x3e1d('0x1b2'));}else{_0x58ed05[_0x3e1d('0x11d')](_0x980cec,_0x608e52,_0x2f5b02,_0x3e1d('0x1b2'));}}break;case'20':_0x286814['outboundRejectCallsDay']+=0x1;_0x980cec['state']=0x14;_0x980cec['statedesc']=_0x3e1d('0x1b3');_0x980cec['countagentrejectretry']+=0x1;_0x980cec[_0x3e1d('0xe4')]+=0x1;_0x2d960c=_0x286814[_0x3e1d('0x196')];_0x19992f=_0x286814[_0x3e1d('0x19e')];ami[_0x3e1d('0x39')](_0x3e1d('0x1b4'),ut[_0x3e1d('0x112')](_0x412b94,_0x3e1d('0x1b5')));hopperUtils[_0x3e1d('0xc7')](_0x980cec)[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x1b6')));if(_0x58ed05[_0x3e1d('0x187')](0x14,_0x412b94,_0x286814)&&!_0x4cd3a5){if(_0x980cec[_0x3e1d('0x11b')]>=_0x286814[_0x3e1d('0x195')]){_0x58ed05[_0x3e1d('0x120')](_0x980cec,_0x608e52,_0x2f5b02,_0x3e1d('0x1b7'));}else{_0x58ed05[_0x3e1d('0x11d')](_0x980cec,_0x608e52,_0x2f5b02,_0x3e1d('0x1b7'));}}break;default:_0x286814[_0x3e1d('0x12a')]+=0x1;_0x980cec[_0x3e1d('0xce')]=0xc;_0x980cec[_0x3e1d('0x6a')]=_0x5717a0[_0x3e1d('0x19b')];_0x2d960c=_0x286814[_0x3e1d('0x196')];_0x19992f=_0x286814['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x980cec)['catch'](loggerCatch(_0x3e1d('0x1b8')));if(_0x58ed05[_0x3e1d('0x187')](_0x5717a0['reason'],_0x412b94,_0x286814)&&!_0x4cd3a5){if(_0x980cec[_0x3e1d('0x119')]+_0x980cec['countcongestionretry']+_0x980cec[_0x3e1d('0x188')]+_0x980cec[_0x3e1d('0x189')]+_0x980cec[_0x3e1d('0xd1')]+_0x980cec[_0x3e1d('0xe3')]+_0x980cec['countmachineretry']+_0x980cec['countagentrejectretry']>=_0x286814[_0x3e1d('0x11c')]){_0x58ed05[_0x3e1d('0x11d')](_0x980cec,_0x608e52,_0x2f5b02,_0x5717a0[_0x3e1d('0x19b')]);}else{_0x58ed05['createStateFinal'](_0x980cec,_0x608e52,_0x2f5b02,_0x5717a0['reason']);}}}})[_0x3e1d('0x9b')](function(){if(_0x4cd3a5){hopperUtils[_0x3e1d('0xea')](_0x980cec,_0x2d960c,_0x19992f)['then'](function(){return _0x608e52(0x1);});}});});};Dialer[_0x3e1d('0x80')][_0x3e1d('0x11d')]=function(_0x57c086,_0x326770,_0x552e87,_0x3edbfe){var _0x3c967f=new Final(_0x57c086);_0x3c967f[_0x3e1d('0xce')]=0xf;_0x3c967f[_0x3e1d('0x6a')]=_0x3e1d('0x1b9');this[_0x3e1d('0x120')](_0x3c967f,_0x326770,_0x552e87,_0x3edbfe);};Dialer[_0x3e1d('0x80')][_0x3e1d('0x120')]=function(_0xbc78f5,_0x3c3952,_0x454489,_0x36b111){hopperUtils[_0x3e1d('0xc8')](_0xbc78f5)[_0x3e1d('0x9b')](function(){return _0x3c3952(msgResponse(_0x3e1d('0x198'),'Success',_0x36b111));})['catch'](function(){return _0x454489(msgResponse(_0x3e1d('0x1ba'),_0x3e1d('0x8e'),_0x3e1d('0x1bb')));});};Dialer[_0x3e1d('0x80')]['predictive']=function(_0x53bd03){var _0x232a33=_0x53bd03[_0x3e1d('0x1bc')]/0x64;var _0x495019=_0x53bd03[_0x3e1d('0xcc')]/(_0x53bd03[_0x3e1d('0xcc')]+_0x53bd03[_0x3e1d('0xc3')]);var _0x57e65=Math[_0x3e1d('0x1bd')](_0x53bd03[_0x3e1d('0x1be')]*(_0x53bd03[_0x3e1d('0x1bf')]/0x64));var _0x4e6484=Math[_0x3e1d('0x1bd')](_0x53bd03[_0x3e1d('0x1be')]*(_0x53bd03[_0x3e1d('0x1c0')]/0x64));var _0xb5d715=_0x53bd03[_0x3e1d('0x131')]+_0x53bd03[_0x3e1d('0x133')];var _0x3d1536=Math[_0x3e1d('0x1c1')](_0x53bd03[_0x3e1d('0x54')]*_0x53bd03[_0x3e1d('0x1c2')]*_0x53bd03[_0x3e1d('0x1c3')]*_0x53bd03[_0x3e1d('0x1c4')]);if(_['isUndefined'](_0x53bd03[_0x3e1d('0x1f')])){if(!_['isUndefined'](_0x53bd03[_0x3e1d('0x1e')])){_0x53bd03[_0x3e1d('0x1e')]=undefined;loggerPredictive[_0x3e1d('0x5f')]('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x3e1d('0x38')](_0x53bd03['handlePredictive'])){loggerPredictive[_0x3e1d('0x5f')](_0x3e1d('0x1c5'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x53bd03[_0x3e1d('0x5d')]);_0x53bd03[_0x3e1d('0x5d')]=undefined;}_0x53bd03[_0x3e1d('0x1f')]=moment()['format'](_0x3e1d('0xc2'));loggerPredictive[_0x3e1d('0x40')](_0x53bd03[_0x3e1d('0x5c')],'collection\x20data\x20in\x20progressive\x20at',_0x53bd03[_0x3e1d('0x1f')]);this[_0x3e1d('0xb2')](_0x53bd03,0x1);}else if(ifInterval(_0x53bd03['dialPredictiveInterval'],_0x53bd03[_0x3e1d('0x1f')])){this[_0x3e1d('0xb2')](_0x53bd03,0x1);loggerPredictiveCalls[_0x3e1d('0x40')](_0x3e1d('0x1c6'),_0x53bd03[_0x3e1d('0x1f')],_0x53bd03[_0x3e1d('0x5c')]);_0x53bd03[_0x3e1d('0x54')]=0x0;_0x53bd03[_0x3e1d('0xcd')]=0x0;}else if(_0x232a33<_0x495019&&_0x53bd03['dialPredictiveOptimization']===_0x3e1d('0x1c7')){clearPredictiveAttributes(_0x53bd03);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x1c8'),_0x3e1d('0x1c9'),_0x495019,_0x3e1d('0x1f'),_0x53bd03['name']);}else if(_0x3d1536<_0x53bd03[_0x3e1d('0xcd')]&&_0x53bd03[_0x3e1d('0x1ca')]===_0x3e1d('0x1c7')){clearPredictiveAttributes(_0x53bd03);loggerPredictive['info'](_0x3e1d('0x1cb'),_0x3e1d('0x1cc'),_0x3d1536,_0x3e1d('0x1cd'),_0x53bd03[_0x3e1d('0xcd')],_0x3e1d('0x1f'),_0x53bd03['name']);}else if(!ifInterval(_0x53bd03[_0x3e1d('0x1ce')],_0x53bd03[_0x3e1d('0x1f')])&&_[_0x3e1d('0x38')](_0x53bd03['startPredictive'])&&!_['isUndefined'](_0x53bd03[_0x3e1d('0x1f')])){_0x53bd03[_0x3e1d('0x1e')]=moment()[_0x3e1d('0x3d')](_0x3e1d('0xc2'));loggerPredictive[_0x3e1d('0x40')](_0x53bd03[_0x3e1d('0x5c')],_0x3e1d('0x1cf'),_0x53bd03[_0x3e1d('0x1e')]);hopperUtils[_0x3e1d('0x1d0')](_0x53bd03['dialPredictiveInterval'])['then'](this['getDataPredictive'](_0x53bd03))['then'](mergeDataErlangB(_0x53bd03))[_0x3e1d('0x9b')](this[_0x3e1d('0x1d1')](_0x53bd03))[_0x3e1d('0xa6')](loggerCatchPredictive(_0x3e1d('0x1d2'),_0x53bd03));}else if(!ifInterval(_0x53bd03[_0x3e1d('0x1ce')],_0x53bd03['startPredictive'])){_0x53bd03[_0x3e1d('0xcd')]=0x0;_0x53bd03[_0x3e1d('0x1e')]=moment()[_0x3e1d('0x3d')](_0x3e1d('0xc2'));loggerPredictive[_0x3e1d('0x40')](_0x53bd03['name'],_0x3e1d('0x1d3'),_0x53bd03['startPredictive']);clearInterval(_0x53bd03[_0x3e1d('0x5d')]);_0x53bd03[_0x3e1d('0x5d')]=undefined;hopperUtils[_0x3e1d('0x1d0')](_0x53bd03[_0x3e1d('0x1ce')])[_0x3e1d('0x9b')](this[_0x3e1d('0x1d4')](_0x53bd03))[_0x3e1d('0x9b')](mergeDataErlangB(_0x53bd03))[_0x3e1d('0x9b')](this[_0x3e1d('0x1d1')](_0x53bd03))[_0x3e1d('0xa6')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x53bd03));}else if(_0x53bd03['predictiveIntervalAvailable']&&_0xb5d715<_0x53bd03[_0x3e1d('0x1be')]-_0x4e6484){clearPredictiveAttributes(_0x53bd03);loggerPredictive[_0x3e1d('0x40')](_0x53bd03[_0x3e1d('0x5c')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0xb5d715,_0x3e1d('0x1d5'),_0x53bd03['predictiveIntervalAvailable'],'-',_0x4e6484,'=',_0x53bd03[_0x3e1d('0x1be')]-_0x4e6484,')');}else if(_0x53bd03['predictiveIntervalAvailable']&&_0xb5d715>_0x53bd03[_0x3e1d('0x1be')]+_0x57e65){clearPredictiveAttributes(_0x53bd03);loggerPredictive[_0x3e1d('0x40')](_0x53bd03[_0x3e1d('0x5c')],_0x3e1d('0x1d6'),_0xb5d715,_0x3e1d('0x1d7'),_0x53bd03[_0x3e1d('0x1be')],'+',_0x57e65,'=',_0x53bd03[_0x3e1d('0x1be')]+_0x57e65,')');}};Dialer[_0x3e1d('0x80')][_0x3e1d('0x1d4')]=function(_0x458d5c){var _0x24ca6b=this;return function(_0x425508){return new Promise(function(_0x6a2b89,_0x36e7d1){_[_0x3e1d('0x59')](_0x458d5c,_0x425508[0x0]);if(checkGetDataPredictive(_0x425508[0x0])){var _0x599305=_0x458d5c[_0x3e1d('0x1be')]=_0x458d5c[_0x3e1d('0x133')]+_0x458d5c[_0x3e1d('0x131')];var _0x342be3=_0x458d5c[_0x3e1d('0x1ce')]*0x3c;var _0x30df7f=_0x425508[0x0][_0x3e1d('0x4d')]+_0x425508[0x0][_0x3e1d('0x4b')];var _0xcff4c3=(_0x425508[0x0][_0x3e1d('0x45')]+_0x425508[0x0][_0x3e1d('0x47')]+_0x425508[0x0][_0x3e1d('0x49')])/_0x425508[0x0]['predictiveIntervalTotalCalls'];_0x458d5c[_0x3e1d('0x1c3')]=_0xcff4c3>0x0?_0xcff4c3:0x1;switch(_0x458d5c[_0x3e1d('0x1ca')]){case'dropRate':var _0xa7d44f=_0x458d5c[_0x3e1d('0x1bc')]/0x64;return _0x24ca6b['abandonmentRate'](_0x599305,_0x342be3,_0x30df7f,_0xcff4c3,_0xa7d44f)[_0x3e1d('0x9b')](function(_0xdc925c){return _0x6a2b89(_0xdc925c);});case _0x3e1d('0x1d8'):var _0x4b6308=_0x458d5c[_0x3e1d('0x1bc')]/0x64;return _0x24ca6b[_0x3e1d('0x1d9')](_0x599305,_0x342be3,_0x30df7f,_0xcff4c3,_0x4b6308)[_0x3e1d('0x9b')](function(_0xa19e14){return _0x6a2b89(_0xa19e14);});default:return _0x36e7d1(msgResponse(_0x3e1d('0x1da'),_0x3e1d('0x8e'),_0x3e1d('0x1db')));}}else{return _0x36e7d1(msgResponse(_0x3e1d('0x1da'),_0x3e1d('0x8e'),_0x3e1d('0x1dc')));}});};};Dialer[_0x3e1d('0x80')][_0x3e1d('0x1dd')]=function(_0x2e2aba){var _0x5e4cf7=this;return function(_0x2b859b){return new Promise(function(_0x1cedb7,_0x6c468b){_[_0x3e1d('0x59')](_0x2e2aba,_0x2b859b[0x0]);if(checkGetDataPredictive(_0x2b859b[0x0])){loggerPredictive[_0x3e1d('0x40')](JSON[_0x3e1d('0x6e')](_0x2b859b[0x0]));if(_0x2e2aba[_0x3e1d('0x1ca')]==='dropRate'){return _0x5e4cf7[_0x3e1d('0x144')](_0x2e2aba['id'])[_0x3e1d('0x9b')](function(_0xfa5ec8){var _0x19708f=_0x2e2aba[_0x3e1d('0x1de')]-_0xfa5ec8[0x0][_0x3e1d('0x1df')];var _0x6c72e8=_0x2e2aba[_0x3e1d('0x1ce')]*0x3c;var _0x36466b=_0x2b859b[0x0][_0x3e1d('0x4d')]+_0x2b859b[0x0][_0x3e1d('0x4b')];var _0x234d4a=(_0x2b859b[0x0][_0x3e1d('0x45')]+_0x2b859b[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2b859b[0x0][_0x3e1d('0x49')])/_0x2b859b[0x0][_0x3e1d('0x43')];var _0x36306e=_0x2e2aba[_0x3e1d('0x1bc')]/0x64;_0x2e2aba[_0x3e1d('0x1e0')]=_0xfa5ec8[0x0][_0x3e1d('0x1df')]||0x0;_0x2e2aba['predictiveIntervalHitRate']=_0x234d4a>0x0?_0x234d4a:0x1;return _0x5e4cf7['abandonmentRate'](_0x19708f,_0x6c72e8,_0x36466b,_0x234d4a,_0x36306e);})[_0x3e1d('0x9b')](function(_0x2dc5ba){return _0x1cedb7(_0x2dc5ba);})['catch'](function(_0x4ac7f7){return _0x6c468b(msgResponse(_0x3e1d('0x1e1'),_0x3e1d('0x8e'),JSON[_0x3e1d('0x6e')](_0x4ac7f7)));});}if(_0x2e2aba[_0x3e1d('0x1ca')]==='agentBusyFactor'){return _0x5e4cf7[_0x3e1d('0x144')](_0x2e2aba['id'])[_0x3e1d('0x9b')](function(_0x1d5a03){var _0x12d2b4=_0x2e2aba['loggedIn']-_0x1d5a03[0x0]['outboundQueuePauses'];var _0x2df508=_0x2e2aba[_0x3e1d('0x1ce')]*0x3c;var _0x12dfab=_0x2b859b[0x0][_0x3e1d('0x4d')]+_0x2b859b[0x0]['predictiveIntervalAvgHoldtime'];var _0x338755=(_0x2b859b[0x0][_0x3e1d('0x45')]+_0x2b859b[0x0][_0x3e1d('0x47')]+_0x2b859b[0x0][_0x3e1d('0x49')])/_0x2b859b[0x0]['predictiveIntervalTotalCalls'];var _0x230d73=_0x2e2aba['dialPredictiveOptimizationPercentage']/0x64;_0x2e2aba[_0x3e1d('0x1e0')]=_0x1d5a03[0x0][_0x3e1d('0x1df')]||0x0;_0x2e2aba['predictiveIntervalHitRate']=_0x338755>0x0?_0x338755:0x1;return _0x5e4cf7[_0x3e1d('0x1d9')](_0x12d2b4,_0x2df508,_0x12dfab,_0x338755,_0x230d73);})['then'](function(_0x940d67){return _0x1cedb7(_0x940d67);})[_0x3e1d('0xa6')](function(_0x5c75be){return _0x6c468b(msgResponse(_0x3e1d('0x1e1'),_0x3e1d('0x8e'),JSON[_0x3e1d('0x6e')](_0x5c75be)));});}}else{return _0x6c468b(msgResponse('[getDataPredictive]',_0x3e1d('0x8e'),_0x3e1d('0x1dc')));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x25a06b){var _0x490174=this;return function(){var _0x30a3bf=0x0;var _0x577d78=Math['floor'](_0x25a06b[_0x3e1d('0x56')]*0x3e8);if(_0x577d78>0x0){_0x577d78=_0x577d78<0x64?0x64:_0x577d78;loggerPredictive[_0x3e1d('0x40')](_0x25a06b[_0x3e1d('0x5c')],_0x3e1d('0x1e2'),_0x577d78,_0x3e1d('0x1e3'));_0x25a06b['handlePredictive']=setInterval(function(){_0x490174[_0x3e1d('0x5d')](_0x25a06b);loggerPredictiveCalls[_0x3e1d('0x40')](_0x3e1d('0x1e4'),_0x30a3bf+=0x1);},_0x577d78);}else{loggerPredictive[_0x3e1d('0x40')](_0x25a06b[_0x3e1d('0x5c')],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype']['checkContactBlack']=function(_0x54f48a,_0x300c11){var _0x11b158=this;return function(_0xd80842){if(_[_0x3e1d('0x3f')](_0xd80842)){if(_[_0x3e1d('0xef')](_0x300c11[_0x3e1d('0x1e5')])||!_0x300c11['recallme']){if(_0x54f48a['dialMethod']===_0x3e1d('0xb4')){_0x54f48a[_0x3e1d('0x6b')]=_[_0x3e1d('0x38')](_0x54f48a[_0x3e1d('0x6b')])?!![]:_0x54f48a['queueStatusComplete'];var _0x32c157=uuid['v4']();_0x11b158['actions'][_0x32c157]=new Action(_0x54f48a,_0x300c11,_0x32c157);loggerBooked[_0x3e1d('0x40')]('[booked][checkContactBlack]',_0x32c157,_0x3e1d('0x1e6'),JSON[_0x3e1d('0x6e')](_0x54f48a['queueStatusComplete']),'Queue:\x20',_0x54f48a[_0x3e1d('0x5c')]);if(_0x54f48a['queueStatusComplete']){_0x54f48a['queueStatusComplete']=![];_0x11b158[_0x3e1d('0x21')][_0x11b158['actions'][_0x32c157][_0x3e1d('0xbd')]]=[];ami['Action']({'actionid':_0x32c157,'action':'queuestatus','queue':_0x54f48a['name']})[_0x3e1d('0xa6')](function(){_0x11b158[_0x3e1d('0xc1')](_0x54f48a);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x11b158['actions'][_0x32c157][_0x3e1d('0xd9')],'ListId':_0x11b158[_0x3e1d('0x1b')][_0x32c157][_0x3e1d('0xda')],'VoiceQueueId':_0x11b158[_0x3e1d('0x1b')][_0x32c157][_0x3e1d('0xe7')]||undefined,'CampaignId':_0x11b158[_0x3e1d('0x1b')][_0x32c157][_0x3e1d('0xdb')]||undefined})[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x1e7')));delete _0x11b158['actions'][_0x32c157];});}else{loggerBooked['info'](_0x3e1d('0x1e8'),JSON['stringify'](_0x54f48a[_0x3e1d('0x6b')]),_0x3e1d('0x1e9'),_0x54f48a['name']);_0x11b158[_0x3e1d('0xc1')](_0x54f48a);hopperUtils[_0x3e1d('0xd6')]({'active':![],'ContactId':_0x11b158[_0x3e1d('0x1b')][_0x32c157][_0x3e1d('0xd9')],'ListId':_0x11b158[_0x3e1d('0x1b')][_0x32c157][_0x3e1d('0xda')],'VoiceQueueId':_0x11b158[_0x3e1d('0x1b')][_0x32c157][_0x3e1d('0xe7')]||undefined,'CampaignId':_0x11b158[_0x3e1d('0x1b')][_0x32c157]['CampaignId']||undefined})[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x1e7')));delete _0x11b158[_0x3e1d('0x1b')][_0x32c157];}}else{return _0x11b158[_0x3e1d('0x153')](_0x54f48a,_0x300c11);}}else{if(utils[_0x3e1d('0x5a')](undefined,_0x300c11[_0x3e1d('0x1ea')])<_0x54f48a[_0x3e1d('0x1eb')]*0x3c){if(_0x300c11[_0x3e1d('0x150')]&&!_0x300c11[_0x3e1d('0x150')][_0x3e1d('0x1ec')]){_0x11b158[_0x3e1d('0x15')][_0x3e1d('0xf6')](_0x300c11['id'])[_0x3e1d('0x13')](function(){_0x11b158[_0x3e1d('0xc1')](_0x54f48a);});}else{hopperUtils[_0x3e1d('0x1ed')]({'active':![]},_0x300c11['id'],0x1)[_0x3e1d('0x13')](function(){_0x11b158[_0x3e1d('0xc1')](_0x54f48a);});}}else{_0x54f48a[_0x3e1d('0x1ee')]+=0x1;_0x11b158[_0x3e1d('0xc1')](_0x54f48a);if(_0x54f48a[_0x3e1d('0x1ef')]){hopperUtils[_0x3e1d('0xd6')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x300c11[_0x3e1d('0xd9')],'ListId':_0x300c11[_0x3e1d('0xda')],'VoiceQueueId':_0x300c11['VoiceQueueId']||undefined,'CampaignId':_0x300c11[_0x3e1d('0xdb')]||undefined})[_0x3e1d('0xa6')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0x3e1d('0xc7')](createObjHistory(_0x54f48a,_0x300c11,utils[_0x3e1d('0x65')][_0x3e1d('0x1f0')],0x17,'RecallInQueue'))[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x1f1')));}else{_0x11b158[_0x3e1d('0x114')](createObjHistory(_0x54f48a,_0x300c11,utils[_0x3e1d('0x65')][_0x3e1d('0x1f2')],0x16,_0x3e1d('0x1f3')),_0x3e1d('0x1f4'),_0x3e1d('0x1f5'));}}}}else{_0x54f48a[_0x3e1d('0x1f6')]+=0x1;_0x11b158[_0x3e1d('0x114')](createObjHistory(_0x54f48a,_0x300c11,utils[_0x3e1d('0x65')][_0x3e1d('0x1f7')],0xd,_0x3e1d('0x1f8')),'[Originate][historyBlacklist]',_0x3e1d('0x1f9'));throw _0x3e1d('0x1fa');}};};Dialer['prototype']['handleIvr']=function(_0x386175){var _0x26c8dc=this;var _0x3517a3=_0x386175[_0x3e1d('0x1fb')]-_0x386175['originated'];emitCampaignSummary(_0x386175);if(_0x3517a3>0x0&&_0x386175[_0x3e1d('0x62')]==0x0){if(_0x3517a3>this[_0x3e1d('0x19')]){_0x3517a3=this['maxNumberOriginate'];}_0x386175[_0x3e1d('0x62')]=0x1;hopperUtils[_0x3e1d('0x1fc')](_0x386175,_0x3517a3)[_0x3e1d('0x9b')](function(_0xbbb528){_0x386175[_0x3e1d('0x62')]=0x0;if(_0xbbb528){if(!utils['checkContactEmpty'](_0xbbb528)){_0x386175[_0x3e1d('0x64')]=utils[_0x3e1d('0x65')][_0x3e1d('0x69')];logger[_0x3e1d('0x40')]('[getContactCampaign2][Empty]'+_0x386175[_0x3e1d('0x5c')]);}else{_0x386175['originated']+=_0xbbb528[_0x3e1d('0x96')];_0x386175[_0x3e1d('0x64')]=utils[_0x3e1d('0x65')][_0x3e1d('0x1fd')];for(var _0x503672=0x0;_0x503672<_0xbbb528['length'];_0x503672+=0x1){_0x386175[_0x3e1d('0x1fe')]+=0x1;if(_[_0x3e1d('0xef')](_0xbbb528[_0x503672])||_['isNil'](_0xbbb528[_0x503672][_0x3e1d('0x172')])||_[_0x3e1d('0xef')](_0xbbb528[_0x503672]['phone'])){_0x26c8dc[_0x3e1d('0x149')]('[actionOriginate]\x20',_0x386175,_0xbbb528[_0x503672]);}else{hopperUtils[_0x3e1d('0x1ff')](_[_0x3e1d('0xf3')](_0xbbb528[_0x503672],['CampaignId',_0x3e1d('0x156')]))[_0x3e1d('0x9b')](_0x26c8dc['checkContactBlack'](_0x386175,_0xbbb528[_0x503672]))[_0x3e1d('0xa6')](_0x26c8dc[_0x3e1d('0x148')]('[actionOriginateIvr]\x20',_0x386175));}}}}})['catch'](loggerGetContactDialer(_0x3e1d('0x200'),_0x386175,_0x3517a3));}};Dialer[_0x3e1d('0x80')][_0x3e1d('0xb2')]=function(_0x41cad3,_0x456cc5){var _0x51abb2=this;var _0x2f598d=[];if(_0x456cc5<0x1||_0x41cad3['dialMethod']===_0x3e1d('0xb4')){_0x456cc5=0x1;}var _0x2a96d3=Math[_0x3e1d('0x1c1')](_0x41cad3[_0x3e1d('0x131')]*_0x456cc5)-_0x41cad3[_0x3e1d('0x78')];if(_0x41cad3[_0x3e1d('0x201')]>0x0){var _0x3a75d3=_0x41cad3[_0x3e1d('0x201')]-_0x41cad3[_0x3e1d('0x78')]-_0x41cad3[_0x3e1d('0x133')]-_0x41cad3[_0x3e1d('0x202')];if(_0x2a96d3>_0x3a75d3){_0x2a96d3=_0x3a75d3;}}if(_0x2a96d3>0x0&&_0x41cad3[_0x3e1d('0x62')]==0x0){if(_0x41cad3['dialMethod']==='booked'){_0x2a96d3=0x1;}if(_0x2a96d3>this[_0x3e1d('0x19')]){_0x2a96d3=this[_0x3e1d('0x19')];}for(var _0x387ffb in this[_0x3e1d('0x17')]){if(typeof this['agents'][_0x387ffb]!=='undefined'){if(this[_0x3e1d('0x17')][_0x387ffb][_0x3e1d('0xce')]===_0x3e1d('0x203')&&this[_0x3e1d('0x17')][_0x387ffb]['status']==='reachable'){_0x2f598d['push'](this['agents'][_0x387ffb]['id']);}}}_0x41cad3[_0x3e1d('0x62')]=0x1;hopperUtils[_0x3e1d('0x204')](_0x41cad3,_0x2f598d,_0x2a96d3)[_0x3e1d('0x9b')](function(_0x521677){_0x41cad3[_0x3e1d('0x62')]=0x0;if(_0x521677){if(!utils['checkContactEmpty'](_0x521677)){hopperUtils[_0x3e1d('0x205')](_0x41cad3)['then'](sendMessageReschedule(_0x41cad3))[_0x3e1d('0xa6')](loggerCatch(_0x3e1d('0x206')));}else{_0x41cad3[_0x3e1d('0x78')]+=_0x521677[_0x3e1d('0x96')];_0x41cad3[_0x3e1d('0x64')]=_0x41cad3[_0x3e1d('0xb0')]===_0x3e1d('0xb4')?utils['CAMPAIGN_STATUS'][_0x3e1d('0x134')]:utils['CAMPAIGN_STATUS'][_0x3e1d('0x1fd')];for(var _0x2bde70=0x0;_0x2bde70<_0x521677['length'];_0x2bde70+=0x1){if(_['isNil'](_0x521677[_0x2bde70])||_[_0x3e1d('0xef')](_0x521677[_0x2bde70][_0x3e1d('0x172')])||_['isNil'](_0x521677[_0x2bde70][_0x3e1d('0x156')])){_0x51abb2[_0x3e1d('0x149')]('[actionOriginate]\x20',_0x41cad3,_0x521677[_0x2bde70]);}else{hopperUtils[_0x3e1d('0x207')](_[_0x3e1d('0xf3')](_0x521677[_0x2bde70],['VoiceQueueId',_0x3e1d('0x156')]))['then'](_0x51abb2[_0x3e1d('0x208')](_0x41cad3,_0x521677[_0x2bde70]))[_0x3e1d('0xa6')](_0x51abb2['loggerHandler'](_0x3e1d('0x209'),_0x41cad3));}}}}})[_0x3e1d('0xa6')](loggerGetContactDialer(_0x3e1d('0x20a'),_0x41cad3,_0x2a96d3));}};Dialer[_0x3e1d('0x80')][_0x3e1d('0x5d')]=function(_0x395839){if(_0x395839[_0x3e1d('0x201')]>0x0){var _0x250f0e=_0x395839[_0x3e1d('0x201')]-_0x395839[_0x3e1d('0x78')]-_0x395839[_0x3e1d('0x133')];if(_0x250f0e>0x0&&_0x395839['temp']==0x0){this[_0x3e1d('0x20b')](_0x395839);}else{loggerPredictiveCalls[_0x3e1d('0x40')]('[handlePredictive][limitChannel]');}}else{this[_0x3e1d('0x20b')](_0x395839);}};Dialer['prototype'][_0x3e1d('0x20b')]=function(_0xd9976d){var _0x5df307=this;var _0x200d60=[];_0xd9976d[_0x3e1d('0x78')]+=0x1;for(var _0x36fb07 in this['agents']){if(typeof this[_0x3e1d('0x17')][_0x36fb07]!==_0x3e1d('0x140')){if(this['agents'][_0x36fb07][_0x3e1d('0xce')]===_0x3e1d('0x203')&&this[_0x3e1d('0x17')][_0x36fb07][_0x3e1d('0x84')]===_0x3e1d('0x85')){_0x200d60[_0x3e1d('0x97')](this[_0x3e1d('0x17')][_0x36fb07]['id']);}}}_0xd9976d[_0x3e1d('0x62')]=0x1;return this[_0x3e1d('0x204')](_0xd9976d['id'],_0x200d60,0x1,_0xd9976d['dialOrderByScheduledAt'],_0xd9976d)[_0x3e1d('0x9b')](function(_0xdba3d2){_0xd9976d[_0x3e1d('0x62')]=0x1;if(_0xdba3d2){if(!utils[_0x3e1d('0x20c')](_0xdba3d2)){utils[_0x3e1d('0x61')](_0xd9976d,0x1,0x0);return hopperUtils[_0x3e1d('0x205')](_0xd9976d)[_0x3e1d('0x9b')](sendMessageReschedule(_0xd9976d))['catch'](loggerCatch(_0x3e1d('0x206')));}else{_0xd9976d[_0x3e1d('0x64')]=utils[_0x3e1d('0x65')][_0x3e1d('0x1fd')];if(_[_0x3e1d('0xef')](_0xdba3d2[0x0])||_['isNil'](_0xdba3d2[0x0][_0x3e1d('0x172')])||_[_0x3e1d('0xef')](_0xdba3d2[0x0]['phone'])){_0x5df307[_0x3e1d('0x149')](_0x3e1d('0x209'),_0xd9976d,_0xdba3d2[0x0]);}else{return hopperUtils['checkIsBlackList'](_['pick'](_0xdba3d2[0x0],['VoiceQueueId',_0x3e1d('0x156')]))[_0x3e1d('0x9b')](_0x5df307['checkContactBlack'](_0xd9976d,_0xdba3d2[0x0]))['catch'](_0x5df307[_0x3e1d('0x148')](_0x3e1d('0x20d'),_0xd9976d));}}}})['catch'](loggerGetContactDialer('[getContactDialerPredictive]',_0xd9976d,0x1));};Dialer[_0x3e1d('0x80')][_0x3e1d('0x20e')]=function(_0x1fba22,_0x19bdf9,_0x441bdc,_0xa22204,_0x2bc0ca,_0x3a33bd){loggerPredictive[_0x3e1d('0x40')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x3e1d('0x40')]('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',_0x1fba22);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x20f'),_0x19bdf9);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x210'),_0x441bdc);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x211'),_0xa22204);loggerPredictive['info'](_0x3e1d('0x212'),_0x2bc0ca);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x4e'));return new Promise(function(_0x342b63,_0x42e84c){if(_0x1fba22<=0x0||isNaN(_0x1fba22)){return _0x42e84c(msgResponse('[abandonmentRate]',_0x3e1d('0x7f'),'m\x20=\x20'+_0x1fba22));}if(_0x441bdc<=0x0||isNaN(_0x441bdc)){return _0x42e84c(msgResponse(_0x3e1d('0x213'),'Error','Ts\x20=\x20'+_0x441bdc));}if(_0xa22204<=0x0||isNaN(_0xa22204)){return _0x42e84c(msgResponse(_0x3e1d('0x213'),_0x3e1d('0x7f'),'p\x20=\x20'+_0xa22204));}if(_0x19bdf9<=0x0||isNaN(_0x19bdf9)){return _0x42e84c(msgResponse(_0x3e1d('0x213'),_0x3e1d('0x7f'),_0x3e1d('0x214')+_0x19bdf9));}if(_0x2bc0ca<=0x0||isNaN(_0x2bc0ca)){return _0x42e84c(msgResponse(_0x3e1d('0x213'),'Error',_0x3e1d('0x215')+_0x2bc0ca));}_0x3a33bd=_0x3a33bd||0x0;var _0x2c70c7=0x1/_0x441bdc;var _0x2135c5=0x0;var _0x5e5b3e=0x0;var _0x12b82b=0x0;var _0x4c3bec=0x0;for(var _0x3c8e68=0x0;_0x12b82b<_0x2bc0ca;_0x3c8e68+=0x1){_0x5e5b3e=_0x3c8e68/_0x19bdf9;_0x2135c5=(_0xa22204*_0x5e5b3e+_0x3a33bd)/_0x2c70c7;_0x12b82b=utils['erlangb'](_0x2135c5,_0x1fba22);_0x4c3bec=_0x2135c5/_0x1fba22*(0x1-utils[_0x3e1d('0x216')](_0x2135c5,_0x1fba22));}return _0x342b63({'erlangCalls':_0x3c8e68,'erlangCallToSecond':_0x19bdf9/_0x3c8e68,'erlangAbandonmentRate':_0x12b82b,'erlangBusyFactor':_0x4c3bec});});};Dialer[_0x3e1d('0x80')][_0x3e1d('0x1d9')]=function(_0x5d1327,_0x2956fc,_0x9d744f,_0x3069bc,_0x3a49d0,_0xf41ba7){loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x217'));loggerPredictive[_0x3e1d('0x40')]('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',_0x5d1327);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x20f'),_0x2956fc);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x210'),_0x9d744f);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x211'),_0x3069bc);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x218'),_0x3a49d0);loggerPredictive[_0x3e1d('0x40')](_0x3e1d('0x4e'));return new Promise(function(_0x202f38,_0xb88739){if(_0x5d1327<=0x0||isNaN(_0x5d1327)){return _0xb88739(msgResponse(_0x3e1d('0x219'),_0x3e1d('0x7f'),'m\x20=\x20'+_0x5d1327));}if(_0x9d744f<=0x0||isNaN(_0x9d744f)){return _0xb88739(msgResponse(_0x3e1d('0x219'),_0x3e1d('0x7f'),_0x3e1d('0x21a')+_0x9d744f));}if(_0x3069bc<=0x0||isNaN(_0x3069bc)){return _0xb88739(msgResponse('[busyFactor]',_0x3e1d('0x7f'),_0x3e1d('0x21b')+_0x3069bc));}if(_0x2956fc<=0x0||isNaN(_0x2956fc)){return _0xb88739(msgResponse('[busyFactor]','Error','interval\x20=\x20'+_0x2956fc));}if(_0x3a49d0<=0x0||isNaN(_0x3a49d0)){return _0xb88739(msgResponse(_0x3e1d('0x219'),'Error','Umin\x20=\x20'+_0x3a49d0));}_0xf41ba7=_0xf41ba7||0x0;var _0x3b7ee5=0x1/_0x9d744f;var _0x13302d=0x0;var _0x4f4ae3=0x0;var _0x3d3611=0x0;var _0x82c09f=0x0;for(var _0x4ece90=0x0;_0x82c09f<_0x3a49d0;_0x4ece90+=0x1){_0x4f4ae3=_0x4ece90/_0x2956fc;_0x13302d=(_0x3069bc*_0x4f4ae3+_0xf41ba7)/_0x3b7ee5;_0x3d3611=utils[_0x3e1d('0x216')](_0x13302d,_0x5d1327);_0x82c09f=_0x13302d/_0x5d1327*(0x1-utils[_0x3e1d('0x216')](_0x13302d,_0x5d1327));}return _0x202f38({'erlangCalls':_0x4ece90,'erlangCallToSecond':_0x2956fc/_0x4ece90,'erlangAbandonmentRate':_0x3d3611,'erlangBusyFactor':_0x82c09f});});};module[_0x3e1d('0x21c')]=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 4cba64a..2caf1c1 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 _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 +var _0xfe8e=['YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','number','substring','voiceQueue','getQueue','exports','util','lodash','isNil','string','uniqueid','name','Contact','phone','lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','ContactId','UserId','VoiceQueueId','idHopper','ContactFirstName','starttime','format'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xfe8e,0x1b2));var _0xefe8=function(_0x1b8e60,_0x21b885){_0x1b8e60=_0x1b8e60-0x0;var _0x363363=_0xfe8e[_0x1b8e60];return _0x363363;};'use strict';var util=require(_0xefe8('0x0'));var _=require(_0xefe8('0x1'));var moment=require('moment');function checkNameSurname(_0x28f0ba,_0x399bc0,_0x4b0ea8){var _0xdbf2f='';if(!_[_0xefe8('0x2')](_0x399bc0)&&'string'===typeof _0x399bc0){_0xdbf2f+=_0x399bc0;}if(!_['isNil'](_0x4b0ea8)&&_0xefe8('0x3')===typeof _0x4b0ea8){_0xdbf2f+='\x20'+_0x4b0ea8;}if(_0xdbf2f!==''){return _0xdbf2f;}return _0x28f0ba;}function Action(_0x348817,_0x1fa4de,_0xf4958f){this['voiceQueue']=_0x348817;this[_0xefe8('0x4')]=_0xf4958f||undefined;this[_0xefe8('0x5')]=checkNameSurname(_0x1fa4de[_0xefe8('0x6')][_0xefe8('0x7')],_0x1fa4de[_0xefe8('0x6')]['firstName'],_0x1fa4de[_0xefe8('0x6')][_0xefe8('0x8')]);this['number']=_0x1fa4de[_0xefe8('0x7')];this[_0xefe8('0x9')]=_0x348817[_0xefe8('0x5')];this[_0xefe8('0xa')]=_0x1fa4de[_0xefe8('0xa')]||![];this[_0xefe8('0xb')]=_0x348817[_0xefe8('0xb')];this[_0xefe8('0xc')]=_0x348817[_0xefe8('0xc')]||0x3;this['scheduledat']=_0x1fa4de[_0xefe8('0xd')];this[_0xefe8('0xe')]=_0x1fa4de[_0xefe8('0xe')];this[_0xefe8('0xf')]=_0x1fa4de['countcongestionretry'];this[_0xefe8('0x10')]=_0x1fa4de['countnoanswerretry'];this[_0xefe8('0x11')]=_0x1fa4de[_0xefe8('0x11')];this[_0xefe8('0x12')]=_0x1fa4de[_0xefe8('0x12')];this['countabandonedretry']=_0x1fa4de['countabandonedretry'];this[_0xefe8('0x13')]=_0x1fa4de[_0xefe8('0x13')];this[_0xefe8('0x14')]=_0x1fa4de[_0xefe8('0x14')];this[_0xefe8('0x15')]=_0x1fa4de[_0xefe8('0x15')];this['ListId']=_0x1fa4de['ListId'];this[_0xefe8('0x16')]=_0x1fa4de['UserId'];this[_0xefe8('0x17')]=_0x1fa4de[_0xefe8('0x17')];this['CampaignId']=_0x1fa4de['CampaignId'];this[_0xefe8('0x18')]=_0x1fa4de['id'];this[_0xefe8('0x19')]=_0x1fa4de[_0xefe8('0x6')]['firstName']||'';this[_0xefe8('0x1a')]=moment()[_0xefe8('0x1b')](_0xefe8('0x1c'));this[_0xefe8('0x1d')]=_0x1fa4de[_0xefe8('0x1d')];this[_0xefe8('0x1e')]=_0x1fa4de['callbackuniqueid'];this['callbackat']=_0x1fa4de[_0xefe8('0x1f')];this[_0xefe8('0x20')]=_0x1fa4de[_0xefe8('0x20')];this[_0xefe8('0x21')]='';this['originatecalleridname']='';}Action['prototype'][_0xefe8('0x22')]=function(){return util[_0xefe8('0x1b')](_0xefe8('0x23'),this['name'],this['voiceQueue'][_0xefe8('0x24')]>0x0?this[_0xefe8('0x25')][_0xefe8('0x26')](this[_0xefe8('0x27')][_0xefe8('0x24')]):this[_0xefe8('0x25')]);};Action['prototype'][_0xefe8('0x28')]=function(){return this[_0xefe8('0x9')];};module[_0xefe8('0x29')]=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 097dc26..ff1fd45 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 _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 +var _0xf339=['calleridname','calleridnum','number','answertime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','getSeconds','talktime','endtime','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','moment','../utils','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid'];(function(_0x1ccc19,_0x2a5e47){var _0x393065=function(_0x1ffa38){while(--_0x1ffa38){_0x1ccc19['push'](_0x1ccc19['shift']());}};_0x393065(++_0x2a5e47);}(_0xf339,0x1e9));var _0x9f33=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xf339[_0x1cc8fe];return _0x230054;};'use strict';var moment=require(_0x9f33('0x0'));var utils=require(_0x9f33('0x1'));function AgentComplete(_0x42ac6c,_0x4e423a){this['state']=0x4;this[_0x9f33('0x2')]='Answer';this[_0x9f33('0x3')]=_0x42ac6c[_0x9f33('0x3')];this[_0x9f33('0x4')]=_0x42ac6c['type'];this[_0x9f33('0x5')]=_0x42ac6c[_0x9f33('0x4')]===_0x9f33('0x6')?_0x9f33('0x7'):_0x42ac6c['type'];this['countbusyretry']=_0x42ac6c[_0x9f33('0x8')];this['countcongestionretry']=_0x42ac6c[_0x9f33('0x9')];this[_0x9f33('0xa')]=_0x42ac6c[_0x9f33('0xa')];this[_0x9f33('0xb')]=_0x42ac6c['countbusyretry']+_0x42ac6c['countcongestionretry']+_0x42ac6c[_0x9f33('0xa')]+_0x42ac6c['countnosuchnumberretry']+_0x42ac6c[_0x9f33('0xc')]+_0x42ac6c['countabandonedretry']+_0x42ac6c['countmachineretry']+_0x42ac6c['countagentrejectretry'];this[_0x9f33('0xd')]=_0x42ac6c[_0x9f33('0xd')];this[_0x9f33('0xc')]=_0x42ac6c[_0x9f33('0xc')];this['countabandonedretry']=_0x42ac6c[_0x9f33('0xe')];this['countmachineretry']=_0x42ac6c[_0x9f33('0xf')];this[_0x9f33('0x10')]=_0x42ac6c[_0x9f33('0x10')];this[_0x9f33('0x11')]=_0x4e423a['uniqueid'];this[_0x9f33('0x12')]=_0x42ac6c['name'];this[_0x9f33('0x13')]=_0x42ac6c[_0x9f33('0x14')];this['starttime']=_0x42ac6c['starttime'];this['responsetime']=_0x42ac6c['responsetime'];this[_0x9f33('0x15')]=_0x42ac6c[_0x9f33('0x15')];this['endtime']=moment()[_0x9f33('0x16')](_0x9f33('0x17'));this['ringtime']=utils['getSeconds'](_0x42ac6c['responsetime'],_0x42ac6c['starttime']);this[_0x9f33('0x18')]=utils[_0x9f33('0x19')](_0x42ac6c['answertime'],_0x42ac6c['responsetime']);this[_0x9f33('0x1a')]=utils[_0x9f33('0x19')](this[_0x9f33('0x1b')],_0x42ac6c[_0x9f33('0x15')]);this[_0x9f33('0x7')]=_0x4e423a['queue'];this['membername']=_0x4e423a['membername'];this[_0x9f33('0x1c')]=_0x4e423a[_0x9f33('0x1c')];this['callback']=_0x42ac6c[_0x9f33('0x1d')];this[_0x9f33('0x1e')]=_0x42ac6c['callbackuniqueid'];this['callbackat']=_0x42ac6c[_0x9f33('0x1f')];this[_0x9f33('0x20')]=_0x42ac6c[_0x9f33('0x20')];this['ContactId']=_0x42ac6c['ContactId'];this[_0x9f33('0x21')]=_0x42ac6c[_0x9f33('0x21')];this[_0x9f33('0x22')]=_0x42ac6c['UserId'];this[_0x9f33('0x23')]=_0x42ac6c[_0x9f33('0x23')];this[_0x9f33('0x24')]=_0x42ac6c['CampaignId'];this['originatecalleridnum']=_0x42ac6c[_0x9f33('0x25')]||'';this['originatecalleridname']=_0x42ac6c[_0x9f33('0x26')]||'';this['agiafterat']=_0x42ac6c['agiafterat'];}module['exports']=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 6b70916..ab9a5d7 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 _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 +var _0x4ac2=['countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','outbound','queue','countbusyretry'];(function(_0x3fc2e3,_0x109f38){var _0x248e01=function(_0xb72b9e){while(--_0xb72b9e){_0x3fc2e3['push'](_0x3fc2e3['shift']());}};_0x248e01(++_0x109f38);}(_0x4ac2,0xd2));var _0x24ac=function(_0x4a56a7,_0x5f295c){_0x4a56a7=_0x4a56a7-0x0;var _0x10463c=_0x4ac2[_0x4a56a7];return _0x10463c;};'use strict';function Final(_0x252535){this[_0x24ac('0x0')]=_0x252535[_0x24ac('0x0')];this[_0x24ac('0x1')]=_0x252535[_0x24ac('0x1')];this[_0x24ac('0x2')]=_0x252535['type'];this['campaigntype']=_0x252535[_0x24ac('0x2')]===_0x24ac('0x3')?_0x24ac('0x4'):_0x252535['type'];this[_0x24ac('0x5')]=_0x252535[_0x24ac('0x5')];this[_0x24ac('0x6')]=_0x252535[_0x24ac('0x6')];this[_0x24ac('0x7')]=_0x252535[_0x24ac('0x7')];this[_0x24ac('0x8')]=_0x252535[_0x24ac('0x5')]+_0x252535['countcongestionretry']+_0x252535[_0x24ac('0x7')]+_0x252535['countnosuchnumberretry']+_0x252535[_0x24ac('0x9')]+_0x252535[_0x24ac('0xa')]+_0x252535[_0x24ac('0xb')]+_0x252535['countagentrejectretry'];this[_0x24ac('0xc')]=_0x252535[_0x24ac('0xc')];this[_0x24ac('0x9')]=_0x252535[_0x24ac('0x9')];this['countabandonedretry']=_0x252535[_0x24ac('0xa')];this['countmachineretry']=_0x252535[_0x24ac('0xb')];this[_0x24ac('0xd')]=_0x252535[_0x24ac('0xd')];this['queue']=_0x252535['queue'];this[_0x24ac('0xe')]=_0x252535['calleridname'];this[_0x24ac('0xf')]=_0x252535[_0x24ac('0xf')];this[_0x24ac('0x10')]=_0x252535[_0x24ac('0x10')];this[_0x24ac('0x11')]=_0x252535[_0x24ac('0x11')];this[_0x24ac('0x12')]=_0x252535['responsetime'];this[_0x24ac('0x13')]=_0x252535[_0x24ac('0x13')]||0x0;this[_0x24ac('0x14')]=_0x252535['holdtime']||0x0;this['talktime']=_0x252535[_0x24ac('0x15')]||0x0;this[_0x24ac('0x16')]=_0x252535[_0x24ac('0x16')];this[_0x24ac('0x17')]=_0x252535['callbackuniqueid'];this[_0x24ac('0x18')]=_0x252535[_0x24ac('0x18')];this[_0x24ac('0x19')]=_0x252535[_0x24ac('0x19')];this[_0x24ac('0x1a')]=_0x252535[_0x24ac('0x1a')];this[_0x24ac('0x1b')]=_0x252535['ListId'];this[_0x24ac('0x1c')]=_0x252535[_0x24ac('0x1c')];this['VoiceQueueId']=_0x252535[_0x24ac('0x1d')];this[_0x24ac('0x1e')]=_0x252535[_0x24ac('0x1e')];this[_0x24ac('0x1f')]=_0x252535[_0x24ac('0x1f')]||'';this[_0x24ac('0x20')]=_0x252535['originatecalleridname']||'';this[_0x24ac('0x21')]=_0x252535[_0x24ac('0x21')];this[_0x24ac('0x22')]=_0x252535[_0x24ac('0x22')];}module[_0x24ac('0x23')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index c1a0150..41c476c 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 _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 +var _0xb5ba=['holdtime','talktime','endtime','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','../utils','Answer','scheduledat','type','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds'];(function(_0x28f9b4,_0x940a3f){var _0x4d67f7=function(_0x164fd6){while(--_0x164fd6){_0x28f9b4['push'](_0x28f9b4['shift']());}};_0x4d67f7(++_0x940a3f);}(_0xb5ba,0x1e9));var _0xab5b=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0xb5ba[_0x3740fe];return _0x55492b;};'use strict';var moment=require('moment');var utils=require(_0xab5b('0x0'));function Hangup(_0x29e146,_0x524611){this['state']=0x4;this['statedesc']=_0xab5b('0x1');this[_0xab5b('0x2')]=_0x29e146[_0xab5b('0x2')];this[_0xab5b('0x3')]=_0x29e146[_0xab5b('0x3')];this['campaigntype']=_0x29e146[_0xab5b('0x3')]===_0xab5b('0x4')?_0xab5b('0x5'):_0x29e146[_0xab5b('0x3')];this['amd']=_0x29e146[_0xab5b('0x6')]||![];this[_0xab5b('0x7')]=_0x29e146[_0xab5b('0x7')];this[_0xab5b('0x8')]=_0x29e146['countcongestionretry'];this[_0xab5b('0x9')]=_0x29e146[_0xab5b('0x9')];this[_0xab5b('0xa')]=_0x29e146[_0xab5b('0x7')]+_0x29e146[_0xab5b('0x8')]+_0x29e146['countnoanswerretry']+_0x29e146['countnosuchnumberretry']+_0x29e146[_0xab5b('0xb')]+_0x29e146[_0xab5b('0xc')]+_0x29e146[_0xab5b('0xd')]+_0x29e146[_0xab5b('0xe')];this['countnosuchnumberretry']=_0x29e146[_0xab5b('0xf')];this[_0xab5b('0xb')]=_0x29e146[_0xab5b('0xb')];this['countabandonedretry']=_0x29e146[_0xab5b('0xc')];this['countmachineretry']=_0x29e146[_0xab5b('0xd')];this[_0xab5b('0xe')]=_0x29e146[_0xab5b('0xe')];this[_0xab5b('0x10')]=_0x524611[_0xab5b('0x10')];this[_0xab5b('0x11')]=_0x29e146[_0xab5b('0x12')];this[_0xab5b('0x13')]=_0x29e146[_0xab5b('0x14')];this[_0xab5b('0x15')]=_0x29e146['starttime'];this[_0xab5b('0x16')]=_0x29e146['responsetime'];this['endtime']=moment()[_0xab5b('0x17')](_0xab5b('0x18'));this[_0xab5b('0x19')]=utils[_0xab5b('0x1a')](_0x29e146[_0xab5b('0x16')],_0x29e146['starttime']);this[_0xab5b('0x1b')]=0x0;this[_0xab5b('0x1c')]=utils[_0xab5b('0x1a')](this[_0xab5b('0x1d')],_0x29e146['responsetime']);this[_0xab5b('0x5')]=_0x29e146[_0xab5b('0x5')];this[_0xab5b('0x1e')]=_0xab5b('0x1f');this[_0xab5b('0x20')]=_0x524611['cause-txt'];this[_0xab5b('0x21')]=_0x29e146[_0xab5b('0x21')];this[_0xab5b('0x22')]=_0x29e146[_0xab5b('0x22')];this[_0xab5b('0x23')]=_0x29e146[_0xab5b('0x23')];this[_0xab5b('0x24')]=_0x29e146[_0xab5b('0x24')];this[_0xab5b('0x25')]=_0x29e146['ContactId'];this[_0xab5b('0x26')]=_0x29e146['ListId'];this[_0xab5b('0x27')]=_0x29e146[_0xab5b('0x27')];this[_0xab5b('0x28')]=_0x29e146[_0xab5b('0x28')];this[_0xab5b('0x29')]=_0x29e146[_0xab5b('0x29')];}module[_0xab5b('0x2a')]=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 244ab61..36e50ba 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 _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 +var _0xd626=['outbound','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','originatecalleridnum','originatecalleridname','state','../utils','uniqueid','scheduledat','type','campaigntype'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xd626,0x124));var _0x6d62=function(_0x2c98fe,_0x2fe375){_0x2c98fe=_0x2c98fe-0x0;var _0x29c444=_0xd626[_0x2c98fe];return _0x29c444;};'use strict';var utils=require(_0x6d62('0x0'));function History(_0x167f92){this[_0x6d62('0x1')]=_0x167f92['uniqueid'];this[_0x6d62('0x2')]=_0x167f92[_0x6d62('0x2')]||undefined;this[_0x6d62('0x3')]=_0x167f92[_0x6d62('0x3')];this[_0x6d62('0x4')]=_0x167f92[_0x6d62('0x3')]===_0x6d62('0x5')?_0x6d62('0x6'):_0x167f92[_0x6d62('0x3')];this[_0x6d62('0x7')]=_0x167f92[_0x6d62('0x7')];this['countcongestionretry']=_0x167f92[_0x6d62('0x8')];this['countnoanswerretry']=_0x167f92['countnoanswerretry'];this[_0x6d62('0x9')]=_0x167f92['countbusyretry']+_0x167f92[_0x6d62('0x8')]+_0x167f92[_0x6d62('0xa')]+_0x167f92[_0x6d62('0xb')]+_0x167f92[_0x6d62('0xc')]+_0x167f92[_0x6d62('0xd')]+_0x167f92[_0x6d62('0xe')]+_0x167f92[_0x6d62('0xf')];this[_0x6d62('0xb')]=_0x167f92['countnosuchnumberretry'];this[_0x6d62('0xc')]=_0x167f92[_0x6d62('0xc')];this[_0x6d62('0xd')]=_0x167f92[_0x6d62('0xd')];this['countmachineretry']=_0x167f92[_0x6d62('0xe')];this['countagentrejectretry']=_0x167f92[_0x6d62('0xf')];this[_0x6d62('0x6')]=_0x167f92[_0x6d62('0x6')];this['calleridname']=_0x167f92['name'];this['calleridnum']=_0x167f92[_0x6d62('0x10')];this[_0x6d62('0x11')]=_0x167f92[_0x6d62('0x11')];this[_0x6d62('0x12')]=_0x167f92[_0x6d62('0x12')];this[_0x6d62('0x13')]=_0x167f92[_0x6d62('0x12')];this[_0x6d62('0x14')]=utils['getSeconds'](_0x167f92[_0x6d62('0x12')],_0x167f92[_0x6d62('0x11')]);this[_0x6d62('0x15')]=0x0;this[_0x6d62('0x16')]=0x0;this[_0x6d62('0x17')]=_0x167f92[_0x6d62('0x17')];this[_0x6d62('0x18')]=_0x167f92['callbackuniqueid'];this['callbackat']=_0x167f92[_0x6d62('0x19')];this[_0x6d62('0x1a')]=_0x167f92[_0x6d62('0x1a')];this['ContactId']=_0x167f92[_0x6d62('0x1b')];this['ListId']=_0x167f92[_0x6d62('0x1c')];this[_0x6d62('0x1d')]=_0x167f92['UserId'];this['VoiceQueueId']=_0x167f92['VoiceQueueId'];this['CampaignId']=_0x167f92['CampaignId'];this[_0x6d62('0x1e')]=_0x167f92[_0x6d62('0x1e')]||'';this[_0x6d62('0x1f')]=_0x167f92[_0x6d62('0x1f')]||'';this[_0x6d62('0x20')]=_0x167f92[_0x6d62('0x20')];this['statedesc']=_0x167f92['statedesc'];}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 ec3be12..edf6cdf 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 _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 +var _0x1e43=['responsetime','droptime','dropreason','endtime','ringtime','getSeconds','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime'];(function(_0x2e69fb,_0x4359e3){var _0x4d2404=function(_0x5667b5){while(--_0x5667b5){_0x2e69fb['push'](_0x2e69fb['shift']());}};_0x4d2404(++_0x4359e3);}(_0x1e43,0x98));var _0x31e4=function(_0x1ceb7b,_0x894d3d){_0x1ceb7b=_0x1ceb7b-0x0;var _0x57c016=_0x1e43[_0x1ceb7b];return _0x57c016;};'use strict';var utils=require(_0x31e4('0x0'));function QueueCallerAbandon(_0x65e473,_0xa2ce82){this[_0x31e4('0x1')]=_0x65e473[_0x31e4('0x1')];this[_0x31e4('0x2')]=_0x65e473[_0x31e4('0x2')];this[_0x31e4('0x3')]=_0x65e473[_0x31e4('0x2')]==='outbound'?_0x31e4('0x4'):_0x65e473['type'];this['countbusyretry']=_0x65e473[_0x31e4('0x5')];this[_0x31e4('0x6')]=_0x65e473[_0x31e4('0x6')];this[_0x31e4('0x7')]=_0x65e473[_0x31e4('0x7')];this[_0x31e4('0x8')]=_0x65e473[_0x31e4('0x5')]+_0x65e473[_0x31e4('0x6')]+_0x65e473['countnoanswerretry']+_0x65e473[_0x31e4('0x9')]+_0x65e473[_0x31e4('0xa')]+_0x65e473[_0x31e4('0xb')]+_0x65e473[_0x31e4('0xc')]+_0x65e473['countagentrejectretry'];this['countnosuchnumberretry']=_0x65e473['countnosuchnumberretry'];this[_0x31e4('0xa')]=_0x65e473[_0x31e4('0xa')];this[_0x31e4('0xb')]=_0x65e473['countabandonedretry'];this[_0x31e4('0xc')]=_0x65e473[_0x31e4('0xc')];this[_0x31e4('0xd')]=_0x65e473[_0x31e4('0xd')];this[_0x31e4('0xe')]=_0xa2ce82['uniqueid'];this[_0x31e4('0xf')]=_0x65e473[_0x31e4('0x10')];this[_0x31e4('0x11')]=_0x65e473[_0x31e4('0x12')];this[_0x31e4('0x13')]=_0x65e473['starttime'];this[_0x31e4('0x14')]=_0x65e473['responsetime'];this[_0x31e4('0x15')]=_0x65e473[_0x31e4('0x15')];this[_0x31e4('0x16')]=_0x65e473[_0x31e4('0x16')];this[_0x31e4('0x17')]=this[_0x31e4('0x15')];this[_0x31e4('0x18')]=utils[_0x31e4('0x19')](_0x65e473[_0x31e4('0x14')],_0x65e473[_0x31e4('0x13')]);this['holdtime']=utils[_0x31e4('0x19')](this[_0x31e4('0x15')],_0x65e473[_0x31e4('0x14')]);this[_0x31e4('0x1a')]=0x0;this[_0x31e4('0x4')]=_0xa2ce82[_0x31e4('0x4')];this[_0x31e4('0x1b')]=_0xa2ce82[_0x31e4('0x1c')];this[_0x31e4('0x1d')]=_0xa2ce82[_0x31e4('0x1d')];this['callback']=_0x65e473[_0x31e4('0x1e')];this[_0x31e4('0x1f')]=_0x65e473[_0x31e4('0x1f')];this[_0x31e4('0x20')]=_0x65e473[_0x31e4('0x20')];this['recallme']=_0x65e473[_0x31e4('0x21')];this[_0x31e4('0x22')]=_0x65e473[_0x31e4('0x22')];this['ListId']=_0x65e473['ListId'];this[_0x31e4('0x23')]=_0x65e473[_0x31e4('0x23')];this['VoiceQueueId']=_0x65e473['VoiceQueueId'];this[_0x31e4('0x24')]=_0x65e473[_0x31e4('0x24')];this[_0x31e4('0x25')]=_0x65e473[_0x31e4('0x25')]||'';this[_0x31e4('0x26')]=_0x65e473[_0x31e4('0x26')]||'';this[_0x31e4('0x27')]=_0x65e473[_0x31e4('0x27')];this[_0x31e4('0x28')]=_0x65e473['state'];this[_0x31e4('0x29')]=_0x65e473[_0x31e4('0x29')];}module[_0x31e4('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 f00b8c6..3ed4acd 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 _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 +var _0xffd6=['[getContactDialerIvr]','getContactDialerIvr','countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer','checkIsBlackList','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','[swapAdditionalPhone]','avgHandleTime','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','getContactDialer','catch','temp','error','[getContactDialer]','dialOrderByScheduledAt'];(function(_0x2ace90,_0x16f0b5){var _0x557d70=function(_0x32e122){while(--_0x32e122){_0x2ace90['push'](_0x2ace90['shift']());}};_0x557d70(++_0x16f0b5);}(_0xffd6,0x97));var _0x6ffd=function(_0xa3c06b,_0x490f99){_0xa3c06b=_0xa3c06b-0x0;var _0x33aa1d=_0xffd6[_0xa3c06b];return _0x33aa1d;};'use strict';var util=require(_0x6ffd('0x0'));var logger=require(_0x6ffd('0x1'))(_0x6ffd('0x2'));var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x6ffd('0x3'));var cmHopperHistory=require(_0x6ffd('0x4'));function inspectError(_0x39fd49){return util['inspect'](_0x39fd49,{'showHidden':![],'depth':null});}function getContactDialer(_0x1d12e3,_0x173979,_0x3b8a46){return cmHopper[_0x6ffd('0x5')](_0x1d12e3['id'],_0x173979,_0x3b8a46,_0x1d12e3['dialOrderByScheduledAt'])[_0x6ffd('0x6')](function(_0xeefe34){_0x1d12e3[_0x6ffd('0x7')]=0x0;logger[_0x6ffd('0x8')](_0x6ffd('0x9'),inspectError(_0xeefe34));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x455dda,_0x417f34){return cmHopper['getContactDialerIvr'](_0x455dda['id'],_0x417f34,_0x455dda[_0x6ffd('0xa')])[_0x6ffd('0x6')](function(_0x23f7f2){_0x455dda[_0x6ffd('0x7')]=0x0;logger[_0x6ffd('0x8')](_0x6ffd('0xb'),inspectError(_0x23f7f2));});}exports[_0x6ffd('0xc')]=getContactDialerIvr;function countReScheduled(_0x5892e1){return cmHopper[_0x6ffd('0xd')](_0x5892e1)[_0x6ffd('0x6')](function(_0x5e8d6d){logger[_0x6ffd('0x8')](_0x6ffd('0xe'),inspectError(_0x5e8d6d));});}exports[_0x6ffd('0xd')]=countReScheduled;function rescheduleContact(_0x1a00d9){return cmHopper['rescheduleContact'](_0x1a00d9)[_0x6ffd('0x6')](function(_0x594cb3){logger[_0x6ffd('0x8')]('[rescheduleContact]',inspectError(_0x594cb3));});}exports[_0x6ffd('0xf')]=rescheduleContact;function unlockContact(_0x261ed7,_0x45db49,_0x5d8aff){return cmHopper[_0x6ffd('0x10')](_0x261ed7,_0x45db49,_0x5d8aff)[_0x6ffd('0x6')](function(_0x350c94){logger[_0x6ffd('0x8')](_0x6ffd('0x11'),inspectError(_0x350c94));});}exports[_0x6ffd('0x10')]=unlockContact;function moveContactManagedDialer(_0x3f38e7){return cmHopper[_0x6ffd('0x12')](_0x3f38e7)['catch'](function(_0x11a609){logger['error']('[moveContactManagedDialer]',inspectError(_0x11a609));});}exports[_0x6ffd('0x12')]=moveContactManagedDialer;function checkIsBlackList(_0x359d09){return cmHopperBlack['checkIsBlackList'](_0x359d09)[_0x6ffd('0x6')](function(_0x4612a3){logger['error']('[checkIsBlackList]',inspectError(_0x4612a3));});}exports[_0x6ffd('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x1c9d19){return cmHopperBlack['checkIsBlackListIvr'](_0x1c9d19)[_0x6ffd('0x6')](function(_0x39f25c){logger[_0x6ffd('0x8')]('[checkIsBlackListIvr]',inspectError(_0x39f25c));});}exports[_0x6ffd('0x14')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x2efeb5,_0x50896b,_0x356c9c){return cmHopperAdditionalPhone[_0x6ffd('0x15')](_0x2efeb5,_0x50896b,_0x356c9c)['catch'](function(_0x31fb22){logger[_0x6ffd('0x8')](_0x6ffd('0x16'),inspectError(_0x31fb22));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x46631e,_0x3e5726,_0x46b03f){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x46631e,_0x3e5726,_0x46b03f)[_0x6ffd('0x6')](function(_0x5a55e2){logger[_0x6ffd('0x8')](_0x6ffd('0x17'),inspectError(_0x5a55e2));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x520258){return cmHopperHistory[_0x6ffd('0x18')](_0x520258)[_0x6ffd('0x6')](function(_0x1934d4){logger['error']('[avgHandleTime]',inspectError(_0x1934d4));});}exports[_0x6ffd('0x18')]=avgHandleTime;function createHistory(_0x48feb4){return cmHopperHistory[_0x6ffd('0x19')](_0x48feb4)[_0x6ffd('0x6')](function(_0x51fdb6){logger[_0x6ffd('0x8')](_0x6ffd('0x1a'),inspectError(_0x51fdb6));});}exports[_0x6ffd('0x19')]=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 d972072..3b51c8f 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 _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 +var _0x5265=['Intervals','isEmpty','SIP/','reachable','unmonitored','name','includes','status','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignActiveStatusMessage','extractCalleridName','string','\x22%s\x22\x20<%s>','format','isUndefined','getCallerId','pow','replace','random','toString','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','createdAt','tags','updatedAt','undefined','XMD-','toUpperCase','setXMDContactVariables','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','ACTIVE','BLACKLIST','DEACTIVATED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','preview','isPreviewCampaign','ivr','type','outbound','dialActive','active','isIVRCampaignActive','milliseconds','dialMethod','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','originated','Trunk','dialTimezone','dialGlobalInterval','Interval'];(function(_0x32d01e,_0x5123d1){var _0x25f8a6=function(_0x477c0b){while(--_0x477c0b){_0x32d01e['push'](_0x32d01e['shift']());}};_0x25f8a6(++_0x5123d1);}(_0x5265,0x115));var _0x5526=function(_0x489420,_0x5e2e0c){_0x489420=_0x489420-0x0;var _0x23cae5=_0x5265[_0x489420];return _0x23cae5;};'use strict';var _=require(_0x5526('0x0'));var moment=require(_0x5526('0x1'));var util=require(_0x5526('0x2'));var logger=require(_0x5526('0x3'))(_0x5526('0x4'));var timezones=require(_0x5526('0x5'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0x5526('0x6'),'BLACKLIST':_0x5526('0x7'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0x5526('0x8'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0x5526('0x9'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0x5526('0xa'),'NO_AVAILABLE_CONTACTS':_0x5526('0xb'),'NULL_INTERVAL':_0x5526('0xc'),'OVERTIME_INTERVAL':_0x5526('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0x5526('0xe'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0x5526('0xf'),'RUNNING':_0x5526('0x10'),'UNKNOWN_TIMEZONE':_0x5526('0x11'),'UNREACHABLE_TRUNK':_0x5526('0x12')};exports[_0x5526('0x13')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x49e178){return _0x49e178['dialMethod']===_0x5526('0x14');}exports[_0x5526('0x15')]=isPreviewCampaign;function isIVRCampaign(_0x30b4f7){return _0x30b4f7['type']===_0x5526('0x16');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x410098){return _0x410098[_0x5526('0x17')]===_0x5526('0x18');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x214e06){return _0x214e06[_0x5526('0x19')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x3f5534){return _0x3f5534[_0x5526('0x1a')];}exports[_0x5526('0x1b')]=isIVRCampaignActive;function getSeconds(_0x4117f3,_0x2b5c98){var _0x5035ef=moment(_0x4117f3)[_0x5526('0x1c')](0x0);var _0x312018=moment(_0x2b5c98)[_0x5526('0x1c')](0x0);return _0x5035ef['diff'](_0x312018,'seconds');}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x414cc7,_0x1f538c){var _0x3ec045=![];var _0x27f7f4=_0x414cc7[_0x5526('0x1d')]!==_0x1f538c[_0x5526('0x1d')]||_0x414cc7[_0x5526('0x19')]!==_0x1f538c[_0x5526('0x19')]||_0x414cc7[_0x5526('0x1e')]!==_0x1f538c[_0x5526('0x1e')];var _0x33a18a=_0x414cc7['available']!==_0x1f538c[_0x5526('0x1f')]||_0x414cc7[_0x5526('0x20')]!==_0x1f538c[_0x5526('0x20')]||_0x414cc7[_0x5526('0x21')]!==_0x1f538c['loggedInDb']||_0x414cc7[_0x5526('0x22')]!==_0x1f538c['paused']||_0x414cc7[_0x5526('0x23')]!==_0x1f538c['talking']||_0x414cc7[_0x5526('0x24')]!==_0x1f538c[_0x5526('0x24')]||_0x414cc7['waiting']!==_0x1f538c[_0x5526('0x25')]||_0x414cc7['inUse']!==_0x1f538c['inUse']||_0x414cc7[_0x5526('0x26')]!==_0x1f538c[_0x5526('0x26')];if(_0x414cc7['Trunk']&&_0x1f538c['Trunk']){_0x3ec045=_0x414cc7[_0x5526('0x27')]['name']!==_0x1f538c[_0x5526('0x27')]['name']||_0x414cc7[_0x5526('0x27')][_0x5526('0x1a')]!==_0x1f538c[_0x5526('0x27')][_0x5526('0x1a')];}return _0x27f7f4||_0x33a18a||_0x3ec045;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x5d316f){var _0xcd7f8=null;var _0x5318ad=_0x5d316f[_0x5526('0x28')];if(_['isNil'](_0x5d316f[_0x5526('0x29')])||_['isNil'](_0x5d316f[_0x5526('0x2a')])||_['isNil'](_0x5d316f[_0x5526('0x2a')][_0x5526('0x2b')])){_0xcd7f8=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0x5526('0x2c')](_0x5d316f[_0x5526('0x29')])||_[_0x5526('0x2c')](_0x5d316f['Interval'][_0x5526('0x2b')])){_0xcd7f8=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x5318ad&&!timezones[_0x5318ad]){_0xcd7f8=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0xcd7f8;}function checkAnyValidTrunk(_0x5e5b2c,_0x50a67e){var _0x3ff681=null;var _0x40c9f2=_0x5526('0x2d');var _0x40fe6e=[_0x5526('0x2e'),_0x5526('0x2f')];var _0x1e96fd=!![];if(_0x5e5b2c[_0x5526('0x27')]&&_0x5e5b2c[_0x5526('0x27')][_0x5526('0x1a')]){_0x40c9f2+=_0x5e5b2c[_0x5526('0x27')][_0x5526('0x30')];_0x3ff681=_0x50a67e[_0x40c9f2];_0x1e96fd=_0x40fe6e[_0x5526('0x31')](_0x3ff681[_0x5526('0x32')]);}else if(_0x5e5b2c[_0x5526('0x33')]&&_0x5e5b2c[_0x5526('0x33')][_0x5526('0x1a')]){_0x40c9f2+=_0x5e5b2c[_0x5526('0x33')][_0x5526('0x30')];_0x3ff681=_0x50a67e[_0x40c9f2];_0x1e96fd=_0x40fe6e[_0x5526('0x31')](_0x3ff681[_0x5526('0x32')]);}return _0x1e96fd;}function getQueueCampaignStatusMessage(_0x3a33f4,_0x2ae5d7){var _0x98f36f=CAMPAIGN_STATUS['ACTIVE'];var _0x34e39f=isPreviewCampaign(_0x3a33f4);if(!isQueueCampaignActive(_0x3a33f4)){if(_0x34e39f){_0x98f36f=CAMPAIGN_STATUS[_0x5526('0x34')];}else{if(_0x3a33f4[_0x5526('0x26')]===0x0&&_0x3a33f4['talking']===0x0&&_0x3a33f4[_0x5526('0x25')]===0x0&&(_0x3a33f4[_0x5526('0x24')]||0x0)===0x0){_0x98f36f=CAMPAIGN_STATUS[_0x5526('0x34')];}else{_0x98f36f=CAMPAIGN_STATUS[_0x5526('0x35')];}}}else if(_0x3a33f4[_0x5526('0x20')]===0x0){_0x98f36f=CAMPAIGN_STATUS[_0x5526('0x36')];}else if(!checkAnyValidTrunk(_0x3a33f4,_0x2ae5d7)){_0x98f36f=CAMPAIGN_STATUS[_0x5526('0x37')];}else if(!isPreviewCampaign(_0x3a33f4)){var _0x4f5fba=checkAnyValidQueueCampaignInterval(_0x3a33f4);if(_0x4f5fba){_0x98f36f=_0x4f5fba;}}return _0x98f36f;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x419a4b){var _0x37fade=CAMPAIGN_STATUS[_0x5526('0x35')];if(_0x419a4b[_0x5526('0x26')]===0x0&&_0x419a4b[_0x5526('0x23')]===0x0&&_0x419a4b['waiting']===0x0&&(_0x419a4b[_0x5526('0x24')]||0x0)===0x0){_0x37fade=CAMPAIGN_STATUS[_0x5526('0x34')];}return _0x37fade;}exports[_0x5526('0x38')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x3a0f2f){var _0x48ce6a=_0x3a0f2f['match'](/"(.*?)"/);return _0x48ce6a?_0x48ce6a[0x1]:_0x3a0f2f;}exports[_0x5526('0x39')]=extractCalleridName;function getCallerId(_0x313583,_0x2fb62b,_0x29b68c){if(!_['isUndefined'](_0x29b68c)&&typeof _0x29b68c===_0x5526('0x3a')&&!_[_0x5526('0x2c')](_0x29b68c)){if(!_['isUndefined'](_0x2fb62b)&&typeof _0x2fb62b===_0x5526('0x3a')&&!_[_0x5526('0x2c')](_0x2fb62b)){return util['format'](_0x5526('0x3b'),_0x2fb62b,_0x29b68c);}return util[_0x5526('0x3c')](_0x5526('0x3b'),_0x29b68c,_0x29b68c);}if(!_[_0x5526('0x3d')](_0x313583)&&typeof _0x313583===_0x5526('0x3a')&&!_[_0x5526('0x2c')](_0x313583)){return _0x313583;}return'\x22\x22\x20<>';}exports[_0x5526('0x3e')]=getCallerId;function getCallerIdRandom(_0xba173e,_0x180bef){var _0x5f6907;var _0x53a827;var _0x914446;if(_0x180bef<=0x0){_0x180bef=0x1;}_0x5f6907=new RegExp('\x5cw{0,'+_0x180bef+'}$');_0x53a827=Math[_0x5526('0x3f')](0xa,_0x180bef-0x1);_0x914446=Math[_0x5526('0x3f')](0xa,_0x180bef)-0x1;return util[_0x5526('0x3c')]('%s',_[_0x5526('0x40')](_0xba173e,_0x5f6907,_[_0x5526('0x41')](_0x53a827,_0x914446)[_0x5526('0x42')]()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x476f04){if(_0x476f04[_0x5526('0x26')]&&_0x476f04[_0x5526('0x26')]>0x0){_0x476f04['originated']-=0x1;}else{logger[_0x5526('0x43')](_0x5526('0x44'));}}exports[_0x5526('0x45')]=decrementOriginate;function checkContactEmpty(_0x3506fe){return _0x3506fe&&_0x3506fe[_0x5526('0x46')]>0x0;}exports[_0x5526('0x47')]=checkContactEmpty;function erlangb(_0x227327,_0x21ae64){if(_0x21ae64===0x0){return 0x0;}var _0x49bae3=0x1;for(var _0x5b4e48=0x1;_0x5b4e48<=_0x21ae64;_0x5b4e48+=0x1){_0x49bae3=0x1+_0x49bae3*_0x5b4e48/_0x227327;}return 0x1/_0x49bae3;}exports[_0x5526('0x48')]=erlangb;function checkContactLowerLimitOriginate(_0x5a4054,_0x470b0a,_0x43d5a4){if(_0x470b0a>_0x43d5a4){for(var _0x4b8599=0x0;_0x4b8599<_0x470b0a-_0x43d5a4;_0x4b8599+=0x1){decrementOriginate(_0x5a4054);}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x1cc9d9){var _0xd610e8={};var _0x1ded30=['id',_0x5526('0x49'),'description',_0x5526('0x4a'),_0x5526('0x4b')];if(_0x1cc9d9){for(var _0x566c38 in _0x1cc9d9){if(typeof _0x1cc9d9[_0x566c38]!==_0x5526('0x4c')){if(!_['isNil'](_0x1cc9d9[_0x566c38])&&!_0x1ded30['includes'](_0x566c38)){_0xd610e8[util['format']('%s%s',_0x5526('0x4d'),_0x566c38[_0x5526('0x4e')]())]=_0x1cc9d9[_0x566c38];}}}}return _0xd610e8;}exports[_0x5526('0x4f')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index fcb02d0..62f6c38 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(_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 +var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x3da443,_0x2b8a4d){var _0x1060dd=function(_0x4b1ecc){while(--_0x4b1ecc){_0x3da443['push'](_0x3da443['shift']());}};_0x1060dd(++_0x2b8a4d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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 aef89d6..ebe6cb9 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 _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 +var _0xa48f=['logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','exports','util','bluebird','uuid','moment','path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./channel','./action','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20'];(function(_0x527882,_0x31c2e7){var _0x574bd8=function(_0x40c03c){while(--_0x40c03c){_0x527882['push'](_0x527882['shift']());}};_0x574bd8(++_0x31c2e7);}(_0xa48f,0x11a));var _0xfa48=function(_0x5d0db1,_0x5f401b){_0x5d0db1=_0x5d0db1-0x0;var _0x2ea0c0=_0xa48f[_0x5d0db1];return _0x2ea0c0;};'use strict';var util=require(_0xfa48('0x0'));var _=require('lodash');var BPromise=require(_0xfa48('0x1'));var uuid=require(_0xfa48('0x2'));var moment=require(_0xfa48('0x3'));var path=require(_0xfa48('0x4'));var tiff2pdf=require(_0xfa48('0x5'));var gs=require('./util/gs');var logger=require(_0xfa48('0x6'))(_0xfa48('0x7'));var ami=require(_0xfa48('0x8'));var rpcDb=require(_0xfa48('0x9'));var Channel=require(_0xfa48('0xa'));var ut=require('./util/util');var Action=require(_0xfa48('0xb'));var faxAccount=require('../rpc/faxAccount');var attachment=require('../rpc/attachment');var faxMessage=require(_0xfa48('0xc'));function Fax(_0x4ea197){this[_0xfa48('0xd')]={};this['faxAccounts']=_0x4ea197[_0xfa48('0xe')];this[_0xfa48('0xf')]=_0x4ea197['trunks'];this[_0xfa48('0x10')]={};ami['on'](_0xfa48('0x11'),this[_0xfa48('0x12')][_0xfa48('0x13')](this));ami['on'](_0xfa48('0x14'),this[_0xfa48('0x15')][_0xfa48('0x13')](this));ami['on'](_0xfa48('0x16'),this[_0xfa48('0x17')]['bind'](this));ami['on'](_0xfa48('0x18'),this['syncNewExten'][_0xfa48('0x13')](this));ami['on'](_0xfa48('0x19'),this[_0xfa48('0x1a')][_0xfa48('0x13')](this));ami['on'](_0xfa48('0x1b'),this['syncReceiveFax'][_0xfa48('0x13')](this));ami['on'](_0xfa48('0x1c'),this[_0xfa48('0x1d')]['bind'](this));ami['on'](_0xfa48('0x1e'),this['syncOriginateResponse'][_0xfa48('0x13')](this));}Fax[_0xfa48('0x1f')][_0xfa48('0x12')]=function(_0x5cda10){if(_0x5cda10[_0xfa48('0x20')]===_0xfa48('0x21')){for(var _0x27bdc9 in this[_0xfa48('0xe')]){if(this[_0xfa48('0xe')][_0xfa48('0x22')](_0x27bdc9)){if(_0x5cda10[_0xfa48('0x23')]===this[_0xfa48('0xe')][_0x27bdc9][_0xfa48('0x24')]){this[_0xfa48('0xd')][_0x5cda10[_0xfa48('0x25')]]={};this[_0xfa48('0xd')][_0x5cda10[_0xfa48('0x25')]][_0xfa48('0x26')]=_0x5cda10[_0xfa48('0x26')];this[_0xfa48('0xd')][_0x5cda10['uniqueid']]['id']=this['faxAccounts'][_0x27bdc9]['id'];this[_0xfa48('0xd')][_0x5cda10['uniqueid']][_0xfa48('0x27')]=this[_0xfa48('0xe')][_0x27bdc9]['name'];logger[_0xfa48('0x28')](_0x5cda10[_0xfa48('0x25')],_0xfa48('0x29'));}}}}if(this[_0xfa48('0x10')][_0x5cda10[_0xfa48('0x25')]]){this[_0xfa48('0xd')][_0x5cda10[_0xfa48('0x25')]]={};this[_0xfa48('0xd')][_0x5cda10['uniqueid']][_0xfa48('0x26')]=_0x5cda10[_0xfa48('0x26')];logger['info'](_0x5cda10[_0xfa48('0x25')],_0xfa48('0x29'));}};Fax[_0xfa48('0x1f')][_0xfa48('0x15')]=function(_0x31cf06){if(this[_0xfa48('0xd')][_0x31cf06[_0xfa48('0x25')]]){for(var _0x1ac1d0 in _0x31cf06[_0xfa48('0x2a')]){if(_0x31cf06[_0xfa48('0x2a')]['hasOwnProperty'](_0x1ac1d0)){this['channels'][_0x31cf06['uniqueid']][_0x1ac1d0]=_0x31cf06[_0xfa48('0x2b')];}}}};Fax['prototype'][_0xfa48('0x17')]=function(_0x288258){if(this['channels'][_0x288258[_0xfa48('0x25')]]){this[_0xfa48('0xd')][_0x288258['uniqueid']]['channelstate']=_0x288258[_0xfa48('0x2c')];this[_0xfa48('0xd')][_0x288258[_0xfa48('0x25')]][_0xfa48('0x2d')]=_0x288258[_0xfa48('0x2d')];}};Fax[_0xfa48('0x1f')][_0xfa48('0x2e')]=function(_0x522d13){if(this['channels'][_0x522d13[_0xfa48('0x25')]]){for(var _0x106ea6 in _0x522d13[_0xfa48('0x2a')]){if(_0x522d13[_0xfa48('0x2a')][_0xfa48('0x22')](_0x106ea6)){this[_0xfa48('0xd')][_0x522d13[_0xfa48('0x25')]][_0x106ea6]=_0x522d13[_0xfa48('0x2b')];}}}};Fax['prototype'][_0xfa48('0x1a')]=function(_0xd5a5f1){if(this['channels'][_0xd5a5f1[_0xfa48('0x25')]]){this[_0xfa48('0xd')][_0xd5a5f1[_0xfa48('0x25')]][_0xfa48('0x2f')]=_0xd5a5f1[_0xfa48('0x2f')];this[_0xfa48('0xd')][_0xd5a5f1[_0xfa48('0x25')]]['status']=_0xd5a5f1[_0xfa48('0x30')];this['channels'][_0xd5a5f1[_0xfa48('0x25')]][_0xfa48('0x24')]=_0xd5a5f1[_0xfa48('0x24')];this['channels'][_0xd5a5f1['uniqueid']][_0xfa48('0x31')]=_0xd5a5f1[_0xfa48('0x31')];logger['info'](_0xd5a5f1[_0xfa48('0x25')],_0xfa48('0x32'));}};Fax[_0xfa48('0x1f')][_0xfa48('0x33')]=function(_0x16d98b){var _0xe52592=this;if(this[_0xfa48('0xd')][_0x16d98b['uniqueid']]){var _0x2a917b=this['channels'][_0x16d98b[_0xfa48('0x25')]]['id'];this[_0xfa48('0xd')][_0x16d98b[_0xfa48('0x25')]][_0xfa48('0x34')]=_0x16d98b[_0xfa48('0x34')];this['channels'][_0x16d98b[_0xfa48('0x25')]]['pagestransferred']=_0x16d98b[_0xfa48('0x35')];this[_0xfa48('0xd')][_0x16d98b['uniqueid']][_0xfa48('0x24')]=_0x16d98b['localstationid'];this[_0xfa48('0xd')][_0x16d98b[_0xfa48('0x25')]][_0xfa48('0x36')]=_0x16d98b[_0xfa48('0x36')];this[_0xfa48('0xd')][_0x16d98b[_0xfa48('0x25')]]['transferrate']=_0x16d98b[_0xfa48('0x37')];this['channels'][_0x16d98b[_0xfa48('0x25')]][_0xfa48('0x31')]=_0x16d98b['filename'];this[_0xfa48('0xd')][_0x16d98b['uniqueid']][_0xfa48('0x38')]=_0x16d98b[_0xfa48('0x38')];if(this[_0xfa48('0xd')][_0x16d98b['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x16d98b['filename'],_0xfa48('0x39'),function(_0x385cf8){logger[_0xfa48('0x28')](_0x16d98b[_0xfa48('0x25')],_0xfa48('0x3a'),_0x385cf8[_0xfa48('0x3b')]);attachment[_0xfa48('0x3c')]({'name':path[_0xfa48('0x3d')](_0x16d98b[_0xfa48('0x31')])['name'],'basename':path[_0xfa48('0x3d')](_0x16d98b[_0xfa48('0x31')])[_0xfa48('0x27')]+_0xfa48('0x3e'),'type':_0xfa48('0x3f')})[_0xfa48('0x40')](function(_0x25d558){faxAccount[_0xfa48('0x41')](_0x2a917b,{'from':_0x16d98b['calleridnum'],'mapKey':'fax','body':path[_0xfa48('0x3d')](_0x16d98b[_0xfa48('0x31')])[_0xfa48('0x27')]+_0xfa48('0x3e'),'AttachmentId':_0x25d558['id']})[_0xfa48('0x42')](function(_0x5b1d99){logger[_0xfa48('0x43')](_0x16d98b[_0xfa48('0x25')],_0xfa48('0x44'),JSON[_0xfa48('0x45')](_0x5b1d99));});})['catch'](function(_0x287448){logger[_0xfa48('0x43')](_0x16d98b[_0xfa48('0x25')],_0xfa48('0x46'),JSON[_0xfa48('0x45')](_0x287448));});});}logger['info'](_0x16d98b[_0xfa48('0x25')],'\x20receiveFax\x20');}};Fax['prototype'][_0xfa48('0x47')]=function(_0xb2e25b){if(this[_0xfa48('0x10')][_0xb2e25b[_0xfa48('0x25')]]){_['merge'](this['channels'][_0xb2e25b[_0xfa48('0x25')]],_[_0xfa48('0x48')](_0xb2e25b,[_0xfa48('0x49'),_0xfa48('0x4a')]));}};function updateStatus(_0x4fa617){if(_0x4fa617[_0xfa48('0x4b')]){faxMessage[_0xfa48('0x4c')](_0x4fa617[_0xfa48('0x4b')],{'failMessage':_0xfa48('0x4d')})[_0xfa48('0x40')](function(_0x178cf0){ut[_0xfa48('0x4e')]('[Fax][Message][Error][Updated]',_0x178cf0);})['catch'](function(_0x5eba2a){ut[_0xfa48('0x4e')](_0xfa48('0x4f'),_0x5eba2a);});}else{ut['logger'](_0xfa48('0x50'));}}Fax[_0xfa48('0x1f')]['updateStatus']=function(_0x49125f,_0x9587e,_0x327119){var _0x44cb6a=this;var _0x142572={};if(_0x9587e){_0x142572={'read':_0x9587e};}else{_0x142572={'failMessage':_0x327119};}if(this[_0xfa48('0x10')][_0x49125f][_0xfa48('0x4b')]){faxMessage[_0xfa48('0x4c')](this['actions'][_0x49125f]['AttachmentId'],_0x142572)['then'](function(_0x414eae){ut['logger']('[Fax][Message][Updated]',_0x414eae);})[_0xfa48('0x42')](function(_0x49f97c){ut[_0xfa48('0x4e')](_0xfa48('0x51'),_0x49f97c);})[_0xfa48('0x52')](function(){delete _0x44cb6a[_0xfa48('0xd')][_0x49125f];delete _0x44cb6a['actions'][_0x49125f];});}else{ut[_0xfa48('0x4e')](_0xfa48('0x53'));delete this[_0xfa48('0xd')][_0x49125f];delete this[_0xfa48('0x10')][_0x49125f];}};Fax[_0xfa48('0x1f')]['syncHangup']=function(_0xa19416){var _0x456413=this;if(this[_0xfa48('0xd')][_0xa19416['uniqueid']]){if(this[_0xfa48('0x10')][_0xa19416[_0xfa48('0x25')]]){this[_0xfa48('0xd')][_0xa19416[_0xfa48('0x25')]]['id']=this[_0xfa48('0x10')][_0xa19416[_0xfa48('0x25')]]['id'];this[_0xfa48('0xd')][_0xa19416[_0xfa48('0x25')]][_0xfa48('0x27')]=this[_0xfa48('0x10')][_0xa19416[_0xfa48('0x25')]][_0xfa48('0x27')];}logger[_0xfa48('0x28')](_0xa19416[_0xfa48('0x25')],this[_0xfa48('0x10')][_0xa19416[_0xfa48('0x25')]]?'\x20hangup\x20sendFile\x20':_0xfa48('0x54'),JSON[_0xfa48('0x45')](this[_0xfa48('0xd')][_0xa19416[_0xfa48('0x25')]]));if(this['actions'][_0xa19416[_0xfa48('0x25')]]){if(this['channels'][_0xa19416[_0xfa48('0x25')]][_0xfa48('0x55')]>0x0&&this[_0xfa48('0xd')][_0xa19416['uniqueid']][_0xfa48('0x19')]===_0xfa48('0x56')){this[_0xfa48('0x57')](_0xa19416[_0xfa48('0x25')],!![]);}else{this[_0xfa48('0x57')](_0xa19416['uniqueid'],![],this[_0xfa48('0xd')][_0xa19416[_0xfa48('0x25')]][_0xfa48('0x58')]?_0xfa48('0x59')+this[_0xfa48('0xd')][_0xa19416[_0xfa48('0x25')]][_0xfa48('0x58')]:_0xfa48('0x5a'));}}}};Fax[_0xfa48('0x1f')][_0xfa48('0x5b')]=function(_0x273b46){var _0x31ad48=this;return new BPromise(function(_0x3b47ff,_0x5d2867){_0x31ad48[_0xfa48('0x5c')](_0x273b46,_0x31ad48[_0xfa48('0xe')][_0x273b46[_0xfa48('0x5d')]])['then'](function(_0x40bec7){ut[_0xfa48('0x4e')](_0xfa48('0x5e'),_0x40bec7);_0x3b47ff(ut[_0xfa48('0x3b')](_0xfa48('0x5f')));})[_0xfa48('0x42')](function(_0x2b9425){ut[_0xfa48('0x4e')](_0xfa48('0x60'),_0x2b9425);updateStatus(_0x273b46);_0x5d2867(ut[_0xfa48('0x3b')]('Fax\x20failed'));});});};Fax[_0xfa48('0x1f')][_0xfa48('0x61')]=function(_0x30b0d8){var _0x2000ab=this;return new BPromise(function(_0x5429e8,_0x156742){var _0x14c635=_0x2000ab[_0xfa48('0x62')](_0x2000ab[_0xfa48('0xe')][_0x30b0d8[_0xfa48('0x5d')]]['Trunk'],_0x30b0d8);if(_0x14c635[_0xfa48('0x63')]){_0x5429e8(ut[_0xfa48('0x3b')](_0xfa48('0x64')));}else{_0x156742(ut[_0xfa48('0x3b')](_0x14c635['message']));}});};function originate(_0x35f123,_0x26f251,_0x28ec0c){return new BPromise(function(_0x1f8116,_0x8743ce){if(_0x28ec0c){var _0xaf7975=util[_0xfa48('0x65')](_0xfa48('0x66'),path[_0xfa48('0x3d')](_0x35f123[_0xfa48('0x4')])['name'],_0x35f123['path']);gs[_0xfa48('0x67')](_0xaf7975)[_0xfa48('0x40')](function(){_0x35f123[_0xfa48('0x4')]=util[_0xfa48('0x65')]('%s/%s.tif',path['parse'](_0x35f123[_0xfa48('0x4')])[_0xfa48('0x68')],path[_0xfa48('0x3d')](_0x35f123['path'])[_0xfa48('0x27')]);_0x26f251[_0xfa48('0x69')]=_0x35f123[_0xfa48('0x4')];ut['logger'](_0xfa48('0x6a'),'');ami[_0xfa48('0x6b')](ut[_0xfa48('0x6c')](_0x35f123,_0x26f251))[_0xfa48('0x40')](function(_0x4b7daf){_0x1f8116(_0x4b7daf);})['catch'](function(_0x60c8ea){_0x8743ce(_0x60c8ea);});})[_0xfa48('0x42')](function(_0x42116e){_0x8743ce(_0x42116e);});}else{ami[_0xfa48('0x6b')](ut[_0xfa48('0x6c')](_0x35f123,_0x26f251))[_0xfa48('0x40')](function(_0x468e7d){_0x1f8116(_0x468e7d);})[_0xfa48('0x42')](function(_0x34e7c5){_0x8743ce(_0x34e7c5);});}});}Fax[_0xfa48('0x1f')][_0xfa48('0x5c')]=function(_0xa19419,_0x4d6267){var _0x4b69ea=this;return new BPromise(function(_0x10e0a7,_0x40425e){var _0x22b285=uuid['v4']();var _0x5da9e8=ut[_0xfa48('0x6d')](_0xa19419,_0x4d6267);_0x4b69ea[_0xfa48('0x10')][_0x22b285]=new Action(_0x22b285,_0x4d6267,_0xa19419);var _0x508182=_0x4b69ea[_0xfa48('0x10')][_0x22b285];if(path[_0xfa48('0x3d')](_0xa19419['path'])[_0xfa48('0x6e')]===_0xfa48('0x3e')){originate(_0x508182,_0x5da9e8,!![])[_0xfa48('0x40')](function(_0x377afc){_0x10e0a7(_0x377afc);})[_0xfa48('0x42')](function(_0x100b20){_0x40425e(_0x100b20);});}else{originate(_0x508182,_0x5da9e8,![])['then'](function(_0xb5354b){_0x10e0a7(_0xb5354b);})[_0xfa48('0x42')](function(_0x59ea85){_0x40425e(_0x59ea85);});}});};Fax[_0xfa48('0x1f')][_0xfa48('0x6f')]=function(_0x43544f){return!_[_0xfa48('0x70')](_0x43544f)&&!_[_0xfa48('0x70')](_0x43544f[_0xfa48('0x27')])&&!_[_0xfa48('0x70')](_0x43544f[_0xfa48('0x71')])&&_0x43544f['active']&&!_[_0xfa48('0x70')](this[_0xfa48('0xf')][util['format'](_0xfa48('0x72'),_0x43544f[_0xfa48('0x27')])])&&!_['isNil'](this[_0xfa48('0xf')][util[_0xfa48('0x65')](_0xfa48('0x72'),_0x43544f['name'])][_0xfa48('0x30')])&&(this[_0xfa48('0xf')][util[_0xfa48('0x65')]('SIP/%s',_0x43544f[_0xfa48('0x27')])][_0xfa48('0x30')]==='reachable'||this[_0xfa48('0xf')][util[_0xfa48('0x65')](_0xfa48('0x72'),_0x43544f[_0xfa48('0x27')])][_0xfa48('0x30')]===_0xfa48('0x73'));};Fax[_0xfa48('0x1f')][_0xfa48('0x62')]=function(_0x456ddc,_0x455a6d){if(!this[_0xfa48('0x6f')](_0x456ddc)){ut['logger'](_0xfa48('0x74'),_[_0xfa48('0x70')](_0x456ddc)?'':_0x456ddc[_0xfa48('0x27')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0xfa48('0x70')](_0x455a6d[_0xfa48('0x7')])){ut[_0xfa48('0x4e')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xfa48('0x45')](_0x455a6d));return{'isValid':![],'message':_0xfa48('0x75')};}if(_[_0xfa48('0x70')](_0x455a6d[_0xfa48('0x4')])){ut[_0xfa48('0x4e')](_0xfa48('0x76'),JSON[_0xfa48('0x45')](_0x455a6d));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xfa48('0x77')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index bd77c84..78a4241 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 _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 +var _0xe395=['[Notify]\x20','util','bluebird','../../../config/logger','preview','../rpc/faxAccount','error','notify','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe395,0x88));var _0x5e39=function(_0x4d5aba,_0x976c34){_0x4d5aba=_0x4d5aba-0x0;var _0x1e1042=_0xe395[_0x4d5aba];return _0x1e1042;};'use strict';var util=require(_0x5e39('0x0'));var BPromise=require(_0x5e39('0x1'));var logger=require(_0x5e39('0x2'))(_0x5e39('0x3'));var _=require('lodash');var faxAccount=require(_0x5e39('0x4'));function loggerCatch(_0x3fec4b){return function(_0x37f99d){logger[_0x5e39('0x5')](_0x3fec4b,util['inspect'](_0x37f99d,{'showHidden':![],'depth':null}));};}exports[_0x5e39('0x6')]=function(_0x9f6d97,_0x138846){return BPromise['resolve']()[_0x5e39('0x7')](faxAccount[_0x5e39('0x6')](_0x9f6d97,_0x138846))['catch'](loggerCatch(_0x5e39('0x8')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index f3632a5..a2e30d1 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 _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 +var _0x1f60=['Exec\x20gs','\x20Error\x20:','util','../../../../config/logger','fax','bluebird','child_process','exec','execute','info'];(function(_0x551904,_0x18af84){var _0xc4fa7f=function(_0x5970e1){while(--_0x5970e1){_0x551904['push'](_0x551904['shift']());}};_0xc4fa7f(++_0x18af84);}(_0x1f60,0x1e2));var _0x01f6=function(_0x5a2798,_0x37840f){_0x5a2798=_0x5a2798-0x0;var _0x8d1d45=_0x1f60[_0x5a2798];return _0x8d1d45;};'use strict';var util=require(_0x01f6('0x0'));var logger=require(_0x01f6('0x1'))(_0x01f6('0x2'));var BPromise=require(_0x01f6('0x3'));var exec=require(_0x01f6('0x4'))[_0x01f6('0x5')];exports[_0x01f6('0x6')]=function(_0x23ffd6){return new BPromise(function(_0x248900,_0x5cd1cd){exec(_0x23ffd6,function(_0x335741,_0xa7af1c,_0x4d1625){logger[_0x01f6('0x7')]('Exec\x20gs',_0xa7af1c);if(_0x335741){logger[_0x01f6('0x7')](_0x01f6('0x8'),_0x01f6('0x9'),util['inspect'](_0x335741,{'showHidden':![],'depth':null}),_0xa7af1c,_0x4d1625);_0x5cd1cd(_0x335741);}_0x248900(_0xa7af1c);});});}; \ 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 8481465..c9bf10d 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 _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 +var _0x3be1=['ecm','headerinfo','maxrate','\x22%s\x22','gateway','t38timeout','localstationid','path','uniqueid','originate','channel','xcally-motion-fax','format','\x22%s\x22\x20<%s>','lodash','moment','../../../../config/logger','fax','message','inspect'];(function(_0x2cc52b,_0xd6096c){var _0x1c0b5f=function(_0x31435c){while(--_0x31435c){_0x2cc52b['push'](_0x2cc52b['shift']());}};_0x1c0b5f(++_0xd6096c);}(_0x3be1,0x72));var _0x13be=function(_0x2e9709,_0x172b8a){_0x2e9709=_0x2e9709-0x0;var _0x7a7d13=_0x3be1[_0x2e9709];return _0x7a7d13;};'use strict';var util=require('util');var _=require(_0x13be('0x0'));var moment=require(_0x13be('0x1'));var logger=require(_0x13be('0x2'))(_0x13be('0x3'));exports[_0x13be('0x4')]=function(_0x15f952){return{'message':_0x15f952};};exports['logger']=function(_0x2fec66,_0x52cb70){logger['info'](_0x2fec66,util[_0x13be('0x5')](_0x52cb70,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x5dbe29,_0x1e78c6){var _0x28a2e1={'XMF-ECM':_0x1e78c6[_0x13be('0x6')],'XMF-HEADERINFO':_0x1e78c6[_0x13be('0x7')],'XMF-MINRATE':_0x1e78c6['minrate'],'XMF-MAXRATE':_0x1e78c6[_0x13be('0x8')],'XMF-MODEM':util['format'](_0x13be('0x9'),_0x1e78c6['modem']),'XMF-GATEWAY':_0x1e78c6[_0x13be('0xa')],'XMF-FAXDETECT':_0x1e78c6['faxdetect'],'XMF-T38TIMEOUT':_0x1e78c6[_0x13be('0xb')],'XMF-LOCALSTATIONID':_0x1e78c6[_0x13be('0xc')],'XMF-PATH':_0x5dbe29[_0x13be('0xd')]};return _0x28a2e1;};exports['variablesAction']=function(_0x44eb31,_0x73af3b){return{'actionid':_0x44eb31[_0x13be('0xe')],'action':_0x13be('0xf'),'channel':_0x44eb31[_0x13be('0x10')],'Exten':_0x13be('0x11'),'Context':'from-sip','Priority':'1','callerid':util[_0x13be('0x12')](_0x13be('0x13'),_0x44eb31[_0x13be('0x7')]?_0x44eb31['headerinfo']:'',_0x44eb31[_0x13be('0xc')]),'variable':_0x73af3b,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x44eb31[_0x13be('0xe')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 8fa32a9..0ebaf09 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 _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 +var _0x4c94=['initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','ami','hour','resolve','then','getAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','getVtigerAccounts','initVtigerAccounts','getServicenowAccounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory'];(function(_0x214763,_0x4701ff){var _0x136bdc=function(_0x4e0985){while(--_0x4e0985){_0x214763['push'](_0x214763['shift']());}};_0x136bdc(++_0x4701ff);}(_0x4c94,0x83));var _0x44c9=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x4c94[_0x3826ad];return _0x17b900;};'use strict';var util=require('util');var moment=require('moment');var server=require(_0x44c9('0x0'));var Realtime=require(_0x44c9('0x1'));var Report=require(_0x44c9('0x2'));var Acw=require(_0x44c9('0x3'));var Trigger=require(_0x44c9('0x4'));var Dialer=require(_0x44c9('0x5'));var Preview=require(_0x44c9('0x6'));var Fax=require(_0x44c9('0x7'));var user=require('./rpc/user');var voiceQueue=require(_0x44c9('0x8'));var voiceQueueReport=require(_0x44c9('0x9'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require(_0x44c9('0xa'));var cmHopperHistory=require(_0x44c9('0xb'));var campaign=require(_0x44c9('0xc'));var voiceExtension=require(_0x44c9('0xd'));var faxAccount=require(_0x44c9('0xe'));var zendesk=require(_0x44c9('0xf'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x44c9('0x10'));var zoho=require(_0x44c9('0x11'));var vtiger=require(_0x44c9('0x12'));var freshsales=require(_0x44c9('0x13'));var servicenow=require(_0x44c9('0x14'));var dynamics365=require('./rpc/integrations/dynamics365');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(_0x44c9('0x15'))(_0x44c9('0x16'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x44c9('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x44c9('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x44c9('0x18')]()[_0x44c9('0x19')](user[_0x44c9('0x1a')]())[_0x44c9('0x19')](realtime['initAgents']())[_0x44c9('0x19')](user[_0x44c9('0x1b')]())[_0x44c9('0x19')](realtime[_0x44c9('0x1c')]())[_0x44c9('0x19')](trunk[_0x44c9('0x1d')]())['then'](realtime[_0x44c9('0x1e')]())[_0x44c9('0x19')](voiceQueue[_0x44c9('0x1f')]())[_0x44c9('0x19')](realtime[_0x44c9('0x20')]())[_0x44c9('0x19')](trigger[_0x44c9('0x21')]())[_0x44c9('0x19')](realtime[_0x44c9('0x22')]())[_0x44c9('0x19')](template[_0x44c9('0x23')]())['then'](realtime[_0x44c9('0x24')]())[_0x44c9('0x19')](zendesk['getZendeskAccounts']())[_0x44c9('0x19')](realtime[_0x44c9('0x25')]())[_0x44c9('0x19')](salesforce[_0x44c9('0x26')]())[_0x44c9('0x19')](realtime[_0x44c9('0x27')]())[_0x44c9('0x19')](sugarcrm['getSugarcrmAccounts']())[_0x44c9('0x19')](realtime[_0x44c9('0x28')]())['then'](freshdesk[_0x44c9('0x29')]())['then'](realtime['initFreshdeskAccounts']())['then'](desk[_0x44c9('0x2a')]())['then'](realtime['initDeskAccounts']())[_0x44c9('0x19')](zoho['getZohoAccounts']())[_0x44c9('0x19')](realtime['initZohoAccounts']())['then'](vtiger[_0x44c9('0x2b')]())[_0x44c9('0x19')](realtime[_0x44c9('0x2c')]())['then'](freshsales['getFreshsalesAccounts']())[_0x44c9('0x19')](realtime['initFreshsalesAccounts']())[_0x44c9('0x19')](servicenow[_0x44c9('0x2d')]())[_0x44c9('0x19')](realtime['initServicenowAccounts']())[_0x44c9('0x19')](dynamics365['getDynamics365Accounts']())['then'](realtime[_0x44c9('0x2e')]())['then'](campaign['getCampaigns']())['then'](realtime[_0x44c9('0x2f')]())[_0x44c9('0x19')](voiceExtension[_0x44c9('0x30')]())[_0x44c9('0x19')](realtime[_0x44c9('0x31')]())['then'](faxAccount['getFaxAccounts']())[_0x44c9('0x19')](realtime[_0x44c9('0x32')]())['then'](function(){return realtime;});}function initParams(){return Promise[_0x44c9('0x18')]()[_0x44c9('0x19')](voiceQueueReport['getVoiceQueueReports']())[_0x44c9('0x19')](realtime[_0x44c9('0x33')]())[_0x44c9('0x19')](cmHopperHistory[_0x44c9('0x34')]())[_0x44c9('0x19')](realtime['initVoiceQueueHopperHistory']())[_0x44c9('0x19')](cmHopperHistory[_0x44c9('0x35')]())[_0x44c9('0x19')](realtime[_0x44c9('0x36')]())['then'](voiceCallReport['getVoiceCallReports']())['then'](realtime[_0x44c9('0x37')]())[_0x44c9('0x38')](function(_0x4adb24){logger[_0x44c9('0x39')](_0x44c9('0x3a'),util[_0x44c9('0x3b')](_0x4adb24,{'showHidden':![],'depth':null}));});}function main(){return server[_0x44c9('0x3c')](realtime,preview,fax)[_0x44c9('0x19')](function(){return initRealtime();})[_0x44c9('0x19')](function(){return initParams();})[_0x44c9('0x19')](function(){report[_0x44c9('0x3d')]();setInterval(initRealtime,0x1388);})[_0x44c9('0x38')](function(_0x40cdc2){logger['error']('[index.js][main]',util[_0x44c9('0x3b')](_0x40cdc2,{'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 7ac68fe..c5cf976 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 _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 +var _0x53d5=['socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','statePause','toNumber','user:ami:update','user:presence','exports','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','localhost'];(function(_0x55d52e,_0x285816){var _0x4bfed4=function(_0x1f10b5){while(--_0x1f10b5){_0x55d52e['push'](_0x55d52e['shift']());}};_0x4bfed4(++_0x285816);}(_0x53d5,0x1cc));var _0x553d=function(_0x505a68,_0xa297b7){_0x505a68=_0x505a68-0x0;var _0x4caac6=_0x53d5[_0x505a68];return _0x4caac6;};'use strict';var _=require(_0x553d('0x0'));var util=require(_0x553d('0x1'));var moment=require(_0x553d('0x2'));var Redis=require(_0x553d('0x3'));var config=require(_0x553d('0x4'));config[_0x553d('0x5')]=_[_0x553d('0x6')](config['redis'],{'host':_0x553d('0x7'),'port':0x18eb});var io=require(_0x553d('0x8'))(new Redis(config[_0x553d('0x5')]));function Agent(_0x1c3955){this['id']=_0x1c3955['id']||0x0;this[_0x553d('0x9')]=_0x1c3955['name']||'';this[_0x553d('0xa')]=_0x1c3955[_0x553d('0xa')]||'';this[_0x553d('0xb')]=_0x1c3955[_0x553d('0xb')]||'';this[_0x553d('0xc')]=_0x1c3955[_0x553d('0xc')]||'';this[_0x553d('0xd')]=_0x553d('0xe');this[_0x553d('0xf')]=0x0;this[_0x553d('0x10')]=_0x553d('0xe');this[_0x553d('0x11')]='';this['phone']='';this['mobile']='';this[_0x553d('0x12')]='';this['online']=_0x1c3955[_0x553d('0x13')]||![];this[_0x553d('0x14')]=_0x553d('0xe');this[_0x553d('0x15')]=0x0;this[_0x553d('0x16')]='';this[_0x553d('0x17')]='';this[_0x553d('0x18')]=![];this[_0x553d('0x19')]=![];}Agent[_0x553d('0x1a')][_0x553d('0x1b')]=function(_0x3cb13c){if(!_0x3cb13c[_0x553d('0xd')]){return;}var _0x52ded8=null;var _0x2dc357=_0x3cb13c['state'][_0x553d('0x1c')]();switch(_0x2dc357){case _0x553d('0x1d'):_0x2dc357=_0x553d('0x1e');break;case'inuse':_0x2dc357='talking';break;}if(this[_0x553d('0x14')]!==_0x2dc357||_0x3cb13c[_0x553d('0x1f')]){_0x52ded8=_[_0x553d('0x20')](moment()['format']('x'));}var _0x2ab468={'id':this['id'],'name':this[_0x553d('0x9')],'email':this[_0x553d('0xa')],'accountcode':this[_0x553d('0xb')],'fullname':this[_0x553d('0xc')],'state':this[_0x553d('0xd')],'stateTime':this[_0x553d('0xf')],'status':this[_0x553d('0x10')],'address':this[_0x553d('0x11')],'voiceStatus':_0x2dc357||this[_0x553d('0x14')],'voiceStatusTime':_0x52ded8||this[_0x553d('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x553d('0x17')],'interface':this[_0x553d('0x12')],'onhold':this['onhold']};if(this[_0x553d('0x14')]!==_0x2dc357){this[_0x553d('0x14')]=_0x2dc357;io['to'](util['format']('user:%s',_0x2ab468['name']))['emit'](_0x553d('0x21'),_0x2ab468);io['emit'](_0x553d('0x22'),_0x2ab468);}};module[_0x553d('0x23')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 6f458d4..c53bef5 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 _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 +var _0x357e=['dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','dialTimezone'];(function(_0x492d02,_0x49e61e){var _0x339033=function(_0x7a96e7){while(--_0x7a96e7){_0x492d02['push'](_0x492d02['shift']());}};_0x339033(++_0x49e61e);}(_0x357e,0x1f3));var _0xe357=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x357e[_0x31a371];return _0x2a5bd6;};'use strict';function Campaign(_0x4bebc5){this['id']=_0x4bebc5['id']||0x0;this['name']=_0x4bebc5[_0xe357('0x0')]||'';this[_0xe357('0x1')]=_0x4bebc5[_0xe357('0x1')]||_0xe357('0x2');this[_0xe357('0x3')]=0x0;this[_0xe357('0x4')]=0x0;this[_0xe357('0x5')]=0x0;this[_0xe357('0x6')]=0x0;this[_0xe357('0x7')]='';this[_0xe357('0x8')]=!![];this[_0xe357('0x9')]=_0x4bebc5[_0xe357('0x9')];this['limitCalls']=_0x4bebc5['limitCalls'];this[_0xe357('0xa')]=_0x4bebc5['dialTimezone']||null;this[_0xe357('0xb')]=_0x4bebc5[_0xe357('0xb')]?_0x4bebc5[_0xe357('0xb')]:null;this[_0xe357('0xc')]=_0x4bebc5[_0xe357('0xc')];this[_0xe357('0xd')]=_0x4bebc5[_0xe357('0xd')];this[_0xe357('0xe')]=_0x4bebc5[_0xe357('0xe')]||0x1e;this[_0xe357('0xf')]=_0x4bebc5[_0xe357('0xf')];this['dialCongestionRetryFrequency']=_0x4bebc5[_0xe357('0x10')];this[_0xe357('0x11')]=_0x4bebc5[_0xe357('0x11')];this['dialBusyRetryFrequency']=_0x4bebc5[_0xe357('0x12')];this['dialNoAnswerMaxRetry']=_0x4bebc5[_0xe357('0x13')];this[_0xe357('0x14')]=_0x4bebc5['dialNoAnswerRetryFrequency'];this[_0xe357('0x15')]=_0x4bebc5['dialGlobalMaxRetry'];this['dialNoSuchNumberMaxRetry']=_0x4bebc5[_0xe357('0x16')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x4bebc5[_0xe357('0x17')]||0x96;this[_0xe357('0x18')]=_0x4bebc5[_0xe357('0x18')]||0x3;this[_0xe357('0x19')]=_0x4bebc5[_0xe357('0x19')]||0x96;this['dialAbandonedMaxRetry']=_0x4bebc5[_0xe357('0x1a')]||0x3;this[_0xe357('0x1b')]=_0x4bebc5[_0xe357('0x1b')]||0x96;this[_0xe357('0x1c')]=_0x4bebc5[_0xe357('0x1c')]||0x3;this[_0xe357('0x1d')]=_0x4bebc5[_0xe357('0x1d')]||0x96;this['dialAgentRejectMaxRetry']=_0x4bebc5[_0xe357('0x1e')]||0x3;this[_0xe357('0x1f')]=_0x4bebc5[_0xe357('0x1f')]||0x96;this['dialOrderByScheduledAt']=_0x4bebc5[_0xe357('0x20')]||_0xe357('0x21');this[_0xe357('0x22')]=_0x4bebc5[_0xe357('0x22')]||undefined;this[_0xe357('0x23')]=_0x4bebc5[_0xe357('0x23')]||undefined;this[_0xe357('0x24')]=_0x4bebc5[_0xe357('0x24')]||undefined;this['TrunkBackup']=_0x4bebc5['TrunkBackup']?_0x4bebc5['TrunkBackup']:undefined;this[_0xe357('0x25')]=_0x4bebc5[_0xe357('0x25')]?_0x4bebc5[_0xe357('0x25')]:undefined;this[_0xe357('0x26')]=_0x4bebc5['Interval']?_0x4bebc5[_0xe357('0x26')]:undefined;this[_0xe357('0x27')]=_0x4bebc5[_0xe357('0x27')]?_0x4bebc5[_0xe357('0x27')]:undefined;this['dialQueueProject']=_0x4bebc5[_0xe357('0x27')]?_0x4bebc5[_0xe357('0x27')][_0xe357('0x0')]:undefined;this[_0xe357('0x28')]=_0x4bebc5[_0xe357('0x28')]||![];this[_0xe357('0x29')]=_0x4bebc5[_0xe357('0x29')];this[_0xe357('0x2a')]=_0x4bebc5[_0xe357('0x2a')];this['dialAMDAfterGreetingSilence']=_0x4bebc5[_0xe357('0x2b')];this[_0xe357('0x2c')]=_0x4bebc5['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x4bebc5[_0xe357('0x2d')];this[_0xe357('0x2e')]=_0x4bebc5[_0xe357('0x2e')];this['dialAMDMaximumNumberOfWords']=_0x4bebc5[_0xe357('0x2f')];this[_0xe357('0x30')]=_0x4bebc5[_0xe357('0x30')];this[_0xe357('0x31')]=_0x4bebc5['dialAMDMaximumWordLength'];}module[_0xe357('0x32')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index c371424..116fc65 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 _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 +var _0xe683=['calleridname','connectedlinenum','connectedlinename','accountcode','context','exten','answered','endtime','unmanaged','lastdata','duration','type','tag','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','exports','starttime','channel','destinationchannel','calleridnum'];(function(_0x1c0dad,_0x430d03){var _0x42efa7=function(_0xa92943){while(--_0xa92943){_0x1c0dad['push'](_0x1c0dad['shift']());}};_0x42efa7(++_0x430d03);}(_0xe683,0x1d7));var _0x3e68=function(_0x533259,_0x1caf05){_0x533259=_0x533259-0x0;var _0x1a3fb7=_0xe683[_0x533259];return _0x1a3fb7;};'use strict';function Channel(){this[_0x3e68('0x0')]=null;this[_0x3e68('0x1')]='';this[_0x3e68('0x2')]='';this[_0x3e68('0x3')]=0x0;this[_0x3e68('0x4')]='';this[_0x3e68('0x5')]=undefined;this[_0x3e68('0x6')]=undefined;this[_0x3e68('0x7')]=0x0;this[_0x3e68('0x8')]='';this['uniqueid']=0x0;this['linkedid']=0x0;this[_0x3e68('0x9')]=0x0;this[_0x3e68('0xa')]=![];this['answertime']=null;this[_0x3e68('0xb')]=null;this[_0x3e68('0xc')]=![];this['abandoned']=![];this['lastapplication']='';this[_0x3e68('0xd')]='';this[_0x3e68('0xe')]=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this[_0x3e68('0xf')]=null;this[_0x3e68('0x10')]=null;this['disposition']=null;this[_0x3e68('0x11')]=![];this[_0x3e68('0x12')]=null;this[_0x3e68('0x13')]=null;this[_0x3e68('0x14')]=[];this[_0x3e68('0x15')]=undefined;this[_0x3e68('0x16')]=undefined;this[_0x3e68('0x17')]=undefined;this['mohtime']=0x0;}module[_0x3e68('0x18')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 9435c47..f0f52bf 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 _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 +var _0x936a=['tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token'];(function(_0x19d814,_0x176bb4){var _0x34e009=function(_0x159c77){while(--_0x159c77){_0x19d814['push'](_0x19d814['shift']());}};_0x34e009(++_0x176bb4);}(_0x936a,0x17e));var _0xa936=function(_0x1b4ef0,_0x41e144){_0x1b4ef0=_0x1b4ef0-0x0;var _0x3c851d=_0x936a[_0x1b4ef0];return _0x3c851d;};'use strict';function DeskAccount(_0x14f703){this['id']=_0x14f703['id']||0x0;this['name']=_0x14f703[_0xa936('0x0')]||'';this[_0xa936('0x1')]=_0x14f703[_0xa936('0x1')]||'';this[_0xa936('0x2')]=_0x14f703[_0xa936('0x2')]||'';this[_0xa936('0x3')]=_0x14f703[_0xa936('0x3')]||'';this[_0xa936('0x4')]=_0x14f703['password']||'';this[_0xa936('0x5')]=_0x14f703[_0xa936('0x5')]||'';this[_0xa936('0x6')]=_0x14f703[_0xa936('0x6')]||'';this[_0xa936('0x7')]=_0x14f703['token']||'';this[_0xa936('0x8')]=_0x14f703[_0xa936('0x8')]||'';this[_0xa936('0x9')]=_0x14f703[_0xa936('0x9')]||'';this[_0xa936('0xa')]=_0x14f703[_0xa936('0xa')]||'';this[_0xa936('0xb')]=_0x14f703[_0xa936('0xb')]||{};}module[_0xa936('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 84f4492..800e205 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 _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 +var _0xf7b5=['name','username','password','remoteUri','tenantId','clientId','serverUrl','modernAuthentication','Configurations','CloudProvider','exports'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xf7b5,0x197));var _0x5f7b=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0xf7b5[_0x2f3794];return _0x1c9fbe;};'use strict';function Dynamics365Account(_0x559a14){this['id']=_0x559a14['id']||0x0;this[_0x5f7b('0x0')]=_0x559a14[_0x5f7b('0x0')]||'';this[_0x5f7b('0x1')]=_0x559a14[_0x5f7b('0x1')]||'';this[_0x5f7b('0x2')]=_0x559a14['password']||'';this['remoteUri']=_0x559a14[_0x5f7b('0x3')]||'';this['tenantId']=_0x559a14[_0x5f7b('0x4')]||'';this[_0x5f7b('0x5')]=_0x559a14[_0x5f7b('0x5')]||'';this['clientSecret']=_0x559a14['clientSecret']||{};this[_0x5f7b('0x6')]=_0x559a14[_0x5f7b('0x6')]||'';this['modernAuthentication']=_0x559a14[_0x5f7b('0x7')]||![];this[_0x5f7b('0x8')]=_0x559a14['Configurations']||{};this[_0x5f7b('0x9')]=_0x559a14[_0x5f7b('0x9')]||{};}module[_0x5f7b('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 6620c65..a8bb8a7 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 _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 +var _0x9919=['gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','localstationid','minrate','maxrate','modem'];(function(_0x1a19dc,_0x2ce4e0){var _0x15c621=function(_0xbae736){while(--_0xbae736){_0x1a19dc['push'](_0x1a19dc['shift']());}};_0x15c621(++_0x2ce4e0);}(_0x9919,0x69));var _0x9991=function(_0x519c88,_0xb84103){_0x519c88=_0x519c88-0x0;var _0x4668d7=_0x9919[_0x519c88];return _0x4668d7;};'use strict';function FaxAccount(_0x21af18){this['id']=_0x21af18['id']||0x0;this[_0x9991('0x0')]=_0x21af18[_0x9991('0x0')]||'';this[_0x9991('0x1')]=_0x21af18[_0x9991('0x1')];this[_0x9991('0x2')]=_0x21af18[_0x9991('0x2')];this['headerinfo']=_0x21af18['headerinfo'];this[_0x9991('0x3')]=_0x21af18['localstationid'];this[_0x9991('0x4')]=_0x21af18[_0x9991('0x4')]||0x960;this[_0x9991('0x5')]=_0x21af18[_0x9991('0x5')]||0x3840;this[_0x9991('0x6')]=_0x21af18[_0x9991('0x6')]||'v17,v27,v29';this[_0x9991('0x7')]=_0x21af18[_0x9991('0x7')]||'no';this[_0x9991('0x8')]=_0x21af18['faxdetect']||'no';this[_0x9991('0x9')]=_0x21af18[_0x9991('0x9')]||0x1388;this[_0x9991('0xa')]=_0x21af18['tech']||_0x9991('0xb');this[_0x9991('0xc')]=_0x21af18[_0x9991('0xc')]?_0x21af18[_0x9991('0xc')]:undefined;this[_0x9991('0xd')]=_0x21af18[_0x9991('0xd')];this[_0x9991('0xe')]=_0x21af18[_0x9991('0xe')];}module[_0x9991('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 729d1de..bddddd7 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 _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 +var _0x43c8=['Configurations','name','apiKey','token','remoteUri','serverUrl'];(function(_0x22c87a,_0x5681cc){var _0x29be08=function(_0x2b1cae){while(--_0x2b1cae){_0x22c87a['push'](_0x22c87a['shift']());}};_0x29be08(++_0x5681cc);}(_0x43c8,0x73));var _0x843c=function(_0x458727,_0x5d368c){_0x458727=_0x458727-0x0;var _0xe917d=_0x43c8[_0x458727];return _0xe917d;};'use strict';function FreshdeskAccount(_0x555ab3){this['id']=_0x555ab3['id']||0x0;this[_0x843c('0x0')]=_0x555ab3[_0x843c('0x0')]||'';this['username']=_0x555ab3['username']||'';this[_0x843c('0x1')]=_0x555ab3[_0x843c('0x2')]||'';this[_0x843c('0x3')]=_0x555ab3['remoteUri']||'';this['serverUrl']=_0x555ab3[_0x843c('0x4')]||'';this[_0x843c('0x5')]=_0x555ab3['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 6bea174..e0cf527 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 _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 +var _0x3a0f=['Configurations','name','apiKey','token','remoteUri','serverUrl'];(function(_0x45c7af,_0x1f9a61){var _0x414147=function(_0x46520d){while(--_0x46520d){_0x45c7af['push'](_0x45c7af['shift']());}};_0x414147(++_0x1f9a61);}(_0x3a0f,0x145));var _0xf3a0=function(_0x576f7a,_0x1e2dd1){_0x576f7a=_0x576f7a-0x0;var _0x533478=_0x3a0f[_0x576f7a];return _0x533478;};'use strict';function FreshsalesAccount(_0x6bb485){this['id']=_0x6bb485['id']||0x0;this['name']=_0x6bb485[_0xf3a0('0x0')]||'';this['username']=_0x6bb485['username']||'';this[_0xf3a0('0x1')]=_0x6bb485[_0xf3a0('0x2')]||'';this[_0xf3a0('0x3')]=_0x6bb485[_0xf3a0('0x3')]||'';this[_0xf3a0('0x4')]=_0x6bb485[_0xf3a0('0x4')]||'';this[_0xf3a0('0x5')]=_0x6bb485[_0xf3a0('0x5')]||{};}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 a31f7cc..3e4136a 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 _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 +var _0x9412=['queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','originalposition','channel','connectedlinenum','connectedlinename','context','exten','priority','holdtime','assigned','motionChannel','routealias','mohtime','variables','exports','inbound','uniqueid','queuecallerleaveAt','position','count'];(function(_0x120625,_0x38ed55){var _0x55dc01=function(_0x5d8b15){while(--_0x5d8b15){_0x120625['push'](_0x120625['shift']());}};_0x55dc01(++_0x38ed55);}(_0x9412,0x133));var _0x2941=function(_0x5d29d0,_0x4e46e3){_0x5d29d0=_0x5d29d0-0x0;var _0xb69951=_0x9412[_0x5d29d0];return _0xb69951;};'use strict';function QueueReport(){this['type']=_0x2941('0x0');this[_0x2941('0x1')]='';this['calleridnum']='';this['calleridname']='';this['queue']='';this['queuecallerjoinAt']=null;this[_0x2941('0x2')]=null;this[_0x2941('0x3')]=0x1;this[_0x2941('0x4')]=0x1;this[_0x2941('0x5')]=![];this[_0x2941('0x6')]=null;this[_0x2941('0x7')]=![];this[_0x2941('0x8')]=null;this[_0x2941('0x9')]=![];this['queuecallerexitAt']=null;this[_0x2941('0xa')]=0x1;this[_0x2941('0xb')]='';this[_0x2941('0xc')]='';this[_0x2941('0xd')]='';this['accountcode']='';this[_0x2941('0xe')]='';this[_0x2941('0xf')]='';this[_0x2941('0x10')]='';this[_0x2941('0x11')]=0x0;this[_0x2941('0x12')]=![];this['lastAssignedTo']='';this[_0x2941('0x13')]='voice';this[_0x2941('0x14')]=null;this[_0x2941('0x15')]=0x0;this[_0x2941('0x16')]={};}module[_0x2941('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index fe67f6e..b88ee91 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 _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 +var _0xea0f=['type','integrationTab','serverUrl','Configurations','exports','name','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xea0f,0x73));var _0xfea0=function(_0x2330d8,_0x48ee0c){_0x2330d8=_0x2330d8-0x0;var _0x4e363d=_0xea0f[_0x2330d8];return _0x4e363d;};'use strict';function SalesforceAccount(_0x455bfa){this['id']=_0x455bfa['id']||0x0;this[_0xfea0('0x0')]=_0x455bfa[_0xfea0('0x0')]||'';this['username']=_0x455bfa['username']||'';this[_0xfea0('0x1')]=_0x455bfa[_0xfea0('0x1')]||'';this[_0xfea0('0x2')]=_0x455bfa['password']||'';this['clientId']=_0x455bfa[_0xfea0('0x3')]||'';this[_0xfea0('0x4')]=_0x455bfa[_0xfea0('0x4')]||'';this[_0xfea0('0x5')]=_0x455bfa['securityToken']||'';this[_0xfea0('0x6')]=_0x455bfa['type']||_0xfea0('0x7');this[_0xfea0('0x8')]=_0x455bfa[_0xfea0('0x8')]||'';this[_0xfea0('0x9')]=_0x455bfa[_0xfea0('0x9')]||{};}module[_0xfea0('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 233c5ee..e4085a0 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 _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 +var _0x0f7d=['username','password','remoteUri','serverUrl','Configurations','name'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0x0f7d,0xd7));var _0xd0f7=function(_0x5466e0,_0x586206){_0x5466e0=_0x5466e0-0x0;var _0xf32c89=_0x0f7d[_0x5466e0];return _0xf32c89;};'use strict';function ServicenowAccount(_0x4b5648){this['id']=_0x4b5648['id']||0x0;this['name']=_0x4b5648[_0xd0f7('0x0')]||'';this[_0xd0f7('0x1')]=_0x4b5648[_0xd0f7('0x1')]||'';this[_0xd0f7('0x2')]=_0x4b5648[_0xd0f7('0x2')]||'';this[_0xd0f7('0x3')]=_0x4b5648['remoteUri']||'';this[_0xd0f7('0x4')]=_0x4b5648['serverUrl']||'';this['Configurations']=_0x4b5648[_0xd0f7('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 5e39b53..4ccd153 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 _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 +var _0x6636=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x5cc5eb,_0x14c888){var _0x27b727=function(_0x5a5940){while(--_0x5a5940){_0x5cc5eb['push'](_0x5cc5eb['shift']());}};_0x27b727(++_0x14c888);}(_0x6636,0x16b));var _0x6663=function(_0x325e67,_0x7d41f9){_0x325e67=_0x325e67-0x0;var _0x296615=_0x6636[_0x325e67];return _0x296615;};'use strict';function SugarcrmAccount(_0x35b47b){this['id']=_0x35b47b['id']||0x0;this[_0x6663('0x0')]=_0x35b47b['name']||'';this[_0x6663('0x1')]=_0x35b47b['username']||'';this[_0x6663('0x2')]=_0x35b47b['password']||'';this['remoteUri']=_0x35b47b[_0x6663('0x3')]||'';this[_0x6663('0x4')]=_0x35b47b[_0x6663('0x4')]||'';this['Configurations']=_0x35b47b[_0x6663('0x5')]||{};}module[_0x6663('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 30f26a0..6c83d31 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 _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 +var _0x5d99=['name','accountcode','state','unknown','stateTime','status','address','exports'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x5d99,0x150));var _0x95d9=function(_0x5a92ad,_0x2219a6){_0x5a92ad=_0x5a92ad-0x0;var _0x2466f8=_0x5d99[_0x5a92ad];return _0x2466f8;};'use strict';function Telephone(_0x3b6713){this['id']=_0x3b6713['id']||0x0;this[_0x95d9('0x0')]=_0x3b6713[_0x95d9('0x0')]||'';this[_0x95d9('0x1')]=_0x3b6713[_0x95d9('0x1')]||'';this[_0x95d9('0x2')]=_0x95d9('0x3');this[_0x95d9('0x4')]=0x0;this[_0x95d9('0x5')]=_0x95d9('0x3');this[_0x95d9('0x6')]='';}module[_0x95d9('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index cb7fcae..6539446 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(_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 +var _0xa9e0=['exports','name'];(function(_0x14ad80,_0x14e853){var _0x3ee434=function(_0x280921){while(--_0x280921){_0x14ad80['push'](_0x14ad80['shift']());}};_0x3ee434(++_0x14e853);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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 caf3069..5804761 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 _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 +var _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x3176bf,_0x4e6834){var _0x355328=function(_0x27ae38){while(--_0x27ae38){_0x3176bf['push'](_0x3176bf['shift']());}};_0x355328(++_0x4e6834);}(_0x8603,0x190));var _0x3860=function(_0x9c6c7d,_0x2d8484){_0x9c6c7d=_0x9c6c7d-0x0;var _0x433f1e=_0x8603[_0x9c6c7d];return _0x433f1e;};'use strict';function Trigger(_0xba4b79){this['id']=_0xba4b79['id']||0x0;this[_0x3860('0x0')]=_0xba4b79[_0x3860('0x0')]||'';this[_0x3860('0x1')]=_0xba4b79['channel']||'voice';this[_0x3860('0x2')]=_0xba4b79[_0x3860('0x2')]||![];this[_0x3860('0x3')]=_0xba4b79['AllConditions']||[];this[_0x3860('0x4')]=_0xba4b79['AnyConditions']||[];this[_0x3860('0x5')]=_0xba4b79[_0x3860('0x5')]||[];}module[_0x3860('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 31a29ed..29b006b 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 _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 +var _0x5e34=['defaultuser','exports','active','name','unknown','stateTime','registry','indexOf','split','port','domain','domainport','refresh','address'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x5e34,0xb8));var _0x45e3=function(_0x247c9a,_0x37da12){_0x247c9a=_0x247c9a-0x0;var _0x29cf01=_0x5e34[_0x247c9a];return _0x29cf01;};'use strict';function Trunk(_0x21cee4){this['id']=_0x21cee4['id']||0x0;this['active']=_0x21cee4[_0x45e3('0x0')]||![];this['name']=_0x21cee4[_0x45e3('0x1')]||'';this['state']=_0x45e3('0x2');this[_0x45e3('0x3')]=0x0;this['status']=_0x45e3('0x2');this[_0x45e3('0x4')]=_0x21cee4[_0x45e3('0x4')]&&_0x21cee4[_0x45e3('0x4')][_0x45e3('0x5')](':')?_0x21cee4[_0x45e3('0x4')][_0x45e3('0x6')](':')[0x0]:'';this['host']='';this[_0x45e3('0x7')]='';this[_0x45e3('0x8')]='';this[_0x45e3('0x9')]='';this[_0x45e3('0xa')]='';this['stateRegistry']=_0x45e3('0x2');this['registrationtime']='';this[_0x45e3('0xb')]='';this[_0x45e3('0xc')]=_0x21cee4['defaultuser']||'';}module[_0x45e3('0xd')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 77d0bdf..bdb6afb 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 _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 +var _0xb619=['exten','recordingFormat','mandatoryDisposition','exports'];(function(_0x1096f8,_0x11e492){var _0x59374f=function(_0x4496b4){while(--_0x4496b4){_0x1096f8['push'](_0x1096f8['shift']());}};_0x59374f(++_0x11e492);}(_0xb619,0x9c));var _0x9b61=function(_0x453b68,_0x30a13b){_0x453b68=_0x453b68-0x0;var _0x3aaa27=_0xb619[_0x453b68];return _0x3aaa27;};'use strict';function voiceExtension(_0x3723fb){this['id']=_0x3723fb['id']||0x0;this['exten']=_0x3723fb[_0x9b61('0x0')]||'';this['recordingFormat']=_0x3723fb[_0x9b61('0x1')]||'none';this[_0x9b61('0x2')]=_0x3723fb[_0x9b61('0x2')]||![];}module[_0x9b61('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 6c98be3..3f348ef 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 _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 +var _0xda2d=['dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav49','gsm','leastrecent','random','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','inUse','invalid','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting'];(function(_0x5c0dcb,_0x16cd83){var _0x183a0e=function(_0xfb292d){while(--_0xfb292d){_0x5c0dcb['push'](_0x5c0dcb['shift']());}};_0x183a0e(++_0x16cd83);}(_0xda2d,0xb3));var _0xdda2=function(_0x2ed58b,_0x2a6b9d){_0x2ed58b=_0x2ed58b-0x0;var _0x1b0211=_0xda2d[_0x2ed58b];return _0x1b0211;};'use strict';var monitorFormat={'wav':'wav','wav49':_0xdda2('0x0'),'gsm':_0xdda2('0x1')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0xdda2('0x2'),'linear':'linear','random':_0xdda2('0x3'),'ringall':'ringall','rr':_0xdda2('0x4'),'rrmemory':_0xdda2('0x5'),'rrordered':_0xdda2('0x6'),'wrandom':_0xdda2('0x7')};function VoiceQueue(_0x3205a7){this['id']=_0x3205a7['id']||0x0;this['name']=_0x3205a7[_0xdda2('0x8')]||'';this[_0xdda2('0x9')]=_0x3205a7[_0xdda2('0x9')]||'';this[_0xdda2('0xa')]=_0x3205a7['type']||'inbound';this[_0xdda2('0xb')]=0x0;this[_0xdda2('0xc')]=0x0;this[_0xdda2('0xd')]=0x0;this[_0xdda2('0xe')]=0x0;this[_0xdda2('0xf')]=0x0;this[_0xdda2('0x10')]=0x0;this[_0xdda2('0x11')]=0x0;this[_0xdda2('0x12')]=0x0;this[_0xdda2('0x13')]=0x0;this['busy']=0x0;this[_0xdda2('0x14')]=0x0;this[_0xdda2('0x15')]=0x0;this['loggedIn']=0x0;this[_0xdda2('0x16')]=0x0;this[_0xdda2('0x17')]=0x0;this[_0xdda2('0x18')]=0x0;this[_0xdda2('0x19')]=0x0;this[_0xdda2('0x1a')]=0x0;this[_0xdda2('0x1b')]=0x0;this[_0xdda2('0x1c')]=0x0;this['unknown']=0x0;this[_0xdda2('0x1d')]=_0x3205a7[_0xdda2('0x1d')]||![];this['acwTimeout']=_0x3205a7[_0xdda2('0x1e')]||0xa;this[_0xdda2('0x1f')]=_0x3205a7[_0xdda2('0x1f')]||'no';this[_0xdda2('0x20')]=!![];this[_0xdda2('0x21')]='';this[_0xdda2('0x22')]='';this[_0xdda2('0x23')]=0x0;this[_0xdda2('0x24')]=0x0;this['dialTimezone']=_0x3205a7[_0xdda2('0x25')]||null;this['dialGlobalInterval']=_0x3205a7[_0xdda2('0x26')]?_0x3205a7['dialGlobalInterval']:null;this[_0xdda2('0x27')]=_0x3205a7[_0xdda2('0x27')];this[_0xdda2('0x28')]=_0x3205a7[_0xdda2('0x28')]||_0xdda2('0x29');this['dialLimitChannel']=_0x3205a7[_0xdda2('0x2a')]||0x0;this['dialLimitQueue']=_0x3205a7[_0xdda2('0x2b')]||0x0;this[_0xdda2('0x2c')]=_0x3205a7[_0xdda2('0x2c')]||0x1;this['dialPredictiveOptimization']=_0x3205a7['dialPredictiveOptimization']||_0xdda2('0x2d');this[_0xdda2('0x2e')]=_0x3205a7['dialPredictiveOptimizationPercentage']||0.03;this[_0xdda2('0x2f')]=_0x3205a7[_0xdda2('0x2f')]||0x258;this['dialOriginateCallerIdName']=_0x3205a7['dialOriginateCallerIdName']||'anonymous';this[_0xdda2('0x30')]=_0x3205a7[_0xdda2('0x30')]||_0xdda2('0x31');this[_0xdda2('0x32')]=_0x3205a7[_0xdda2('0x32')]||0x1e;this['dialQueueOptions']=_0x3205a7[_0xdda2('0x33')]||'tTxX';this[_0xdda2('0x34')]=_0x3205a7[_0xdda2('0x34')]||0x3;this[_0xdda2('0x35')]=_0x3205a7[_0xdda2('0x35')]||undefined;this[_0xdda2('0x36')]=_0x3205a7[_0xdda2('0x36')]||0x3;this['dialCongestionRetryFrequency']=_0x3205a7[_0xdda2('0x37')]||0x96;this[_0xdda2('0x38')]=_0x3205a7[_0xdda2('0x38')]||0x3;this['dialBusyRetryFrequency']=_0x3205a7[_0xdda2('0x39')]||0x96;this['dialNoAnswerMaxRetry']=_0x3205a7['dialNoAnswerMaxRetry']||0x3;this[_0xdda2('0x3a')]=_0x3205a7[_0xdda2('0x3a')]||0x96;this[_0xdda2('0x3b')]=_0x3205a7[_0xdda2('0x3b')]||0x3;this[_0xdda2('0x3c')]=_0x3205a7['dialNoSuchNumberRetryFrequency']||0x96;this[_0xdda2('0x3d')]=_0x3205a7[_0xdda2('0x3d')]||0x3;this[_0xdda2('0x3e')]=_0x3205a7[_0xdda2('0x3e')]||0x96;this[_0xdda2('0x3f')]=_0x3205a7[_0xdda2('0x3f')]||0x3;this[_0xdda2('0x40')]=_0x3205a7[_0xdda2('0x40')]||0x96;this[_0xdda2('0x41')]=_0x3205a7[_0xdda2('0x41')]||0x3;this['dialMachineRetryFrequency']=_0x3205a7[_0xdda2('0x42')]||0x96;this[_0xdda2('0x43')]=_0x3205a7['dialAgentRejectMaxRetry']||0x3;this[_0xdda2('0x44')]=_0x3205a7[_0xdda2('0x44')]||0x96;this[_0xdda2('0x45')]=_0x3205a7[_0xdda2('0x45')]||0x3;this['dialGlobalMaxRetry']=_0x3205a7[_0xdda2('0x46')]||0x4;this[_0xdda2('0x47')]=_0x3205a7[_0xdda2('0x47')]?_0x3205a7['Trunk']:undefined;this[_0xdda2('0x48')]=_0x3205a7['TrunkBackup']?_0x3205a7[_0xdda2('0x48')]:undefined;this['dialPrefix']=_0x3205a7[_0xdda2('0x49')]||undefined;this[_0xdda2('0x4a')]=_0x3205a7['Interval']?_0x3205a7['Interval']:undefined;this[_0xdda2('0x4b')]=_0x3205a7[_0xdda2('0x4b')]||'DESC';this[_0xdda2('0x4c')]=_0x3205a7[_0xdda2('0x4c')]||undefined;this[_0xdda2('0x4d')]=_0x3205a7[_0xdda2('0x4d')]||undefined;this[_0xdda2('0x4e')]=strategy[_0x3205a7[_0xdda2('0x4e')]];this[_0xdda2('0x4f')]=!![];this[_0xdda2('0x50')]=_0x3205a7['dialAMDActive']||![];this[_0xdda2('0x51')]=_0x3205a7[_0xdda2('0x51')];this[_0xdda2('0x52')]=_0x3205a7[_0xdda2('0x52')];this[_0xdda2('0x53')]=_0x3205a7[_0xdda2('0x53')];this[_0xdda2('0x54')]=_0x3205a7[_0xdda2('0x54')];this[_0xdda2('0x55')]=_0x3205a7[_0xdda2('0x55')];this[_0xdda2('0x56')]=_0x3205a7[_0xdda2('0x56')];this['dialAMDMaximumNumberOfWords']=_0x3205a7[_0xdda2('0x57')];this['dialAMDSilenceThreshold']=_0x3205a7[_0xdda2('0x58')];this[_0xdda2('0x59')]=_0x3205a7[_0xdda2('0x59')];this[_0xdda2('0x5a')]=0x0;this[_0xdda2('0x5b')]=0x0;this[_0xdda2('0x5c')]=_0x3205a7[_0xdda2('0x5c')];this[_0xdda2('0x5d')]=0x0;this[_0xdda2('0x5e')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xdda2('0x5f')]=0x0;this[_0xdda2('0x60')]=0x0;this[_0xdda2('0x61')]=0x0;this[_0xdda2('0x62')]=0x0;this[_0xdda2('0x63')]=0x0;this[_0xdda2('0x64')]=0x0;this[_0xdda2('0x65')]=0x0;this[_0xdda2('0x66')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xdda2('0x67')]=0x0;this[_0xdda2('0x68')]=0x0;this[_0xdda2('0x69')]=undefined;this[_0xdda2('0x6a')]=undefined;this[_0xdda2('0x6b')]=undefined;this[_0xdda2('0x6c')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xdda2('0x6d')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xdda2('0x6e')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xdda2('0x6f')]=0x0;this[_0xdda2('0x70')]=_0x3205a7[_0xdda2('0x71')]||0x14;this[_0xdda2('0x72')]=_0x3205a7[_0xdda2('0x71')]||0xa;this[_0xdda2('0x73')]=0x0;this[_0xdda2('0x74')]=0x0;this[_0xdda2('0x75')]=0x1;this['erlangCalls']=0x0;this[_0xdda2('0x76')]=0x0;this[_0xdda2('0x77')]=0x0;this[_0xdda2('0x78')]=0x0;this['dialRecallMeTimeout']=_0x3205a7[_0xdda2('0x79')]||0x1e;this[_0xdda2('0x7a')]=_0x3205a7[_0xdda2('0x7a')]||![];this[_0xdda2('0x7b')]=!!_0x3205a7['dialPreviewAutoRecallMe']||![];this[_0xdda2('0x7c')]=!!_0x3205a7[_0xdda2('0x7c')]||![];this['dialQueueProject2']=_0x3205a7['dialQueueProject2']||undefined;this[_0xdda2('0x7d')]=_0x3205a7[_0xdda2('0x7d')]||![];this[_0xdda2('0x7e')]=_0x3205a7[_0xdda2('0x7e')]||![];this[_0xdda2('0x9')]=monitorFormat[_0x3205a7[_0xdda2('0x9')]]?monitorFormat[_0x3205a7[_0xdda2('0x9')]]:undefined;this[_0xdda2('0x7f')]=_0x3205a7[_0xdda2('0x7f')]||![];this[_0xdda2('0x80')]=_0x3205a7[_0xdda2('0x80')]?_0x3205a7[_0xdda2('0x80')]:undefined;this[_0xdda2('0x81')]=![];}module[_0xdda2('0x82')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index b63feac..34dba56 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 _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 +var _0x93bb=['outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','createReport','loggedin','callers','length','online','incall','includes','status','booked','keys','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','active','updateReportFromOutboundQueue','total','preview','exports','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','inUse','originated','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBusyCallsDay'];(function(_0x21bc24,_0x1b6d5b){var _0x41a486=function(_0x5c56da){while(--_0x5c56da){_0x21bc24['push'](_0x21bc24['shift']());}};_0x41a486(++_0x1b6d5b);}(_0x93bb,0x135));var _0xb93b=function(_0x159212,_0x188d2e){_0x159212=_0x159212-0x0;var _0x4a8cfd=_0x93bb[_0x159212];return _0x4a8cfd;};'use strict';var INBOUND_COUNTERS=[_0xb93b('0x0'),_0xb93b('0x1'),_0xb93b('0x2'),_0xb93b('0x3'),_0xb93b('0x4'),_0xb93b('0x5'),_0xb93b('0x6')];var OUTBOUND_COUNTERS=[_0xb93b('0x0'),_0xb93b('0x7'),_0xb93b('0x8'),'loggedIn',_0xb93b('0x2'),_0xb93b('0x9'),'outboundAbandonedCallsDay',_0xb93b('0xa'),_0xb93b('0xb'),'outboundBusyCallsDay',_0xb93b('0xc'),_0xb93b('0xd'),_0xb93b('0xe'),_0xb93b('0xf'),_0xb93b('0x10'),_0xb93b('0x11'),_0xb93b('0x3'),_0xb93b('0x12'),_0xb93b('0x5'),_0xb93b('0x13'),_0xb93b('0x14'),'total',_0xb93b('0x6')];function VoiceQueueSummary(_0xc5385a){this['id']=_0xc5385a['id'];this[_0xb93b('0x15')]=_0xc5385a[_0xb93b('0x15')];this['strategy']=_0xc5385a[_0xb93b('0x16')];this[_0xb93b('0x17')]=_0xc5385a[_0xb93b('0x17')]||0x0;this[_0xb93b('0x7')]=_0xc5385a[_0xb93b('0x7')]||0x0;this[_0xb93b('0x0')]=_0xc5385a[_0xb93b('0x0')]||0x0;this['busy']=_0xc5385a[_0xb93b('0x18')]||0x0;this[_0xb93b('0x8')]=_0xc5385a[_0xb93b('0x8')]||0x0;this[_0xb93b('0x19')]=_0xc5385a[_0xb93b('0x19')]||0x0;this[_0xb93b('0x1')]=_0xc5385a['loggedIn']||0x0;this[_0xb93b('0x2')]=_0xc5385a['loggedInDb']||0x0;this[_0xb93b('0x1a')]=_0xc5385a[_0xb93b('0x1a')]||0x0;this[_0xb93b('0x1b')]=_0xc5385a[_0xb93b('0x1b')]||0x0;this[_0xb93b('0x3')]=_0xc5385a[_0xb93b('0x3')]||0x0;this['ringing']=_0xc5385a[_0xb93b('0x4')]||0x0;this[_0xb93b('0x1c')]=_0xc5385a[_0xb93b('0x1c')];this[_0xb93b('0x13')]=_0xc5385a[_0xb93b('0x13')];this[_0xb93b('0x14')]=_0xc5385a['sumDuration'];this['sumHoldTime']=_0xc5385a['sumHoldTime']||0x0;this['talking']=_0xc5385a[_0xb93b('0x5')]||0x0;this['total']=_0xc5385a['total']||0x0;this[_0xb93b('0x1d')]=_0xc5385a[_0xb93b('0x1d')];this[_0xb93b('0x1e')]=_0xc5385a['unavailable']||0x0;this[_0xb93b('0x1f')]=_0xc5385a[_0xb93b('0x1f')]||0x0;this['unmanaged']=_0xc5385a[_0xb93b('0x20')]||0x0;this[_0xb93b('0x6')]=_0xc5385a[_0xb93b('0x6')]||0x0;if(_0xc5385a[_0xb93b('0x1d')]===_0xb93b('0x21')){this[_0xb93b('0x12')]=_0xc5385a['pTalking']||0x0;this[_0xb93b('0x22')]=_0xc5385a[_0xb93b('0x22')];this[_0xb93b('0x23')]=_0xc5385a[_0xb93b('0x23')];this['dialOriginateCallerIdName']=_0xc5385a[_0xb93b('0x24')];this[_0xb93b('0x25')]=_0xc5385a[_0xb93b('0x25')];this[_0xb93b('0x26')]=_0xc5385a[_0xb93b('0x26')];this[_0xb93b('0x27')]=_0xc5385a[_0xb93b('0x27')];this['temp']=_0xc5385a[_0xb93b('0x28')];this['outboundAnswerAgiCallsDay']=_0xc5385a[_0xb93b('0x29')];this[_0xb93b('0xa')]=_0xc5385a[_0xb93b('0xa')];this[_0xb93b('0xb')]=_0xc5385a[_0xb93b('0xb')];this[_0xb93b('0x2a')]=_0xc5385a[_0xb93b('0x2a')];this[_0xb93b('0xc')]=_0xc5385a[_0xb93b('0xc')];this['outboundDropCallsDayACS']=_0xc5385a['outboundDropCallsDayACS'];this[_0xb93b('0x2b')]=_0xc5385a[_0xb93b('0x2b')];this[_0xb93b('0x2c')]=_0xc5385a['outboundDropCallsDayTimeout'];this['outboundNoAnswerCallsDay']=_0xc5385a[_0xb93b('0xd')];this[_0xb93b('0xe')]=_0xc5385a[_0xb93b('0xe')];this['outboundOriginateFailureCallsDay']=_0xc5385a['outboundOriginateFailureCallsDay'];this[_0xb93b('0xf')]=_0xc5385a[_0xb93b('0xf')];this[_0xb93b('0x10')]=_0xc5385a[_0xb93b('0x10')];this[_0xb93b('0x11')]=_0xc5385a[_0xb93b('0x11')];this[_0xb93b('0x2d')]=_0xc5385a['predictiveIntervalAnsweredCalls'];this[_0xb93b('0x2e')]=_0xc5385a[_0xb93b('0x2e')];this[_0xb93b('0x2f')]=_0xc5385a[_0xb93b('0x2f')];this[_0xb93b('0x30')]=_0xc5385a[_0xb93b('0x30')];this[_0xb93b('0x31')]=_0xc5385a['predictiveIntervalDroppedCallsTimeout'];this[_0xb93b('0x32')]=_0xc5385a[_0xb93b('0x32')];this[_0xb93b('0x33')]=_0xc5385a[_0xb93b('0x33')];this[_0xb93b('0x34')]=_0xc5385a[_0xb93b('0x34')];this[_0xb93b('0x35')]=_0xc5385a['predictiveIntervalMultiplicativeFactor'];this[_0xb93b('0x36')]=_0xc5385a[_0xb93b('0x36')];this[_0xb93b('0x37')]=_0xc5385a[_0xb93b('0x37')];this[_0xb93b('0x38')]=_0xc5385a[_0xb93b('0x38')];this[_0xb93b('0x9')]=_0xc5385a[_0xb93b('0x9')];this[_0xb93b('0x39')]=_0xc5385a[_0xb93b('0x39')];this[_0xb93b('0x3a')]=_0xc5385a[_0xb93b('0x3a')];this[_0xb93b('0x3b')]=_0xc5385a[_0xb93b('0x3b')];this['erlangBusyFactor']=_0xc5385a[_0xb93b('0x3c')];this[_0xb93b('0x3d')]=_0xc5385a['startPredictive'];this[_0xb93b('0x3e')]=_0xc5385a[_0xb93b('0x3e')];this[_0xb93b('0x3f')]=_0xc5385a[_0xb93b('0x3f')];this[_0xb93b('0x40')]=_0xc5385a[_0xb93b('0x40')];}if(_0xc5385a['Trunk']){this[_0xb93b('0x41')]={'id':_0xc5385a[_0xb93b('0x41')]['id'],'name':_0xc5385a[_0xb93b('0x41')][_0xb93b('0x15')],'active':_0xc5385a['Trunk']['active'],'callerid':_0xc5385a[_0xb93b('0x41')][_0xb93b('0x42')]};}}VoiceQueueSummary[_0xb93b('0x43')][_0xb93b('0x44')]=function(_0x53aaaa,_0x3396d7,_0x4b7f03,_0x14cea3){this['loggedInDb']=0x0;this[_0xb93b('0x5')]=0x0;this[_0xb93b('0x3')]=0x0;this[_0xb93b('0x1f')]=0x0;this[_0xb93b('0x1b')]=0x0;this[_0xb93b('0x8')]=0x0;this[_0xb93b('0x18')]=0x0;this[_0xb93b('0x19')]=0x0;this['unavailable']=0x0;this[_0xb93b('0x4')]=0x0;this['ringInUse']=0x0;this[_0xb93b('0x1a')]=0x0;if(_0x4b7f03){if(_0x4b7f03['available']){this['available']=Number(_0x4b7f03[_0xb93b('0x0')]);}if(_0x4b7f03[_0xb93b('0x45')]){this[_0xb93b('0x1')]=Number(_0x4b7f03[_0xb93b('0x45')]);}if(_0x4b7f03[_0xb93b('0x46')]){this['waiting']=Number(_0x4b7f03['callers']);}}for(var _0x321fb0=0x0;_0x321fb0<_0x53aaaa[_0xb93b('0x47')];_0x321fb0++){var _0x1a5560=_0x3396d7['SIP/'+_0x53aaaa[_0x321fb0][_0xb93b('0x15')]];if(_0x1a5560&&_0x1a5560[_0xb93b('0x48')]){this['loggedInDb']+=0x1;}if(_0x53aaaa[_0x321fb0][_0xb93b('0x49')]==='1'){this[_0xb93b('0x5')]+=0x1;}if(_0x53aaaa[_0x321fb0][_0xb93b('0x3')]==='1'&&!['2','7','8'][_0xb93b('0x4a')](_0x53aaaa[_0x321fb0]['status'])){this[_0xb93b('0x3')]+=0x1;}switch(_0x53aaaa[_0x321fb0][_0xb93b('0x4b')]){case'0':this['unknown']+=0x1;break;case'1':this[_0xb93b('0x1b')]+=0x1;break;case'2':this[_0xb93b('0x8')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0xb93b('0x1e')]+=0x1;break;case'6':this[_0xb93b('0x4')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0xb93b('0x1a')]+=0x1;break;}}if(this[_0xb93b('0x23')]===_0xb93b('0x4c')){var _0x2f62be=Object[_0xb93b('0x4d')](_0x14cea3);for(var _0x2b47d4=0x0;_0x2b47d4<_0x2f62be['length'];_0x2b47d4++){var _0x15bd64=_0x2f62be[_0x2b47d4];var _0x456702=_0x14cea3[_0x15bd64];if(_0x456702['queue']===this[_0xb93b('0x15')]&&_0x456702['type']===_0xb93b('0x4e')&&_0x456702[_0xb93b('0x4f')]===_0xb93b('0x50')){this[_0xb93b('0x5')]+=0x1;}}if(this[_0xb93b('0x5')]>this['inUse']){this['talking']=this[_0xb93b('0x8')];}this[_0xb93b('0x12')]=0x0;}return this;};VoiceQueueSummary[_0xb93b('0x43')][_0xb93b('0x51')]=function(_0x1e667e){var _0x3ae118=![];if(_0x1e667e){_0x3ae118=INBOUND_COUNTERS[_0xb93b('0x52')](function(_0x49797b){return this[_0x49797b]!==_0x1e667e[_0x49797b];},this);}return _0x3ae118;};VoiceQueueSummary['prototype']['compareToOutboundQueue']=function(_0x88c27e){var _0x4b60bf=![];var _0x56cc48=![];var _0x53cf62=![];if(_0x88c27e){_0x4b60bf=this[_0xb93b('0x23')]!==_0x88c27e[_0xb93b('0x23')]||this[_0xb93b('0x22')]!==_0x88c27e[_0xb93b('0x22')]||this['message']!==_0x88c27e['message']||this[_0xb93b('0x40')]!==_0x88c27e[_0xb93b('0x40')];_0x56cc48=OUTBOUND_COUNTERS[_0xb93b('0x52')](function(_0x1dcfba){return this[_0x1dcfba]!==_0x88c27e[_0x1dcfba];},this);if(this[_0xb93b('0x41')]&&_0x88c27e[_0xb93b('0x41')]){_0x53cf62=this['Trunk'][_0xb93b('0x15')]!==_0x88c27e[_0xb93b('0x41')]['name']||this['Trunk']['active']!==_0x88c27e[_0xb93b('0x41')][_0xb93b('0x53')];}}return _0x4b60bf||_0x56cc48||_0x53cf62;};VoiceQueueSummary[_0xb93b('0x43')][_0xb93b('0x54')]=function(_0x1b3976){this['answered']=_0x1b3976[_0xb93b('0x7')];this[_0xb93b('0x3f')]=_0x1b3976[_0xb93b('0x3f')];this['statusMessage']=_0x1b3976[_0xb93b('0x40')];this[_0xb93b('0x9')]=_0x1b3976[_0xb93b('0x9')];this['outboundAbandonedCallsDay']=_0x1b3976['outboundAbandonedCallsDay'];this[_0xb93b('0xa')]=_0x1b3976[_0xb93b('0xa')];this[_0xb93b('0xb')]=_0x1b3976[_0xb93b('0xb')];this[_0xb93b('0x2a')]=_0x1b3976['outboundBusyCallsDay'];this[_0xb93b('0xc')]=_0x1b3976[_0xb93b('0xc')];this[_0xb93b('0xd')]=_0x1b3976[_0xb93b('0xd')];this['outboundNoSuchCallsDay']=_0x1b3976[_0xb93b('0xe')];this[_0xb93b('0xf')]=_0x1b3976['outboundReCallsDay'];this['outboundRejectCallsDay']=_0x1b3976[_0xb93b('0x10')];this['outboundUnknownCallsDay']=_0x1b3976[_0xb93b('0x11')];this[_0xb93b('0x13')]=_0x1b3976[_0xb93b('0x13')];this[_0xb93b('0x14')]=_0x1b3976['sumDuration'];this[_0xb93b('0x55')]=_0x1b3976[_0xb93b('0x55')];if(this[_0xb93b('0x23')]===_0xb93b('0x56')){this[_0xb93b('0x12')]=_0x1b3976[_0xb93b('0x12')];}};module[_0xb93b('0x57')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 0e5a667..ec5ab58 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 _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 +var _0x30d7=['username','accessKey','remoteUri','serverUrl','Configurations','name'];(function(_0x5db140,_0x2afc63){var _0x171133=function(_0x26b95a){while(--_0x26b95a){_0x5db140['push'](_0x5db140['shift']());}};_0x171133(++_0x2afc63);}(_0x30d7,0x173));var _0x730d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x30d7[_0x3dd15e];return _0x231fd0;};'use strict';function VtigerAccount(_0x46d7fe){this['id']=_0x46d7fe['id']||0x0;this[_0x730d('0x0')]=_0x46d7fe[_0x730d('0x0')]||'';this[_0x730d('0x1')]=_0x46d7fe[_0x730d('0x1')]||'';this['accessKey']=_0x46d7fe[_0x730d('0x2')]||'';this[_0x730d('0x3')]=_0x46d7fe[_0x730d('0x3')]||'';this[_0x730d('0x4')]=_0x46d7fe[_0x730d('0x4')]||'';this['Configurations']=_0x46d7fe[_0x730d('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 8aa9bc6..97f62f6 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 _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 +var _0x3462=['serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0xff659d,_0x2283a1){var _0x19c170=function(_0x15358e){while(--_0x15358e){_0xff659d['push'](_0xff659d['shift']());}};_0x19c170(++_0x2283a1);}(_0x3462,0x10b));var _0x2346=function(_0x1a5469,_0x5035a1){_0x1a5469=_0x1a5469-0x0;var _0x3f59cd=_0x3462[_0x1a5469];return _0x3f59cd;};'use strict';function ZendeskAccount(_0x5d168a){this['id']=_0x5d168a['id']||0x0;this['name']=_0x5d168a[_0x2346('0x0')]||'';this[_0x2346('0x1')]=_0x5d168a[_0x2346('0x1')]||'';this[_0x2346('0x2')]=_0x5d168a[_0x2346('0x2')]||'';this[_0x2346('0x3')]=_0x5d168a['token']||'';this[_0x2346('0x4')]=_0x5d168a[_0x2346('0x4')]||'';this[_0x2346('0x5')]=_0x5d168a['authType']||'';this[_0x2346('0x6')]=_0x5d168a[_0x2346('0x6')]||_0x2346('0x7');this[_0x2346('0x8')]=_0x5d168a['serverUrl']||'';this[_0x2346('0x9')]=_0x5d168a['Configurations']||{};}module[_0x2346('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 26cb2a5..a5e24b8 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 _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 +var _0x05cd=['serverUrl','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret'];(function(_0x561a26,_0x1f944b){var _0x1e7e34=function(_0x1961b0){while(--_0x1961b0){_0x561a26['push'](_0x561a26['shift']());}};_0x1e7e34(++_0x1f944b);}(_0x05cd,0x86));var _0xd05c=function(_0x50536d,_0x310e0d){_0x50536d=_0x50536d-0x0;var _0xd48d5c=_0x05cd[_0x50536d];return _0xd48d5c;};'use strict';function ZohoAccount(_0x19b1db){this['id']=_0x19b1db['id']||0x0;this[_0xd05c('0x0')]=_0x19b1db[_0xd05c('0x0')]||'';this[_0xd05c('0x1')]=_0x19b1db[_0xd05c('0x1')]||'';this[_0xd05c('0x2')]=_0x19b1db[_0xd05c('0x2')]||'';this[_0xd05c('0x3')]=_0x19b1db[_0xd05c('0x3')]||'';this[_0xd05c('0x4')]=_0x19b1db[_0xd05c('0x4')]||'';this[_0xd05c('0x5')]=_0x19b1db['clientSecret']||'';this['serverUrl']=_0x19b1db[_0xd05c('0x6')]||'';this['code']=_0x19b1db['code']||'';this[_0xd05c('0x7')]=_0x19b1db['refreshToken']||'';this[_0xd05c('0x8')]=_0x19b1db['Configurations']||{};}module[_0xd05c('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 921859b..6cc8ec8 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 _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 +var _0x1399=['type','queue','dialAnswer','Agent','name','channelAgent','membername','calleridname','phone','Contact','firstName','active','scheduledat','countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','format','\x22%s\x22\x20<%s>','number','exports','util','lodash','isNil','string','idContact'];(function(_0x5c14e3,_0x1c80e9){var _0x53e39d=function(_0x2da4e9){while(--_0x2da4e9){_0x5c14e3['push'](_0x5c14e3['shift']());}};_0x53e39d(++_0x1c80e9);}(_0x1399,0x16c));var _0x9139=function(_0x4ae32d,_0x256489){_0x4ae32d=_0x4ae32d-0x0;var _0x550537=_0x1399[_0x4ae32d];return _0x550537;};'use strict';var util=require(_0x9139('0x0'));var _=require(_0x9139('0x1'));var moment=require('moment');function checkNameSurname(_0x474911,_0x4f01ae,_0x10c98f){var _0x8bba08='';if(!_[_0x9139('0x2')](_0x4f01ae)&&_0x9139('0x3')===typeof _0x4f01ae){_0x8bba08+=_0x4f01ae;}if(!_[_0x9139('0x2')](_0x10c98f)&&_0x9139('0x3')===typeof _0x10c98f){_0x8bba08+='\x20'+_0x10c98f;}if(_0x8bba08!==''){return _0x8bba08;}return _0x474911;}function Action(_0x5ac80b,_0x54af2d,_0x8f086b,_0x11d2ed,_0x4d5d1e){this['uniqueid']=_0x8f086b||undefined;this[_0x9139('0x4')]=_0x5ac80b['id'];this['queue']=_0x54af2d['name'];this[_0x9139('0x5')]=_0x54af2d[_0x9139('0x5')];this['campaigntype']=_0x9139('0x6');this[_0x9139('0x7')]=![];this['membername']=_['isNil'](_0x5ac80b[_0x9139('0x8')])?undefined:_0x5ac80b[_0x9139('0x8')][_0x9139('0x9')];this[_0x9139('0xa')]=this[_0x9139('0xb')]?util['format']('SIP/%s',this['membername']):_0x11d2ed||undefined;this[_0x9139('0xc')]=checkNameSurname(_0x5ac80b['Contact'][_0x9139('0xd')],_0x5ac80b[_0x9139('0xe')][_0x9139('0xf')],_0x5ac80b[_0x9139('0xe')]['lastName']);this[_0x9139('0x10')]=_0x5ac80b['active']||![];this['calleridnum']=_0x5ac80b['phone'];this[_0x9139('0x11')]=_0x5ac80b[_0x9139('0x11')];this[_0x9139('0x12')]=_0x5ac80b[_0x9139('0x12')]||0x0;this[_0x9139('0x13')]=_0x5ac80b[_0x9139('0x13')]||0x0;this['countnoanswerretry']=_0x5ac80b['countnoanswerretry']||0x0;this[_0x9139('0x14')]=(_0x5ac80b[_0x9139('0x12')]||0x0)+(_0x5ac80b['countcongestionretry']||0x0)+(_0x5ac80b['countnoanswerretry']||0x0)+(_0x5ac80b[_0x9139('0x15')]||0x0)+(_0x5ac80b[_0x9139('0x16')]||0x0)+(_0x5ac80b['countabandonedretry']||0x0)+(_0x5ac80b[_0x9139('0x17')]||0x0)+(_0x5ac80b[_0x9139('0x18')]||0x0);this[_0x9139('0x15')]=_0x5ac80b[_0x9139('0x15')]||0x0;this[_0x9139('0x16')]=_0x5ac80b[_0x9139('0x16')]||0x0;this[_0x9139('0x19')]=_0x5ac80b[_0x9139('0x19')]||0x0;this[_0x9139('0x17')]=_0x5ac80b[_0x9139('0x17')]||0x0;this[_0x9139('0x18')]=_0x5ac80b[_0x9139('0x18')]||0x0;this[_0x9139('0x1a')]=_0x5ac80b[_0x9139('0x1a')];this[_0x9139('0x1b')]=_0x5ac80b[_0x9139('0x1b')];this[_0x9139('0x1c')]=_0x5ac80b[_0x9139('0x1c')];this[_0x9139('0x1d')]=_0x5ac80b['recallme'];this[_0x9139('0x1e')]=_0x5ac80b[_0x9139('0x1e')];this['ListId']=_0x5ac80b[_0x9139('0x1f')];this[_0x9139('0x20')]=_[_0x9139('0x2')](_0x5ac80b['Agent'])?_0x5ac80b[_0x9139('0x20')]:_0x5ac80b[_0x9139('0x8')]['id'];this['VoiceQueueId']=_0x5ac80b[_0x9139('0x21')];this[_0x9139('0x22')]='';this[_0x9139('0x23')]='';}Action['prototype'][_0x9139('0x24')]=function(){return util[_0x9139('0x25')](_0x9139('0x26'),this[_0x9139('0xc')],this[_0x9139('0x27')]);};module[_0x9139('0x28')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index b4aa0b7..70c3e88 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 _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 +var _0x8471=['object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','updateOriginated','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','called','Calling','Call\x20failed','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','isTrunkReachable','active','SIP/%s','unmonitored','unlock','disableContact','execRun','getContactPreview','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','assign','toLowerVariables','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','custom:agentringnoanswer','rejected','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','unlockContact','addVariable','variables','syncVarSet','filterKey','keys','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','util','uuid','moment','ioredis','../../../config/environment','../../../config/logger','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./util/util','redis','defaults','localhost','socket.io-emitter','tail','finally','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','hangup','syncHangup','bind','syncHangupRequest','dialend','syncNewExten','varset','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','info','stringify','format','name','voice_queue_channel:remove','emit','voice_queue_presence:remove','originated','pTalking','sendMessageOneNotActive','available','message','CAMPAIGN_STATUS','INACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','logger','\x20is\x20deactivated','prototype','syncCampaigns','dialMethod','preview','booked','type','outbound','clearZombieChannels','dialActive','setMessage','recallMe','clearZombieChannel','sequence','enqueue','isNil','actions','[clearZombieChannels][talking]','Queue','pTalking:\x20','queue','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','size','hasOwnProperty','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','RecallFailedTimeout','[HistoryRecallClose]','logger2','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','Trunk','TrunkBackup','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','responsetime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','complete','outboundAnswerCallsDay','answered','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','unlockAgent','swapAdditionalPhones','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','outboundAbandonedCallsDay','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','countabandonedretry','dialAbandonedRetryFrequency','outboundUnknownCallsDay','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','ANSWER','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent'];(function(_0x2c53f2,_0xf57a6e){var _0x232260=function(_0x9c8bd1){while(--_0x9c8bd1){_0x2c53f2['push'](_0x2c53f2['shift']());}};_0x232260(++_0xf57a6e);}(_0x8471,0x67));var _0x1847=function(_0x2791d8,_0x57e8cb){_0x2791d8=_0x2791d8-0x0;var _0x1bee79=_0x8471[_0x2791d8];return _0x1bee79;};'use strict';var util=require(_0x1847('0x0'));var _=require('lodash');var uuid=require(_0x1847('0x1'));var moment=require(_0x1847('0x2'));var Redis=require(_0x1847('0x3'));var config=require(_0x1847('0x4'));var logger=require(_0x1847('0x5'))('preview');var loggerAction=require(_0x1847('0x5'))(_0x1847('0x6'));var ami=require(_0x1847('0x7'));var rpcDb=require(_0x1847('0x8'));var cmHopperAdditionalPhone=require(_0x1847('0x9'));var Action=require('./action');var ut=require(_0x1847('0xa'));var utils=require('../dialer/utils');config[_0x1847('0xb')]=_[_0x1847('0xc')](config['redis'],{'host':_0x1847('0xd'),'port':0x18eb});var io=require(_0x1847('0xe'))(new Redis(config['redis']));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x1ed5e7){this[_0x1847('0xf')]=this[_0x1847('0xf')]?this[_0x1847('0xf')][_0x1847('0x10')](_0x1ed5e7):_0x1ed5e7();};function Preview(_0xccab50){this['sequence']=new Sequence();this['campaignsPreview']=_0xccab50['voiceQueues'];this[_0x1847('0x11')]=_0xccab50[_0x1847('0x11')];this['actions']={};this[_0x1847('0x12')]=_0xccab50[_0x1847('0x12')];this[_0x1847('0x13')]=0x0;ami['on'](_0x1847('0x14'),this[_0x1847('0x15')]['bind'](this));ami['on'](_0x1847('0x16'),this[_0x1847('0x17')][_0x1847('0x18')](this));ami['on']('hanguprequest',this[_0x1847('0x19')][_0x1847('0x18')](this));ami['on'](_0x1847('0x1a'),this['syncDialEnd']['bind'](this));ami['on']('newexten',this[_0x1847('0x1b')][_0x1847('0x18')](this));ami['on'](_0x1847('0x1c'),this['syncVarSet']['bind'](this));ami['on'](_0x1847('0x1d'),this[_0x1847('0x1e')][_0x1847('0x18')](this));ami['on'](_0x1847('0x1f'),this[_0x1847('0x20')]['bind'](this));this[_0x1847('0x21')](this[_0x1847('0x22')]);}function emit(_0x2ea4e9,_0x4e10bc,_0x17f721){io['to'](_0x2ea4e9)['emit'](_0x4e10bc,_0x17f721);}function emitVoiceQueueChannelRemove(_0x20f903){logger[_0x1847('0x23')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x1847('0x24')](_0x20f903));emit(util[_0x1847('0x25')]('voice:queue:%s',_0x20f903[_0x1847('0x26')]),_0x1847('0x27'),_0x20f903);io[_0x1847('0x28')](_0x1847('0x29'),_0x20f903);}function notSendMessagesQueue(_0xa3534a){if(_0xa3534a['sendMessageOneNotActive']){if(_0xa3534a[_0x1847('0x2a')]===0x0&&_0xa3534a[_0x1847('0x2b')]===0x0){_0xa3534a[_0x1847('0x2c')]=![];_0xa3534a[_0x1847('0x2d')]=0x0;_0xa3534a['paused']=0x0;_0xa3534a[_0x1847('0x2e')]=utils[_0x1847('0x2f')][_0x1847('0x30')];ut['logger'](_0x1847('0x31'),_0xa3534a[_0x1847('0x26')]+'\x20is\x20not\x20active');}else{_0xa3534a[_0x1847('0x2e')]=utils[_0x1847('0x2f')]['DEACTIVATED'];ut[_0x1847('0x32')](_0x1847('0x31'),_0xa3534a[_0x1847('0x26')]+_0x1847('0x33'));}}}Preview[_0x1847('0x34')][_0x1847('0x21')]=function(){var _0x53f377=this;setInterval(function(){_0x53f377['syncCampaigns']();},0x7cf);};Preview[_0x1847('0x34')][_0x1847('0x35')]=function(){var _0x25c561=this[_0x1847('0x22')];this[_0x1847('0x13')]+=0x1;for(var _0x52afbe in _0x25c561){if(_0x25c561['hasOwnProperty'](_0x52afbe)&&(_0x25c561[_0x52afbe][_0x1847('0x36')]===_0x1847('0x37')||_0x25c561[_0x52afbe][_0x1847('0x36')]===_0x1847('0x38'))&&_0x25c561[_0x52afbe][_0x1847('0x39')]===_0x1847('0x3a')){if(this[_0x1847('0x13')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x1847('0x3b')]();}}if(_0x25c561['hasOwnProperty'](_0x52afbe)&&_0x25c561[_0x52afbe]['dialMethod']===_0x1847('0x37')&&_0x25c561[_0x52afbe][_0x1847('0x39')]===_0x1847('0x3a')){if(_0x25c561[_0x52afbe][_0x1847('0x3c')]){this[_0x1847('0x3d')](_0x25c561[_0x52afbe]);if(_0x25c561[_0x52afbe]['dialPreviewAutoRecallMe'])this[_0x1847('0x3e')](_0x25c561[_0x52afbe]);}else{notSendMessagesQueue(_0x25c561[_0x52afbe]);}}}};Preview[_0x1847('0x34')][_0x1847('0x3f')]=function(_0x49c607){var _0x5c68a8=this;this[_0x1847('0x40')][_0x1847('0x41')](function(){if(!_[_0x1847('0x42')](_0x5c68a8[_0x1847('0x43')][_0x49c607])){loggerAction[_0x1847('0x23')](_0x1847('0x44'),_0x49c607,_0x1847('0x45'),_0x5c68a8[_0x1847('0x43')][_0x49c607]['queue'],'originated:\x20',JSON[_0x1847('0x24')](_0x5c68a8['campaignsPreview'][_0x5c68a8['actions'][_0x49c607]['queue']][_0x1847('0x2a')]),_0x1847('0x46'),JSON[_0x1847('0x24')](_0x5c68a8[_0x1847('0x22')][_0x5c68a8[_0x1847('0x43')][_0x49c607][_0x1847('0x47')]][_0x1847('0x2b')]),JSON[_0x1847('0x24')](_0x5c68a8[_0x1847('0x43')][_0x49c607][_0x1847('0x48')]),JSON[_0x1847('0x24')](_[_0x1847('0x49')](_0x5c68a8['actions'][_0x49c607],[_0x1847('0x4a'),_0x1847('0x4b'),_0x1847('0x4c'),_0x1847('0x4d')])));return ami[_0x1847('0x4e')]({'action':_0x1847('0x4f'),'channel':_0x5c68a8[_0x1847('0x43')][_0x49c607][_0x1847('0x50')]})[_0x1847('0x51')](function(_0x55e034){if(_0x55e034[_0x1847('0x2e')]===_0x1847('0x52')){setTimeout(function(){if(_0x5c68a8['actions'][_0x49c607]){ut['updateOriginated'](_0x5c68a8[_0x1847('0x22')][_0x5c68a8[_0x1847('0x43')][_0x49c607][_0x1847('0x47')]],_0x1847('0x53'));if(_0x5c68a8[_0x1847('0x43')][_0x49c607][_0x1847('0x48')]===!![]){ut[_0x1847('0x54')](_0x5c68a8['campaignsPreview'][_0x5c68a8[_0x1847('0x43')][_0x49c607]['queue']],'[clearZombieChannel]');ut[_0x1847('0x55')]('[Dialer][checkChannel][pTalking][Preview]'+_0x49c607,_0x5c68a8[_0x1847('0x43')][_0x49c607]['queue']);}ut[_0x1847('0x55')](_0x1847('0x56')+_0x49c607,_0x5c68a8[_0x1847('0x43')][_0x49c607][_0x1847('0x47')]);delete _0x5c68a8[_0x1847('0x43')][_0x49c607];}},0x2328);}});}});};Preview[_0x1847('0x34')][_0x1847('0x3b')]=function(){var _0x1d253d=this;loggerAction['info']('[action]',_[_0x1847('0x57')](this[_0x1847('0x43')]));for(var _0x474a43 in this[_0x1847('0x43')]){if(_0x1d253d[_0x1847('0x43')][_0x1847('0x58')](_0x474a43)){_0x1d253d[_0x1847('0x3f')](_0x474a43);}}};Preview[_0x1847('0x34')]['recallMe']=function(_0x17cf3a){var _0x2ec67f=this;rpcDb[_0x1847('0x59')](_0x17cf3a['id'],ut[_0x1847('0x5a')](this['agents']))[_0x1847('0x5b')](function(_0x10de2c){if(!_[_0x1847('0x42')](_0x10de2c)){for(var _0x4927d9=0x0;_0x4927d9<_0x10de2c[_0x1847('0x5c')];_0x4927d9+=0x1){if(ut[_0x1847('0x5d')](_0x10de2c[_0x4927d9][_0x1847('0x5e')])<_0x17cf3a['dialRecallMeTimeout']*0x3c){if(_0x10de2c[_0x4927d9][_0x1847('0x5f')]&&!_0x10de2c[_0x4927d9]['Agent'][_0x1847('0x60')]){_0x2ec67f[_0x1847('0x61')](_0x10de2c[_0x4927d9]['id'])[_0x1847('0x5b')](ut['logger2'](_0x1847('0x62')))['catch'](ut['logger2'](_0x1847('0x62')));}else{rpcDb['disableContact'](_0x10de2c[_0x4927d9]['id']);}}else{var _0x4c3725=new Action(_0x10de2c[_0x4927d9],_0x17cf3a);_0x4c3725[_0x1847('0x63')]=moment()[_0x1847('0x25')](_0x1847('0x64'));_0x17cf3a['outboundReCallsDay']+=0x1;ut['logCustomer'](_0x4c3725,0x17,_0x1847('0x65'));if(_0x17cf3a[_0x1847('0x66')]){rpcDb[_0x1847('0x67')](ut[_0x1847('0x68')](_0x10de2c[_0x4927d9]));rpcDb[_0x1847('0x69')](_0x4c3725,_0x1847('0x6a'));}else{ut[_0x1847('0x6b')](_0x4c3725,0x16,_0x1847('0x6c'));rpcDb[_0x1847('0x69')](_0x4c3725,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x4c3725,_0x1847('0x6d'));}}}}})[_0x1847('0x51')](ut[_0x1847('0x6e')](_0x1847('0x6f')));};Preview['prototype']['setMessage']=function(_0x3081a0){_0x3081a0[_0x1847('0x2c')]=!![];if(ut[_0x1847('0x70')](_0x3081a0[_0x1847('0x71')])){_0x3081a0[_0x1847('0x2e')]=utils[_0x1847('0x2f')][_0x1847('0x72')];}else if(!ut[_0x1847('0x73')](_0x3081a0[_0x1847('0x3c')])){_0x3081a0[_0x1847('0x2e')]=utils[_0x1847('0x2f')][_0x1847('0x30')];}else if(!this['isTrunkReachable'](_0x3081a0[_0x1847('0x74')])){if(!this['isTrunkReachable'](_0x3081a0[_0x1847('0x75')])){_0x3081a0[_0x1847('0x2e')]=utils['CAMPAIGN_STATUS']['UNREACHABLE_TRUNK'];}else{_0x3081a0[_0x1847('0x2e')]=utils[_0x1847('0x2f')][_0x1847('0x76')];}}else{_0x3081a0['message']=utils[_0x1847('0x2f')][_0x1847('0x76')];}};Preview['prototype'][_0x1847('0x77')]=function(_0x14ab2b,_0x34aa8b,_0xedd2db){var _0x17eb45=this;var _0x10ca77=this[_0x1847('0x43')][_0x34aa8b];var _0x38e17f=this['campaignsPreview'][_0x10ca77[_0x1847('0x47')]];var _0x4ef935;var _0x525069=![];var _0x27491a=0x2;var _0x74e673=0x3;if(_0x38e17f){switch(_0xedd2db){case'1':_0x38e17f[_0x1847('0x78')]+=0x1;_0x10ca77[_0x1847('0x79')]+=0x1;_0x10ca77['countglobal']=ut[_0x1847('0x7a')](_0x10ca77);ut[_0x1847('0x6b')](_0x10ca77,0x0,_0x1847('0x7b'));ami[_0x1847('0x28')](_0x1847('0x7c'),ut[_0x1847('0x7d')](_0x10ca77,_0x1847('0x7e')));rpcDb[_0x1847('0x69')](_0x10ca77,'[callProgressDetectingCustomer][logNoSuch]');_0x17eb45[_0x1847('0x7f')](_0x10ca77,'0',_0x38e17f)['then'](function(_0x1e0e51){_0x525069=_0x1e0e51[_0x1847('0x80')]==0x1;_0x27491a=_0x38e17f[_0x1847('0x81')];_0x74e673=_0x38e17f[_0x1847('0x82')];if(!_0x525069){if(ut[_0x1847('0x7a')](_0x10ca77)>=_0x38e17f['dialGlobalMaxRetry']){_0x4ef935=ut[_0x1847('0x83')](_0x10ca77,0xf,_0x1847('0x84'));rpcDb[_0x1847('0x85')](_0x4ef935,_0x1847('0x86'));}else{if(_0x10ca77[_0x1847('0x79')]>=_0x38e17f[_0x1847('0x87')]){rpcDb['createCustomerFinal'](_0x10ca77,_0x1847('0x86'));}else{rpcDb[_0x1847('0x88')](ut[_0x1847('0x89')](_0x10ca77,_0x1847('0x79'),_0x38e17f['dialNoSuchNumberRetryFrequency']),_0x10ca77['unlockAgent'],_0x10ca77[_0x1847('0x8a')]);}}delete this[_0x1847('0x43')][_0x14ab2b[_0x1847('0x8b')]];}else{_0x10ca77[_0x1847('0x79')]++;logger[_0x1847('0x23')](_0x1847('0x8c'),_0x10ca77[_0x1847('0x79')]);logger[_0x1847('0x23')]('id',_0x10ca77[_0x1847('0x8d')]);_0x17eb45[_0x1847('0x8e')]({'id':_0x10ca77['idContact'],'field':{'countnosuchnumberretry':_0x10ca77[_0x1847('0x79')]}})['then'](function(){_0x17eb45['swapAdditionalPhones'](_0x10ca77,_0x27491a,_0x74e673)['then'](function(){});});}});break;case'ANSWER':var _0x143d7e=moment()['format'](_0x1847('0x64'));_0x10ca77[_0x1847('0x8f')]=_0x143d7e;_0x10ca77['answertime']=_0x143d7e;_0x10ca77[_0x1847('0x48')]=!![];_0x38e17f[_0x1847('0x2b')]+=0x1;logger[_0x1847('0x23')](_0x1847('0x90'),_0x10ca77[_0x1847('0x91')],'\x20Queue',_0x38e17f[_0x1847('0x26')],_0x1847('0x46'),_0x38e17f['pTalking']);ami[_0x1847('0x28')](_0x1847('0x92'),ut[_0x1847('0x7d')](_0x10ca77,_0x1847('0x93'),this[_0x1847('0x22')][_0x10ca77[_0x1847('0x47')]]));if(_0x38e17f[_0x1847('0x94')]){ami[_0x1847('0x28')](_0x1847('0x95'),ut[_0x1847('0x96')](_0x10ca77));}break;case'16':ami['emit']('custom:agentcomplete',ut['buildObj'](_0x10ca77,'complete',this[_0x1847('0x22')][_0x10ca77[_0x1847('0x47')]]));emitVoiceQueueChannelRemove(ut[_0x1847('0x7d')](_0x10ca77,_0x1847('0x97')));_0x38e17f[_0x1847('0x98')]+=0x1;_0x38e17f['total']+=0x1;_0x38e17f[_0x1847('0x99')]+=0x1;ut['decrementTalkink'](_0x38e17f,_0x1847('0x9a'));_0x10ca77[_0x1847('0x9b')]=ut['totalGlobal'](_0x10ca77);ut[_0x1847('0x6b')](_0x10ca77,0x4,_0x1847('0x9c'));rpcDb[_0x1847('0x69')](_0x10ca77,'[callProgressDetectingCustomer][logAnswer]');rpcDb['createCustomerFinal'](_0x10ca77,_0x1847('0x9d'));rpcDb[_0x1847('0x9e')](_0x10ca77);_0x38e17f[_0x1847('0x9f')]+=_0x10ca77[_0x1847('0xa0')];_0x38e17f['sumBillable']+=_0x10ca77[_0x1847('0xa0')];logger[_0x1847('0x23')](_0x1847('0xa1'),_0x10ca77[_0x1847('0x91')],_0x1847('0xa2'),_0x38e17f['name'],_0x1847('0x46'),_0x38e17f[_0x1847('0x2b')]);delete this[_0x1847('0x43')][_0x14ab2b[_0x1847('0x8b')]];break;case'BUSY':_0x38e17f[_0x1847('0xa3')]+=0x1;_0x10ca77[_0x1847('0xa4')]+=0x1;_0x10ca77['countglobal']=ut[_0x1847('0x7a')](_0x10ca77);ut[_0x1847('0x6b')](_0x10ca77,0x5,_0x1847('0xa5'));_0x27491a=_0x38e17f[_0x1847('0xa6')];_0x74e673=_0x38e17f[_0x1847('0x82')];ami[_0x1847('0x28')](_0x1847('0xa7'),ut['buildObj'](_0x10ca77,_0x1847('0xa8')));rpcDb[_0x1847('0x69')](_0x10ca77,_0x1847('0xa9'));_0x17eb45['verifyAdditionalPhones'](_0x10ca77,'5',_0x38e17f)[_0x1847('0x5b')](function(_0x2a18b4){_0x525069=_0x2a18b4[_0x1847('0x80')]==0x1;if(!_0x525069){if(ut['totalGlobal'](_0x10ca77)>=_0x38e17f[_0x1847('0xaa')]){_0x4ef935=ut[_0x1847('0x83')](_0x10ca77,0xf,_0x1847('0x84'));rpcDb[_0x1847('0x85')](_0x4ef935,_0x1847('0xab'));}else{if(_0x10ca77[_0x1847('0xa4')]>=_0x38e17f['dialBusyMaxRetry']){rpcDb[_0x1847('0x85')](_0x10ca77,_0x1847('0xa9'));}else{rpcDb[_0x1847('0x88')](ut['scheduledAt'](_0x10ca77,_0x1847('0xa4'),_0x38e17f[_0x1847('0xa6')]),_0x10ca77[_0x1847('0xac')],_0x10ca77['activeContact']);}}}else{_0x10ca77[_0x1847('0xa4')]++;_0x17eb45[_0x1847('0x8e')]({'id':_0x10ca77[_0x1847('0x8d')],'field':{'countbusyretry':_0x10ca77['countbusyretry']}})['then'](function(){_0x17eb45[_0x1847('0xad')](_0x10ca77,_0x27491a,_0x74e673)[_0x1847('0x5b')](function(){});});}});break;case _0x1847('0xae'):_0x38e17f[_0x1847('0xaf')]+=0x1;_0x10ca77['countnoanswerretry']+=0x1;_0x10ca77[_0x1847('0x9b')]=ut[_0x1847('0x7a')](_0x10ca77);ut['logCustomer'](_0x10ca77,0x3,_0x1847('0xb0'));_0x27491a=_0x38e17f[_0x1847('0xb1')];_0x74e673=_0x38e17f[_0x1847('0x82')];var _0x37cb47=ut['buildNoAnswerEventPayload'](_0x10ca77,_0x38e17f);ami[_0x1847('0x28')]('custom:agentnoanswer',_0x37cb47);rpcDb[_0x1847('0x69')](_0x10ca77,_0x1847('0xb2'));_0x17eb45['verifyAdditionalPhones'](_0x10ca77,'3',_0x38e17f)[_0x1847('0x5b')](function(_0x4d30d8){_0x525069=_0x4d30d8[_0x1847('0x80')]==0x1;if(!_0x525069){if(ut[_0x1847('0x7a')](_0x10ca77)>=_0x38e17f['dialGlobalMaxRetry']){_0x4ef935=ut[_0x1847('0x83')](_0x10ca77,0xf,_0x1847('0x84'));rpcDb[_0x1847('0x85')](_0x4ef935,_0x1847('0xb3'));}else{if(_0x10ca77[_0x1847('0xb4')]>=_0x38e17f[_0x1847('0xb5')]){rpcDb[_0x1847('0x85')](_0x10ca77,_0x1847('0xb2'));}else{rpcDb[_0x1847('0x88')](ut['scheduledAt'](_0x10ca77,_0x1847('0xb4'),_0x38e17f[_0x1847('0xb1')]),_0x10ca77[_0x1847('0xac')],_0x10ca77[_0x1847('0x8a')]);}}}else{_0x10ca77[_0x1847('0xb4')]++;_0x17eb45[_0x1847('0x8e')]({'id':_0x10ca77['idContact'],'field':{'countnoanswerretry':_0x10ca77[_0x1847('0xb4')]}})['then'](function(){_0x17eb45[_0x1847('0xad')](_0x10ca77,_0x27491a,_0x74e673)['then'](function(){});});}});break;case'CONGESTION':_0x38e17f[_0x1847('0xb6')]+=0x1;_0x10ca77[_0x1847('0xb7')]+=0x1;_0x10ca77[_0x1847('0x9b')]=ut[_0x1847('0x7a')](_0x10ca77);ut[_0x1847('0x6b')](_0x10ca77,0x8,_0x1847('0xb8'));_0x27491a=_0x38e17f['dialCongestionRetryFrequency'];_0x74e673=_0x38e17f['callAdditionalPhoneAfterMin'];ami[_0x1847('0x28')](_0x1847('0xb9'),ut['buildObj'](_0x10ca77,'congestion'));rpcDb['createCustomerHistory'](_0x10ca77,_0x1847('0xba'));_0x17eb45[_0x1847('0x7f')](_0x10ca77,'8',_0x38e17f)['then'](function(_0x315593){_0x525069=_0x315593[_0x1847('0x80')]==0x1;if(!_0x525069){if(ut[_0x1847('0x7a')](_0x10ca77)>=_0x38e17f[_0x1847('0xaa')]){_0x4ef935=ut[_0x1847('0x83')](_0x10ca77,0xf,'Global');rpcDb[_0x1847('0x85')](_0x4ef935,_0x1847('0xbb'));}else{if(_0x10ca77['countcongestionretry']>=_0x38e17f[_0x1847('0xbc')]){rpcDb[_0x1847('0x85')](_0x10ca77,_0x1847('0xba'));}else{rpcDb[_0x1847('0x88')](ut[_0x1847('0x89')](_0x10ca77,'countcongestionretry',_0x38e17f['dialBusyRetryFrequency']),_0x10ca77[_0x1847('0xac')],_0x10ca77[_0x1847('0x8a')]);}}}else{_0x10ca77['countcongestionretry']++;_0x17eb45[_0x1847('0x8e')]({'id':_0x10ca77[_0x1847('0x8d')],'field':{'countcongestionretry':_0x10ca77[_0x1847('0xb7')]}})[_0x1847('0x5b')](function(){_0x17eb45['swapAdditionalPhones'](_0x10ca77,_0x27491a,_0x74e673)[_0x1847('0x5b')](function(){});});}});break;case _0x1847('0xbd'):_0x38e17f[_0x1847('0xbe')]+=0x1;_0x10ca77[_0x1847('0xbf')]+=0x1;_0x10ca77[_0x1847('0x9b')]=ut[_0x1847('0x7a')](_0x10ca77);ut[_0x1847('0x6b')](_0x10ca77,0x14,_0x1847('0xc0'));_0x27491a=_0x38e17f[_0x1847('0xc1')];_0x74e673=_0x38e17f[_0x1847('0x82')];ami['emit'](_0x1847('0xc2'),ut[_0x1847('0x7d')](_0x10ca77,_0x1847('0xc3')));rpcDb[_0x1847('0x69')](_0x10ca77,_0x1847('0xc4'));_0x17eb45[_0x1847('0x7f')](_0x10ca77,'20',_0x38e17f)[_0x1847('0x5b')](function(_0x32aa91){_0x525069=_0x32aa91[_0x1847('0x80')]==0x1;if(!_0x525069){if(ut['totalGlobal'](_0x10ca77)>=_0x38e17f['dialGlobalMaxRetry']){_0x4ef935=ut[_0x1847('0x83')](_0x10ca77,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x4ef935,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x10ca77[_0x1847('0xbf')]>=_0x38e17f[_0x1847('0xc5')]){rpcDb['createCustomerFinal'](_0x10ca77,_0x1847('0xc6'));}else{rpcDb[_0x1847('0x88')](ut['scheduledAt'](_0x10ca77,_0x1847('0xbf'),_0x38e17f[_0x1847('0xc1')]),_0x10ca77[_0x1847('0xac')],_0x10ca77[_0x1847('0x8a')]);}}}else{_0x10ca77[_0x1847('0xb4')]++;_0x17eb45[_0x1847('0x8e')]({'id':_0x10ca77[_0x1847('0x8d')],'field':{'countnoanswerretry':_0x10ca77[_0x1847('0xb4')]}})[_0x1847('0x5b')](function(){_0x17eb45[_0x1847('0xad')](_0x10ca77,_0x27491a,_0x74e673)[_0x1847('0x5b')](function(){});});}});break;case'ABANDONED':_0x38e17f[_0x1847('0xc7')]+=0x1;_0x10ca77['countabandonedretry']+=0x1;_0x10ca77[_0x1847('0x9b')]=ut[_0x1847('0x7a')](_0x10ca77);ut[_0x1847('0x6b')](_0x10ca77,0xb,_0x1847('0xc8'));rpcDb[_0x1847('0x69')](_0x10ca77,_0x1847('0xc9'));_0x17eb45[_0x1847('0x7f')](_0x10ca77,'11',_0x38e17f)[_0x1847('0x5b')](function(_0xdf4807){_0x525069=_0xdf4807[_0x1847('0x80')]==0x1;if(!_0x525069){if(ut[_0x1847('0x7a')](_0x10ca77)>=_0x38e17f[_0x1847('0xaa')]){_0x4ef935=ut[_0x1847('0x83')](_0x10ca77,0xf,'Global');rpcDb[_0x1847('0x85')](_0x4ef935,_0x1847('0xc9'));}else{if(_0x10ca77[_0x1847('0xca')]>=_0x38e17f['dialAbandonedMaxRety']){rpcDb[_0x1847('0x85')](_0x10ca77,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x1847('0x88')](ut[_0x1847('0x89')](_0x10ca77,_0x1847('0xcb'),_0x38e17f[_0x1847('0xcc')]),_0x10ca77[_0x1847('0xac')],_0x10ca77[_0x1847('0x8a')]);}}}else{_0x10ca77[_0x1847('0xb4')]++;_0x17eb45[_0x1847('0x8e')]({'id':_0x10ca77[_0x1847('0x8d')],'field':{'countnoanswerretry':_0x10ca77['countnoanswerretry']}})[_0x1847('0x5b')](function(){_0x17eb45[_0x1847('0xad')](_0x10ca77,_0x27491a,_0x74e673)[_0x1847('0x5b')](function(){});});}});break;case'18':_0x38e17f[_0x1847('0xcd')]+=0x1;_0x10ca77['countmachineretry']+=0x1;_0x10ca77[_0x1847('0x9b')]=ut[_0x1847('0x7a')](_0x10ca77);ut['logCustomer'](_0x10ca77,0x12,_0x14ab2b[_0x1847('0xce')]||_0x14ab2b[_0x1847('0xcf')]);ami[_0x1847('0x28')](_0x1847('0xd0'),ut['buildObj'](_0x10ca77,'amd'));rpcDb[_0x1847('0x69')](_0x10ca77,_0x1847('0xd1'));_0x17eb45['verifyAdditionalPhones'](_0x10ca77,'18',_0x38e17f)[_0x1847('0x5b')](function(_0x1d69a0){_0x525069=_0x1d69a0[_0x1847('0x80')]==0x1;if(!_0x525069){if(ut[_0x1847('0x7a')](_0x10ca77)>=_0x38e17f[_0x1847('0xaa')]){_0x4ef935=ut['cloneAction'](_0x10ca77,0x12,_0x1847('0x84'));rpcDb[_0x1847('0x85')](_0x4ef935,_0x1847('0xd1'));}else{rpcDb[_0x1847('0x85')](_0x10ca77,_0x1847('0xd1'));}}else{_0x10ca77[_0x1847('0xb4')]++;_0x17eb45[_0x1847('0x8e')]({'id':_0x10ca77[_0x1847('0x8d')],'field':{'countnoanswerretry':_0x10ca77[_0x1847('0xb4')]}})[_0x1847('0x5b')](function(){_0x17eb45[_0x1847('0xad')](_0x10ca77,_0x27491a,_0x74e673)[_0x1847('0x5b')](function(){});});}});delete this[_0x1847('0x43')][_0x14ab2b['linkedid']];break;case'19':_0x38e17f[_0x1847('0xcd')]+=0x1;_0x10ca77[_0x1847('0x9b')]=ut['totalGlobal'](_0x10ca77);ut[_0x1847('0x6b')](_0x10ca77,0x13,_0x14ab2b[_0x1847('0xce')]||_0x14ab2b[_0x1847('0xcf')]);ami[_0x1847('0x28')](_0x1847('0xd0'),ut['buildObj'](_0x10ca77,_0x1847('0xd2')));rpcDb[_0x1847('0x69')](_0x10ca77,'[callProgressDetectingCustomer][machine]');_0x17eb45['verifyAdditionalPhones'](_0x10ca77,'18',_0x38e17f)['then'](function(_0x4f7e6f){_0x525069=_0x4f7e6f[_0x1847('0x80')]==0x1;if(!_0x525069){if(ut[_0x1847('0x7a')](_0x10ca77)>=_0x38e17f['dialGlobalMaxRetry']){_0x4ef935=ut['cloneAction'](_0x10ca77,0xf,_0x1847('0x84'));rpcDb[_0x1847('0x85')](_0x4ef935,_0x1847('0xd3'));}else{rpcDb[_0x1847('0x85')](_0x10ca77,_0x1847('0xd3'));}}else{_0x10ca77['countnoanswerretry']++;_0x17eb45[_0x1847('0x8e')]({'id':_0x10ca77['idContact'],'field':{'countnoanswerretry':_0x10ca77[_0x1847('0xb4')]}})[_0x1847('0x5b')](function(){_0x17eb45[_0x1847('0xad')](_0x10ca77,_0x27491a,_0x74e673)[_0x1847('0x5b')](function(){});});}});delete this[_0x1847('0x43')][_0x14ab2b[_0x1847('0x8b')]];break;default:if(_0x10ca77[_0x1847('0x48')]){ut[_0x1847('0x54')](_0x38e17f,_0x1847('0xd4'));ut[_0x1847('0x55')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x38e17f[_0x1847('0x26')],_0x14ab2b);}_0x38e17f['outboundUnknownCallsDay']+=0x1;_0x10ca77[_0x1847('0x9b')]=ut[_0x1847('0x7a')](_0x10ca77);ut[_0x1847('0x6b')](_0x10ca77,0xc,_0x14ab2b[_0x1847('0xce')]||_0x14ab2b[_0x1847('0xcf')]);_0x27491a=_0x38e17f[_0x1847('0xc1')];_0x74e673=_0x38e17f[_0x1847('0x82')];rpcDb[_0x1847('0x69')](_0x10ca77,'[callProgressDetectingCustomer][logUnknown]');_0x17eb45[_0x1847('0x7f')](_0x10ca77,'20',_0x38e17f)[_0x1847('0x5b')](function(_0x2538d8){_0x525069=_0x2538d8['additional']==0x1;if(!_0x525069){if(ut[_0x1847('0x7a')](_0x10ca77)>=_0x38e17f['dialGlobalMaxRetry']){_0x4ef935=ut['cloneAction'](_0x10ca77,0xf,'Global');rpcDb[_0x1847('0x85')](_0x4ef935,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x1847('0x85')](_0x10ca77,_0x1847('0xd5'));}delete this['actions'][_0x14ab2b[_0x1847('0x8b')]];}else{_0x17eb45[_0x1847('0xad')](_0x10ca77,_0x27491a,_0x74e673)[_0x1847('0x5b')](function(){});}});}if(!(_0x10ca77[_0x1847('0x48')]&&_0xedd2db==='16')){ut['updateOriginated'](_0x38e17f,'[callProgressDetectingCustomer]');logger[_0x1847('0x23')](_0x1847('0xd6'),_0x10ca77[_0x1847('0x91')],_0x1847('0xa2'),_0x38e17f[_0x1847('0x26')],_0x1847('0xd7'),_0x38e17f['originated']);}if(_0xedd2db!==_0x1847('0xd8')){delete this[_0x1847('0x43')][_0x14ab2b[_0x1847('0x8b')]];delete this[_0x1847('0x43')][_0x14ab2b[_0x1847('0xd9')]];}_0x38e17f[_0x1847('0xda')]=!![];}};Preview[_0x1847('0x34')][_0x1847('0xdb')]=function(_0x256479,_0x441a22,_0x56e1f4){if(_['isUndefined'](_0x441a22)&&_0x1847('0xdc')!==typeof _0x441a22){return;}if(_[_0x1847('0xdd')](_0x56e1f4)&&_0x1847('0xdc')!==typeof _0x56e1f4){return;}switch(_0x56e1f4[_0x1847('0xde')]){case'0':ut[_0x1847('0xdf')](_0x256479,0x0,_0x1847('0x7b'));rpcDb['createAgentHistory'](_0x256479,_0x1847('0xe0'));break;case'3':ut[_0x1847('0xdf')](_0x256479,0x3,'NoAnswer');rpcDb[_0x1847('0xe1')](_0x256479,_0x1847('0xe2'));break;case'5':ut['logAgent'](_0x256479,0x5,_0x1847('0xa5'));rpcDb[_0x1847('0xe1')](_0x256479,_0x1847('0xe3'));break;case'8':ut['logAgent'](_0x256479,0x8,'Congestion');rpcDb[_0x1847('0xe1')](_0x256479,_0x1847('0xe4'));break;case'22':ut[_0x1847('0xdf')](_0x256479,0x16,_0x1847('0xe5'));rpcDb[_0x1847('0xe1')](_0x256479,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x1847('0xdf')](_0x256479,0xc,_0x56e1f4[_0x1847('0xde')]);rpcDb[_0x1847('0xe1')](_0x256479,_0x1847('0xe4'));}ut[_0x1847('0xe6')](_0x441a22,_0x1847('0xe7'));logger['info'](_0x1847('0xe8'),_0x256479[_0x1847('0x91')],_0x1847('0xa2'),_0x441a22[_0x1847('0x26')],'originated:\x20',_0x441a22[_0x1847('0x2a')]);delete this['actions'][_0x256479['uniqueid']];};Preview[_0x1847('0x34')][_0x1847('0x7f')]=function(_0x30fe8d,_0x46e622,_0x1f7b6a){return cmHopperAdditionalPhone[_0x1847('0x7f')](_0x30fe8d,_0x46e622,_0x1f7b6a)[_0x1847('0x51')](logger[_0x1847('0x23')](_0x1847('0xe9')));};Preview['prototype'][_0x1847('0xad')]=function(_0x5baa29,_0x26af7d,_0x2f3d6e){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x5baa29,_0x26af7d,_0x2f3d6e)[_0x1847('0x51')](logger[_0x1847('0x23')](_0x1847('0xea')));};Preview['prototype'][_0x1847('0x8e')]=function(_0x7a944e){return Promise[_0x1847('0xeb')]()['then'](cmHopperAdditionalPhone[_0x1847('0x8e')](_0x7a944e))[_0x1847('0x51')](logger[_0x1847('0x23')](_0x1847('0xec')));};Preview[_0x1847('0x34')][_0x1847('0xed')]=function(_0x55cc92,_0x219934,_0xa96dc,_0x2c80cf,_0x28d2ea){var _0x4dc16d=this;return new Promise(function(_0x45b8ab,_0x337ed6){if(_[_0x1847('0x42')](_0x219934)||_['isNil'](_0x219934[_0x1847('0xee')])||_[_0x1847('0x42')](_0x219934[_0x1847('0xef')])||_[_0x1847('0x42')](_0x219934[_0x1847('0x4c')])){_0x337ed6(ut['message'](_0x1847('0xf0'),_0x2c80cf,_0x28d2ea));return;}var _0xda4547=uuid['v4']();var _0x1f5d04=_0x4dc16d['campaignsPreview'][_0x219934[_0x1847('0x45')][_0x1847('0x26')]];var _0x4089db=_0xa96dc?_0x4dc16d[_0x1847('0x12')][_0xa96dc]['id']:undefined;_0x4dc16d[_0x1847('0x43')][_0xda4547]=new Action(_0x219934,_0x1f5d04,_0xda4547,_0xa96dc,_0x4089db);var _0x5c3304=_0x4dc16d[_0x1847('0x43')][_0xda4547];_0x5c3304['unlockAgent']=_0x2c80cf;_0x5c3304['activeContact']=_0x28d2ea;_0x5c3304[_0x1847('0xf1')]=_0xa96dc;if(_[_0x1847('0xf2')](_0x55cc92)){_0x4dc16d[_0x1847('0xf3')](_0x5c3304,_0x1f5d04,_0x219934,_0xa96dc)[_0x1847('0x5b')](function(_0x1d8ef5){logger['info'](_0x1847('0xf4'),_0x1847('0xf5')+_0x5c3304[_0x1847('0x47')]+_0x1847('0xf6')+_0x5c3304[_0x1847('0x8d')],JSON[_0x1847('0x24')](_0x1d8ef5));ami[_0x1847('0x28')]('custom:agentcalled',ut[_0x1847('0x7d')](_0x5c3304,_0x1847('0xf7'),_0x4dc16d[_0x1847('0x22')][_0x5c3304[_0x1847('0x47')]]));_0x45b8ab(ut[_0x1847('0x2e')](_0x1847('0xf8')));})[_0x1847('0x51')](function(_0xaed1bc){ut['logger']('[Preview][execCall][failure]',_0xaed1bc);_0x337ed6(ut[_0x1847('0x2e')](_0x1847('0xf9'),_0x2c80cf,_0x28d2ea));});}else{_0x1f5d04[_0x1847('0xfa')]+=0x1;ut['logBlacklist'](_0x5c3304);rpcDb[_0x1847('0xfb')](_0x5c3304,_0x1847('0xfc'));delete _0x4dc16d['actions'][_0xda4547];_0x337ed6(ut[_0x1847('0x2e')]('Contact\x20in\x20black\x20List',_0x2c80cf,_0x28d2ea));}});};Preview[_0x1847('0x34')][_0x1847('0xfd')]=function(_0x4e9311){return!_[_0x1847('0x42')](_0x4e9311)&&!_['isNil'](_0x4e9311['name'])&&!_['isNil'](_0x4e9311[_0x1847('0xfe')])&&_0x4e9311[_0x1847('0xfe')]&&!_[_0x1847('0x42')](this[_0x1847('0x11')][util[_0x1847('0x25')]('SIP/%s',_0x4e9311[_0x1847('0x26')])])&&!_[_0x1847('0x42')](this[_0x1847('0x11')][util[_0x1847('0x25')](_0x1847('0xff'),_0x4e9311['name'])][_0x1847('0x4f')])&&(this[_0x1847('0x11')][util[_0x1847('0x25')](_0x1847('0xff'),_0x4e9311[_0x1847('0x26')])][_0x1847('0x4f')]==='reachable'||this[_0x1847('0x11')][util[_0x1847('0x25')]('SIP/%s',_0x4e9311['name'])][_0x1847('0x4f')]===_0x1847('0x100'));};Preview[_0x1847('0x34')][_0x1847('0x61')]=function(_0x257d4f,_0x5d73a7){return this['execRun'](_0x257d4f,_0x5d73a7)[_0x1847('0x5b')](function(_0xbf8649){return _['pick'](_0xbf8649,[_0x1847('0x2e')]);})[_0x1847('0x51')](function(_0xd10b64){if(_0xd10b64[_0x1847('0x101')]){rpcDb['unlockContact'](_0x257d4f);}if(_0xd10b64['active']){rpcDb[_0x1847('0x102')](_0x257d4f);}throw _['pick'](_0xd10b64,[_0x1847('0x2e')]);});};Preview[_0x1847('0x34')][_0x1847('0x103')]=function(_0x590abc,_0x33fa17){var _0x46a009=this;var _0x23bcb8,_0x490129;return rpcDb[_0x1847('0x104')](_0x590abc)[_0x1847('0x5b')](function(_0x48fdac){if(!_['isNil'](_0x48fdac[0x0])){_0x490129=_0x48fdac[0x0]['recallme']?![]:!![];_0x23bcb8=_0x48fdac[0x0][_0x1847('0x105')]?!![]:![];_0x23bcb8=_0x33fa17?!![]:_0x23bcb8;}var _0x19fe75=_0x46a009[_0x1847('0x106')](_0x48fdac);if(_0x19fe75['isValid']){rpcDb[_0x1847('0x107')](_['pick'](_0x48fdac[0x0],[_0x1847('0x4c'),'phone']))['then'](function(_0x3c8d51){_0x46a009[_0x1847('0xed')](_0x3c8d51,_0x48fdac[0x0],_0x33fa17,_0x490129,_0x23bcb8)['then'](function(_0x3ac66e){return _0x3ac66e;})[_0x1847('0x51')](function(_0x44cbe9){throw _0x44cbe9;});})[_0x1847('0x51')](function(_0x164e3b){ut[_0x1847('0x32')](_0x1847('0x108'),_0x164e3b);throw ut[_0x1847('0x2e')]('Call\x20unsuccessful',_0x490129,_0x23bcb8);});}else{throw ut[_0x1847('0x2e')](_0x19fe75[_0x1847('0x2e')],_0x490129,_0x23bcb8);}})[_0x1847('0x51')](function(_0x160bea){ut[_0x1847('0x32')](_0x1847('0x109'),_0x160bea);throw ut[_0x1847('0x2e')](_0x1847('0x10a'),![],!![]);});};Preview[_0x1847('0x34')][_0x1847('0x106')]=function(_0x5cddd2){if(_['isNil'](_0x5cddd2)||_[_0x1847('0xf2')](_0x5cddd2)||!_[_0x1847('0x42')](_0x5cddd2[0x0][_0x1847('0x5f')])&&_['isNil'](_0x5cddd2[0x0][_0x1847('0x5f')][_0x1847('0x26')])){ut['logger'](_0x1847('0x10b'),_0x5cddd2);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x13f5e3=this['campaignsPreview'][_0x5cddd2[0x0][_0x1847('0x45')][_0x1847('0x26')]];_0x13f5e3[_0x1847('0x2e')]=utils['CAMPAIGN_STATUS'][_0x1847('0x76')];if(_[_0x1847('0x42')](_0x13f5e3)){ut[_0x1847('0x32')](_0x1847('0x10c'),_0x13f5e3);return{'isValid':![],'message':_0x1847('0x10d')};}if(!this['isTrunkReachable'](_0x13f5e3[_0x1847('0x74')])){ut[_0x1847('0x32')](_0x1847('0x10e'),'campaign\x20Name:\x20'+_0x13f5e3['name']+_0x1847('0x10f'));if(!this[_0x1847('0xfd')](_0x13f5e3['TrunkBackup'])){ut['logger'](_0x1847('0x10e'),_0x13f5e3[_0x1847('0x26')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x1847('0x110')};}}if(!ut[_0x1847('0x73')](_0x13f5e3[_0x1847('0x3c')])){ut[_0x1847('0x32')](_0x1847('0x111'),_0x13f5e3[_0x1847('0x26')]+_0x1847('0x112'));return{'isValid':![],'message':_0x1847('0x113')+_0x13f5e3[_0x1847('0x26')]+_0x1847('0x112')};}return{'isValid':!![],'message':_0x1847('0x114')};};Preview[_0x1847('0x34')]['execCall']=function(_0xad2275,_0x4f7b96,_0x10d150,_0x155262){var _0x50934e=this;return new Promise(function(_0x328caf,_0x41b836){var _0x570a8d=_0xad2275[_0x1847('0x91')];var _0x5b9c0d=_0x50934e[_0x1847('0xfd')](_0x4f7b96[_0x1847('0x74')])?util[_0x1847('0x25')](_0x1847('0x115'),_0x4f7b96[_0x1847('0x74')]['name'],_[_0x1847('0x42')](_0x4f7b96['dialPrefix'])?'':_0x4f7b96[_0x1847('0x116')][_0x1847('0x117')]()||'',_0x4f7b96[_0x1847('0x118')]>0x0?_0x10d150[_0x1847('0xef')][_0x1847('0x119')](_0x4f7b96[_0x1847('0x118')]):_0x10d150[_0x1847('0xef')]):util[_0x1847('0x25')](_0x1847('0x115'),_[_0x1847('0x42')](_0x4f7b96[_0x1847('0x75')])?_0x4f7b96[_0x1847('0x74')][_0x1847('0x26')]:_0x4f7b96['TrunkBackup'][_0x1847('0x26')],_[_0x1847('0x42')](_0x4f7b96[_0x1847('0x116')])?'':_0x4f7b96[_0x1847('0x116')][_0x1847('0x117')]()||'',_0x4f7b96[_0x1847('0x118')]>0x0?_0x10d150['phone']['substring'](_0x4f7b96[_0x1847('0x118')]):_0x10d150[_0x1847('0xef')]);var _0x1e4a0a=_0x50934e['isTrunkReachable'](_0x4f7b96['Trunk'])?ut[_0x1847('0x11a')](_0x4f7b96[_0x1847('0x74')][_0x1847('0x11b')],_0x4f7b96[_0x1847('0x11c')],_0x4f7b96['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x1847('0x11d')](_0x4f7b96[_0x1847('0x11e')],_0x4f7b96['dialRandomLastDigitCallerIdNumber']):_0x4f7b96[_0x1847('0x11e')]):ut[_0x1847('0x11a')](_[_0x1847('0x42')](_0x4f7b96[_0x1847('0x75')])?_0x4f7b96[_0x1847('0x74')][_0x1847('0x11b')]:_0x4f7b96['TrunkBackup']['callerid'],_0x4f7b96[_0x1847('0x11c')],_0x4f7b96['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x4f7b96[_0x1847('0x11e')],_0x4f7b96[_0x1847('0x11f')]):_0x4f7b96[_0x1847('0x11e')]);if(_0x1e4a0a){_0xad2275['originatecalleridname']=ut[_0x1847('0x120')](_0x1e4a0a);_0xad2275[_0x1847('0x121')]=ut[_0x1847('0x122')](_0x1e4a0a);}var _0x8a0fb8=ut[_0x1847('0x123')](_0x4f7b96,_0x10d150,_0x5b9c0d,_0x1e4a0a,_0x570a8d,_0xad2275);var _0x5f4111=utils[_0x1847('0x124')](_0x10d150['Contact']);Object[_0x1847('0x125')](_0x8a0fb8,_0x5f4111);_['merge'](_0xad2275,ut[_0x1847('0x126')](_0x8a0fb8));_0xad2275[_0x1847('0x63')]=moment()['format'](_0x1847('0x64'));_0x4f7b96['variables']=_0x8a0fb8;var _0x2c37e3=ut['variablesAction'](_0xad2275,_0x4f7b96,_0x8a0fb8,_0xad2275[_0x1847('0x8a')],_0x155262);return ami['Action'](_0x2c37e3)[_0x1847('0x5b')](function(_0x2d3360){_0x4f7b96[_0x1847('0x2a')]+=0x1;logger[_0x1847('0x23')](_0x1847('0x127'),_0x570a8d,_0x1847('0xa2'),_0x4f7b96[_0x1847('0x26')],_0x1847('0xd7'),_0x4f7b96[_0x1847('0x2a')]);_0x328caf(_0x2d3360);})[_0x1847('0x51')](function(_0xc37d5d){ut['logAgent'](_0xad2275,0xe,_0x1847('0x128'));rpcDb[_0x1847('0xe1')](_0xad2275,_0x1847('0x129'));_0x41b836(_0xc37d5d);});});};Preview[_0x1847('0x34')][_0x1847('0x1b')]=function(_0x55e64d){if(this[_0x1847('0x43')][_0x55e64d[_0x1847('0x8b')]]){this[_0x1847('0x43')][_0x55e64d[_0x1847('0x8b')]][_0x1847('0x50')]=_0x55e64d[_0x1847('0x50')];}};Preview[_0x1847('0x34')]['syncOriginateResponse']=function(_0x52bc8e){var _0x25711f=this;var _0x52050b=this[_0x1847('0x43')][_0x52bc8e[_0x1847('0x12a')]];if(_0x52050b){if(_0x52050b[_0x1847('0xf1')]&&this['agents'][_0x52050b[_0x1847('0xf1')]]){ut[_0x1847('0x12b')](_0x52050b,this[_0x1847('0x12')][_0x52050b[_0x1847('0xf1')]][_0x1847('0x26')],this[_0x1847('0x12')][_0x52050b['lookAgent']]['id']);}var _0x5efd58=_[_0x1847('0x12c')](_0x52050b);_0x5efd58['responsetime']=moment()[_0x1847('0x25')](_0x1847('0x64'));var _0x57794f=_0x25711f[_0x1847('0x22')][_0x52050b[_0x1847('0x47')]];if(ut['isFailure'](_0x52bc8e['response'])){if(_0x52050b[_0x1847('0xac')]){rpcDb['unlockContact'](_0x52050b[_0x1847('0x8d')]);}if(_0x52050b['activeContact']){rpcDb[_0x1847('0x102')](_0x52050b['idContact']);}ami[_0x1847('0x28')](_0x1847('0x12d'),ut['buildObj'](_0x52050b,_0x1847('0x12e'),this['campaignsPreview'][_0x52050b[_0x1847('0x47')]]));this['callProgressDetectingAgent'](_0x5efd58,_0x57794f,_0x52bc8e);}else{_0x52050b[_0x1847('0x63')]=moment()[_0x1847('0x25')](_0x1847('0x64'));ut[_0x1847('0xdf')](_0x5efd58,0x4,'Answer');rpcDb['createAgentHistory'](_0x5efd58,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x1847('0x34')]['syncHangup']=function(_0x49fa07){var _0x527889=this[_0x1847('0x43')][_0x49fa07[_0x1847('0x8b')]];var _0x4d5f55;if(_0x527889){_0x4d5f55=this['campaignsPreview'][_0x527889['queue']];logger['info'](_0x1847('0x12f'),_0x49fa07[_0x1847('0x8b')],_0x1847('0xa2'),_0x4d5f55[_0x1847('0x26')],_0x1847('0x46'),_0x4d5f55[_0x1847('0x2b')]);}if(this[_0x1847('0x43')][_0x49fa07[_0x1847('0x8b')]]&&_0x49fa07[_0x1847('0x8b')]!==_0x49fa07[_0x1847('0x91')]){if(_0x49fa07['cause']==='16'&&this[_0x1847('0x43')][_0x49fa07[_0x1847('0x8b')]]['dialAnswer']){this['callProgressDetectingCustomer'](_0x49fa07,_0x49fa07[_0x1847('0x8b')],_0x49fa07[_0x1847('0x130')]);}else if(this['actions'][_0x49fa07[_0x1847('0x8b')]][_0x1847('0x48')]){logger[_0x1847('0x23')](_0x1847('0x131'),_0x49fa07['linkedid'],_0x49fa07[_0x1847('0x130')],_0x1847('0xa2'),_0x4d5f55[_0x1847('0x26')],'pTalking:\x20',_0x4d5f55[_0x1847('0x2b')]);this['callProgressDetectingCustomer'](_0x49fa07,_0x49fa07[_0x1847('0x8b')],_0x49fa07[_0x1847('0x130')]);}}else if(_0x527889&&_['isNil'](_0x527889[_0x1847('0x132')])&&_0x4d5f55[_0x1847('0x133')]&&_0x49fa07[_0x1847('0x8b')]===_0x49fa07[_0x1847('0x91')]&&_[_0x1847('0x42')](_0x49fa07[_0x1847('0xde')])&&_0x49fa07[_0x1847('0x130')]==='16'&&_0x49fa07[_0x1847('0x134')]==='6'&&_[_0x1847('0xdd')](_0x527889[_0x1847('0x135')])){if(_0x527889['unlockAgent']){rpcDb[_0x1847('0x136')](_0x527889[_0x1847('0x8d')]);}if(_0x527889[_0x1847('0x8a')]){rpcDb[_0x1847('0x102')](_0x527889[_0x1847('0x8d')]);}_0x49fa07[_0x1847('0xde')]='22';this[_0x1847('0xdb')](_0x527889,_0x4d5f55,_0x49fa07);}else if(_0x527889&&_0x527889[_0x1847('0x135')]){if(_0x49fa07[_0x1847('0x130')]==='16'&&this[_0x1847('0x43')][_0x49fa07['linkedid']][_0x1847('0x48')]){logger['info']('[syncHangup][talking][transfer]',_0x49fa07[_0x1847('0x8b')],_0x49fa07[_0x1847('0x130')],'\x20Queue',_0x4d5f55[_0x1847('0x26')],_0x1847('0x46'),_0x4d5f55[_0x1847('0x2b')]);this[_0x1847('0x77')](_0x49fa07,_0x49fa07[_0x1847('0x8b')],_0x49fa07[_0x1847('0x130')]);}else if(this['actions'][_0x49fa07[_0x1847('0x8b')]][_0x1847('0x48')]){logger[_0x1847('0x23')]('[syncHangup][talking][cause]',_0x49fa07[_0x1847('0x8b')],_0x49fa07['cause'],_0x1847('0xa2'),_0x4d5f55['name'],_0x1847('0x46'),_0x4d5f55[_0x1847('0x2b')]);this[_0x1847('0x77')](_0x49fa07,_0x49fa07[_0x1847('0x8b')],_0x49fa07[_0x1847('0x130')]);}}};Preview[_0x1847('0x34')]['syncDialEnd']=function(_0x5e5e6c){if(this[_0x1847('0x43')][_0x5e5e6c[_0x1847('0xd9')]]&&_0x5e5e6c[_0x1847('0xd9')]!==_0x5e5e6c['destuniqueid']){this['callProgressDetectingCustomer'](_0x5e5e6c,_0x5e5e6c[_0x1847('0xd9')],_0x5e5e6c[_0x1847('0xcf')]);}};Preview[_0x1847('0x34')]['syncHangupRequest']=function(_0x40df7b){if(this[_0x1847('0x43')][_0x40df7b[_0x1847('0x8b')]]&&_0x40df7b['linkedid']!==_0x40df7b[_0x1847('0x91')]&&!this[_0x1847('0x43')][_0x40df7b[_0x1847('0x8b')]][_0x1847('0x48')]){if(_0x40df7b['cause']==='1'){this[_0x1847('0x77')](_0x40df7b,_0x40df7b[_0x1847('0x8b')],_0x40df7b[_0x1847('0x130')]);}}};Preview[_0x1847('0x34')][_0x1847('0x137')]=function(_0x1bd103,_0x4ac2cc,_0x23266b){if(this['actions'][_0x1bd103]){if(_[_0x1847('0x42')](this[_0x1847('0x43')][_0x1bd103][_0x1847('0x138')])){this[_0x1847('0x43')][_0x1bd103]['variables']={};}this[_0x1847('0x43')][_0x1bd103][_0x1847('0x138')][_0x4ac2cc]=_0x23266b;}};Preview[_0x1847('0x34')][_0x1847('0x139')]=function(_0x2c8dd5){try{if(!_[_0x1847('0x42')](_0x2c8dd5)){if(ut[_0x1847('0x13a')](_[_0x1847('0x13b')](_0x2c8dd5[_0x1847('0x13c')])[0x0])){this['addVariable'](_0x2c8dd5[_0x1847('0x91')],_[_0x1847('0x13b')](_0x2c8dd5[_0x1847('0x13c')])[0x0],_0x2c8dd5[_0x1847('0x13d')]);}}}catch(_0x6ebc8a){logger[_0x1847('0x13e')](_0x1847('0x13f'),util['inspect'](_0x6ebc8a,{'showHidden':![],'depth':null}));}};Preview[_0x1847('0x34')][_0x1847('0x1e')]=function(_0x51fcf0){if(_0x51fcf0){if(this['actions'][_0x51fcf0[_0x1847('0x140')]]){this[_0x1847('0x43')][_0x51fcf0['transfertargetlinkedid']][_0x1847('0x135')]=!![];}}};Preview[_0x1847('0x34')][_0x1847('0x20')]=function(_0x50140d){if(_0x50140d){if(this[_0x1847('0x43')][_0x50140d[_0x1847('0x141')]]){this['actions'][_0x50140d[_0x1847('0x141')]][_0x1847('0x135')]=!![];}}};module[_0x1847('0x142')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 1dc53db..09d10f0 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 _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 +var _0x6920=['uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','../../../config/logger','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','[createHistory]\x20','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','resolve','then','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x6920,0x1c7));var _0x0692=function(_0x1e2080,_0x53283b){_0x1e2080=_0x1e2080-0x0;var _0x260111=_0x6920[_0x1e2080];return _0x260111;};'use strict';var util=require(_0x0692('0x0'));var BPromise=require('bluebird');var logger=require(_0x0692('0x1'))('preview');var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x0692('0x2'));var cmHopperBlack=require(_0x0692('0x3'));var agentReportPreview=require(_0x0692('0x4'));var voiceQueueReport=require(_0x0692('0x5'));function loggerCatch(_0x25ac5a){return function(_0x44f17d){logger[_0x0692('0x6')](_0x25ac5a,util[_0x0692('0x7')](_0x44f17d,{'showHidden':![],'depth':null}));};}function create(_0x46f0cf){return cmHopperHistory[_0x0692('0x8')](_0x46f0cf)['catch'](loggerCatch(_0x0692('0x9')));}function createAgent(_0x51ffd6){return BPromise['resolve']()['then'](agentReportPreview['createHistory'](_0x51ffd6))[_0x0692('0xa')](loggerCatch(_0x0692('0x9')));}function moveContact(_0x4b3201){return cmHopper[_0x0692('0xb')](_0x4b3201,!![])[_0x0692('0xa')](loggerCatch(_0x0692('0xc')));}exports[_0x0692('0xd')]=function(_0x3e85ba){return cmHopperBlack[_0x0692('0xd')](_0x3e85ba)[_0x0692('0xa')](loggerCatch(_0x0692('0xe')));};exports[_0x0692('0xf')]=function(_0x2768d4){return BPromise[_0x0692('0x10')]()[_0x0692('0x11')](cmHopper[_0x0692('0xf')](_0x2768d4))[_0x0692('0xa')](loggerCatch(_0x0692('0x12')));};exports[_0x0692('0x8')]=function(_0x4de618,_0x4ade18){create(_0x4de618)[_0x0692('0xa')](loggerCatch(_0x4ade18));moveContact(_0x4de618)[_0x0692('0xa')](loggerCatch(_0x4ade18));};exports[_0x0692('0x13')]=function(_0x4f08fd,_0x39bb4e){createAgent(_0x4f08fd)[_0x0692('0xa')](loggerCatch(_0x39bb4e));};exports[_0x0692('0x14')]=function(_0x510829,_0x2463ef){create(_0x510829)[_0x0692('0xa')](loggerCatch(_0x2463ef));};exports[_0x0692('0x15')]=function(_0x36b533,_0x28db6f){moveContact(_0x36b533)[_0x0692('0xa')](loggerCatch(_0x28db6f));};exports['rescheduleContact']=function(_0x3c4eb5,_0x1c7acd,_0x2b29d1){if(_0x1c7acd){_0x3c4eb5['UserId']=null;}if(_0x2b29d1){_0x3c4eb5['active']=![];}return cmHopper[_0x0692('0x16')](_0x3c4eb5)[_0x0692('0xa')](loggerCatch(_0x0692('0x17')));};exports[_0x0692('0x18')]=function(_0x247a2d){return cmHopper['countReScheduled'](_0x247a2d)[_0x0692('0xa')](loggerCatch('[countReScheduled]\x20'));};exports[_0x0692('0x19')]=function(_0x238c66){return cmHopper['unlockContact']({'UserId':null},_0x238c66,0x1)[_0x0692('0xa')](loggerCatch(_0x0692('0x1a')));};exports[_0x0692('0x1b')]=function(_0x53d3ff){return cmHopper[_0x0692('0x19')]({'active':![]},_0x53d3ff,0x1)[_0x0692('0xa')](loggerCatch(_0x0692('0x1c')));};exports[_0x0692('0x1d')]=function(_0x397ca1){var _0x44ab81={};_0x44ab81[_0x0692('0x1e')]=_0x397ca1['type'];_0x44ab81[_0x0692('0x1f')]=_0x397ca1[_0x0692('0x1f')];_0x44ab81['calleridnum']=_0x397ca1[_0x0692('0x20')];_0x44ab81[_0x0692('0x21')]=_0x397ca1[_0x0692('0x21')];_0x44ab81[_0x0692('0x22')]=_0x397ca1[_0x0692('0x22')];_0x44ab81[_0x0692('0x23')]=_0x397ca1[_0x0692('0x24')];_0x44ab81['queuecallerleaveAt']=_0x397ca1[_0x0692('0x24')];_0x44ab81[_0x0692('0x25')]=0x1;_0x44ab81[_0x0692('0x26')]=_0x397ca1[_0x0692('0x27')];_0x44ab81[_0x0692('0x28')]=_0x397ca1[_0x0692('0x29')];_0x44ab81[_0x0692('0x2a')]=_0x0692('0x2b');_0x44ab81[_0x0692('0x2c')]=_0x0692('0x2d');_0x44ab81['holdtime']=0x0;_0x44ab81[_0x0692('0x2e')]=0x1;_0x44ab81[_0x0692('0x2f')]=_0x397ca1[_0x0692('0x29')];_0x44ab81[_0x0692('0x30')]=_0x0692('0x31');return BPromise[_0x0692('0x10')]()['then'](voiceQueueReport[_0x0692('0x32')](_0x44ab81))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x0692('0x33')]=function(_0x343e59,_0x529cb2){return BPromise[_0x0692('0x10')]()[_0x0692('0x11')](cmHopper['getContactRecallMe'](_0x343e59,_0x529cb2))['catch'](loggerCatch(_0x0692('0x34')));};exports[_0x0692('0x35')]=function(_0x5c6896){return cmHopper[_0x0692('0x16')](_0x5c6896,!![],!![])['catch'](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index dc65bdd..2cd4b1f 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 _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 +var _0xdf19=['ContactId','ListId','VoiceQueueId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','queue','interface','channelAgent','voice','buildObj','buildAcw','uniqueid','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','diff','seconds','createBody','filterKey','idContact','type','campaigntype','dialAnswer','countglobal','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','noanswer','variables','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','preview','XCALLY_IP_AGI','loggerCatch','error','inspect','info','loggerError','logger2','message','getCallerId','string','isEmpty','isUndefined','isNil','addVariables','name','format','\x22%s\x22\x20<%s>','calleridname','calleridnum','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','endtime','logAgent','state','responsetime','logLookAgent','membername','UserId','logCustomer','answertime','getSeconds','isFailure','Failure','RECALL','xcally-motion-preview','from-sip','timeout','countbusyretry','countcongestionretry','countnoanswerretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add'];(function(_0x566051,_0x1ccdaa){var _0x54b3cb=function(_0x2dadff){while(--_0x2dadff){_0x566051['push'](_0x566051['shift']());}};_0x54b3cb(++_0x1ccdaa);}(_0xdf19,0x151));var _0x9df1=function(_0x1dd8f6,_0x3ea487){_0x1dd8f6=_0x1dd8f6-0x0;var _0xf083b7=_0xdf19[_0x1dd8f6];return _0xf083b7;};'use strict';var util=require(_0x9df1('0x0'));var _=require(_0x9df1('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x9df1('0x2'));var ipAgi=process['env'][_0x9df1('0x3')]||'127.0.0.1';var utils=require('../../dialer/utils');exports[_0x9df1('0x4')]=function(_0x3f1f86){return function(_0x4b10f5){logger[_0x9df1('0x5')](_0x3f1f86,util[_0x9df1('0x6')](_0x4b10f5,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x42fb07,_0xd392c5){logger[_0x9df1('0x7')](_0x42fb07,util[_0x9df1('0x6')](_0xd392c5,{'showHidden':![],'depth':null}));};exports[_0x9df1('0x8')]=function(_0x1de9a6,_0x167817){logger[_0x9df1('0x5')](_0x1de9a6,util[_0x9df1('0x6')](_0x167817,{'showHidden':![],'depth':null}));};exports[_0x9df1('0x9')]=function(_0xd93a82){return function(_0x17647a){logger[_0x9df1('0x7')](_0xd93a82,util['inspect'](_0x17647a,{'showHidden':![],'depth':null}));};};exports[_0x9df1('0xa')]=function(_0x5f28f3,_0xcf6722,_0x2ca911){return{'message':_0x5f28f3,'unlock':_0xcf6722,'active':_0x2ca911};};exports[_0x9df1('0xb')]=function(_0x99082e,_0x391017,_0x35c9f2){if(!_['isUndefined'](_0x35c9f2)&&_0x9df1('0xc')===typeof _0x35c9f2&&!_[_0x9df1('0xd')](_0x35c9f2)){if(!_[_0x9df1('0xe')](_0x391017)&&'string'===typeof _0x391017&&!_[_0x9df1('0xd')](_0x391017)){return util['format']('\x22%s\x22\x20<%s>',_0x391017,_0x35c9f2);}return util['format']('\x22%s\x22\x20<%s>',_0x35c9f2,_0x35c9f2);}if(!_[_0x9df1('0xe')](_0x99082e)&&_0x9df1('0xc')===typeof _0x99082e&&!_[_0x9df1('0xd')](_0x99082e)){return _0x99082e;}return'\x22\x22\x20<>';};exports['isActive']=function(_0x3463bf){if(_[_0x9df1('0xf')](_0x3463bf)){return![];}return _0x3463bf;};exports[_0x9df1('0x10')]=function(_0x28ecac,_0x557eff,_0xcbbfa3,_0x61e441,_0x1a978c,_0x2f95bb){var _0x4fc9e0={'XMD-QUEUE':_0x557eff['Queue']?_0x557eff['Queue'][_0x9df1('0x11')]:'','XMD-CALLERID':_0x61e441,'XMD-CALLERID-PREVIEW':_0x2f95bb?util[_0x9df1('0x12')](_0x9df1('0x13'),_0x2f95bb[_0x9df1('0x14')],_0x2f95bb[_0x9df1('0x15')]):_0x61e441,'XMD-DIALID':_0x1a978c,'XMD-CONTACTID':_0x557eff['ContactId'],'XMD-CDRTYPE':_0x9df1('0x16'),'CALLERID(all)':_0x61e441,'XMD-VOICEQUEUEID':_0x557eff['VoiceQueueId'],'XMD-DIALCHANNEL':_0xcbbfa3,'XMD-DIALTIMEOUT':_0x28ecac[_0x9df1('0x17')]||0x1e,'XMD-DIALOPTIONS':util[_0x9df1('0x12')](_0x9df1('0x18'),_0x28ecac[_0x9df1('0x19')]?'g':'',_['isEmpty'](_0x28ecac[_0x9df1('0x1a')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x28ecac[_0x9df1('0x1b')]||'','XMD-AGI':_0x28ecac['dialQueueProject']?util[_0x9df1('0x12')]('\x22agi://%s/square,%s\x22',ipAgi,_0x28ecac[_0x9df1('0x1c')]):_0x9df1('0x1d'),'XMD-AGIAFTER':_0x28ecac['dialQueueProject2']?util[_0x9df1('0x12')](_0x9df1('0x1e'),ipAgi,_0x28ecac[_0x9df1('0x19')]):_0x9df1('0x1d'),'XMD-ORIGINATECALLERIDNUM':_0x2f95bb?_0x2f95bb[_0x9df1('0x1f')]:'','XMD-ORIGINATECALLERIDNAME':_0x2f95bb?_0x2f95bb[_0x9df1('0x20')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x9df1('0x21')};if(!_[_0x9df1('0xd')](_0x28ecac[_0x9df1('0x1a')])){_0x4fc9e0[util['format']('%s',_0x9df1('0x22'))]=_0x28ecac[_0x9df1('0x1a')];_0x4fc9e0[util[_0x9df1('0x12')]('%s',_0x9df1('0x23'))]=_0x1a978c;}return _0x4fc9e0;};exports[_0x9df1('0x24')]=function(_0x38ff55){var _0x5d9976={};for(var _0x1eff4a in _0x38ff55){if(_0x38ff55[_0x9df1('0x25')](_0x1eff4a)){_0x5d9976[util[_0x9df1('0x12')]('%s',_[_0x9df1('0x26')](_0x1eff4a))]=_0x38ff55[_0x1eff4a];}}return{'variables':_0x5d9976};};exports[_0x9df1('0x27')]=function(_0x429ef6,_0x8d98f2){if(!_[_0x9df1('0xf')](_0x429ef6)){if(_0x429ef6[_0x9df1('0x25')](_0x9df1('0x28'))){if(_0x429ef6[_0x9df1('0x28')]>0x0){_0x429ef6[_0x9df1('0x28')]-=0x1;}else{logger['error'](_0x9df1('0x29'),_0x8d98f2);}}}else{logger[_0x9df1('0x5')](_0x9df1('0x2a'),_0x8d98f2);}};exports[_0x9df1('0x2b')]=function(_0x9c9c71){var _0x4e2d1f=moment()[_0x9df1('0x12')](_0x9df1('0x2c'));_0x9c9c71['state']=0xd;_0x9c9c71[_0x9df1('0x2d')]=_0x9df1('0x2e');_0x9c9c71[_0x9df1('0x2f')]=_0x4e2d1f;_0x9c9c71['responsetime']=_0x4e2d1f;_0x9c9c71[_0x9df1('0x30')]=_0x4e2d1f;};exports[_0x9df1('0x31')]=function(_0xe13170,_0x287008,_0x2f5f11){var _0x49faa9=moment()[_0x9df1('0x12')](_0x9df1('0x2c'));_0xe13170[_0x9df1('0x32')]=_0x287008;_0xe13170[_0x9df1('0x2d')]=_0x2f5f11;_0xe13170[_0x9df1('0x33')]=_0x49faa9;_0xe13170['ringtime']=utils['getSeconds'](_0xe13170[_0x9df1('0x33')],_0xe13170['starttime']);};exports[_0x9df1('0x34')]=function(_0x1d1420,_0x43b48f,_0xb4412){_0x1d1420[_0x9df1('0x35')]=_0x43b48f;_0x1d1420[_0x9df1('0x36')]=_0xb4412;};exports[_0x9df1('0x37')]=function(_0x21713d,_0xcd75eb,_0x286c4b){var _0x335c22=moment()[_0x9df1('0x12')](_0x9df1('0x2c'));_0x21713d[_0x9df1('0x32')]=_0xcd75eb;_0x21713d[_0x9df1('0x2d')]=_0x286c4b;_0x21713d['responsetime']=_0x21713d[_0x9df1('0x33')]?_0x21713d[_0x9df1('0x33')]:_0x335c22;_0x21713d[_0x9df1('0x30')]=_0x21713d[_0x9df1('0x30')]?_0x21713d['endtime']:_0x335c22;_0x21713d['ringtime']=utils['getSeconds'](_0x21713d['responsetime']||0x0,_0x21713d[_0x9df1('0x2f')]||0x0);_0x21713d['talktime']=_0x21713d[_0x9df1('0x38')]?utils[_0x9df1('0x39')](_0x21713d[_0x9df1('0x30')],_0x21713d[_0x9df1('0x38')]):0x0;};exports[_0x9df1('0x3a')]=function(_0x434846){return _0x434846===_0x9df1('0x3b');};exports['variablesAction']=function(_0x22cf68,_0x22a9f3,_0x325288,_0x2159f4,_0x55c183){var _0x554685=_0x2159f4?_0x9df1('0x3c'):_0x22cf68[_0x9df1('0x14')];_0x554685=_0x55c183?'BOOKED':_0x554685;return{'actionid':_0x22cf68['uniqueid'],'action':'originate','channel':_0x22cf68['channelAgent'],'callerid':util[_0x9df1('0x12')]('\x22%s\x22\x20<%s>',_0x554685,_0x22cf68[_0x9df1('0x15')]),'Exten':_0x9df1('0x3d'),'Context':_0x9df1('0x3e'),'Priority':'1','variable':_0x325288,'timeout':(_0x22a9f3[_0x9df1('0x3f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x22cf68['uniqueid']};};exports['totalGlobal']=function(_0x23b738){return _0x23b738[_0x9df1('0x40')]+_0x23b738[_0x9df1('0x41')]+_0x23b738[_0x9df1('0x42')]+_0x23b738['countagentrejectretry']+_0x23b738['countnosuchnumberretry'];};exports[_0x9df1('0x43')]=function(_0x7ded97){var _0x427450=_[_0x9df1('0x44')](_0x7ded97);_0x427450[_0x9df1('0x32')]=0xf;_0x427450['statedesc']=_0x9df1('0x45');return _0x427450;};exports[_0x9df1('0x46')]=function(_0x58f980,_0x326db3,_0x3cee59){var _0x341664={};_0x341664[_0x326db3]=_0x58f980[_0x326db3];_0x341664[_0x9df1('0x47')]=![];_0x341664[_0x9df1('0x48')]=moment()[_0x9df1('0x49')](_0x3cee59,'minutes')[_0x9df1('0x12')](_0x9df1('0x2c'));_0x341664[_0x9df1('0x4a')]=_0x58f980['ContactId'];_0x341664['ListId']=_0x58f980[_0x9df1('0x4b')];_0x341664[_0x9df1('0x4c')]=_0x58f980['VoiceQueueId']||undefined;return _0x341664;};exports['decrementTalkink']=function(_0x185266,_0x18c390){if(!_['isNil'](_0x185266)){if(_0x185266[_0x9df1('0x4d')]>0x0){_0x185266[_0x9df1('0x4d')]-=0x1;}else{logger['error'](_0x18c390,_0x9df1('0x4e'));}}else{logger['error'](_0x18c390,_0x9df1('0x4f'));}};exports['IsNotLoggedIn']=function(_0x596c6d){if(_0x596c6d<=0x0){return!![];}return![];};function buildObj(_0x54069d,_0x514833,_0x3dcfd2){_0x54069d['lastevent']=_0x514833;_0x54069d[_0x9df1('0x11')]=_0x54069d[_0x9df1('0x50')];_0x54069d[_0x9df1('0x51')]=_0x54069d[_0x9df1('0x52')];_0x54069d['motionChannel']=_0x9df1('0x53');if(_0x3dcfd2){_0x54069d['mandatoryDisposition']=_0x3dcfd2['mandatoryDisposition'];}return _0x54069d;}exports[_0x9df1('0x54')]=buildObj;exports[_0x9df1('0x55')]=function(_0x1274b9){var _0x6424bb={};_0x6424bb[_0x9df1('0x50')]=_0x1274b9['queue'];_0x6424bb['interface']=_0x1274b9['channelAgent'];_0x6424bb[_0x9df1('0x56')]=_0x1274b9[_0x9df1('0x56')];return _0x6424bb;};exports[_0x9df1('0x57')]=function(_0xc49a4b){var _0x514861=[];for(var _0x3fa9ac in _0xc49a4b){if(_0xc49a4b[_0x9df1('0x25')](_0x3fa9ac)){if(!_['isNil'](_0xc49a4b[_0x3fa9ac])&&_0xc49a4b[_0x3fa9ac]['state']===_0x9df1('0x58')&&_0xc49a4b[_0x3fa9ac][_0x9df1('0x59')]===_0x9df1('0x5a')){_0x514861[_0x9df1('0x5b')](_0xc49a4b[_0x3fa9ac]['id']);}}}return _0x514861;};exports[_0x9df1('0x5c')]=function(_0x4214a5){var _0x1097ae=moment()['milliseconds'](0x0);var _0x69c576=moment(_0x4214a5)[_0x9df1('0x5d')](0x0);return _0x1097ae[_0x9df1('0x5e')](_0x69c576,_0x9df1('0x5f'));};exports[_0x9df1('0x60')]=function(_0x34673e){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x34673e[_0x9df1('0x4a')],'ListId':_0x34673e[_0x9df1('0x4b')],'VoiceQueueId':_0x34673e[_0x9df1('0x4c')]||undefined,'CampaignId':_0x34673e['CampaignId']||undefined};};exports[_0x9df1('0x61')]=function(_0x2ce158){if(_0x2ce158==='uniqueid'||_0x2ce158===_0x9df1('0x62')||_0x2ce158===_0x9df1('0x50')||_0x2ce158===_0x9df1('0x63')||_0x2ce158===_0x9df1('0x64')||_0x2ce158===_0x9df1('0x65')||_0x2ce158==='membername'||_0x2ce158===_0x9df1('0x52')||_0x2ce158===_0x9df1('0x14')||_0x2ce158===_0x9df1('0x47')||_0x2ce158===_0x9df1('0x15')||_0x2ce158==='scheduledat'||_0x2ce158===_0x9df1('0x40')||_0x2ce158==='countcongestionretry'||_0x2ce158===_0x9df1('0x42')||_0x2ce158===_0x9df1('0x66')||_0x2ce158==='callback'||_0x2ce158==='callbackuniqueid'||_0x2ce158===_0x9df1('0x67')||_0x2ce158===_0x9df1('0x68')||_0x2ce158===_0x9df1('0x4a')||_0x2ce158==='ListId'||_0x2ce158===_0x9df1('0x36')||_0x2ce158===_0x9df1('0x4c')||_0x2ce158===_0x9df1('0x69')||_0x2ce158===_0x9df1('0x6a')||_0x2ce158===_0x9df1('0x6b')||_0x2ce158===_0x9df1('0x6c')||_0x2ce158==='xmd-listid'||_0x2ce158===_0x9df1('0x6d')||_0x2ce158==='xmd-dialtimeout'||_0x2ce158===_0x9df1('0x6e')||_0x2ce158===_0x9df1('0x6f')||_0x2ce158===_0x9df1('0x70')||_0x2ce158===_0x9df1('0x71')||_0x2ce158==='xmd-cdrtype'||_0x2ce158===_0x9df1('0x72')||_0x2ce158===_0x9df1('0x73')||_0x2ce158==='xmd-agi'||_0x2ce158===_0x9df1('0x74')||_0x2ce158===_0x9df1('0x75')||_0x2ce158===_0x9df1('0x76')||_0x2ce158===_0x9df1('0x77')||_0x2ce158===_0x9df1('0x78')||_0x2ce158===_0x9df1('0x79')||_0x2ce158===_0x9df1('0x7a')||_0x2ce158==='rtpaudioqosrttbridged'||_0x2ce158===_0x9df1('0x74')||_0x2ce158==='rtpaudioqosbridged'||_0x2ce158===_0x9df1('0x76')||_0x2ce158===_0x9df1('0x77')||_0x2ce158===_0x9df1('0x78')||_0x2ce158===_0x9df1('0x79')||_0x2ce158===_0x9df1('0x7a')||_0x2ce158===_0x9df1('0x7b')||_0x2ce158===_0x9df1('0x7c')||_0x2ce158==='bridgepvtcallid'||_0x2ce158===_0x9df1('0x32')||_0x2ce158===_0x9df1('0x2d')){return![];}return!![];};exports[_0x9df1('0x7d')]=function(_0x3a1862,_0x1711fc){var _0x4657cd,_0x3fb6c8,_0x5ade94;if(_0x1711fc<=0x0){_0x1711fc=0x1;}_0x4657cd=new RegExp(_0x9df1('0x7e')+_0x1711fc+'}$');_0x3fb6c8=Math[_0x9df1('0x7f')](0xa,_0x1711fc-0x1);_0x5ade94=Math[_0x9df1('0x7f')](0xa,_0x1711fc)-0x1;return util['format']('%s',_[_0x9df1('0x80')](_0x3a1862,_0x4657cd,_['random'](_0x3fb6c8,_0x5ade94)));};exports[_0x9df1('0x81')]=function(_0x51178f){var _0x3af85e=_0x51178f[_0x9df1('0x82')](/"(.*?)"/);return _0x3af85e?_0x3af85e[0x1]:_0x51178f;};exports[_0x9df1('0x83')]=function(_0x3aace8){var _0x4fd353=_0x3aace8[_0x9df1('0x82')](/<(.*?)>/);return _0x4fd353?_0x4fd353[0x1]:_0x3aace8;};function buildNoAnswerEventPayload(_0x457044,_0x1265e9){var _0x9c402c=buildObj(_0x457044,_0x9df1('0x84'));if(!_[_0x9df1('0xd')](_0x1265e9['variables'])){Object['keys'](_0x1265e9[_0x9df1('0x85')])[_0x9df1('0x86')](function(_0x39a184){_0x9c402c[_0x39a184[_0x9df1('0x87')]()]=_0x1265e9['variables'][_0x39a184];});}return _0x9c402c;}exports[_0x9df1('0x88')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 755025b..5f86725 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 _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 +var _0x09dc=['string','number','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','queueadd'];(function(_0x37fb1f,_0x16836c){var _0x2313ab=function(_0x28599d){while(--_0x28599d){_0x37fb1f['push'](_0x37fb1f['shift']());}};_0x2313ab(++_0x16836c);}(_0x09dc,0x74));var _0xc09d=function(_0x315b61,_0x4bb11e){_0x315b61=_0x315b61-0x0;var _0x3521e8=_0x09dc[_0x315b61];return _0x3521e8;};'use strict';exports[_0xc09d('0x0')]={'queue':{'type':_0xc09d('0x1'),'required':!![]},'interface':{'type':_0xc09d('0x1'),'required':!![]},'membername':{'type':_0xc09d('0x1'),'required':!![]},'penalty':{'type':_0xc09d('0x2'),'required':![]},'paused':{'type':_0xc09d('0x3'),'required':![]}};exports[_0xc09d('0x4')]={'queue':{'type':_0xc09d('0x1'),'required':!![]},'interface':{'type':_0xc09d('0x1'),'required':!![]}};exports[_0xc09d('0x5')]={'interface':{'type':_0xc09d('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0xc09d('0x1'),'required':![]}};exports[_0xc09d('0x6')]={'module':{'type':_0xc09d('0x1'),'required':![]}};exports[_0xc09d('0x7')]={'uniqueid':{'type':_0xc09d('0x1'),'required':!![]}};exports[_0xc09d('0x8')]={'uniqueid':{'type':_0xc09d('0x1'),'required':!![]},'filename':{'type':_0xc09d('0x1')},'format':{'type':_0xc09d('0x1')},'mixmonitorid':{'type':_0xc09d('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0xc09d('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xc09d('0x1'),'required':!![]},'context':{'type':_0xc09d('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index e86f0a5..7b7bfa5 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 _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 +var _0xb10b=['../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','triggers','campaigns','templates','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','trunks','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','dialQueueProject','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','lodash','util','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign'];(function(_0x3e36ec,_0x404d8d){var _0x30ce00=function(_0x667858){while(--_0x667858){_0x3e36ec['push'](_0x3e36ec['shift']());}};_0x30ce00(++_0x404d8d);}(_0xb10b,0x12a));var _0xbb10=function(_0x25a42a,_0x3d489b){_0x25a42a=_0x25a42a-0x0;var _0x1129b1=_0xb10b[_0x25a42a];return _0x1129b1;};'use strict';var _=require(_0xbb10('0x0'));var moment=require('moment');var util=require(_0xbb10('0x1'));var Agent=require(_0xbb10('0x2'));var Telephone=require(_0xbb10('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xbb10('0x4'));var Trigger=require(_0xbb10('0x5'));var Template=require(_0xbb10('0x6'));var Campaign=require(_0xbb10('0x7'));var VoiceExtension=require(_0xbb10('0x8'));var ZendeskAccount=require(_0xbb10('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xbb10('0xa'));var SugarcrmAccount=require(_0xbb10('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xbb10('0xc'));var VtigerAccount=require(_0xbb10('0xd'));var ServicenowAccount=require(_0xbb10('0xe'));var Dynamics365Account=require(_0xbb10('0xf'));var FreshsalesAccount=require(_0xbb10('0x10'));var FaxAccount=require(_0xbb10('0x11'));function Realtime(){this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0xbb10('0x14')]={};this[_0xbb10('0x15')]={};this[_0xbb10('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbb10('0x17')]={};this['channels']={};this[_0xbb10('0x18')]={};this[_0xbb10('0x19')]={};this[_0xbb10('0x1a')]={};this[_0xbb10('0x1b')]={};this[_0xbb10('0x1c')]={};this[_0xbb10('0x1d')]={};this['sugarcrmAccounts']={};this[_0xbb10('0x1e')]={};this[_0xbb10('0x1f')]={};this[_0xbb10('0x20')]={};this[_0xbb10('0x21')]={};this[_0xbb10('0x22')]={};this[_0xbb10('0x23')]={};this[_0xbb10('0x24')]={};this[_0xbb10('0x25')]={};}function freeIsNotKey(_0x3e26f4,_0x2b184e,_0x4a2bfc){var _0x2eca0f=_[_0xbb10('0x26')](_0x3e26f4,function(_0x133ac2){return _0x133ac2[_0x4a2bfc];});for(var _0x42db98 in _0x2b184e){if(_0x2b184e[_0xbb10('0x27')](_0x42db98)){if(!_0x2eca0f[_0x42db98]){delete _0x2b184e[_0x42db98];}}}}function freeIsNotKeySip(_0x1682a4,_0x575cca){var _0x30efc6=_[_0xbb10('0x26')](_0x1682a4,function(_0xe1c665){return util['format'](_0xbb10('0x28'),_0xe1c665[_0xbb10('0x29')]);});for(var _0x388fab in _0x575cca){if(_0x575cca[_0xbb10('0x27')](_0x388fab)){if(!_0x30efc6[_0x388fab]){delete _0x575cca[_0x388fab];}}}}function freeIsNotKeyAgent(_0xdf237d,_0x44e563){var _0x4deb49=_[_0xbb10('0x26')](_0xdf237d,function(_0x12ef77){var _0x50aea1=_['isNil'](_0x12ef77[_0xbb10('0x2a')])?util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x12ef77[_0xbb10('0x29')]):_0x12ef77[_0xbb10('0x2a')];return _0x50aea1;});for(var _0x1824b7 in _0x44e563){if(_0x44e563[_0xbb10('0x27')](_0x1824b7)){if(!_0x4deb49[_0x1824b7]){delete _0x44e563[_0x1824b7];}}}}function clearVoiceCallReports(_0x436104){_0x436104[_0xbb10('0x2c')]=0x0;_0x436104[_0xbb10('0x2d')]=0x0;_0x436104[_0xbb10('0x2e')]=0x0;_0x436104[_0xbb10('0x2f')]=0x0;_0x436104['sumBillable']=0x0;}function clearCampaigns(_0x4fedac){if(!_['isEmpty'](_0x4fedac)){for(var _0xc93a04 in _0x4fedac){if(_0x4fedac[_0xbb10('0x27')](_0xc93a04)){_0x4fedac[_0xc93a04][_0xbb10('0x30')]=0x0;_0x4fedac[_0xc93a04]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2fdde9){if(!_[_0xbb10('0x31')](_0x2fdde9)){for(var _0x6ed43b in _0x2fdde9){if(_0x2fdde9[_0xbb10('0x27')](_0x6ed43b)){_0x2fdde9[_0x6ed43b][_0xbb10('0x2c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2d')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x32')]=0x0;_0x2fdde9[_0x6ed43b]['abandoned']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2e')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2f')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x33')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x34')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x35')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x36')]=0x0;_0x2fdde9[_0x6ed43b]['outboundCongestionCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x37')]=0x0;_0x2fdde9[_0x6ed43b]['outboundUnknownCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x38')]=0x0;_0x2fdde9[_0x6ed43b]['outboundDropCallsDayCallersExit']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x39')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3a')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3b')]=0x0;_0x2fdde9[_0x6ed43b]['outboundReCallsDay']=0x0;_0x2fdde9[_0x6ed43b]['outboundAnswerAgiCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3d')]=!![];}}}}Realtime['prototype'][_0xbb10('0x3e')]=function(_0x37dde7,_0x2f653f){for(var _0x1c0b57 in _0x2f653f){if(_0x37dde7[_0xbb10('0x27')](_0x1c0b57)){_0x37dde7[_0x1c0b57]=_0x2f653f[_0x1c0b57];}}};Realtime[_0xbb10('0x3f')][_0xbb10('0x40')]=function(){var _0x4975f5=this;return function(_0x25acb3){if(_0x25acb3){freeIsNotKeyAgent(_0x25acb3,_0x4975f5[_0xbb10('0x12')]);for(var _0x441d15=0x0,_0x8c1ce6={};_0x441d15<_0x25acb3[_0xbb10('0x41')];_0x441d15+=0x1){_0x8c1ce6=_0x25acb3[_0x441d15];var _0x9de708=_[_0xbb10('0x42')](_0x8c1ce6[_0xbb10('0x2a')])?util[_0xbb10('0x2b')]('SIP/%s',_0x8c1ce6[_0xbb10('0x29')]):_0x8c1ce6[_0xbb10('0x2a')];if(_[_0xbb10('0x43')](_0x4975f5[_0xbb10('0x12')][_0x9de708])){_0x4975f5['agents'][_0x9de708]=new Agent(_0x8c1ce6);}else{_0x4975f5[_0xbb10('0x3e')](_0x4975f5['agents'][_0x9de708],_0x8c1ce6);}}}return _0x4975f5['agents'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x44')]=function(){var _0x26e76a=this;return function(_0x120d21){if(_0x120d21){freeIsNotKeySip(_0x120d21,_0x26e76a[_0xbb10('0x13')]);for(var _0x29d11a=0x0,_0x547062={};_0x29d11a<_0x120d21[_0xbb10('0x41')];_0x29d11a+=0x1){_0x547062=_0x120d21[_0x29d11a];if(_[_0xbb10('0x43')](_0x26e76a['telephones'][util['format']('SIP/%s',_0x547062[_0xbb10('0x29')])])){_0x26e76a[_0xbb10('0x13')][util[_0xbb10('0x2b')]('SIP/%s',_0x547062[_0xbb10('0x29')])]=new Telephone(_0x547062);}else{_0x26e76a[_0xbb10('0x3e')](_0x26e76a[_0xbb10('0x13')][util['format'](_0xbb10('0x28'),_0x547062[_0xbb10('0x29')])],_0x547062);}}}return _0x26e76a[_0xbb10('0x13')];};};Realtime[_0xbb10('0x3f')]['initTrunks']=function(){var _0xd238e9=this;return function(_0x110eb5){if(_0x110eb5){freeIsNotKeySip(_0x110eb5,_0xd238e9['trunks']);for(var _0xe2040f=0x0,_0x2e3214={};_0xe2040f<_0x110eb5[_0xbb10('0x41')];_0xe2040f+=0x1){_0x2e3214=_0x110eb5[_0xe2040f];if(_[_0xbb10('0x43')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')]('SIP/%s',_0x2e3214[_0xbb10('0x29')])])){_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])]=new Trunk(_0x2e3214);}else{_0xd238e9[_0xbb10('0x3e')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])],_0x2e3214);}}}return _0xd238e9[_0xbb10('0x45')];};};Realtime[_0xbb10('0x3f')]['initTriggers']=function(){var _0x5d9a4f=this;return function(_0x38d78f){if(_0x38d78f){freeIsNotKey(_0x38d78f,_0x5d9a4f['triggers'],'id');for(var _0x318984=0x0,_0x180933={};_0x318984<_0x38d78f['length'];_0x318984+=0x1){_0x180933=_0x38d78f[_0x318984];if(_[_0xbb10('0x43')](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']])){_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']]=new Trigger(_0x180933);}else{_0x5d9a4f['mergeFromDatabase'](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']],_0x180933);}}}return _0x5d9a4f[_0xbb10('0x14')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x46')]=function(){var _0x36e1fa=this;return function(_0x19f94d){if(_0x19f94d){freeIsNotKey(_0x19f94d,_0x36e1fa[_0xbb10('0x16')],'id');for(var _0x3efa96=0x0,_0x205bb4={};_0x3efa96<_0x19f94d[_0xbb10('0x41')];_0x3efa96+=0x1){_0x205bb4=_0x19f94d[_0x3efa96];if(_[_0xbb10('0x43')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']])){_0x36e1fa['templates'][_0x205bb4['id']]=new Template(_0x205bb4);}else{_0x36e1fa[_0xbb10('0x3e')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']],_0x205bb4);}}}return _0x36e1fa['templates'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x47')]=function(){var _0x1a7df6=this;return function(_0x5a5226){if(_0x5a5226){freeIsNotKey(_0x5a5226,_0x1a7df6[_0xbb10('0x1c')],'id');for(var _0x39f0de=0x0,_0x3e06b0={};_0x39f0de<_0x5a5226['length'];_0x39f0de+=0x1){_0x3e06b0=_0x5a5226[_0x39f0de];if(_['isUndefined'](_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']])){_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']]=new ZendeskAccount(_0x3e06b0);}else{_0x1a7df6[_0xbb10('0x3e')](_0x1a7df6['zendeskAccounts'][_0x3e06b0['id']],_0x3e06b0);}}}return _0x1a7df6['zendeskAccounts'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x48')]=function(){var _0x1bd054=this;return function(_0xf820fe){if(_0xf820fe){freeIsNotKey(_0xf820fe,_0x1bd054[_0xbb10('0x1d')],'id');for(var _0x22b315=0x0,_0x2f2552={};_0x22b315<_0xf820fe[_0xbb10('0x41')];_0x22b315+=0x1){_0x2f2552=_0xf820fe[_0x22b315];if(_[_0xbb10('0x43')](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']])){_0x1bd054['salesforceAccounts'][_0x2f2552['id']]=new SalesforceAccount(_0x2f2552);}else{_0x1bd054['mergeFromDatabase'](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']],_0x2f2552);}}}return _0x1bd054[_0xbb10('0x1d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x49')]=function(){var _0x36aa7d=this;return function(_0x440f9e){if(_0x440f9e){freeIsNotKey(_0x440f9e,_0x36aa7d[_0xbb10('0x1e')],'id');for(var _0x445870=0x0,_0x1c0d8f={};_0x445870<_0x440f9e[_0xbb10('0x41')];_0x445870+=0x1){_0x1c0d8f=_0x440f9e[_0x445870];if(_[_0xbb10('0x43')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']])){_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']]=new FreshdeskAccount(_0x1c0d8f);}else{_0x36aa7d[_0xbb10('0x3e')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']],_0x1c0d8f);}}}return _0x36aa7d['freshdeskAccounts'];};};Realtime[_0xbb10('0x3f')]['initZohoAccounts']=function(){var _0x33d60a=this;return function(_0x2e21a0){if(_0x2e21a0){freeIsNotKey(_0x2e21a0,_0x33d60a[_0xbb10('0x1f')],'id');for(var _0x3f27ce=0x0,_0x26e66e={};_0x3f27ce<_0x2e21a0[_0xbb10('0x41')];_0x3f27ce+=0x1){_0x26e66e=_0x2e21a0[_0x3f27ce];if(_[_0xbb10('0x43')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']])){_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']]=new ZohoAccount(_0x26e66e);}else{_0x33d60a[_0xbb10('0x3e')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']],_0x26e66e);}}}return _0x33d60a[_0xbb10('0x1f')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4a')]=function(){var _0x4475e1=this;return function(_0x5de0cc){if(_0x5de0cc){freeIsNotKey(_0x5de0cc,_0x4475e1[_0xbb10('0x20')],'id');for(var _0x466eb7=0x0,_0x1b83a9={};_0x466eb7<_0x5de0cc[_0xbb10('0x41')];_0x466eb7+=0x1){_0x1b83a9=_0x5de0cc[_0x466eb7];if(_[_0xbb10('0x43')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']])){_0x4475e1['deskAccounts'][_0x1b83a9['id']]=new DeskAccount(_0x1b83a9);}else{_0x4475e1[_0xbb10('0x3e')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']],_0x1b83a9);}}}return _0x4475e1[_0xbb10('0x20')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4b')]=function(){var _0x22de7f=this;return function(_0x175872){if(_0x175872){freeIsNotKey(_0x175872,_0x22de7f[_0xbb10('0x4c')],'id');for(var _0x205e01=0x0,_0x40c4fb={};_0x205e01<_0x175872[_0xbb10('0x41')];_0x205e01+=0x1){_0x40c4fb=_0x175872[_0x205e01];if(_[_0xbb10('0x43')](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']])){_0x22de7f['sugarcrmAccounts'][_0x40c4fb['id']]=new SugarcrmAccount(_0x40c4fb);}else{_0x22de7f['mergeFromDatabase'](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']],_0x40c4fb);}}}return _0x22de7f[_0xbb10('0x4c')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4d')]=function(){var _0x5573bb=this;return function(_0x506498){if(_0x506498){freeIsNotKey(_0x506498,_0x5573bb[_0xbb10('0x21')],'id');for(var _0xaf2cc3=0x0,_0x410bef={};_0xaf2cc3<_0x506498[_0xbb10('0x41')];_0xaf2cc3+=0x1){_0x410bef=_0x506498[_0xaf2cc3];if(_[_0xbb10('0x43')](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']])){_0x5573bb[_0xbb10('0x21')][_0x410bef['id']]=new VtigerAccount(_0x410bef);}else{_0x5573bb['mergeFromDatabase'](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']],_0x410bef);}}}return _0x5573bb[_0xbb10('0x21')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x5a231f=this;return function(_0x32c1e8){if(_0x32c1e8){freeIsNotKey(_0x32c1e8,_0x5a231f[_0xbb10('0x22')],'id');for(var _0x155dc5=0x0,_0x5bd1c0={};_0x155dc5<_0x32c1e8['length'];_0x155dc5+=0x1){_0x5bd1c0=_0x32c1e8[_0x155dc5];if(_['isUndefined'](_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']])){_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']]=new ServicenowAccount(_0x5bd1c0);}else{_0x5a231f[_0xbb10('0x3e')](_0x5a231f['servicenowAccounts'][_0x5bd1c0['id']],_0x5bd1c0);}}}return _0x5a231f[_0xbb10('0x22')];};};Realtime[_0xbb10('0x3f')]['initDynamics365Accounts']=function(){var _0x4a560c=this;return function(_0x27d7b9){if(_0x27d7b9){freeIsNotKey(_0x27d7b9,_0x4a560c[_0xbb10('0x23')],'id');for(var _0xd77753=0x0,_0x237246={};_0xd77753<_0x27d7b9['length'];_0xd77753+=0x1){_0x237246=_0x27d7b9[_0xd77753];if(_[_0xbb10('0x43')](_0x4a560c[_0xbb10('0x23')][_0x237246['id']])){_0x4a560c[_0xbb10('0x23')][_0x237246['id']]=new Dynamics365Account(_0x237246);}else{_0x4a560c['mergeFromDatabase'](_0x4a560c[_0xbb10('0x23')][_0x237246['id']],_0x237246);}}}return _0x4a560c[_0xbb10('0x23')];};};Realtime[_0xbb10('0x3f')]['initFreshsalesAccounts']=function(){var _0x2ca491=this;return function(_0x31e85e){if(_0x31e85e){freeIsNotKey(_0x31e85e,_0x2ca491[_0xbb10('0x24')],'id');for(var _0x37b65f=0x0,_0x5e4a6e={};_0x37b65f<_0x31e85e[_0xbb10('0x41')];_0x37b65f+=0x1){_0x5e4a6e=_0x31e85e[_0x37b65f];if(_[_0xbb10('0x43')](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']])){_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']]=new FreshsalesAccount(_0x5e4a6e);}else{_0x2ca491['mergeFromDatabase'](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']],_0x5e4a6e);}}}return _0x2ca491[_0xbb10('0x24')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4e')]=function(){var _0x12f750=this;return function(_0x17807e){for(var _0x1e4694=0x0;_0x1e4694<_0x17807e['length'];_0x1e4694+=0x1){_['merge'](_0x12f750['voiceQueues'][_0x17807e[_0x1e4694][_0xbb10('0x29')]],_0x17807e[_0x1e4694]);}return _0x12f750[_0xbb10('0x4f')];};};Realtime[_0xbb10('0x3f')]['initVoiceQueueReports']=function(){var _0x5cd089=this;return function(_0x46f462){clearVoiceQueues(_0x5cd089[_0xbb10('0x4f')]);if(_0x46f462){_0x46f462=_[_0xbb10('0x50')](_0x46f462,_0xbb10('0x51'));for(var _0x260e06 in _0x46f462){if(_0x46f462[_0xbb10('0x27')](_0x260e06)){for(var _0x4cf2f3=0x0;_0x4cf2f3<_0x46f462[_0x260e06][_0xbb10('0x41')];_0x4cf2f3+=0x1){var _0x15fae2=_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x52')];if(_0x5cd089[_0xbb10('0x4f')][_0x15fae2]){if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x53')]){_0x5cd089['voiceQueues'][_0x15fae2]['unmanaged']+=0x1;}if(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerabandon']){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x54')]+=0x1;}_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;if(_0x4cf2f3===_0x46f462[_0x260e06]['length']-0x1){_0x5cd089['voiceQueues'][_0x15fae2]['sumDuration']+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x58')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x59')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5a')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;_0x5cd089['voiceQueues'][_0x15fae2]['total']+=0x1;if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5b')]){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2d')]+=0x1;_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x33')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallercompleteAt'])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')]),_0xbb10('0x57'))||0x0;}}else{_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2f')]+=_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]||0x0;}}}}}}return _0x5cd089['voiceQueues'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x5c')]=function(){var _0x30f3ea=this;return function(_0x322b41){clearVoiceCallReports(_0x30f3ea[_0xbb10('0x5d')]);if(_0x322b41){for(var _0x172be3=0x0;_0x172be3<_0x322b41[_0xbb10('0x41')];_0x172be3+=0x1){_0x30f3ea[_0xbb10('0x5d')]['total']+=0x1;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x2f')]+=_0x322b41[_0x172be3][_0xbb10('0x5e')];if(_0x322b41[_0x172be3]['disposition']==='ANSWERED'){_0x30f3ea['outbound'][_0xbb10('0x2d')]+=0x1;_0x30f3ea['outbound']['sumHoldTime']+=_0x322b41[_0x172be3][_0xbb10('0x5e')]-_0x322b41[_0x172be3][_0xbb10('0x5f')]||0x0;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x33')]+=_0x322b41[_0x172be3][_0xbb10('0x5f')];}}}return _0x30f3ea[_0xbb10('0x5d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x60')]=function(){var _0x188b97=this;return function(_0x5206e1){if(_0x5206e1){freeIsNotKey(_0x5206e1,_0x188b97[_0xbb10('0x15')],_0xbb10('0x29'));for(var _0x46b6d2=0x0,_0x35b811={};_0x46b6d2<_0x5206e1['length'];_0x46b6d2+=0x1){_0x35b811=_0x5206e1[_0x46b6d2];if(_['isUndefined'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]])){_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]]=new Campaign(_0x35b811);}else{_0x188b97['mergeFromDatabase'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]],_0x35b811);_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]][_0xbb10('0x61')]=_0x35b811['SquareProject']?_0x35b811['SquareProject'][_0xbb10('0x29')]:undefined;}}}return _0x188b97[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')]['initVoiceExtensions']=function(){var _0x256b35=this;return function(_0x13e2ab){if(_0x13e2ab){freeIsNotKey(_0x13e2ab,_0x256b35['voiceExtensions'],'id');for(var _0x5caa06=0x0,_0x2f667f={};_0x5caa06<_0x13e2ab[_0xbb10('0x41')];_0x5caa06+=0x1){_0x2f667f=_0x13e2ab[_0x5caa06];if(_[_0xbb10('0x43')](_0x256b35['voiceExtensions'][_0x2f667f['id']])){_0x256b35[_0xbb10('0x17')][_0x2f667f['id']]=new VoiceExtension(_0x2f667f);}else{_0x256b35[_0xbb10('0x3e')](_0x256b35[_0xbb10('0x17')][_0x2f667f['id']],_0x2f667f);}}}return _0x256b35[_0xbb10('0x17')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x62')]=function(){var _0x45bd4e=this;return function(_0x226363){clearCampaigns(_0x45bd4e[_0xbb10('0x15')]);for(var _0x479d51=0x0;_0x479d51<_0x226363[_0xbb10('0x41')];_0x479d51+=0x1){_[_0xbb10('0x63')](_0x45bd4e[_0xbb10('0x15')][_0x226363[_0x479d51][_0xbb10('0x29')]],_0x226363[_0x479d51]);}return _0x45bd4e[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x64')]=function(){var _0x305d52=this;return function(_0x17ed20){if(_0x17ed20){freeIsNotKey(_0x17ed20,_0x305d52[_0xbb10('0x25')],'id');for(var _0x15e043=0x0,_0x2a4278={};_0x15e043<_0x17ed20['length'];_0x15e043+=0x1){_0x2a4278=_0x17ed20[_0x15e043];if(_['isUndefined'](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']])){_0x305d52[_0xbb10('0x25')][_0x2a4278['id']]=new FaxAccount(_0x2a4278);}else{_0x305d52[_0xbb10('0x3e')](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']],_0x2a4278);}}}return _0x305d52[_0xbb10('0x25')];};};Realtime['prototype'][_0xbb10('0x65')]=function(){var _0x332fbe=this;return function(_0x3b4d0b){if(_0x3b4d0b){freeIsNotKey(_0x3b4d0b,_0x332fbe[_0xbb10('0x4f')],_0xbb10('0x29'));for(var _0x379d49=0x0,_0x546db5={};_0x379d49<_0x3b4d0b[_0xbb10('0x41')];_0x379d49+=0x1){_0x546db5=_0x3b4d0b[_0x379d49];if(_[_0xbb10('0x43')](_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]])){_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]]=new VoiceQueue(_0x546db5);}else{_0x332fbe[_0xbb10('0x3e')](_0x332fbe[_0xbb10('0x4f')][_0x546db5[_0xbb10('0x29')]],_0x546db5);}}}return _0x332fbe[_0xbb10('0x4f')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index eeb9843..f0fde41 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 _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 +var _0x4b13=['assign','hasOwnProperty','mergeDBDataToRealtime'];(function(_0x3f8a03,_0x319b9c){var _0x147fb2=function(_0x523c1c){while(--_0x523c1c){_0x3f8a03['push'](_0x3f8a03['shift']());}};_0x147fb2(++_0x319b9c);}(_0x4b13,0x90));var _0x34b1=function(_0x3bcea4,_0x59cab8){_0x3bcea4=_0x3bcea4-0x0;var _0x3ac6ce=_0x4b13[_0x3bcea4];return _0x3ac6ce;};'use strict';function mergeDBDataToRealtime(_0x4229ca,_0x59f4e4){var _0x576bff=Object[_0x34b1('0x0')]({},_0x4229ca);for(var _0x4a966d in _0x59f4e4){if(_0x576bff[_0x34b1('0x1')](_0x4a966d)){_0x576bff[_0x4a966d]=_0x59f4e4[_0x4a966d];}}return _0x576bff;}exports[_0x34b1('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 bc1eb22..5168fc2 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 _0x6263=['match','keys','split','getAgentByInternal','destination','type','dialer','lastapplication','queue','lastdata','context','xcally-motion-preview','calleridpreview','calleridnum','destinationchannel','channel','callerid','originatecalleridnum','disposition','\x22%s\x22\x20<%s>','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;_0x40542b','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','UserId','membername','monitor','length','monitorFilename','monitors','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','voiceDialReport','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','attendedTransfer','exports','moment','util','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','bind','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindTransfer','findAgent','find','accountcode','name','interface','format','voiceQueueReport','assigned','lastAssignedTo','isNil','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','channel','split','calleridnum','internal','voiceCallReport','destination','exten','type','dialer'];(function(_0x22d257,_0x42e442){var _0x388bd5=function(_0x14adad){while(--_0x14adad){_0x22d257['push'](_0x22d257['shift']());}};_0x388bd5(++_0x42e442);}(_0x8edd,0x8e));var _0xd8ed=function(_0xd2c728,_0x18c2ef){_0xd2c728=_0xd2c728-0x0;var _0x410019=_0x8edd[_0xd2c728];return _0x410019;};'use strict';var _=require('lodash');var moment=require(_0xd8ed('0x0'));var util=require(_0xd8ed('0x1'));var config=require('../../../config/environment');var ami=require(_0xd8ed('0x2'));var RpcVoiceAgentReport=require(_0xd8ed('0x3'));var RpcVoiceCallReport=require(_0xd8ed('0x4'));var RpcVoiceDialReport=require(_0xd8ed('0x5'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xd8ed('0x6'));var RpcVoiceRecording=require(_0xd8ed('0x7'));var RpcVoiceTransferReport=require(_0xd8ed('0x8'));var VoiceQueueReport=require(_0xd8ed('0x9'));var VoiceCallReport=require(_0xd8ed('0xa'));var VoiceAgentReport=require(_0xd8ed('0xb'));var VoiceDialReport=require(_0xd8ed('0xc'));var UserReport=require(_0xd8ed('0xd'));function Report(_0x3f5ed7){this[_0xd8ed('0xe')]=_0x3f5ed7;this[_0xd8ed('0xf')]=_0x3f5ed7[_0xd8ed('0xf')];this[_0xd8ed('0x10')]=_0x3f5ed7[_0xd8ed('0x10')];}Report[_0xd8ed('0x11')][_0xd8ed('0x12')]=function(_0x59b05b){var _0x5ec1c3=new VoiceQueueReport(this[_0xd8ed('0xe')]);var _0x29a0be=new VoiceAgentReport(this['realtime']);var _0x35d152=new VoiceDialReport(this[_0xd8ed('0xe')]);var _0x92c98d=new VoiceCallReport(this[_0xd8ed('0xe')]);var _0x45b45f=new UserReport(this['realtime']);if(config[_0xd8ed('0x13')]&&config[_0xd8ed('0x13')][_0xd8ed('0x14')]){ami['on']('custom:voiceQueueReport',this['voiceQueueReport'][_0xd8ed('0x15')](this));ami['on'](_0xd8ed('0x16'),this['voiceCallReport'][_0xd8ed('0x15')](this));ami['on'](_0xd8ed('0x17'),this[_0xd8ed('0x18')][_0xd8ed('0x15')](this));ami['on'](_0xd8ed('0x19'),this['voiceDialReport']['bind'](this));ami['on']('blindtransfer',this[_0xd8ed('0x1a')][_0xd8ed('0x15')](this));ami['on']('attendedtransfer',this['attendedTransfer']['bind'](this));}};Report[_0xd8ed('0x11')][_0xd8ed('0x1b')]=function(_0x1fbe1f){var _0x5876f6;_0x5876f6=_[_0xd8ed('0x1c')](this[_0xd8ed('0xf')],function(_0x52999c){return _0x52999c[_0xd8ed('0x1d')]==_0x1fbe1f||_0x52999c[_0xd8ed('0x1e')]==_0x1fbe1f;});if(_['isNil'](_0x5876f6)){var _0x4a91a3=_[_0xd8ed('0x1c')](this['telephones'],function(_0x2a1bc9){return _0x2a1bc9[_0xd8ed('0x1d')]==_0x1fbe1f||_0x2a1bc9[_0xd8ed('0x1e')]==_0x1fbe1f;});if(_0x4a91a3){_0x5876f6=_[_0xd8ed('0x1c')](this[_0xd8ed('0xf')],function(_0x566c9d){return _0x566c9d[_0xd8ed('0x1f')]==util[_0xd8ed('0x20')]('SIP/%s',_0x4a91a3[_0xd8ed('0x1e')]);});}}return _0x5876f6;};Report[_0xd8ed('0x11')][_0xd8ed('0x21')]=function(_0x34b077){for(var _0x3bcdc6=0x0;_0x3bcdc6<_0x34b077['length'];_0x3bcdc6+=0x1){var _0x3c0652=this[_0xd8ed('0x1b')](_0x34b077[_0x3bcdc6]['connectedlinenum']);if(_0x3c0652){_0x34b077[_0x3bcdc6][_0xd8ed('0x1d')]=_0x3c0652['accountcode'];_0x34b077[_0x3bcdc6][_0xd8ed('0x22')]=!![];_0x34b077[_0x3bcdc6][_0xd8ed('0x23')]=_0x3c0652[_0xd8ed('0x1e')];_0x34b077[_0x3bcdc6][_0xd8ed('0x1f')]=_[_0xd8ed('0x24')](_0x3c0652['interface'])?util['format']('SIP/%s',_0x3c0652['name']):_0x3c0652[_0xd8ed('0x1f')];if(_0x34b077[_0x3bcdc6][_0xd8ed('0x25')]){_0x34b077[_0x3bcdc6][_0xd8ed('0x26')]=moment()[_0xd8ed('0x20')](_0xd8ed('0x27'));}if(_0x34b077[_0x3bcdc6][_0xd8ed('0x28')]){_0x34b077[_0x3bcdc6][_0xd8ed('0x29')]=moment()[_0xd8ed('0x20')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xd8ed('0x21')](_0x34b077[_0x3bcdc6]);}RpcVoiceQueueReport[_0xd8ed('0x2a')](_0x34b077[_0x3bcdc6]);}};function extractCalleridNumber(_0x566a90){var _0x1b1f7d=_0x566a90[_0xd8ed('0x2b')](/<(.*?)>/);return _0x1b1f7d?_0x1b1f7d[0x1]:_0x566a90;}Report[_0xd8ed('0x11')][_0xd8ed('0x2c')]=function(_0x59699e){for(var _0x4c1703=0x0;_0x4c17030x0?!![]:![];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;_0x10f76b0x0?!![]:![];if(!_0x12fc52){return this[_0x8a71('0x1a')](this[_0x8a71('0x15')][_0x8a71('0x73')]);}};VoiceQueueReport[_0x8a71('0xb')][_0x8a71('0x1c')]=function(_0x90ce01){var _0xd962ce=this[_0x8a71('0x15')]['id'];if(this[_0x8a71('0x15')]['queuestatus'][_0xd962ce]&&this[_0x8a71('0x15')][_0x8a71('0x66')][_0xd962ce][_0x90ce01[_0x8a71('0x67')]]){this[_0x8a71('0x15')][_0x8a71('0x66')][_0xd962ce][_0x90ce01['actionid']]['agents'][_0x8a71('0x74')](_0x90ce01);}};VoiceQueueReport[_0x8a71('0xb')][_0x8a71('0x18')]=function(_0x3d22c5){var _0xd12f55=this;try{if(this['isNotNull'](_0x3d22c5)&&this['isNotNull'](_0x3d22c5[_0x8a71('0x6e')])){logger[_0x8a71('0x52')](_0x8a71('0x75'),util[_0x8a71('0x4b')](_0x3d22c5,{'showHidden':![],'depth':null}));var _0x13a0e1=this['voiceQueues'][_0x3d22c5['queue']];if(_0x13a0e1){logger[_0x8a71('0x52')](_0x8a71('0x76'),_0x13a0e1[_0x8a71('0x5f')]);this[_0x8a71('0x15')]['queues'][_0x13a0e1[_0x8a71('0x5f')]]={'summaryEvent':_0x3d22c5};this[_0x8a71('0x15')][_0x8a71('0x72')]+=0x1;return ami[_0x8a71('0x43')]({'action':_0x8a71('0x66'),'queue':_0x13a0e1['name']})[_0x8a71('0x64')](function(_0x98abbc){if(!_0xd12f55[_0x8a71('0x15')][_0x8a71('0x66')][_0x3d22c5[_0x8a71('0x67')]]){_0xd12f55[_0x8a71('0x15')]['queuestatus'][_0x3d22c5[_0x8a71('0x67')]]={};}_0xd12f55['summary'][_0x8a71('0x66')][_0x3d22c5[_0x8a71('0x67')]][_0x98abbc[_0x8a71('0x67')]]={'queue':_0x13a0e1['name'],'agents':[]};})[_0x8a71('0x46')](function(_0x47739d){throw _0x47739d;});}}}catch(_0x5850f9){logger[_0x8a71('0x49')]('[voiceQueueReport][queuesummary]',util[_0x8a71('0x4b')](_0x5850f9,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0x28238a){if(this[_0x8a71('0x15')]['statusRequests']>0x0){this[_0x8a71('0x15')][_0x8a71('0x73')]=_0x28238a;return;}logger['debug'](_0x8a71('0x77'),util[_0x8a71('0x4b')](_0x28238a,{'showHidden':![],'depth':null}));this[_0x8a71('0x15')]=initializeSummary();ami['emit'](_0x8a71('0x78'),{});};VoiceQueueReport[_0x8a71('0xb')]['syncQueueCallerJoin']=function(_0x30424f){try{if(this[_0x8a71('0x61')](_0x30424f)){logger[_0x8a71('0x52')](_0x8a71('0x79'),_0x30424f['uniqueid'],util[_0x8a71('0x4b')](_0x30424f,{'showHidden':![],'depth':null}));if(_[_0x8a71('0x7a')](this[_0x8a71('0xf')][_0x30424f['uniqueid']])){this['queueReports'][_0x30424f[_0x8a71('0x55')]]=[];}if(_[_0x8a71('0x7a')](this['channels'][_0x30424f['uniqueid']])){this[_0x8a71('0x12')][_0x30424f[_0x8a71('0x55')]]={};}var _0x55a1e8=new QueueReport();_0x55a1e8[_0x8a71('0x6e')]=_0x30424f[_0x8a71('0x6e')];_0x55a1e8['type']=this[_0x8a71('0x6d')][_0x55a1e8['queue']]&&this[_0x8a71('0x6d')][_0x55a1e8[_0x8a71('0x6e')]][_0x8a71('0x5d')]?this[_0x8a71('0x6d')][_0x55a1e8[_0x8a71('0x6e')]][_0x8a71('0x5d')]||_0x8a71('0x6f'):_0x8a71('0x6f');_0x55a1e8[_0x8a71('0x7b')]=moment()[_0x8a71('0x57')](_0x8a71('0x7c'));_0x55a1e8[_0x8a71('0x7d')]=_0x30424f['position'];_0x55a1e8[_0x8a71('0x7e')]=_0x30424f['count'];_0x55a1e8['uniqueid']=_0x30424f[_0x8a71('0x55')];_0x55a1e8[_0x8a71('0x7f')]=this[_0x8a71('0x12')][_0x30424f['uniqueid']]['routealias'];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x55a1e8[_0x8a71('0x6e')],_0x55a1e8[_0x8a71('0x5d')]);Object[_0x8a71('0x6c')](_0x55a1e8,_['pick'](_0x30424f,_[_0x8a71('0x80')](_0x55a1e8)));this[_0x8a71('0xf')][_0x30424f['uniqueid']][_0x8a71('0x74')](_0x55a1e8);this['channels'][_0x30424f[_0x8a71('0x55')]]=_0x55a1e8;this[_0x8a71('0x51')](_0x55a1e8,'queuecallerjoin');}}catch(_0x3c42e8){logger[_0x8a71('0x49')](_0x8a71('0x79'),_0x30424f[_0x8a71('0x55')],util[_0x8a71('0x4b')](_0x3c42e8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8a71('0xb')]['syncQueueCallerAbandon']=function(_0x5be44e){try{if(this[_0x8a71('0x61')](_0x5be44e)){logger['debug'](_0x8a71('0x81'),_0x5be44e[_0x8a71('0x55')],util['inspect'](_0x5be44e,{'showHidden':![],'depth':null}));if(this[_0x8a71('0xf')][_0x5be44e['uniqueid']]){var _0x1e0cf6=_[_0x8a71('0x82')](this[_0x8a71('0xf')][_0x5be44e[_0x8a71('0x55')]]);_0x1e0cf6[_0x8a71('0x3e')]=![];_0x1e0cf6[_0x8a71('0x83')]=null;_0x1e0cf6['holdtime']=_0x5be44e[_0x8a71('0x84')];_0x1e0cf6[_0x8a71('0x85')]=_0x5be44e[_0x8a71('0x85')];_0x1e0cf6[_0x8a71('0x21')]=!![];_0x1e0cf6[_0x8a71('0x86')]=moment()['format'](_0x8a71('0x7c'));_0x1e0cf6[_0x8a71('0x5a')]=_0x8a71('0x87');_0x1e0cf6[_0x8a71('0x88')]=null;logger[_0x8a71('0x89')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x1e0cf6['queue'],_0x1e0cf6[_0x8a71('0x5d')]);this['channels'][_0x5be44e['uniqueid']]=_0x1e0cf6;this[_0x8a71('0x4f')](_0x1e0cf6,_0x8a71('0x21'));}}}catch(_0x125901){logger['error'](_0x8a71('0x81'),_0x5be44e['uniqueid'],util[_0x8a71('0x4b')](_0x125901,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x32ffaf){try{if(this[_0x8a71('0x61')](_0x32ffaf)){logger[_0x8a71('0x52')](_0x8a71('0x8a'),_0x32ffaf[_0x8a71('0x55')],util[_0x8a71('0x4b')](_0x32ffaf,{'showHidden':![],'depth':null}));if(this[_0x8a71('0xf')][_0x32ffaf[_0x8a71('0x55')]]){var _0x29a887=_[_0x8a71('0x82')](this['queueReports'][_0x32ffaf[_0x8a71('0x55')]]);_0x29a887[_0x8a71('0x8b')]=moment()['format'](_0x8a71('0x7c'));_0x29a887[_0x8a71('0x8c')]=_0x32ffaf[_0x8a71('0x8c')];_0x29a887[_0x8a71('0x8d')]=_0x32ffaf[_0x8a71('0x8d')];logger[_0x8a71('0x89')](_0x8a71('0x8e'),_0x29a887[_0x8a71('0x6e')],_0x29a887[_0x8a71('0x5d')],_0x32ffaf[_0x8a71('0x8c')],_0x32ffaf['connectedlinename']);this[_0x8a71('0x12')][_0x32ffaf['uniqueid']]=_0x29a887;this[_0x8a71('0x51')](_0x29a887,_0x8a71('0x23'));}}}catch(_0x2ab6ba){logger[_0x8a71('0x49')](_0x8a71('0x8a'),_0x32ffaf[_0x8a71('0x55')],util[_0x8a71('0x4b')](_0x2ab6ba,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8a71('0xb')]['syncAgentConnect']=function(_0x2abf32){try{if(this['isNotNull'](_0x2abf32)){logger[_0x8a71('0x52')](_0x8a71('0x8f'),_0x2abf32['uniqueid'],util[_0x8a71('0x4b')](_0x2abf32,{'showHidden':![],'depth':null}));if(this[_0x8a71('0xf')][_0x2abf32[_0x8a71('0x55')]]){var _0x297b2f=_[_0x8a71('0x82')](this[_0x8a71('0xf')][_0x2abf32[_0x8a71('0x55')]]);_0x297b2f['queuecallercomplete']=!![];_0x297b2f[_0x8a71('0x5a')]=_0x8a71('0x90');logger[_0x8a71('0x89')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x297b2f[_0x8a71('0x6e')],_0x297b2f[_0x8a71('0x5d')]);}}}catch(_0x149f39){logger[_0x8a71('0x49')]('[%s][voiceQueueReport][agentconnect]',_0x2abf32[_0x8a71('0x55')],util['inspect'](_0x149f39,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8a71('0xb')]['syncAgentComplete']=function(_0x56bb24){try{if(this[_0x8a71('0x61')](_0x56bb24)){logger[_0x8a71('0x52')](_0x8a71('0x91'),_0x56bb24[_0x8a71('0x55')],util[_0x8a71('0x4b')](_0x56bb24,{'showHidden':![],'depth':null}));if(this[_0x8a71('0xf')][_0x56bb24['uniqueid']]){var _0x5d1ecb=_[_0x8a71('0x82')](this[_0x8a71('0xf')][_0x56bb24[_0x8a71('0x55')]]);_0x5d1ecb[_0x8a71('0x21')]=![];_0x5d1ecb[_0x8a71('0x86')]=null;_0x5d1ecb['assigned']=!![];_0x5d1ecb[_0x8a71('0x88')]=_0x56bb24[_0x8a71('0x92')];_0x5d1ecb['holdtime']=_0x56bb24[_0x8a71('0x84')];_0x5d1ecb[_0x8a71('0x3e')]=!![];_0x5d1ecb[_0x8a71('0x3d')]=![];_0x5d1ecb[_0x8a71('0x93')]=null;if(!_0x5d1ecb[_0x8a71('0x94')]){if(_0x56bb24[_0x8a71('0x95')]==_0x8a71('0x94')){_0x5d1ecb[_0x8a71('0x5a')]=_0x8a71('0x96');logger[_0x8a71('0x89')](_0x8a71('0x97'),_0x5d1ecb[_0x8a71('0x6e')],_0x5d1ecb[_0x8a71('0x5d')]);}else{if(_['startsWith'](_0x56bb24['channel'][_0x8a71('0x98')](),'local/')){if(this[_0x8a71('0xf')][_0x56bb24[_0x8a71('0x99')]]){var _0xf1b047=_[_0x8a71('0x82')](this[_0x8a71('0xf')][_0x56bb24['linkedid']]);_0xf1b047[_0x8a71('0x3e')]=![];_0xf1b047[_0x8a71('0x3d')]=!![];_0xf1b047[_0x8a71('0x93')]=moment(_0x5d1ecb['queuecallerjoinAt'])[_0x8a71('0x9a')](_0x56bb24[_0x8a71('0x84')],_0x8a71('0x9b'))[_0x8a71('0x57')](_0x8a71('0x7c'));_0xf1b047[_0x8a71('0x5a')]=_0x8a71('0x9c');_0xf1b047[_0x8a71('0x94')]=!![];_0xf1b047[_0x8a71('0x9d')]='FORWARD';_0xf1b047[_0x8a71('0x9e')]=_0x56bb24['destexten'];_0xf1b047['transferuniqueid']=_0x56bb24[_0x8a71('0x55')];logger[_0x8a71('0x89')](_0x8a71('0x9f'),_0xf1b047['queue'],_0xf1b047[_0x8a71('0x5d')]);var _0x5ae501=this[_0x8a71('0xf')][_0x56bb24[_0x8a71('0x99')]];this[_0x8a71('0xf')][_0x56bb24['linkedid']]=this[_0x8a71('0xf')][_0x56bb24[_0x8a71('0x55')]];this[_0x8a71('0xf')][_0x56bb24['uniqueid']]=_0x5ae501;}}else{_0x5d1ecb[_0x8a71('0x5a')]=_0x8a71('0xa0')+_0x56bb24[_0x8a71('0x95')][_0x8a71('0xa1')]();logger[_0x8a71('0x89')](_0x8a71('0xa2'),_0x5d1ecb[_0x8a71('0x6e')],_0x5d1ecb['type'],_0x5d1ecb[_0x8a71('0x5a')]);}}}this['channels'][_0x56bb24['uniqueid']]=_0x5d1ecb;}}}catch(_0x58e1e1){logger[_0x8a71('0x49')](_0x8a71('0x91'),_0x56bb24[_0x8a71('0x55')],util[_0x8a71('0x4b')](_0x58e1e1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8a71('0xb')][_0x8a71('0x29')]=function(_0x4b3a10){try{if(this[_0x8a71('0x61')](_0x4b3a10)){logger['debug'](_0x8a71('0xa3'),_0x4b3a10[_0x8a71('0x55')],util[_0x8a71('0x4b')](_0x4b3a10,{'showHidden':![],'depth':null}));this['addVariable'](_0x4b3a10[_0x8a71('0x55')],_[_0x8a71('0x80')](_0x4b3a10['variable'])[0x0],_0x4b3a10[_0x8a71('0xa4')]);if(this[_0x8a71('0xf')][_0x4b3a10[_0x8a71('0x55')]]){var _0x356060=_[_0x8a71('0x82')](this[_0x8a71('0xf')][_0x4b3a10[_0x8a71('0x55')]]);if(_0x356060){if(this[_0x8a71('0x61')](_0x4b3a10[_0x8a71('0xa5')])&&this['isNotNull'](_0x4b3a10[_0x8a71('0xa5')][_0x8a71('0x66')])){switch(_0x4b3a10['value']){case _0x8a71('0xa6'):_0x356060['queuecallerexit']=![];_0x356060['queuecallerexitAt']=null;break;case _0x8a71('0xa7'):_0x356060[_0x8a71('0xa8')]=_0x8a71('0xa9');_0x356060[_0x8a71('0x3d')]=!![];_0x356060[_0x8a71('0x93')]=moment()['format'](_0x8a71('0x7c'));_0x356060['queuecallerleaveAt']=moment()[_0x8a71('0x57')](_0x8a71('0x7c'));logger[_0x8a71('0x52')](_0x8a71('0xaa'),_0x4b3a10['uniqueid'],util[_0x8a71('0x4b')](_0x356060,{'showHidden':![],'depth':null}));ami[_0x8a71('0x56')](_0x8a71('0xab'),_0x356060);break;default:_0x356060[_0x8a71('0x3d')]=!![];_0x356060[_0x8a71('0x93')]=moment()['format'](_0x8a71('0x7c'));_0x356060['queuecallerleaveAt']=moment()['format'](_0x8a71('0x7c'));}_0x356060['queuecallerabandon']=![];_0x356060[_0x8a71('0x86')]=null;_0x356060[_0x8a71('0x5a')]=_0x4b3a10['value'];this['channels'][_0x4b3a10['uniqueid']]=_0x356060;this[_0x8a71('0x4f')](_0x356060,'varset');}else if(this['isNotNull'](_0x4b3a10[_0x8a71('0xa5')])&&this['isNotNull'](_0x4b3a10[_0x8a71('0xa5')][_0x8a71('0xac')])){if(!_0x356060[_0x8a71('0x21')]){_0x356060[_0x8a71('0x3d')]=!![];_0x356060[_0x8a71('0x93')]=moment()['format'](_0x8a71('0x7c'));_0x356060[_0x8a71('0x5a')]=_0x8a71('0xad');_0x356060[_0x8a71('0x8b')]=moment()[_0x8a71('0x57')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x8a71('0x12')][_0x4b3a10[_0x8a71('0x55')]]=_0x356060;}}logger['info'](_0x8a71('0xae'),_0x4b3a10[_0x8a71('0x55')],_0x356060[_0x8a71('0x6e')],_0x356060[_0x8a71('0x5d')],_['keys'](_0x4b3a10[_0x8a71('0xa5')])[0x0],_0x4b3a10[_0x8a71('0xa4')]);_0x356060['variables']=this[_0x8a71('0x16')][_0x4b3a10[_0x8a71('0x55')]];}}}}catch(_0xd3f68d){logger[_0x8a71('0x49')](_0x8a71('0xa3'),_0x4b3a10['uniqueid'],util[_0x8a71('0x4b')](_0xd3f68d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8a71('0xb')][_0x8a71('0xaf')]=function(_0x23d442,_0x165f82,_0x2fd9f9){var _0x2f02c0=[_0x8a71('0xb0'),'rtpaudioqosbridged',_0x8a71('0xb1'),'rtpaudioqosjitterbridged',_0x8a71('0xb2'),_0x8a71('0xb3'),_0x8a71('0xb4'),'rtpaudioqosrttbridged',_0x8a71('0xb5'),_0x8a71('0xb6'),_0x8a71('0xb7'),'bridgepvtcallid',_0x8a71('0xb8'),_0x8a71('0xb9'),_0x8a71('0xba'),_0x8a71('0xbb'),_0x8a71('0x92'),'memberpenalty',_0x8a71('0xbc')];if(!_[_0x8a71('0x42')](_0x165f82)&&!_[_0x8a71('0xbd')](_0x2f02c0,_0x165f82)){if(_[_0x8a71('0x7a')](this[_0x8a71('0x16')][_0x23d442])){this[_0x8a71('0x16')][_0x23d442]={};}this[_0x8a71('0x16')][_0x23d442][_0x165f82]=_0x2fd9f9;}};VoiceQueueReport[_0x8a71('0xb')][_0x8a71('0xbe')]=function(_0x573191,_0x276f0e,_0x4e1200){try{var _0xaefae5={};if(this['queueReports'][_0x573191]){for(var _0x3b7448=0x0;_0x3b7448=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 +var _0x824b=['TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','accountcode','toNumber','CreateMemberReport','voiceDialReport','starttime','endtime','outbound','dialstring','agent','uniqueid','moment','lodash','util','../client','queuecallercompleteAt','queuecallerexitAt','Request','voice','lastAssignedTo','isNil','interface','SIP/%s'];(function(_0x29dda1,_0x508e13){var _0x21b0ef=function(_0x118906){while(--_0x118906){_0x29dda1['push'](_0x29dda1['shift']());}};_0x21b0ef(++_0x508e13);}(_0x824b,0x1b6));var _0xb824=function(_0x326737,_0x3f30c6){_0x326737=_0x326737-0x0;var _0x229df7=_0x824b[_0x326737];return _0x229df7;};'use strict';var moment=require(_0xb824('0x0'));var _=require(_0xb824('0x1'));var util=require(_0xb824('0x2'));var client=require(_0xb824('0x3'));exports['voiceQueueReport']=function(_0x3906c7){var _0x4bf9aa=_0x3906c7[_0xb824('0x4')]||_0x3906c7[_0xb824('0x5')];return client[_0xb824('0x6')]('CreateMemberReport',{'body':{'channel':_0xb824('0x7'),'membername':_0x3906c7[_0xb824('0x8')],'interface':_[_0xb824('0x9')](_0x3906c7[_0xb824('0xa')])?util['format'](_0xb824('0xb'),_0x3906c7[_0xb824('0x8')]):_0x3906c7[_0xb824('0xa')],'type':_0xb824('0xc'),'enterAt':_0x3906c7[_0xb824('0xd')],'exitAt':_0x4bf9aa,'duration':moment(_0x4bf9aa)[_0xb824('0xe')](_0x3906c7[_0xb824('0xd')],_0xb824('0xf')),'data1':_0xb824('0x10'),'data2':_0x3906c7[_0xb824('0x11')],'data3':_0x3906c7[_0xb824('0x12')],'data4':null,'data5':_0x3906c7[_0xb824('0x13')],'role':'agent','internal':_0x3906c7[_0xb824('0x14')]?_[_0xb824('0x15')](_0x3906c7[_0xb824('0x14')]):undefined,'uniqueid':_0x3906c7['uniqueid']},'log':_0xb824('0x16')});};exports[_0xb824('0x17')]=function(_0x423c26){return client['Request'](_0xb824('0x16'),{'body':{'channel':_0xb824('0x7'),'membername':_0x423c26['membername'],'interface':_0x423c26[_0xb824('0xa')],'type':_0xb824('0xc'),'enterAt':_0x423c26[_0xb824('0x18')],'exitAt':_0x423c26['endtime'],'duration':moment(_0x423c26[_0xb824('0x19')])[_0xb824('0xe')](_0x423c26[_0xb824('0x18')],_0xb824('0xf'))>=0x0?moment(_0x423c26['endtime'])['diff'](_0x423c26[_0xb824('0x18')],_0xb824('0xf')):null,'data1':_0xb824('0x1a'),'data2':_0x423c26[_0xb824('0x14')],'data3':_0x423c26[_0xb824('0x12')],'data4':_0x423c26[_0xb824('0x1b')]||null,'role':_0xb824('0x1c'),'internal':_0x423c26[_0xb824('0x14')]?_[_0xb824('0x15')](_0x423c26[_0xb824('0x14')]):undefined,'uniqueid':_0x423c26[_0xb824('0x1d')]},'log':_0xb824('0x16')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 3b595ed..86cc71b 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 _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 +var _0x5a1c=['GetSettings','../client','getSettings','stopRecordingOnTransfer'];(function(_0x565e69,_0x3461b5){var _0x5e4884=function(_0x1cd2f9){while(--_0x1cd2f9){_0x565e69['push'](_0x565e69['shift']());}};_0x5e4884(++_0x3461b5);}(_0x5a1c,0x1b5));var _0xc5a1=function(_0x35bad7,_0x3e6e33){_0x35bad7=_0x35bad7-0x0;var _0x52f8ce=_0x5a1c[_0x35bad7];return _0x52f8ce;};'use strict';var client=require(_0xc5a1('0x0'));exports[_0xc5a1('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc5a1('0x2'),'previewRecallmeReminderInterval']},'log':_0xc5a1('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 719ef0e..25c063f 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 _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 +var _0x0289=['name','html','../client','getTemplates','Request','GetTemplate'];(function(_0x427435,_0x4e76ec){var _0x2442a0=function(_0x182282){while(--_0x182282){_0x427435['push'](_0x427435['shift']());}};_0x2442a0(++_0x4e76ec);}(_0x0289,0x14c));var _0x9028=function(_0x10a889,_0x220612){_0x10a889=_0x10a889-0x0;var _0x3b5ed3=_0x0289[_0x10a889];return _0x3b5ed3;};'use strict';var client=require(_0x9028('0x0'));exports[_0x9028('0x1')]=function(_0x516441){return function(_0x41b478){return client[_0x9028('0x2')](_0x9028('0x3'),{'options':{'raw':!![],'attributes':['id',_0x9028('0x4'),_0x9028('0x5')]},'log':_0x9028('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 106a2c2..05cab0a 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 _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 +var _0x9064=['GetTrigger','name','channel','Condition','AllConditions','operator','value','AnyConditions','field','Action','action','data2','data3','data4','data6','data7','getTriggers','Request'];(function(_0x4e38db,_0x153522){var _0x106544=function(_0x1fd495){while(--_0x1fd495){_0x4e38db['push'](_0x4e38db['shift']());}};_0x106544(++_0x153522);}(_0x9064,0x178));var _0x4906=function(_0x1537d0,_0x2bf71d){_0x1537d0=_0x1537d0-0x0;var _0x4d4bfe=_0x9064[_0x1537d0];return _0x4d4bfe;};'use strict';var client=require('../client');exports[_0x4906('0x0')]=function(_0x394842){return function(_0x4e0361){return client[_0x4906('0x1')](_0x4906('0x2'),{'options':{'raw':![],'attributes':['id',_0x4906('0x3'),_0x4906('0x4'),'status'],'include':[{'model':_0x4906('0x5'),'as':_0x4906('0x6'),'attributes':['id','field',_0x4906('0x7'),_0x4906('0x8')]},{'model':'Condition','as':_0x4906('0x9'),'attributes':['id',_0x4906('0xa'),_0x4906('0x7'),_0x4906('0x8')]},{'model':_0x4906('0xb'),'as':'Actions','attributes':['id',_0x4906('0xc'),'data1',_0x4906('0xd'),_0x4906('0xe'),_0x4906('0xf'),'data5',_0x4906('0x10'),_0x4906('0x11')]}]},'log':_0x4906('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index a41cd5d..8f252ad 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 _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 +var _0x8d98=['name','registry','defaultuser','../client','getTrunks','GetTrunk'];(function(_0x540732,_0x304900){var _0x305c2a=function(_0xef391a){while(--_0xef391a){_0x540732['push'](_0x540732['shift']());}};_0x305c2a(++_0x304900);}(_0x8d98,0x1a7));var _0x88d9=function(_0x2043e4,_0x5bb36f){_0x2043e4=_0x2043e4-0x0;var _0x309ffb=_0x8d98[_0x2043e4];return _0x309ffb;};'use strict';var client=require(_0x88d9('0x0'));exports[_0x88d9('0x1')]=function(_0x407a59){return function(_0x442ccd){return client['Request'](_0x88d9('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x88d9('0x3'),_0x88d9('0x4'),_0x88d9('0x5')]},'log':_0x88d9('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 69201bd..f558b66 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_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 +var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x299c38,_0x421b9f){var _0x501076=function(_0x47ba54){while(--_0x47ba54){_0x299c38['push'](_0x299c38['shift']());}};_0x501076(++_0x421b9f);}(_0x70e0,0x17b));var _0x070e=function(_0x274f3b,_0x4d8b0f){_0x274f3b=_0x274f3b-0x0;var _0x17db5b=_0x70e0[_0x274f3b];return _0x17db5b;};'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 1f53c95..192f659 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 _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 +var _0xba9a=['update','UpdateVoiceAgentReport','create','Request','CreateVoiceAgentReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba9a,0x17e));var _0xaba9=function(_0x294d7f,_0x4dc59d){_0x294d7f=_0x294d7f-0x0;var _0x1156b5=_0xba9a[_0x294d7f];return _0x1156b5;};'use strict';var client=require('../client');exports[_0xaba9('0x0')]=function(_0x327547){return client[_0xaba9('0x1')](_0xaba9('0x2'),{'body':_0x327547,'log':_0xaba9('0x2')});};exports[_0xaba9('0x3')]=function(_0x4ccc09,_0x1ba32e,_0x33326f){return client[_0xaba9('0x1')]('UpdateVoiceAgentReport',{'body':_0x4ccc09,'options':{'where':{'uniqueid':_0x1ba32e,'interface':_0x33326f,'agentcomplete':!![]}},'log':_0xaba9('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index e125938..490203d 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 _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 +var _0xcf55=['../client','create','Request','CreateVoiceCallReport','calleridnum','context','callerid','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','duration','billableseconds','GetVoiceCallReports','moment','lodash'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xcf55,0x1b7));var _0x5cf5=function(_0x4ada50,_0x54757b){_0x4ada50=_0x4ada50-0x0;var _0x3d85d5=_0xcf55[_0x4ada50];return _0x3d85d5;};'use strict';var moment=require(_0x5cf5('0x0'));var util=require('util');var _=require(_0x5cf5('0x1'));var client=require(_0x5cf5('0x2'));exports[_0x5cf5('0x3')]=function(_0x175951){return client[_0x5cf5('0x4')](_0x5cf5('0x5'),{'body':_['merge'](_0x175951,{'source':_0x175951[_0x5cf5('0x6')],'destinationcontext':_0x175951[_0x5cf5('0x7')],'callerid':_0x175951[_0x5cf5('0x8')],'amaflags':'DOCUMENTATION'}),'log':_0x5cf5('0x5')});};exports[_0x5cf5('0x9')]=function(){return function(){return client[_0x5cf5('0x4')](_0x5cf5('0xa'),{'options':{'where':{'type':[_0x5cf5('0xb')],'createdAt':{'$between':[moment()[_0x5cf5('0xc')](_0x5cf5('0xd'))[_0x5cf5('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x5cf5('0xf')]('day')[_0x5cf5('0xe')](_0x5cf5('0x10'))]}},'attributes':[_0x5cf5('0x11'),'disposition',_0x5cf5('0x12'),_0x5cf5('0x13')]},'log':_0x5cf5('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index f4b9a39..5a9e80b 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 _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 +var _0x054c=['../client','create','CreateVoiceDialReport'];(function(_0x36141e,_0x584aad){var _0x115fba=function(_0x49b235){while(--_0x49b235){_0x36141e['push'](_0x36141e['shift']());}};_0x115fba(++_0x584aad);}(_0x054c,0x1dd));var _0xc054=function(_0x2c4c00,_0x2b0f28){_0x2c4c00=_0x2c4c00-0x0;var _0x1cc943=_0x054c[_0x2c4c00];return _0x1cc943;};'use strict';var client=require(_0xc054('0x0'));exports[_0xc054('0x1')]=function(_0x3f23b7){return client['Request'](_0xc054('0x2'),{'body':_0x3f23b7,'log':_0xc054('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index fa975e8..2bd7843 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 _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 +var _0x6f7a=['../client','getVoiceExtensions','Request','GetVoiceExtension','recordingFormat'];(function(_0x5b3f83,_0x2801c5){var _0x47ee75=function(_0x40509a){while(--_0x40509a){_0x5b3f83['push'](_0x5b3f83['shift']());}};_0x47ee75(++_0x2801c5);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x2087b4,_0x1b050e){_0x2087b4=_0x2087b4-0x0;var _0x27c480=_0x6f7a[_0x2087b4];return _0x27c480;};'use strict';var client=require(_0xa6f7('0x0'));exports[_0xa6f7('0x1')]=function(){return function(){return client[_0xa6f7('0x2')](_0xa6f7('0x3'),{'options':{'raw':!![],'attributes':['id','exten',_0xa6f7('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xa6f7('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index bb85c70..51fe2cf 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 _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 +var _0x70ae=['mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','Pause','mandatoryDispositionPause','callerid','active','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','monitor_format','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialOriginateCallerIdName','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialAMDActive','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency'];(function(_0x277fa3,_0x3b2dde){var _0x2e4520=function(_0x209eab){while(--_0x209eab){_0x277fa3['push'](_0x277fa3['shift']());}};_0x2e4520(++_0x3b2dde);}(_0x70ae,0xad));var _0xe70a=function(_0x395b75,_0x5e4170){_0x395b75=_0x395b75-0x0;var _0x21f76c=_0x70ae[_0x395b75];return _0x21f76c;};'use strict';var client=require(_0xe70a('0x0'));exports[_0xe70a('0x1')]=function(){return function(){return client[_0xe70a('0x2')](_0xe70a('0x3'),{'options':{'raw':![],'attributes':['id',_0xe70a('0x4'),_0xe70a('0x5'),'acwTimeout','autopause',_0xe70a('0x6'),'type',_0xe70a('0x7'),'dialMethod',_0xe70a('0x8'),_0xe70a('0x9'),_0xe70a('0xa'),_0xe70a('0xb'),'dialPredictiveOptimizationPercentage','dialPredictiveInterval',_0xe70a('0xc'),'dialOriginateCallerIdNumber','dialOriginateTimeout',_0xe70a('0xd'),_0xe70a('0xe'),_0xe70a('0xf'),_0xe70a('0x10'),_0xe70a('0x11'),'dialBusyMaxRetry',_0xe70a('0x12'),_0xe70a('0x13'),_0xe70a('0x14'),_0xe70a('0x15'),_0xe70a('0x16'),'dialGlobalInterval',_0xe70a('0x17'),'dialCheckDuplicateType',_0xe70a('0x18'),'dialAMDInitialSilence',_0xe70a('0x19'),'dialAMDAfterGreetingSilence',_0xe70a('0x1a'),_0xe70a('0x1b'),'dialAMDBetweenWordsSilence',_0xe70a('0x1c'),_0xe70a('0x1d'),'dialAMDMaximumWordLength',_0xe70a('0x1e'),'dialRecallMeTimeout','dialRecallInQueue',_0xe70a('0x1f'),'dialAgiAfterHangupAgent',_0xe70a('0x20'),_0xe70a('0x21'),_0xe70a('0x6'),'strategy',_0xe70a('0x22'),_0xe70a('0x23'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency',_0xe70a('0x24'),_0xe70a('0x25'),_0xe70a('0x26'),'dialAbandonedRetryFrequency',_0xe70a('0x27'),_0xe70a('0x28'),_0xe70a('0x29'),_0xe70a('0x2a'),_0xe70a('0x2b'),_0xe70a('0x2c'),_0xe70a('0x2d'),_0xe70a('0x2e'),'dialPreviewRecallmeReminder'],'include':[{'model':_0xe70a('0x2f'),'as':_0xe70a('0x2f'),'attributes':['id',_0xe70a('0x4'),'callerid','active']},{'model':_0xe70a('0x30'),'as':_0xe70a('0x31'),'attributes':['id',_0xe70a('0x4')]},{'model':_0xe70a('0x2f'),'as':'TrunkBackup','attributes':['id',_0xe70a('0x4'),_0xe70a('0x32'),_0xe70a('0x33')]},{'model':_0xe70a('0x34'),'as':'Interval','attributes':['id',_0xe70a('0x4')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0xe70a('0x4'),_0xe70a('0x35')]}]}]},'log':_0xe70a('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 3fedcc9..791cbdb 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(_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 +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(_0x2d7b3f,_0x5c6735){var _0x3eb39d=function(_0x55c1ab){while(--_0x55c1ab){_0x2d7b3f['push'](_0x2d7b3f['shift']());}};_0x3eb39d(++_0x5c6735);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 064fea6..a1d980d 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 _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 +var _0xca05=['getVoiceQueueRtPauses','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca05,0x7f));var _0x5ca0=function(_0xc2c0c3,_0x2bf8a9){_0xc2c0c3=_0xc2c0c3-0x0;var _0x292acf=_0xca05[_0xc2c0c3];return _0x292acf;};'use strict';var client=require(_0x5ca0('0x0'));exports[_0x5ca0('0x1')]=function(_0x6f2f85){return function(){return client['Request']('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x6f2f85,'paused':!![]},'raw':!![]},'log':_0x5ca0('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 65b1ec7..f3c3e55 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_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 +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x4d731f,_0x27ef41){var _0x215b83=function(_0x469304){while(--_0x469304){_0x4d731f['push'](_0x4d731f['shift']());}};_0x215b83(++_0x27ef41);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index d4dbba1..aa725e7 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 _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 +var _0x9c72=['transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','context','extension','blind','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode'];(function(_0x38da7c,_0x646a68){var _0x98dfc4=function(_0x35933c){while(--_0x35933c){_0x38da7c['push'](_0x38da7c['shift']());}};_0x98dfc4(++_0x646a68);}(_0x9c72,0xcd));var _0x29c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c72[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x29c7('0x0')]={};exports[_0x29c7('0x1')]=function(_0x8c64bd){return client[_0x29c7('0x2')](_0x29c7('0x3'),{'body':{'result':_0x8c64bd[_0x29c7('0x4')],'transfererchannel':_0x8c64bd[_0x29c7('0x5')],'transferercalleridnum':_0x8c64bd[_0x29c7('0x6')],'transferercalleridname':_0x8c64bd[_0x29c7('0x7')],'transfererconnectedlinenum':_0x8c64bd['transfererconnectedlinenum'],'transfererconnectedlinename':_0x8c64bd[_0x29c7('0x8')],'transfereraccountcode':_0x8c64bd[_0x29c7('0x9')],'transferercontext':_0x8c64bd[_0x29c7('0xa')],'transfererexten':_0x8c64bd[_0x29c7('0xb')],'transfererlinkedid':_0x8c64bd[_0x29c7('0xc')],'transfereechannel':_0x8c64bd[_0x29c7('0xd')],'transfereecalleridnum':_0x8c64bd[_0x29c7('0xe')],'transfereecalleridname':_0x8c64bd[_0x29c7('0xf')],'transfereeconnectedlinenum':_0x8c64bd[_0x29c7('0x10')],'transfereeconnectedlinename':_0x8c64bd[_0x29c7('0x11')],'transfereeaccountcode':_0x8c64bd[_0x29c7('0x12')],'transfereecontext':_0x8c64bd[_0x29c7('0x13')],'transfereeexten':_0x8c64bd['transfereeexten'],'transfereelinkedid':_0x8c64bd[_0x29c7('0x14')],'isexternal':_0x8c64bd[_0x29c7('0x15')],'context':_0x8c64bd[_0x29c7('0x16')],'extension':_0x8c64bd[_0x29c7('0x17')],'type':_0x29c7('0x18')},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0xfb21e5){return client[_0x29c7('0x2')](_0x29c7('0x3'),{'body':{'result':_0xfb21e5[_0x29c7('0x4')],'transfererchannel':_0xfb21e5[_0x29c7('0x19')],'transferercalleridnum':_0xfb21e5[_0x29c7('0x1a')],'transferercalleridname':_0xfb21e5[_0x29c7('0x1b')],'transfererconnectedlinenum':_0xfb21e5[_0x29c7('0x1c')],'transfererconnectedlinename':_0xfb21e5[_0x29c7('0x1d')],'transfereraccountcode':_0xfb21e5[_0x29c7('0x1e')],'transferercontext':_0xfb21e5[_0x29c7('0x1f')],'transfererexten':_0xfb21e5['secondtransfererexten'],'transfererlinkedid':_0xfb21e5[_0x29c7('0x20')],'transfereechannel':_0xfb21e5[_0x29c7('0x21')],'transfereecalleridnum':_0xfb21e5[_0x29c7('0x22')],'transfereecalleridname':_0xfb21e5[_0x29c7('0x23')],'transfereeconnectedlinenum':_0xfb21e5[_0x29c7('0x24')],'transfereeconnectedlinename':_0xfb21e5['transfertargetconnectedlinename'],'transfereeaccountcode':_0xfb21e5['transfertargetaccountcode'],'transfereecontext':_0xfb21e5[_0x29c7('0x25')],'transfereeexten':_0xfb21e5[_0x29c7('0x26')],'transfereelinkedid':_0xfb21e5[_0x29c7('0x27')],'isexternal':_0xfb21e5[_0x29c7('0x15')],'context':_0xfb21e5[_0x29c7('0x28')],'extension':_0xfb21e5[_0x29c7('0x29')],'type':_0x29c7('0x2a')},'log':_0x29c7('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 0f4a447..2e0de7d 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_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 +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(_0xaafe34,_0x207ba9){var _0x4c4468=function(_0x3cb01d){while(--_0x3cb01d){_0xaafe34['push'](_0xaafe34['shift']());}};_0x4c4468(++_0x207ba9);}(_0x7a54,0x106));var _0x47a5=function(_0xcbd842,_0x3aa012){_0xcbd842=_0xcbd842-0x0;var _0x2af4ba=_0x7a54[_0xcbd842];return _0x2af4ba;};'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 abf1bee..5e3e6e2 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 _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 +var _0x22be=['destcalleridname','','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','format','user:%s','trigger:%s','action','toLowerCase','merge','bluebird','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','data2','data5','xmd-contactid','ListId','data3','split','phone','$or','map','destcalleridnum','calleridnum','routeId','firstName','lastName','mobile','fax','createdAt','scheduledAt','union','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','data4','isNil','calleridname','Unknown'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x22be,0x15c));var _0xe22b=function(_0x170772,_0x1f1ee7){_0x170772=_0x170772-0x0;var _0x3ef69c=_0x22be[_0x170772];return _0x3ef69c;};'use strict';var _=require('lodash');var BPromise=require(_0xe22b('0x0'));var Redis=require('ioredis');var util=require(_0xe22b('0x1'));var config=require(_0xe22b('0x2'));var logger=require(_0xe22b('0x3'))(_0xe22b('0x4'));var cmContactRpc=require(_0xe22b('0x5'));config['redis']=_[_0xe22b('0x6')](config[_0xe22b('0x7')],{'host':_0xe22b('0x8'),'port':0x18eb});var io=require(_0xe22b('0x9'))(new Redis(config[_0xe22b('0x7')]));function emit(_0x427ec1,_0x29f99e,_0x2bf021,_0xfa1745,_0x772ed9){logger[_0xe22b('0xa')](_0xe22b('0xb'),_0x427ec1,_0x29f99e['id'],_0x2bf021,_0xfa1745,JSON['stringify'](_0x772ed9));io['to'](_0x2bf021)[_0xe22b('0xc')](_0xfa1745,_0x772ed9);}exports['exec']=function(_0x277159,_0x26925f,_0x16fc68,_0x2c54ea){var _0x1a3df9,_0x5785a9;var _0x174571={};var _0x5537be;var _0x255607=Number(_0x16fc68['data1']);var _0x31f89f=_0x16fc68[_0xe22b('0xd')]?Boolean(Number(_0x16fc68[_0xe22b('0xd')])):![];var _0x37779c;var _0x276203=![];if(!_['isNil'](_0x16fc68[_0xe22b('0xe')])){if(_0x16fc68[_0xe22b('0xe')]=='1')_0x276203=!![];}if(!_0x276203){if(_0x2c54ea['xmd-contactid']){_0x174571['id']=_0x2c54ea[_0xe22b('0xf')];}}if(!_0x174571['id']){_0x174571[_0xe22b('0x10')]=_0x255607;_0x37779c=_0x16fc68[_0xe22b('0x11')]&&_0x16fc68['data3']!=='0'?_0x16fc68[_0xe22b('0x11')][_0xe22b('0x12')](','):[_0xe22b('0x13')];_0x174571[_0xe22b('0x14')]=_[_0xe22b('0x15')](_0x37779c,function(_0x4f43f0){var _0x355088={};_0x355088[_0x4f43f0]=_0x2c54ea['routeId']?_0x2c54ea[_0xe22b('0x16')]:_0x2c54ea[_0xe22b('0x17')];return _0x355088;});_0x5537be=_0x2c54ea[_0xe22b('0x18')]?_0x2c54ea['destcalleridnum']:_0x2c54ea[_0xe22b('0x17')];}var _0x4510a9=['id',_0xe22b('0x19'),_0xe22b('0x1a'),_0xe22b('0x13'),_0xe22b('0x1b'),_0xe22b('0x1c'),_0xe22b('0x10'),_0xe22b('0x1d'),_0xe22b('0x1e'),'updatedAt'];var _0xc6c9b7=_[_0xe22b('0x1f')](_0x4510a9,_0x37779c);BPromise['resolve']()[_0xe22b('0x20')](cmContactRpc[_0xe22b('0x21')]({'attributes':_0xc6c9b7,'where':_0x174571,'phone':_0x5537be}))[_0xe22b('0x20')](function(_0x169e8c){_0x5785a9=_0x169e8c;if(!_[_0xe22b('0x22')](_0x5785a9)){if(_0x5785a9[_0xe22b('0x23')]===0x1){_0x1a3df9=_0x5785a9[0x0];logger['info'](_0xe22b('0x24'),_0x2c54ea[_0xe22b('0x25')],_0x26925f['id'],_0x1a3df9['id']);}else{logger[_0xe22b('0xa')](_0xe22b('0x26'),_0x2c54ea[_0xe22b('0x25')],_0x26925f['id'],_[_0xe22b('0x15')](_0x5785a9,'id')[_0xe22b('0x27')](','));}return;}else{logger[_0xe22b('0xa')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x2c54ea[_0xe22b('0x25')],_0x26925f['id']);var _0x4293a1={'ListId':_0x255607};var _0x5f2a2e=_0x16fc68[_0xe22b('0x28')]&&_0x16fc68[_0xe22b('0x28')]!=='0'?_0x16fc68[_0xe22b('0x28')]:'phone';if(_0x31f89f){logger[_0xe22b('0xa')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x2c54ea[_0xe22b('0x25')],_0x26925f['id']);_0x4293a1[_0x5f2a2e]=_[_0xe22b('0x29')](_0x2c54ea[_0xe22b('0x18')])?_0x2c54ea['calleridnum']:_0x2c54ea[_0xe22b('0x16')];if(_['isNil'](_0x2c54ea['routeId'])){_0x4293a1[_0xe22b('0x19')]=_0x2c54ea[_0xe22b('0x2a')]&&_0x2c54ea[_0xe22b('0x2a')]!==''?_0x2c54ea[_0xe22b('0x2a')]:_0xe22b('0x2b');}else{_0x4293a1[_0xe22b('0x19')]=_0x2c54ea[_0xe22b('0x2c')]&&_0x2c54ea['destcalleridname']!==_0xe22b('0x2d')?_0x2c54ea[_0xe22b('0x2c')]:_0xe22b('0x2b');}return BPromise[_0xe22b('0x2e')]()['then'](cmContactRpc[_0xe22b('0x2f')](_0x4293a1))['then'](function(_0x168b1b){_0x1a3df9=_0x168b1b;_0x5785a9[_0xe22b('0x30')](_0x168b1b);if(_0x1a3df9){logger['info'](_0xe22b('0x31'),_0x2c54ea[_0xe22b('0x25')],_0x26925f['id'],_0x1a3df9['id']);}return;});}else{logger[_0xe22b('0xa')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x2c54ea[_0xe22b('0x25')],_0x26925f['id']);_0x4293a1[_0x5f2a2e]=_[_0xe22b('0x29')](_0x2c54ea[_0xe22b('0x18')])?_0x2c54ea[_0xe22b('0x17')]:_0x2c54ea[_0xe22b('0x16')];if(_[_0xe22b('0x29')](_0x2c54ea[_0xe22b('0x18')])){_0x4293a1[_0xe22b('0x19')]=_0x2c54ea['calleridname']&&_0x2c54ea['calleridname']!==_0xe22b('0x2d')?_0x2c54ea[_0xe22b('0x2a')]:'Unknown';}else{_0x4293a1[_0xe22b('0x19')]=_0x2c54ea[_0xe22b('0x2c')]&&_0x2c54ea['destcalleridname']!==_0xe22b('0x2d')?_0x2c54ea[_0xe22b('0x2c')]:'Unknown';}_0x1a3df9=_0x4293a1;_0x5785a9[_0xe22b('0x30')](_0x4293a1);return;}}})['then'](function(){if(_0x277159){emit(_0x2c54ea['uniqueid'],_0x26925f,util[_0xe22b('0x32')](_0xe22b('0x33'),_0x277159['name']),util['format'](_0xe22b('0x34'),_0x16fc68[_0xe22b('0x35')][_0xe22b('0x36')]()),{'evt':_[_0xe22b('0x37')](_0x2c54ea,{'autoCreate':_0x31f89f}),'contact':_0x1a3df9===undefined?{}:_0x1a3df9,'contacts':_0x5785a9['length']===0x0?undefined:_0x5785a9});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 4864283..8e98050 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 _0x2edf=['AllConditions','every','checkConditions','some','AnyConditions','checkTrigger:\x20trigger','evt','field','ChatWebsiteId','operator','AccountId','value','upperFirst','interaction','event','agent','membername','lastevent','mailSubstatus','null','substatus','undefined','created','exports','util','lodash','url','./integration','./cmContact','./script','trigger','../ami','defaults','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:amd','custom:queuecallerabandon','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','custom:offlineMessage','emit','info','stringify','prototype','motionChannel','voice','debug','inspect','interface','checkTriggers','hasOwnProperty','checkTrigger','merge','variables','Actions','length','toLowerCase','contactmanager','motionbar','browser','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','data3','isNil','data4','location','uriLocation','data5','windowHeight','data6','600','winApplication','winArguments','format','user:%s','name','trigger:%s:%s','action','data1','jscripty','trigger:%s','exec','integration','queue','routeId','urlforward','parse','query','replace','channel'];(function(_0x12015b,_0x5b4562){var _0x132680=function(_0x329bb9){while(--_0x329bb9){_0x12015b['push'](_0x12015b['shift']());}};_0x132680(++_0x5b4562);}(_0x2edf,0x94));var _0xf2ed=function(_0x404eed,_0x5390c5){_0x404eed=_0x404eed-0x0;var _0xd45887=_0x2edf[_0x404eed];return _0xd45887;};'use strict';var util=require(_0xf2ed('0x0'));var _=require(_0xf2ed('0x1'));var url=require(_0xf2ed('0x2'));var Mustache=require('mustache');var Redis=require('ioredis');var urlforward=require('./urlforward');var integration=require(_0xf2ed('0x3'));var cmContact=require(_0xf2ed('0x4'));var script=require(_0xf2ed('0x5'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xf2ed('0x6'));var ami=require(_0xf2ed('0x7'));config['redis']=_[_0xf2ed('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xf2ed('0x9'))(new Redis(config['redis']));var operators={'equals':function(_0x330c9d,_0x2daebf){return _0x330c9d==_0x2daebf;},'not_equals':function(_0x97d52a,_0x1d12f6){return _0x97d52a!=_0x1d12f6;}};var barAndWebActions=[_0xf2ed('0xa'),'url',_0xf2ed('0xb')];function Trigger(_0x3021f7){this['triggers']=_0x3021f7[_0xf2ed('0xc')];this['agents']=_0x3021f7[_0xf2ed('0xd')];this[_0xf2ed('0xe')]=_0x3021f7[_0xf2ed('0xe')];this['templates']=_0x3021f7['templates'];this[_0xf2ed('0xf')]=_0x3021f7[_0xf2ed('0xf')];this['zendeskAccounts']=_0x3021f7[_0xf2ed('0x10')];this[_0xf2ed('0x11')]=_0x3021f7[_0xf2ed('0x11')];this['salesforceAccounts']=_0x3021f7[_0xf2ed('0x12')];this[_0xf2ed('0x13')]=_0x3021f7[_0xf2ed('0x13')];this['zohoAccounts']=_0x3021f7[_0xf2ed('0x14')];this[_0xf2ed('0x15')]=_0x3021f7['deskAccounts'];this['vtigerAccounts']=_0x3021f7[_0xf2ed('0x16')];this[_0xf2ed('0x17')]=_0x3021f7[_0xf2ed('0x17')];this[_0xf2ed('0x18')]=_0x3021f7[_0xf2ed('0x18')];this[_0xf2ed('0x19')]=_0x3021f7[_0xf2ed('0x19')];this[_0xf2ed('0x1a')]={'zendesk':this[_0xf2ed('0x10')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0xf2ed('0x11')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0xf2ed('0x14')],'desk':this[_0xf2ed('0x15')],'vtiger':this[_0xf2ed('0x16')],'dynamics365':this[_0xf2ed('0x18')],'freshsales':this[_0xf2ed('0x19')],'servicenow':this['servicenowAccounts']};ami['on'](_0xf2ed('0x1b'),this[_0xf2ed('0x1c')][_0xf2ed('0x1d')](this));ami['on'](_0xf2ed('0x1e'),this[_0xf2ed('0x1c')][_0xf2ed('0x1d')](this));ami['on'](_0xf2ed('0x1f'),this['syncCustomEvent'][_0xf2ed('0x1d')](this));ami['on'](_0xf2ed('0x20'),this['syncCustomEvent'][_0xf2ed('0x1d')](this));ami['on']('custom:agentnosuchnumber',this['syncCustomEvent'][_0xf2ed('0x1d')](this));ami['on']('custom:agentnoanswer',this[_0xf2ed('0x1c')]['bind'](this));ami['on']('custom:agentbusy',this['syncCustomEvent'][_0xf2ed('0x1d')](this));ami['on']('custom:agentcongestion',this['syncCustomEvent'][_0xf2ed('0x1d')](this));ami['on']('custom:agentreject',this['syncCustomEvent'][_0xf2ed('0x1d')](this));ami['on'](_0xf2ed('0x21'),this[_0xf2ed('0x1c')]['bind'](this));ami['on'](_0xf2ed('0x22'),this['syncCustomEvent'][_0xf2ed('0x1d')](this));ami['on']('custom:timeout',this['syncCustomEvent'][_0xf2ed('0x1d')](this));ami['on'](_0xf2ed('0x23'),this[_0xf2ed('0x24')][_0xf2ed('0x1d')](this));ami['on'](_0xf2ed('0x25'),this[_0xf2ed('0x24')][_0xf2ed('0x1d')](this));ami['on'](_0xf2ed('0x26'),this[_0xf2ed('0x24')]['bind'](this));ami['on'](_0xf2ed('0x27'),this['syncCustomEvent']['bind'](this));ami['on']('custom:closedinteraction',this[_0xf2ed('0x1c')]['bind'](this));ami['on'](_0xf2ed('0x28'),this['syncCustomEvent']['bind'](this));ami['on'](_0xf2ed('0x29'),this['syncCustomEvent'][_0xf2ed('0x1d')](this));ami['on'](_0xf2ed('0x2a'),this[_0xf2ed('0x1c')]['bind'](this));ami['on']('custom:acceptmessage',this[_0xf2ed('0x1c')][_0xf2ed('0x1d')](this));ami['on'](_0xf2ed('0x2b'),this[_0xf2ed('0x1c')][_0xf2ed('0x1d')](this));ami['on'](_0xf2ed('0x2c'),this[_0xf2ed('0x1c')]['bind'](this));}Trigger['prototype'][_0xf2ed('0x2d')]=function(_0xa2bbd8,_0x1e77f4,_0x212364){logger[_0xf2ed('0x2e')](_0xa2bbd8,_0x1e77f4,JSON[_0xf2ed('0x2f')](_0x212364));io['to'](_0xa2bbd8)[_0xf2ed('0x2d')](_0x1e77f4,_0x212364);};Trigger[_0xf2ed('0x30')][_0xf2ed('0x1c')]=function(_0x42b774){var _0x17c5cc=_['clone'](_0x42b774);if(typeof _0x17c5cc[_0xf2ed('0x31')]==='undefined'){_0x17c5cc[_0xf2ed('0x31')]=_0xf2ed('0x32');}logger[_0xf2ed('0x33')]('syncCustomEvent',util[_0xf2ed('0x34')](_0x17c5cc,{'showHidden':!![],'depth':null}));this['checkTriggers'](_0x17c5cc);};Trigger[_0xf2ed('0x30')][_0xf2ed('0x24')]=function(_0x23eaf2){if(this[_0xf2ed('0xd')][_0x23eaf2[_0xf2ed('0x35')]]){this[_0xf2ed('0x1c')](_0x23eaf2);}};Trigger[_0xf2ed('0x30')][_0xf2ed('0x36')]=function(_0x15d9e1){var _0x1d07d5;for(var _0x34c2f9 in this['triggers']){if(this[_0xf2ed('0xc')][_0xf2ed('0x37')](_0x34c2f9)){if(this['triggers'][_0x34c2f9]['status']){_0x1d07d5=this[_0xf2ed('0x38')](this[_0xf2ed('0xc')][_0x34c2f9],_0x15d9e1);if(_0x1d07d5){_[_0xf2ed('0x39')](_0x15d9e1,_0x15d9e1[_0xf2ed('0x3a')]);for(var _0x1c4652=0x0,_0x1262e3,_0x324f34,_0x33a845;_0x1c46520x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file +var _0x5fc3=['map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','custom_fields','variable','variableName','idField','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','recordingURL','The\x20User\x20ID\x20is:','destcalleridnum','Ticket\x20created!','[OUTBOUND]','unmanaged','lastevent','Recording\x20is\x20enabled!','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','remoteUri','total_entries','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','%s/users/me','debug','stringify','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4695ba,_0x5a7f2a){_0x4695ba=_0x4695ba-0x0;var _0x524b7d=_0x5fc3[_0x4695ba];return _0x524b7d;};'use strict';var _=require(_0x35fc('0x0'));var rp=require(_0x35fc('0x1'));var md5=require('md5');var util=require(_0x35fc('0x2'));var Redis=require(_0x35fc('0x3'));var intUtil=require(_0x35fc('0x4'));var config=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('desk');config[_0x35fc('0x7')]=_[_0x35fc('0x8')](config[_0x35fc('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x35fc('0x7')]));function emit(_0x508b32,_0x16e153,_0x27524f){io['to'](_0x508b32)[_0x35fc('0x9')](_0x16e153,_0x27524f);}var headers={'Content-Type':_0x35fc('0xa'),'Accept':_0x35fc('0xa')};function getUser(_0xf9d3a6,_0x2051ab){if(intUtil['validateEmail'](_0x2051ab)===!![]){logger[_0x35fc('0xb')](_0x35fc('0xc'),_0x2051ab);return request({'uri':util['format'](_0x35fc('0xd'),_0xf9d3a6[_0x35fc('0xe')])})['then'](function(_0xda83fb){if(_0xda83fb[_0x35fc('0xf')]){return _['find'](_0xda83fb['_embedded'][_0x35fc('0x10')],{'email':_0x2051ab});}})['then'](function(_0x397738){if(_0x397738){logger[_0x35fc('0xb')](_0x35fc('0x11'));return _0x397738;}else{logger[_0x35fc('0xb')](_0x35fc('0x12'));return request({'uri':util['format']('%s/users/me',_0xf9d3a6['remoteUri'])});}});}else{logger['info'](_0x35fc('0x13'));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x15'),_0xf9d3a6[_0x35fc('0xe')])});}}function request(_0x227a49){logger[_0x35fc('0x16')]('[HTTP]',JSON[_0x35fc('0x17')](_0x227a49));return rp(_[_0x35fc('0x8')](_0x227a49,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x41e165){var _0x363e47;if(_0x41e165[_0x35fc('0x18')]==='basic'){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x19'),_0x41e165[_0x35fc('0x1a')],_0x41e165['password']);}else if(_0x41e165[_0x35fc('0x18')]===_0x35fc('0x1b')){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x1c'),_0x41e165[_0x35fc('0x1a')],_0x41e165[_0x35fc('0x1b')]);}return util[_0x35fc('0x14')](_0x35fc('0x1d'),new Buffer(_0x363e47)[_0x35fc('0x1e')](_0x35fc('0x1f')));}function getEndUser(_0x5bd2b8,_0x323aee,_0xd5399f){logger[_0x35fc('0xb')](_0x35fc('0x20'),_0xd5399f);return request({'uri':util[_0x35fc('0x14')]('%s/customers/search',_0x5bd2b8[_0x35fc('0xe')]),'qs':{'phone':_0xd5399f}})[_0x35fc('0x21')](function(_0x561bf8){if(_0x561bf8[_0x35fc('0xf')]){logger[_0x35fc('0xb')](_0x35fc('0x22'));return _0x561bf8['_embedded'][_0x35fc('0x10')][0x0];}else{logger['info'](_0x35fc('0x23'));return request({'uri':util[_0x35fc('0x14')]('%s/customers',_0x5bd2b8['remoteUri']),'method':_0x35fc('0x24'),'body':{'first_name':_0x323aee,'title':_0x323aee,'phone_numbers':[{'type':'work','value':_0xd5399f}]}});}});}function getTags(_0x274208,_0x1a5d92){var _0x57001c=[];if(_0x274208&&_0x274208[_0x35fc('0x25')]>0x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ 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 d33abef..e449da0 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 _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 +var _0x6d3e=['isdisabled','info','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','calleridnum','/systemusers(','Bearer\x20','body','odata-entityid','substring','lastIndexOf','enduserId','catch','destcalleridnum','GET','contacts?$select=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20created!','forEach','includes','picklist','type','idField','indexOf','content','ticketType','incident','assign','getString','/contacts(','phonecall','callDirection','queue','phonecalls','Subjects','headers','ticketId','format','user:%s','emit','stripTrailingSlash','remoteUri','serverUrl','unmanaged','%s/api/data/v9.0/','tenantId','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','socket.io-emitter','modernAuthentication','data7','data2','resolve','CloudProvider','data5','POST','clientId','username','password','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','email','userEmail','length','internalemailaddress'];(function(_0x596e28,_0x48bb02){var _0x503a36=function(_0x1731b3){while(--_0x1731b3){_0x596e28['push'](_0x596e28['shift']());}};_0x503a36(++_0x48bb02);}(_0x6d3e,0xac));var _0xe6d3=function(_0x4b11d8,_0x14aba9){_0x4b11d8=_0x4b11d8-0x0;var _0x3c09d5=_0x6d3e[_0x4b11d8];return _0x3c09d5;};'use strict';var _=require(_0xe6d3('0x0'));var rp=require(_0xe6d3('0x1'));var util=require(_0xe6d3('0x2'));var intUtil=require(_0xe6d3('0x3'));var md5=require('md5');var Redis=require(_0xe6d3('0x4'));var logger=require(_0xe6d3('0x5'))(_0xe6d3('0x6'));var config=require(_0xe6d3('0x7'));config[_0xe6d3('0x8')]=_['defaults'](config[_0xe6d3('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xe6d3('0x9'))(new Redis(config[_0xe6d3('0x8')]));function getAuthToken(_0x1f71b5,_0x851f54,_0x2bab17){if(_0x1f71b5[_0xe6d3('0xa')]){_0x1f71b5['remoteUri']=_0x1f71b5['CloudProvider'][_0xe6d3('0xb')];_0x1f71b5['tenantId']=_0x1f71b5['CloudProvider'][_0xe6d3('0xc')];return Promise[_0xe6d3('0xd')](_0x1f71b5[_0xe6d3('0xe')][_0xe6d3('0xf')]);}var _0x5173fa={'method':_0xe6d3('0x10'),'uri':_0x851f54,'form':{'client_id':_0x1f71b5[_0xe6d3('0x11')],'resource':_0x1f71b5['remoteUri'],'username':_0x1f71b5[_0xe6d3('0x12')],'password':_0x1f71b5[_0xe6d3('0x13')],'grant_type':_0xe6d3('0x13'),'client_secret':_0x1f71b5['clientSecret']},'json':!![]};return rp(_0x5173fa)[_0xe6d3('0x14')](function(_0x5d5976){return _0x5d5976[_0xe6d3('0x15')];})['catch'](function(_0x47e35c){logger[_0xe6d3('0x16')]('['+[_0x2bab17[_0xe6d3('0x17')]()]+_0xe6d3('0x18'));return _0x47e35c[_0xe6d3('0x19')];});}function getUser(_0x4091aa,_0x3a7147,_0x3c462f,_0x53109e,_0x52243b,_0x3c725e){return new Promise(function(_0x7ca83c,_0x2b6df1){return getAuthToken(_0x3a7147,_0x53109e,_0x3c725e)['then'](function(_0x1d0ee2){var _0x5c5312={'method':'GET','uri':_0x52243b+_0xe6d3('0x1a'),'headers':{'Authorization':'Bearer\x20'+_0x1d0ee2,'OData-Version':_0xe6d3('0x1b')},'json':!![]};return rp(_0x5c5312);})[_0xe6d3('0x14')](function(_0x358223){var _0x2f5d70=_0x358223[_0xe6d3('0x1c')];var _0x10bc39=![];var _0x55382f=null;if(!_[_0xe6d3('0x1d')](_0x3c462f)){if(intUtil['validateEmail'](_0x3c462f[_0xe6d3('0x1e')])){_0x4091aa[_0xe6d3('0x1f')]=_0x3c462f[_0xe6d3('0x1e')];for(_0x55382f=0x0;_0x55382f<_0x2f5d70[_0xe6d3('0x20')];_0x55382f++){if(_0x2f5d70[_0x55382f][_0xe6d3('0x21')]===_0x3c462f[_0xe6d3('0x1e')]&&!_0x2f5d70[_0x55382f][_0xe6d3('0x22')]){_0x10bc39=!![];logger[_0xe6d3('0x23')]('['+[_0x3c725e['toUpperCase']()]+']\x20Agent\x20found\x20'+_0x2f5d70[_0x55382f][_0xe6d3('0x24')]+'!');_0x4091aa[_0xe6d3('0x25')]=_0x2f5d70[_0x55382f]['systemuserid'];}}}}if(!_0x10bc39){logger[_0xe6d3('0x23')]('['+[_0x3c725e[_0xe6d3('0x17')]()]+_0xe6d3('0x26'));_0x4091aa[_0xe6d3('0x1f')]=_0x3a7147['username'];for(_0x55382f=0x0;_0x55382f<_0x2f5d70[_0xe6d3('0x20')];_0x55382f++){if(_0x2f5d70[_0x55382f]['internalemailaddress']===_0x3a7147[_0xe6d3('0x12')]){_0x4091aa[_0xe6d3('0x25')]=_0x2f5d70[_0x55382f][_0xe6d3('0x24')];}}}_0x7ca83c(_0x4091aa);})['catch'](function(_0x3ab286){_0x2b6df1(_0x3ab286['message']);});});}function createEndUser(_0x98ef77,_0x3b7090,_0x4b085b,_0x26b09f,_0x36bcb8,_0x5d04d7,_0x5044b9){return new Promise(function(_0x5e5631,_0x5639dc){return getAuthToken(_0x3b7090,_0x4b085b,_0x5d04d7)[_0xe6d3('0x14')](function(_0x36eddf){var _0xb83068=_0x5d04d7[_0xe6d3('0x27')]()===_0xe6d3('0x28')?_0x36bcb8['destcalleridnum']:_0x36bcb8[_0xe6d3('0x29')];var _0x50c723={'method':'POST','uri':_0x26b09f+'contacts','body':{'fullname':_0xb83068,'firstname':_0xb83068,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xe6d3('0x2a')+_0x98ef77[_0xe6d3('0x25')]+')'},'headers':{'Authorization':_0xe6d3('0x2b')+_0x36eddf,'OData-Version':_0xe6d3('0x1b')},'json':!![],'resolveWithFullResponse':!![]};_0x50c723[_0xe6d3('0x2c')][_0x5044b9]=_0xb83068;return rp(_0x50c723);})[_0xe6d3('0x14')](function(_0x2e5b63){var _0x17b1d7=_0x2e5b63['headers'][_0xe6d3('0x2d')];var _0x47ef82=_0x17b1d7[_0xe6d3('0x2e')](_0x17b1d7[_0xe6d3('0x2f')]('(')+0x1,_0x17b1d7[_0xe6d3('0x2f')](')'));_0x98ef77[_0xe6d3('0x30')]=_0x47ef82;_0x5e5631(_0x98ef77);})[_0xe6d3('0x31')](function(_0x11ccf2){_0x5639dc(_0x11ccf2[_0xe6d3('0x19')]);});});}function getEndUser(_0x499874,_0x244da0,_0x2213d9,_0x2a7a0c,_0x4c6eb6,_0x46958f,_0x31775e,_0x7097c5){var _0x113c39=_0x46958f['toLowerCase']()==='outbound'?_0x4c6eb6[_0xe6d3('0x32')]:_0x4c6eb6[_0xe6d3('0x29')];return getAuthToken(_0x244da0,_0x2213d9,_0x46958f)['then'](function(_0x29d926){_0x7097c5=_0x7097c5?_0x7097c5:'telephone1';var _0x1b46ef={'method':_0xe6d3('0x33'),'uri':_0x2a7a0c+_0xe6d3('0x34')+_0x7097c5+'&$filter='+_0x7097c5+_0xe6d3('0x35')+_0x113c39[_0xe6d3('0x36')]('+',_0xe6d3('0x37'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x29d926,'If-None-Match':null,'OData-Version':_0xe6d3('0x1b')},'json':!![]};return rp(_0x1b46ef);})[_0xe6d3('0x14')](function(_0x452581){var _0xd12d7b=![];if(!_0x452581)return _0xd12d7b;var _0x4fde2a=_0x452581['value'];for(var _0x456155=0x0;_0x456155<_0x4fde2a[_0xe6d3('0x20')];_0x456155++){if(_0x4fde2a[_0x456155][_0x7097c5]===_0x113c39){_0xd12d7b=!![];_0x499874['enduserId']=_0x4fde2a[_0x456155][_0xe6d3('0x38')];}}return _0xd12d7b;})['then'](function(_0xc16898){if(_0xc16898)return _0x499874;if(_0x31775e===_0xe6d3('0x39')){logger['info']('['+[_0x46958f['toUpperCase']()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x499874;}return createEndUser(_0x499874,_0x244da0,_0x2213d9,_0x2a7a0c,_0x4c6eb6,_0x46958f,_0x7097c5)[_0xe6d3('0x14')](function(_0x16f871){logger[_0xe6d3('0x23')]('['+[_0x46958f[_0xe6d3('0x17')]()]+_0xe6d3('0x3a'),_0x16f871[_0xe6d3('0x30')]);return _0x16f871;});});}function getCustomFields(_0x31543b,_0x307ca4,_0x6b7898){var _0x3ad573={};if(_0x31543b[_0xe6d3('0x20')]>0x0){_[_0xe6d3('0x3b')](_0x31543b,function(_0x3bf9f1){if(_[_0xe6d3('0x3c')](['string',_0xe6d3('0x3d')],_0x3bf9f1[_0xe6d3('0x3e')])&&_0x3bf9f1['nameField']&&!_0x3bf9f1['customField']){var _0x1e1342=_0x3bf9f1[_0xe6d3('0x3f')][_0xe6d3('0x27')]();var _0x51f344=_0x1e1342[_0xe6d3('0x2e')](0x0,_0x1e1342[_0xe6d3('0x40')]('_'));var _0x428518=_0x1e1342[_0xe6d3('0x2e')](_0x1e1342[_0xe6d3('0x40')]('_')+0x1);if(_0x51f344===_0x6b7898){_0x3ad573[_0x428518]=_0x3bf9f1[_0xe6d3('0x41')];}}});}return _0x3ad573;}function getTicket(_0x1d1859,_0x7e2aca,_0x259d7f,_0x5afae8,_0xfcb0d4,_0x143d9f,_0x5f4dca){return new Promise(function(_0x2a1a68,_0x3da6bb){var _0x43bab0;return getAuthToken(_0x7e2aca,_0x259d7f,_0x5f4dca)[_0xe6d3('0x14')](function(_0x59d2a3){if(_0x143d9f[_0xe6d3('0x42')]===_0xe6d3('0x43')){_0x43bab0={'method':'POST','uri':_0x5afae8+'incidents','body':Object[_0xe6d3('0x44')]({},{'title':intUtil['getString'](_0x143d9f['Subjects'],_0xfcb0d4,'\x20'),'description':intUtil[_0xe6d3('0x45')](_0x143d9f['Descriptions'],_0xfcb0d4,'\x0a'),'customerid_contact@odata.bind':_0x1d1859[_0xe6d3('0x30')]?_0xe6d3('0x46')+_0x1d1859[_0xe6d3('0x30')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x1d1859[_0xe6d3('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x143d9f['Fields'],_0xfcb0d4,_0x143d9f[_0xe6d3('0x42')])),'headers':{'Authorization':_0xe6d3('0x2b')+_0x59d2a3,'OData-Version':_0xe6d3('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x143d9f['ticketType']===_0xe6d3('0x47')){var _0x54e266=_0x1d1859[_0xe6d3('0x30')]?[{'partyid_systemuser@odata.bind':_0xe6d3('0x2a')+_0x1d1859[_0xe6d3('0x25')]+')','participationtypemask':_0x1d1859[_0xe6d3('0x48')]===_0xe6d3('0x49')?0x2:0x1},{'partyid_contact@odata.bind':_0xe6d3('0x46')+_0x1d1859['enduserId']+')','participationtypemask':_0x1d1859[_0xe6d3('0x48')]===_0xe6d3('0x49')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x1d1859[_0xe6d3('0x25')]+')','participationtypemask':_0x1d1859[_0xe6d3('0x48')]===_0xe6d3('0x49')?0x2:0x1}];_0x43bab0={'method':_0xe6d3('0x10'),'uri':_0x5afae8+_0xe6d3('0x4a'),'body':Object['assign']({},{'subject':intUtil[_0xe6d3('0x45')](_0x143d9f[_0xe6d3('0x4b')],_0xfcb0d4,'\x20'),'phonenumber':String(_0xfcb0d4[_0xe6d3('0x29')]),'description':intUtil[_0xe6d3('0x45')](_0x143d9f['Descriptions'],_0xfcb0d4,'\x0a'),'regardingobjectid_contact@odata.bind':_0x1d1859['enduserId']?_0xe6d3('0x46')+_0x1d1859[_0xe6d3('0x30')]+')':undefined,'ownerid@odata.bind':_0xe6d3('0x2a')+_0x1d1859[_0xe6d3('0x25')]+')','directioncode':_0x1d1859[_0xe6d3('0x48')]===_0xe6d3('0x49')?![]:!![],'phonecall_activity_parties':_0x54e266},getCustomFields(_0x143d9f['Fields'],_0xfcb0d4,_0x143d9f[_0xe6d3('0x42')])),'headers':{'Authorization':'Bearer\x20'+_0x59d2a3,'OData-Version':_0xe6d3('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x43bab0);})[_0xe6d3('0x14')](function(_0x2ad2e7){var _0x3c0d1c=_0x2ad2e7[_0xe6d3('0x4c')][_0xe6d3('0x2d')];var _0x3d501b=_0x3c0d1c[_0xe6d3('0x2e')](_0x3c0d1c[_0xe6d3('0x2f')]('(')+0x1,_0x3c0d1c[_0xe6d3('0x2f')](')'));_0x1d1859[_0xe6d3('0x4d')]=_0x3d501b;_0x2a1a68(_0x1d1859);})[_0xe6d3('0x31')](function(_0x5ad3ba){_0x3da6bb(_0x5ad3ba['message']);});});}function emit(_0x35bb6b,_0x3add03,_0x2c5d88,_0x338235){var _0x96d7a4={'uri':util[_0xe6d3('0x4e')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x35bb6b,_0x2c5d88,_0x338235)};io['to'](util[_0xe6d3('0x4e')](_0xe6d3('0x4f'),_0x3add03))[_0xe6d3('0x50')]('trigger:browser:url',_0x96d7a4);}exports['cs']=function(_0x3ec24f,_0x59881f,_0x339078,_0x432d2c,_0x43bcbd,_0x31b0e1,_0x12ebdf,_0x5216e7){var _0x4aea5d={};_0x31b0e1['remoteUri']=_0x31b0e1[_0xe6d3('0xa')]?intUtil[_0xe6d3('0x51')](_0x31b0e1[_0xe6d3('0xe')][_0xe6d3('0xb')]):intUtil[_0xe6d3('0x51')](_0x31b0e1[_0xe6d3('0x52')]);_0x31b0e1['serverUrl']=intUtil['stripTrailingSlash'](_0x31b0e1[_0xe6d3('0x53')]);_0x4aea5d[_0xe6d3('0x48')]=_0x5216e7===_0xe6d3('0x49')||_0x5216e7===_0xe6d3('0x54')?_0xe6d3('0x49'):_0xe6d3('0x28');var _0x2158d9=_0x31b0e1[_0xe6d3('0xa')]?util['format']('%s/api/data/v9.0/',_0x31b0e1[_0xe6d3('0xe')][_0xe6d3('0xb')]):util[_0xe6d3('0x4e')](_0xe6d3('0x55'),_0x31b0e1[_0xe6d3('0x52')]);var _0x5a0ec0=util[_0xe6d3('0x4e')]('https://login.microsoftonline.com/%s/oauth2/token',_0x31b0e1[_0xe6d3('0x56')]);var _0x177ff8=util[_0xe6d3('0x4e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x31b0e1[_0xe6d3('0x53')],_0x59881f[_0xe6d3('0x57')],md5(_0x59881f[_0xe6d3('0x57')]));if(_0x43bcbd&&_0x43bcbd[_0xe6d3('0x58')]){logger[_0xe6d3('0x23')](_0xe6d3('0x59'),_0xe6d3('0x5a'));_0x59881f['recordingURL']=_0x177ff8;}else if(_0x12ebdf&&_0x12ebdf[_0xe6d3('0x5b')]&&_0x12ebdf[_0xe6d3('0x5b')]!==_0xe6d3('0x5c')){logger[_0xe6d3('0x23')](_0xe6d3('0x5d'),'Recording\x20is\x20enabled!');_0x59881f[_0xe6d3('0x5e')]=_0x177ff8;}else{_0x59881f[_0xe6d3('0x5e')]='';}return getUser(_0x4aea5d,_0x31b0e1,_0x432d2c,_0x5a0ec0,_0x2158d9,_0x5216e7)[_0xe6d3('0x14')](function(_0x2c61d8){logger[_0xe6d3('0x23')]('['+_0x5216e7[_0xe6d3('0x17')]()+']\x20The\x20User\x20ID\x20is:',_0x2c61d8[_0xe6d3('0x25')]);logger[_0xe6d3('0x23')]('['+_0x5216e7[_0xe6d3('0x17')]()+_0xe6d3('0x5f'),_0x2c61d8[_0xe6d3('0x1f')]);return getEndUser(_0x2c61d8,_0x31b0e1,_0x5a0ec0,_0x2158d9,_0x59881f,_0x5216e7,_0x339078['moduleCreate'],_0x339078['additionalSearchContact']);})[_0xe6d3('0x14')](function(_0x150a07){logger['info']('['+_0x5216e7[_0xe6d3('0x17')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x150a07['enduserId']);logger[_0xe6d3('0x23')]('['+_0x5216e7[_0xe6d3('0x17')]()+_0xe6d3('0x60'),_0x59881f[_0xe6d3('0x29')]);return getTicket(_0x150a07,_0x31b0e1,_0x5a0ec0,_0x2158d9,_0x59881f,_0x339078,_0x5216e7);})[_0xe6d3('0x14')](function(_0x3709de){logger['info'](util[_0xe6d3('0x4e')]('['+_0x5216e7[_0xe6d3('0x17')]()+_0xe6d3('0x61'),_0x339078[_0xe6d3('0x42')],_0x3709de['ticketId']));logger['info'](util['format']('['+_0x5216e7[_0xe6d3('0x17')]()+_0xe6d3('0x62'),_0x5216e7));if(_0x5216e7!==_0xe6d3('0x54')&&_0x339078[_0xe6d3('0x63')]){logger[_0xe6d3('0x23')]('['+_0x5216e7[_0xe6d3('0x17')]()+']',_0xe6d3('0x64'));emit(_0x31b0e1[_0xe6d3('0x52')],_0x432d2c[_0xe6d3('0x65')],_0x339078['ticketType'],_0x3709de['ticketId']);}})['catch'](function(_0x158337){logger['error']('['+_0x5216e7[_0xe6d3('0x17')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x158337[_0xe6d3('0x19')]);console[_0xe6d3('0x16')](_0xe6d3('0x66'),_0x158337);});}; \ 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 507a6fa..9f8d614 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 _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 +var _0x9eef=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','user:%s','unmanaged','toUpperCase','lastevent','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','info','Ticket\x20created!','%s/api/v2/agents','length','Agent\x20found!','contact','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','then','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','[HTTP]','stringify','map','forEach','string','picklist','type','nameField','toLowerCase','content','includes','customField','push','idField','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]'];(function(_0x749cfd,_0x16a571){var _0x5b9c4e=function(_0x448683){while(--_0x448683){_0x749cfd['push'](_0x749cfd['shift']());}};_0x5b9c4e(++_0x16a571);}(_0x9eef,0xd7));var _0xf9ee=function(_0x365e54,_0x44be74){_0x365e54=_0x365e54-0x0;var _0x13317a=_0x9eef[_0x365e54];return _0x13317a;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xf9ee('0x0'));var util=require(_0xf9ee('0x1'));var Redis=require(_0xf9ee('0x2'));var intUtil=require(_0xf9ee('0x3'));var config=require(_0xf9ee('0x4'));var logger=require(_0xf9ee('0x5'))(_0xf9ee('0x6'));config[_0xf9ee('0x7')]=_[_0xf9ee('0x8')](config[_0xf9ee('0x7')],{'host':_0xf9ee('0x9'),'port':0x18eb});var io=require(_0xf9ee('0xa'))(new Redis(config[_0xf9ee('0x7')]));var headers={'Content-Type':_0xf9ee('0xb'),'Accept':_0xf9ee('0xb')};function emit(_0x1645fc,_0x47a549,_0x510751){io['to'](_0x1645fc)['emit'](_0x47a549,_0x510751);}function getTicket(_0x2803b6,_0x2fe28d,_0x5c579e,_0xa76aa8,_0x573136){logger['info']('Creating\x20new\x20ticket...');var _0x2e775b=_[_0xf9ee('0xc')]({'responder_id':_0x2fe28d['id'],'requester_id':_0x5c579e['id'],'name':util[_0xf9ee('0xd')](_0xf9ee('0xe'),_0x573136[_0xf9ee('0xf')]),'phone':_0x573136[_0xf9ee('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xf9ee('0x11')](_0xa76aa8['Subjects'],_0x573136,'\x20'),'description':intUtil[_0xf9ee('0x11')](_0xa76aa8['Descriptions'],_0x573136,_0xf9ee('0x12')),'tags':getTags(_0xa76aa8[_0xf9ee('0x13')],_0xf9ee('0x14'))},getCustomFields(_0xa76aa8[_0xf9ee('0x15')],_0x573136));_0x2e775b[_0xf9ee('0x16')]=_[_0xf9ee('0x17')](_[_0xf9ee('0x18')](_0x2e775b[_0xf9ee('0x16')],'id'),_0xf9ee('0x19'));return request({'uri':util[_0xf9ee('0xd')](_0xf9ee('0x1a'),_0x2803b6[_0xf9ee('0x1b')]),'method':_0xf9ee('0x1c'),'body':_0x2e775b})['then'](function(_0x3c33bf){logger[_0xf9ee('0x1d')](_0xf9ee('0x1e'));return _0x3c33bf;});}function getUser(_0x124df1,_0x19ee5d){if(intUtil['validateEmail'](_0x19ee5d)){return request({'uri':util['format'](_0xf9ee('0x1f'),_0x124df1[_0xf9ee('0x1b')]),'qs':{'email':_0x19ee5d}})['then'](function(_0x3cc322){if(_0x3cc322[_0xf9ee('0x20')]){logger[_0xf9ee('0x1d')](_0xf9ee('0x21'));return _['find'](_0x3cc322,function(_0x369eef){return _0x369eef[_0xf9ee('0x22')][_0xf9ee('0x23')]===_0x19ee5d;});}else{logger[_0xf9ee('0x1d')](_0xf9ee('0x24'));return request({'uri':util[_0xf9ee('0xd')](_0xf9ee('0x25'),_0x124df1[_0xf9ee('0x1b')])})['then'](function(_0x7aea61){logger[_0xf9ee('0x1d')](_0xf9ee('0x26'));return _0x7aea61;});}});}else{logger[_0xf9ee('0x1d')](_0xf9ee('0x27'));return request({'uri':util[_0xf9ee('0xd')](_0xf9ee('0x25'),_0x124df1[_0xf9ee('0x1b')])})['then'](function(_0x50dd51){logger[_0xf9ee('0x1d')](_0xf9ee('0x26'));return _0x50dd51;});}}function getEndUser(_0x921806,_0x12fdd4,_0x33d9d7){logger[_0xf9ee('0x1d')]('Searching\x20enduser\x20with\x20phone',_0x33d9d7);return request({'uri':util[_0xf9ee('0xd')](_0xf9ee('0x28'),_0x921806['remoteUri']),'qs':{'phone':_0x33d9d7}})[_0xf9ee('0x29')](function(_0x3370b2){if(_0x3370b2[_0xf9ee('0x20')]){logger[_0xf9ee('0x1d')](_0xf9ee('0x2a'));return _[_0xf9ee('0x2b')](_0x3370b2,{'phone':_0x33d9d7});}else{logger[_0xf9ee('0x1d')](_0xf9ee('0x2c'));return request({'uri':util[_0xf9ee('0xd')](_0xf9ee('0x28'),_0x921806[_0xf9ee('0x1b')]),'method':_0xf9ee('0x1c'),'body':{'name':_0x12fdd4,'phone':_0x33d9d7}})[_0xf9ee('0x29')](function(_0x5e2f12){logger['info'](_0xf9ee('0x2d'));return _0x5e2f12;});}});}function getAuth(_0x411ffe){return util[_0xf9ee('0xd')](_0xf9ee('0x2e'),new Buffer(_0x411ffe[_0xf9ee('0x2f')]+':X')[_0xf9ee('0x30')](_0xf9ee('0x31')));}function request(_0x1e6621){logger['debug'](_0xf9ee('0x32'),JSON[_0xf9ee('0x33')](_0x1e6621));return rp(_['defaults'](_0x1e6621,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x3c579a,_0x57270d){var _0x58c660=[];if(_0x3c579a&&_0x3c579a['length']>0x0){_0x58c660=_[_0xf9ee('0x34')](_0x3c579a,_0x57270d);}return _0x58c660;}function getCustomFields(_0x12808a,_0x540b65){var _0xc27255=[];var _0x1c86fc={'custom_fields':[]};if(_0x12808a['length']>0x0){_[_0xf9ee('0x35')](_0x12808a,function(_0x47d673){if(_['includes']([_0xf9ee('0x36'),_0xf9ee('0x37')],_0x47d673[_0xf9ee('0x38')])&&_0x47d673[_0xf9ee('0x39')]&&!_0x47d673['customField']){_0x1c86fc[_0x47d673['nameField'][_0xf9ee('0x3a')]()]=_0x47d673[_0xf9ee('0x3b')][_0xf9ee('0x30')]();}else if(_[_0xf9ee('0x3c')]([_0xf9ee('0x36'),_0xf9ee('0x37')],_0x47d673[_0xf9ee('0x38')])&&_0x47d673['idField']&&_0x47d673[_0xf9ee('0x3d')]){_0x1c86fc[_0xf9ee('0x16')][_0xf9ee('0x3e')]({'id':_0x47d673[_0xf9ee('0x3f')],'value':_0x47d673[_0xf9ee('0x3b')][_0xf9ee('0x30')]()});}else if(_0x47d673[_0xf9ee('0x38')]===_0xf9ee('0x40')&&_0x47d673[_0xf9ee('0x41')]&&_0x47d673[_0xf9ee('0x3f')]&&_0x47d673[_0xf9ee('0x3d')]){_0x540b65[_0x47d673[_0xf9ee('0x41')]]&&_0x1c86fc[_0xf9ee('0x16')][_0xf9ee('0x3e')]({'id':_0x47d673[_0xf9ee('0x3f')],'value':_0x540b65[_0x47d673[_0xf9ee('0x41')]][_0xf9ee('0x30')]()});}else if(_0x47d673[_0xf9ee('0x38')]===_0xf9ee('0x42')&&_0x47d673['Variable']&&_0x47d673[_0xf9ee('0x43')][_0xf9ee('0x14')]&&_0x47d673[_0xf9ee('0x3f')]&&_0x47d673[_0xf9ee('0x3d')]){_0x540b65[_0x47d673['Variable']['name']['toLowerCase']()]&&_0x1c86fc['custom_fields'][_0xf9ee('0x3e')]({'id':_0x47d673[_0xf9ee('0x3f')],'value':_0x540b65[_0x47d673[_0xf9ee('0x43')][_0xf9ee('0x14')][_0xf9ee('0x3a')]()][_0xf9ee('0x30')]()});}});}return _0x1c86fc;}exports[_0xf9ee('0x44')]=function(_0x2b8cca,_0x303c62,_0x53b20b,_0x217fe8,_0x20b3a2,_0x534e29){var _0x2a6d75,_0xc40971;_0x534e29[_0xf9ee('0x1b')]=intUtil[_0xf9ee('0x45')](_0x534e29[_0xf9ee('0x1b')]);_0x534e29[_0xf9ee('0x46')]=intUtil[_0xf9ee('0x45')](_0x534e29[_0xf9ee('0x46')]);if(_0x20b3a2&&_0x20b3a2[_0xf9ee('0x47')]){logger[_0xf9ee('0x1d')](_0xf9ee('0x48'),'Recording\x20is\x20enabled!');_0x303c62['recordingURL']=util['format'](_0xf9ee('0x49'),_0x534e29['serverUrl'],_0x303c62[_0xf9ee('0x4a')],md5(_0x303c62[_0xf9ee('0x4a')]));}else{_0x303c62[_0xf9ee('0x4b')]='';}headers[_0xf9ee('0x4c')]=getAuth(_0x534e29);return getUser(_0x534e29,_0x217fe8[_0xf9ee('0x23')])['then'](function(_0x36d3ae){_0x2a6d75=_0x36d3ae;logger['info'](_0xf9ee('0x4d'),_0x2a6d75['id']);return getEndUser(_0x534e29,_0x303c62['calleridname'],_0x303c62[_0xf9ee('0x10')]);})[_0xf9ee('0x29')](function(_0x4cefb3){_0xc40971=_0x4cefb3;logger[_0xf9ee('0x1d')](_0xf9ee('0x4e'),_0xc40971['id']);return getTicket(_0x534e29,_0x2a6d75,_0xc40971,_0x53b20b,_0x303c62);})[_0xf9ee('0x29')](function(_0x4a4b34){if(_0x4a4b34&&_0x4a4b34['id']){logger[_0xf9ee('0x1d')](_0xf9ee('0x1e'));logger['info'](_0xf9ee('0x4f'),_0x4a4b34['id']);logger[_0xf9ee('0x1d')](_0xf9ee('0x48'),_0xf9ee('0x50'));emit(util[_0xf9ee('0xd')]('user:%s',_0x217fe8[_0xf9ee('0x14')]),_0xf9ee('0x51'),{'uri':util[_0xf9ee('0xd')](_0xf9ee('0x52'),_0x534e29[_0xf9ee('0x1b')],_0x4a4b34['id'])});}})[_0xf9ee('0x53')](function(_0x4b25f4){logger[_0xf9ee('0x54')](_0xf9ee('0x48'),JSON[_0xf9ee('0x33')](_0x4b25f4));});};exports[_0xf9ee('0x55')]=function(_0x3071a8,_0xd29bd0,_0x56fc3f,_0x53b23f,_0x48cfba,_0x4b8bb0,_0x23741d){var _0x377d53,_0x362295;_0x4b8bb0[_0xf9ee('0x1b')]=intUtil[_0xf9ee('0x45')](_0x4b8bb0[_0xf9ee('0x1b')]);_0x4b8bb0['serverUrl']=intUtil[_0xf9ee('0x45')](_0x4b8bb0['serverUrl']);if(_0x23741d&&_0x23741d[_0xf9ee('0x56')]&&_0x23741d[_0xf9ee('0x56')]!==_0xf9ee('0x57')){logger[_0xf9ee('0x1d')](_0xf9ee('0x58'),_0xf9ee('0x59'));_0xd29bd0[_0xf9ee('0x4b')]=util[_0xf9ee('0xd')](_0xf9ee('0x49'),_0x4b8bb0[_0xf9ee('0x46')],_0xd29bd0['uniqueid'],md5(_0xd29bd0[_0xf9ee('0x4a')]));}headers[_0xf9ee('0x4c')]=getAuth(_0x4b8bb0);return getUser(_0x4b8bb0,_0x53b23f[_0xf9ee('0x23')])[_0xf9ee('0x29')](function(_0x523652){_0x377d53=_0x523652;logger[_0xf9ee('0x1d')](_0xf9ee('0x4d'),_0x377d53['id']);return getEndUser(_0x4b8bb0,_0xd29bd0[_0xf9ee('0x5a')],_0xd29bd0[_0xf9ee('0x5b')]);})[_0xf9ee('0x29')](function(_0x5e4ea4){_0x362295=_0x5e4ea4;logger['info'](_0xf9ee('0x4e'),_0x362295['id']);return getTicket(_0x4b8bb0,_0x377d53,_0x362295,_0x56fc3f,_0xd29bd0);})[_0xf9ee('0x29')](function(_0x45c53e){if(_0x45c53e&&_0x45c53e['id']){logger[_0xf9ee('0x1d')](_0xf9ee('0x1e'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x45c53e['id']);logger[_0xf9ee('0x1d')](_0xf9ee('0x58'),_0xf9ee('0x50'));emit(util['format'](_0xf9ee('0x5c'),_0x53b23f[_0xf9ee('0x14')]),_0xf9ee('0x51'),{'uri':util[_0xf9ee('0xd')]('%s/helpdesk/tickets/%d',_0x4b8bb0[_0xf9ee('0x1b')],_0x45c53e['id'])});}})[_0xf9ee('0x53')](function(_0x45dd17){logger[_0xf9ee('0x54')]('[OUTBOUND]',JSON[_0xf9ee('0x33')](_0x45dd17));});};exports[_0xf9ee('0x5d')]=function(_0x5eb0a8,_0x23c323,_0x560c86,_0x2146e6,_0x3e1ca1,_0xf33063){var _0x42ddf0,_0x2bf981;_0xf33063[_0xf9ee('0x1b')]=intUtil[_0xf9ee('0x45')](_0xf33063[_0xf9ee('0x1b')]);_0xf33063[_0xf9ee('0x46')]=intUtil[_0xf9ee('0x45')](_0xf33063[_0xf9ee('0x46')]);if(_0x3e1ca1&&_0x3e1ca1['monitor_format']){logger[_0xf9ee('0x1d')]('['+_0x23c323['lastevent'][_0xf9ee('0x5e')]()+']','Recording\x20is\x20enabled!');_0x23c323[_0xf9ee('0x4b')]=util[_0xf9ee('0xd')](_0xf9ee('0x49'),_0xf33063['serverUrl'],_0x23c323[_0xf9ee('0x4a')],md5(_0x23c323[_0xf9ee('0x4a')]));}else{_0x23c323[_0xf9ee('0x4b')]='';}headers[_0xf9ee('0x4c')]=getAuth(_0xf33063);return getUser(_0xf33063,'')[_0xf9ee('0x29')](function(_0x224bce){_0x42ddf0=_0x224bce;logger['info'](_0xf9ee('0x4d'),_0x42ddf0['id']);return getEndUser(_0xf33063,_0x23c323[_0xf9ee('0xf')],_0x23c323[_0xf9ee('0x10')]);})['then'](function(_0x3d4b45){_0x2bf981=_0x3d4b45;logger[_0xf9ee('0x1d')](_0xf9ee('0x4e'),_0x2bf981['id']);return getTicket(_0xf33063,_0x42ddf0,_0x2bf981,_0x560c86,_0x23c323);})['then'](function(_0x52e3c4){if(_0x52e3c4){logger[_0xf9ee('0x1d')]('Ticket\x20created!');logger[_0xf9ee('0x1d')](_0xf9ee('0x4f'),_0x52e3c4['id']);}})[_0xf9ee('0x53')](function(_0xd9b4d4){logger[_0xf9ee('0x54')]('['+_0x23c323[_0xf9ee('0x5f')][_0xf9ee('0x5e')]()+']',JSON[_0xf9ee('0x33')](_0xd9b4d4));});}; \ 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 b6d4562..b52c340 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 _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 +var _0xef30=['Contact\x20created:','POST','/api/contacts','format','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','getString','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','headers','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','freshsales','redis','defaults','GET','/api/selector/owners','info','users','email','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','then','Getting\x20user\x20with\x20email','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','adminEmail','/api/lookup?q=','&f=','&entities=contact','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:'];(function(_0x399e3b,_0x5dd3d2){var _0x28c6a4=function(_0x7d77c1){while(--_0x7d77c1){_0x399e3b['push'](_0x399e3b['shift']());}};_0x28c6a4(++_0x5dd3d2);}(_0xef30,0x129));var _0x0ef3=function(_0x1c510a,_0x1413a9){_0x1c510a=_0x1c510a-0x0;var _0x23cedd=_0xef30[_0x1c510a];return _0x23cedd;};'use strict';var _=require(_0x0ef3('0x0'));var rp=require(_0x0ef3('0x1'));var md5=require(_0x0ef3('0x2'));var util=require(_0x0ef3('0x3'));var moment=require(_0x0ef3('0x4'));var Promise=require(_0x0ef3('0x5'));var Redis=require(_0x0ef3('0x6'));var intUtil=require(_0x0ef3('0x7'));var config=require(_0x0ef3('0x8'));var logger=require('../../../../config/logger')(_0x0ef3('0x9'));config[_0x0ef3('0xa')]=_[_0x0ef3('0xb')](config[_0x0ef3('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0ef3('0xa')]));function getAdminId(_0x262555,_0x5a04f2,_0x92f3aa,_0x535c4f){return new Promise(function(_0x111243,_0x5e2e23){var _0x5a64a9=![];var _0xb64aac={'method':_0x0ef3('0xc'),'uri':_0x535c4f+_0x0ef3('0xd'),'json':!![]};_0xb64aac['headers']=_0x92f3aa;logger[_0x0ef3('0xe')]('Getting\x20admin\x20information');return rp(_0xb64aac)['then'](function(_0x5522a5){if(_0x5522a5){var _0x5816d2=_0x5522a5[_0x0ef3('0xf')];var _0x3bbf36=null;for(_0x3bbf36=0x0;_0x3bbf36<_0x5816d2['length'];_0x3bbf36++){if(_0x5816d2[_0x3bbf36][_0x0ef3('0x10')]===_0x262555['adminEmail']){_0x262555[_0x0ef3('0x11')]=_0x5816d2[_0x3bbf36]['id'];_0x5a64a9=!![];}}if(_0x5a64a9){logger[_0x0ef3('0xe')]('Admin\x20found:',_0x262555[_0x0ef3('0x11')]);_0x111243(_0x262555);}else{_0x5e2e23({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x5e2e23({'statusCode':0x194,'message':_0x0ef3('0x12')});}})[_0x0ef3('0x13')](function(_0x1e5bc5){logger[_0x0ef3('0x14')]('['+[_0x5a04f2[_0x0ef3('0x15')]()]+']',_0x1e5bc5[_0x0ef3('0x16')]);_0x5e2e23(_0x1e5bc5);});});}function getUser(_0x1b8ec6,_0x5531da,_0x31108e){return function(_0x1b2100){return new Promise(function(_0x8e2da9,_0x5b1d0b){var _0x285265={'method':'GET','uri':_0x31108e+_0x0ef3('0xd'),'json':!![]};_0x285265['headers']=_0x5531da;logger['info'](_0x0ef3('0x17'));return rp(_0x285265)[_0x0ef3('0x18')](function(_0x3001a0){if(_0x3001a0){var _0x598f98=_0x3001a0[_0x0ef3('0xf')];var _0x38ae3d=![];var _0x56604d=null;if(_0x1b2100['agentEmail']!==null){logger[_0x0ef3('0xe')](_0x0ef3('0x19'),_0x1b2100[_0x0ef3('0x1a')]);_0x1b2100[_0x0ef3('0x1b')]=_0x1b2100[_0x0ef3('0x1a')];for(_0x56604d=0x0;_0x56604d<_0x598f98['length'];_0x56604d++){if(_0x598f98[_0x56604d][_0x0ef3('0x10')]===_0x1b2100[_0x0ef3('0x1a')]){_0x38ae3d=!![];_0x1b2100[_0x0ef3('0x1c')]=_0x598f98[_0x56604d]['id'];logger[_0x0ef3('0xe')](_0x0ef3('0x1d'),_0x1b2100[_0x0ef3('0x1c')]);}}}if(!_0x38ae3d){logger[_0x0ef3('0xe')](_0x0ef3('0x1e'));_0x1b2100['userEmail']=_0x1b2100[_0x0ef3('0x1f')];_0x1b2100[_0x0ef3('0x1c')]=_0x1b2100[_0x0ef3('0x11')];_0x38ae3d=!![];}if(_0x38ae3d){_0x8e2da9(_0x1b2100);}else{_0x5b1d0b({'statusCode':0x194,'message':_0x0ef3('0x12')});}}else{_0x5b1d0b({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x0ef3('0x13')](function(_0xebe3a8){logger[_0x0ef3('0x14')]('['+[_0x1b8ec6[_0x0ef3('0x15')]()]+']',_0xebe3a8[_0x0ef3('0x16')]);_0x5b1d0b(_0xebe3a8);});});};}function searchContact(_0x47cca0,_0x14b2ec,_0x289081,_0x18c342){return new Promise(function(_0x5ebf3a,_0x229f24){var _0x310465={'method':'GET','headers':_0x14b2ec,'uri':_0x47cca0+_0x0ef3('0x20')+_0x18c342+_0x0ef3('0x21')+_0x289081+_0x0ef3('0x22'),'json':!![]};rp(_0x310465)[_0x0ef3('0x18')](function(_0x1dc02d){var _0x29843b=_['find'](_0x1dc02d['contacts'][_0x0ef3('0x23')],[_0x289081,_0x18c342]);_0x5ebf3a(_0x29843b);})['catch'](function(_0x4d3d35){_0x229f24(_0x4d3d35);});});}function getEndUser(_0x1063a5,_0x574560,_0x21c85b){return function(_0x44148f){return new Promise(function(_0x24fca3,_0xe035a4){logger['info'](util['format'](_0x0ef3('0x24'),_0x44148f[_0x0ef3('0x25')]));searchContact(_0x21c85b,_0x574560,_0x0ef3('0x26'),_0x44148f['contactNumber'])[_0x0ef3('0x18')](function(_0x1d6545){if(_0x1d6545){_0x44148f[_0x0ef3('0x27')]=_0x1d6545['id'];logger[_0x0ef3('0xe')](_0x0ef3('0x28'),_0x44148f['endUserId']);return _0x24fca3(_0x44148f);}searchContact(_0x21c85b,_0x574560,_0x0ef3('0x29'),_0x44148f[_0x0ef3('0x25')])[_0x0ef3('0x18')](function(_0xf1008d){if(_0xf1008d){_0x44148f[_0x0ef3('0x27')]=_0xf1008d['id'];logger[_0x0ef3('0xe')](_0x0ef3('0x2a'),_0x44148f[_0x0ef3('0x27')]);return _0x24fca3(_0x44148f);}createEndUser(_0x44148f,_0x1063a5,_0x574560,_0x21c85b)[_0x0ef3('0x18')](function(_0x477e4b){logger[_0x0ef3('0xe')](_0x0ef3('0x2b'),_0x477e4b['endUserId']);return _0x24fca3(_0x477e4b);});});})[_0x0ef3('0x13')](function(_0x2e4482){_0xe035a4(_0x2e4482);});});};}function createEndUser(_0x22e819,_0x32cfbf,_0x3f7b18,_0x305721){return new Promise(function(_0x45fcb9,_0x7061d){var _0x275d46=moment();var _0x36e1ff={'method':_0x0ef3('0x2c'),'uri':_0x305721+_0x0ef3('0x2d'),'body':{'contact':{'last_name':_0x22e819[_0x0ef3('0x25')],'work_number':_0x22e819['contactNumber'],'mobile_number':_0x22e819[_0x0ef3('0x25')],'owner_id':_0x22e819[_0x0ef3('0x1c')],'created_at':_0x275d46[_0x0ef3('0x2e')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x36e1ff['headers']=_0x3f7b18;logger[_0x0ef3('0xe')](_0x0ef3('0x2f'));return rp(_0x36e1ff)[_0x0ef3('0x18')](function(_0x5ceae9){_0x22e819[_0x0ef3('0x27')]=_0x5ceae9[_0x0ef3('0x30')]['id'];_0x45fcb9(_0x22e819);})['catch'](function(_0x5e7ab8){logger[_0x0ef3('0x14')]('['+[_0x32cfbf[_0x0ef3('0x15')]()]+']',_0x5e7ab8[_0x0ef3('0x16')]);_0x7061d(_0x5e7ab8['message']);});});}function getTicket(_0x20fb31,_0x1e115f,_0x19374b,_0x5ceef5,_0x201c36){return function(_0x41b1d){logger[_0x0ef3('0xe')](_0x0ef3('0x31'));return new Promise(function(_0x351ddd,_0xd9d381){var _0x48c4f3=moment();var _0x7398e4={'method':'POST','uri':_0x19374b+'/api/tasks','body':{'title':intUtil[_0x0ef3('0x32')](_0x5ceef5[_0x0ef3('0x33')],_0x201c36,'\x20'),'description':intUtil[_0x0ef3('0x32')](_0x5ceef5[_0x0ef3('0x34')],_0x201c36,'\x0a'),'owner_id':_0x41b1d[_0x0ef3('0x1c')],'creater_id':_0x41b1d['adminId'],'targetable_id':_0x41b1d[_0x0ef3('0x27')],'targetable_type':_0x0ef3('0x35'),'created_at':_0x48c4f3[_0x0ef3('0x2e')](_0x0ef3('0x36')),'due_date':_0x48c4f3[_0x0ef3('0x37')](0x1e,'m')['format'](_0x0ef3('0x36'))},'json':!![]};_0x7398e4[_0x0ef3('0x38')]=_0x1e115f;return rp(_0x7398e4)[_0x0ef3('0x18')](function(_0x317bb4){_0x41b1d[_0x0ef3('0x39')]=_0x317bb4[_0x0ef3('0x3a')]['id'];logger[_0x0ef3('0xe')](_0x0ef3('0x3b'),_0x41b1d[_0x0ef3('0x39')]);_0x351ddd(_0x41b1d);})['catch'](function(_0x3ba9ed){logger['error']('['+[_0x20fb31[_0x0ef3('0x15')]()]+']',_0x3ba9ed[_0x0ef3('0x16')]);_0xd9d381(_0x3ba9ed[_0x0ef3('0x16')]);});});};}function emit(_0x198d58,_0x1865f1,_0x6cafc1){var _0x402243={'uri':_0x198d58+_0x0ef3('0x3c')+_0x6cafc1};io['to'](util[_0x0ef3('0x2e')](_0x0ef3('0x3d'),_0x1865f1))[_0x0ef3('0x3e')]('trigger:browser:url',_0x402243);}exports['cs']=function(_0x4e4a84,_0x5a6549,_0x1c4699,_0x4f6d3a,_0x394371,_0x299e93,_0x44bf24,_0x5bf24d){var _0x4c519b={};var _0x116750={'Authorization':_0x0ef3('0x3f')+_0x299e93[_0x0ef3('0x40')]};_0x299e93[_0x0ef3('0x41')]=intUtil[_0x0ef3('0x42')](_0x299e93[_0x0ef3('0x41')]);_0x299e93[_0x0ef3('0x43')]=intUtil['stripTrailingSlash'](_0x299e93[_0x0ef3('0x43')]);var _0xd21825=_0x299e93[_0x0ef3('0x41')];_0x4c519b[_0x0ef3('0x1f')]=_0x299e93[_0x0ef3('0x44')];_0x4c519b['contactNumber']=_0x5bf24d[_0x0ef3('0x45')]()===_0x0ef3('0x46')?_0x5a6549[_0x0ef3('0x47')]:_0x5a6549['calleridnum'];_0x4c519b[_0x0ef3('0x48')]=_0x5bf24d===_0x0ef3('0x49')||_0x5bf24d===_0x0ef3('0x4a')?_0x0ef3('0x49'):_0x0ef3('0x46');if(_0x4f6d3a){_0x4c519b['agentEmail']=_0x4f6d3a[_0x0ef3('0x10')];}var _0x51e50d=util[_0x0ef3('0x2e')](_0x0ef3('0x4b'),_0x299e93[_0x0ef3('0x43')],_0x5a6549[_0x0ef3('0x4c')],md5(_0x5a6549[_0x0ef3('0x4c')]));if(_0x394371&&_0x394371['monitor_format']){logger[_0x0ef3('0xe')]('[QUEUE]',_0x0ef3('0x4d'));_0x5a6549[_0x0ef3('0x4e')]=_0x51e50d;}else if(_0x44bf24&&_0x44bf24[_0x0ef3('0x4f')]&&_0x44bf24[_0x0ef3('0x4f')]!==_0x0ef3('0x50')){logger[_0x0ef3('0xe')](_0x0ef3('0x51'),_0x0ef3('0x4d'));_0x5a6549[_0x0ef3('0x4e')]=_0x51e50d;}else{_0x5a6549[_0x0ef3('0x4e')]='';}return getAdminId(_0x4c519b,_0x5bf24d,_0x116750,_0xd21825)[_0x0ef3('0x18')](getUser(_0x5bf24d,_0x116750,_0xd21825))[_0x0ef3('0x18')](getEndUser(_0x5bf24d,_0x116750,_0xd21825))[_0x0ef3('0x18')](getTicket(_0x5bf24d,_0x116750,_0xd21825,_0x1c4699,_0x5a6549))[_0x0ef3('0x18')](function(_0x125d09){logger[_0x0ef3('0xe')](util[_0x0ef3('0x2e')]('The\x20ticket\x20ID\x20is:\x20%s',_0x125d09[_0x0ef3('0x39')]));if(_0x5bf24d!==_0x0ef3('0x4a')){logger[_0x0ef3('0xe')]('['+[_0x5bf24d[_0x0ef3('0x15')]()]+']',_0x0ef3('0x52'));emit(_0xd21825,_0x4f6d3a[_0x0ef3('0x53')],_0x125d09['endUserId']);}})[_0x0ef3('0x13')](function(_0x4db300){logger[_0x0ef3('0x14')]('['+[_0x5bf24d[_0x0ef3('0x15')]()]+_0x0ef3('0x54'),util['inspect'](_0x4db300,{'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 ab34a29..e9a94ec 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 _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 +var _0xad90=['freshsales','servicenow','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','outbound','log','EVENT\x20UNKNOWN','unmanaged','salesforce','vtiger','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./zoho','./vtiger','./dynamics365','./freshsales','sugarcrm','freshdesk','zoho','desk','dynamics365'];(function(_0x274be0,_0x90ddea){var _0x4c92c4=function(_0x1f68b7){while(--_0x1f68b7){_0x274be0['push'](_0x274be0['shift']());}};_0x4c92c4(++_0x90ddea);}(_0xad90,0xab));var _0x0ad9=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0xad90[_0x2faddb];return _0x273c05;};'use strict';var _=require(_0x0ad9('0x0'));var util=require(_0x0ad9('0x1'));var zendesk=require(_0x0ad9('0x2'));var salesforce=require(_0x0ad9('0x3'));var sugarcrm=require(_0x0ad9('0x4'));var freshdesk=require('./freshdesk');var zoho=require(_0x0ad9('0x5'));var desk=require('./desk');var vtiger=require(_0x0ad9('0x6'));var servicenow=require('./servicenow');var dynamics365=require(_0x0ad9('0x7'));var freshsales=require(_0x0ad9('0x8'));var integrations=['zendesk','salesforce',_0x0ad9('0x9'),_0x0ad9('0xa'),_0x0ad9('0xb'),_0x0ad9('0xc'),'vtiger',_0x0ad9('0xd'),_0x0ad9('0xe'),_0x0ad9('0xf')];exports['exec']=function(_0x2d5878,_0x145acf,_0x2cf912,_0x45a421,_0x225237,_0x28ab38){if(_0x2cf912){if(_[_0x0ad9('0x10')](integrations,_0x2d5878[_0x0ad9('0x11')]['toLowerCase']())){try{var _0x4f80f5=null;var _0x2a5d58='';var _0x3cf238=_0x2cf912[_0x2d5878[_0x0ad9('0x11')][_0x0ad9('0x12')]()];if(_0x3cf238){var _0x2700f8=_0x3cf238[_0x2d5878[_0x0ad9('0x13')]];if(_0x2700f8){var _0x16aad1=_[_0x0ad9('0x14')](_0x2700f8[_0x0ad9('0x15')],{'id':parseInt(_0x2d5878[_0x0ad9('0x16')],0xa)});if(_0x16aad1){if(_0x45a421){if(_0x225237&&_0x145acf[_0x0ad9('0x17')]){_0x2a5d58=_0x0ad9('0x17');}else if(_0x145acf['routeId']){_0x2a5d58=_0x0ad9('0x18');}else{console[_0x0ad9('0x19')](_0x0ad9('0x1a'),_0x145acf);}}else{_0x2a5d58=_0x0ad9('0x1b');}switch(_0x2d5878[_0x0ad9('0x11')][_0x0ad9('0x12')]()){case'zendesk':zendesk[_0x2a5d58](_0x2d5878,_0x145acf,_0x16aad1,_0x45a421,_0x225237,_0x2700f8,_0x28ab38);break;case _0x0ad9('0x1c'):salesforce[_0x2a5d58](_0x2d5878,_0x145acf,_0x16aad1,_0x45a421,_0x225237,_0x2700f8,_0x28ab38);break;case _0x0ad9('0x9'):sugarcrm[_0x2a5d58](_0x2d5878,_0x145acf,_0x16aad1,_0x45a421,_0x225237,_0x2700f8,_0x28ab38);break;case _0x0ad9('0xa'):freshdesk[_0x2a5d58](_0x2d5878,_0x145acf,_0x16aad1,_0x45a421,_0x225237,_0x2700f8,_0x28ab38);break;case _0x0ad9('0xb'):zoho[_0x2a5d58](_0x2d5878,_0x145acf,_0x16aad1,_0x45a421,_0x225237,_0x2700f8,_0x28ab38);break;case _0x0ad9('0xc'):desk[_0x2a5d58](_0x2d5878,_0x145acf,_0x16aad1,_0x45a421,_0x225237,_0x2700f8,_0x28ab38);break;case _0x0ad9('0x1d'):vtiger[_0x2a5d58](_0x2d5878,_0x145acf,_0x16aad1,_0x45a421,_0x225237,_0x2700f8,_0x28ab38);break;case _0x0ad9('0xe'):freshsales['cs'](_0x2d5878,_0x145acf,_0x16aad1,_0x45a421,_0x225237,_0x2700f8,_0x28ab38,_0x2a5d58);break;case'servicenow':servicenow['cs'](_0x2d5878,_0x145acf,_0x16aad1,_0x45a421,_0x225237,_0x2700f8,_0x28ab38,_0x2a5d58);break;case _0x0ad9('0xd'):dynamics365['cs'](_0x2d5878,_0x145acf,_0x16aad1,_0x45a421,_0x225237,_0x2700f8,_0x28ab38,_0x2a5d58);break;default:console[_0x0ad9('0x19')](_0x0ad9('0x1e'));}}else{_0x4f80f5=require(_0x0ad9('0x1f'))(_0x2d5878['data1']['toLowerCase']());_0x4f80f5[_0x0ad9('0x20')](_0x0ad9('0x21'),util['format'](_0x0ad9('0x22'),_0x2d5878[_0x0ad9('0x11')][_0x0ad9('0x12')](),_0x2d5878[_0x0ad9('0x16')]));}}else{_0x4f80f5=require(_0x0ad9('0x1f'))(_0x2d5878['data1']['toLowerCase']());_0x4f80f5[_0x0ad9('0x20')]('[EXEC]',util[_0x0ad9('0x23')](_0x0ad9('0x24'),_0x2d5878[_0x0ad9('0x11')][_0x0ad9('0x12')](),_0x2d5878[_0x0ad9('0x13')]));}}else{}}catch(_0x125fc1){console[_0x0ad9('0x20')](_0x125fc1);}}}}; \ 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 743355d..38a102b 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 _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 +var _0x3419=['request-promise','moment','md5','jsforce','util','ioredis','./util','../../../../config/environment','salesforce','redis','defaults','localhost','socket.io-emitter','assign','Subjects','getString','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','Case','ContactId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','sobject','User','find','execute','then','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','Contact','length','additionalSearchLead','account_contact_lead','additionalSearchAccount','Lead','Account','first','Phone','attributes','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','LastName','Caller\x20-\x20%s','Company','No\x20Company','forEach','includes','idField','toString','variableName','customVariable','name','Variable','toLowerCase','password','securityToken','https://login.salesforce.com','clientId','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','error','outbound','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','catch','unmanaged','isNil','calleridnum','toUpperCase','lastevent',']\x20Integration\x20account\x20type\x20%s.','lodash'];(function(_0x209ec9,_0x30378c){var _0x129b1b=function(_0x2f2b9e){while(--_0x2f2b9e){_0x209ec9['push'](_0x209ec9['shift']());}};_0x129b1b(++_0x30378c);}(_0x3419,0xfd));var _0x9341=function(_0x5a26f5,_0x196300){_0x5a26f5=_0x5a26f5-0x0;var _0x2e9ef7=_0x3419[_0x5a26f5];return _0x2e9ef7;};'use strict';var _=require(_0x9341('0x0'));var rp=require(_0x9341('0x1'));var moment=require(_0x9341('0x2'));var BPromise=require('bluebird');var md5=require(_0x9341('0x3'));var jsforce=require(_0x9341('0x4'));var util=require(_0x9341('0x5'));var Redis=require(_0x9341('0x6'));var intUtil=require(_0x9341('0x7'));var config=require(_0x9341('0x8'));var logger=require('../../../../config/logger')(_0x9341('0x9'));config[_0x9341('0xa')]=_[_0x9341('0xb')](config['redis'],{'host':_0x9341('0xc'),'port':0x18eb});var io=require(_0x9341('0xd'))(new Redis(config[_0x9341('0xa')]));function emit(_0x314c1e,_0x372fbf,_0x24d9dc){io['to'](_0x314c1e)['emit'](_0x372fbf,_0x24d9dc);}function getTicket(_0x192502,_0xa37eeb,_0x477ee5,_0x247005,_0x153369,_0x14eb8c,_0x4acb43,_0x2f2e93){var _0x407997=Object[_0x9341('0xe')]({},{'OwnerId':_0xa37eeb['id'],'Subject':intUtil['getString'](_0x247005[_0x9341('0xf')],_0x153369,'\x20'),'Description':intUtil[_0x9341('0x10')](_0x247005[_0x9341('0x11')],_0x153369,'\x0a')},getCustomFields(_0x14eb8c,_0x153369));if(_0x477ee5){if(_0x247005[_0x9341('0x12')]===_0x9341('0x13')){_0x407997[_0x9341('0x14')]=moment[_0x9341('0x15')]();_0x407997[_0x9341('0x16')]=![];_0x407997[_0x9341('0x17')]=![];if(_0x477ee5[_0x9341('0x18')]===_0x9341('0x19')||_0x477ee5[_0x9341('0x18')]===_0x9341('0x1a')){_0x407997[_0x9341('0x1b')]=_0x477ee5['id'];}else if(_0x477ee5[_0x9341('0x18')]===_0x9341('0x1c')){_0x407997[_0x9341('0x1d')]=_0x477ee5['id'];}}else if(_0x247005['ticketType']===_0x9341('0x1e')){if(_0x477ee5['endUserType']==='contact'){_0x407997[_0x9341('0x1f')]=_0x477ee5['id'];}else if(_0x477ee5[_0x9341('0x18')]===_0x9341('0x1c')){_0x407997['AccountId']=_0x477ee5['id'];}else if(_0x477ee5[_0x9341('0x18')]===_0x9341('0x1a')&&_0x247005['leadId']){_0x407997[_0x247005[_0x9341('0x20')]]=_0x477ee5['id'];}else{logger[_0x9341('0x21')](_0x9341('0x22'));}}}return _0x4acb43['sobject'](_0x247005[_0x9341('0x12')])[_0x9341('0x23')](_0x407997);}function getUser(_0x4a569d,_0x132acb,_0x94ca19){if(!_['isNil'](_0x132acb)&&intUtil['validateEmail'](_0x132acb)){var _0xb24185={'Email':_0x132acb};var _0x1886d2={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x94ca19[_0x9341('0x24')](_0x9341('0x25'))[_0x9341('0x26')](_0xb24185,_0x1886d2)[_0x9341('0x27')]()[_0x9341('0x28')](function(_0x1027bb){if(_0x1027bb['length']){var _0x4cb102=_['find'](_0x1027bb,function(_0x4d2179){return _0x4d2179[_0x9341('0x29')]===_0x132acb;});if(_0x4cb102){logger[_0x9341('0x21')](_0x9341('0x2a'),_0x132acb);return BPromise[_0x9341('0x2b')]({'id':_0x4cb102['Id'],'name':_0x4cb102[_0x9341('0x2c')]});}}else{logger[_0x9341('0x21')](_0x9341('0x2d'),_0x132acb);return _0x94ca19[_0x9341('0x2e')]()[_0x9341('0x28')](function(_0x1ab12c){return BPromise['resolve']({'id':_0x1ab12c[_0x9341('0x2f')],'name':_0x1ab12c[_0x9341('0x30')]});});}});}else{logger[_0x9341('0x21')](_0x9341('0x2d'),_0x132acb);return _0x94ca19[_0x9341('0x2e')]()[_0x9341('0x28')](function(_0xb50147){return BPromise['resolve']({'id':_0xb50147[_0x9341('0x2f')],'name':_0xb50147[_0x9341('0x30')]});});}}function getEndUser(_0x9bfe09,_0x37ca7d,_0x521bfe,_0x2bd253,_0x1fb5d8){var _0x4fcd76={'$or':{'Phone':_0x2bd253}};var _0x314494={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){logger[_0x9341('0x21')](_0x9341('0x31'),_0x2bd253,_0x37ca7d[_0x9341('0x32')]);switch(_0x37ca7d['moduleSearch']){case'contact_lead':var _0x38e01b=_[_0x9341('0x33')](_0x4fcd76);if(_0x37ca7d['additionalSearchContact']){var _0x51f822={};_0x51f822[_0x37ca7d[_0x9341('0x34')]]=_0x2bd253;_[_0x9341('0x35')](_0x38e01b[_0x9341('0x36')],_0x51f822);}return _0x1fb5d8[_0x9341('0x24')](_0x9341('0x37'))[_0x9341('0x26')](_0x38e01b,_0x314494)[_0x9341('0x27')]()[_0x9341('0x28')](function(_0x26b2a2){if(_0x26b2a2&&_0x26b2a2[_0x9341('0x38')]){return _0x26b2a2;}else{var _0x361367=_[_0x9341('0x33')](_0x4fcd76);if(_0x37ca7d['additionalSearchLead']){var _0x33bc69={};_0x33bc69[_0x37ca7d[_0x9341('0x39')]]=_0x2bd253;_['merge'](_0x361367[_0x9341('0x36')],_0x33bc69);}return _0x1fb5d8[_0x9341('0x24')]('Lead')[_0x9341('0x26')](_0x361367,_0x314494);}});case _0x9341('0x3a'):var _0x35189e=_[_0x9341('0x33')](_0x4fcd76);if(_0x37ca7d[_0x9341('0x3b')]){var _0x51f822={};_0x51f822[_0x37ca7d[_0x9341('0x3b')]]=_0x2bd253;_[_0x9341('0x35')](_0x35189e[_0x9341('0x36')],_0x51f822);}return _0x1fb5d8[_0x9341('0x24')]('Account')['find'](_0x35189e,_0x314494)[_0x9341('0x27')]()[_0x9341('0x28')](function(_0x12c6d3){if(_0x12c6d3&&_0x12c6d3[_0x9341('0x38')]){return _0x12c6d3;}else{var _0x34d77e=_[_0x9341('0x33')](_0x4fcd76);if(_0x37ca7d[_0x9341('0x34')]){var _0x2db7cb={};_0x2db7cb[_0x37ca7d[_0x9341('0x34')]]=_0x2bd253;_[_0x9341('0x35')](_0x34d77e[_0x9341('0x36')],_0x2db7cb);}return _0x1fb5d8[_0x9341('0x24')](_0x9341('0x37'))['find'](_0x34d77e,_0x314494)[_0x9341('0x28')](function(_0x1776e9){if(_0x1776e9&&_0x1776e9[_0x9341('0x38')]){return _0x1776e9;}else{var _0xcb955c=_[_0x9341('0x33')](_0x4fcd76);if(_0x37ca7d['additionalSearchLead']){var _0x33d949={};_0x33d949[_0x37ca7d[_0x9341('0x39')]]=_0x2bd253;_['merge'](_0xcb955c[_0x9341('0x36')],_0x33d949);}return _0x1fb5d8['sobject']('Lead')[_0x9341('0x26')](_0xcb955c,_0x314494);}});}});case _0x9341('0x19'):var _0x38e01b=_[_0x9341('0x33')](_0x4fcd76);if(_0x37ca7d[_0x9341('0x34')]){var _0x51f822={};_0x51f822[_0x37ca7d['additionalSearchContact']]=_0x2bd253;_[_0x9341('0x35')](_0x38e01b[_0x9341('0x36')],_0x51f822);}return _0x1fb5d8[_0x9341('0x24')](_0x9341('0x37'))[_0x9341('0x26')](_0x38e01b,_0x314494)[_0x9341('0x27')]();case _0x9341('0x1a'):var _0x241f06=_[_0x9341('0x33')](_0x4fcd76);if(_0x37ca7d[_0x9341('0x39')]){var _0x51f822={};_0x51f822[_0x37ca7d[_0x9341('0x39')]]=_0x2bd253;_[_0x9341('0x35')](_0x241f06[_0x9341('0x36')],_0x51f822);}return _0x1fb5d8[_0x9341('0x24')](_0x9341('0x3c'))['find'](_0x241f06,_0x314494);case _0x9341('0x1c'):var _0x35189e=_[_0x9341('0x33')](_0x4fcd76);if(_0x37ca7d[_0x9341('0x3b')]){var _0x51f822={};_0x51f822[_0x37ca7d[_0x9341('0x3b')]]=_0x2bd253;_[_0x9341('0x35')](_0x35189e[_0x9341('0x36')],_0x51f822);}return _0x1fb5d8[_0x9341('0x24')](_0x9341('0x3d'))[_0x9341('0x26')](_0x35189e,_0x314494);default:return null;}})[_0x9341('0x28')](function(_0x5ef280){if(_0x5ef280&&_0x5ef280[_0x9341('0x38')]){var _0x20c5d2=_[_0x9341('0x3e')](_0x5ef280);if(_0x20c5d2){return BPromise[_0x9341('0x2b')]({'id':_0x20c5d2['Id'],'name':_0x20c5d2[_0x9341('0x2c')],'phone':_0x20c5d2[_0x9341('0x3f')],'endUserType':_0x20c5d2[_0x9341('0x40')][_0x9341('0x41')]['toLowerCase']()});}}})['then'](function(_0x1ef1dd){if(_0x1ef1dd){logger['info'](_0x9341('0x42'),_0x1ef1dd[_0x9341('0x18')],_0x2bd253);return BPromise[_0x9341('0x2b')](_0x1ef1dd);}else{logger[_0x9341('0x21')](_0x9341('0x43'),_0x2bd253);var _0x478e73={'Phone':_0x2bd253};if(_0x37ca7d['moduleCreate']){if(_0x37ca7d[_0x9341('0x44')]==='contact'){logger[_0x9341('0x21')](_0x9341('0x45'),_0x2bd253,_0x37ca7d[_0x9341('0x44')]);_0x478e73['LastName']=_0x521bfe!==_0x9341('0x46')?_0x521bfe:util[_0x9341('0x47')]('Caller\x20-\x20%s',_0x2bd253);}else if(_0x37ca7d[_0x9341('0x44')]==='lead'){logger[_0x9341('0x21')](_0x9341('0x45'),_0x2bd253,_0x37ca7d[_0x9341('0x44')]);_0x478e73[_0x9341('0x48')]=_0x521bfe!==_0x9341('0x46')?_0x521bfe:util[_0x9341('0x47')](_0x9341('0x49'),_0x2bd253);_0x478e73[_0x9341('0x4a')]=_0x9341('0x4b');}else if(_0x37ca7d['moduleCreate']===_0x9341('0x1c')){logger[_0x9341('0x21')](_0x9341('0x45'),_0x2bd253,_0x37ca7d[_0x9341('0x44')]);_0x478e73[_0x9341('0x2c')]=_0x521bfe!==''?_0x521bfe:util[_0x9341('0x47')](_0x9341('0x49'),_0x2bd253);}else{return null;}}return _0x1fb5d8[_0x9341('0x24')](_['upperFirst'](_0x37ca7d[_0x9341('0x44')]))['create'](_0x478e73)[_0x9341('0x28')](function(_0x3e71a2){return BPromise[_0x9341('0x2b')]({'id':_0x3e71a2['id'],'endUserType':_0x37ca7d[_0x9341('0x44')]});});}});}function getCustomFields(_0x81f627,_0x3f479e){var _0x34687e={};if(_0x81f627[_0x9341('0x38')]>0x0){_[_0x9341('0x4c')](_0x81f627,function(_0x1d3f30){if(_[_0x9341('0x4d')](['string','picklist'],_0x1d3f30[_0x9341('0x41')])&&_0x1d3f30[_0x9341('0x4e')]){_0x34687e[_0x1d3f30[_0x9341('0x4e')]]=_0x1d3f30['content'][_0x9341('0x4f')]();}else if(_0x1d3f30[_0x9341('0x41')]==='variable'&&_0x1d3f30[_0x9341('0x50')]&&_0x1d3f30['idField']){_0x3f479e[_0x1d3f30[_0x9341('0x50')]]&&(_0x34687e[_0x1d3f30[_0x9341('0x4e')]]=_0x3f479e[_0x1d3f30[_0x9341('0x50')]]['toString']());}else if(_0x1d3f30[_0x9341('0x41')]===_0x9341('0x51')&&_0x1d3f30['Variable']&&_0x1d3f30['Variable'][_0x9341('0x52')]&&_0x1d3f30['idField']){_0x3f479e[_0x1d3f30[_0x9341('0x53')][_0x9341('0x52')][_0x9341('0x54')]()]&&(_0x34687e[_0x1d3f30[_0x9341('0x4e')]]=_0x3f479e[_0x1d3f30[_0x9341('0x53')]['name']['toLowerCase']()][_0x9341('0x4f')]());}});}return _0x34687e;}function getConnection(_0x4a5dd7){var _0x2ad8c6=_0x4a5dd7[_0x9341('0x55')]['concat'](_0x4a5dd7[_0x9341('0x56')]);var _0x3e6823=new jsforce['Connection']({'oauth2':{'loginUrl':_0x4a5dd7['remoteUri']||_0x9341('0x57'),'clientId':_0x4a5dd7[_0x9341('0x58')],'clientSecret':_0x4a5dd7['clientSecret']}});return _0x3e6823[_0x9341('0x59')](_0x4a5dd7[_0x9341('0x5a')],_0x2ad8c6)[_0x9341('0x28')](function(){logger[_0x9341('0x21')](_0x9341('0x5b'));return _0x3e6823;});}exports[_0x9341('0x5c')]=function(_0x2a26ca,_0x311ab4,_0x26d281,_0x9dc535,_0xf206bb,_0x3029ba){var _0x11c0e1,_0x159692,_0x28c5a3,_0x3f0d37;_0x3029ba[_0x9341('0x5d')]=intUtil[_0x9341('0x5e')](_0x3029ba[_0x9341('0x5d')]);_0x3029ba[_0x9341('0x5f')]=intUtil[_0x9341('0x5e')](_0x3029ba[_0x9341('0x5f')]);if(_0xf206bb&&_0xf206bb[_0x9341('0x60')]){logger[_0x9341('0x21')](_0x9341('0x61'),'Recording\x20is\x20enabled!');_0x311ab4[_0x9341('0x62')]=util[_0x9341('0x47')](_0x9341('0x63'),_0x3029ba['serverUrl'],_0x311ab4['uniqueid'],md5(_0x311ab4[_0x9341('0x64')]));}else{_0x311ab4[_0x9341('0x62')]='';}return getConnection(_0x3029ba)['then'](function(_0x44dc4f){_0x3f0d37=_0x44dc4f;return getUser(_0x3029ba,_0x9dc535[_0x9341('0x65')],_0x3f0d37);})[_0x9341('0x28')](function(_0x3d4240){_0x11c0e1=_0x3d4240;return getEndUser(_0x3029ba,_0x26d281,_0x311ab4[_0x9341('0x66')],_0x311ab4['calleridnum'],_0x3f0d37);})['then'](function(_0x46613e){_0x159692=_0x46613e;return getTicket(_0x3029ba,_0x11c0e1,_0x159692,_0x26d281,_0x311ab4,_0x26d281['Fields'],_0x3f0d37,_0x9341('0x5c'));})[_0x9341('0x28')](function(_0x1d0830){_0x28c5a3=_0x1d0830;logger[_0x9341('0x21')](_0x9341('0x67'),_0x28c5a3['id']);logger[_0x9341('0x21')](_0x9341('0x68'),_0x28c5a3['id'],_0x9dc535[_0x9341('0x52')],_0x3029ba[_0x9341('0x41')]);switch(_0x3029ba[_0x9341('0x41')]){case _0x9341('0x69'):emit(util[_0x9341('0x47')](_0x9341('0x6a'),_0x9dc535['name']),_0x9341('0x6b'),{'recordId':_0x28c5a3['id']});break;case _0x9341('0x6c'):emit(util[_0x9341('0x47')](_0x9341('0x6a'),_0x9dc535['name']),_0x9341('0x6d'),{'uri':util[_0x9341('0x47')](_0x9341('0x6e'),_0x3f0d37['instanceUrl'],_0x28c5a3['id'])});break;default:logger[_0x9341('0x6f')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x3c374a){logger['error'](_0x9341('0x61'),_0x3c374a);});};exports[_0x9341('0x70')]=function(_0x200497,_0x363edb,_0xa5cccf,_0x4b7c03,_0x30a9d1,_0x5ebd4a,_0x3b5240){var _0x4b846c,_0x50b27f,_0xe4fb85,_0x23ac0b;_0x5ebd4a[_0x9341('0x5d')]=intUtil[_0x9341('0x5e')](_0x5ebd4a[_0x9341('0x5d')]);_0x5ebd4a[_0x9341('0x5f')]=intUtil[_0x9341('0x5e')](_0x5ebd4a[_0x9341('0x5f')]);if(_0x3b5240&&_0x3b5240['recordingFormat']&&_0x3b5240[_0x9341('0x71')]!==_0x9341('0x72')){logger['info']('[OUTBOUND]',_0x9341('0x73'));_0x363edb['recordingURL']=util[_0x9341('0x47')](_0x9341('0x63'),_0x5ebd4a[_0x9341('0x5d')],_0x363edb[_0x9341('0x64')],md5(_0x363edb[_0x9341('0x64')]));}return getConnection(_0x5ebd4a)[_0x9341('0x28')](function(_0x215ebb){_0x23ac0b=_0x215ebb;return getUser(_0x5ebd4a,_0x4b7c03[_0x9341('0x65')],_0x23ac0b);})[_0x9341('0x28')](function(_0x5464b0){_0x4b846c=_0x5464b0;return getEndUser(_0x5ebd4a,_0xa5cccf,_0x363edb[_0x9341('0x74')],_0x363edb['destcalleridnum'],_0x23ac0b);})[_0x9341('0x28')](function(_0x44d2c0){_0x50b27f=_0x44d2c0;return getTicket(_0x5ebd4a,_0x4b846c,_0x50b27f,_0xa5cccf,_0x363edb,_0xa5cccf[_0x9341('0x75')],_0x23ac0b,_0x9341('0x70'));})[_0x9341('0x28')](function(_0x5f2ac5){_0xe4fb85=_0x5f2ac5;logger[_0x9341('0x21')](_0x9341('0x76'),_0xe4fb85['id']);logger[_0x9341('0x21')](_0x9341('0x77'),_0xe4fb85['id'],_0x4b7c03['name'],_0x5ebd4a[_0x9341('0x41')]);switch(_0x5ebd4a[_0x9341('0x41')]){case _0x9341('0x69'):emit(util[_0x9341('0x47')](_0x9341('0x6a'),_0x4b7c03[_0x9341('0x52')]),_0x9341('0x6b'),{'recordId':_0xe4fb85['id']});break;case _0x9341('0x6c'):emit(util[_0x9341('0x47')](_0x9341('0x6a'),_0x4b7c03[_0x9341('0x52')]),_0x9341('0x6d'),{'uri':util['format']('%s/%s/e',_0x23ac0b['instanceUrl'],_0xe4fb85['id'])});break;default:logger[_0x9341('0x6f')]('[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x9341('0x78')](function(_0x8c2e09){logger[_0x9341('0x6f')]('[OUTBOUND]',_0x8c2e09);});};exports[_0x9341('0x79')]=function(_0x2a0ad8,_0x5b74cc,_0x1a1da7,_0x1a958c,_0x5de181,_0x1cd81d){var _0xbcf0e9,_0xd99683,_0x161c88,_0xf51064;_0x1cd81d[_0x9341('0x5d')]=intUtil[_0x9341('0x5e')](_0x1cd81d[_0x9341('0x5d')]);_0x1cd81d[_0x9341('0x5f')]=intUtil[_0x9341('0x5e')](_0x1cd81d[_0x9341('0x5f')]);if(_0x5de181&&_0x5de181[_0x9341('0x60')]){logger[_0x9341('0x21')]('['+_0x5b74cc['lastevent']['toUpperCase']()+']',_0x9341('0x73'));_0x5b74cc[_0x9341('0x62')]=util[_0x9341('0x47')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1cd81d[_0x9341('0x5d')],_0x5b74cc['uniqueid'],md5(_0x5b74cc[_0x9341('0x64')]));}else{_0x5b74cc[_0x9341('0x62')]='';}return getConnection(_0x1cd81d)[_0x9341('0x28')](function(_0x431a15){_0xf51064=_0x431a15;if(!_[_0x9341('0x7a')](_0x1a958c)){return getUser(_0x1cd81d,_0x1a958c['name'],_0xf51064);}else{return getUser(_0x1cd81d,null,_0xf51064);}})[_0x9341('0x28')](function(_0x1ce816){_0xbcf0e9=_0x1ce816;return getEndUser(_0x1cd81d,_0x1a1da7,_0x5b74cc[_0x9341('0x66')],_0x5b74cc[_0x9341('0x7b')],_0xf51064);})['then'](function(_0x3d134c){_0xd99683=_0x3d134c;return getTicket(_0x1cd81d,_0xbcf0e9,_0xd99683,_0x1a1da7,_0x5b74cc,_0x1a1da7[_0x9341('0x75')],_0xf51064);})[_0x9341('0x28')](function(_0x53cb6b){_0x161c88=_0x53cb6b;logger[_0x9341('0x21')]('['+_0x5b74cc['lastevent'][_0x9341('0x7c')]()+']\x20Ticket\x20%s\x20created.',_0x161c88['id']);logger[_0x9341('0x21')]('['+_0x5b74cc[_0x9341('0x7d')][_0x9341('0x7c')]()+_0x9341('0x7e'),_0x1cd81d[_0x9341('0x41')]);})['catch'](function(_0x1764a8){logger[_0x9341('0x6f')]('['+_0x5b74cc[_0x9341('0x7d')][_0x9341('0x7c')]()+']',_0x1764a8);});}; \ 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 94acde9..d921c97 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 _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 +var _0x2820=['username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','result','length','adminId','sys_id','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','info','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','true','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20createEndUser\x20crm','includes','picklist','type','nameField','toLowerCase','toString','idField','content','variable','variableName','customField','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','POST','assign','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','incident','Incident','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','trigger:browser:url'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x2820,0x1c4));var _0x0282=function(_0x51da50,_0x2dacc8){_0x51da50=_0x51da50-0x0;var _0x117660=_0x2820[_0x51da50];return _0x117660;};'use strict';var _=require(_0x0282('0x0'));var Promise=require('bluebird');var rp=require(_0x0282('0x1'));var util=require(_0x0282('0x2'));var md5=require(_0x0282('0x3'));var Redis=require(_0x0282('0x4'));var intUtil=require('./util');var config=require(_0x0282('0x5'));var logger=require(_0x0282('0x6'))(_0x0282('0x7'));config[_0x0282('0x8')]=_[_0x0282('0x9')](config[_0x0282('0x8')],{'host':_0x0282('0xa'),'port':0x18eb});var io=require(_0x0282('0xb'))(new Redis(config[_0x0282('0x8')]));function getAdminUser(_0x117ea6,_0x1b3737,_0x417707,_0x5c5723,_0x47199d,_0x3decbd){return new Promise(function(_0x23dd9b,_0x4a749e){var _0x47ffb4={'method':_0x0282('0xc'),'uri':_0x5c5723+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x47199d+'&'+_0x3decbd,'auth':_0x1b3737,'json':!![]};return rp(_0x47ffb4)['then'](function(_0x347b75){if(_0x347b75[_0x0282('0xd')][_0x0282('0xe')]>0x0){_0x417707[_0x0282('0xf')]=_0x347b75[_0x0282('0xd')][0x0][_0x0282('0x10')];}logger['info']('['+[_0x117ea6['toUpperCase']()]+_0x0282('0x11'),_0x417707);_0x23dd9b(_0x417707);})[_0x0282('0x12')](function(_0x4f2927){logger[_0x0282('0x13')]('['+[_0x117ea6[_0x0282('0x14')]()]+']',_0x4f2927[_0x0282('0x15')]);_0x4a749e(_0x4f2927['message']);});});}function getUser(_0x51089f,_0x47d0a7,_0xca9ef5,_0xe12a99,_0x399634){return function(_0x3e15a8){logger[_0x0282('0x16')]('['+[_0x51089f[_0x0282('0x14')]()]+'],\x20getUser\x20input\x20crm',_0x3e15a8);return new Promise(function(_0xf309e7,_0x364f9e){if(intUtil['validateEmail'](_0x3e15a8[_0x0282('0x17')])){var _0x69c71a={'method':_0x0282('0xc'),'uri':_0xca9ef5+_0x0282('0x18')+_0x3e15a8[_0x0282('0x17')]+'&'+_0xe12a99+'&'+_0x399634,'auth':_0x47d0a7,'json':!![]};logger[_0x0282('0x16')]('['+[_0x51089f[_0x0282('0x14')]()]+_0x0282('0x19'),_0x69c71a);return rp(_0x69c71a)[_0x0282('0x1a')](function(_0x5a302d){logger[_0x0282('0x16')]('['+[_0x51089f[_0x0282('0x14')]()]+_0x0282('0x1b'),_0x5a302d);if(_0x5a302d[_0x0282('0xd')][_0x0282('0xe')]>0x0&&String(_0x5a302d[_0x0282('0xd')][0x0]['active'])===_0x0282('0x1c')){_0x3e15a8[_0x0282('0x1d')]=_0x5a302d[_0x0282('0xd')][0x0][_0x0282('0x10')];}else{_0x3e15a8[_0x0282('0x1d')]=_0x3e15a8[_0x0282('0xf')];_0x3e15a8[_0x0282('0x17')]=_0x3e15a8['adminEmail'];}logger['info']('['+[_0x51089f[_0x0282('0x14')]()]+_0x0282('0x1e'),_0x3e15a8);_0xf309e7(_0x3e15a8);})[_0x0282('0x12')](function(_0x81ce27){logger[_0x0282('0x13')]('['+[_0x51089f[_0x0282('0x14')]()]+']',_0x81ce27['message']);_0x364f9e(_0x81ce27['message']);});}else{logger[_0x0282('0x16')]('['+[_0x51089f[_0x0282('0x14')]()]+_0x0282('0x1f'));_0x3e15a8[_0x0282('0x1d')]=_0x3e15a8[_0x0282('0xf')];_0x3e15a8[_0x0282('0x17')]=_0x3e15a8[_0x0282('0x20')];_0xf309e7(_0x3e15a8);}});};}function createEndUser(_0x25d26f,_0x482ee0,_0x45c1fb,_0x4e13ae,_0x2bc5e0){logger[_0x0282('0x16')]('['+[_0x25d26f[_0x0282('0x14')]()]+_0x0282('0x21'),_0x45c1fb);return new Promise(function(_0x348cbe,_0x2dbb70){var _0xbd21d7={'method':'POST','uri':_0x4e13ae+_0x0282('0x22')+_0x2bc5e0,'body':{'user_name':_0x45c1fb[_0x0282('0x23')],'roles':'user','first_name':_0x45c1fb['endUserNumber'],'active':_0x0282('0x1c'),'date_format':_0x0282('0x24'),'phone':_0x45c1fb['endUserNumber']},'auth':_0x482ee0,'json':!![]};return rp(_0xbd21d7)[_0x0282('0x1a')](function(_0x9171bb){logger['info']('['+[_0x25d26f[_0x0282('0x14')]()]+_0x0282('0x25'),_0x9171bb['result']);_0x45c1fb['endUserId']=_0x9171bb[_0x0282('0xd')][_0x0282('0x10')];_0x348cbe(_0x45c1fb);})[_0x0282('0x12')](function(_0x56d625){logger[_0x0282('0x13')]('['+[_0x25d26f[_0x0282('0x14')]()]+']',_0x56d625[_0x0282('0x15')]);_0x2dbb70(_0x56d625[_0x0282('0x15')]);});});}function getEndUser(_0x5d398e,_0x305153,_0x12469c,_0x3e9463,_0x2edc95){return function(_0x32771){logger['info']('['+[_0x5d398e[_0x0282('0x14')]()]+_0x0282('0x26'),_0x32771);return new Promise(function(_0xb405ea,_0x44f024){var _0x516de5={'method':'GET','uri':_0x12469c+_0x0282('0x27')+_0x32771[_0x0282('0x23')]+'&'+_0x3e9463+'&'+_0x2edc95,'auth':_0x305153,'json':!![]};return rp(_0x516de5)[_0x0282('0x1a')](function(_0x46afd8){if(_0x46afd8[_0x0282('0xd')][_0x0282('0xe')]>0x0){_0x32771[_0x0282('0x28')]=_0x46afd8['result'][0x0][_0x0282('0x10')];logger[_0x0282('0x16')]('['+[_0x5d398e[_0x0282('0x14')]()]+'],\x20getEndUser\x20crm',_0x32771);_0xb405ea(_0x32771);}else{return createEndUser(_0x5d398e,_0x305153,_0x32771,_0x12469c,_0x3e9463)[_0x0282('0x1a')](function(_0x239a0d){logger['info']('['+[_0x5d398e[_0x0282('0x14')]()]+_0x0282('0x29'),_0x239a0d);_0xb405ea(_0x239a0d);});}})[_0x0282('0x12')](function(_0x21275f){logger[_0x0282('0x13')]('['+[_0x5d398e[_0x0282('0x14')]()]+']',_0x21275f[_0x0282('0x15')]);_0x44f024(_0x21275f[_0x0282('0x15')]);});});};}function getCustomFields(_0x5e4af9,_0x3d1b6e){var _0x333f41={};if(_0x5e4af9[_0x0282('0xe')]>0x0){_['forEach'](_0x5e4af9,function(_0x2626e3){if(_[_0x0282('0x2a')](['string',_0x0282('0x2b')],_0x2626e3[_0x0282('0x2c')])&&_0x2626e3[_0x0282('0x2d')]&&!_0x2626e3['customField']){_0x333f41[_0x2626e3[_0x0282('0x2d')][_0x0282('0x2e')]()]=_0x2626e3['content'][_0x0282('0x2f')]();}else if(_[_0x0282('0x2a')](['string','picklist'],_0x2626e3[_0x0282('0x2c')])&&_0x2626e3[_0x0282('0x30')]&&_0x2626e3['customField']){_0x333f41[_0x2626e3[_0x0282('0x30')][_0x0282('0x2e')]()]=_0x2626e3[_0x0282('0x31')][_0x0282('0x2f')]();}else if(_0x2626e3['type']===_0x0282('0x32')&&_0x2626e3[_0x0282('0x33')]&&_0x2626e3['idField']&&_0x2626e3[_0x0282('0x34')]){_0x333f41[_0x2626e3['idField'][_0x0282('0x2e')]()]=_0x3d1b6e[_0x2626e3['variableName']][_0x0282('0x2f')]();}else if(_0x2626e3['type']===_0x0282('0x35')&&_0x2626e3[_0x0282('0x36')]&&_0x2626e3[_0x0282('0x36')][_0x0282('0x37')]&&_0x2626e3[_0x0282('0x30')]&&_0x2626e3[_0x0282('0x34')]){_0x333f41[_0x2626e3['idField']['toLowerCase']()]=_0x3d1b6e[_0x2626e3[_0x0282('0x36')][_0x0282('0x37')][_0x0282('0x2e')]()][_0x0282('0x2f')]();}});}return _0x333f41;}function getTicket(_0x16f2d9,_0x1ae84e,_0x31b845,_0x5e2837,_0x42ca88,_0x17da5a){return function(_0x35da57){logger[_0x0282('0x16')]('['+[_0x16f2d9['toUpperCase']()]+_0x0282('0x38'),_0x35da57);return new Promise(function(_0x1587e7,_0x4e1d94){var _0xa18a1d=_0x16f2d9[_0x0282('0x2e')]()===_0x0282('0x39')?_0x35da57['userId']:_0x35da57[_0x0282('0x28')];var _0x1203f2={'method':_0x0282('0x3a'),'uri':_0x31b845+'incident'+'?'+_0x17da5a,'body':Object[_0x0282('0x3b')]({},{'active':_0x0282('0x1c'),'caller_id':_0xa18a1d,'assigned_to':_0x35da57[_0x0282('0x1d')],'short_description':intUtil[_0x0282('0x3c')](_0x5e2837[_0x0282('0x3d')],_0x42ca88,'\x20'),'description':intUtil[_0x0282('0x3c')](_0x5e2837[_0x0282('0x3e')],_0x42ca88,'\x0a')},getCustomFields(_0x5e2837['Fields'],_0x42ca88)),'auth':_0x1ae84e,'json':!![]};return rp(_0x1203f2)[_0x0282('0x1a')](function(_0x1fafe1){logger[_0x0282('0x16')]('['+[_0x16f2d9[_0x0282('0x14')]()]+_0x0282('0x3f'),_0x1fafe1['result']);_0x35da57[_0x0282('0x40')]=_0x1fafe1[_0x0282('0xd')][_0x0282('0x10')];_0x35da57[_0x0282('0x41')]=_0x1fafe1[_0x0282('0xd')]['number'];logger['info']('['+[_0x16f2d9[_0x0282('0x14')]()]+_0x0282('0x42'),_0x35da57);_0x1587e7(_0x35da57);})[_0x0282('0x12')](function(_0x20a24a){logger[_0x0282('0x13')]('['+[_0x16f2d9[_0x0282('0x14')]()]+']',_0x20a24a[_0x0282('0x15')]);_0x4e1d94(_0x20a24a[_0x0282('0x15')]);});});};}function createRemoteTag(_0x295135,_0x4ebd46,_0x460011,_0x3b4a3a){return new Promise(function(_0x3293a4,_0x574b66){var _0x1b8e9f={'method':_0x0282('0x3a'),'uri':_0x460011+_0x0282('0x43')+'?'+_0x3b4a3a,'body':{'short_description':_0x295135,'global':!![],'active':!![],'name':_0x295135},'auth':_0x4ebd46,'json':!![]};return rp(_0x1b8e9f)[_0x0282('0x1a')](function(_0x583ecb){var _0x3f3719=_0x583ecb[_0x0282('0xd')][_0x0282('0x10')];_0x3293a4(_0x3f3719);});});}function getRemoteTag(_0x2f6459,_0xaf5a0c,_0x15d10b,_0x378142,_0x48a76c){return new Promise(function(_0x2a022a,_0x1ee757){var _0x352a03={'method':_0x0282('0xc'),'uri':_0x15d10b+'label'+_0x0282('0x44')+_0x2f6459+'&'+_0x378142,'auth':_0xaf5a0c,'json':!![]};return rp(_0x352a03)[_0x0282('0x1a')](function(_0x5db0d8){if(_0x5db0d8['result'][_0x0282('0xe')]>0x0){var _0x5d461d=_0x5db0d8[_0x0282('0xd')][0x0][_0x0282('0x10')];_0x2a022a(_0x5d461d);}else{return createRemoteTag(_0x2f6459,_0xaf5a0c,_0x15d10b,_0x378142)['then'](function(_0x535082){_0x2a022a(_0x535082);});}});});}function assignTagToIncident(_0x22d22f,_0x4fe5bc,_0x3e7545,_0x3f50ef,_0x2f1700){return new Promise(function(_0x2566a8,_0x745829){var _0x34745e={'method':_0x0282('0x3a'),'uri':_0x3e7545+_0x0282('0x45')+'?'+_0x2f1700,'body':{'label':_0x22d22f,'table':_0x0282('0x46'),'id_type':_0x0282('0x47'),'table_key':_0x3f50ef['ticketId'],'title':'Incident\x20-\x20'+_0x3f50ef[_0x0282('0x41')],'id_display':_0x3f50ef['ticketNumber']},'auth':_0x4fe5bc,'json':!![]};return rp(_0x34745e)[_0x0282('0x1a')](function(_0x3973a9){_0x2566a8();})[_0x0282('0x12')](function(){_0x2566a8();});});}function manageTags(_0x1b2158,_0x148451,_0x174e4e,_0x2d2125,_0x31e233,_0x3684cf,_0x384556){return new Promise(function(_0x5a39f1,_0x3edac1){var _0x25036a=[];_0x148451[_0x0282('0x48')](function(_0xf98b8b){_0x25036a[_0x0282('0x49')](getRemoteTag(_0xf98b8b,_0x174e4e,_0x2d2125,_0x3684cf,_0x384556));});return Promise[_0x0282('0x4a')](_0x25036a)[_0x0282('0x1a')](function(_0x1c4b59){if(_0x1c4b59[_0x0282('0xe')]){logger['info']('['+[_0x1b2158[_0x0282('0x14')]()]+_0x0282('0x4b'),_0x1c4b59);var _0x497924=[];_0x1c4b59['forEach'](function(_0x4d2a35){_0x497924[_0x0282('0x49')](assignTagToIncident(_0x4d2a35,_0x174e4e,_0x2d2125,_0x31e233,_0x3684cf));});return Promise[_0x0282('0x4a')](_0x497924)[_0x0282('0x1a')](function(){_0x5a39f1();})[_0x0282('0x12')](function(){_0x5a39f1();});}else{_0x5a39f1();}});});}function getTags(_0x444f75,_0xe1f508,_0x5866e1,_0x40b408,_0x58d2c7,_0x87f5b2){return function(_0x58c611){return new Promise(function(_0x7d4257,_0x117d19){var _0xd5604=[];var _0x4b5254=_0x40b408['Tags'];if(_0x4b5254&&_0x4b5254[_0x0282('0xe')]>0x0){_0xd5604=_[_0x0282('0x4c')](_0x4b5254,_0x0282('0x37'));}if(_0xd5604[_0x0282('0xe')]>0x0){return manageTags(_0x444f75,_0xd5604,_0xe1f508,_0x5866e1,_0x58c611,_0x58d2c7,_0x87f5b2)[_0x0282('0x1a')](function(){_0x7d4257(_0x58c611);});}else{_0x7d4257(_0x58c611);}});};}function emit(_0xc515eb,_0x159fc7,_0x5a64fa){var _0x5aa798='%26sysparm_record_target%3Dincident'+_0x0282('0x4d')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x0282('0x4e');var _0x519e9d={'uri':_0xc515eb+_0x0282('0x4f')+_0x5a64fa+_0x5aa798};io['to'](util[_0x0282('0x50')](_0x0282('0x51'),_0x159fc7))['emit'](_0x0282('0x52'),_0x519e9d);}exports['cs']=function(_0x5ef81b,_0x3f6268,_0x1b160c,_0x3f65fa,_0x2e599d,_0x49d946,_0xc66efd,_0x12b60a){var _0x2e1177={};var _0x54028b={'user':_0x49d946[_0x0282('0x53')],'pass':_0x49d946[_0x0282('0x54')]};var _0x4ecfff='sysparm_limit=1';var _0x5a7ede=_0x0282('0x55');_0x49d946[_0x0282('0x56')]=intUtil[_0x0282('0x57')](_0x49d946[_0x0282('0x56')]);_0x49d946[_0x0282('0x58')]=intUtil[_0x0282('0x57')](_0x49d946['serverUrl']);var _0x4a2647=util[_0x0282('0x50')](_0x0282('0x59'),_0x49d946['remoteUri']);_0x2e1177[_0x0282('0x17')]=!_['isNil'](_0x3f65fa)?_0x3f65fa[_0x0282('0x5a')]:null;_0x2e1177[_0x0282('0x20')]=_0x49d946[_0x0282('0x5a')];_0x2e1177[_0x0282('0x23')]=_0x12b60a['toLowerCase']()===_0x0282('0x39')?_0x3f6268[_0x0282('0x5b')]:_0x3f6268[_0x0282('0x5c')];_0x2e1177[_0x0282('0x5d')]=_0x12b60a===_0x0282('0x5e')||_0x12b60a===_0x0282('0x5f')?_0x0282('0x5e'):'outbound';var _0x1de037=util[_0x0282('0x50')](_0x0282('0x60'),_0x49d946[_0x0282('0x58')],_0x3f6268[_0x0282('0x61')],md5(_0x3f6268[_0x0282('0x61')]));if(_0x2e599d&&_0x2e599d[_0x0282('0x62')]){logger['info']('[QUEUE]',_0x0282('0x63'));_0x3f6268['recordingURL']=_0x1de037;}else if(_0xc66efd&&_0xc66efd[_0x0282('0x64')]&&_0xc66efd[_0x0282('0x64')]!==_0x0282('0x65')){logger[_0x0282('0x16')](_0x0282('0x66'),_0x0282('0x63'));_0x3f6268[_0x0282('0x67')]=_0x1de037;}else{_0x3f6268[_0x0282('0x67')]='';}return getAdminUser(_0x12b60a,_0x54028b,_0x2e1177,_0x4a2647,_0x5a7ede,_0x4ecfff)[_0x0282('0x1a')](getUser(_0x12b60a,_0x54028b,_0x4a2647,_0x5a7ede,_0x4ecfff))[_0x0282('0x1a')](getEndUser(_0x12b60a,_0x54028b,_0x4a2647,_0x5a7ede,_0x4ecfff))[_0x0282('0x1a')](getTicket(_0x12b60a,_0x54028b,_0x4a2647,_0x1b160c,_0x3f6268,_0x5a7ede))[_0x0282('0x1a')](function(_0x1d0418){logger[_0x0282('0x16')](util[_0x0282('0x50')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1d0418[_0x0282('0x40')]));logger[_0x0282('0x16')](util[_0x0282('0x50')](_0x0282('0x68'),_0x12b60a));if(_0x12b60a!==_0x0282('0x5f')){logger[_0x0282('0x16')]('['+[_0x12b60a[_0x0282('0x14')]()]+']',_0x0282('0x69'));emit(_0x49d946[_0x0282('0x56')],_0x3f65fa[_0x0282('0x37')],_0x1d0418[_0x0282('0x40')]);}})['catch'](function(_0x4c38fb){logger['error']('['+[_0x12b60a[_0x0282('0x14')]()]+_0x0282('0x6a'),util['inspect'](_0x4c38fb,{'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 55823a2..b074e1e 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 _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 +var _0xab34=['username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','outbound','recordingFormat','none','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','trigger:browser:url','error','lastevent','toUpperCase','lodash','bluebird','md5','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','emit','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','created_by','description','toISOString','slice','replace','duration_minutes','parent_id','parent_type','parent_name','name','length','forEach','variableName','idField','set_entry','JSON','stringify','format','Basic\x20%s','get_server_info','isNil','Getting\x20agent\x20with\x20name','user_name','find','entry_list','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','debug','[HTTP]','merge','map','type','string','nameField','toLowerCase','content','toString','variable','customField','push','customVariable','Variable','custom_fields','POST','login'];(function(_0x50eb7e,_0x159fee){var _0x2e0ef8=function(_0x402ddc){while(--_0x402ddc){_0x50eb7e['push'](_0x50eb7e['shift']());}};_0x2e0ef8(++_0x159fee);}(_0xab34,0xa5));var _0x4ab3=function(_0x4457a1,_0x2946c4){_0x4457a1=_0x4457a1-0x0;var _0x46134e=_0xab34[_0x4457a1];return _0x46134e;};'use strict';var _=require(_0x4ab3('0x0'));var rp=require('request-promise');var BPromise=require(_0x4ab3('0x1'));var md5=require(_0x4ab3('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x4ab3('0x3'));var config=require(_0x4ab3('0x4'));var logger=require(_0x4ab3('0x5'))(_0x4ab3('0x6'));config[_0x4ab3('0x7')]=_[_0x4ab3('0x8')](config[_0x4ab3('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4ab3('0x7')]));var def={'method':'POST','json':!![]};function emit(_0x59d076,_0x1a960b,_0x4aac85){io['to'](_0x59d076)[_0x4ab3('0x9')](_0x1a960b,_0x4aac85);}function getTicket(_0xff46e4,_0x8ec4d7,_0x416c8c,_0x1e7d8f,_0x414d3d,_0x5658a5,_0x4c2c57,_0x4bea50){logger[_0x4ab3('0xa')](_0x4ab3('0xb'));var _0x480395=new Date();var _0x2207b3=[{'name':'name','value':intUtil[_0x4ab3('0xc')](_0x1e7d8f[_0x4ab3('0xd')],_0x414d3d,'\x20')},{'name':_0x4ab3('0xe'),'value':_0x8ec4d7['id']},{'name':_0x4ab3('0xf'),'value':_0x8ec4d7['id']},{'name':_0x4ab3('0x10'),'value':intUtil[_0x4ab3('0xc')](_0x1e7d8f['Descriptions'],_0x414d3d,'\x0a')},{'name':'date_start','value':_0x480395[_0x4ab3('0x11')]()[_0x4ab3('0x12')](0x0,0x13)[_0x4ab3('0x13')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x4ab3('0x14'),'value':'15'},{'name':_0x4ab3('0x15'),'value':_0x416c8c['id']},{'name':_0x4ab3('0x16'),'value':'Contacts'},{'name':_0x4ab3('0x17'),'value':_0x416c8c[_0x4ab3('0x18')]},{'name':'direction','value':_0x4bea50}];if(_0x5658a5[_0x4ab3('0x19')]){_[_0x4ab3('0x1a')](_0x5658a5,function(_0x5ce415){if(_0x414d3d[_0x5ce415[_0x4ab3('0x1b')]]){_0x2207b3['push']({'name':_0x5ce415[_0x4ab3('0x1c')],'value':_0x414d3d[_0x5ce415[_0x4ab3('0x1b')]]});}});}return request({'form':{'method':_0x4ab3('0x1d'),'input_type':_0x4ab3('0x1e'),'response_type':_0x4ab3('0x1e'),'rest_data':JSON[_0x4ab3('0x1f')]({'session':_0x4c2c57['id'],'module_name':'Calls','name_value_list':_0x2207b3})}});}function getAuth(_0x28414a){return util[_0x4ab3('0x20')](_0x4ab3('0x21'),new Buffer(_0x28414a['apiKey']+':X')['toString']('base64'));}function getServerInfo(_0x4c4614){return request({'form':{'method':_0x4ab3('0x22'),'input_type':_0x4ab3('0x1e'),'response_type':'JSON','rest_data':JSON[_0x4ab3('0x1f')]({'session':_0x4c4614['id']})}});}function getUser(_0xa1ab8a,_0x2c9b0f,_0x19685d){if(!_[_0x4ab3('0x23')](_0x2c9b0f)){logger[_0x4ab3('0xa')](_0x4ab3('0x24'),_0x2c9b0f);return request({'form':{'method':'get_entry_list','input_type':_0x4ab3('0x1e'),'response_type':'JSON','rest_data':JSON[_0x4ab3('0x1f')]({'session':_0x19685d['id'],'module_name':'Employees','query':util[_0x4ab3('0x20')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x2c9b0f),'order_by':'','offset':'0','select_fields':['id',_0x4ab3('0x18'),_0x4ab3('0x25')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x1e3451){if(_0x1e3451['entry_list'][_0x4ab3('0x19')]){var _0x3d8a63=_[_0x4ab3('0x26')](_0x1e3451[_0x4ab3('0x27')],function(_0x5d2625){return _0x5d2625[_0x4ab3('0x28')][_0x4ab3('0x25')][_0x4ab3('0x29')]===_0x2c9b0f;});if(_0x3d8a63){logger[_0x4ab3('0xa')](_0x4ab3('0x2a'));return BPromise[_0x4ab3('0x2b')]({'id':_0x3d8a63[_0x4ab3('0x28')]['id']['value'],'name':_0x3d8a63[_0x4ab3('0x28')][_0x4ab3('0x18')]['value']});}}logger[_0x4ab3('0xa')](_0x4ab3('0x2c'));return BPromise[_0x4ab3('0x2b')]({'id':_0x19685d[_0x4ab3('0x28')][_0x4ab3('0x2d')][_0x4ab3('0x29')],'name':_0x19685d[_0x4ab3('0x28')][_0x4ab3('0x25')][_0x4ab3('0x29')]});});}else{logger[_0x4ab3('0xa')](_0x4ab3('0x2e'));return BPromise[_0x4ab3('0x2b')]({'id':_0x19685d[_0x4ab3('0x28')][_0x4ab3('0x2d')]['value'],'name':_0x19685d['name_value_list'][_0x4ab3('0x25')][_0x4ab3('0x29')]});}}function getEndUser(_0x5e49f5,_0x5cd6fb,_0x2aca6b,_0x8321d9){logger['info'](_0x4ab3('0x2f'),_0x2aca6b);return request({'form':{'method':_0x4ab3('0x30'),'input_type':_0x4ab3('0x1e'),'response_type':_0x4ab3('0x1e'),'rest_data':JSON[_0x4ab3('0x1f')]({'session':_0x8321d9['id'],'module_name':_0x4ab3('0x31'),'query':util[_0x4ab3('0x20')](_0x4ab3('0x32'),_0x2aca6b),'order_by':'','offset':'0','select_fields':['id',_0x4ab3('0x18'),_0x4ab3('0x33')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4ab3('0x34')](function(_0x3b55c2){if(_0x3b55c2[_0x4ab3('0x27')][_0x4ab3('0x19')]){var _0x53c2cb=_[_0x4ab3('0x26')](_0x3b55c2['entry_list'],function(_0x3500be){return _0x3500be[_0x4ab3('0x28')][_0x4ab3('0x33')][_0x4ab3('0x29')]===_0x2aca6b;});if(_0x53c2cb){logger['info']('Enduser\x20found!');return BPromise[_0x4ab3('0x2b')]({'id':_0x53c2cb[_0x4ab3('0x28')]['id'][_0x4ab3('0x29')],'name':_0x53c2cb[_0x4ab3('0x28')][_0x4ab3('0x18')]['value'],'phone':_0x53c2cb[_0x4ab3('0x28')][_0x4ab3('0x33')][_0x4ab3('0x29')]});}}else{logger[_0x4ab3('0xa')](_0x4ab3('0x35'));return request({'form':{'method':_0x4ab3('0x1d'),'input_type':_0x4ab3('0x1e'),'response_type':'JSON','rest_data':JSON[_0x4ab3('0x1f')]({'session':_0x8321d9['id'],'module_name':_0x4ab3('0x31'),'name_value_list':[{'name':_0x4ab3('0x36'),'value':_0x5cd6fb!==_0x4ab3('0x37')?_0x5cd6fb:util[_0x4ab3('0x20')](_0x4ab3('0x38'),_0x2aca6b)},{'name':_0x4ab3('0x33'),'value':_0x2aca6b}]})}})['then'](function(_0x16b474){logger[_0x4ab3('0xa')]('Enduser\x20created.');return BPromise['resolve']({'id':_0x16b474['id'],'name':_0x16b474[_0x4ab3('0x27')][_0x4ab3('0x36')][_0x4ab3('0x29')],'phone':_0x16b474['entry_list'][_0x4ab3('0x33')][_0x4ab3('0x29')]});});}});}function request(_0x4ff1bc){logger[_0x4ab3('0x39')](_0x4ab3('0x3a'),JSON[_0x4ab3('0x1f')](_0x4ff1bc));return rp(_[_0x4ab3('0x3b')](def,_0x4ff1bc));}function getTags(_0x9433f,_0x2d259f){var _0x290f1b=[];if(_0x9433f&&_0x9433f[_0x4ab3('0x19')]>0x0){_0x290f1b=_[_0x4ab3('0x3c')](_0x9433f,_0x2d259f);}return _0x290f1b;}function getCustomFields(_0x44b10f,_0x573337){var _0x394ce8=[];var _0x305b87={'custom_fields':[]};if(_0x44b10f[_0x4ab3('0x19')]>0x0){_[_0x4ab3('0x1a')](_0x44b10f,function(_0x32fcaa){if(_0x32fcaa[_0x4ab3('0x3d')]===_0x4ab3('0x3e')&&_0x32fcaa[_0x4ab3('0x3f')]&&!_0x32fcaa['customField']){_0x305b87[_0x32fcaa['nameField'][_0x4ab3('0x40')]()]=_0x32fcaa[_0x4ab3('0x41')][_0x4ab3('0x42')]();}else if(_0x32fcaa['type']==='string'&&_0x32fcaa[_0x4ab3('0x1c')]&&_0x32fcaa['customField']){_0x305b87['custom_fields']['push']({'id':_0x32fcaa[_0x4ab3('0x1c')],'value':_0x32fcaa[_0x4ab3('0x41')][_0x4ab3('0x42')]()});}else if(_0x32fcaa[_0x4ab3('0x3d')]===_0x4ab3('0x43')&&_0x32fcaa[_0x4ab3('0x1b')]&&_0x32fcaa[_0x4ab3('0x1c')]&&_0x32fcaa[_0x4ab3('0x44')]){_0x573337[_0x32fcaa[_0x4ab3('0x1b')]]&&_0x305b87['custom_fields'][_0x4ab3('0x45')]({'id':_0x32fcaa[_0x4ab3('0x1c')],'value':_0x573337[_0x32fcaa['variableName']][_0x4ab3('0x42')]()});}else if(_0x32fcaa['type']===_0x4ab3('0x46')&&_0x32fcaa[_0x4ab3('0x47')]&&_0x32fcaa[_0x4ab3('0x47')][_0x4ab3('0x18')]&&_0x32fcaa['idField']&&_0x32fcaa[_0x4ab3('0x44')]){_0x573337[_0x32fcaa['Variable'][_0x4ab3('0x18')]['toLowerCase']()]&&_0x305b87[_0x4ab3('0x48')][_0x4ab3('0x45')]({'id':_0x32fcaa[_0x4ab3('0x1c')],'value':_0x573337[_0x32fcaa[_0x4ab3('0x47')][_0x4ab3('0x18')][_0x4ab3('0x40')]()]['toString']()});}});}return _0x305b87;}function getConnection(_0x284fd5){return request({'method':_0x4ab3('0x49'),'form':{'method':_0x4ab3('0x4a'),'input_type':_0x4ab3('0x1e'),'response_type':_0x4ab3('0x1e'),'rest_data':JSON[_0x4ab3('0x1f')]({'user_auth':{'user_name':_0x284fd5[_0x4ab3('0x4b')],'password':_0x284fd5['password'],'encryption':_0x4ab3('0x4c')},'application':_0x4ab3('0x4d')})}})[_0x4ab3('0x34')](function(_0x28a19d){var _0x3b1efe=_0x28a19d;if(_0x3b1efe['id']){def[_0x4ab3('0x4e')]=_0x3b1efe['id'];return BPromise[_0x4ab3('0x2b')](_0x3b1efe);}else{throw new Error(util[_0x4ab3('0x20')](_0x4ab3('0x4f'),_0x284fd5['id']));}});}function setRelationship(_0x4e54a1,_0x31cad6,_0x3d3d3b,_0x4ed5b1){return request({'form':{'method':_0x4ab3('0x50'),'input_type':_0x4ab3('0x1e'),'response_type':_0x4ab3('0x1e'),'rest_data':JSON['stringify']({'session':_0x4e54a1['id'],'module_name':_0x4ab3('0x51'),'module_id':_0x3d3d3b['id'],'link_field_name':_0x4ed5b1,'related_ids':[_0x31cad6['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x4ab3('0x52')]=function(_0x116e9f,_0x3e02f0,_0x4536e2,_0x356f96,_0x4bd503,_0x546706){var _0x301288,_0xef3427,_0x4f2749,_0x1a78d6;_0x546706[_0x4ab3('0x53')]=intUtil[_0x4ab3('0x54')](_0x546706['remoteUri']);_0x546706['serverUrl']=intUtil['stripTrailingSlash'](_0x546706[_0x4ab3('0x55')]);def['uri']=util[_0x4ab3('0x20')](_0x4ab3('0x56'),_0x546706[_0x4ab3('0x53')]);if(_0x4bd503&&_0x4bd503[_0x4ab3('0x57')]){logger[_0x4ab3('0xa')]('[QUEUE]',_0x4ab3('0x58'));_0x3e02f0[_0x4ab3('0x59')]=util[_0x4ab3('0x20')](_0x4ab3('0x5a'),_0x546706['serverUrl'],_0x3e02f0['uniqueid'],md5(_0x3e02f0[_0x4ab3('0x5b')]));}else{_0x3e02f0[_0x4ab3('0x59')]='';}return getConnection(_0x546706)[_0x4ab3('0x34')](function(_0x7523fc){_0x1a78d6=_0x7523fc;return getUser(_0x546706,_0x356f96['name'],_0x1a78d6);})[_0x4ab3('0x34')](function(_0x202d56){_0x301288=_0x202d56;logger[_0x4ab3('0xa')](_0x4ab3('0x5c'),_0x301288['id']);return getEndUser(_0x546706,_0x3e02f0[_0x4ab3('0x5d')],_0x3e02f0[_0x4ab3('0x5e')],_0x1a78d6);})[_0x4ab3('0x34')](function(_0x555bcc){_0xef3427=_0x555bcc;logger[_0x4ab3('0xa')](_0x4ab3('0x5f'),_0xef3427['id']);return getTicket(_0x546706,_0x301288,_0xef3427,_0x4536e2,_0x3e02f0,_0x4536e2[_0x4ab3('0x60')],_0x1a78d6,_0x4ab3('0x61'));})['then'](function(_0x379009){_0x4f2749=_0x379009;logger[_0x4ab3('0xa')]('Ticket\x20created!');logger[_0x4ab3('0xa')](_0x4ab3('0x62'),_0x4f2749['id']);return setRelationship(_0x1a78d6,_0x301288,_0x4f2749,_0x4ab3('0x63'));})[_0x4ab3('0x34')](function(){return setRelationship(_0x1a78d6,_0xef3427,_0x4f2749,_0x4ab3('0x64'));})[_0x4ab3('0x34')](function(){return getServerInfo(_0x1a78d6);})['then'](function(_0x336c86){var _0x1ee223=parseInt(_0x336c86[_0x4ab3('0x65')][_0x4ab3('0x66')](0x0));var _0x523b01=util[_0x4ab3('0x20')](_0x4ab3('0x67'),_0x546706[_0x4ab3('0x53')],_0x4f2749['id']);if(_0x1ee223>0x6){_0x523b01=util[_0x4ab3('0x20')](_0x4ab3('0x68'),_0x546706[_0x4ab3('0x53')],_0x4f2749['id']);}logger['info'](_0x4ab3('0x69'),_0x4ab3('0x6a'));emit(util[_0x4ab3('0x20')](_0x4ab3('0x6b'),_0x356f96[_0x4ab3('0x18')]),'trigger:browser:url',{'uri':_0x523b01});})[_0x4ab3('0x6c')](function(_0x46bed4){logger['error'](_0x4ab3('0x69'),JSON[_0x4ab3('0x1f')](_0x46bed4));});};exports[_0x4ab3('0x6d')]=function(_0x216e81,_0x4cf67f,_0x86b149,_0x732680,_0x8e6ccc,_0x329ff5,_0x1ede25){var _0x3519ec,_0x98bdc2,_0xff0c4e,_0x49742c;_0x329ff5[_0x4ab3('0x53')]=intUtil['stripTrailingSlash'](_0x329ff5['remoteUri']);_0x329ff5['serverUrl']=intUtil[_0x4ab3('0x54')](_0x329ff5[_0x4ab3('0x55')]);def['uri']=util[_0x4ab3('0x20')](_0x4ab3('0x56'),_0x329ff5[_0x4ab3('0x53')]);if(_0x1ede25&&_0x1ede25[_0x4ab3('0x6e')]&&_0x1ede25[_0x4ab3('0x6e')]!==_0x4ab3('0x6f')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4cf67f[_0x4ab3('0x59')]=util[_0x4ab3('0x20')](_0x4ab3('0x5a'),_0x329ff5[_0x4ab3('0x55')],_0x4cf67f[_0x4ab3('0x5b')],md5(_0x4cf67f[_0x4ab3('0x5b')]));}return getConnection(_0x329ff5)[_0x4ab3('0x34')](function(_0x594fa3){_0x49742c=_0x594fa3;return getUser(_0x329ff5,_0x732680[_0x4ab3('0x18')],_0x49742c);})[_0x4ab3('0x34')](function(_0x1fd449){_0x3519ec=_0x1fd449;logger[_0x4ab3('0xa')](_0x4ab3('0x5c'),_0x3519ec['id']);return getEndUser(_0x329ff5,_0x4cf67f[_0x4ab3('0x70')],_0x4cf67f[_0x4ab3('0x71')],_0x49742c);})[_0x4ab3('0x34')](function(_0x1aa1e3){_0x98bdc2=_0x1aa1e3;logger[_0x4ab3('0xa')](_0x4ab3('0x5f'),_0x98bdc2['id']);return getTicket(_0x329ff5,_0x3519ec,_0x98bdc2,_0x86b149,_0x4cf67f,_0x86b149['Fields'],_0x49742c,_0x4ab3('0x72'));})[_0x4ab3('0x34')](function(_0x2eabc2){_0xff0c4e=_0x2eabc2;logger[_0x4ab3('0xa')]('Ticket\x20created!');logger[_0x4ab3('0xa')]('The\x20Ticket\x20ID\x20is:',_0xff0c4e['id']);return setRelationship(_0x49742c,_0x3519ec,_0xff0c4e,_0x4ab3('0x63'));})['then'](function(){return setRelationship(_0x49742c,_0x98bdc2,_0xff0c4e,'contacts');})['then'](function(){return getServerInfo(_0x49742c);})[_0x4ab3('0x34')](function(_0x299dc1){var _0x1bc036=parseInt(_0x299dc1[_0x4ab3('0x65')][_0x4ab3('0x66')](0x0));var _0x124882=util[_0x4ab3('0x20')](_0x4ab3('0x67'),_0x329ff5[_0x4ab3('0x53')],_0xff0c4e['id']);if(_0x1bc036>0x6){_0x124882=util['format'](_0x4ab3('0x68'),_0x329ff5['remoteUri'],_0xff0c4e['id']);}logger['info'](_0x4ab3('0x73'),_0x4ab3('0x6a'));emit(util[_0x4ab3('0x20')]('user:%s',_0x732680[_0x4ab3('0x18')]),_0x4ab3('0x74'),{'uri':_0x124882});})['catch'](function(_0x5b39ae){logger[_0x4ab3('0x75')](_0x4ab3('0x73'),JSON[_0x4ab3('0x1f')](_0x5b39ae));});};exports['unmanaged']=function(_0x2b71ff,_0x129893,_0x13b018,_0x54a1bb,_0x3e11a6,_0x3937c0){var _0x1f08b7,_0x993246,_0x5f4dcb,_0x404bf7;_0x3937c0[_0x4ab3('0x53')]=intUtil[_0x4ab3('0x54')](_0x3937c0[_0x4ab3('0x53')]);_0x3937c0[_0x4ab3('0x55')]=intUtil[_0x4ab3('0x54')](_0x3937c0[_0x4ab3('0x55')]);def['uri']=util[_0x4ab3('0x20')](_0x4ab3('0x56'),_0x3937c0[_0x4ab3('0x53')]);if(_0x3e11a6&&_0x3e11a6[_0x4ab3('0x57')]){logger['info']('['+_0x129893[_0x4ab3('0x76')][_0x4ab3('0x77')]()+']',_0x4ab3('0x58'));_0x129893[_0x4ab3('0x59')]=util[_0x4ab3('0x20')](_0x4ab3('0x5a'),_0x3937c0[_0x4ab3('0x55')],_0x129893[_0x4ab3('0x5b')],md5(_0x129893[_0x4ab3('0x5b')]));}else{_0x129893[_0x4ab3('0x59')]='';}return getConnection(_0x3937c0)[_0x4ab3('0x34')](function(_0x2532a8){_0x404bf7=_0x2532a8;if(!_[_0x4ab3('0x23')](_0x54a1bb)){return getUser(_0x3937c0,_0x54a1bb[_0x4ab3('0x18')],_0x404bf7);}else{return getUser(_0x3937c0,null,_0x404bf7);}})[_0x4ab3('0x34')](function(_0x3d9ab5){_0x1f08b7=_0x3d9ab5;logger[_0x4ab3('0xa')](_0x4ab3('0x5c'),_0x1f08b7['id']);return getEndUser(_0x3937c0,_0x129893['calleridname'],_0x129893[_0x4ab3('0x5e')],_0x404bf7);})[_0x4ab3('0x34')](function(_0x386fc0){_0x993246=_0x386fc0;logger[_0x4ab3('0xa')](_0x4ab3('0x5f'),_0x993246['id']);return getTicket(_0x3937c0,_0x1f08b7,_0x993246,_0x13b018,_0x129893,_0x13b018[_0x4ab3('0x60')],_0x404bf7,_0x4ab3('0x61'));})[_0x4ab3('0x34')](function(_0x5d31b6){_0x5f4dcb=_0x5d31b6;logger[_0x4ab3('0xa')]('Ticket\x20created!');logger['info'](_0x4ab3('0x62'),_0x5f4dcb['id']);return setRelationship(_0x404bf7,_0x1f08b7,_0x5f4dcb,_0x4ab3('0x63'));})[_0x4ab3('0x34')](function(){return setRelationship(_0x404bf7,_0x993246,_0x5f4dcb,_0x4ab3('0x64'));})[_0x4ab3('0x34')](function(){return getServerInfo(_0x404bf7);})[_0x4ab3('0x6c')](function(_0x313cc1){logger[_0x4ab3('0x75')]('['+_0x129893['lastevent']['toUpperCase']()+']',JSON[_0x4ab3('0x1f')](_0x313cc1));});}; \ 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 47c9f1c..0495e86 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 _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 +var _0xb336=['string','push','content','variableName','toString','Variable','name','toLowerCase','type','keyValue','keyType','key','format','%s:\x20%s','keyContent','customVariable','join','slice','substring','lastIndexOf','isNil','test','util','getString','length','sortBy'];(function(_0x19362a,_0x126dfe){var _0x39c212=function(_0x65d587){while(--_0x65d587){_0x19362a['push'](_0x19362a['shift']());}};_0x39c212(++_0x126dfe);}(_0xb336,0x168));var _0x6b33=function(_0x3b221d,_0x460fea){_0x3b221d=_0x3b221d-0x0;var _0x3d9cf0=_0xb336[_0x3b221d];return _0x3d9cf0;};'use strict';var _=require('lodash');var util=require(_0x6b33('0x0'));exports[_0x6b33('0x1')]=function(_0x36a567,_0x14e829,_0x4bb4d1){var _0x1c9380=[];if(_0x36a567[_0x6b33('0x2')]>0x0){var _0x3bac0f=_[_0x6b33('0x3')](_0x36a567,['id']);for(var _0x549887=0x0;_0x549887<_0x3bac0f[_0x6b33('0x2')];_0x549887++){var _0x237f8c=_0x3bac0f[_0x549887];if(_0x237f8c['type']===_0x6b33('0x4')){_0x1c9380[_0x6b33('0x5')](_0x237f8c[_0x6b33('0x6')]);}else if(_0x237f8c['type']==='variable'&&_0x237f8c['variableName']){_0x14e829[_0x237f8c[_0x6b33('0x7')]]&&_0x1c9380[_0x6b33('0x5')](_0x14e829[_0x237f8c['variableName']][_0x6b33('0x8')]());}else if(_0x237f8c['type']==='customVariable'&&_0x237f8c[_0x6b33('0x9')]&&_0x237f8c[_0x6b33('0x9')][_0x6b33('0xa')]){_0x14e829[_0x237f8c[_0x6b33('0x9')][_0x6b33('0xa')]['toLowerCase']()]&&_0x1c9380['push'](_0x14e829[_0x237f8c[_0x6b33('0x9')][_0x6b33('0xa')][_0x6b33('0xb')]()][_0x6b33('0x8')]());}else if(_0x237f8c[_0x6b33('0xc')]===_0x6b33('0xd')){if(_0x237f8c[_0x6b33('0xe')]===_0x6b33('0x4')&&_0x237f8c[_0x6b33('0xf')]){_0x1c9380['push'](util[_0x6b33('0x10')](_0x6b33('0x11'),_0x237f8c[_0x6b33('0xf')],_0x237f8c[_0x6b33('0x12')]));}else if(_0x237f8c[_0x6b33('0xe')]==='variable'&&_0x237f8c[_0x6b33('0x7')]&&_0x237f8c[_0x6b33('0xf')]){_0x14e829[_0x237f8c[_0x6b33('0x7')]]&&_0x1c9380[_0x6b33('0x5')](util['format'](_0x6b33('0x11'),_0x237f8c[_0x6b33('0xf')],_0x14e829[_0x237f8c[_0x6b33('0x7')]]));}else if(_0x237f8c[_0x6b33('0xe')]===_0x6b33('0x13')&&_0x237f8c[_0x6b33('0x9')]&&_0x237f8c[_0x6b33('0x9')][_0x6b33('0xa')]&&_0x237f8c[_0x6b33('0xf')]){_0x14e829[_0x237f8c[_0x6b33('0x9')][_0x6b33('0xa')][_0x6b33('0xb')]()]&&_0x1c9380[_0x6b33('0x5')](util[_0x6b33('0x10')]('%s:\x20%s',_0x237f8c['key'],_0x14e829[_0x237f8c[_0x6b33('0x9')][_0x6b33('0xa')]['toLowerCase']()]));}}}}return _0x1c9380[_0x6b33('0x14')](_0x4bb4d1);};exports['stripTrailingSlash']=function(_0x4c4f86){var _0x4200a0=_0x4c4f86[_0x6b33('0x15')](-0x1);if(_0x4200a0==='/'){_0x4c4f86=_0x4c4f86[_0x6b33('0x16')](0x0,_0x4c4f86[_0x6b33('0x17')](_0x4200a0));}return _0x4c4f86;};exports['validateEmail']=function(_0xca8f36){if(!_[_0x6b33('0x18')](_0xca8f36)&&_0xca8f36!==''){var _0x5a8b85=/^(([^<>()\[\]\\.,;:\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 _0x5a8b85[_0x6b33('0x19')](String(_0xca8f36)['toLowerCase']());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 4e41be0..e6e0ea6 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_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 +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(_0x16ef78,_0x251f60){var _0x352117=function(_0x668cd8){while(--_0x668cd8){_0x16ef78['push'](_0x16ef78['shift']());}};_0x352117(++_0x251f60);}(_0xe706,0xa3));var _0x6e70=function(_0x378a48,_0x5b012f){_0x378a48=_0x378a48-0x0;var _0x1538c5=_0xe706[_0x378a48];return _0x1538c5;};'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 86d1937..4af6a3d 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 _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 +var _0x9f18=['destcalleridnum','[OUTBOUND]','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase','calleridnum','\x20Error\x20running\x20Zendesk\x20integration','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','emit','Creating\x20new\x20ticket...','%s/tickets.json','POST','merge','Tags','getString','Subjects','Descriptions','then','info','ticket','validateEmail','%s/search.json','remoteUri','format','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','agent','Admin\x20account\x20selected.','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user','results','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','password','%s:%s','username','authType','token','%s/token:%s','Basic\x20%s','toString','debug','[HTTP]','stringify','defaults','GET','map','includes','string','picklist','type','nameField','toLowerCase','content','idField','customField','custom_fields','push','variableName','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','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','destcalleridname'];(function(_0x53b7ca,_0x7b041d){var _0x4a64bd=function(_0x2f2d03){while(--_0x2f2d03){_0x53b7ca['push'](_0x53b7ca['shift']());}};_0x4a64bd(++_0x7b041d);}(_0x9f18,0xe0));var _0x89f1=function(_0x207a02,_0x278c56){_0x207a02=_0x207a02-0x0;var _0xd995c3=_0x9f18[_0x207a02];return _0xd995c3;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x89f1('0x0'));var util=require(_0x89f1('0x1'));var Redis=require(_0x89f1('0x2'));var intUtil=require(_0x89f1('0x3'));var config=require(_0x89f1('0x4'));var logger=require(_0x89f1('0x5'))('zendesk');config[_0x89f1('0x6')]=_['defaults'](config['redis'],{'host':_0x89f1('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x89f1('0x6')]));function emit(_0x2574ca,_0x30f704,_0x10f4db){io['to'](_0x2574ca)[_0x89f1('0x8')](_0x30f704,_0x10f4db);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getTicket(_0x43b9e7,_0xbe5b8f,_0x208059,_0x512c37,_0x73d74b){logger['info'](_0x89f1('0x9'));return request({'uri':util['format'](_0x89f1('0xa'),_0x43b9e7['remoteUri']),'method':_0x89f1('0xb'),'body':{'ticket':_[_0x89f1('0xc')]({'requester_id':_0x208059['id'],'submitter_id':_0xbe5b8f?_0xbe5b8f['id']:undefined,'assignee_id':_0xbe5b8f?_0xbe5b8f['id']:undefined,'tags':getTags(_0x512c37[_0x89f1('0xd')],'name'),'subject':intUtil[_0x89f1('0xe')](_0x512c37[_0x89f1('0xf')],_0x73d74b,'\x20'),'description':intUtil['getString'](_0x512c37['Descriptions'],_0x73d74b,'\x0a'),'comment':{'public':![],'body':intUtil[_0x89f1('0xe')](_0x512c37[_0x89f1('0x10')],_0x73d74b,'\x0a')}},getCustomFields(_0x512c37['Fields'],_0x73d74b))}})[_0x89f1('0x11')](function(_0x49aa2b){logger[_0x89f1('0x12')]('Ticket\x20created!');return _0x49aa2b[_0x89f1('0x13')];});}function getUser(_0x4eb578,_0x3b7689){if(intUtil[_0x89f1('0x14')](_0x3b7689)){logger[_0x89f1('0x12')]('Getting\x20agent\x20with\x20email',_0x3b7689);return request({'uri':util['format'](_0x89f1('0x15'),_0x4eb578[_0x89f1('0x16')]),'qs':{'query':util[_0x89f1('0x17')](_0x89f1('0x18'),_0x3b7689)}})[_0x89f1('0x11')](function(_0x2f8d57){if(_0x2f8d57['count']){logger[_0x89f1('0x12')](_0x89f1('0x19'));return _[_0x89f1('0x1a')](_0x2f8d57['results'],{'email':_0x3b7689,'role':_0x89f1('0x1b')});}else{logger[_0x89f1('0x12')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x89f1('0x17')]('%s/users/me.json',_0x4eb578['remoteUri'])})[_0x89f1('0x11')](function(_0x3df17b){logger['info'](_0x89f1('0x1c'));return _0x3df17b['user'];});}});}else{logger[_0x89f1('0x12')](_0x89f1('0x1d'));return request({'uri':util[_0x89f1('0x17')]('%s/users/me.json',_0x4eb578['remoteUri'])})['then'](function(_0x17c88c){logger['info'](_0x89f1('0x1c'));return _0x17c88c[_0x89f1('0x1e')];});}}function getEndUser(_0x51b106,_0x4f3257,_0x472569){logger[_0x89f1('0x12')]('Searching\x20enduser\x20with\x20phone',_0x472569);return request({'uri':util[_0x89f1('0x17')](_0x89f1('0x15'),_0x51b106[_0x89f1('0x16')]),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x472569)}})[_0x89f1('0x11')](function(_0x20626d){var _0x281889;if(_0x20626d[_0x89f1('0x1f')][_0x89f1('0x20')]){_0x20626d[_0x89f1('0x1f')]=_[_0x89f1('0x21')](_0x20626d[_0x89f1('0x1f')],{'suspended':![],'role':_0x89f1('0x22')});if(_0x20626d['results']['length']){_0x281889=_[_0x89f1('0x23')](_0x20626d[_0x89f1('0x1f')]);}}if(_0x281889){logger[_0x89f1('0x12')](_0x89f1('0x24'));return _0x281889;}else{logger[_0x89f1('0x12')](_0x89f1('0x25'));return request({'uri':util[_0x89f1('0x17')](_0x89f1('0x26'),_0x51b106[_0x89f1('0x16')]),'method':_0x89f1('0xb'),'body':{'user':{'role':_0x89f1('0x22'),'name':util[_0x89f1('0x17')]('Caller\x20-\x20%s',_0x4f3257||_0x472569),'phone':_0x472569}}})[_0x89f1('0x11')](function(_0x2967de){logger['info'](_0x89f1('0x27'));return _0x2967de[_0x89f1('0x1e')];});}});}function getAuth(_0x5f1393){var _0x34c6dc;if(_0x5f1393['authType']===_0x89f1('0x28')){_0x34c6dc=util['format'](_0x89f1('0x29'),_0x5f1393[_0x89f1('0x2a')],_0x5f1393[_0x89f1('0x28')]);}else if(_0x5f1393[_0x89f1('0x2b')]===_0x89f1('0x2c')){_0x34c6dc=util[_0x89f1('0x17')](_0x89f1('0x2d'),_0x5f1393[_0x89f1('0x2a')],_0x5f1393[_0x89f1('0x2c')]);}return util[_0x89f1('0x17')](_0x89f1('0x2e'),new Buffer(_0x34c6dc)[_0x89f1('0x2f')]('base64'));}function request(_0x2dbe21){logger[_0x89f1('0x30')](_0x89f1('0x31'),JSON[_0x89f1('0x32')](_0x2dbe21));return rp(_[_0x89f1('0x33')](_0x2dbe21,{'method':_0x89f1('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x1fb2fc,_0x412228){var _0x53841d=[];if(_0x1fb2fc&&_0x1fb2fc[_0x89f1('0x20')]>0x0){_0x53841d=_[_0x89f1('0x35')](_0x1fb2fc,_0x412228);}return _0x53841d;}function getCustomFields(_0x20eac2,_0x27c950){var _0x55a4b9=[];var _0x1a83ef={'custom_fields':[]};if(_0x20eac2[_0x89f1('0x20')]>0x0){_['forEach'](_0x20eac2,function(_0x1b7673){if(_[_0x89f1('0x36')]([_0x89f1('0x37'),_0x89f1('0x38')],_0x1b7673[_0x89f1('0x39')])&&_0x1b7673[_0x89f1('0x3a')]&&!_0x1b7673['customField']){_0x1a83ef[_0x1b7673[_0x89f1('0x3a')][_0x89f1('0x3b')]()]=_0x1b7673[_0x89f1('0x3c')]['toString']();}else if(_[_0x89f1('0x36')]([_0x89f1('0x37'),_0x89f1('0x38')],_0x1b7673[_0x89f1('0x39')])&&_0x1b7673[_0x89f1('0x3d')]&&_0x1b7673[_0x89f1('0x3e')]){_0x1a83ef[_0x89f1('0x3f')][_0x89f1('0x40')]({'id':_0x1b7673['idField'],'value':_0x1b7673[_0x89f1('0x3c')][_0x89f1('0x2f')]()});}else if(_0x1b7673[_0x89f1('0x39')]==='variable'&&_0x1b7673[_0x89f1('0x41')]&&_0x1b7673['idField']&&_0x1b7673['customField']){_0x27c950[_0x1b7673['variableName']]&&_0x1a83ef[_0x89f1('0x3f')][_0x89f1('0x40')]({'id':_0x1b7673[_0x89f1('0x3d')],'value':_0x27c950[_0x1b7673['variableName']][_0x89f1('0x2f')]()});}else if(_0x1b7673[_0x89f1('0x39')]===_0x89f1('0x42')&&_0x1b7673[_0x89f1('0x43')]&&_0x1b7673[_0x89f1('0x43')][_0x89f1('0x44')]&&_0x1b7673['idField']&&_0x1b7673[_0x89f1('0x3e')]){_0x27c950[_0x1b7673[_0x89f1('0x43')][_0x89f1('0x44')][_0x89f1('0x3b')]()]&&_0x1a83ef[_0x89f1('0x3f')][_0x89f1('0x40')]({'id':_0x1b7673['idField'],'value':_0x27c950[_0x1b7673['Variable'][_0x89f1('0x44')][_0x89f1('0x3b')]()][_0x89f1('0x2f')]()});}});}return _0x1a83ef;}exports[_0x89f1('0x45')]=function(_0x3c6fec,_0x5ca10c,_0x14b25e,_0x5006e1,_0x9d8bc1,_0x569c5b){var _0x32cc74,_0x47a002;_0x569c5b[_0x89f1('0x16')]=intUtil[_0x89f1('0x46')](_0x569c5b[_0x89f1('0x16')]);_0x569c5b[_0x89f1('0x47')]=intUtil[_0x89f1('0x46')](_0x569c5b[_0x89f1('0x47')]);if(_0x9d8bc1&&_0x9d8bc1[_0x89f1('0x48')]){logger[_0x89f1('0x12')](_0x89f1('0x49'),_0x89f1('0x4a'));_0x5ca10c[_0x89f1('0x4b')]=util[_0x89f1('0x17')](_0x89f1('0x4c'),_0x569c5b[_0x89f1('0x47')],_0x5ca10c[_0x89f1('0x4d')],md5(_0x5ca10c[_0x89f1('0x4d')]));}else{_0x5ca10c['recordingURL']='';}headers[_0x89f1('0x4e')]=getAuth(_0x569c5b);return getUser(_0x569c5b,_0x5006e1[_0x89f1('0x4f')])[_0x89f1('0x11')](function(_0x2e7474){_0x32cc74=_0x2e7474;logger['info'](_0x89f1('0x50'),_0x32cc74['id']);return getEndUser(_0x569c5b,_0x5ca10c[_0x89f1('0x51')],_0x5ca10c['calleridnum']);})['then'](function(_0x12f004){_0x47a002=_0x12f004;logger[_0x89f1('0x12')](_0x89f1('0x52'),_0x47a002['id']);return getTicket(_0x569c5b,_0x32cc74,_0x47a002,_0x14b25e,_0x5ca10c);})['then'](function(_0x11cf01){if(_0x11cf01){logger[_0x89f1('0x12')](_0x89f1('0x53'),_0x11cf01['id']);switch(_0x569c5b['type']){case _0x89f1('0x54'):logger[_0x89f1('0x12')](_0x89f1('0x49'),_0x89f1('0x55'));return request({'uri':util[_0x89f1('0x17')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x569c5b[_0x89f1('0x16')],_0x32cc74['id'],_0x11cf01['id']),'method':'POST'});case _0x89f1('0x56'):logger[_0x89f1('0x12')](_0x89f1('0x49'),_0x89f1('0x57'));emit(util[_0x89f1('0x17')](_0x89f1('0x58'),_0x5006e1[_0x89f1('0x44')]),_0x89f1('0x59'),{'uri':util[_0x89f1('0x17')](_0x89f1('0x5a'),_0x569c5b[_0x89f1('0x16')][_0x89f1('0x5b')](_0x89f1('0x5c'),''),_0x11cf01['id'])});break;default:logger[_0x89f1('0x5d')]('[QUEUE]',_0x89f1('0x5e'));}}})['catch'](function(_0x9fc324){logger['error'](_0x89f1('0x5f'),util[_0x89f1('0x60')](_0x9fc324,{'showHidden':!![],'depth':null}));});};exports[_0x89f1('0x61')]=function(_0x5764cc,_0x3c492a,_0x35f4d8,_0x34bb0b,_0x3922af,_0x2e10ac,_0x2ff2db){var _0x2a2b39,_0x20331d;_0x2e10ac[_0x89f1('0x16')]=intUtil[_0x89f1('0x46')](_0x2e10ac[_0x89f1('0x16')]);_0x2e10ac['serverUrl']=intUtil[_0x89f1('0x46')](_0x2e10ac[_0x89f1('0x47')]);if(_0x2ff2db&&_0x2ff2db['recordingFormat']&&_0x2ff2db[_0x89f1('0x62')]!=='none'){logger[_0x89f1('0x12')]('[OUTBOUND]',_0x89f1('0x4a'));_0x3c492a[_0x89f1('0x4b')]=util[_0x89f1('0x17')](_0x89f1('0x4c'),_0x2e10ac[_0x89f1('0x47')],_0x3c492a[_0x89f1('0x4d')],md5(_0x3c492a[_0x89f1('0x4d')]));}headers['Authorization']=getAuth(_0x2e10ac);return getUser(_0x2e10ac,_0x34bb0b[_0x89f1('0x4f')])[_0x89f1('0x11')](function(_0x5889de){_0x2a2b39=_0x5889de;logger['info'](_0x89f1('0x50'),_0x2a2b39['id']);return getEndUser(_0x2e10ac,_0x3c492a[_0x89f1('0x63')],_0x3c492a[_0x89f1('0x64')]);})[_0x89f1('0x11')](function(_0x786cff){_0x20331d=_0x786cff;logger[_0x89f1('0x12')](_0x89f1('0x52'),_0x20331d['id']);return getTicket(_0x2e10ac,_0x2a2b39,_0x20331d,_0x35f4d8,_0x3c492a);})[_0x89f1('0x11')](function(_0x39c026){if(_0x39c026){logger['info'](_0x89f1('0x53'),_0x39c026['id']);switch(_0x2e10ac['type']){case _0x89f1('0x54'):logger['info']('[OUTBOUND]',_0x89f1('0x55'));return request({'uri':util[_0x89f1('0x17')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x2e10ac[_0x89f1('0x16')],_0x2a2b39['id'],_0x39c026['id']),'method':_0x89f1('0xb')});case'newTab':logger['info'](_0x89f1('0x65'),_0x89f1('0x57'));emit(util['format'](_0x89f1('0x58'),_0x34bb0b[_0x89f1('0x44')]),_0x89f1('0x59'),{'uri':util[_0x89f1('0x17')]('%s/agent/tickets/%s',_0x2e10ac[_0x89f1('0x16')][_0x89f1('0x5b')]('/api/v2',''),_0x39c026['id'])});break;default:logger[_0x89f1('0x5d')](_0x89f1('0x65'),_0x89f1('0x5e'));}}})[_0x89f1('0x66')](function(_0x2df2a5){logger['error'](_0x89f1('0x67'),util[_0x89f1('0x60')](_0x2df2a5,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x58fd1e,_0xec71e8,_0x27406,_0x241be2,_0x13adde,_0x58961f){var _0x14dbe4,_0x4d18e2;_0x58961f[_0x89f1('0x16')]=intUtil[_0x89f1('0x46')](_0x58961f['remoteUri']);_0x58961f[_0x89f1('0x47')]=intUtil['stripTrailingSlash'](_0x58961f['serverUrl']);if(_0x13adde&&_0x13adde['monitor_format']){logger[_0x89f1('0x12')]('['+_0xec71e8[_0x89f1('0x68')][_0x89f1('0x69')]()+']',_0x89f1('0x4a'));_0xec71e8[_0x89f1('0x4b')]=util[_0x89f1('0x17')](_0x89f1('0x4c'),_0x58961f['serverUrl'],_0xec71e8[_0x89f1('0x4d')],md5(_0xec71e8['uniqueid']));}else{_0xec71e8['recordingURL']='';}headers[_0x89f1('0x4e')]=getAuth(_0x58961f);return getUser(_0x58961f)['then'](function(_0x5eac76){_0x14dbe4=_0x5eac76;logger[_0x89f1('0x12')](_0x89f1('0x50'),_0x14dbe4['id']);return getEndUser(_0x58961f,_0xec71e8[_0x89f1('0x51')],_0xec71e8[_0x89f1('0x6a')]);})['then'](function(_0x32d49e){_0x4d18e2=_0x32d49e;logger[_0x89f1('0x12')](_0x89f1('0x52'),_0x4d18e2['id']);return getTicket(_0x58961f,_0x14dbe4,_0x4d18e2,_0x27406,_0xec71e8);})['then'](function(_0x5d2315){if(_0x5d2315){logger['info']('The\x20Ticket\x20ID\x20is:',_0x5d2315['id']);}})['catch'](function(_0x501b30){logger[_0x89f1('0x5d')]('['+_0xec71e8[_0x89f1('0x68')][_0x89f1('0x69')]()+']'+_0x89f1('0x6b'),util['inspect'](_0x501b30,{'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 b46257b..2082c95 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 _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 +var _0x09a8=['monitor_format','toUpperCase','calleridnum','lodash','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','zoho','defaults','redis','localhost','socket.io-emitter','stringify','length','forEach','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','isBefore','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','expires_in','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','email','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','isNil','first_name','last_name','code','SUCCESS','details','moduleCreate','Error:\x20','log','moduleSearch','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...','profile','Subject','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','utc','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','host','zoho.eu','The\x20User\x20ID\x20is:','calleridname','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','recordingFormat','none','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','The\x20Call\x20ID\x20is:','[OUTBOUND]','unmanaged'];(function(_0x357408,_0x2c8640){var _0x39ebc3=function(_0x418e9c){while(--_0x418e9c){_0x357408['push'](_0x357408['shift']());}};_0x39ebc3(++_0x2c8640);}(_0x09a8,0x13d));var _0x809a=function(_0x4b6026,_0x194b58){_0x4b6026=_0x4b6026-0x0;var _0x13868d=_0x09a8[_0x4b6026];return _0x13868d;};'use strict';var _=require(_0x809a('0x0'));var rp=require('request-promise');var md5=require(_0x809a('0x1'));var util=require(_0x809a('0x2'));var intUtil=require(_0x809a('0x3'));var moment=require(_0x809a('0x4'));var Redis=require(_0x809a('0x5'));var BPromise=require(_0x809a('0x6'));var config=require(_0x809a('0x7'));var logger=require('../../../../config/logger')(_0x809a('0x8'));config['redis']=_[_0x809a('0x9')](config[_0x809a('0xa')],{'host':_0x809a('0xb'),'port':0x18eb});var io=require(_0x809a('0xc'))(new Redis(config[_0x809a('0xa')]));function emit(_0x471df1,_0x12a947,_0x213b18){io['to'](_0x471df1)['emit'](_0x12a947,_0x213b18);}function request(_0x15adc8){logger['debug']('[HTTP]',JSON[_0x809a('0xd')](_0x15adc8));return rp(_0x15adc8);}function getCustomFields(_0x3fcaa0,_0x1fe021){var _0x40b170={};if(_0x3fcaa0[_0x809a('0xe')]>0x0){_[_0x809a('0xf')](_0x3fcaa0,function(_0x2e9404){if(_['includes']([_0x809a('0x10'),_0x809a('0x11')],_0x2e9404[_0x809a('0x12')])&&_0x2e9404['idField']){_0x40b170[_0x2e9404[_0x809a('0x13')]]=_0x2e9404[_0x809a('0x14')][_0x809a('0x15')]();}else if(_0x2e9404[_0x809a('0x12')]===_0x809a('0x16')&&_0x2e9404[_0x809a('0x17')]&&_0x2e9404[_0x809a('0x13')]&&_0x1fe021[_0x2e9404['variableName']]){_0x40b170[_0x2e9404[_0x809a('0x13')]]=_0x1fe021[_0x2e9404['variableName']][_0x809a('0x15')]();}else if(_0x2e9404[_0x809a('0x12')]===_0x809a('0x18')&&_0x2e9404[_0x809a('0x19')]&&_0x2e9404[_0x809a('0x19')]['name']&&_0x2e9404['idField']&&_0x1fe021[_0x2e9404[_0x809a('0x19')][_0x809a('0x1a')][_0x809a('0x1b')]()]){_0x40b170[_0x2e9404['idField']]=_0x1fe021[_0x2e9404[_0x809a('0x19')][_0x809a('0x1a')][_0x809a('0x1b')]()][_0x809a('0x15')]();}});}return _0x40b170;}function getName(_0x2e0aef){if(_0x2e0aef['indexOf']('\x20')>0x0){var _0x5d6598=_0x2e0aef[_0x809a('0x1c')](/ (.+)/);if(_0x5d6598[0x1]){return _0x5d6598;}}return[_0x2e0aef,_0x2e0aef];}var accountsTokens={};function getAccessToken(_0x4a3451){return new Promise(function(_0x4aff73,_0x18e678){if(!_['isNil'](accountsTokens[_0x4a3451['id']])&&!_['isNil'](accountsTokens[_0x4a3451['id']]['access_token'])){if(moment()[_0x809a('0x1d')](accountsTokens[_0x4a3451['id']]['expires_in'])){_0x4aff73(accountsTokens[_0x4a3451['id']][_0x809a('0x1e')]);}}var _0x4913b1;switch(_0x4a3451[_0x809a('0x1f')]){case'US':_0x4913b1=_0x809a('0x20');break;case'AU':_0x4913b1=_0x809a('0x21');break;case'EU':_0x4913b1='https://accounts.zoho.eu';break;case'IN':_0x4913b1='https://accounts.zoho.in';break;case'CN':_0x4913b1='https://accounts.zoho.com.cn';break;default:_0x4913b1=_0x809a('0x22');break;}var _0x1c88bd={'method':_0x809a('0x23'),'uri':_0x4913b1+_0x809a('0x24'),'qs':{'refresh_token':_0x4a3451[_0x809a('0x25')],'client_id':_0x4a3451[_0x809a('0x26')],'client_secret':_0x4a3451[_0x809a('0x27')],'grant_type':_0x809a('0x28')},'json':!![]};return rp(_0x1c88bd)[_0x809a('0x29')](function(_0x37e32d){accountsTokens[_0x4a3451['id']]={'access_token':_0x37e32d['access_token'],'expires_in':moment()[_0x809a('0x2a')](_0x37e32d[_0x809a('0x2b')],_0x809a('0x2c'))};_0x4aff73(_0x37e32d['access_token']);})['catch'](function(_0x2f0b45){logger[_0x809a('0x2d')](_0x809a('0x2e'),_0x2f0b45[_0x809a('0x2f')]);_0x18e678(_0x2f0b45);});});}function getUser(_0x427836,_0x2e95d1,_0x242920,_0x5264e7){logger[_0x809a('0x30')](_0x809a('0x31'));return request({'method':_0x809a('0x32'),'uri':util[_0x809a('0x33')](_0x809a('0x34'),_0x2e95d1),'qs':{'type':_0x809a('0x35')},'headers':{'Authorization':_0x809a('0x36')+_0x427836},'json':!![]})[_0x809a('0x29')](function(_0x5c1506){if(_0x5c1506[_0x809a('0x37')]){var _0x5e9c06=-0x1;if(_[_0x809a('0x38')](_0x5c1506[_0x809a('0x37')])){if(!_['isNil'](_0x5264e7)){_0x5e9c06=_['findIndex'](_0x5c1506[_0x809a('0x37')],function(_0x5a17ce){return _0x5a17ce[_0x809a('0x39')]===_0x5264e7;});}if(_0x5e9c06>=0x0){logger['info'](_0x809a('0x3a'));}else{logger[_0x809a('0x30')](_0x809a('0x3b'));_0x5e9c06=_[_0x809a('0x3c')](_0x5c1506['users'],function(_0x306fca){return _0x306fca['profile'][_0x809a('0x1a')]==='Administrator';});}return _0x5c1506[_0x809a('0x37')][_0x5e9c06];}else{if(_0x5c1506['user']['profile'][_0x809a('0x1a')]===_0x809a('0x3d')){logger[_0x809a('0x30')](_0x809a('0x3b'));user=_0x5c1506['user'];return user;}else{logger[_0x809a('0x2d')](_0x809a('0x3e'),JSON[_0x809a('0xd')](_0x5c1506));throw new Error(_0x809a('0x3f')+JSON['stringify'](_0x5c1506));}}}else{logger[_0x809a('0x2d')](_0x809a('0x3e'),JSON[_0x809a('0xd')](_0x5c1506));throw new Error(_0x809a('0x3f')+JSON['stringify'](_0x5c1506));}})[_0x809a('0x40')](function(_0x45461b){console[_0x809a('0x2d')](_0x45461b);});}function getZohoUser(_0x57e36c,_0xcd34c1){return new BPromise(function(_0x34c329,_0x5d6700){request(_0x57e36c)[_0x809a('0x29')](function(_0x3a046f){var _0x158d69=null;if(_0x3a046f){_0x158d69=_0x3a046f[_0x809a('0x41')][0x0];_0x158d69[_0x809a('0x42')]=_0xcd34c1;}_0x34c329(_0x158d69);})['catch'](function(_0x3231ed){_0x5d6700(_0x3231ed);});});}function createEndUser(_0x381c86,_0x4c13c3,_0x37f7fa,_0x366216,_0x2cb817,_0x80222f){var _0x37f7fa=getName(_0x37f7fa);return request({'method':_0x809a('0x23'),'uri':_0x809a('0x43')+_0x4c13c3+_0x809a('0x44')+_[_0x809a('0x45')](_0x80222f['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x37f7fa[0x1],'First_Name':_0x37f7fa[0x0],'Phone':_0x366216,'Owner':{'name':!_['isNil'](_0x2cb817['role'][_0x809a('0x1a')])?_0x2cb817[_0x809a('0x46')][_0x809a('0x1a')]:!_[_0x809a('0x47')](_0x2cb817[_0x809a('0x48')])?_0x2cb817[_0x809a('0x48')]+'\x20'+_0x2cb817['last_name']:_0x2cb817[_0x809a('0x49')],'id':_0x2cb817['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x381c86},'json':!![]})['then'](function(_0x89c6c2){if(_0x89c6c2&&_0x89c6c2[_0x809a('0x41')][0x0][_0x809a('0x4a')]===_0x809a('0x4b')){var _0x1fc528=_0x89c6c2['data'][0x0][_0x809a('0x4c')];_0x1fc528['enduserType']=_[_0x809a('0x45')](_0x80222f[_0x809a('0x4d')])+'s';return _0x1fc528;}logger[_0x809a('0x2d')](_0x809a('0x3e'),JSON[_0x809a('0xd')](data));throw new Error(_0x809a('0x4e')+JSON['stringify'](data));})[_0x809a('0x40')](function(_0x958a3a){console[_0x809a('0x4f')]('CREATE\x20ERROR',_0x958a3a);});}function getEndUser(_0xa2cdc8,_0x5a6312,_0x364a00,_0x53b64e,_0x2209a6,_0xe4498a,_0x3db9df){var _0x5388b0={'method':'GET','uri':'','headers':{'Authorization':_0x809a('0x36')+_0xa2cdc8},'json':!![]};switch(_0x3db9df[_0x809a('0x50')]){case _0x809a('0x51'):_0x5388b0[_0x809a('0x52')]=_0x809a('0x43')+_0x5a6312+_0x809a('0x53')+_0x2209a6+'))';return getZohoUser(_0x5388b0,_0x809a('0x54'))[_0x809a('0x29')](function(_0x2394c6){if(_0x2394c6)return _0x2394c6;_0x5388b0[_0x809a('0x52')]=_0x809a('0x43')+_0x5a6312+_0x809a('0x55')+_0x2209a6+'))';return getZohoUser(_0x5388b0,_0x809a('0x56'))['then'](function(_0x205179){if(_0x205179)return _0x205179;if(_0x3db9df[_0x809a('0x4d')]!=_0x809a('0x57')){return createEndUser(_0xa2cdc8,_0x5a6312,_0x53b64e,_0x2209a6,_0xe4498a,_0x3db9df);}else{return{};}});});break;case _0x809a('0x58'):_0x5388b0[_0x809a('0x52')]='https://www.zohoapis.'+_0x5a6312+_0x809a('0x53')+_0x2209a6+'))';return getZohoUser(_0x5388b0,_0x809a('0x54'))[_0x809a('0x29')](function(_0xaab3e0){if(_0xaab3e0)return _0xaab3e0;if(_0x3db9df[_0x809a('0x4d')]!=_0x809a('0x57')){return createEndUser(_0xa2cdc8,_0x5a6312,_0x53b64e,_0x2209a6,_0xe4498a,_0x3db9df);}else{return{};}});break;case _0x809a('0x59'):_0x5388b0[_0x809a('0x52')]='https://www.zohoapis.'+_0x5a6312+_0x809a('0x55')+_0x2209a6+'))';return getZohoUser(_0x5388b0,_0x809a('0x56'))[_0x809a('0x29')](function(_0x527785){if(_0x527785)return _0x527785;if(_0x3db9df[_0x809a('0x4d')]!='nothing'){return createEndUser(_0xa2cdc8,_0x5a6312,_0x53b64e,_0x2209a6,_0xe4498a,_0x3db9df);}else{return{};}});break;}}function getCall(_0x359858,_0x41f232,_0x4b5c2d,_0x3e4a23,_0xe63d9,_0x4be3ed,_0x42f520,_0x4ff42a){logger[_0x809a('0x30')](_0x809a('0x5a'));var _0x126581={};_0x126581['Owner']={'name':!_[_0x809a('0x47')](_0x3e4a23[_0x809a('0x46')][_0x809a('0x1a')])&&!_[_0x809a('0x47')](_0x3e4a23[_0x809a('0x5b')][_0x809a('0x1a')])&&_0x3e4a23[_0x809a('0x5b')][_0x809a('0x1a')]==='administrator'?_0x3e4a23[_0x809a('0x46')][_0x809a('0x1a')]:!_[_0x809a('0x47')](_0x3e4a23[_0x809a('0x48')])?_0x3e4a23[_0x809a('0x48')]+'\x20'+_0x3e4a23[_0x809a('0x49')]:_0x3e4a23[_0x809a('0x49')],'id':_0x3e4a23['id']};_0x126581[_0x809a('0x5c')]=intUtil[_0x809a('0x5d')](_0x4be3ed[_0x809a('0x5e')],_0x42f520,'\x20');_0x126581['Description']=intUtil['getString'](_0x4be3ed[_0x809a('0x5f')],_0x42f520,'\x0a');if(_0xe63d9[_0x809a('0x42')]===_0x809a('0x54')){_0x126581[_0x809a('0x60')]={'name':!_[_0x809a('0x47')](_0xe63d9[_0x809a('0x61')])?_0xe63d9[_0x809a('0x61')]:!_[_0x809a('0x47')](_0xe63d9['First_Name'])?_0xe63d9[_0x809a('0x62')]+'\x20'+_0xe63d9[_0x809a('0x63')]:_0xe63d9[_0x809a('0x63')],'id':_0xe63d9['id']};}if(_0xe63d9['enduserType']===_0x809a('0x56')){_0x126581[_0x809a('0x64')]={'name':!_[_0x809a('0x47')](_0xe63d9[_0x809a('0x61')])?_0xe63d9['Full_Name']:!_[_0x809a('0x47')](_0xe63d9['First_Name'])?_0xe63d9[_0x809a('0x62')]+'\x20'+_0xe63d9['Last_Name']:_0xe63d9[_0x809a('0x63')],'id':_0xe63d9['id']};_0x126581['$se_module']=_[_0x809a('0x45')](_0xe63d9['enduserType']);}if(_0x42f520[_0x809a('0x65')]){_0x126581[_0x809a('0x66')]=moment[_0x809a('0x67')](parseInt(_0x42f520['talktime'])*0x3e8)[_0x809a('0x33')]('mm:ss');}else if(_0x42f520['answertime']&&_0x42f520[_0x809a('0x68')]){_0x126581[_0x809a('0x66')]=moment[_0x809a('0x67')](moment(_0x42f520[_0x809a('0x68')],_0x809a('0x69'))[_0x809a('0x6a')](moment(_0x42f520[_0x809a('0x6b')],'YYYY-MM-DDTHH:mm:ss')))['format'](_0x809a('0x6c'));}switch(_0x42f520[_0x809a('0x6d')]){case _0x809a('0x6e'):_0x126581[_0x809a('0x6f')]=_0x809a('0x70');break;case _0x809a('0x71'):case _0x809a('0x72'):_0x126581['Call_Result']=_0x809a('0x73');break;case _0x809a('0x74'):_0x126581[_0x809a('0x6f')]=_0x809a('0x75');break;case _0x809a('0x76'):_0x126581[_0x809a('0x6f')]=_0x809a('0x77');break;case _0x809a('0x78'):_0x126581['Call_Result']=_0x809a('0x79');default:}_0x126581[_0x809a('0x7a')]=(_0x4ff42a===_0x809a('0x7b')?moment(_0x42f520[_0x809a('0x6b')])[_0x809a('0x33')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x42f520['agentcalledAt'])[_0x809a('0x33')](_0x809a('0x69')))||moment()[_0x809a('0x33')](_0x809a('0x69'));_0x126581[_0x809a('0x7c')]=_0x4ff42a||_0x809a('0x7d');_0x126581=_[_0x809a('0x7e')](_0x126581,getCustomFields(_0x4be3ed[_0x809a('0x7f')],_0x42f520));return request({'method':'POST','uri':_0x809a('0x43')+_0x41f232+_0x809a('0x80'),'headers':{'Authorization':_0x809a('0x36')+_0x359858},'body':{'data':[_0x126581]},'json':!![]})[_0x809a('0x29')](function(_0x285bbd){if(_0x285bbd&&_0x285bbd[_0x809a('0x41')][0x0]['code']===_0x809a('0x4b')){logger[_0x809a('0x30')](_0x809a('0x81'));return{'id':_0x285bbd[_0x809a('0x41')][0x0][_0x809a('0x4c')]['id']};}})[_0x809a('0x40')](function(_0x2e2e53){logger[_0x809a('0x30')](_0x809a('0x82'),_0x2e2e53[_0x809a('0x2f')]);console[_0x809a('0x4f')](_0x809a('0x82'),_0x2e2e53);});}exports[_0x809a('0x83')]=function(_0x27b87c,_0x45845a,_0x37926f,_0x4bcfb8,_0x58c6f2,_0x4834da){var _0xfbdfc3,_0x43c47c,_0x262edb;_0x4834da['host']=intUtil[_0x809a('0x84')](_0x4834da['host']);_0x4834da[_0x809a('0x85')]=intUtil['stripTrailingSlash'](_0x4834da[_0x809a('0x85')]);if(_0x58c6f2&&_0x58c6f2['monitor_format']){logger[_0x809a('0x30')](_0x809a('0x86'),_0x809a('0x87'));_0x45845a[_0x809a('0x88')]=_0x4834da[_0x809a('0x85')]+_0x809a('0x89')+_0x45845a['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x45845a[_0x809a('0x8a')]);}else{_0x45845a[_0x809a('0x88')]='';}var _0x438b59=_0x4834da[_0x809a('0x8b')]===_0x809a('0x8c')?'eu':'com';return getAccessToken(_0x4834da)['then'](function(_0x2c24a1){_0x262edb=_0x2c24a1;return getUser(_0x262edb,_0x438b59,_0x4834da,_0x4bcfb8[_0x809a('0x39')]);})[_0x809a('0x29')](function(_0xabfbf9){_0xfbdfc3=_0xabfbf9;logger['info'](_0x809a('0x8d'),_0xfbdfc3['id']);return getEndUser(_0x262edb,_0x438b59,_0x4834da,_0x45845a[_0x809a('0x8e')],_0x45845a['calleridnum'],_0xfbdfc3,_0x37926f);})[_0x809a('0x29')](function(_0x58b88c){_0x43c47c=_0x58b88c;return getCall(_0x262edb,_0x438b59,_0x4834da,_0xfbdfc3,_0x43c47c,_0x37926f,_0x45845a,_0x809a('0x7d'));})['then'](function(_0x5929df){if(_0x5929df){logger[_0x809a('0x30')]('The\x20Call\x20ID\x20is:',_0x5929df['id']);logger['info'](_0x809a('0x86'),_0x809a('0x8f'));emit(util['format'](_0x809a('0x90'),_0x4bcfb8['name']),'trigger:browser:url',{'uri':_0x809a('0x91')+_0x4834da[_0x809a('0x8b')]+'/crm/EntityInfo.do?module=Calls&id='+_0x5929df['id']});}})[_0x809a('0x40')](function(_0x46eeaa){logger[_0x809a('0x2d')](_0x809a('0x86'),JSON[_0x809a('0xd')](_0x46eeaa));});};exports[_0x809a('0x7b')]=function(_0x1e94b6,_0x439dee,_0x32d7bf,_0x470178,_0x5bbb1e,_0x96e0dc,_0x26cd2c){var _0x450aee,_0x3453bb,_0x209a45;_0x96e0dc['host']=intUtil[_0x809a('0x84')](_0x96e0dc[_0x809a('0x8b')]);_0x96e0dc[_0x809a('0x85')]=intUtil['stripTrailingSlash'](_0x96e0dc[_0x809a('0x85')]);if(_0x26cd2c&&_0x26cd2c[_0x809a('0x92')]&&_0x26cd2c[_0x809a('0x92')]!==_0x809a('0x93')){logger[_0x809a('0x30')]('[OUTBOUND]',_0x809a('0x87'));_0x439dee[_0x809a('0x88')]=_0x96e0dc[_0x809a('0x85')]+_0x809a('0x89')+_0x439dee['uniqueid']+_0x809a('0x94')+md5(_0x439dee[_0x809a('0x8a')]);}var _0x12d3a8=_0x96e0dc[_0x809a('0x8b')]===_0x809a('0x8c')?'eu':'com';return getAccessToken(_0x96e0dc)[_0x809a('0x29')](function(_0x1d5407){_0x209a45=_0x1d5407;return getUser(_0x209a45,_0x12d3a8,_0x96e0dc,_0x470178[_0x809a('0x39')]);})['then'](function(_0x3acd95){_0x450aee=_0x3acd95;logger['info'](_0x809a('0x8d'),_0x450aee['id']);return getEndUser(_0x209a45,_0x12d3a8,_0x96e0dc,_0x439dee[_0x809a('0x95')],_0x439dee[_0x809a('0x96')],_0x450aee,_0x32d7bf);})[_0x809a('0x29')](function(_0x26d980){_0x3453bb=_0x26d980;return getCall(_0x209a45,_0x12d3a8,_0x96e0dc,_0x450aee,_0x3453bb,_0x32d7bf,_0x439dee,'Outbound');})[_0x809a('0x29')](function(_0x4dc21b){if(_0x4dc21b){logger[_0x809a('0x30')](_0x809a('0x97'),_0x4dc21b['id']);logger[_0x809a('0x30')](_0x809a('0x98'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x809a('0x90'),_0x470178[_0x809a('0x1a')]),'trigger:browser:url',{'uri':'https://crm.'+_0x96e0dc[_0x809a('0x8b')]+'/crm/EntityInfo.do?module=Calls&id='+_0x4dc21b['id']});}})[_0x809a('0x40')](function(_0x4b89f1){logger['error']('[OUTBOUND]',JSON[_0x809a('0xd')](_0x4b89f1));});};exports[_0x809a('0x99')]=function(_0x4793c8,_0x4e9754,_0x39c605,_0x51a978,_0x3dd4f1,_0x319d1c){var _0x406765,_0x484343,_0x528909;_0x319d1c[_0x809a('0x8b')]=intUtil['stripTrailingSlash'](_0x319d1c[_0x809a('0x8b')]);_0x319d1c[_0x809a('0x85')]=intUtil[_0x809a('0x84')](_0x319d1c['serverUrl']);if(_0x3dd4f1&&_0x3dd4f1[_0x809a('0x9a')]){logger[_0x809a('0x30')]('['+_0x4e9754['lastevent'][_0x809a('0x9b')]()+']',_0x809a('0x87'));_0x4e9754[_0x809a('0x88')]=_0x319d1c[_0x809a('0x85')]+_0x809a('0x89')+_0x4e9754[_0x809a('0x8a')]+_0x809a('0x94')+md5(_0x4e9754['uniqueid']);}else{_0x4e9754[_0x809a('0x88')]='';}var _0xea764d=_0x319d1c[_0x809a('0x8b')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x319d1c)[_0x809a('0x29')](function(_0x450a19){_0x528909=_0x450a19;return getUser(_0x528909,_0xea764d,_0x319d1c);})['then'](function(_0x1a5608){_0x406765=_0x1a5608;logger[_0x809a('0x30')](_0x809a('0x8d'),_0x406765['id']);return getEndUser(_0x528909,_0xea764d,_0x319d1c,_0x4e9754[_0x809a('0x8e')],_0x4e9754[_0x809a('0x9c')],_0x406765,_0x39c605);})[_0x809a('0x29')](function(_0x4f1f3d){_0x484343=_0x4f1f3d;return getCall(_0x528909,_0xea764d,_0x319d1c,_0x406765,_0x484343,_0x39c605,_0x4e9754,_0x809a('0x7d'));})[_0x809a('0x29')](function(_0x5721df){if(_0x5721df){logger[_0x809a('0x30')]('The\x20Call\x20ID\x20is:',_0x5721df['id']);}})['catch'](function(_0x45f611){logger[_0x809a('0x2d')]('['+_0x4e9754['lastevent'][_0x809a('0x9b')]()+']',JSON[_0x809a('0xd')](_0x45f611));});}; \ 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 b4b7fee..b6d53a8 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 _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 +var _0xf8d6=['mustache','../../../../config/logger','trigger','exec','data2','Script','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x100836,_0x1d9c5f){var _0x19ab99=function(_0x5f549b){while(--_0x5f549b){_0x100836['push'](_0x100836['shift']());}};_0x19ab99(++_0x1d9c5f);}(_0xf8d6,0x11b));var _0x6f8d=function(_0x590a38,_0x2bc65c){_0x590a38=_0x590a38-0x0;var _0xf36626=_0xf8d6[_0x590a38];return _0xf36626;};'use strict';var util=require(_0x6f8d('0x0'));var sh=require(_0x6f8d('0x1'));var Mustache=require(_0x6f8d('0x2'));var logger=require(_0x6f8d('0x3'))(_0x6f8d('0x4'));exports[_0x6f8d('0x5')]=function(_0x35c9b5,_0x2150fc){var _0x43a276=_0x35c9b5['data2']?_0x35c9b5[_0x6f8d('0x6')]:_0x6f8d('0x7');var _0x295b39=_0x35c9b5[_0x6f8d('0x8')]?Mustache[_0x6f8d('0x9')](_0x35c9b5['data3'],_0x2150fc):_0x2150fc;sh[_0x6f8d('0x5')](_0x295b39,function(_0x44ede1,_0x5704fe,_0x54d7f9){if(_0x44ede1!==0x0){logger[_0x6f8d('0xa')](util[_0x6f8d('0xb')](_0x6f8d('0xc'),_0x43a276,_0x295b39,_0x44ede1,_0x54d7f9));}else{logger[_0x6f8d('0xd')](util[_0x6f8d('0xb')](_0x6f8d('0xe'),_0x43a276,_0x295b39,_0x5704fe));}});}; \ 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 6d54731..4a51e16 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 _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 +var _0x66e4=['request-promise','util','lodash','mustache','trigger','exec','data1','toUpperCase','render','data2','data5','number','data6','error','stack','GET','DELETE','PUT','data7','parse','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','isNil','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message'];(function(_0x472d55,_0x38460b){var _0x372767=function(_0x47c1ea){while(--_0x47c1ea){_0x472d55['push'](_0x472d55['shift']());}};_0x372767(++_0x38460b);}(_0x66e4,0xd9));var _0x466e=function(_0x2e84c6,_0x3c9eb1){_0x2e84c6=_0x2e84c6-0x0;var _0x349a23=_0x66e4[_0x2e84c6];return _0x349a23;};'use strict';var rp=require(_0x466e('0x0'));var util=require(_0x466e('0x1'));var _=require(_0x466e('0x2'));var Mustache=require(_0x466e('0x3'));var logger=require('../../../../config/logger')(_0x466e('0x4'));exports[_0x466e('0x5')]=function(_0xce1591,_0x16337c){var _0x6d66ce,_0x5ce9e7;var _0x5a0f28={'method':_0xce1591[_0x466e('0x6')][_0x466e('0x7')](),'uri':Mustache[_0x466e('0x8')](_0xce1591[_0x466e('0x9')],_0x16337c),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xce1591[_0x466e('0xa')])===_0x466e('0xb')&&parseInt(_0xce1591[_0x466e('0xa')])>=0x1&&parseInt(_0xce1591[_0x466e('0xa')])<=0xa?parseInt(_0xce1591[_0x466e('0xa')])*0x3e8:0x5*0x3e8};try{_0x5a0f28['headers']=_0xce1591[_0x466e('0xc')]?JSON['parse'](Mustache[_0x466e('0x8')](_0xce1591[_0x466e('0xc')],_0x16337c)):{};}catch(_0x24bc22){logger[_0x466e('0xd')](_0x24bc22[_0x466e('0xe')]);}switch(_0xce1591[_0x466e('0x6')][_0x466e('0x7')]()){case _0x466e('0xf'):case _0x466e('0x10'):_0x6d66ce=null;_0x5a0f28['qs']=_0x16337c;break;case'POST':case _0x466e('0x11'):if(_0xce1591[_0x466e('0x12')]){try{_0x6d66ce=JSON[_0x466e('0x13')](Mustache[_0x466e('0x8')](_0xce1591[_0x466e('0x12')],_0x16337c));_0x5a0f28['body']=_0x6d66ce;}catch(_0x5c4f1a){logger[_0x466e('0xd')](_0x5c4f1a['stack']);logger[_0x466e('0xd')](_0x466e('0x14'));}}else{_0x6d66ce=_0x16337c;_0x5a0f28[_0x466e('0x15')]=_0x6d66ce;}break;}logger[_0x466e('0x16')](util['format'](_0x466e('0x17'),_0xce1591['data1'],_0xce1591[_0x466e('0x9')],JSON[_0x466e('0x18')](_0x5a0f28)));rp(_0x5a0f28)['then'](function(_0x488ae5){_0x6d66ce=!_[_0x466e('0x19')](_0x6d66ce)?',\x20request\x20body:\x20'+_0x6d66ce:'';_0x5ce9e7=typeof _0x488ae5[_0x466e('0x15')]===_0x466e('0x1a')?JSON[_0x466e('0x18')](_0x488ae5[_0x466e('0x15')]):_0x488ae5[_0x466e('0x15')];logger[_0x466e('0x16')](util['format'](_0x466e('0x1b'),_0xce1591['data1'],_0xce1591['data2'],_0x488ae5[_0x466e('0x1c')],_0x5ce9e7));})['catch'](function(_0x432495){logger[_0x466e('0xd')](util['format'](_0x466e('0x1d'),_0xce1591[_0x466e('0x6')],_0xce1591[_0x466e('0x9')],_0x432495[_0x466e('0x1c')],_0x432495['name'],_0x432495[_0x466e('0x1e')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index ee4765d..8233a5e 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 _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 +var _0xc551=['result','catch','exports','bluebird','../../config/logger','routing','http','Request','request','then','rpc','error','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc551,0x1d7));var _0x1c55=function(_0x245e3a,_0x240cea){_0x245e3a=_0x245e3a-0x0;var _0x528311=_0xc551[_0x245e3a];return _0x528311;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x1c55('0x0'));var logger=require(_0x1c55('0x1'))(_0x1c55('0x2'));var client=jayson['client'][_0x1c55('0x3')]({'port':0x2329});client[_0x1c55('0x4')]=function(_0x5f5b62,_0x5b1658){return new BPromise(function(_0x57c6b9,_0x2243f5){return client[_0x1c55('0x5')](_0x5f5b62,_0x5b1658)[_0x1c55('0x6')](function(_0x4c6835){logger['debug'](_0x1c55('0x7'),_0x1c55('0x2'),_0x5f5b62,_0x5b1658,_0x4c6835);if(_0x4c6835[_0x1c55('0x8')]){logger[_0x1c55('0x8')]('rpc',_0x1c55('0x2'),_0x5f5b62,_0x4c6835[_0x1c55('0x8')]['message'],_0x5b1658);return _0x2243f5(_0x4c6835[_0x1c55('0x8')][_0x1c55('0x9')]);}else{return _0x57c6b9(_0x4c6835[_0x1c55('0xa')]);}})[_0x1c55('0xb')](function(_0x45fb85){logger[_0x1c55('0x8')](_0x1c55('0x7'),_0x1c55('0x2'),_0x5f5b62,_0x45fb85,_0x5b1658);return _0x2243f5(_0x45fb85);});});};module[_0x1c55('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 09a4984..a55ce4a 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 _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 +var _0xb0c0=['Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','getMailAccounts','then','loginMailFrequency','catch','error'];(function(_0x294ba1,_0x20188f){var _0x176a81=function(_0x1e3037){while(--_0x1e3037){_0x294ba1['push'](_0x294ba1['shift']());}};_0x176a81(++_0x20188f);}(_0xb0c0,0x7f));var _0x0b0c=function(_0x34f26b,_0x1c400b){_0x34f26b=_0x34f26b-0x0;var _0x568071=_0xb0c0[_0x34f26b];return _0x568071;};'use strict';var server=require(_0x0b0c('0x0'));var Realtime=require(_0x0b0c('0x1'));var EmailChannel=require(_0x0b0c('0x2'));var mailAccount=require(_0x0b0c('0x3'));var setting=require(_0x0b0c('0x4'));var logger=require(_0x0b0c('0x5'))(_0x0b0c('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x0b0c('0x7')]()['then'](mailAccount[_0x0b0c('0x8')]())['then'](realtime['initMailAccounts']())[_0x0b0c('0x9')](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)[_0x0b0c('0x9')](function(){return initRealtime();})[_0x0b0c('0x9')](function(){return setting['getSettings']();})[_0x0b0c('0x9')](function(_0x42da5a){return setInterval(initRealtime,_0x42da5a[_0x0b0c('0xa')]*0x3e8);})[_0x0b0c('0xb')](function(_0x4307bd){logger[_0x0b0c('0xc')](_0x0b0c('0xd'),_0x4307bd);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 4b0fa87..26de43b 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 _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 +var _0xdf87=['Smtp','exports','lodash','bluebird','ioredis','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','start\x20email\x20channel','imapAccounts','smtp','emit','mailAccounts','name','key','active','Imap','messageStatus','total','isNil','stringify','md5','prototype','refresh','service','custom','provider','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','handleImapError','status','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','info','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','error','sendMail','send','verifySmtp','verify','verified'];(function(_0x4febcd,_0x141f0c){var _0x253421=function(_0x4768dc){while(--_0x4768dc){_0x4febcd['push'](_0x4febcd['shift']());}};_0x253421(++_0x141f0c);}(_0xdf87,0x1e2));var _0x7df8=function(_0xbf8c84,_0xc878c){_0xbf8c84=_0xbf8c84-0x0;var _0x456334=_0xdf87[_0xbf8c84];return _0x456334;};'use strict';var _=require(_0x7df8('0x0'));var moment=require('moment');var BPromise=require(_0x7df8('0x1'));var md5=require('md5');var Redis=require(_0x7df8('0x2'));var config=require('../../../config/environment');var logger=require(_0x7df8('0x3'))(_0x7df8('0x4'));config[_0x7df8('0x5')]=_[_0x7df8('0x6')](config['redis'],{'host':_0x7df8('0x7'),'port':0x18eb});var io=require(_0x7df8('0x8'))(new Redis(config[_0x7df8('0x5')]));var EmailImap=require(_0x7df8('0x9'));var EmailSmtp=require(_0x7df8('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x8035b1){logger['info'](_0x7df8('0xb'));this['mailAccounts']=_0x8035b1['mailAccounts'];this[_0x7df8('0xc')]={};this[_0x7df8('0xd')]=new EmailSmtp();}EmailChannel['prototype'][_0x7df8('0xe')]=function(_0x2b0c15){var _0x28b396=this[_0x7df8('0xf')][_0x2b0c15];var _0x57fb9f={'id':_0x28b396['id'],'name':_0x28b396[_0x7df8('0x10')],'key':_0x28b396[_0x7df8('0x11')],'active':_0x28b396[_0x7df8('0x12')],'Imap':{'status':_0x28b396[_0x7df8('0x13')]['status'],'messageStatus':_0x28b396[_0x7df8('0x13')][_0x7df8('0x14')],'total':_0x28b396['Imap'][_0x7df8('0x15')]}};if(_[_0x7df8('0x16')](md5Accounts[_0x2b0c15])){md5Accounts[_0x2b0c15]={};}var _0x28d994=md5(JSON[_0x7df8('0x17')](_0x57fb9f));if(md5Accounts[_0x2b0c15][_0x7df8('0x18')]!==_0x28d994){md5Accounts[_0x2b0c15][_0x7df8('0x18')]=_0x28d994;io[_0x7df8('0xe')]('mailAccount:update',_0x57fb9f);}};EmailChannel[_0x7df8('0x19')][_0x7df8('0x1a')]=function(_0x43f412){for(var _0x270323 in _0x43f412){if(_0x43f412['hasOwnProperty'](_0x270323)){if(_0x43f412[_0x270323][_0x7df8('0x13')]&&_0x43f412[_0x270323][_0x7df8('0x12')]){var _0x124dda=_0x43f412[_0x270323][_0x7df8('0x13')];if(!_0x124dda[_0x7df8('0x1b')]&&_0x43f412[_0x270323]['provider']!==_0x7df8('0x1c'))_0x124dda[_0x7df8('0x1b')]=_0x43f412[_0x270323][_0x7df8('0x1d')];if(!this[_0x7df8('0xc')][_0x7df8('0x1e')](_0x124dda['id'])){this[_0x7df8('0xc')][_0x124dda['id']]=new EmailImap(_0x124dda,_0x43f412[_0x270323]['email']);this[_0x7df8('0xc')][_0x124dda['id']]['on'](_0x7df8('0x1f'),this[_0x7df8('0x20')][_0x7df8('0x21')](this,_0x270323));this[_0x7df8('0xc')][_0x124dda['id']]['on'](_0x7df8('0x4'),this[_0x7df8('0x22')]['bind'](this,_0x270323));this[_0x7df8('0xc')][_0x124dda['id']]['on'](_0x7df8('0x23'),this[_0x7df8('0x24')][_0x7df8('0x21')](this,_0x270323));this[_0x7df8('0xc')][_0x124dda['id']]['on']('error',this[_0x7df8('0x25')][_0x7df8('0x21')](this,_0x270323));}}else{if(_[_0x7df8('0x16')](this[_0x7df8('0xf')][_0x270323][_0x7df8('0x13')])){this['mailAccounts'][_0x270323][_0x7df8('0x13')]={};}this[_0x7df8('0xf')][_0x270323][_0x7df8('0x13')][_0x7df8('0x26')]='disabled';this['mailAccounts'][_0x270323][_0x7df8('0x13')][_0x7df8('0x14')]='';this[_0x7df8('0xe')](_0x270323);}}}};EmailChannel[_0x7df8('0x19')][_0x7df8('0x20')]=function(_0x20a1f8,_0x5194b2){if(this[_0x7df8('0xf')][_0x20a1f8]){this[_0x7df8('0xf')][_0x20a1f8]['Imap'][_0x7df8('0x26')]=_0x7df8('0x27');this[_0x7df8('0xf')][_0x20a1f8][_0x7df8('0x13')][_0x7df8('0x14')]=_0x5194b2[_0x7df8('0x10')];if(_0x5194b2[_0x7df8('0x28')]){this[_0x7df8('0xf')][_0x20a1f8][_0x7df8('0x13')]['total']=_0x5194b2[_0x7df8('0x28')][_0x7df8('0x15')];}return this[_0x7df8('0xe')](_0x20a1f8);}};EmailChannel['prototype'][_0x7df8('0x22')]=function(_0x1a567e,_0x1e72a3){logger['info'](_0x7df8('0x29'),_0x1e72a3[_0x7df8('0x2a')],_0x1e72a3[_0x7df8('0x2b')],_0x1e72a3[_0x7df8('0x2c')],_0x1a567e);if(this[_0x7df8('0xf')][_0x1a567e]){return mailAccount[_0x7df8('0x2d')](_0x1a567e,_0x1e72a3)[_0x7df8('0x2e')](function(_0x1e5c98){if(_0x1e5c98){logger[_0x7df8('0x2f')](_0x7df8('0x30'));}})[_0x7df8('0x31')](function(_0x2cedbd){logger['error'](_0x7df8('0x32'),JSON[_0x7df8('0x17')](_0x2cedbd));});}};EmailChannel[_0x7df8('0x19')]['handleImapEnd']=function(_0x330c18){if(this[_0x7df8('0xf')][_0x330c18]&&this['mailAccounts'][_0x330c18][_0x7df8('0x13')]){if(this[_0x7df8('0xc')][this[_0x7df8('0xf')][_0x330c18][_0x7df8('0x13')]['id']]){delete this[_0x7df8('0xc')][this[_0x7df8('0xf')][_0x330c18][_0x7df8('0x13')]['id']];}this[_0x7df8('0xf')][_0x330c18][_0x7df8('0x13')][_0x7df8('0x33')]=moment();this[_0x7df8('0xe')](_0x330c18);}};EmailChannel[_0x7df8('0x19')][_0x7df8('0x25')]=function(_0x3501c3,_0x360b22){if(this[_0x7df8('0xf')][_0x3501c3]){this['mailAccounts'][_0x3501c3][_0x7df8('0x13')]['status']=_0x7df8('0x34');this[_0x7df8('0xf')][_0x3501c3]['Imap']['messageStatus']=_0x360b22;return this['emit'](_0x3501c3);}};EmailChannel[_0x7df8('0x19')][_0x7df8('0x35')]=function(_0x56ed96,_0x5a4f9a){return this[_0x7df8('0xd')][_0x7df8('0x36')](_0x56ed96,_0x5a4f9a);};EmailChannel[_0x7df8('0x19')][_0x7df8('0x37')]=function(_0x54d4d9){var _0x194f78=this;if(this[_0x7df8('0xf')][_0x54d4d9['id']]){if(_[_0x7df8('0x16')](this[_0x7df8('0xf')][_0x54d4d9['id']]['Smtp'])){this[_0x7df8('0xf')][_0x54d4d9['id']]['Smtp']={};}this[_0x7df8('0xf')][_0x54d4d9['id']]['Smtp'][_0x7df8('0x33')]=moment();return new BPromise(function(_0x1fb2c5,_0x1969f3){return _0x194f78[_0x7df8('0xd')][_0x7df8('0x38')](_0x54d4d9)[_0x7df8('0x2e')](function(_0x12c65a){_0x194f78[_0x7df8('0xf')][_0x54d4d9['id']]['Smtp'][_0x7df8('0x26')]=_0x7df8('0x39');_0x194f78['mailAccounts'][_0x54d4d9['id']][_0x7df8('0x3a')][_0x7df8('0x14')]='';_0x194f78[_0x7df8('0xe')](_0x54d4d9['id']);_0x1fb2c5(_0x12c65a);})[_0x7df8('0x31')](function(_0xa0148e){_0x194f78[_0x7df8('0xf')][_0x54d4d9['id']][_0x7df8('0x3a')][_0x7df8('0x26')]='error';_0x194f78[_0x7df8('0xf')][_0x54d4d9['id']][_0x7df8('0x3a')][_0x7df8('0x14')]=_0xa0148e;_0x194f78[_0x7df8('0xe')](_0x54d4d9['id']);_0x1969f3(_0xa0148e);});});}return this[_0x7df8('0xd')][_0x7df8('0x38')](_0x54d4d9);};module[_0x7df8('0x3b')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index e145518..e68d25b 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 _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 +var _0x64e6=['generateXOAuth2Token','CloudProvider','password','authentication','host','port','tls','autotls','required','handleReady','handleOpenBox','emit','box','readUnseen','search','UNSEEN','length','fetch','handleFetchError','handleCloseBox','handleFetchMessage','body','attributes','handleMessageEnd','handleMessageBody','handleSimpleParser','handleMessageAttributes','parser','closeBox','stringify','textCode','hasOwnProperty','upperFirst','exports','util','imap','mailparser','simpleParser','Iconv','events','email','mailbox','account','getAccount','once','bind','end','handleEnd','error','handleError','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x64e6,0xcd));var _0x664e=function(_0x6494a3,_0x35cfc1){_0x6494a3=_0x6494a3-0x0;var _0x1f9bc4=_0x64e6[_0x6494a3];return _0x1f9bc4;};'use strict';var _=require('lodash');var util=require(_0x664e('0x0'));var Imap=require(_0x664e('0x1'));var simpleParser=require(_0x664e('0x2'))[_0x664e('0x3')];var Iconv=require('iconv')[_0x664e('0x4')];var EventEmitter=require(_0x664e('0x5'))['EventEmitter'];var utils=require('./utils');var logger=require('../../../config/logger')(_0x664e('0x6'));function EmailImap(_0x4d634c,_0x2e3184){this[_0x664e('0x7')]=_0x4d634c['mailbox'];this[_0x664e('0x8')]=this[_0x664e('0x9')](_0x4d634c,_0x2e3184);this[_0x664e('0x1')]=new Imap(this[_0x664e('0x8')]);this[_0x664e('0x1')][_0x664e('0xa')]('ready',this['handleReady'][_0x664e('0xb')](this));this[_0x664e('0x1')][_0x664e('0xa')](_0x664e('0xc'),this[_0x664e('0xd')][_0x664e('0xb')](this));this['imap']['on'](_0x664e('0xe'),this[_0x664e('0xf')]['bind'](this));this[_0x664e('0x1')]['connect']();}util[_0x664e('0x10')](EmailImap,EventEmitter);EmailImap[_0x664e('0x11')][_0x664e('0x9')]=function(_0x55d989,_0x243848){var _0x4837bd={'connTimeout':_0x55d989[_0x664e('0x12')]?_0x55d989[_0x664e('0x12')]*0x3e8:0x2710,'authTimeout':_0x55d989[_0x664e('0x13')]?_0x55d989[_0x664e('0x13')]*0x3e8:0x1388};if(_0x55d989[_0x664e('0x14')]){_0x4837bd[_0x664e('0x15')]=_0x55d989[_0x664e('0x15')];if(_0x55d989[_0x664e('0x16')]){_0x4837bd['xoauth2']=utils[_0x664e('0x17')](_0x55d989[_0x664e('0x18')]['data5'],_0x55d989[_0x664e('0x15')]);}else{_0x4837bd['password']=_0x55d989[_0x664e('0x19')];}}else{if(_0x55d989[_0x664e('0x1a')]){_0x4837bd[_0x664e('0x15')]=_0x55d989[_0x664e('0x15')];_0x4837bd[_0x664e('0x19')]=_0x55d989['password'];}}_0x4837bd[_0x664e('0x6')]=_0x243848||_0x55d989[_0x664e('0x15')]||'anonymous@xcally.com';_0x4837bd[_0x664e('0x1b')]=_0x55d989['host'];_0x4837bd[_0x664e('0x1c')]=_0x55d989[_0x664e('0x1c')]||0x3e1;if(_0x55d989[_0x664e('0x1d')]){_0x4837bd[_0x664e('0x1d')]=!![];}else{_0x4837bd['tls']=![];_0x4837bd[_0x664e('0x1e')]=_0x664e('0x1f');}return _0x4837bd;};EmailImap[_0x664e('0x11')][_0x664e('0x20')]=function(){this[_0x664e('0x1')]['openBox'](this[_0x664e('0x7')],![],this[_0x664e('0x21')][_0x664e('0xb')](this));};EmailImap[_0x664e('0x11')][_0x664e('0x21')]=function(_0x79cc62,_0x540a60){if(_0x79cc62){this[_0x664e('0xf')](_0x79cc62,!![]);}else{this[_0x664e('0x22')](_0x664e('0x23'),_0x540a60);this[_0x664e('0x24')]();}};EmailImap[_0x664e('0x11')]['handleCloseBox']=function(_0x2363bb){if(_0x2363bb){this[_0x664e('0xf')](_0x2363bb,!![]);}else{this['imap'][_0x664e('0xc')]();}};EmailImap['prototype']['readUnseen']=function(){this[_0x664e('0x1')][_0x664e('0x25')]([_0x664e('0x26')],this['handleReadUnseen'][_0x664e('0xb')](this));};EmailImap[_0x664e('0x11')]['handleReadUnseen']=function(_0x41025d,_0x4cb38f){if(_0x41025d){this[_0x664e('0xf')](_0x41025d,!![]);}else{if(_0x4cb38f[_0x664e('0x27')]){try{var _0x289b50=this[_0x664e('0x1')][_0x664e('0x28')](_0x4cb38f,{'bodies':'','markSeen':!![]});_0x289b50['on']('message',this['handleFetchMessage']['bind'](this));_0x289b50[_0x664e('0xa')](_0x664e('0xe'),this[_0x664e('0x29')][_0x664e('0xb')](this));_0x289b50['once'](_0x664e('0xc'),this['handleFetchEnd'][_0x664e('0xb')](this));}catch(_0xf18e7b){logger[_0x664e('0xe')](_0xf18e7b);}}else{this[_0x664e('0x1')]['closeBox'](!![],this[_0x664e('0x2a')][_0x664e('0xb')](this));}}};EmailImap['prototype'][_0x664e('0x2b')]=function(_0xacd7b3){_0xacd7b3['on'](_0x664e('0x2c'),this['handleMessageBody']['bind'](this));_0xacd7b3['once'](_0x664e('0x2d'),this['handleMessageAttributes']['bind'](this));_0xacd7b3[_0x664e('0xa')](_0x664e('0xc'),this[_0x664e('0x2e')][_0x664e('0xb')](this));};EmailImap[_0x664e('0x11')][_0x664e('0x2f')]=function(_0x4557f6){simpleParser(_0x4557f6,{'Iconv':Iconv},this[_0x664e('0x30')]['bind'](this));};EmailImap[_0x664e('0x11')][_0x664e('0x31')]=function(){};EmailImap[_0x664e('0x11')][_0x664e('0x2e')]=function(){};EmailImap['prototype'][_0x664e('0x30')]=function(_0x174d10,_0x2039a4){if(_0x174d10){logger[_0x664e('0xe')](_0x174d10);}else{var _0x28ca4a=this;utils[_0x664e('0x32')](this['account'],_0x2039a4,function(_0x4fbf66){_0x28ca4a[_0x664e('0x22')](_0x664e('0x6'),_0x4fbf66);});}};EmailImap[_0x664e('0x11')]['handleFetchEnd']=function(){this[_0x664e('0x1')][_0x664e('0x33')](!![],this[_0x664e('0x2a')][_0x664e('0xb')](this));};EmailImap['prototype'][_0x664e('0x29')]=function(_0xb6ccec){this[_0x664e('0xf')](_0xb6ccec);this[_0x664e('0x1')][_0x664e('0x33')](!![],this[_0x664e('0x2a')][_0x664e('0xb')](this));};EmailImap[_0x664e('0x11')][_0x664e('0xd')]=function(){this[_0x664e('0x22')](_0x664e('0xc'));};EmailImap[_0x664e('0x11')][_0x664e('0xf')]=function(_0x4a4aaf,_0x471750){logger[_0x664e('0xe')]('handleError',this[_0x664e('0x8')][_0x664e('0x6')],JSON[_0x664e('0x34')](_0x4a4aaf));var _0x30122d='';if(_0x4a4aaf){if(_0x4a4aaf[_0x664e('0x35')]){_0x30122d=_0x4a4aaf[_0x664e('0x35')];}else{for(var _0x362ea4 in _0x4a4aaf){if(_0x4a4aaf[_0x664e('0x36')](_0x362ea4)){_0x30122d+=_[_0x664e('0x37')](_0x362ea4)+':\x20'+_0x4a4aaf[_0x362ea4]+'\x0a';}}}}if(_0x471750){this['imap'][_0x664e('0xc')]();}else{this['emit'](_0x664e('0xe'),_0x30122d);this[_0x664e('0x22')]('end');}};module[_0x664e('0x38')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index b48ef46..d6f9691 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 _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 +var _0x9dde=['sendMail','toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','send','createTransport','use'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x9dde,0xeb));var _0xe9dd=function(_0x12d769,_0x47a127){_0x12d769=_0x12d769-0x0;var _0x35987b=_0x9dde[_0x12d769];return _0x35987b;};'use strict';var nodemailer=require(_0xe9dd('0x0'));var inlineBase64=require(_0xe9dd('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0xe9dd('0x2')]=function(_0x3b7e4a,_0x13be42){return new Promise(function(_0x4d62f5,_0x18f6f4){var _0x400d5e=nodemailer[_0xe9dd('0x3')](_0x3b7e4a);_0x400d5e[_0xe9dd('0x4')]('compile',inlineBase64());_0x400d5e[_0xe9dd('0x5')](_0x13be42,function(_0x1c6338,_0xf47f0){if(_0x1c6338){_0x18f6f4(_0x1c6338[_0xe9dd('0x6')]());}else{_0x4d62f5(_0xf47f0);}});});};EmailSmtp['prototype'][_0xe9dd('0x7')]=function(_0x4cba6d){return new Promise(function(_0x511c5a,_0x34d3c1){var _0x428fad=nodemailer['createTransport'](_0x4cba6d);_0x428fad['verify'](function(_0x422447,_0x23d082){if(_0x422447){_0x34d3c1(_0x422447['toString']());}else{if(_0x23d082){_0x511c5a(_0x23d082);}else{_0x34d3c1(_0xe9dd('0x8'));}}});});};module[_0xe9dd('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 2d72e75..fd602dd 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 _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 +var _0xe3df=['join','Anonymous','pop','isEmpty','html','test','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','generateXOAuth2Token','user=','utf-8','toString','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','length'];(function(_0x3b3bd7,_0x58e72e){var _0x414c31=function(_0x57453a){while(--_0x57453a){_0x3b3bd7['push'](_0x3b3bd7['shift']());}};_0x414c31(++_0x58e72e);}(_0xe3df,0x87));var _0xfe3d=function(_0x2e1997,_0x364eff){_0x2e1997=_0x2e1997-0x0;var _0x2e3dda=_0xe3df[_0x2e1997];return _0x2e3dda;};'use strict';var _=require(_0xfe3d('0x0'));var moment=require(_0xfe3d('0x1'));var random=require(_0xfe3d('0x2'));var fs=require('fs');var path=require(_0xfe3d('0x3'));var util=require(_0xfe3d('0x4'));var tnef=require(_0xfe3d('0x5'));var logger=require(_0xfe3d('0x6'))('email');var config=require('../../../config/environment');function getAddress(_0x1dfc9b){var _0x418038=_[_0xfe3d('0x7')](_0x1dfc9b[_0xfe3d('0x8')]);return _0x418038&&_0x418038['address']?_0x418038[_0xfe3d('0x9')]:_0xfe3d('0xa')+random[_0xfe3d('0xb')](0x6)+_0xfe3d('0xc');}function getFirstName(_0x1d9d10){var _0x5212a0=_['head'](_0x1d9d10[_0xfe3d('0x8')]);if(_0x5212a0&&_0x5212a0['name']){if(_0x5212a0['name']==_0x5212a0[_0xfe3d('0x9')]){return _0x5212a0[_0xfe3d('0xd')][_0xfe3d('0xe')](0x0,_0x5212a0[_0xfe3d('0xd')][_0xfe3d('0xf')]('@'));}var _0x3d5753=_0x5212a0[_0xfe3d('0xd')]['split'](/\s+/);return _0x3d5753[_0xfe3d('0x10')]>0x1?_0x3d5753['slice'](0x0,-0x1)[_0xfe3d('0x11')]('\x20'):_0x5212a0[_0xfe3d('0xd')];}return _0xfe3d('0x12');}function getLastName(_0xdcd8e8){var _0x2e434b=_[_0xfe3d('0x7')](_0xdcd8e8[_0xfe3d('0x8')]);if(_0x2e434b&&_0x2e434b[_0xfe3d('0xd')]){var _0x49e096=_0x2e434b[_0xfe3d('0xd')]['split'](/\s+/);return _0x49e096[_0xfe3d('0x10')]>0x1?_0x49e096[_0xfe3d('0x13')]():'';}return'';}function getMails(_0xeee022,_0x417b45){var _0x3e48b2='';for(var _0x59f90c=0x0;_0x59f90c<_0x417b45[_0xfe3d('0x8')]['length'];_0x59f90c+=0x1){if(_0x417b45['value'][_0x59f90c][_0xfe3d('0x9')]!==_0xeee022){if(!_[_0xfe3d('0x14')](_0x3e48b2)){_0x3e48b2+=',';}_0x3e48b2+=_0x417b45[_0xfe3d('0x8')][_0x59f90c]['name']||_0x417b45[_0xfe3d('0x8')][_0x59f90c]['address']||'';_0x3e48b2+='\x20<';_0x3e48b2+=_0x417b45[_0xfe3d('0x8')][_0x59f90c][_0xfe3d('0x9')]?_0x417b45[_0xfe3d('0x8')][_0x59f90c][_0xfe3d('0x9')]:'anonymous'+random['generate'](0x6)+_0xfe3d('0xc');_0x3e48b2+='>';}}return _0x3e48b2;}function parseEmail(_0x503d56,_0x4edb87,_0x454e8c){if(_0x4edb87[_0xfe3d('0x15')]){var _0x1a60b3=/)<[^<]*)*<\/script>/gi;while(_0x1a60b3[_0xfe3d('0x16')](_0x4edb87[_0xfe3d('0x15')])){_0x4edb87['html']=_0x4edb87[_0xfe3d('0x15')]['replace'](_0x1a60b3,'');}if(_0x4edb87[_0xfe3d('0x15')][_0xfe3d('0x17')](_0xfe3d('0x18'))){var _0x51ecd1=[];_0x4edb87[_0xfe3d('0x19')]['forEach'](_0x3e095e=>{_0x51ecd1[_0xfe3d('0x1a')](_0x3e095e[_0xfe3d('0x1b')]);});var _0x1c07a0=/]+>/g;var _0x28ee65=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x437814=_0x4edb87[_0xfe3d('0x15')][_0xfe3d('0x1c')](_0x28ee65,'_SRC');var _0xceb226=_0x437814[_0xfe3d('0x1c')](_0x1c07a0,_0xfe3d('0x1d'));for(let _0x5046eb=0x0;_0x5046eb<_0x51ecd1[_0xfe3d('0x10')];_0x5046eb++){var _0x12b2c8=_0xceb226[_0xfe3d('0x1c')]('_IMG',_0xfe3d('0x1e')+_0x51ecd1[_0x5046eb]+_0xfe3d('0x1f'));_0xceb226=_0x12b2c8;}_0x4edb87['html']=_0xceb226;}_0x454e8c[_0xfe3d('0x20')]=_0x4edb87[_0xfe3d('0x15')];}else{_0x454e8c[_0xfe3d('0x20')]=_0x4edb87[_0xfe3d('0x21')];}if(_0x454e8c[_0xfe3d('0x20')]){_0x454e8c[_0xfe3d('0x20')]=_0x454e8c[_0xfe3d('0x20')]['replace'](/0x0){var _0x276477=[_0xfe3d('0x32'),_0xfe3d('0x33'),_0xfe3d('0x34')];for(var _0x53cf96=0x0;_0x53cf96<_0x4edb87[_0xfe3d('0x31')][_0xfe3d('0x10')];_0x53cf96++){var _0xabd6d8=_['indexOf'](_0x276477,_0x4edb87[_0xfe3d('0x31')][_0x53cf96][_0xfe3d('0x35')]);if(_0xabd6d8>=0x0){_0x454e8c[_0xfe3d('0x36')]=!![];}}}return _0x454e8c;}exports['parser']=function(_0x5a3d60,_0xe958a4,_0x2fa91b){var _0x3262f0={'from':getAddress(_0xe958a4['from']),'firstName':getFirstName(_0xe958a4[_0xfe3d('0x37')]),'lastName':getLastName(_0xe958a4[_0xfe3d('0x37')]),'mapKey':_0xfe3d('0x23'),'message':{'from':getMails(_0x5a3d60[_0xfe3d('0x23')],_0xe958a4['from']),'to':_0x5a3d60[_0xfe3d('0x23')],'cc':'','subject':_0xe958a4['subject']||'','messageId':_0xe958a4[_0xfe3d('0x38')],'inReplyTo':_0xe958a4[_0xfe3d('0x39')],'sentAt':moment(_0xe958a4[_0xfe3d('0x3a')])['format'](_0xfe3d('0x3b')),'attach':![],'attachments':[]}};if(!_0xe958a4[_0xfe3d('0x15')]&&!_0xe958a4['textAsHtml']){var _0xd24643=_[_0xfe3d('0x3c')](_0xe958a4[_0xfe3d('0x19')],{'contentType':_0xfe3d('0x3d')});if(_0xd24643[_0xfe3d('0x10')]){logger[_0xfe3d('0x3e')](util['format'](_0xfe3d('0x3f'),_0xe958a4['messageId']));tnef[_0xfe3d('0x40')](_[_0xfe3d('0x41')](_0xd24643)[_0xfe3d('0x2f')],function(_0x37c46f,_0x467700){if(_0x467700){_0xe958a4[_0xfe3d('0x15')]=_0x467700[_0xfe3d('0x42')]||'

Empty\x20message

';if(_0x467700[_0xfe3d('0x43')]){for(var _0x56075d=0x0;_0x56075d<_0x467700[_0xfe3d('0x43')][_0xfe3d('0x10')];_0x56075d++){var _0x2320f0=_0x467700['Attachments'][_0x56075d];_0x3262f0['message'][_0xfe3d('0x19')]['push']({'filename':_0x2320f0[_0xfe3d('0x44')],'content':Buffer[_0xfe3d('0x37')](_0x2320f0[_0xfe3d('0x45')])});}}}_0x2fa91b(parseEmail(_0x5a3d60,_0xe958a4,_0x3262f0));});}else{_0xe958a4[_0xfe3d('0x15')]=_0xfe3d('0x46');_0x2fa91b(parseEmail(_0x5a3d60,_0xe958a4,_0x3262f0));}}else{_0x2fa91b(parseEmail(_0x5a3d60,_0xe958a4,_0x3262f0));}};exports[_0xfe3d('0x47')]=function(_0x2cfa61,_0x50d61f){var _0x54c0f0=[_0xfe3d('0x48')+(_0x50d61f||''),'auth=Bearer\x20'+_0x2cfa61,'',''];return Buffer[_0xfe3d('0x37')](_0x54c0f0['join'](''),_0xfe3d('0x49'))[_0xfe3d('0x4a')](_0xfe3d('0x4b'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 63f41e9..7eaa3bf 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 _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 +var _0xaa24=['Service','key','SERV','active','Imap','Smtp','lodash','name'];(function(_0x347b73,_0x55d4b2){var _0x43e702=function(_0x9ac1){while(--_0x9ac1){_0x347b73['push'](_0x347b73['shift']());}};_0x43e702(++_0x55d4b2);}(_0xaa24,0x10e));var _0x4aa2=function(_0xb8bbf4,_0x136a2d){_0xb8bbf4=_0xb8bbf4-0x0;var _0x208a08=_0xaa24[_0xb8bbf4];return _0x208a08;};'use strict';var _=require(_0x4aa2('0x0'));function MailAccount(_0x246dc0){this['id']=_0x246dc0['id']||0x0;this[_0x4aa2('0x1')]=_0x246dc0[_0x4aa2('0x1')]||_0x4aa2('0x2');this[_0x4aa2('0x3')]=_0x246dc0[_0x4aa2('0x3')]||_0x4aa2('0x4');this[_0x4aa2('0x5')]=_0x246dc0[_0x4aa2('0x5')]||![];this['Imap']=_0x246dc0[_0x4aa2('0x6')]||[];this[_0x4aa2('0x7')]=_0x246dc0['Smtp']||[];}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 95069d4..7d1ea67 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 _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 +var _0xabfb=['prototype','initMailAccounts','length','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xabfb,0x12f));var _0xbabf=function(_0x411e71,_0xf9652){_0x411e71=_0x411e71-0x0;var _0x226ae3=_0xabfb[_0x411e71];return _0x226ae3;};'use strict';var _=require(_0xbabf('0x0'));var MailAccount=require(_0xbabf('0x1'));var Realtime=function(){this[_0xbabf('0x2')]={};};function freeIsNotKey(_0x2045de,_0x4850b8,_0x417eb2){var _0x1c9686=_[_0xbabf('0x3')](_0x2045de,function(_0x2a3fce,_0x390cc3){return _0x2a3fce[_0x417eb2];});for(var _0x6ab122 in _0x4850b8){if(_0x4850b8[_0xbabf('0x4')](_0x6ab122)){if(!_0x1c9686[_0x6ab122]){delete _0x4850b8[_0x6ab122];}}}}Realtime[_0xbabf('0x5')]['mergeFromDatabase']=function(_0x2d2729,_0x297ae0){for(var _0x332d24 in _0x297ae0){if(_0x2d2729['hasOwnProperty'](_0x332d24)){_0x2d2729[_0x332d24]=_0x297ae0[_0x332d24];}}};Realtime[_0xbabf('0x5')][_0xbabf('0x6')]=function(){var _0x32f060=this;return function(_0x16d59f){if(_0x16d59f){freeIsNotKey(_0x16d59f,_0x32f060['mailAccounts'],'id');for(var _0xf1a902=0x0,_0x16fac4={},_0x3d2565={};_0xf1a902<_0x16d59f[_0xbabf('0x7')];_0xf1a902+=0x1){_0x16fac4=_0x16d59f[_0xf1a902];if(_[_0xbabf('0x8')](_0x32f060['mailAccounts'][_0x16fac4['id']])){_0x32f060[_0xbabf('0x2')][_0x16fac4['id']]=new MailAccount(_0x16fac4);}else{_[_0xbabf('0x9')](_0x32f060[_0xbabf('0x2')][_0x16fac4['id']],_0x16fac4);}}}return _0x32f060[_0xbabf('0x2')];};};module[_0xbabf('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index a493961..a9ff774 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 _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 +var _0x1419=['service','type','data5','MailServerOut','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','email','active','TemplateId','MailServerIn','Imap','CloudProvider'];(function(_0x4e90da,_0x15a81f){var _0x5279e4=function(_0x4c0b5a){while(--_0x4c0b5a){_0x4e90da['push'](_0x4e90da['shift']());}};_0x5279e4(++_0x15a81f);}(_0x1419,0x127));var _0x9141=function(_0x5080cb,_0x24f94e){_0x5080cb=_0x5080cb-0x0;var _0x15dbc2=_0x1419[_0x5080cb];return _0x15dbc2;};'use strict';var client=require(_0x9141('0x0'));exports[_0x9141('0x1')]=function(){return function(){return client[_0x9141('0x2')](_0x9141('0x3'),{'options':{'attributes':['id',_0x9141('0x4'),'provider','service',_0x9141('0x5'),_0x9141('0x6'),'key','ListId',_0x9141('0x7')],'raw':![],'include':[{'model':_0x9141('0x8'),'as':_0x9141('0x9'),'include':[{'model':_0x9141('0xa'),'attributes':['id',_0x9141('0x4'),_0x9141('0xb'),_0x9141('0xc'),_0x9141('0xd')],'as':_0x9141('0xa')}]},{'model':_0x9141('0xe'),'as':'Smtp','include':[{'model':_0x9141('0xa'),'attributes':['id',_0x9141('0x4'),_0x9141('0xb'),_0x9141('0xc'),_0x9141('0xd')],'as':_0x9141('0xa')}]}]},'log':_0x9141('0xf')});};};exports[_0x9141('0x10')]=function(_0x4495ad,_0xeea0f5){return client['Request'](_0x9141('0x11'),{'account':{'id':_0x4495ad},'body':_0xeea0f5,'log':_0x9141('0x11')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 69c451b..55c0982 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 _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 +var _0x5007=['GetSettings','../client','getSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x41d548,_0x2804b2){var _0xe4620f=function(_0x2b076e){while(--_0x2b076e){_0x41d548['push'](_0x41d548['shift']());}};_0xe4620f(++_0x2804b2);}(_0x5007,0x15d));var _0x7500=function(_0x404b40,_0x4497da){_0x404b40=_0x404b40-0x0;var _0x178f3c=_0x5007[_0x404b40];return _0x178f3c;};'use strict';var client=require(_0x7500('0x0'));exports[_0x7500('0x1')]=function(){return client[_0x7500('0x2')](_0x7500('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x7500('0x4')]},'log':_0x7500('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 425ce84..046bcc5 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_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 +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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 5437c3a..2c20f6d 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 _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 +var _0x54a8=['websocket','redis','defaults','adapter','socket.io-redis','../../config/triggers','../../config/socketio','default','../../config/express','../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','sticky-session','ioredis','createServer','timeout','listen','port','socket.io'];(function(_0xcafd5b,_0x54669a){var _0x32c389=function(_0x2ac6d4){while(--_0x2ac6d4){_0xcafd5b['push'](_0xcafd5b['shift']());}};_0x32c389(++_0x54669a);}(_0x54a8,0x173));var _0x854a=function(_0x374214,_0x262429){_0x374214=_0x374214-0x0;var _0x402719=_0x54a8[_0x374214];return _0x402719;};'use strict';var _=require('lodash');var http=require('http');var express=require('express');var sticky=require(_0x854a('0x0'));var Redis=require(_0x854a('0x1'));var config=require('../../config/environment');var app=express();var server=http[_0x854a('0x2')](app);server[_0x854a('0x3')]=0xdbba0;if(sticky[_0x854a('0x4')](server,config[_0x854a('0x5')])){var socketio=require(_0x854a('0x6'))(server,{'transports':[_0x854a('0x7'),'polling']});config[_0x854a('0x8')]=_[_0x854a('0x9')](config[_0x854a('0x8')],{'host':'localhost','port':0x18eb});socketio[_0x854a('0xa')](require(_0x854a('0xb'))({'pubClient':new Redis(config[_0x854a('0x8')]),'subClient':new Redis(config[_0x854a('0x8')])}));require(_0x854a('0xc'))['default']();require(_0x854a('0xd'))[_0x854a('0xe')](socketio);require(_0x854a('0xf'))[_0x854a('0xe')](app);require(_0x854a('0x10'))[_0x854a('0xe')](app);}else{server[_0x854a('0x11')]('listening',function(){console[_0x854a('0x12')](_0x854a('0x13'),config['port']);});}exports=module[_0x854a('0x14')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 4893f71..69f8934 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 _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 +var _0x3d2f=['catch','exports','jayson/promise','bluebird','routing','client','http','Request','request','then','debug','rpc','error','message'];(function(_0x1114d6,_0x50f8cd){var _0x28b41d=function(_0x457530){while(--_0x457530){_0x1114d6['push'](_0x1114d6['shift']());}};_0x28b41d(++_0x50f8cd);}(_0x3d2f,0xc6));var _0xf3d2=function(_0x149cf0,_0x55c9a1){_0x149cf0=_0x149cf0-0x0;var _0x350d0d=_0x3d2f[_0x149cf0];return _0x350d0d;};'use strict';var jayson=require(_0xf3d2('0x0'));var BPromise=require(_0xf3d2('0x1'));var logger=require('../../config/logger')(_0xf3d2('0x2'));var client=jayson[_0xf3d2('0x3')][_0xf3d2('0x4')]({'port':0x2329});client[_0xf3d2('0x5')]=function(_0x36bcb6,_0x36fb14){return new BPromise(function(_0x172c0a,_0x2c6b1c){return client[_0xf3d2('0x6')](_0x36bcb6,_0x36fb14)[_0xf3d2('0x7')](function(_0x202cc3){logger[_0xf3d2('0x8')](_0xf3d2('0x9'),_0xf3d2('0x2'),_0x36bcb6,_0x36fb14,_0x202cc3);if(_0x202cc3[_0xf3d2('0xa')]){logger['error'](_0xf3d2('0x9'),'routing',_0x36bcb6,_0x202cc3[_0xf3d2('0xa')][_0xf3d2('0xb')],_0x36fb14);return _0x2c6b1c(_0x202cc3[_0xf3d2('0xa')][_0xf3d2('0xb')]);}else{return _0x172c0a(_0x202cc3['result']);}})[_0xf3d2('0xc')](function(_0x573137){logger[_0xf3d2('0xa')](_0xf3d2('0x9'),_0xf3d2('0x2'),_0x36bcb6,_0x573137,_0x36fb14);return _0x2c6b1c(_0x573137);});});};module[_0xf3d2('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index d123f74..92fb567 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 _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 +var _0x3993=['getChatQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','initFaxQueues','initWhatsappQueues','listen','catch','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/whatsappQueue','resolve','getAgents','then','initAgents','getIntervals','initIntervals'];(function(_0x3eb1ec,_0x3e3684){var _0x331a42=function(_0x2f7f3e){while(--_0x2f7f3e){_0x3eb1ec['push'](_0x3eb1ec['shift']());}};_0x331a42(++_0x3e3684);}(_0x3993,0x72));var _0x3399=function(_0x29df67,_0x723968){_0x29df67=_0x29df67-0x0;var _0x3d18da=_0x3993[_0x29df67];return _0x3d18da;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require('./realtime');var user=require(_0x3399('0x0'));var interval=require(_0x3399('0x1'));var openchannelQueue=require(_0x3399('0x2'));var chatQueue=require(_0x3399('0x3'));var smsQueue=require(_0x3399('0x4'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x3399('0x5'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x3399('0x6')]()['then'](user[_0x3399('0x7')]())[_0x3399('0x8')](realtime[_0x3399('0x9')]())['then'](interval[_0x3399('0xa')]())['then'](realtime[_0x3399('0xb')]())[_0x3399('0x8')](openchannelQueue['getOpenchannelQueues']())['then'](realtime['initOpenchannelQueues']())[_0x3399('0x8')](chatQueue[_0x3399('0xc')]())[_0x3399('0x8')](realtime[_0x3399('0xd')]())[_0x3399('0x8')](smsQueue[_0x3399('0xe')]())['then'](realtime['initSmsQueues']())[_0x3399('0x8')](mailQueue[_0x3399('0xf')]())[_0x3399('0x8')](realtime[_0x3399('0x10')]())[_0x3399('0x8')](faxQueue['getFaxQueues']())[_0x3399('0x8')](realtime[_0x3399('0x11')]())[_0x3399('0x8')](whatsappQueue['getWhatsappQueues']())[_0x3399('0x8')](realtime[_0x3399('0x12')]())[_0x3399('0x8')](function(){return realtime;});}function main(){return server[_0x3399('0x13')](realtime)['then'](function(_0x3eea3a){return initRealtime();})['then'](function(_0x50521d){return setInterval(initRealtime,0x1388);})[_0x3399('0x14')](function(_0x39c44c){console['log'](_0x39c44c);});}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 4bceaf1..153186d 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 _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 +var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x385fd3,_0x3680b6){var _0x27c543=function(_0x3610cc){while(--_0x3610cc){_0x385fd3['push'](_0x385fd3['shift']());}};_0x27c543(++_0x3680b6);}(_0x5fc3,0xa8));var _0x35fc=function(_0x329437,_0x1de73a){_0x329437=_0x329437-0x0;var _0x3789d9=_0x5fc3[_0x329437];return _0x3789d9;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 28b2a95..38581e5 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 _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 +var _0xda05=['error','message','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then'];(function(_0x5027b1,_0x1409a5){var _0x4a46cf=function(_0x121920){while(--_0x121920){_0x5027b1['push'](_0x5027b1['shift']());}};_0x4a46cf(++_0x1409a5);}(_0xda05,0xc0));var _0x5da0=function(_0x27247e,_0x2ef3a1){_0x27247e=_0x27247e-0x0;var _0x16015f=_0xda05[_0x27247e];return _0x16015f;};'use strict';var BPromise=require(_0x5da0('0x0'));var jayson=require(_0x5da0('0x1'));var client=jayson[_0x5da0('0x2')][_0x5da0('0x3')]({'port':0x232b});function request(_0x3a1cff,_0x30d5b6){return new BPromise(function(_0x206692,_0x2ecefd){return client[_0x5da0('0x4')](_0x3a1cff,_0x30d5b6)[_0x5da0('0x5')](function(_0x21f232){if(_0x21f232[_0x5da0('0x6')]){return _0x2ecefd(_0x21f232['error'][_0x5da0('0x7')]);}else{return _0x206692(_0x21f232['result']);}})[_0x5da0('0x8')](function(_0x2be4b9){return _0x2ecefd(_0x2be4b9);});});}exports[_0x5da0('0x9')]=function(_0x10463c,_0x4208f){return request(_0x5da0('0xa'),{'account':_0x10463c,'message':_0x4208f});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 504fd95..d543ec1 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 _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 +var _0x0aee=['whatsappStatusTime','whatsappCapacity','openchannelCapacity','openchannelCurrentCapacity','busy','md5','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','prototype','getChannelStatus','CurrentCapacity','Capacity','working','idle','updateRealtime','mail','chat','openchannel','fax','sms','Status','toNumber','format','online','smsPause','chatCurrentCapacity','faxStatus','faxStatusTime','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','busyQueue','stringify','emit','user:routing:update','exports','lodash','moment','ioredis','defaults','localhost','socket.io-emitter','name','voicePause','faxPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x0aee,0x11e));var _0xe0ae=function(_0x4c2687,_0x5c4f38){_0x4c2687=_0x4c2687-0x0;var _0x132287=_0x0aee[_0x4c2687];return _0x132287;};'use strict';var _=require(_0xe0ae('0x0'));var moment=require(_0xe0ae('0x1'));var md5=require('md5');var Redis=require(_0xe0ae('0x2'));var config=require('../../../config/environment');config['redis']=_[_0xe0ae('0x3')](config['redis'],{'host':_0xe0ae('0x4'),'port':0x18eb});var io=require(_0xe0ae('0x5'))(new Redis(config['redis']));function Agent(_0x2e1592){this['id']=_0x2e1592['id']||0x0;this[_0xe0ae('0x6')]=_0x2e1592['name']||'';this[_0xe0ae('0x7')]=_0x2e1592[_0xe0ae('0x7')]||![];this['chatPause']=_0x2e1592['chatPause']||![];this['mailPause']=_0x2e1592['mailPause']||![];this[_0xe0ae('0x8')]=_0x2e1592[_0xe0ae('0x8')]||![];this['smsPause']=_0x2e1592['smsPause']||![];this['openchannelPause']=_0x2e1592[_0xe0ae('0x9')]||![];this[_0xe0ae('0xa')]=_0xe0ae('0xb');this[_0xe0ae('0xc')]=0x0;this[_0xe0ae('0xd')]=_0x2e1592[_0xe0ae('0xd')]||0x0;this['chatCurrentCapacity']=0x0;this[_0xe0ae('0xe')]='unknown';this[_0xe0ae('0xf')]=0x0;this['mailCapacity']=_0x2e1592[_0xe0ae('0x10')]||0x0;this[_0xe0ae('0x11')]=0x0;this['faxStatus']=_0xe0ae('0xb');this['faxStatusTime']=0x0;this[_0xe0ae('0x12')]=_0x2e1592['faxCapacity']||0x0;this[_0xe0ae('0x13')]=0x0;this['smsStatus']='unknown';this[_0xe0ae('0x14')]=0x0;this[_0xe0ae('0x15')]=_0x2e1592[_0xe0ae('0x15')]||0x0;this[_0xe0ae('0x16')]=0x0;this[_0xe0ae('0x17')]='unknown';this[_0xe0ae('0x18')]=0x0;this[_0xe0ae('0x19')]=_0x2e1592['whatsappCapacity']||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0xe0ae('0xb');this['openchannelStatusTime']=0x0;this[_0xe0ae('0x1a')]=_0x2e1592[_0xe0ae('0x1a')]||0x0;this[_0xe0ae('0x1b')]=0x0;this[_0xe0ae('0x1c')]=![];this['busyQueue']=undefined;this[_0xe0ae('0x1d')]='';this[_0xe0ae('0x1e')]={};this[_0xe0ae('0x1f')]={};this[_0xe0ae('0x20')]={};this[_0xe0ae('0x21')]={};this['smsWaitingInteractions']={};this['whatsappWaitingInteractions']={};this['updateRealtime']();}Agent[_0xe0ae('0x22')][_0xe0ae('0x23')]=function(_0xd1aa31){if(this[_0xd1aa31+_0xe0ae('0x24')]>0x0){if(this[_0xd1aa31+_0xe0ae('0x25')]>0x0&&this[_0xd1aa31+'CurrentCapacity']>=this[_0xd1aa31+'Capacity']){return'maxcapacity';}else{return _0xe0ae('0x26');}}else{return _0xe0ae('0x27');}};Agent[_0xe0ae('0x22')][_0xe0ae('0x28')]=function(){var _0x470a36=[_0xe0ae('0x29'),_0xe0ae('0x2a'),_0xe0ae('0x2b'),_0xe0ae('0x2c'),_0xe0ae('0x2d'),'whatsapp'];for(var _0x37fa72=0x0;_0x37fa72<_0x470a36['length'];_0x37fa72+=0x1){var _0x547e23=this[_0xe0ae('0x23')](_0x470a36[_0x37fa72]);if(this[_0x470a36[_0x37fa72]+_0xe0ae('0x2e')]!==_0x547e23){this[_0x470a36[_0x37fa72]+'StatusTime']=_[_0xe0ae('0x2f')](moment()[_0xe0ae('0x30')]('x'));}this[_0x470a36[_0x37fa72]+_0xe0ae('0x2e')]=_0x547e23;}var _0x38ad89={'id':this['id'],'name':this['name'],'online':this[_0xe0ae('0x31')],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0xe0ae('0x32')],'faxPause':this[_0xe0ae('0x8')],'openchannelPause':this[_0xe0ae('0x9')],'chatStatus':this[_0xe0ae('0xa')],'chatStatusTime':this[_0xe0ae('0xc')],'chatCapacity':this[_0xe0ae('0xd')],'chatCurrentCapacity':this[_0xe0ae('0x33')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0xe0ae('0xf')],'mailCapacity':this[_0xe0ae('0x10')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xe0ae('0x34')],'faxStatusTime':this[_0xe0ae('0x35')],'faxCapacity':this[_0xe0ae('0x12')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xe0ae('0x14')],'smsCapacity':this[_0xe0ae('0x15')],'smsCurrentCapacity':this[_0xe0ae('0x16')],'whatsappStatus':this[_0xe0ae('0x17')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0xe0ae('0x36')],'openchannelStatus':this[_0xe0ae('0x37')],'openchannelStatusTime':this[_0xe0ae('0x38')],'openchannelCapacity':this[_0xe0ae('0x1a')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xe0ae('0x1c')],'busyQueue':this[_0xe0ae('0x39')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0xe0ae('0x1f')],'mailWaitingInteractions':this[_0xe0ae('0x20')],'openchannelWaitingInteractions':this[_0xe0ae('0x21')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x5d6a4b=md5(JSON[_0xe0ae('0x3a')](_0x38ad89));if(this[_0xe0ae('0x1d')]!==_0x5d6a4b){this[_0xe0ae('0x1d')]=_0x5d6a4b;io[_0xe0ae('0x3b')](_0xe0ae('0x3c'),_0x38ad89);}};module[_0xe0ae('0x3d')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 6e4d13f..7373dcc 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 _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 +var _0x4bd4=['chat:queue:%s','chat_queue:save','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','chatPause','paused','available','format'];(function(_0x398294,_0x5ceb9d){var _0x2a872d=function(_0x390883){while(--_0x390883){_0x398294['push'](_0x398294['shift']());}};_0x2a872d(++_0x5ceb9d);}(_0x4bd4,0x1a6));var _0x44bd=function(_0x5ca64c,_0x208e45){_0x5ca64c=_0x5ca64c-0x0;var _0x2f5575=_0x4bd4[_0x5ca64c];return _0x2f5575;};'use strict';var _=require(_0x44bd('0x0'));var md5=require(_0x44bd('0x1'));var util=require('util');var Redis=require(_0x44bd('0x2'));var config=require(_0x44bd('0x3'));config[_0x44bd('0x4')]=_[_0x44bd('0x5')](config['redis'],{'host':_0x44bd('0x6'),'port':0x18eb});var io=require(_0x44bd('0x7'))(new Redis(config['redis']));function ChatQueue(_0xd1b41e){this['id']=_0xd1b41e['id']||0x0;this[_0x44bd('0x8')]=_0xd1b41e[_0x44bd('0x8')]||'';this['timeout']=_0xd1b41e[_0x44bd('0x9')]||0xa;this['strategy']=_0xd1b41e['strategy']||_0x44bd('0xa');this[_0x44bd('0xb')]=_0xd1b41e[_0x44bd('0xb')];this[_0x44bd('0xc')]={};this[_0x44bd('0xd')]=0x0;this[_0x44bd('0x1')]='';this[_0x44bd('0xe')]();this[_0x44bd('0xf')]();}ChatQueue[_0x44bd('0x10')][_0x44bd('0xe')]=function(){var _0x1d6f59=this[_0x44bd('0xc')][_0x44bd('0x11')];this[_0x44bd('0xc')]=_[_0x44bd('0x12')](this[_0x44bd('0xb')],'id');this[_0x44bd('0xc')][_0x44bd('0x11')]=_0x1d6f59;};ChatQueue['prototype'][_0x44bd('0xf')]=function(){this[_0x44bd('0x13')]=0x0;this['paused']=0x0;for(var _0x3862fe=0x0;_0x3862fe=0x0?this[_0x44bd('0x18')]:0x0;var _0x28ed4c={'id':this['id'],'available':this[_0x44bd('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x44bd('0x8')],'paused':this['paused'],'waiting':this[_0x44bd('0xd')]};var _0x2a3790=md5(JSON['stringify'](_0x28ed4c));if(this[_0x44bd('0x1')]!==_0x2a3790){this[_0x44bd('0x1')]=_0x2a3790;io['to'](util[_0x44bd('0x19')](_0x44bd('0x1a'),_0x28ed4c[_0x44bd('0x8')]))['emit'](_0x44bd('0x1b'),_0x28ed4c);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index a2aa1b9..3e6e44c 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 _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 +var _0x3344=['length','faxPause','paused','available','waiting','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn'];(function(_0x5f424f,_0x122b66){var _0x9f4dbd=function(_0x530998){while(--_0x530998){_0x5f424f['push'](_0x5f424f['shift']());}};_0x9f4dbd(++_0x122b66);}(_0x3344,0x1a1));var _0x4334=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3344[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4334('0x0'));var md5=require(_0x4334('0x1'));var util=require(_0x4334('0x2'));var Redis=require('ioredis');var config=require(_0x4334('0x3'));config[_0x4334('0x4')]=_[_0x4334('0x5')](config[_0x4334('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x4334('0x6'))(new Redis(config['redis']));function FaxQueue(_0x324b14){this['id']=_0x324b14['id']||0x0;this[_0x4334('0x7')]=_0x324b14[_0x4334('0x7')]||'';this[_0x4334('0x8')]=_0x324b14['timeout']||0xa;this[_0x4334('0x9')]=_0x324b14[_0x4334('0x9')]||'beepall';this[_0x4334('0xa')]=_0x324b14[_0x4334('0xa')];this[_0x4334('0xb')]={};this['waiting']=0x0;this[_0x4334('0x1')]='';this[_0x4334('0xc')]();this[_0x4334('0xd')]();}FaxQueue[_0x4334('0xe')][_0x4334('0xc')]=function(){var _0x2604e8=this['mapAgentsId'][_0x4334('0xf')];this[_0x4334('0xb')]=_[_0x4334('0x10')](this[_0x4334('0xa')],'id');this[_0x4334('0xb')][_0x4334('0xf')]=_0x2604e8;};FaxQueue['prototype'][_0x4334('0xd')]=function(){this[_0x4334('0x11')]=0x0;this['paused']=0x0;for(var _0x20b106=0x0;_0x20b106=0x0?this[_0x4334('0x15')]:0x0;var _0x5400ef={'id':this['id'],'available':this[_0x4334('0x15')],'loggedIn':this[_0x4334('0x11')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x4334('0x16')]};var _0x5df213=md5(JSON[_0x4334('0x17')](_0x5400ef));if(this[_0x4334('0x1')]!==_0x5df213){this[_0x4334('0x1')]=_0x5df213;io['to'](util[_0x4334('0x18')](_0x4334('0x19'),_0x5400ef[_0x4334('0x7')]))[_0x4334('0x1a')](_0x4334('0x1b'),_0x5400ef);}};module[_0x4334('0x1c')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 28dea9a..0620044 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 _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 +var _0xa1de=['name','Intervals','exports'];(function(_0x1778e1,_0x3e1727){var _0x2bc4c6=function(_0x359c65){while(--_0x359c65){_0x1778e1['push'](_0x1778e1['shift']());}};_0x2bc4c6(++_0x3e1727);}(_0xa1de,0xae));var _0xea1d=function(_0x5cb5fc,_0x6cdda3){_0x5cb5fc=_0x5cb5fc-0x0;var _0x4b6fab=_0xa1de[_0x5cb5fc];return _0x4b6fab;};'use strict';function Interval(_0x5ab3cb){this['id']=_0x5ab3cb['id']||0x0;this['name']=_0x5ab3cb[_0xea1d('0x0')]||'';this[_0xea1d('0x1')]=_0x5ab3cb[_0xea1d('0x1')]||{};}module[_0xea1d('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 616413e..f6cbb79 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 _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 +var _0x7dd0=['ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','map','loggedIn','length','online','paused','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util'];(function(_0x519ce2,_0x32362a){var _0x1a5464=function(_0x52492b){while(--_0x52492b){_0x519ce2['push'](_0x519ce2['shift']());}};_0x1a5464(++_0x32362a);}(_0x7dd0,0x79));var _0x07dd=function(_0x1ff340,_0x43e3e1){_0x1ff340=_0x1ff340-0x0;var _0x1be5ce=_0x7dd0[_0x1ff340];return _0x1be5ce;};'use strict';var _=require(_0x07dd('0x0'));var md5=require(_0x07dd('0x1'));var util=require(_0x07dd('0x2'));var Redis=require(_0x07dd('0x3'));var config=require(_0x07dd('0x4'));config[_0x07dd('0x5')]=_[_0x07dd('0x6')](config[_0x07dd('0x5')],{'host':_0x07dd('0x7'),'port':0x18eb});var io=require(_0x07dd('0x8'))(new Redis(config[_0x07dd('0x5')]));function MailQueue(_0x184655){this['id']=_0x184655['id']||0x0;this[_0x07dd('0x9')]=_0x184655[_0x07dd('0x9')]||'';this[_0x07dd('0xa')]=_0x184655[_0x07dd('0xa')]||0xa;this['strategy']=_0x184655[_0x07dd('0xb')]||_0x07dd('0xc');this[_0x07dd('0xd')]=_0x184655[_0x07dd('0xd')];this[_0x07dd('0xe')]={};this[_0x07dd('0xf')]=0x0;this['md5']='';this['updateRouting']();this[_0x07dd('0x10')]();}MailQueue[_0x07dd('0x11')]['updateRouting']=function(){var _0x55475c=this[_0x07dd('0xe')][_0x07dd('0x12')];this['mapAgentsId']=_[_0x07dd('0x13')](this[_0x07dd('0xd')],'id');this[_0x07dd('0xe')][_0x07dd('0x12')]=_0x55475c;};MailQueue[_0x07dd('0x11')]['updateRealtime']=function(){this[_0x07dd('0x14')]=0x0;this['paused']=0x0;for(var _0x12a7a0=0x0;_0x12a7a0=0x0?this[_0x07dd('0x18')]:0x0;var _0x2cf4e7={'id':this['id'],'available':this['available'],'loggedIn':this[_0x07dd('0x14')],'name':this[_0x07dd('0x9')],'paused':this['paused'],'waiting':this[_0x07dd('0xf')]};var _0x23f724=md5(JSON[_0x07dd('0x19')](_0x2cf4e7));if(this[_0x07dd('0x1')]!==_0x23f724){this[_0x07dd('0x1')]=_0x23f724;io['to'](util[_0x07dd('0x1a')](_0x07dd('0x1b'),_0x2cf4e7['name']))[_0x07dd('0x1c')](_0x07dd('0x1d'),_0x2cf4e7);}};module[_0x07dd('0x1e')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 5c20989..4c52b6b 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 _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 +var _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0x2ef3,0xba));var _0x32ef=function(_0x1ee9eb,_0x549c99){_0x1ee9eb=_0x1ee9eb-0x0;var _0x20a371=_0x2ef3[_0x1ee9eb];return _0x20a371;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 7c46780..84c4541 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 _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 +var _0xdace=['sms_queue:save','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','length','online','available','stringify','md5','format','sms:queue:%s','emit'];(function(_0x2de0a7,_0x38d3e7){var _0x429437=function(_0x23c148){while(--_0x23c148){_0x2de0a7['push'](_0x2de0a7['shift']());}};_0x429437(++_0x38d3e7);}(_0xdace,0xc5));var _0xedac=function(_0xfb0cfd,_0x500179){_0xfb0cfd=_0xfb0cfd-0x0;var _0x2fd8aa=_0xdace[_0xfb0cfd];return _0x2fd8aa;};'use strict';var _=require(_0xedac('0x0'));var md5=require('md5');var util=require(_0xedac('0x1'));var Redis=require(_0xedac('0x2'));var config=require(_0xedac('0x3'));config['redis']=_[_0xedac('0x4')](config[_0xedac('0x5')],{'host':_0xedac('0x6'),'port':0x18eb});var io=require(_0xedac('0x7'))(new Redis(config['redis']));function SmsQueue(_0x32b066){this['id']=_0x32b066['id']||0x0;this[_0xedac('0x8')]=_0x32b066[_0xedac('0x8')]||'';this['timeout']=_0x32b066[_0xedac('0x9')]||0xa;this[_0xedac('0xa')]=_0x32b066[_0xedac('0xa')]||'beepall';this[_0xedac('0xb')]=_0x32b066[_0xedac('0xb')];this[_0xedac('0xc')]={};this['waiting']=0x0;this['md5']='';this[_0xedac('0xd')]();this[_0xedac('0xe')]();}SmsQueue['prototype']['updateRouting']=function(){var _0x4db2ad=this[_0xedac('0xc')]['_rr'];this[_0xedac('0xc')]=_['map'](this[_0xedac('0xb')],'id');this[_0xedac('0xc')][_0xedac('0xf')]=_0x4db2ad;};SmsQueue[_0xedac('0x10')][_0xedac('0xe')]=function(){this[_0xedac('0x11')]=0x0;this[_0xedac('0x12')]=0x0;for(var _0x11f0b0=0x0;_0x11f0b0=0x0?this['available']:0x0;var _0x4b2563={'id':this['id'],'available':this[_0xedac('0x15')],'loggedIn':this[_0xedac('0x11')],'name':this[_0xedac('0x8')],'paused':this[_0xedac('0x12')],'waiting':this['waiting']};var _0x4a699b=md5(JSON[_0xedac('0x16')](_0x4b2563));if(this[_0xedac('0x17')]!==_0x4a699b){this[_0xedac('0x17')]=_0x4a699b;io['to'](util[_0xedac('0x18')](_0xedac('0x19'),_0x4b2563[_0xedac('0x8')]))[_0xedac('0x1a')](_0xedac('0x1b'),_0x4b2563);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 74d6218..c47a74a 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 _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 +var _0xd4a7=['whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','whatsappPause','available','waiting','stringify'];(function(_0x266a33,_0x579047){var _0xd679ce=function(_0x54b45b){while(--_0x54b45b){_0x266a33['push'](_0x266a33['shift']());}};_0xd679ce(++_0x579047);}(_0xd4a7,0x164));var _0x7d4a=function(_0x427f07,_0x129488){_0x427f07=_0x427f07-0x0;var _0x407c21=_0xd4a7[_0x427f07];return _0x407c21;};'use strict';var _=require(_0x7d4a('0x0'));var md5=require(_0x7d4a('0x1'));var util=require(_0x7d4a('0x2'));var Redis=require(_0x7d4a('0x3'));var config=require(_0x7d4a('0x4'));config[_0x7d4a('0x5')]=_[_0x7d4a('0x6')](config[_0x7d4a('0x5')],{'host':_0x7d4a('0x7'),'port':0x18eb});var io=require(_0x7d4a('0x8'))(new Redis(config[_0x7d4a('0x5')]));function WhatsappQueue(_0x3543a8){this['id']=_0x3543a8['id']||0x0;this[_0x7d4a('0x9')]=_0x3543a8['name']||'';this[_0x7d4a('0xa')]=_0x3543a8[_0x7d4a('0xa')]||0xa;this[_0x7d4a('0xb')]=_0x3543a8['strategy']||_0x7d4a('0xc');this['Agents']=_0x3543a8[_0x7d4a('0xd')];this[_0x7d4a('0xe')]={};this['waiting']=0x0;this[_0x7d4a('0x1')]='';this[_0x7d4a('0xf')]();this[_0x7d4a('0x10')]();}WhatsappQueue[_0x7d4a('0x11')][_0x7d4a('0xf')]=function(){var _0x463ba2=this[_0x7d4a('0xe')][_0x7d4a('0x12')];this[_0x7d4a('0xe')]=_[_0x7d4a('0x13')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x463ba2;};WhatsappQueue['prototype'][_0x7d4a('0x10')]=function(){this[_0x7d4a('0x14')]=0x0;this[_0x7d4a('0x15')]=0x0;for(var _0x1051fc=0x0;_0x1051fc=0x0?this[_0x7d4a('0x19')]:0x0;var _0x180017={'id':this['id'],'available':this[_0x7d4a('0x19')],'loggedIn':this[_0x7d4a('0x14')],'name':this['name'],'paused':this[_0x7d4a('0x15')],'waiting':this[_0x7d4a('0x1a')]};var _0x4ea1b6=md5(JSON[_0x7d4a('0x1b')](_0x180017));if(this['md5']!==_0x4ea1b6){this[_0x7d4a('0x1')]=_0x4ea1b6;io['to'](util['format'](_0x7d4a('0x1c'),_0x180017['name']))[_0x7d4a('0x1d')](_0x7d4a('0x1e'),_0x180017);}};module[_0x7d4a('0x1f')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 3182ac1..2d371e0 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_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 +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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 3ae85ec..0ddb6c4 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 _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 +var _0x76d5=['UpdateChatInteraction','updateChatInteraction','addTags','addTagsToChatInteraction','update','Request'];(function(_0xdee740,_0x40916d){var _0x5bc51f=function(_0x573331){while(--_0x573331){_0xdee740['push'](_0xdee740['shift']());}};_0x5bc51f(++_0x40916d);}(_0x76d5,0x70));var _0x576d=function(_0x3c1e9e,_0x43fd56){_0x3c1e9e=_0x3c1e9e-0x0;var _0x53bac3=_0x76d5[_0x3c1e9e];return _0x53bac3;};'use strict';var client=require('../client');exports[_0x576d('0x0')]=function(_0x3ed882,_0x1332ca){return client[_0x576d('0x1')](_0x576d('0x2'),{'body':_0x1332ca,'options':{'where':{'id':_0x3ed882}},'log':_0x576d('0x3')});};exports[_0x576d('0x4')]=function(_0x65da34,_0x1a2e6d){return client[_0x576d('0x1')]('AddTagsToChatInteraction',{'body':_0x1a2e6d,'options':{'where':{'id':_0x65da34}},'log':_0x576d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 734e651..71f9fca 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 _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 +var _0xeb82=['CreateChatMessage','../client','Request'];(function(_0x4835b2,_0x3c93da){var _0x57d8a4=function(_0x4a5c0f){while(--_0x4a5c0f){_0x4835b2['push'](_0x4835b2['shift']());}};_0x57d8a4(++_0x3c93da);}(_0xeb82,0x1c9));var _0x2eb8=function(_0x359ea9,_0x405aeb){_0x359ea9=_0x359ea9-0x0;var _0x36ae73=_0xeb82[_0x359ea9];return _0x36ae73;};'use strict';var client=require(_0x2eb8('0x0'));exports['create']=function(_0x4b98ac){return client[_0x2eb8('0x1')](_0x2eb8('0x2'),{'body':_0x4b98ac,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 2a3373a..acf0490 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 _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 +var _0x861a=['User','online','chatPause','getChatQueues','../client','Request','GetChatQueue','name','timeout','strategy'];(function(_0x32b122,_0x1ad490){var _0x4ad25a=function(_0x590ee6){while(--_0x590ee6){_0x32b122['push'](_0x32b122['shift']());}};_0x4ad25a(++_0x1ad490);}(_0x861a,0x194));var _0xa861=function(_0x3f8f89,_0x4226e3){_0x3f8f89=_0x3f8f89-0x0;var _0x4d8adf=_0x861a[_0x3f8f89];return _0x4d8adf;};'use strict';var client=require(_0xa861('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xa861('0x1')](_0xa861('0x2'),{'options':{'raw':![],'attributes':['id',_0xa861('0x3'),_0xa861('0x4'),_0xa861('0x5')],'include':[{'model':_0xa861('0x6'),'as':'Agents','attributes':['id',_0xa861('0x3'),_0xa861('0x7'),_0xa861('0x8')]}]},'log':_0xa861('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index c03930d..bb2f04d 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 _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 +var _0x7217=['update','Request','UpdateChatQueueReport','DESC','CreateChatQueueReport'];(function(_0x336cda,_0x3a7718){var _0x190b40=function(_0x2a0b94){while(--_0x2a0b94){_0x336cda['push'](_0x336cda['shift']());}};_0x190b40(++_0x3a7718);}(_0x7217,0xa9));var _0x7721=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x7217[_0x2763f2];return _0x3ef471;};'use strict';var client=require('../client');exports['create']=function(_0x3f36a3){return client['Request'](_0x7721('0x0'),{'body':_0x3f36a3,'log':_0x7721('0x0')});};exports[_0x7721('0x1')]=function(_0x18353b,_0x363be8){return client[_0x7721('0x2')](_0x7721('0x3'),{'body':_0x363be8,'options':{'where':{'uniqueid':_0x18353b},'order':[['id',_0x7721('0x4')]],'limit':0x1},'log':_0x7721('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 0d330ab..926eb37 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(_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 +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x5a99db,_0x1cece5){var _0x3aad62=function(_0x334cb7){while(--_0x334cb7){_0x5a99db['push'](_0x5a99db['shift']());}};_0x3aad62(++_0x1cece5);}(_0x7a54,0x106));var _0x47a5=function(_0x1c7c55,_0x4537ba){_0x1c7c55=_0x1c7c55-0x0;var _0x39b400=_0x7a54[_0x1c7c55];return _0x39b400;};'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 53e55ba..7c610e4 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 _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 +var _0xf878=['createFaxMessage','../client','Request','CreateFaxMessage'];(function(_0x116e47,_0x2ee4d4){var _0xfcfb2a=function(_0x3f4a41){while(--_0x3f4a41){_0x116e47['push'](_0x116e47['shift']());}};_0xfcfb2a(++_0x2ee4d4);}(_0xf878,0x75));var _0x8f87=function(_0x1d1219,_0x51cfd2){_0x1d1219=_0x1d1219-0x0;var _0x31373a=_0xf878[_0x1d1219];return _0x31373a;};'use strict';var client=require(_0x8f87('0x0'));exports['create']=function(_0x106c4c){return client[_0x8f87('0x1')](_0x8f87('0x2'),{'body':_0x106c4c,'log':_0x8f87('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 4a45b47..5f62108 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 _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 +var _0x1095=['User','Agents','faxPause','../client','getFaxQueues','Request','GetFaxQueue','timeout','strategy'];(function(_0x14ac39,_0x46a70f){var _0x149e0f=function(_0x1991f5){while(--_0x1991f5){_0x14ac39['push'](_0x14ac39['shift']());}};_0x149e0f(++_0x46a70f);}(_0x1095,0x1ce));var _0x5109=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x1095[_0x4baae2];return _0x1a2285;};'use strict';var client=require(_0x5109('0x0'));exports[_0x5109('0x1')]=function(){return function(){return client[_0x5109('0x2')](_0x5109('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x5109('0x4'),_0x5109('0x5')],'include':[{'model':_0x5109('0x6'),'as':_0x5109('0x7'),'attributes':['id','name','online',_0x5109('0x8')]}]},'log':_0x5109('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 501c16f..2c5c5e1 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 _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 +var _0xa1b4=['../client','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC'];(function(_0x5a215c,_0xaa3f6c){var _0x1b623e=function(_0x44dede){while(--_0x44dede){_0x5a215c['push'](_0x5a215c['shift']());}};_0x1b623e(++_0xaa3f6c);}(_0xa1b4,0x12c));var _0x4a1b=function(_0x45b1ba,_0x5a6a21){_0x45b1ba=_0x45b1ba-0x0;var _0x145ddb=_0xa1b4[_0x45b1ba];return _0x145ddb;};'use strict';var client=require(_0x4a1b('0x0'));exports['create']=function(_0x20b088){return client[_0x4a1b('0x1')](_0x4a1b('0x2'),{'body':_0x20b088,'log':_0x4a1b('0x2')});};exports[_0x4a1b('0x3')]=function(_0x34a075,_0x421757){return client[_0x4a1b('0x1')](_0x4a1b('0x4'),{'body':_0x421757,'options':{'where':{'uniqueid':_0x34a075},'order':[['id',_0x4a1b('0x5')]],'limit':0x1},'log':_0x4a1b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 57b8f49..c86be89 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 _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 +var _0xbb86=['Intervals','name','getIntervals','GetInterval','Interval'];(function(_0x4d6f5c,_0x4ca170){var _0x155796=function(_0x21857a){while(--_0x21857a){_0x4d6f5c['push'](_0x4d6f5c['shift']());}};_0x155796(++_0x4ca170);}(_0xbb86,0xe3));var _0x6bb8=function(_0x5cfbd1,_0x2a5877){_0x5cfbd1=_0x5cfbd1-0x0;var _0x206ad5=_0xbb86[_0x5cfbd1];return _0x206ad5;};'use strict';var client=require('../client');exports[_0x6bb8('0x0')]=function(){return function(){return client['Request'](_0x6bb8('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x6bb8('0x2'),'as':_0x6bb8('0x3'),'attributes':['id',_0x6bb8('0x4'),'interval']}]},'log':_0x6bb8('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index ee96c6c..ea07b45 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 _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 +var _0x8603=['update','updateMailInteraction','addTags','Request','addTagsToChatInteraction'];(function(_0x217136,_0x4994f4){var _0xe5e18e=function(_0x2060c3){while(--_0x2060c3){_0x217136['push'](_0x217136['shift']());}};_0xe5e18e(++_0x4994f4);}(_0x8603,0x190));var _0x3860=function(_0x1fec86,_0x422ed7){_0x1fec86=_0x1fec86-0x0;var _0x55e897=_0x8603[_0x1fec86];return _0x55e897;};'use strict';var client=require('../client');exports[_0x3860('0x0')]=function(_0x3b9c54,_0x96d2bc){return client['Request']('UpdateMailInteraction',{'body':_0x96d2bc,'options':{'where':{'id':_0x3b9c54}},'log':_0x3860('0x1')});};exports[_0x3860('0x2')]=function(_0x2f56a3,_0x490262){return client[_0x3860('0x3')]('AddTagsToMailInteraction',{'body':_0x490262,'options':{'where':{'id':_0x2f56a3}},'log':_0x3860('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index f69070e..b2ef2ab 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 _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 +var _0xe4d9=['CreateMailMessage','createMailMessage','../client','create','Request'];(function(_0x90f34f,_0x404021){var _0x4b18cf=function(_0x25112d){while(--_0x25112d){_0x90f34f['push'](_0x90f34f['shift']());}};_0x4b18cf(++_0x404021);}(_0xe4d9,0x1dd));var _0x9e4d=function(_0x107361,_0xb5fe90){_0x107361=_0x107361-0x0;var _0x379631=_0xe4d9[_0x107361];return _0x379631;};'use strict';var client=require(_0x9e4d('0x0'));exports[_0x9e4d('0x1')]=function(_0x10649f){return client[_0x9e4d('0x2')](_0x9e4d('0x3'),{'body':_0x10649f,'log':_0x9e4d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index d5c2fba..b70b0b3 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 _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 +var _0x49b2=['name','timeout','strategy','User','Agents','getMailQueues','../client','Request','GetMailQueue'];(function(_0x271cb1,_0x32186d){var _0x52d703=function(_0x5c6b4d){while(--_0x5c6b4d){_0x271cb1['push'](_0x271cb1['shift']());}};_0x52d703(++_0x32186d);}(_0x49b2,0x14a));var _0x249b=function(_0x2fa010,_0x3ed775){_0x2fa010=_0x2fa010-0x0;var _0xc0ce1b=_0x49b2[_0x2fa010];return _0xc0ce1b;};'use strict';var client=require(_0x249b('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x249b('0x1')](_0x249b('0x2'),{'options':{'raw':![],'attributes':['id',_0x249b('0x3'),_0x249b('0x4'),_0x249b('0x5')],'include':[{'model':_0x249b('0x6'),'as':_0x249b('0x7'),'attributes':['id','name','online','mailPause']}]},'log':_0x249b('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 9ad0e51..66254b9 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 _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 +var _0xdf5b=['CreateMailQueueReport','update','UpdateMailQueueReport','DESC','Request'];(function(_0x4dc7f5,_0x312c14){var _0x3e37db=function(_0x820d0e){while(--_0x820d0e){_0x4dc7f5['push'](_0x4dc7f5['shift']());}};_0x3e37db(++_0x312c14);}(_0xdf5b,0x12b));var _0xbdf5=function(_0x2ff1ba,_0x279ef8){_0x2ff1ba=_0x2ff1ba-0x0;var _0x510a2e=_0xdf5b[_0x2ff1ba];return _0x510a2e;};'use strict';var client=require('../client');exports['create']=function(_0x28ffd1){return client[_0xbdf5('0x0')](_0xbdf5('0x1'),{'body':_0x28ffd1,'log':_0xbdf5('0x1')});};exports[_0xbdf5('0x2')]=function(_0x4ab34e,_0x3fafff){return client['Request'](_0xbdf5('0x3'),{'body':_0x3fafff,'options':{'where':{'uniqueid':_0x4ab34e},'order':[['id',_0xbdf5('0x4')]],'limit':0x1},'log':_0xbdf5('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 1cf51eb..12c096a 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 _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 +var _0x63f2=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update'];(function(_0x576d8a,_0x2d7bde){var _0x3dc3ef=function(_0xc76758){while(--_0xc76758){_0x576d8a['push'](_0x576d8a['shift']());}};_0x3dc3ef(++_0x2d7bde);}(_0x63f2,0x17e));var _0x263f=function(_0x4253cc,_0x258e6f){_0x4253cc=_0x4253cc-0x0;var _0x18451f=_0x63f2[_0x4253cc];return _0x18451f;};'use strict';var client=require(_0x263f('0x0'));exports[_0x263f('0x1')]=function(_0x1b97cb,_0x237b35){return client[_0x263f('0x2')](_0x263f('0x3'),{'body':_0x237b35,'options':{'where':{'id':_0x1b97cb}},'log':_0x263f('0x4')});};exports[_0x263f('0x5')]=function(_0x23dc78,_0x119215){return client[_0x263f('0x2')](_0x263f('0x6'),{'body':_0x119215,'options':{'where':{'id':_0x23dc78}},'log':_0x263f('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index dd78b2f..80e7031 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 _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 +var _0x84fc=['create','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x172533,_0x314805){var _0x43238a=function(_0x3e3f1d){while(--_0x3e3f1d){_0x172533['push'](_0x172533['shift']());}};_0x43238a(++_0x314805);}(_0x84fc,0x15f));var _0xc84f=function(_0x5d3394,_0x5e5dce){_0x5d3394=_0x5d3394-0x0;var _0x102ca5=_0x84fc[_0x5d3394];return _0x102ca5;};'use strict';var client=require(_0xc84f('0x0'));exports[_0xc84f('0x1')]=function(_0x941111){return client['Request'](_0xc84f('0x2'),{'body':_0x941111,'log':_0xc84f('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index fbbc74a..b3e4f0a 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 _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 +var _0x2f92=['User','online','openchannelPause','getOpenchannelQueues','Request','name'];(function(_0x931cca,_0x4497e4){var _0x31bcc6=function(_0x33308f){while(--_0x33308f){_0x931cca['push'](_0x931cca['shift']());}};_0x31bcc6(++_0x4497e4);}(_0x2f92,0x1d1));var _0x22f9=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x2f92[_0x297fd3];return _0x2af381;};'use strict';var client=require('../client');exports[_0x22f9('0x0')]=function(){return function(){return client[_0x22f9('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x22f9('0x2'),'timeout','strategy'],'include':[{'model':_0x22f9('0x3'),'as':'Agents','attributes':['id',_0x22f9('0x2'),_0x22f9('0x4'),_0x22f9('0x5')]}]},'log':_0x22f9('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 25e3625..9a24606 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 _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 +var _0x0cee=['CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC','../client','create','Request'];(function(_0x3383d9,_0x8b44a1){var _0x176b7c=function(_0x429c0c){while(--_0x429c0c){_0x3383d9['push'](_0x3383d9['shift']());}};_0x176b7c(++_0x8b44a1);}(_0x0cee,0x12f));var _0xe0ce=function(_0x280760,_0x68a129){_0x280760=_0x280760-0x0;var _0x19116b=_0x0cee[_0x280760];return _0x19116b;};'use strict';var client=require(_0xe0ce('0x0'));exports[_0xe0ce('0x1')]=function(_0x3e5499){return client[_0xe0ce('0x2')](_0xe0ce('0x3'),{'body':_0x3e5499,'log':_0xe0ce('0x3')});};exports['update']=function(_0x563553,_0xe181aa){return client[_0xe0ce('0x2')](_0xe0ce('0x4'),{'body':_0xe181aa,'options':{'where':{'uniqueid':_0x563553},'order':[['id',_0xe0ce('0x5')]],'limit':0x1},'log':_0xe0ce('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 5ea941d..99b0f9d 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 _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 +var _0x7250=['addTags','../client','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x5e8eae,_0x4f81e0){var _0xdd09cd=function(_0x28c85c){while(--_0x28c85c){_0x5e8eae['push'](_0x5e8eae['shift']());}};_0xdd09cd(++_0x4f81e0);}(_0x7250,0x1b1));var _0x0725=function(_0x44e9ea,_0x325f33){_0x44e9ea=_0x44e9ea-0x0;var _0x5c2c5d=_0x7250[_0x44e9ea];return _0x5c2c5d;};'use strict';var client=require(_0x0725('0x0'));exports[_0x0725('0x1')]=function(_0x56da03,_0x3ecf7f){return client[_0x0725('0x2')](_0x0725('0x3'),{'body':_0x3ecf7f,'options':{'where':{'id':_0x56da03}},'log':_0x0725('0x4')});};exports[_0x0725('0x5')]=function(_0x4724ef,_0x53cc59){return client[_0x0725('0x2')]('AddTagsToSmsInteraction',{'body':_0x53cc59,'options':{'where':{'id':_0x4724ef}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 5d53ef7..8ca7bd6 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 _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 +var _0x20c4=['Request','createSmsMessage','../client','create'];(function(_0x209e15,_0x90ee17){var _0x4a9c8a=function(_0x1dd9b1){while(--_0x1dd9b1){_0x209e15['push'](_0x209e15['shift']());}};_0x4a9c8a(++_0x90ee17);}(_0x20c4,0x14a));var _0x420c=function(_0x1b63ae,_0xea3e82){_0x1b63ae=_0x1b63ae-0x0;var _0x1b6035=_0x20c4[_0x1b63ae];return _0x1b6035;};'use strict';var client=require(_0x420c('0x0'));exports[_0x420c('0x1')]=function(_0xf8c908){return client[_0x420c('0x2')]('CreateSmsMessage',{'body':_0xf8c908,'log':_0x420c('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index e8b73e3..a1ca002 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_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 +var _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0xffff0e,_0x32b4de){var _0x53a360=function(_0x5923bb){while(--_0x5923bb){_0xffff0e['push'](_0xffff0e['shift']());}};_0x53a360(++_0x32b4de);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0xcb91[_0x4a7631];return _0x1a5a6f;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 7e2b0f0..b775203 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_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 +var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x10e983,_0x2f4eda){var _0x324138=function(_0x17a377){while(--_0x17a377){_0x10e983['push'](_0x10e983['shift']());}};_0x324138(++_0x2f4eda);}(_0xedd9,0xfc));var _0x9edd=function(_0x334a3b,_0x325689){_0x334a3b=_0x334a3b-0x0;var _0xe59b1e=_0xedd9[_0x334a3b];return _0xe59b1e;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 5f78e1d..a2315f3 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(_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 +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x515989,_0x20c7db){var _0x277629=function(_0x12ea58){while(--_0x12ea58){_0x515989['push'](_0x515989['shift']());}};_0x277629(++_0x20c7db);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 545289a..d5d12d4 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 _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 +var _0x938d=['../client','update','Request','UpdateWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x56342c,_0x4bcd71){var _0x15da84=function(_0x58e74a){while(--_0x58e74a){_0x56342c['push'](_0x56342c['shift']());}};_0x15da84(++_0x4bcd71);}(_0x938d,0x122));var _0xd938=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x938d[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xd938('0x0'));exports[_0xd938('0x1')]=function(_0x4fb46a,_0x3c6634){return client[_0xd938('0x2')](_0xd938('0x3'),{'body':_0x3c6634,'options':{'where':{'id':_0x4fb46a}},'log':'updateWhatsappInteraction'});};exports['addTags']=function(_0xc9f24b,_0x429911){return client[_0xd938('0x2')]('AddTagsToWhatsappInteraction',{'body':_0x429911,'options':{'where':{'id':_0xc9f24b}},'log':_0xd938('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 5133fa5..681bf1d 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 _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 +var _0x818b=['Request','CreateWhatsappMessage','../client','create'];(function(_0x5cba6b,_0x5f42ef){var _0x3c69fc=function(_0x417b21){while(--_0x417b21){_0x5cba6b['push'](_0x5cba6b['shift']());}};_0x3c69fc(++_0x5f42ef);}(_0x818b,0x112));var _0xb818=function(_0x1cd5e9,_0x151862){_0x1cd5e9=_0x1cd5e9-0x0;var _0x1d488b=_0x818b[_0x1cd5e9];return _0x1d488b;};'use strict';var client=require(_0xb818('0x0'));exports[_0xb818('0x1')]=function(_0x565c61){return client[_0xb818('0x2')](_0xb818('0x3'),{'body':_0x565c61,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index bb73dca..cd83296 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 _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 +var _0xae89=['timeout','strategy','User','Agents','online','whatsappPause','GetWhatsappQueue','name'];(function(_0x221e5e,_0x3b5ff5){var _0x1f45c3=function(_0x138ad4){while(--_0x138ad4){_0x221e5e['push'](_0x221e5e['shift']());}};_0x1f45c3(++_0x3b5ff5);}(_0xae89,0x66));var _0x9ae8=function(_0x749c48,_0x336468){_0x749c48=_0x749c48-0x0;var _0x2f419c=_0xae89[_0x749c48];return _0x2f419c;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0x9ae8('0x0'),{'options':{'raw':![],'attributes':['id',_0x9ae8('0x1'),_0x9ae8('0x2'),_0x9ae8('0x3')],'include':[{'model':_0x9ae8('0x4'),'as':_0x9ae8('0x5'),'attributes':['id',_0x9ae8('0x1'),_0x9ae8('0x6'),_0x9ae8('0x7')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index ff1c6fa..faad9f5 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 _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 +var _0xff23=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff23,0x155));var _0x3ff2=function(_0x4a7fc0,_0x4312ae){_0x4a7fc0=_0x4a7fc0-0x0;var _0x2b0a75=_0xff23[_0x4a7fc0];return _0x2b0a75;};'use strict';var client=require('../client');exports[_0x3ff2('0x0')]=function(_0x1ac347){return client[_0x3ff2('0x1')](_0x3ff2('0x2'),{'body':_0x1ac347,'log':'CreateWhatsappQueueReport'});};exports[_0x3ff2('0x3')]=function(_0x121c0d,_0x3f2980){return client['Request'](_0x3ff2('0x4'),{'body':_0x3f2980,'options':{'where':{'uniqueid':_0x121c0d},'order':[['id',_0x3ff2('0x5')]],'limit':0x1},'log':_0x3ff2('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index f8b1a42..e6ceb6f 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 _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 +var _0x6749=['START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','close','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','util','seq-queue','../../../../config/logger','routing','./strategy','string','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','map','message','stop','find','name','atimeout','channel'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x6749,0x1af));var _0x9674=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6749[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x9674('0x0'));var seqqueue=require(_0x9674('0x1'));var logger=require(_0x9674('0x2'))(_0x9674('0x3'));var strategy=require(_0x9674('0x4'));var queue=schema({'name':{'type':_0x9674('0x5'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x9674('0x6'),'message':_0x9674('0x7')}});function writeLog(_0x437441,_0x32ebb9,_0x1d02dc){return logger[_0x9674('0x8')](util[_0x9674('0x9')](_0x9674('0xa'),_0x437441,_0x32ebb9['name'],_0x1d02dc));}function handleFindAgent(_0x57e093){return function(_0xcc9e86){return _0xcc9e86['name'][_0x9674('0xb')]()===_0x57e093['toLowerCase']();};}exports[_0x9674('0xc')]=function(_0x1fc1dc,_0x2e0ce1,_0x530941,_0x3d3170){return function(_0x171590){try{var _0x40d7c6={'name':_0x2e0ce1[0x0],'timeout':_0x2e0ce1[0x1]};var _0x18b11c=queue[_0x9674('0xd')](_0x40d7c6,{'typecast':!![]});if(_0x18b11c[_0x9674('0xe')]){logger[_0x9674('0xf')](_0x9674('0x10'),_0x1fc1dc,_[_0x9674('0x11')](_0x18b11c,_0x9674('0x12'))['join'](',\x20'));_0x171590[_0x9674('0x13')]();}else{var _0x9f4cc2=_[_0x9674('0x14')](_0x530941['agents'],handleFindAgent(_0x40d7c6[_0x9674('0x15')]));if(_0x9f4cc2){var _0x2e369f=(_0x40d7c6['timeout']||0xa)*0x3e8;var _0x5bb7a0,_0x589c7e;var _0x3df40d=seqqueue['createQueue'](_0x2e369f);_0x3df40d['id']=_0x1fc1dc;_0x3df40d[_0x9674('0x16')]=_0x2e369f;_0x3df40d['channel']=_0x3d3170[_0x9674('0x17')];writeLog(_0x1fc1dc,_0x9f4cc2,util['format'](_0x9674('0x18'),_0x2e369f));_0x530941[_0x9674('0x19')][_0x1fc1dc]['on'](_0x9674('0x1a'),function(){logger['info'](_0x9674('0x1b'),_0x1fc1dc);clearTimeout(_0x589c7e);_0x589c7e=undefined;_0x3df40d['close']();if(_0x530941[_0x9674('0x19')][_0x1fc1dc]){delete _0x530941['rules'][_0x1fc1dc];}_0x171590[_0x9674('0x13')]();});_0x530941['rules'][_0x1fc1dc]['on'](_0x9674('0x1c'),function(){if(_0x530941['rules'][_0x1fc1dc]){delete _0x530941[_0x9674('0x19')][_0x1fc1dc];}});_0x589c7e=setTimeout(function(){logger[_0x9674('0x8')]('[%s][AGENT]\x20ROUTING\x20END',_0x1fc1dc);clearTimeout(_0x589c7e);_0x3df40d[_0x9674('0x1d')]();_0x171590[_0x9674('0x1e')]();},_0x2e369f);strategy['agent'](_0x3df40d,_0x9f4cc2,_0x530941,_0x3d3170);}else{logger['error'](_0x9674('0x1f'),_0x1fc1dc,_0x40d7c6['name']);_0x171590['stop']();}}}catch(_0x413d0b){console[_0x9674('0x20')](_0x413d0b);logger['error'](_0x9674('0x21'),_0x1fc1dc,_0x413d0b[_0x9674('0x22')]);_0x171590[_0x9674('0x13')]();}};}; \ 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 af0e6b3..f8f1053 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 _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 +var _0x3ad4=['chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','toString','message','amazonlex','providerName','providerResponse','stringify','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone'];(function(_0x5c3dec,_0x3f1541){var _0x4e875f=function(_0x3f7a7c){while(--_0x3f7a7c){_0x5c3dec['push'](_0x5c3dec['shift']());}};_0x4e875f(++_0x3f1541);}(_0x3ad4,0x18e));var _0x43ad=function(_0x2c1a27,_0x4cd2d9){_0x2c1a27=_0x2c1a27-0x0;var _0x58a7f7=_0x3ad4[_0x2c1a27];return _0x58a7f7;};'use strict';var _=require(_0x43ad('0x0'));var moment=require(_0x43ad('0x1'));var AWS=require(_0x43ad('0x2'));var utils=require(_0x43ad('0x3'));var logger=require(_0x43ad('0x4'))(_0x43ad('0x5'));var rpc={'chatMessage':require(_0x43ad('0x6')),'openchannelMessage':require(_0x43ad('0x7')),'mailMessage':require(_0x43ad('0x8')),'smsMessage':require(_0x43ad('0x9')),'faxMessage':require(_0x43ad('0xa')),'whatsappMessage':require(_0x43ad('0xb'))};exports[_0x43ad('0xc')]=function(_0x717405,_0x596c40){return function(_0x4df9bf){try{if(!_['isNil'](this[_0x43ad('0xd')][_0x43ad('0xe')])){logger[_0x43ad('0xf')](_0x43ad('0x10'),_0x717405,_0x43ad('0x11'));return _0x4df9bf[_0x43ad('0x12')]();}var _0x3d5d66={'ContactId':this[_0x43ad('0x13')]['id'],'sentAt':moment()['format'](_0x43ad('0x14')),'direction':_0x43ad('0x15')};if(this['channel']===_0x43ad('0x16')||this[_0x43ad('0x17')]===_0x43ad('0x18')){_0x3d5d66[_0x43ad('0x19')]=this['interaction'][_0x43ad('0x19')];}var _0x350729=this['channel'];if(_0x350729===_0x43ad('0x1a')){_0x3d5d66[_0x43ad('0x1b')]=this[_0x43ad('0x1c')]['id'];}else{_0x3d5d66[_[_0x43ad('0x1d')](_0x350729)+'AccountId']=this[_0x43ad('0x1c')]['id'];}_0x3d5d66[_[_0x43ad('0x1d')](_0x350729)+_0x43ad('0x1e')]=this['interaction']['id'];if(this[_0x43ad('0xd')][_0x43ad('0x1f')]){var _0x488934=_0x596c40[0x4];if(!_[_0x43ad('0x20')](_0x488934)){_0x3d5d66[_0x43ad('0x21')]=utils[_0x43ad('0x22')](_0x488934,this);return rpc[_0x350729+_0x43ad('0x23')][_0x43ad('0x24')](_0x3d5d66)[_0x43ad('0x25')](function(_0x5eacc0){logger[_0x43ad('0xf')](_0x43ad('0x10'),_0x717405,_0x3d5d66[_0x43ad('0x21')]);})[_0x43ad('0x26')](function(_0x35cf96){logger[_0x43ad('0x27')](_0x43ad('0x10'),_0x717405,JSON['stringify'](_0x35cf96));})[_0x43ad('0x28')](function(){logger['info'](_0x43ad('0x29'),_0x717405);_0x4df9bf[_0x43ad('0x2a')]();});}else{logger[_0x43ad('0xf')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x717405);_0x4df9bf[_0x43ad('0x2a')]();}}else{var _0x26b387=this;var _0x5889ab=new AWS[(_0x43ad('0x2b'))]({'accessKeyId':_0x596c40[0x0],'secretAccessKey':_0x596c40[0x1],'region':_0x596c40[0x2]});var _0x5a2fe3={'botAlias':_0x43ad('0x2c'),'botName':_0x596c40[0x3],'inputText':this['message'][_0x43ad('0x21')],'userId':this[_0x43ad('0x17')]+':'+this[_0x43ad('0xd')]['id'][_0x43ad('0x2d')]()};_0x5889ab['postText'](_0x5a2fe3,function(_0xa4f661,_0x47a524){if(_0xa4f661){logger[_0x43ad('0x27')](_0x43ad('0x10'),_0x717405,_0xa4f661[_0x43ad('0x2e')]);_0x4df9bf[_0x43ad('0x12')]();}else if(_0x47a524&&_0x47a524[_0x43ad('0x2e')]){_0x26b387[_0x43ad('0x21')][_0x43ad('0x2f')]=_0x47a524;_0x3d5d66['body']=_0x47a524['message'];_0x3d5d66[_0x43ad('0x30')]=_0x43ad('0x2f');_0x3d5d66[_0x43ad('0x31')]=JSON[_0x43ad('0x32')](_0x47a524);return rpc[_0x350729+_0x43ad('0x23')]['create'](_0x3d5d66)[_0x43ad('0x25')](function(_0x4fae23){logger[_0x43ad('0xf')]('[%s][AMAZONLEX]\x20%s',_0x717405,_0x3d5d66['body']);if(_0x47a524[_0x43ad('0x33')]==_0x43ad('0x34')){_0x4df9bf[_0x43ad('0x12')]();}else{_0x4df9bf['stop']();}})[_0x43ad('0x26')](function(_0x2b2719){logger[_0x43ad('0x27')]('[%s][AMAZONLEX]\x20%s',_0x717405,JSON['stringify'](_0x2b2719));_0x4df9bf[_0x43ad('0x12')]();});}else{_0x4df9bf[_0x43ad('0x12')]();}});}}catch(_0x1f3137){logger['error'](_0x43ad('0x10'),_0x717405,JSON[_0x43ad('0x32')](_0x1f3137));_0x4df9bf[_0x43ad('0x2a')]();}};}; \ 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 1538bac..c0826d2 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 _0x5952=['info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','created','interaction','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','out','getMustacheRender','message','from','phone','read','subject','Re:','Re:\x20','ChatWebsiteId','account','upperFirst','InteractionId','Message','messageId','html','','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 +var _0x8ae0=['isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction','created','One\x20Time\x20already\x20sent','contact','format','out','body','getMustacheRender','from','message','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','upperFirst','AccountId','account','inReplyTo','html','','replace','headers','All','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','Message','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','autoreplyExecuted','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','finally','next','stop','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','consequence','channel','mail'];(function(_0x362d16,_0x31c1a2){var _0x5596de=function(_0x3e588b){while(--_0x3e588b){_0x362d16['push'](_0x362d16['shift']());}};_0x5596de(++_0x31c1a2);}(_0x8ae0,0xb1));var _0x08ae=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x8ae0[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x08ae('0x0'));var moment=require(_0x08ae('0x1'));var utils=require(_0x08ae('0x2'));var logger=require(_0x08ae('0x3'))('routing');var rpc={'chatMessage':require(_0x08ae('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x08ae('0x5')),'smsMessage':require(_0x08ae('0x6')),'faxMessage':require(_0x08ae('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x08ae('0x8')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x08ae('0x9')),'faxInteraction':require(_0x08ae('0xa')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x08ae('0xb'));exports[_0x08ae('0xc')]=function(_0x3a3742,_0x53e20a,_0x11ab33,_0xc4e815){return function(_0x3a5d6e){try{var _0x11a214=this[_0x08ae('0xd')];if(_0x11a214===_0x08ae('0xe')&&_0xc4e815['body'][_0x08ae('0xf')]){logger[_0x08ae('0x10')](_0x08ae('0x11'),_0x3a3742,_0x08ae('0x12'));return _0x3a5d6e['next']();}if(_0x53e20a[0x0]==='1'&&(_[_0x08ae('0x13')](this[_0x08ae('0x14')][_0x08ae('0x15')])||!this[_0x08ae('0x14')]['created'])){logger['info'](_0x08ae('0x11'),_0x3a3742,'Autoreply\x20already\x20sent');return _0x3a5d6e['next']();}if(_0x53e20a[0x0]==='2'&&this[_0x08ae('0x14')]['autoreplyExecuted']){logger[_0x08ae('0x10')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3a3742,_0x08ae('0x16'));return _0x3a5d6e['next']();}var _0x1492c9={'ContactId':this[_0x08ae('0x17')]['id'],'sentAt':moment()[_0x08ae('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x08ae('0x19')};if(this[_0x08ae('0xd')]==='mail'){_0x1492c9[_0x08ae('0x1a')]=utils[_0x08ae('0x1b')](_0x53e20a[0x2],this);}else{_0x1492c9[_0x08ae('0x1a')]=utils[_0x08ae('0x1b')](_0x53e20a[0x1],this);}if(this['message']){_0x1492c9['to']=this['message'][_0x08ae('0x1c')]||'';if(this[_0x08ae('0xd')]==='mail'&&_0x53e20a[0x1]==='1'){_0x1492c9['cc']=this[_0x08ae('0x1d')]['cc']||'';}_0x1492c9['from']=this[_0x08ae('0x1d')]['to']||'';_0x1492c9['phone']=this[_0x08ae('0x1d')]['phone']||'';_0x1492c9['read']=!![];if(this[_0x08ae('0x1d')][_0x08ae('0x1e')]){_0x1492c9[_0x08ae('0x1e')]='';_0x1492c9[_0x08ae('0x1e')]+=_[_0x08ae('0x1f')](this[_0x08ae('0x1d')][_0x08ae('0x1e')],_0x08ae('0x20'))?'':_0x08ae('0x21');_0x1492c9['subject']+=this[_0x08ae('0x1d')][_0x08ae('0x1e')];}}if(this[_0x08ae('0xd')]===_0x08ae('0x22')){_0x1492c9[_0x08ae('0x23')]=this['account']['id'];}else{_0x1492c9[_[_0x08ae('0x24')](this['channel'])+_0x08ae('0x25')]=this[_0x08ae('0x26')]['id'];}_0x1492c9[_[_0x08ae('0x24')](this[_0x08ae('0xd')])+'InteractionId']=this['interaction']['id'];var _0x1f289b=this['interaction'];if(rpc[this[_0x08ae('0xd')]+'Message']){if(this['channel']===_0x08ae('0xe')){_0x1492c9[_0x08ae('0x27')]=this[_0x08ae('0x1d')]['messageId'];_0x1492c9[_0x08ae('0x28')]=_0x08ae('0x29')+_[_0x08ae('0x2a')](_0x1492c9['body'],'';_0x1492c9[_0x08ae('0x2b')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x08ae('0x2c'),'Precedence':'auto_reply'};return mailRpc[_0x08ae('0x2d')](this['account'][_0x08ae('0x2e')],_0x1492c9)[_0x08ae('0x2f')](function(_0x3821aa){logger[_0x08ae('0x10')](_0x08ae('0x30'),_0x3a3742);_0x1492c9[_0x08ae('0x31')]=_0x3821aa[_0x08ae('0x1d')][_0x08ae('0x31')];return rpc[_0x11a214+_0x08ae('0x32')]['create'](_0x1492c9);})[_0x08ae('0x2f')](function(_0x31e099){logger['info'](_0x08ae('0x11'),_0x3a3742,JSON[_0x08ae('0x33')](_0x31e099));})[_0x08ae('0x34')](function(_0xf4730c){logger[_0x08ae('0x35')](_0x08ae('0x36'),_0x3a3742,JSON[_0x08ae('0x33')](_0xf4730c));})['finally'](function(){Promise['resolve']()['then'](function(){if(_0x53e20a[0x0]!=='2'||_0x1f289b[_0x08ae('0x37')])return;return rpc[_0x11a214+_0x08ae('0x38')][_0x08ae('0x39')](_0x1f289b['id'],{'autoreplyExecuted':!![]})[_0x08ae('0x2f')](function(_0x2ba29a){logger[_0x08ae('0x10')](_0x08ae('0x3a'),_0x3a3742,JSON[_0x08ae('0x33')](_0x2ba29a));})[_0x08ae('0x34')](function(_0xea9379){logger[_0x08ae('0x35')](_0x08ae('0x3b'),_0x3a3742,JSON['stringify'](_0xea9379));});})['then'](function(){_0x3a5d6e['next']();});});}else{return rpc[this['channel']+_0x08ae('0x32')][_0x08ae('0x3c')](_0x1492c9)[_0x08ae('0x2f')](function(){logger[_0x08ae('0x10')](_0x08ae('0x11'),_0x3a3742,_0x1492c9[_0x08ae('0x1a')]);})[_0x08ae('0x34')](function(_0x57ac50){logger[_0x08ae('0x35')](_0x08ae('0x11'),_0x3a3742,JSON[_0x08ae('0x33')](_0x57ac50));})[_0x08ae('0x3d')](function(){Promise['resolve']()[_0x08ae('0x2f')](function(){if(_0x53e20a[0x0]!=='2'||_0x1f289b[_0x08ae('0x37')])return;return rpc[_0x11a214+_0x08ae('0x38')][_0x08ae('0x39')](_0x1f289b['id'],{'autoreplyExecuted':!![]})[_0x08ae('0x2f')](function(_0x55af4e){logger[_0x08ae('0x10')](_0x08ae('0x3a'),_0x3a3742,JSON[_0x08ae('0x33')](_0x55af4e));})[_0x08ae('0x34')](function(_0x1666a8){logger['error'](_0x08ae('0x3b'),_0x3a3742,JSON[_0x08ae('0x33')](_0x1666a8));});})[_0x08ae('0x2f')](function(){_0x3a5d6e[_0x08ae('0x3e')]();});});}}}catch(_0x190a70){logger[_0x08ae('0x35')](_0x08ae('0x11'),_0x3a3742,JSON[_0x08ae('0x33')](_0x190a70));_0x3a5d6e[_0x08ae('0x3f')]();}};}; \ 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 5786aad..5b8677f 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 _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 +var _0xd5c0=['routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','finally','stringify','stop','moment','../../../../config/logger'];(function(_0x14a47c,_0x3f32fd){var _0xd43546=function(_0x5656a0){while(--_0x5656a0){_0x14a47c['push'](_0x14a47c['shift']());}};_0xd43546(++_0x3f32fd);}(_0xd5c0,0x157));var _0x0d5c=function(_0x57c662,_0x2c9ffe){_0x57c662=_0x57c662-0x0;var _0x216916=_0xd5c0[_0x57c662];return _0x216916;};'use strict';var moment=require(_0x0d5c('0x0'));var logger=require(_0x0d5c('0x1'))(_0x0d5c('0x2'));var rpc={'chatInteraction':require(_0x0d5c('0x3')),'openchannelInteraction':require(_0x0d5c('0x4')),'smsInteraction':require(_0x0d5c('0x5')),'mailInteraction':require(_0x0d5c('0x6')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x0d5c('0x7'))};exports['consequence']=function(_0x283326,_0x1e9ca2,_0x45ec65,_0x1187df){return function(_0x21c384){try{logger[_0x0d5c('0x8')](_0x0d5c('0x9'),_0x283326,_0x1e9ca2[0x0]);var _0x148ab3={'closed':0x1,'closedAt':moment()[_0x0d5c('0xa')](_0x0d5c('0xb')),'closeReason':_0x0d5c('0xc'),'disposition':_0x1e9ca2[0x0]};if(rpc[_0x1187df[_0x0d5c('0xd')]+_0x0d5c('0xe')]){rpc[_0x1187df['channel']+_0x0d5c('0xe')][_0x0d5c('0xf')](_0x1187df[_0x0d5c('0x10')]['id'],_0x148ab3)['then'](function(_0x4af1cf){logger[_0x0d5c('0x8')](_0x0d5c('0x11'),_0x283326,_0x1187df[_0x0d5c('0x10')]['id']);})['catch'](function(_0x19f5bc){logger[_0x0d5c('0x12')](_0x0d5c('0x13'),_0x283326,JSON['stringify'](_0x19f5bc));})[_0x0d5c('0x14')](function(){_0x21c384['stop']();});}}catch(_0x1a8113){logger[_0x0d5c('0x12')](_0x0d5c('0x13'),_0x283326,JSON[_0x0d5c('0x15')](_0x1a8113));_0x21c384[_0x0d5c('0x16')]();}};}; \ 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 c372dbc..bde3851 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 _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 +var _0x6c99=['error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','body','interaction','dialogflow','result','fulfillment','speech','providerResponse','stringify','metadata','endConversation','next','lodash','apiai-promise','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','chat','upperFirst','AccountId','account','created','isEmpty','getMustacheRender','Message','create','then','[%s][DIALOGFLOW]\x20%s','catch'];(function(_0x1dc70e,_0x48031d){var _0x5c4472=function(_0x405b77){while(--_0x405b77){_0x1dc70e['push'](_0x1dc70e['shift']());}};_0x5c4472(++_0x48031d);}(_0x6c99,0x9b));var _0x96c9=function(_0x3e32a8,_0x255953){_0x3e32a8=_0x3e32a8-0x0;var _0x2997b0=_0x6c99[_0x3e32a8];return _0x2997b0;};'use strict';var _=require(_0x96c9('0x0'));var moment=require('moment');var apiai=require(_0x96c9('0x1'));var md5=require('md5');var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x96c9('0x2')),'mailMessage':require(_0x96c9('0x3')),'smsMessage':require(_0x96c9('0x4')),'faxMessage':require(_0x96c9('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x96c9('0x6')]=function(_0x1a30b2,_0x4323be){return function(_0x31d79e){try{if(!_[_0x96c9('0x7')](this['interaction']['UserId'])){logger[_0x96c9('0x8')]('[%s][DIALOGFLOW]\x20%s',_0x1a30b2,_0x96c9('0x9'));return _0x31d79e['next']();}var _0x2e05a5={'ContactId':this[_0x96c9('0xa')]['id'],'sentAt':moment()[_0x96c9('0xb')](_0x96c9('0xc')),'direction':'out'};if(this[_0x96c9('0xd')]===_0x96c9('0xe')||this[_0x96c9('0xd')]===_0x96c9('0xf')){_0x2e05a5[_0x96c9('0x10')]=this['interaction'][_0x96c9('0x10')];}var _0x196124=this[_0x96c9('0xd')];if(_0x196124===_0x96c9('0x11')){_0x2e05a5['ChatWebsiteId']=this['account']['id'];}else{_0x2e05a5[_[_0x96c9('0x12')](_0x196124)+_0x96c9('0x13')]=this[_0x96c9('0x14')]['id'];}_0x2e05a5[_[_0x96c9('0x12')](_0x196124)+'InteractionId']=this['interaction']['id'];if(this['interaction'][_0x96c9('0x15')]){var _0x508568=_0x4323be[0x2];if(!_[_0x96c9('0x16')](_0x508568)){_0x2e05a5['body']=utils[_0x96c9('0x17')](_0x508568,this);return rpc[_0x196124+_0x96c9('0x18')][_0x96c9('0x19')](_0x2e05a5)[_0x96c9('0x1a')](function(_0x3bdf8f){logger['info'](_0x96c9('0x1b'),_0x1a30b2,_0x2e05a5['body']);})[_0x96c9('0x1c')](function(_0x433390){logger[_0x96c9('0x1d')]('[%s][DIALOGFLOW]\x20%s',_0x1a30b2,JSON['stringify'](_0x433390));})[_0x96c9('0x1e')](function(){logger[_0x96c9('0x8')](_0x96c9('0x1f'),_0x1a30b2);_0x31d79e[_0x96c9('0x20')]();});}else{logger[_0x96c9('0x8')](_0x96c9('0x21'),_0x1a30b2);_0x31d79e['stop']();}}else{var _0x101a25=this;var _0x3a7fc5=apiai(_0x4323be[0x0],{'language':_0x4323be[0x1]||'en'});return _0x3a7fc5['textRequest'](this[_0x96c9('0x22')][_0x96c9('0x23')],{'sessionId':md5(this[_0x96c9('0x24')]['id'])})['then'](function(_0x13e642){_0x101a25[_0x96c9('0x23')][_0x96c9('0x25')]=_0x13e642;_0x2e05a5[_0x96c9('0x23')]=_0x13e642[_0x96c9('0x26')][_0x96c9('0x27')][_0x96c9('0x28')];_0x2e05a5['providerName']=_0x96c9('0x25');_0x2e05a5[_0x96c9('0x29')]=JSON[_0x96c9('0x2a')](_0x13e642);return rpc[_0x196124+_0x96c9('0x18')][_0x96c9('0x19')](_0x2e05a5)[_0x96c9('0x1a')](function(_0x306ac6){logger[_0x96c9('0x8')](_0x96c9('0x1b'),_0x1a30b2,_0x2e05a5[_0x96c9('0x23')]);if(_0x13e642[_0x96c9('0x26')][_0x96c9('0x2b')][_0x96c9('0x2c')]){_0x31d79e['next']();}else{_0x31d79e[_0x96c9('0x20')]();}})[_0x96c9('0x1c')](function(_0x4cae5a){logger[_0x96c9('0x1d')]('[%s][DIALOGFLOW]\x20%s',_0x1a30b2,JSON['stringify'](_0x4cae5a));_0x31d79e[_0x96c9('0x2d')]();});})[_0x96c9('0x1c')](function(_0x3516eb){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x1a30b2,_0x3516eb[_0x96c9('0x22')]);_0x31d79e[_0x96c9('0x2d')]();});}}catch(_0x4408bd){logger[_0x96c9('0x1d')](_0x96c9('0x1b'),_0x1a30b2,JSON[_0x96c9('0x2a')](_0x4408bd));_0x31d79e['stop']();}};}; \ 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 d5a2494..2c526d3 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 _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 +var _0x23c2=['DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','dialogflowV2','providerResponse','push','all','message','stack','lodash','dialogflow','md5','moment','bluebird','routing','./utils','../../rpc/chatMessage','../../rpc/whatsappMessage','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','interaction','ChatWebsiteId','AccountId','account','upperFirst','created','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','sessionPath','length','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','displayName','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText'];(function(_0x483d8b,_0x526c52){var _0x6500f1=function(_0x372797){while(--_0x372797){_0x483d8b['push'](_0x483d8b['shift']());}};_0x6500f1(++_0x526c52);}(_0x23c2,0x111));var _0x223c=function(_0x50e545,_0x342948){_0x50e545=_0x50e545-0x0;var _0x181af8=_0x23c2[_0x50e545];return _0x181af8;};'use strict';var _=require(_0x223c('0x0'));var dialogflow=require(_0x223c('0x1'));var md5=require(_0x223c('0x2'));var moment=require(_0x223c('0x3'));var Promise=require(_0x223c('0x4'));var logger=require('../../../../config/logger')(_0x223c('0x5'));var utils=require(_0x223c('0x6'));var rpc={'chatMessage':require(_0x223c('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x223c('0x8'))};function createMessage(_0x340982,_0xa3f59c,_0x1e2312,_0x4516a0){return new Promise(function(_0x26d0f9,_0x37057c){var _0x44e993=_['clone'](_0x1e2312);_0x44e993[_0x223c('0x9')]=_0x4516a0;return rpc[_0xa3f59c+_0x223c('0xa')][_0x223c('0xb')](_0x44e993)[_0x223c('0xc')](function(){logger[_0x223c('0xd')](_0x223c('0xe'),_0x340982,_0x44e993[_0x223c('0x9')]);_0x26d0f9();})[_0x223c('0xf')](function(_0x39533c){logger[_0x223c('0x10')](_0x223c('0xe'),_0x340982,JSON[_0x223c('0x11')](_0x39533c));_0x37057c(_0x39533c);});});}exports[_0x223c('0x12')]=function(_0x1b1fa7,_0x126180){return function(_0x318758){try{if(!_['isNil'](this['interaction'][_0x223c('0x13')])){logger['info'](_0x223c('0xe'),_0x1b1fa7,_0x223c('0x14'));return _0x318758[_0x223c('0x15')]();}var _0x36e4b2={'ContactId':this['contact']['id'],'sentAt':moment()[_0x223c('0x16')](_0x223c('0x17')),'direction':_0x223c('0x18')};if(this[_0x223c('0x19')]===_0x223c('0x1a')||this[_0x223c('0x19')]==='whatsapp'){_0x36e4b2[_0x223c('0x1b')]=this[_0x223c('0x1c')][_0x223c('0x1b')];}var _0x15c1c5=this['channel'];if(_0x15c1c5==='chat'){_0x36e4b2[_0x223c('0x1d')]=this['account']['id'];}else{_0x36e4b2[_['upperFirst'](_0x15c1c5)+_0x223c('0x1e')]=this[_0x223c('0x1f')]['id'];}_0x36e4b2[_[_0x223c('0x20')](_0x15c1c5)+'InteractionId']=this[_0x223c('0x1c')]['id'];if(this['interaction'][_0x223c('0x21')]){var _0x429d94=_0x126180[0x4];if(!_['isEmpty'](_0x429d94)){_0x36e4b2[_0x223c('0x9')]=utils['getMustacheRender'](_0x429d94,this);return rpc[_0x15c1c5+_0x223c('0xa')][_0x223c('0xb')](_0x36e4b2)[_0x223c('0xc')](function(_0x3914d7){logger['info'](_0x223c('0xe'),_0x1b1fa7,_0x36e4b2[_0x223c('0x9')]);})[_0x223c('0xf')](function(_0x5d4b05){logger['error'](_0x223c('0xe'),_0x1b1fa7,JSON[_0x223c('0x11')](_0x5d4b05));})[_0x223c('0x22')](function(){logger[_0x223c('0xd')](_0x223c('0x23'),_0x1b1fa7);_0x318758[_0x223c('0x24')]();});}else{logger[_0x223c('0xd')](_0x223c('0x25'),_0x1b1fa7);_0x318758[_0x223c('0x24')]();}}else{var _0x21d613=this;var _0x4ce96b=_0x126180[0x2]['replace'](/\\n/g,'\x0a');var _0x23f4da={'credentials':{'private_key':_0x4ce96b,'client_email':_0x126180[0x1]}};var _0x33e93f=new dialogflow['SessionsClient'](_0x23f4da);var _0x10a223=_0x33e93f[_0x223c('0x26')](_0x126180[0x0],md5(_0x21d613['interaction']['id']));var _0x127cc1={'session':_0x10a223,'queryInput':{'text':{'text':_0x21d613['message'][_0x223c('0x9')],'languageCode':_0x126180[0x3]||'en'}}};return _0x33e93f['detectIntent'](_0x127cc1)[_0x223c('0xc')](function(_0x5cbdda){if(_0x5cbdda&&_0x5cbdda[_0x223c('0x27')]){_0x21d613['body']['dialogflowV2']=_0x5cbdda;var _0x401a5a=_0x5cbdda[0x0];var _0x26d38e=_0x401a5a[_0x223c('0x28')]['diagnosticInfo']&&_0x401a5a[_0x223c('0x28')][_0x223c('0x29')]['fields']?_0x401a5a['queryResult'][_0x223c('0x29')][_0x223c('0x2a')][_0x223c('0x2b')][_0x223c('0x2c')]:![];_0x21d613[_0x223c('0x9')]['DIALOGFLOWV2_ACTION']=_0x401a5a[_0x223c('0x28')]['action'];_0x21d613[_0x223c('0x9')][_0x223c('0x2d')]=_0x401a5a[_0x223c('0x28')][_0x223c('0x2e')];_0x21d613['body'][_0x223c('0x2f')]=_0x401a5a[_0x223c('0x28')][_0x223c('0x29')]&&_0x401a5a[_0x223c('0x28')][_0x223c('0x29')][_0x223c('0x2a')]?_0x401a5a[_0x223c('0x28')][_0x223c('0x29')][_0x223c('0x2a')][_0x223c('0x2b')]['boolValue']:![];_0x21d613[_0x223c('0x9')][_0x223c('0x30')]=_0x401a5a['queryResult'][_0x223c('0x31')][_0x223c('0x32')];_0x21d613[_0x223c('0x9')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x401a5a[_0x223c('0x28')][_0x223c('0x31')][_0x223c('0x33')];_0x21d613[_0x223c('0x9')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x401a5a[_0x223c('0x28')][_0x223c('0x31')][_0x223c('0x34')];_0x21d613[_0x223c('0x9')][_0x223c('0x35')]=_0x401a5a['queryResult'][_0x223c('0x36')];_0x21d613[_0x223c('0x9')][_0x223c('0x37')]=_0x401a5a['queryResult'][_0x223c('0x38')];_0x21d613[_0x223c('0x9')][_0x223c('0x39')]=_0x401a5a['queryResult'][_0x223c('0x3a')];_0x36e4b2[_0x223c('0x3b')]=_0x223c('0x3c');_0x36e4b2[_0x223c('0x3d')]=JSON['stringify'](_0x5cbdda);var _0x2970e7=[];for(var _0xdcf0ef=0x0;_0xdcf0ef<_0x5cbdda[_0x223c('0x27')];_0xdcf0ef++){var _0x1a3e19=_0x5cbdda[_0xdcf0ef];if(_0x1a3e19&&_0x1a3e19[_0x223c('0x28')]&&_0x1a3e19['queryResult']['fulfillmentText']){_0x2970e7[_0x223c('0x3e')](createMessage(_0x1b1fa7,_0x15c1c5,_0x36e4b2,_0x1a3e19[_0x223c('0x28')]['fulfillmentText']));}}return Promise[_0x223c('0x3f')](_0x2970e7)[_0x223c('0xc')](function(){if(_0x26d38e){_0x318758[_0x223c('0x15')]();}else{_0x318758[_0x223c('0x24')]();}})[_0x223c('0xf')](function(_0x2d7535){logger[_0x223c('0x10')](_0x223c('0xe'),_0x1b1fa7,JSON[_0x223c('0x11')](_0x2d7535));_0x318758[_0x223c('0x15')]();});}})[_0x223c('0xf')](function(_0x2f47f8){logger[_0x223c('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x1b1fa7,_0x2f47f8[_0x223c('0x40')],_0x2f47f8[_0x223c('0x41')]);_0x318758[_0x223c('0x15')]();});}}catch(_0x236bbb){logger[_0x223c('0x10')](_0x223c('0xe'),_0x1b1fa7,JSON[_0x223c('0x11')](_0x236bbb));_0x318758['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 244648e..6baa92b 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 _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 +var _0x7deb=['./utils','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','validate','length','error','join','stop','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','[%s][GOTOIF]\x20%s','stringify','html-to-text'];(function(_0x3cfb0d,_0x4df584){var _0x3486b4=function(_0x1b0939){while(--_0x1b0939){_0x3cfb0d['push'](_0x3cfb0d['shift']());}};_0x3486b4(++_0x4df584);}(_0x7deb,0x1e5));var _0xb7de=function(_0x3227c1,_0x4318c5){_0x3227c1=_0x3227c1-0x0;var _0x31fd48=_0x7deb[_0x3227c1];return _0x31fd48;};'use strict';var schema=require('validate');var _=require('lodash');var htmlToText=require(_0xb7de('0x0'));var utils=require(_0xb7de('0x1'));var logger=require('../../../../config/logger')('routing');var gotoif=schema({'condition':{'type':_0xb7de('0x2'),'required':!![],'message':_0xb7de('0x3')},'priorityTrue':{'type':_0xb7de('0x4'),'message':_0xb7de('0x5')},'priorityFalse':{'type':_0xb7de('0x4'),'message':_0xb7de('0x6')}});exports[_0xb7de('0x7')]=function(_0x30e4e7,_0xabd37){return function(_0x5e66ff){try{var _0x491adc={'condition':htmlToText[_0xb7de('0x8')](utils[_0xb7de('0x9')](_0xabd37[0x0],this),{'wordwrap':![]})[_0xb7de('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0xabd37[0x1],'priorityFalse':_0xabd37[0x2]};var _0x3a867c=gotoif[_0xb7de('0xb')](_0x491adc,{'typecast':!![]});if(_0x3a867c[_0xb7de('0xc')]){logger[_0xb7de('0xd')]('[%s][GOTOIF]\x20%s',_0x30e4e7,_['map'](_0x3a867c,'message')[_0xb7de('0xe')](',\x20'));_0x5e66ff[_0xb7de('0xf')]();}else{try{var _0x19d598=eval('('+_0x491adc['condition']+')');var _0x38c5b7=_0x19d598?_0x491adc['priorityTrue']:_0x491adc[_0xb7de('0x10')];logger[_0xb7de('0x11')](_0xb7de('0x12'),_0x30e4e7,_0x491adc['condition'],_0x19d598,_0x38c5b7||'next');if(_0x38c5b7){var _0x5f010b=_[_0xb7de('0x13')](_0x5e66ff[_0xb7de('0x14')](),{'p':_0x38c5b7});if(_0x5f010b>=0x0){logger[_0xb7de('0x11')](_0xb7de('0x15'),_0x30e4e7,_0x38c5b7||'next',_0x5f010b);_0x5e66ff[_0xb7de('0x16')](_0x5f010b);}else{logger[_0xb7de('0x11')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x30e4e7,_0x38c5b7||_0xb7de('0x16'));_0x5e66ff[_0xb7de('0xf')]();}}else{_0x5e66ff['next']();}}catch(_0x3ffc57){logger[_0xb7de('0xd')](_0xb7de('0x17'),_0x30e4e7,_0x3ffc57[_0xb7de('0x18')]);_0x5e66ff[_0xb7de('0xf')]();}}}catch(_0x3de380){logger['error'](_0xb7de('0x19'),_0x30e4e7,JSON[_0xb7de('0x1a')](_0x3de380));_0x5e66ff['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 585602b..7de2bc5 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 _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 +var _0x8624=['priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','map','message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','next','stringify','validate','lodash','../../../../config/logger','number'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8624,0x95));var _0x4862=function(_0x3e37b3,_0x570305){_0x3e37b3=_0x3e37b3-0x0;var _0x47e724=_0x8624[_0x3e37b3];return _0x47e724;};'use strict';var schema=require(_0x4862('0x0'));var _=require(_0x4862('0x1'));var logger=require(_0x4862('0x2'))('routing');var gotop=schema({'priority':{'type':_0x4862('0x3'),'required':!![],'message':_0x4862('0x4')}});exports['consequence']=function(_0x56a4b0,_0x18fe4b){return function(_0x587162){try{var _0x2cccbc={'priority':_0x18fe4b[0x0]};var _0x494bff=gotop[_0x4862('0x0')](_0x2cccbc,{'typecast':!![]});if(_0x494bff[_0x4862('0x5')]){logger[_0x4862('0x6')](_0x4862('0x7'),_0x56a4b0,_[_0x4862('0x8')](_0x494bff,_0x4862('0x9'))['join'](',\x20'));_0x587162[_0x4862('0xa')]();}else{logger[_0x4862('0xb')](_0x4862('0xc'),_0x56a4b0,_0x2cccbc['priority']);if(_0x2cccbc[_0x4862('0xd')]){var _0x5310ba=_['findIndex'](_0x587162[_0x4862('0xe')](),{'p':_0x2cccbc[_0x4862('0xd')]});if(_0x5310ba>=0x0){logger[_0x4862('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x56a4b0,_0x2cccbc[_0x4862('0xd')]||_0x4862('0xf'),_0x5310ba);_0x587162[_0x4862('0xf')](_0x5310ba);}else{logger['info']('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x56a4b0,_0x2cccbc[_0x4862('0xd')]||_0x4862('0xf'));_0x587162['stop']();}}else{_0x587162['next']();}}}catch(_0x4b7fc4){logger['error'](_0x4862('0x7'),_0x56a4b0,JSON[_0x4862('0x10')](_0x4b7fc4));_0x587162[_0x4862('0xa')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 7257d61..490853f 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 _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 +var _0x9624=['[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message','create','then','info','next','catch','error'];(function(_0x15fec1,_0x3684c1){var _0x5719e5=function(_0x4dd05c){while(--_0x4dd05c){_0x15fec1['push'](_0x15fec1['shift']());}};_0x5719e5(++_0x3684c1);}(_0x9624,0xc0));var _0x4962=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9624[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4962('0x0'));var utils=require(_0x4962('0x1'));var logger=require(_0x4962('0x2'))(_0x4962('0x3'));var rpc={'chatMessage':require(_0x4962('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x4962('0x5')),'smsMessage':require(_0x4962('0x6')),'faxMessage':require(_0x4962('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x4962('0x8')]=function(_0x133128,_0x100ebc){return function(_0x3eb249){try{var _0x352f31={'body':utils[_0x4962('0x9')](_0x100ebc[0x0],this),'ContactId':this[_0x4962('0xa')]['id']};if(this[_0x4962('0xb')]==='chat'){_0x352f31[_0x4962('0xc')]=this[_0x4962('0xd')]['id'];}else{_0x352f31[_[_0x4962('0xe')](this['channel'])+'AccountId']=this[_0x4962('0xd')]['id'];}_0x352f31[_[_0x4962('0xe')](this[_0x4962('0xb')])+_0x4962('0xf')]=this[_0x4962('0x10')]['id'];if(rpc[this[_0x4962('0xb')]+_0x4962('0x11')]){return rpc[this[_0x4962('0xb')]+_0x4962('0x11')][_0x4962('0x12')](_0x352f31)[_0x4962('0x13')](function(_0x385f85){logger[_0x4962('0x14')]('[%s][MESSAGE]\x20%s',_0x133128,_0x352f31['body']);_0x3eb249[_0x4962('0x15')]();})[_0x4962('0x16')](function(_0x4c984a){logger[_0x4962('0x17')](_0x4962('0x18'),_0x133128,JSON[_0x4962('0x19')](_0x4c984a));_0x3eb249[_0x4962('0x1a')]();});}}catch(_0x291e69){logger[_0x4962('0x17')](_0x4962('0x18'),_0x133128,JSON[_0x4962('0x19')](_0x291e69));_0x3eb249[_0x4962('0x1a')]();}};}; \ 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 f226191..48262f2 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 _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 +var _0x1447=['routing','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','../../../../config/logger'];(function(_0x555aa9,_0x3a607f){var _0x20aecd=function(_0x28e2e9){while(--_0x28e2e9){_0x555aa9['push'](_0x555aa9['shift']());}};_0x20aecd(++_0x3a607f);}(_0x1447,0xb7));var _0x7144=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x1447[_0x199572];return _0x13cfa3;};'use strict';var utils=require('./utils');var logger=require(_0x7144('0x0'))(_0x7144('0x1'));exports['consequence']=function(_0x18c634,_0x24d12e){return function(_0x28dc49){try{logger[_0x7144('0x2')](_0x7144('0x3'),_0x18c634,utils[_0x7144('0x4')](_0x24d12e[0x0],this));_0x28dc49[_0x7144('0x5')]();}catch(_0x78e332){logger[_0x7144('0x6')](_0x7144('0x3'),_0x18c634,JSON[_0x7144('0x7')](_0x78e332));_0x28dc49['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 3ce75d8..00bca99 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 _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 +var _0x67d0=['InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','update\x20queue\x20report','timeout','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','createQueue','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','seq-queue','moment','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','joinAt','emit','clone','push','%sQueuesWaitingInteractions','pick','format','%s_queue_waiting_interaction:%s','save','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x67d0,0x1c7));var _0x067d=function(_0x36276d,_0x486003){_0x36276d=_0x36276d-0x0;var _0x56bf35=_0x67d0[_0x36276d];return _0x56bf35;};'use strict';var schema=require(_0x067d('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require(_0x067d('0x1'));var moment=require(_0x067d('0x2'));var Redis=require('ioredis');var config=require(_0x067d('0x3'));var logger=require(_0x067d('0x4'))(_0x067d('0x5'));var strategy=require('./strategy');config[_0x067d('0x6')]=_[_0x067d('0x7')](config['redis'],{'host':_0x067d('0x8'),'port':0x18eb});var io=require(_0x067d('0x9'))(new Redis(config[_0x067d('0x6')]));var attributes=['id',_0x067d('0xa'),_0x067d('0xb'),_0x067d('0xc'),'from',_0x067d('0xd')];function emit(_0x467aa8,_0x2f519b,_0x3ae5a0){io['to'](_0x467aa8)[_0x067d('0xe')](_0x2f519b,_0x3ae5a0);}function emitChannelQueueInteraction(_0x57a096,_0x51dcfa,_0x4d7fab,_0x30ee99,_0x55290a,_0x1d24f0,_0x3f70b1,_0x1839cf){var _0x468882=_[_0x067d('0xf')](_0x4d7fab);_0x468882[_0x067d('0xa')]=_0x1839cf;_0x468882['queue']=_0x51dcfa;_0x468882[_0x067d('0xb')]=_0x30ee99;_0x468882['id']=_0x55290a;if(_0x1d24f0){attributes[_0x067d('0x10')](_['capitalize'](_0x57a096)+'InteractionId');_0x3f70b1[util['format'](_0x067d('0x11'),_0x57a096)][_0x55290a]=_[_0x067d('0x12')](_0x468882,attributes);}else{delete _0x3f70b1[util[_0x067d('0x13')]('%sQueuesWaitingInteractions',_0x57a096)][_0x55290a];}emit(util['format']('%s:queue:%s',_0x57a096,_0x51dcfa),util[_0x067d('0x13')](_0x067d('0x14'),_0x57a096,_0x1d24f0?_0x067d('0x15'):'remove'),_[_0x067d('0x12')](_0x468882,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x067d('0x16')),'chatQueueReport':require(_0x067d('0x17')),'smsQueueReport':require(_0x067d('0x18')),'faxQueueReport':require(_0x067d('0x19')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require(_0x067d('0x1a')),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require(_0x067d('0x1b')),'openchannelInteraction':require(_0x067d('0x1c')),'smsInteraction':require(_0x067d('0x1d')),'whatsappInteraction':require(_0x067d('0x1e'))};var queue=schema({'name':{'type':_0x067d('0x1f'),'required':!![],'message':_0x067d('0x20')},'timeout':{'type':_0x067d('0x21'),'message':_0x067d('0x22')}});function startRouting(_0x5c574f,_0x4e7d96,_0xd14075,_0x4bf972){if(_0x5c574f&&_0x4e7d96&&_0xd14075){_0x4e7d96[_0x067d('0x23')]+=0x1;var _0x4cd3de={'uniqueid':_0x5c574f,'from':_0xd14075[_0x067d('0x24')]?_0xd14075['body']['from']:'','joinAt':moment()['format'](_0x067d('0x25')),'ContactId':_0xd14075[_0x067d('0x26')]?_0xd14075[_0x067d('0x26')]['id']:null,'ListId':_0xd14075[_0x067d('0x27')]?_0xd14075[_0x067d('0x27')]['id']:null};_0x4cd3de[_[_0x067d('0x28')](_0xd14075[_0x067d('0x29')])+_0x067d('0x2a')]=_0x4e7d96['id']||null;_0x4cd3de[_['upperFirst'](_0xd14075['channel'])+_0x067d('0x2b')]=_0xd14075[_0x067d('0x2c')]?_0xd14075['interaction']['id']:null;_0x4cd3de[_[_0x067d('0x28')](_0xd14075[_0x067d('0x29')])+_0x067d('0x2d')]=_0xd14075[_0x067d('0x2e')]?_0xd14075[_0x067d('0x2e')]['id']:null;_0x4cd3de[_[_0x067d('0x28')](_0xd14075[_0x067d('0x29')])+(_0xd14075[_0x067d('0x29')]!==_0x067d('0x2f')?_0x067d('0x30'):_0x067d('0x31'))]=_0xd14075[_0x067d('0xb')]?_0xd14075[_0x067d('0xb')]['id']:null;logger[_0x067d('0x32')](util[_0x067d('0x13')]('[%s][START:QUEUE][NAME:%s]',_0x5c574f,_0x4e7d96[_0x067d('0x33')]));emitChannelQueueInteraction(_0xd14075[_0x067d('0x29')],_0x4e7d96[_0x067d('0x33')],_0x4cd3de,_0xd14075[_0x067d('0xb')][_0x067d('0x33')],_0xd14075[_0x067d('0x2e')]['id'],!![],_0x4bf972,_0x4e7d96['id']);if(rpc[_0xd14075[_0x067d('0x29')]+_0x067d('0x34')]){return rpc[_0xd14075[_0x067d('0x29')]+'QueueReport'][_0x067d('0x35')](_0x4cd3de)[_0x067d('0x36')](function(_0x15f9ec){logger[_0x067d('0x37')](_0x067d('0x38'),_0x15f9ec);});}}}function stopRouting(_0x2f1f24,_0x22018b,_0x13e1c6,_0x5665c0){if(_0x2f1f24&&_0x22018b){_0x22018b[_0x067d('0x23')]-=0x1;var _0x5b34bb={'leaveAt':moment()[_0x067d('0x13')](_0x067d('0x25')),'acceptAt':moment()[_0x067d('0x13')](_0x067d('0x25')),'reason':_0x067d('0x39')};logger[_0x067d('0x32')](util['format'](_0x067d('0x3a'),_0x2f1f24,_0x22018b[_0x067d('0x33')]));emitChannelQueueInteraction(_0x13e1c6['channel'],_0x22018b[_0x067d('0x33')],_0x13e1c6[_0x067d('0x24')],_0x13e1c6[_0x067d('0xb')]['name'],_0x13e1c6['message']['id'],![],_0x5665c0,_0x22018b['id']);return rpc[_0x13e1c6[_0x067d('0x29')]+_0x067d('0x3b')][_0x067d('0x3c')](_0x13e1c6[_0x067d('0x2c')]['id'],{'queueId':_0x22018b['id']})[_0x067d('0x3d')](function(){if(rpc[_0x13e1c6[_0x067d('0x29')]+'QueueReport']){return rpc[_0x13e1c6[_0x067d('0x29')]+_0x067d('0x34')][_0x067d('0x3c')](_0x2f1f24,_0x5b34bb)['catch'](function(_0x5a900f){logger[_0x067d('0x37')](_0x067d('0x3e'),_0x5a900f);});}});}}function endRouting(_0x265dea,_0x4f964a,_0x2cfea2,_0x451459){if(_0x265dea&&_0x4f964a){_0x4f964a[_0x067d('0x23')]-=0x1;var _0x3a1a38={'leaveAt':moment()[_0x067d('0x13')](_0x067d('0x25')),'exitAt':moment()[_0x067d('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x067d('0x3f')};logger[_0x067d('0x32')](util[_0x067d('0x13')]('[%s][END:QUEUE][NAME:%s]',_0x265dea,_0x4f964a[_0x067d('0x33')]));emitChannelQueueInteraction(_0x2cfea2[_0x067d('0x29')],_0x4f964a[_0x067d('0x33')],_0x2cfea2['body'],_0x2cfea2[_0x067d('0xb')]['name'],_0x2cfea2[_0x067d('0x2e')]['id'],![],_0x451459);if(rpc[_0x2cfea2['channel']+'QueueReport']){return rpc[_0x2cfea2[_0x067d('0x29')]+_0x067d('0x34')][_0x067d('0x3c')](_0x265dea,_0x3a1a38)[_0x067d('0x36')](function(_0x291c3d){logger['error'](_0x067d('0x3e'),_0x291c3d);});}}}function handleFindQueue(_0x1109e1){return function(_0x403104){return _0x403104['name'][_0x067d('0x40')]()===_0x1109e1[_0x067d('0x40')]();};}exports[_0x067d('0x41')]=function(_0x3184ca,_0x422693,_0x30b269,_0x366392){return function(_0x1915e5){try{var _0x5e13c5={'name':_0x422693[0x0],'timeout':_0x422693[0x1]};var _0x141c6c=queue[_0x067d('0x0')](_0x5e13c5,{'typecast':!![]});if(_0x141c6c[_0x067d('0x42')]){logger[_0x067d('0x37')](_0x067d('0x43'),_0x3184ca,_[_0x067d('0x44')](_0x141c6c,_0x067d('0x2e'))[_0x067d('0x45')](',\x20'));_0x1915e5[_0x067d('0x46')]();}else{var _0x2b2b6e=_[_0x067d('0x47')](_0x30b269[_0x366392[_0x067d('0x29')]+'Queues'],handleFindQueue(_0x5e13c5[_0x067d('0x33')]));if(_0x2b2b6e){startRouting(_0x3184ca,_0x2b2b6e,_0x366392,_0x30b269);var _0x1d4fd8=(_0x2b2b6e[_0x067d('0x3f')]||0xa)*0x3e8;var _0x129adc=(_0x5e13c5['timeout']||0x14)*0x3e8;var _0x39595d;if(_0x1d4fd8>_0x129adc){_0x129adc=_0x1d4fd8;}var _0x2b996a=seqqueue[_0x067d('0x48')](_0x1d4fd8);_0x2b996a['id']=_0x3184ca;_0x2b996a['atimeout']=_0x1d4fd8;_0x2b996a[_0x067d('0x49')]=_0x129adc;_0x2b996a[_0x067d('0x29')]=_0x366392[_0x067d('0x29')];_0x30b269[_0x067d('0x4a')][_0x3184ca]['on'](_0x067d('0x4b'),function(){logger[_0x067d('0x32')](_0x067d('0x4c'),_0x3184ca);stopRouting(_0x3184ca,_0x2b2b6e,_0x366392,_0x30b269);clearTimeout(_0x39595d);_0x39595d=undefined;_0x2b996a['close'](!![]);if(_0x30b269['rules'][_0x3184ca]){delete _0x30b269[_0x067d('0x4a')][_0x3184ca];}_0x1915e5[_0x067d('0x46')]();});_0x30b269[_0x067d('0x4a')][_0x3184ca]['on']('complete',function(){if(_0x30b269['rules'][_0x3184ca]){delete _0x30b269[_0x067d('0x4a')][_0x3184ca];}});_0x39595d=setTimeout(function(){logger[_0x067d('0x32')](_0x067d('0x4d'),_0x3184ca);endRouting(_0x3184ca,_0x2b2b6e,_0x366392,_0x30b269);clearTimeout(_0x39595d);_0x2b996a['close'](!![]);_0x1915e5['next']();},_0x129adc);switch(_0x2b2b6e[_0x067d('0x4e')]){case'rrmemory':strategy[_0x067d('0x4f')](_0x2b996a,_0x2b2b6e,_0x30b269,_0x366392);break;default:strategy[_0x067d('0x50')](_0x2b996a,_0x2b2b6e,_0x30b269,_0x366392);}}else{logger[_0x067d('0x37')](_0x067d('0x51'),_0x3184ca,_0x5e13c5[_0x067d('0x33')]);_0x1915e5[_0x067d('0x46')]();}}}catch(_0x334063){logger[_0x067d('0x37')](_0x067d('0x43'),_0x3184ca,_0x334063[_0x067d('0x52')]);_0x1915e5[_0x067d('0x46')]();}};}; \ 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 ddcbc59..0b6dfd3 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 _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 +var _0x0fda=['lodash','./util','../../../../../config/logger','routing','agent','squeue','push','handleRun','bind','timeout','handleTimeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','busyQueue','saveWaitingNotification','showNotification','notificationId','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','busy','STOP','exports'];(function(_0xe2b3bf,_0x8f706e){var _0x2ae4d3=function(_0x5b962b){while(--_0x5b962b){_0xe2b3bf['push'](_0xe2b3bf['shift']());}};_0x2ae4d3(++_0x8f706e);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x23b272,_0x452586){_0x23b272=_0x23b272-0x0;var _0x42df3b=_0x0fda[_0x23b272];return _0x42df3b;};'use strict';var _=require(_0xa0fd('0x0'));var uuid=require('uuid');var util=require(_0xa0fd('0x1'));var logger=require(_0xa0fd('0x2'))(_0xa0fd('0x3'));var Agent=function(_0x2f71f3,_0x426242,_0xd8e73a,_0x13c734){this['notificationId']=uuid['v4']();this['squeue']=_0x2f71f3;this[_0xa0fd('0x4')]=_0x426242;this['realtime']=_0xd8e73a;this['routing']=_0x13c734;this[_0xa0fd('0x5')][_0xa0fd('0x6')](this[_0xa0fd('0x7')][_0xa0fd('0x8')](this),this['handleTimeout'][_0xa0fd('0x8')](this));this[_0xa0fd('0x5')]['on'](_0xa0fd('0x9'),this[_0xa0fd('0xa')]['bind'](this));this[_0xa0fd('0x5')]['on'](_0xa0fd('0xb'),this[_0xa0fd('0xc')]['bind'](this));};Agent[_0xa0fd('0xd')][_0xa0fd('0x6')]=function(){this[_0xa0fd('0x5')][_0xa0fd('0x6')](this[_0xa0fd('0x7')]['bind'](this),this['handleTimeout'][_0xa0fd('0x8')](this));};Agent[_0xa0fd('0xd')]['handleDrained']=function(){this[_0xa0fd('0xa')](!![]);};Agent[_0xa0fd('0xd')][_0xa0fd('0x7')]=function(){logger[_0xa0fd('0xe')](_0xa0fd('0xf'),this[_0xa0fd('0x5')]['id'],this[_0xa0fd('0x4')]['id']);if(_['isNil'](this[_0xa0fd('0x10')][_0xa0fd('0x11')][this['agent']['id']])){logger['debug'](_0xa0fd('0x12'),this[_0xa0fd('0x5')]['id'],this['agent']['id']);setTimeout(this[_0xa0fd('0x6')][_0xa0fd('0x8')](this),0x3e8);}else{if(this[_0xa0fd('0x3')]['forcedOwnership']||util['isAgentAvailable'](this[_0xa0fd('0x5')]['id'],this['realtime'][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']],this[_0xa0fd('0x5')][_0xa0fd('0x13')],![])){this[_0xa0fd('0x10')][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']]['busy']=!![];this[_0xa0fd('0x10')][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']][_0xa0fd('0x14')]=undefined;util[_0xa0fd('0x15')](this[_0xa0fd('0x10')],this[_0xa0fd('0x3')],this[_0xa0fd('0x4')],this[_0xa0fd('0x5')][_0xa0fd('0x13')]);util[_0xa0fd('0x16')](this[_0xa0fd('0x17')],this[_0xa0fd('0x5')]['id'],this['realtime'][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']],null,this['routing']);util[_0xa0fd('0x18')](this[_0xa0fd('0x5')]['id'],this['realtime']['agents'][this[_0xa0fd('0x4')]['id']],_0xa0fd('0x19')+(this['routing']['forcedOwnership']?':FORCED':''));}else{logger['debug'](_0xa0fd('0x1a'),this['squeue']['id'],this[_0xa0fd('0x4')]['id']);setTimeout(this[_0xa0fd('0x6')][_0xa0fd('0x8')](this),0x3e8);}}};Agent['prototype'][_0xa0fd('0xa')]=function(_0x19c352){if(_[_0xa0fd('0x1b')](this[_0xa0fd('0x10')][_0xa0fd('0x11')][this['agent']['id']])){return logger[_0xa0fd('0xe')](_0xa0fd('0x12'),this[_0xa0fd('0x5')]['id'],this[_0xa0fd('0x4')]['id']);}else{logger['debug'](_0xa0fd('0x1c'),this[_0xa0fd('0x5')]['id'],this['agent']['id']);util['hideNotification'](this['notificationId'],this[_0xa0fd('0x5')]['id'],this['realtime']['agents'][this[_0xa0fd('0x4')]['id']],null,this['routing']);this[_0xa0fd('0x10')][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']][_0xa0fd('0x1d')]=![];this[_0xa0fd('0x10')][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']][_0xa0fd('0x14')]=undefined;util['removeWaitingNotification'](this[_0xa0fd('0x10')],this['routing'],this[_0xa0fd('0x4')],this['squeue']['channel']);util[_0xa0fd('0x18')](this['squeue']['id'],this[_0xa0fd('0x10')][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']],_0x19c352?_0xa0fd('0x1e'):'TIMEOUT');}if(!_0x19c352){setTimeout(this[_0xa0fd('0x6')][_0xa0fd('0x8')](this),0x3e8);}};function agent(_0x3b06ef,_0x3f6146,_0x2e3cfa,_0x31f1e2){return new Agent(_0x3b06ef,_0x3f6146,_0x2e3cfa,_0x31f1e2);}module[_0xa0fd('0x1f')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 60df6e1..10e8c95 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 _0xe1f7=['Agents','length','agents','debug','isAgentAvailable','channel','writeLog','RINGING','busyQueue','name','notificationId','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','STOP','busy','removeWaitingNotification','exports','lodash','uuid','../../../../../config/logger','routing','squeue','queue','realtime','push','handleRun','bind','timeout','drained','handleDrained','prototype','handleTimeout','isNil'];(function(_0x221246,_0x168ceb){var _0x13e1ea=function(_0x17ee22){while(--_0x17ee22){_0x221246['push'](_0x221246['shift']());}};_0x13e1ea(++_0x168ceb);}(_0xe1f7,0x9f));var _0x7e1f=function(_0x156dba,_0x4e513e){_0x156dba=_0x156dba-0x0;var _0xa401c=_0xe1f7[_0x156dba];return _0xa401c;};'use strict';var _=require(_0x7e1f('0x0'));var uuid=require(_0x7e1f('0x1'));var util=require('./util');var logger=require(_0x7e1f('0x2'))(_0x7e1f('0x3'));var Beepall=function(_0x51c22b,_0x45b8b5,_0x5a9a0f,_0x43a81e){this['notificationId']=uuid['v4']();this[_0x7e1f('0x4')]=_0x51c22b;this[_0x7e1f('0x5')]=_0x45b8b5;this[_0x7e1f('0x6')]=_0x5a9a0f;this[_0x7e1f('0x3')]=_0x43a81e;this[_0x7e1f('0x4')][_0x7e1f('0x7')](this[_0x7e1f('0x8')][_0x7e1f('0x9')](this),this['handleTimeout'][_0x7e1f('0x9')](this));this[_0x7e1f('0x4')]['on'](_0x7e1f('0xa'),this['handleTimeout']['bind'](this));this['squeue']['on'](_0x7e1f('0xb'),this[_0x7e1f('0xc')][_0x7e1f('0x9')](this));};Beepall[_0x7e1f('0xd')][_0x7e1f('0x7')]=function(){this[_0x7e1f('0x4')][_0x7e1f('0x7')](this[_0x7e1f('0x8')][_0x7e1f('0x9')](this),this[_0x7e1f('0xe')][_0x7e1f('0x9')](this));};Beepall[_0x7e1f('0xd')][_0x7e1f('0xc')]=function(){this['handleTimeout'](!![]);};Beepall['prototype'][_0x7e1f('0x8')]=function(){var _0x76ed2b=!![];if(!_[_0x7e1f('0xf')](this[_0x7e1f('0x5')])&&!_[_0x7e1f('0xf')](this[_0x7e1f('0x5')][_0x7e1f('0x10')])&&this[_0x7e1f('0x5')][_0x7e1f('0x10')][_0x7e1f('0x11')]>0x0){for(var _0x5f1e76=0x0,_0x4492ae;_0x5f1e760x0){for(var _0x1c1205=0x0,_0x14dc91;_0x1c12050x0&&_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 +var _0x5a93=['hideNotification','interaction','UserId','some','channel','capitalize','InteractionId','agents','saveWaitingNotification','WaitingInteractions','writeLog','util','ioredis','../../../../../config/environment','redis','defaults','socket.io-emitter','format','user:%s','name','emit','user:save','split','account','notificationSound','body','queue','msg','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','notification:%s','save','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY'];(function(_0x403db1,_0x59018e){var _0x47c48f=function(_0x1b663c){while(--_0x1b663c){_0x403db1['push'](_0x403db1['shift']());}};_0x47c48f(++_0x59018e);}(_0x5a93,0xf6));var _0x35a9=function(_0x29e8bf,_0x5bf617){_0x29e8bf=_0x29e8bf-0x0;var _0x439087=_0x5a93[_0x29e8bf];return _0x439087;};'use strict';var _=require('lodash');var util=require(_0x35a9('0x0'));var utils=require('../utils');var Redis=require(_0x35a9('0x1'));var config=require(_0x35a9('0x2'));var logger=require('../../../../../config/logger')('routing');config[_0x35a9('0x3')]=_[_0x35a9('0x4')](config[_0x35a9('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x35a9('0x5'))(new Redis(config[_0x35a9('0x3')]));function sendNotification(_0x2e8a14,_0x354490,_0x271228,_0x45e6f7,_0x71d143,_0x22d770){io['to'](util[_0x35a9('0x6')](_0x35a9('0x7'),_0x45e6f7[_0x35a9('0x8')]))[_0x35a9('0x9')](_0x35a9('0xa'),_0x45e6f7);var _0x2dd7f4=_0x22d770||{};var _0xeca85e=_0x271228[_0x35a9('0xb')]('.');var _0x1e0958={'uniqueid':_0x354490,'channel':_0xeca85e[0x0],'id':_0xeca85e[0x1],'title':_0xeca85e[0x0]+'\x20interaction','interactionId':_0xeca85e[0x2],'queue':_0x71d143?_0x71d143[_0x35a9('0x8')]:null,'sound':_0x2dd7f4[_0x35a9('0xc')][_0x35a9('0xd')],'shake':_0x2dd7f4[_0x35a9('0xc')]['notificationShake']};try{if(!_0x2dd7f4[_0x35a9('0xe')]){_0x2dd7f4[_0x35a9('0xe')]={};}if(_0x71d143){_0x2dd7f4[_0x35a9('0xe')][_0x35a9('0xf')]=_0x71d143;}else if(_0x2dd7f4['body'][_0x35a9('0xf')]){delete _0x2dd7f4[_0x35a9('0xe')][_0x35a9('0xf')];}_0x1e0958[_0x35a9('0x10')]=utils['getMustacheRender'](_0x2dd7f4[_0x35a9('0xc')][_0x35a9('0x11')],_0x2dd7f4);}catch(_0x21b9f1){_0x1e0958['msg']=_0x35a9('0x12');logger[_0x35a9('0x13')](util[_0x35a9('0x6')](_0x35a9('0x14'),_0x354490,_0x21b9f1[_0x35a9('0x15')]));}io['to'](util[_0x35a9('0x6')]('user:%s',_0x45e6f7[_0x35a9('0x8')]))[_0x35a9('0x9')](util[_0x35a9('0x6')](_0x35a9('0x16'),_0x2e8a14?_0x35a9('0x17'):'remove'),_0x1e0958);}function writeLog(_0xa19efe,_0x4d7f2b,_0x354367){return logger[_0x35a9('0x18')](util[_0x35a9('0x6')](_0x35a9('0x19'),_0xa19efe,_0x4d7f2b[_0x35a9('0x8')],_0x354367));}exports[_0x35a9('0x1a')]=function(_0x2bf9ce,_0x26f49a,_0x27032e,_0x5eb97d){if(_0x26f49a[_0x35a9('0x1b')]){writeLog(_0x2bf9ce,_0x26f49a,_0x35a9('0x1c'));return![];}if(!_0x26f49a['online']){writeLog(_0x2bf9ce,_0x26f49a,'OFFLINE');return![];}if(_0x26f49a[_0x27032e+_0x35a9('0x1d')]){writeLog(_0x2bf9ce,_0x26f49a,_0x35a9('0x1e'));return![];}if(_0x5eb97d&&_0x26f49a[_0x35a9('0x1f')](_0x27032e+_0x35a9('0x20'))&&_0x26f49a[_0x35a9('0x1f')](_0x27032e+'CurrentCapacity')){if(_0x26f49a[_0x27032e+_0x35a9('0x20')]>0x0&&_0x26f49a[_0x27032e+_0x35a9('0x21')]>=_0x26f49a[_0x27032e+_0x35a9('0x20')]){writeLog(_0x2bf9ce,_0x26f49a,_0x27032e[_0x35a9('0x22')]()+_0x35a9('0x23'));return![];}}return!![];};exports['showNotification']=function(_0x484212,_0x5dfc9f,_0x2de1e4,_0x555746,_0x3119a6){return sendNotification(!![],_0x484212,_0x5dfc9f,_0x2de1e4,_0x555746,_0x3119a6);};exports[_0x35a9('0x24')]=function(_0x5e3631,_0x22835a,_0x4cd0b3,_0x1fc384,_0x42b5bd){return sendNotification(![],_0x5e3631,_0x22835a,_0x4cd0b3,_0x1fc384,_0x42b5bd);};exports['checkWaitingNotifications']=function(_0x534455,_0x16ee46,_0x207444){var _0x3f90fa=_0x16ee46[_0x35a9('0x25')][_0x35a9('0x26')];if(!_0x3f90fa&&_0x207444){_0x3f90fa=_0x207444['id'];}var _0x15ac13=_[_0x35a9('0x27')](_0x534455[_0x16ee46[_0x35a9('0x28')]+'QueuesWaitingInteractions'],function(_0x39fa5a){var _0x23abfd=_[_0x35a9('0x29')](_0x16ee46[_0x35a9('0x28')])+_0x35a9('0x2a');return _0x39fa5a[_0x23abfd]===_0x16ee46[_0x35a9('0x25')]['id'];});if(!_0x15ac13&&_0x3f90fa&&_0x534455['agents'][_0x3f90fa]){_0x15ac13=_[_0x35a9('0x27')](_0x534455[_0x35a9('0x2b')][_0x3f90fa][_0x16ee46[_0x35a9('0x28')]+'WaitingInteractions'],function(_0x37bd4c){return _0x37bd4c['id']===_0x16ee46['interaction']['id'];});}return _0x15ac13;};exports[_0x35a9('0x2c')]=function(_0x40ea7a,_0xd53b5d,_0xc07d46,_0x1445f1){if(_0xc07d46&&_0xc07d46['id']&&_0x40ea7a[_0x35a9('0x2b')]&&_0x40ea7a['agents'][_0xc07d46['id']]){_0x40ea7a['agents'][_0xc07d46['id']][_0x1445f1+_0x35a9('0x2d')][_0xd53b5d[_0x35a9('0x15')]['id']]={'id':_0xd53b5d['interaction']['id']};}};exports['removeWaitingNotification']=function(_0x294cfb,_0x569f7f,_0x5d4504,_0x58831e){if(_0x5d4504&&_0x5d4504['id']&&_0x294cfb[_0x35a9('0x2b')]&&_0x294cfb[_0x35a9('0x2b')][_0x5d4504['id']]){delete _0x294cfb['agents'][_0x5d4504['id']][_0x58831e+_0x35a9('0x2d')][_0x569f7f[_0x35a9('0x15')]['id']];}};exports[_0x35a9('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 bc8c049..c0f5bc7 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 _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 +var _0x49bb=['lodash','./utils','../../../../config/logger','routing','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','isObject','stringify'];(function(_0x43a5c7,_0x2286bf){var _0x3b12a2=function(_0x1f8f53){while(--_0x1f8f53){_0x43a5c7['push'](_0x43a5c7['shift']());}};_0x3b12a2(++_0x2286bf);}(_0x49bb,0xc6));var _0xb49b=function(_0x3180c8,_0x48ab2a){_0x3180c8=_0x3180c8-0x0;var _0x3b6865=_0x49bb[_0x3180c8];return _0x3b6865;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require(_0xb49b('0x0'));var utils=require(_0xb49b('0x1'));var logger=require(_0xb49b('0x2'))(_0xb49b('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x14aa98,_0xeede15){return function(_0x45f4b5){try{var _0x4c3502={'command':_0xeede15[0x0]};var _0x5526a7=system['validate'](_0x4c3502,{'typecast':!![]});if(_0x5526a7['length']){logger[_0xb49b('0x4')](_0xb49b('0x5'),_0x14aa98,_[_0xb49b('0x6')](_0x5526a7,_0xb49b('0x7'))[_0xb49b('0x8')](',\x20'));logger[_0xb49b('0x9')](_0xb49b('0xa'),_0x14aa98);_0x45f4b5[_0xb49b('0xb')]();}else{var _0x97d613=this;var _0x16d740=utils[_0xb49b('0xc')](_0xeede15[0x0],this);logger[_0xb49b('0x9')](_0xb49b('0xd'),_0x14aa98,_0x16d740);sh['exec'](_[_0xb49b('0xe')](_0x16d740),function(_0x31ec0f,_0x2b1ec9){logger[_0xb49b('0x9')](_0xb49b('0xf'),_0x14aa98,_0x31ec0f);if(_0x31ec0f==0x0){var _0x4de12a=_0x2b1ec9['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xb49b('0x10')](_0xeede15[0x1])||_[_0xb49b('0x11')](_0xeede15[0x1])){logger[_0xb49b('0x9')](_0xb49b('0x12'),_0x14aa98);_0x97d613[_0xb49b('0x13')][_0xeede15[0x1]]=_0x4de12a;}else{logger[_0xb49b('0x9')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x14aa98,_0xeede15[0x1],_0x4de12a);_0x97d613[_0xb49b('0x13')][_0xeede15[0x1]]=_0x4de12a;}}_0x45f4b5[_0xb49b('0xb')]();});}}catch(_0x4df11e){logger[_0xb49b('0x4')](_0xb49b('0x5'),_0x14aa98,_[_0xb49b('0x14')](_0x4df11e)?JSON[_0xb49b('0x15')](_0x4df11e):_0x4df11e);logger[_0xb49b('0x9')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x14aa98);_0x45f4b5[_0xb49b('0xb')]();}};}; \ 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 6c0a79e..789528a 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 _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 +var _0x311f=['../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','[%s][TAG]\x20%s','map','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','addTags','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','channel','interaction','catch','error','finally','stringify','info','validate','lodash','../../rpc/chatInteraction'];(function(_0x3fefac,_0x212363){var _0x52d655=function(_0x4e59e9){while(--_0x4e59e9){_0x3fefac['push'](_0x3fefac['shift']());}};_0x52d655(++_0x212363);}(_0x311f,0x126));var _0xf311=function(_0x58dce4,_0x31434c){_0x58dce4=_0x58dce4-0x0;var _0x5dfd88=_0x311f[_0x58dce4];return _0x5dfd88;};'use strict';var schema=require(_0xf311('0x0'));var _=require(_0xf311('0x1'));var rpc={'chatInteraction':require(_0xf311('0x2')),'openchannelInteraction':require(_0xf311('0x3')),'smsInteraction':require(_0xf311('0x4')),'mailInteraction':require(_0xf311('0x5')),'faxInteraction':require(_0xf311('0x6')),'whatsappInteraction':require(_0xf311('0x7'))};var logger=require(_0xf311('0x8'))(_0xf311('0x9'));var tag=schema({'tag':{'type':_0xf311('0xa'),'required':!![],'message':_0xf311('0xb')}});exports['consequence']=function(_0x3b1e23,_0x31eacb,_0x5ce777,_0x526917){return function(_0x4e742f){try{var _0x1224b8={'tag':_0x31eacb[0x0]};var _0x7afbe9=tag[_0xf311('0x0')](_0x1224b8,{'typecast':!![]});if(_0x7afbe9[_0xf311('0xc')]){logger['error'](_0xf311('0xd'),_0x3b1e23,_[_0xf311('0xe')](_0x7afbe9,'message')['join'](',\x20'));logger['info'](_0xf311('0xf'),_0x3b1e23);_0x4e742f[_0xf311('0x10')]();}else{var _0x4793e0={'ids':[_0x31eacb[0x0]]};if(rpc[_0x526917['channel']+_0xf311('0x11')]){rpc[_0x526917['channel']+_0xf311('0x11')][_0xf311('0x12')](_0x526917['interaction']['id'],_0x4793e0)['then'](function(_0x544bdf){logger['info'](_0xf311('0x13'),_0x3b1e23,_0x31eacb[0x1],_0x526917[_0xf311('0x14')],_0x526917[_0xf311('0x15')]['id']);})[_0xf311('0x16')](function(_0x437a81){logger[_0xf311('0x17')](_0xf311('0xd'),_0x3b1e23,JSON['stringify'](_0x437a81));logger['info'](_0xf311('0xf'),_0x3b1e23);})[_0xf311('0x18')](function(){_0x4e742f[_0xf311('0x10')]();});}}}catch(_0x4769a2){logger[_0xf311('0x17')](_0xf311('0xd'),_0x3b1e23,_['isObject'](_0x4769a2)?JSON[_0xf311('0x19')](_0x4769a2):_0x4769a2);logger[_0xf311('0x1a')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3b1e23);_0x4e742f[_0xf311('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 dc29e1f..615ddfd 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 _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 +var _0x3ab6=['info','next','request-promise','../../../../config/logger','consequence','replace','includes','?params=','urlOnRing','title','jsonrpc','method','login','push','params','utf8','POST','then','parse','result','channelId=','&serviceId=','&data=','stringify','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','isObject','stop'];(function(_0x9ace37,_0x4d1159){var _0x23ecc0=function(_0xda11a){while(--_0xda11a){_0x9ace37['push'](_0x9ace37['shift']());}};_0x23ecc0(++_0x4d1159);}(_0x3ab6,0x16e));var _0x63ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ab6[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require(_0x63ab('0x0'));var logger=require(_0x63ab('0x1'))('routing');var _=require('lodash');var arr=[];exports[_0x63ab('0x2')]=function(_0x5e167c,_0x21f957){return function(_0x5ed95a){var _0x5039cf=_0x21f957[0xa];var _0x4afded=_0x21f957[0xb];var _0x508d3b=_0x21f957[0xc];var _0x46adc2=_0x21f957[0xd];var _0x1f3088=_0x21f957[0xe];var _0x2d7c74=_0x21f957[0xf][_0x63ab('0x3')](/\n/g,'\x20-\x20');var _0x58eba6=_0x21f957[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x63ab('0x4')](_0x4afded)){arr['push'](_0x4afded);var _0x14ccc8=_0x21f957[0x3];var _0x2a5df1=_0x21f957[0x4];var _0x2ca658=_0x21f957[0x1];var _0x5139e1=_0x21f957[0x0];var _0x2765ed={};_0x2765ed['urlOnAnswer']=_0x21f957[0x8]+_0x63ab('0x5')+_0x508d3b+'|'+_0x5039cf+'|'+_0x46adc2+'|'+_0x4afded+'|'+_0x1f3088;_0x2765ed[_0x63ab('0x6')]=_0x21f957[0x7]+'?params='+_0x508d3b+'|'+_0x5039cf+'|'+_0x46adc2+'|'+_0x4afded+'|'+_0x1f3088+'|'+_0x2d7c74+'|'+_0x58eba6;_0x2765ed[_0x63ab('0x7')]=_0x21f957[0x9];var _0x3247e6={};_0x3247e6[_0x63ab('0x8')]='2.0';_0x3247e6[_0x63ab('0x9')]=_0x63ab('0xa');var _0x5d3e98=[];_0x5d3e98[_0x63ab('0xb')](_0x21f957[0x2]);_0x5d3e98[_0x63ab('0xb')](_0x21f957[0x5]);_0x5d3e98[_0x63ab('0xb')](_0x21f957[0x6]);_0x3247e6[_0x63ab('0xc')]=_0x5d3e98;_0x3247e6['id']=0x1;var _0x1e938d=JSON['stringify'](_0x3247e6);var _0x5f090f={'encoding':_0x63ab('0xd'),'method':_0x63ab('0xe'),'timeout':0x2710,'url':_0x14ccc8,'headers':{'Content-Type':'application/json-rpc'},'body':_0x1e938d};return rp(_0x5f090f)[_0x63ab('0xf')](function(_0x445477){const _0x325647=JSON[_0x63ab('0x10')](_0x445477);if(!_0x325647[_0x63ab('0x11')]['logged']){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x4cd5b2=_0x4afded;var _0x4f46e4=_0x63ab('0x12')+_0x2ca658+_0x63ab('0x13')+_0x5139e1+'&sessionId='+_0x4cd5b2+_0x63ab('0x14')+JSON[_0x63ab('0x15')](_0x2765ed);var _0x362a7e=_0x2a5df1+'?'+_0x4f46e4;return rp(_0x362a7e);})[_0x63ab('0xf')](function(_0x1a1de4){logger['info'](_0x63ab('0x16'),_0x5e167c,_0x1a1de4);_0x5ed95a['stop']();})[_0x63ab('0x17')](function(_0x2e7d7a){logger['error']('[%s][TVOX]\x20%s',_0x5e167c,_[_0x63ab('0x18')](_0x2e7d7a)?JSON[_0x63ab('0x15')](_0x2e7d7a):_0x2e7d7a);_0x5ed95a[_0x63ab('0x19')]();});}else{logger[_0x63ab('0x1a')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x5e167c);_0x5ed95a[_0x63ab('0x1b')]();}};}; \ 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 2ca7ba7..ed34b8c 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(_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 +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x44ab4a,_0x3c1de4){var _0x938cb1=function(_0x1732ec){while(--_0x1732ec){_0x44ab4a['push'](_0x44ab4a['shift']());}};_0x938cb1(++_0x3c1de4);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 53c1d25..3ec42df 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 _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 +var _0x6616=['../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','join','.js','toLowerCase','autoreply','appdata','mail','push','dialogflow','split','slice','dialogflowv2','amazonlex','tvox','getMustacheRender','notificationTemplate','ChatWebsiteId','body','app','./interval','condition','./applications/','consequence','info','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','emit','complete','No\x20applications\x20to\x20execute','stack','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','CurrentCapacity','capacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','name','waiting','mailQueues','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','bluebird','./applications/utils','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6616,0x183));var _0x6661=function(_0xb6695a,_0xf61eff){_0xb6695a=_0xb6695a-0x0;var _0x323e3c=_0x6616[_0xb6695a];return _0x323e3c;};'use strict';var _=require('lodash');var util=require(_0x6661('0x0'));var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x6661('0x1'));var utils=require(_0x6661('0x2'));var sUtils=require('./applications/strategy/util');var logger=require(_0x6661('0x3'))(_0x6661('0x4'));var rpc={'openchannelQueueReport':require(_0x6661('0x5')),'mailQueueReport':require(_0x6661('0x6')),'chatQueueReport':require(_0x6661('0x7')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x6661('0x8')),'whatsappQueueReport':require(_0x6661('0x9'))};var RuleEngine=require(_0x6661('0xa'));function getId(_0x254903,_0x10586a,_0x4ea778){return util[_0x6661('0xb')]('%s.%s.%s',_0x254903,_0x10586a||0x0,_0x4ea778||0x0);}function getIntervals(_0x20010f,_0x40aa71){var _0x4121f9=[];if(!_[_0x6661('0xc')](_0x40aa71[_0x6661('0xd')])&&!_[_0x6661('0xc')](_0x20010f[_0x40aa71[_0x6661('0xd')]])&&!_[_0x6661('0xc')](_0x20010f[_0x40aa71['IntervalId']][_0x6661('0xe')])){_0x4121f9=_['map'](_0x20010f[_0x40aa71[_0x6661('0xd')]]['Intervals'],_0x6661('0xf'));}else if(!_['isNil'](_0x40aa71[_0x6661('0xf')])){_0x4121f9=[_0x40aa71[_0x6661('0xf')]];}return _0x4121f9;}exports[_0x6661('0x10')]=function(_0x5d42a6){_0x5d42a6[_0x6661('0x11')]={};return new BPromise(function(_0x599281,_0x2f1ef4){var _0x32c3fa={'Start':function(_0x39cca5){var _0x5eb6f5=this;return new Promise(function(_0x3a1f70,_0x454667){if(_0x39cca5){try{var _0x2b5859=[];var _0x1f80b8=getId(_0x39cca5[_0x6661('0x12')],_0x39cca5[_0x6661('0x13')]?_0x39cca5[_0x6661('0x13')]['id']:0x0,_0x39cca5[_0x6661('0x14')]?_0x39cca5['interaction']['id']:0x0);var _0x456e38=sUtils[_0x6661('0x15')](_0x5d42a6,_0x39cca5);if(!_0x456e38&&_0x39cca5[_0x6661('0x16')]&&_[_0x6661('0x17')](_0x39cca5[_0x6661('0x16')])&&_0x39cca5[_0x6661('0x16')][_0x6661('0x18')]){for(var _0x4e0301=0x0;_0x4e0301<_0x39cca5['applications'][_0x6661('0x18')];_0x4e0301+=0x1){var _0x5e321c=_0x39cca5[_0x6661('0x16')][_0x4e0301];if(fs[_0x6661('0x19')](path[_0x6661('0x1a')](__dirname,_0x6661('0x16'),_0x5e321c['app']+_0x6661('0x1b')))){var _0x6e9b9c=[];switch(_0x5e321c['app'][_0x6661('0x1c')]()){case _0x6661('0x1d'):var _0x120207=_0x5e321c[_0x6661('0x1e')]['split'](',');if(_0x39cca5[_0x6661('0x12')]===_0x6661('0x1f')){_0x6e9b9c['push'](_0x120207[0x0]);_0x6e9b9c[_0x6661('0x20')](_0x120207[0x1]);_0x6e9b9c[_0x6661('0x20')](_0x120207['slice'](0x2,_0x120207[_0x6661('0x18')])[_0x6661('0x1a')](','));}else{_0x6e9b9c[_0x6661('0x20')](_0x120207[0x0]);_0x6e9b9c[_0x6661('0x20')](_0x120207['slice'](0x1,_0x120207['length'])[_0x6661('0x1a')](','));}break;case _0x6661('0x21'):var _0x4a2355=_0x5e321c[_0x6661('0x1e')][_0x6661('0x22')](',');_0x6e9b9c[_0x6661('0x20')](_0x4a2355[0x0]);_0x6e9b9c[_0x6661('0x20')](_0x4a2355[0x1]);_0x6e9b9c['push'](_0x4a2355[_0x6661('0x23')](0x2,_0x4a2355[_0x6661('0x18')])['join'](','));break;case _0x6661('0x24'):var _0x1ee9ce=_0x5e321c[_0x6661('0x1e')][_0x6661('0x22')](',');_0x6e9b9c['push'](_0x1ee9ce[0x0]);_0x6e9b9c['push'](_0x1ee9ce[0x1]);_0x6e9b9c[_0x6661('0x20')](_0x1ee9ce[0x2]);_0x6e9b9c['push'](_0x1ee9ce[0x3]);_0x6e9b9c[_0x6661('0x20')](_0x1ee9ce[_0x6661('0x23')](0x4,_0x1ee9ce[_0x6661('0x18')])[_0x6661('0x1a')](','));break;case _0x6661('0x25'):var _0x18e8fb=_0x5e321c[_0x6661('0x1e')][_0x6661('0x22')](',');_0x6e9b9c[_0x6661('0x20')](_0x18e8fb[0x0]);_0x6e9b9c['push'](_0x18e8fb[0x1]);_0x6e9b9c['push'](_0x18e8fb[0x2]);_0x6e9b9c['push'](_0x18e8fb[0x3]);_0x6e9b9c[_0x6661('0x20')](_0x18e8fb[_0x6661('0x23')](0x4,_0x18e8fb[_0x6661('0x18')])['join'](','));break;case _0x6661('0x13'):_0x6e9b9c[_0x6661('0x20')](_0x5e321c[_0x6661('0x1e')]);break;case'tag':_0x6e9b9c['push'](_0x5e321c['TagId']);_0x6e9b9c[_0x6661('0x20')](_0x5e321c[_0x6661('0x1e')]);break;case _0x6661('0x26'):var _0x46964f=utils[_0x6661('0x27')](_0x39cca5['account'][_0x6661('0x28')],_0x39cca5);var _0x599ee2=_0x5e321c[_0x6661('0x1e')][_0x6661('0x22')](',');_0x6e9b9c[_0x6661('0x20')](_0x599ee2[0x0]);_0x6e9b9c[_0x6661('0x20')](_0x599ee2[0x1]);_0x6e9b9c['push'](_0x599ee2[0x2]);_0x6e9b9c['push'](_0x599ee2[0x3]);_0x6e9b9c[_0x6661('0x20')](_0x599ee2[0x4]);_0x6e9b9c[_0x6661('0x20')](_0x599ee2[0x5]);_0x6e9b9c[_0x6661('0x20')](_0x599ee2[0x6]);_0x6e9b9c['push'](_0x599ee2[0x7]);_0x6e9b9c[_0x6661('0x20')](_0x599ee2[0x8]);_0x6e9b9c[_0x6661('0x20')](_0x599ee2[0x9]);_0x6e9b9c[_0x6661('0x20')](_0x599ee2[0xa]);_0x6e9b9c[_0x6661('0x20')](_0x39cca5['interaction']['id']);_0x6e9b9c[_0x6661('0x20')](_0x39cca5[_0x6661('0x13')]['id']);_0x6e9b9c[_0x6661('0x20')](_0x5e321c[_0x6661('0x29')]);_0x6e9b9c['push'](_0x39cca5[_0x6661('0x14')]['ContactId']);_0x6e9b9c[_0x6661('0x20')](_0x39cca5['body'][_0x6661('0x2a')]);_0x6e9b9c[_0x6661('0x20')](_0x46964f);break;default:_0x6e9b9c=_['isNil'](_0x5e321c[_0x6661('0x1e')])?[]:_0x5e321c['appdata'][_0x6661('0x22')](',');}var _0x469251={'id':util[_0x6661('0xb')]('%s:%s:%s',_0x1f80b8,_0x5e321c['id'],_0x5e321c[_0x6661('0x2b')]),'condition':require(_0x6661('0x2c'))[_0x6661('0x2d')](_0x1f80b8,getIntervals(_0x5d42a6['intervals'],_0x5e321c),_0x5d42a6),'consequence':require(_0x6661('0x2e')+_0x5e321c[_0x6661('0x2b')])[_0x6661('0x2f')](_0x1f80b8,_0x6e9b9c,_0x5d42a6,_0x39cca5),'p':_0x5e321c['priority']||0x0};logger[_0x6661('0x30')]('Push\x20new\x20rule',_0x469251['id'],_0x6661('0x31'),getIntervals(_0x5d42a6[_0x6661('0x32')],_0x5e321c)[_0x6661('0x1a')](_0x6661('0x33')));_0x2b5859[_0x6661('0x20')](_0x469251);}else{logger[_0x6661('0x34')](_0x6661('0x35'),path[_0x6661('0x1a')](__dirname,_0x6661('0x16'),_0x5e321c[_0x6661('0x2b')]+'.js'));}}_0x5d42a6['rules'][_0x1f80b8]=new RuleEngine(_0x2b5859);_0x5d42a6['rules'][_0x1f80b8][_0x6661('0x36')](_0x39cca5,function(_0x27980b){logger[_0x6661('0x30')](_0x6661('0x37'),JSON[_0x6661('0x38')](_0x27980b['matchPath']));if(_0x5d42a6['rules'][_0x1f80b8]){_0x5d42a6[_0x6661('0x11')][_0x1f80b8][_0x6661('0x39')](_0x6661('0x3a'));}});return _0x3a1f70({'code':0xc8,'message':_0x39cca5});}else{if(_0x456e38){logger['info'](util[_0x6661('0xb')]('Skipped\x20routing\x20for\x20%s',_0x1f80b8));}else{logger[_0x6661('0x30')](_0x6661('0x3b'));}return _0x3a1f70({'code':0xc8,'message':_0x39cca5});}}catch(_0x531b85){logger['error'](_0x531b85[_0x6661('0x3c')]);return _0x454667(_0x5eb6f5[_0x6661('0x34')](0x1f4,_0x531b85));}}return _0x454667('routing\x20is\x20empty');});},'AcceptMessage':function(_0x2c1d9e){var _0x2664a8=this;return new Promise(function(_0x2fd62c,_0x499c52){if(_0x2c1d9e[_0x6661('0x3d')]&&_0x2c1d9e[_0x6661('0x3d')]['id']){if(_0x5d42a6[_0x6661('0x3e')][_0x2c1d9e[_0x6661('0x3d')]['id']]){_0x5d42a6[_0x6661('0x3e')][_0x2c1d9e[_0x6661('0x3d')]['id']][_0x6661('0x3f')]=![];_0x5d42a6[_0x6661('0x3e')][_0x2c1d9e[_0x6661('0x3d')]['id']][_0x6661('0x40')]=undefined;}}if(_0x2c1d9e[_0x6661('0x13')]&&_0x2c1d9e['message']['id']){try{var _0x13ffcd=getId(_0x2c1d9e[_0x6661('0x12')],_0x2c1d9e['message']?_0x2c1d9e['message']['id']:0x0,_0x2c1d9e['interaction']?_0x2c1d9e[_0x6661('0x14')]['id']:0x0);if(_0x5d42a6[_0x6661('0x11')][_0x13ffcd]){_0x5d42a6[_0x6661('0x11')][_0x13ffcd]['emit'](_0x6661('0x41'));if(rpc[_0x2c1d9e[_0x6661('0x12')]+_0x6661('0x42')]){rpc[_0x2c1d9e[_0x6661('0x12')]+'QueueReport'][_0x6661('0x43')](_0x13ffcd,{'UserId':_0x2c1d9e['message'][_0x6661('0x44')]})[_0x6661('0x45')](function(){logger[_0x6661('0x34')](_0x6661('0x46'));});}}return _0x2fd62c({'code':0xc8,'message':_0x2c1d9e});}catch(_0x2b88ce){logger[_0x6661('0x34')](_0x2b88ce[_0x6661('0x3c')]);return _0x499c52(_0x2664a8[_0x6661('0x34')](0x1f4,_0x2b88ce));}}logger['error']('message\x20is\x20empty');return _0x499c52(_0x2664a8[_0x6661('0x34')](0x1f4,_0x6661('0x47')));});},'RejectMessage':function(_0x3497a8){var _0x3e85b5=this;return new Promise(function(_0x4093dd,_0x139ead){if(_0x3497a8['agent']&&_0x3497a8[_0x6661('0x3d')]['id']){try{if(_0x5d42a6['agents'][_0x3497a8[_0x6661('0x3d')]['id']]){_0x5d42a6[_0x6661('0x3e')][_0x3497a8[_0x6661('0x3d')]['id']]['busy']=![];_0x5d42a6[_0x6661('0x3e')][_0x3497a8[_0x6661('0x3d')]['id']]['busyQueue']=undefined;}return _0x4093dd({'code':0xc8,'message':_0x3497a8});}catch(_0x1e18d1){logger[_0x6661('0x34')](_0x1e18d1[_0x6661('0x3c')]);return _0x139ead(_0x3e85b5[_0x6661('0x34')](0x1f4,_0x1e18d1));}}logger[_0x6661('0x34')](_0x6661('0x47'));return _0x139ead(_0x3e85b5[_0x6661('0x34')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x3fc298){var _0x305993=this;return new Promise(function(_0x54b64a,_0x4a776b){if(_0x3fc298[_0x6661('0x12')]&&_0x3fc298[_0x6661('0x14')]&&_0x3fc298[_0x6661('0x14')]['id']){try{var _0x577a9a=getId(_0x3fc298['channel'],_0x3fc298[_0x6661('0x13')]?_0x3fc298['message']['id']:0x0,_0x3fc298[_0x6661('0x14')]?_0x3fc298['interaction']['id']:0x0);if(_0x5d42a6[_0x6661('0x11')][_0x577a9a]){_0x5d42a6[_0x6661('0x11')][_0x577a9a][_0x6661('0x39')](_0x6661('0x41'));}return _0x54b64a({'code':0xc8,'message':_0x3fc298});}catch(_0x118613){logger[_0x6661('0x34')](_0x118613['stack']);return _0x4a776b(_0x305993[_0x6661('0x34')](0x1f4,_0x118613));}}logger['error'](_0x6661('0x47'));return _0x4a776b(_0x305993['error'](0x1f4,_0x6661('0x47')));});},'AgentCapacity':function(_0x2594c7){var _0x555f6b=this;return new Promise(function(_0x527e7e,_0x396231){if(_0x5d42a6[_0x6661('0x3e')][_0x6661('0x48')](_0x2594c7['id'])){for(var _0x4f2605 in _0x2594c7['capacity']){if(_0x2594c7['capacity'][_0x6661('0x48')](_0x4f2605)){if(_0x5d42a6['agents'][_0x2594c7['id']][_0x6661('0x48')](_0x4f2605+'CurrentCapacity')){_0x5d42a6[_0x6661('0x3e')][_0x2594c7['id']][_0x4f2605+_0x6661('0x49')]=parseInt(_0x2594c7[_0x6661('0x4a')][_0x4f2605],0xa);}}}_0x5d42a6[_0x6661('0x3e')][_0x2594c7['id']][_0x6661('0x4b')]();return _0x527e7e({'code':0xc8,'message':_0x5d42a6['agents'][_0x2594c7['id']]});}else{return _0x396231(_0x555f6b[_0x6661('0x34')](0x1f4,_0x6661('0x4c')));}});},'Agents':function(_0x1a0dd9){return new Promise(function(_0x25c714){var _0x5dbb87=_[_0x6661('0x4d')](_0x5d42a6[_0x6661('0x3e')]);if(_0x1a0dd9&&_0x1a0dd9['id']){var _0x27ef62=_[_0x6661('0x4e')](_0x5dbb87,function(_0x29229a){return _0x29229a['id']===_0x1a0dd9['id'];});_0x25c714(_0x27ef62);}else{_0x25c714({'count':_0x5dbb87[_0x6661('0x18')],'rows':_0x5dbb87});}});},'ChatQueues':function(){return new Promise(function(_0x51158f){var _0x563d41=[];for(var _0x728b16 in _0x5d42a6[_0x6661('0x4f')]){if(_0x5d42a6['chatQueues']['hasOwnProperty'](_0x728b16)){var _0xe9b82f=_0x5d42a6['chatQueues'][_0x728b16];var _0x2b8ce3={'id':_0xe9b82f['id'],'available':_0xe9b82f[_0x6661('0x50')],'loggedIn':_0xe9b82f[_0x6661('0x51')],'name':_0xe9b82f[_0x6661('0x52')],'paused':_0xe9b82f['paused'],'waiting':_0xe9b82f[_0x6661('0x53')]};_0x563d41[_0x6661('0x20')](_0x2b8ce3);}}_0x51158f({'count':_0x563d41[_0x6661('0x18')],'rows':_0x563d41});});},'MailQueues':function(){return new Promise(function(_0x7d6229){var _0x5e572b=[];for(var _0x690b0f in _0x5d42a6[_0x6661('0x54')]){if(_0x5d42a6[_0x6661('0x54')][_0x6661('0x48')](_0x690b0f)){var _0x669826=_0x5d42a6[_0x6661('0x54')][_0x690b0f];var _0x4bab0a={'id':_0x669826['id'],'available':_0x669826[_0x6661('0x50')],'loggedIn':_0x669826[_0x6661('0x51')],'name':_0x669826['name'],'paused':_0x669826[_0x6661('0x55')],'waiting':_0x669826[_0x6661('0x53')]};_0x5e572b[_0x6661('0x20')](_0x4bab0a);}}_0x7d6229({'count':_0x5e572b[_0x6661('0x18')],'rows':_0x5e572b});});},'OpenchannelQueues':function(){return new Promise(function(_0x16d96d){var _0x3fa8fb=[];for(var _0x1038ca in _0x5d42a6[_0x6661('0x56')]){if(_0x5d42a6[_0x6661('0x56')][_0x6661('0x48')](_0x1038ca)){var _0x534949=_0x5d42a6[_0x6661('0x56')][_0x1038ca];var _0x2f6ece={'id':_0x534949['id'],'available':_0x534949['available'],'loggedIn':_0x534949[_0x6661('0x51')],'name':_0x534949[_0x6661('0x52')],'paused':_0x534949[_0x6661('0x55')],'waiting':_0x534949[_0x6661('0x53')]};_0x3fa8fb[_0x6661('0x20')](_0x2f6ece);}}_0x16d96d({'count':_0x3fa8fb[_0x6661('0x18')],'rows':_0x3fa8fb});});},'SmsQueues':function(){return new Promise(function(_0x32422e){var _0x5b3b00=[];for(var _0x11db0b in _0x5d42a6[_0x6661('0x57')]){if(_0x5d42a6[_0x6661('0x57')][_0x6661('0x48')](_0x11db0b)){var _0xa2d9ad=_0x5d42a6[_0x6661('0x57')][_0x11db0b];var _0x271546={'id':_0xa2d9ad['id'],'available':_0xa2d9ad[_0x6661('0x50')],'loggedIn':_0xa2d9ad[_0x6661('0x51')],'name':_0xa2d9ad['name'],'paused':_0xa2d9ad[_0x6661('0x55')],'waiting':_0xa2d9ad['waiting']};_0x5b3b00['push'](_0x271546);}}_0x32422e({'count':_0x5b3b00[_0x6661('0x18')],'rows':_0x5b3b00});});},'FaxQueues':function(){return new Promise(function(_0x211861){var _0x1473f6=[];for(var _0x41afea in _0x5d42a6[_0x6661('0x58')]){if(_0x5d42a6['faxQueues'][_0x6661('0x48')](_0x41afea)){var _0x49e8d2=_0x5d42a6['faxQueues'][_0x41afea];var _0x413506={'id':_0x49e8d2['id'],'available':_0x49e8d2[_0x6661('0x50')],'loggedIn':_0x49e8d2[_0x6661('0x51')],'name':_0x49e8d2[_0x6661('0x52')],'paused':_0x49e8d2[_0x6661('0x55')],'waiting':_0x49e8d2[_0x6661('0x53')]};_0x1473f6[_0x6661('0x20')](_0x413506);}}_0x211861({'count':_0x1473f6[_0x6661('0x18')],'rows':_0x1473f6});});},'WhatsappQueues':function(){return new Promise(function(_0x83639f){var _0x4f4a20=[];for(var _0x4cda65 in _0x5d42a6[_0x6661('0x59')]){if(_0x5d42a6[_0x6661('0x59')][_0x6661('0x48')](_0x4cda65)){var _0x12d370=_0x5d42a6['whatsappQueues'][_0x4cda65];var _0x17812b={'id':_0x12d370['id'],'available':_0x12d370['available'],'loggedIn':_0x12d370['loggedIn'],'name':_0x12d370[_0x6661('0x52')],'paused':_0x12d370[_0x6661('0x55')],'waiting':_0x12d370[_0x6661('0x53')]};_0x4f4a20[_0x6661('0x20')](_0x17812b);}}_0x83639f({'count':_0x4f4a20[_0x6661('0x18')],'rows':_0x4f4a20});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x3ae1da){var _0x599958=_[_0x6661('0x4d')](_0x5d42a6[_0x6661('0x5a')]);_0x3ae1da({'count':_0x599958['length'],'rows':_0x599958});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x47c3f9){var _0x21d3f0=_[_0x6661('0x4d')](_0x5d42a6['mailQueuesWaitingInteractions']);_0x47c3f9({'count':_0x21d3f0[_0x6661('0x18')],'rows':_0x21d3f0});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x1c3dd1){var _0x5a3076=_['values'](_0x5d42a6[_0x6661('0x5b')]);_0x1c3dd1({'count':_0x5a3076[_0x6661('0x18')],'rows':_0x5a3076});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x26979d){var _0x196b66=_[_0x6661('0x4d')](_0x5d42a6[_0x6661('0x5c')]);_0x26979d({'count':_0x196b66['length'],'rows':_0x196b66});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x432736){var _0x26204e=_[_0x6661('0x4d')](_0x5d42a6['faxQueuesWaitingInteractions']);_0x432736({'count':_0x26204e[_0x6661('0x18')],'rows':_0x26204e});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x17dd75){var _0x29bbfe=_[_0x6661('0x4d')](_0x5d42a6[_0x6661('0x5d')]);_0x17dd75({'count':_0x29bbfe['length'],'rows':_0x29bbfe});});}};var _0x3552ba=jayson[_0x6661('0x5e')](_0x32c3fa)['http']();_0x3552ba['on'](_0x6661('0x34'),function(_0x275858){logger[_0x6661('0x34')](JSON[_0x6661('0x38')](_0x275858));return _0x2f1ef4(_0x275858);});_0x3552ba[_0x6661('0x10')](0x232c,_0x6661('0x5f'),function(){console[_0x6661('0x60')](_0x6661('0x61'),0x232c);return _0x599281(_0x6661('0x62')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 790bf23..811ed97 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 _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 +var _0x99e9=['lodash','../../../utils/iftime','iftime','../../../config/logger','routing','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','map','some','[%s][INTERVAL\x20VALID]\x20%s\x20%s','when','info','\x20|\x20'];(function(_0x277b55,_0x8ba28){var _0xff0d15=function(_0x1beefc){while(--_0x1beefc){_0x277b55['push'](_0x277b55['shift']());}};_0xff0d15(++_0x8ba28);}(_0x99e9,0x168));var _0x999e=function(_0x364cf8,_0x146b9b){_0x364cf8=_0x364cf8-0x0;var _0x6a59ee=_0x99e9[_0x364cf8];return _0x6a59ee;};'use strict';var _=require(_0x999e('0x0'));var iftime=require(_0x999e('0x1'))[_0x999e('0x2')];var logger=require(_0x999e('0x3'))(_0x999e('0x4'));exports[_0x999e('0x5')]=function(_0x2beec7,_0x76fb02,_0x12dbbb){return function(_0x25da71){if(_0x12dbbb['rules']&&!_0x12dbbb[_0x999e('0x6')][_0x2beec7]){logger['info'](_0x999e('0x7'),_0x2beec7);return _0x25da71[_0x999e('0x8')]();}var _0x52821b=_0x76fb02[_0x999e('0x9')](function(_0x49cf89){return iftime(_0x49cf89);});var _0x5eff34=_[_0x999e('0xa')](_0x52821b);if(_0x5eff34){logger['info'](_0x999e('0xb'),_0x2beec7,_0x76fb02['join']('\x20|\x20'),_0x5eff34);_0x25da71[_0x999e('0xc')](_0x5eff34);}else{logger[_0x999e('0xd')]('[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s',_0x2beec7,_0x76fb02['join'](_0x999e('0xe')));_0x25da71[_0x999e('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 98b4ebd..b973c4e 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 _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 +var _0x44a3=['agentacw','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','uniqueid','destuniqueid','agentcalledAt','now','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','forIn','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][queuecallerabandon]','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','lastevent','answered_elsewhere','answeredelsewheredestinationuniqueid','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','complete','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','clone','calleridname','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','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','channel','queue','membername','interface','calleridnum','then','type','agentcomplete','acw'];(function(_0x15216f,_0x52a1b1){var _0x2e553e=function(_0x19366e){while(--_0x19366e){_0x15216f['push'](_0x15216f['shift']());}};_0x2e553e(++_0x52a1b1);}(_0x44a3,0x1a9));var _0x344a=function(_0x178e71,_0x5c6c7d){_0x178e71=_0x178e71-0x0;var _0x3eec6c=_0x44a3[_0x178e71];return _0x3eec6c;};'use strict';var _=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var utils=require(_0x344a('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x23cef2,_0xdffe0b){utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x5'),_0x23cef2['uniqueid'],_0x23cef2[_0x344a('0x6')],_0x23cef2[_0x344a('0x7')],_0x23cef2[_0x344a('0x8')],_0x23cef2[_0x344a('0x9')],_0x23cef2[_0x344a('0xa')],_0x23cef2['connectedlinenum'],_0x23cef2['lastevent']));if(_0x23cef2['queue']){utils['getVoiceQueueByName'](_0x23cef2[_0x344a('0x7')])[_0x344a('0xb')](function(_0x3c725e){if(_0x3c725e){_0x23cef2[_0x344a('0xc')]=_0x3c725e[_0x344a('0xc')];_0x23cef2['agentacw']=_0x23cef2[_0x344a('0xd')]?_0x3c725e[_0x344a('0xe')]:![];_0x23cef2['acwtime']=_0x23cef2[_0x344a('0xf')]?_0x3c725e['acwTimeout']:0x0;}utils[_0x344a('0x10')]('CreateVoiceAgentReport',_0x23cef2);});}else{utils[_0x344a('0x10')](_0x344a('0x11'),_0x23cef2);}if(_0xdffe0b){delete transfers[_0x23cef2['uniqueid']];}else{delete agents[_0x23cef2['destuniqueid']];}}exports[_0x344a('0x12')]=function(_0x2ad7eb){try{utils[_0x344a('0x13')](util[_0x344a('0x4')](_0x344a('0x14'),_0x2ad7eb[_0x344a('0x15')]),_0x2ad7eb);agents[_0x2ad7eb['destuniqueid']]=_0x2ad7eb;agents[_0x2ad7eb[_0x344a('0x16')]][_0x344a('0x17')]=utils[_0x344a('0x18')]();agents[_0x2ad7eb[_0x344a('0x16')]]['lastevent']='called';agents[_0x2ad7eb[_0x344a('0x16')]][_0x344a('0x19')]=null;agents[_0x2ad7eb[_0x344a('0x16')]][_0x344a('0x1a')]=null;utils['info'](util[_0x344a('0x4')](_0x344a('0x1b'),_0x2ad7eb['uniqueid'],agents[_0x2ad7eb[_0x344a('0x16')]][_0x344a('0x8')],_0x2ad7eb[_0x344a('0x16')]));}catch(_0x45a827){utils[_0x344a('0x1c')](util[_0x344a('0x4')](_0x344a('0x14'),_0x2ad7eb[_0x344a('0x15')]),_0x45a827);}};exports[_0x344a('0x1d')]=function(_0x450922){try{if(!_['isNil'](agents[_0x450922[_0x344a('0x16')]])){utils[_0x344a('0x13')](util[_0x344a('0x4')](_0x344a('0x1e'),_0x450922[_0x344a('0x15')]),_0x450922);utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x1f'),_0x450922[_0x344a('0x15')],agents[_0x450922[_0x344a('0x16')]][_0x344a('0x8')],_0x450922[_0x344a('0x16')]));agents[_0x450922[_0x344a('0x16')]][_0x344a('0x1d')]=!![];agents[_0x450922['destuniqueid']][_0x344a('0x20')]=utils['now']();agents[_0x450922[_0x344a('0x16')]]['lastevent']=_0x344a('0x21');agents[_0x450922[_0x344a('0x16')]][_0x344a('0x22')]=_0x344a('0x21');agents[_0x450922[_0x344a('0x16')]][_0x344a('0x23')]=_0x450922[_0x344a('0x24')]?parseInt(_0x450922[_0x344a('0x24')])/0x3e8:0x0;agents[_0x450922['destuniqueid']][_0x344a('0x25')]=0x0;unanswered[_0x344a('0x26')](_0x450922[_0x344a('0x16')]);}}catch(_0xc02d6){utils[_0x344a('0x1c')](util[_0x344a('0x4')]('[%s][agents][agentringnoanswer]',_0x450922[_0x344a('0x15')]),_0xc02d6);}};exports['queuecallerabandon']=function(_0x593cf6){try{_[_0x344a('0x27')](agents,function(_0x14fa86,_0x5a36bb){if(_0x14fa86['uniqueid']==_0x593cf6['uniqueid']&&!_['includes'](unanswered,_0x14fa86[_0x344a('0x16')])){utils[_0x344a('0x13')](util[_0x344a('0x4')]('[%s][agents][queuecallerabandon]',_0x593cf6[_0x344a('0x15')]),_0x593cf6);utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x28'),_0x593cf6[_0x344a('0x15')],_0x14fa86[_0x344a('0x8')],_0x14fa86[_0x344a('0x16')]));_0x14fa86['agentringnoanswer']=!![];_0x14fa86[_0x344a('0x20')]=utils['now']();_0x14fa86['lastevent']='abandoned';_0x14fa86[_0x344a('0x22')]=_0x344a('0x29');_0x14fa86[_0x344a('0x23')]=_0x593cf6[_0x344a('0x23')];_0x14fa86[_0x344a('0x25')]=0x0;writeDB(_0x14fa86);}});}catch(_0xdf6a8f){utils['error'](util[_0x344a('0x4')](_0x344a('0x2a'),_0x593cf6[_0x344a('0x15')]),_0xdf6a8f);}};exports['agentconnect']=function(_0x3698eb){try{if(agents[_0x3698eb[_0x344a('0x16')]]){utils[_0x344a('0x13')](util[_0x344a('0x4')](_0x344a('0x2b'),_0x3698eb['uniqueid']),_0x3698eb);utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x2c'),_0x3698eb[_0x344a('0x15')],agents[_0x3698eb[_0x344a('0x16')]]['membername'],_0x3698eb[_0x344a('0x16')]));agents[_0x3698eb[_0x344a('0x16')]][_0x344a('0x2d')]=utils[_0x344a('0x18')]();agents[_0x3698eb[_0x344a('0x16')]]['connectedlinenum']=_0x3698eb[_0x344a('0x19')];agents[_0x3698eb[_0x344a('0x16')]][_0x344a('0x1a')]=_0x3698eb[_0x344a('0x1a')];agents[_0x3698eb[_0x344a('0x16')]][_0x344a('0x23')]=_0x3698eb[_0x344a('0x24')];agents[_0x3698eb[_0x344a('0x16')]]['lastevent']=_0x344a('0x2e');_[_0x344a('0x27')](agents,function(_0x3d34c3,_0x28bad9){if(_0x3d34c3[_0x344a('0x16')]!=_0x3698eb['destuniqueid']&&_0x3d34c3[_0x344a('0x15')]==_0x3698eb[_0x344a('0x15')]){_0x3d34c3[_0x344a('0x25')]=0x0;_0x3d34c3[_0x344a('0x23')]=_0x3698eb[_0x344a('0x24')];_0x3d34c3[_0x344a('0x1d')]=!![];_0x3d34c3[_0x344a('0x20')]=utils[_0x344a('0x18')]();_0x3d34c3[_0x344a('0x2f')]='answered_elsewhere';_0x3d34c3[_0x344a('0x22')]=_0x344a('0x30');_0x3d34c3[_0x344a('0x31')]=_0x3698eb[_0x344a('0x16')];_0x3d34c3['answeredelsewheremembername']=_0x3698eb[_0x344a('0x8')];writeDB(_0x3d34c3);}});}}catch(_0x3069ca){utils[_0x344a('0x1c')](util[_0x344a('0x4')](_0x344a('0x2b'),_0x3698eb[_0x344a('0x15')]),_0x3069ca);}};exports[_0x344a('0xd')]=function(_0x372e7d){try{if(!_[_0x344a('0x32')](agents[_0x372e7d[_0x344a('0x16')]])){utils[_0x344a('0x13')](util['format'](_0x344a('0x33'),_0x372e7d[_0x344a('0x15')]),_0x372e7d);utils['info'](util[_0x344a('0x4')](_0x344a('0x34'),_0x372e7d['uniqueid'],agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0x8')],_0x372e7d['destuniqueid']));agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0xd')]=!![];agents[_0x372e7d[_0x344a('0x16')]]['agentcompleteAt']=utils[_0x344a('0x18')]();agents[_0x372e7d['destuniqueid']][_0x344a('0x25')]=utils[_0x344a('0x35')](agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0x36')],agents[_0x372e7d['destuniqueid']]['agentconnectAt']);agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0x22')]=_0x372e7d[_0x344a('0x22')];agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0x2f')]=_0x344a('0x37');writeDB(agents[_0x372e7d[_0x344a('0x16')]]);}}catch(_0x23c214){utils[_0x344a('0x1c')](util[_0x344a('0x4')]('[%s][agents][agentcomplete]',_0x372e7d[_0x344a('0x15')]),_0x23c214);}};exports[_0x344a('0x38')]=function(_0x6fad37){try{if(!_[_0x344a('0x32')](agents[_0x6fad37['transfereruniqueid']])){utils[_0x344a('0x13')](util['format']('[%s][agents][blindtransfer]',_0x6fad37[_0x344a('0x15')]),_0x6fad37);utils[_0x344a('0x3')](util['format'](_0x344a('0x39'),_0x6fad37[_0x344a('0x15')],agents[_0x6fad37[_0x344a('0x3a')]][_0x344a('0x8')],agents[_0x6fad37['transfereruniqueid']][_0x344a('0x15')]));agents[_0x6fad37[_0x344a('0x3a')]][_0x344a('0x3b')]=!![];agents[_0x6fad37[_0x344a('0x3a')]][_0x344a('0x3c')]=_0x344a('0x3d');agents[_0x6fad37[_0x344a('0x3a')]][_0x344a('0x3e')]=_0x6fad37[_0x344a('0x3f')];agents[_0x6fad37[_0x344a('0x3a')]]['transferuniqueid']=agents[_0x6fad37[_0x344a('0x3a')]]['uniqueid'];}}catch(_0x1b7f6c){utils[_0x344a('0x1c')](util[_0x344a('0x4')]('[%s][agents][blindtransfer]',_0x6fad37[_0x344a('0x15')]),_0x1b7f6c);}};exports[_0x344a('0x40')]=function(_0x188c6b){try{utils[_0x344a('0x13')](util[_0x344a('0x4')](_0x344a('0x41'),_0x188c6b[_0x344a('0x42')]),_0x188c6b);if(_0x188c6b[_0x344a('0x42')]==_0x188c6b[_0x344a('0x43')]){if(!_['isNil'](agents[_0x188c6b[_0x344a('0x44')]])){utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x45'),_0x188c6b[_0x344a('0x42')],agents[_0x188c6b['secondtransfereruniqueid']][_0x344a('0x8')]));agents[_0x188c6b[_0x344a('0x44')]][_0x344a('0x3b')]=!![];agents[_0x188c6b[_0x344a('0x44')]]['transfertype']=_0x344a('0x46');agents[_0x188c6b[_0x344a('0x44')]]['transferexten']=_0x188c6b[_0x344a('0x47')];agents[_0x188c6b[_0x344a('0x44')]][_0x344a('0x48')]=_0x188c6b[_0x344a('0x42')];}if(_0x188c6b[_0x344a('0x49')]&&agents[_0x188c6b[_0x344a('0x49')]]){agents[_0x188c6b[_0x344a('0x49')]]['agententerreason']=0x1;transfers[_0x188c6b['transfereeuniqueid']]=_['clone'](agents[_0x188c6b[_0x344a('0x49')]]);transfers[_0x188c6b[_0x344a('0x49')]][_0x344a('0xa')]=agents[_0x188c6b[_0x344a('0x44')]]['calleridnum'];transfers[_0x188c6b[_0x344a('0x49')]]['calleridname']=agents[_0x188c6b['secondtransfereruniqueid']]['calleridname'];transfers[_0x188c6b['transfereeuniqueid']][_0x344a('0x17')]=utils[_0x344a('0x18')]();transfers[_0x188c6b[_0x344a('0x49')]][_0x344a('0x2d')]=utils['now']();transfers[_0x188c6b['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x188c6b[_0x344a('0x49')]][_0x344a('0x4a')]=0x2;}}else if(_0x188c6b[_0x344a('0x44')]==_0x188c6b[_0x344a('0x4b')]){if(!_[_0x344a('0x32')](agents[_0x188c6b['origtransfereruniqueid']])){utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x45'),_0x188c6b['origtransfereruniqueid'],agents[_0x188c6b[_0x344a('0x42')]]['membername']));agents[_0x188c6b['origtransfereruniqueid']][_0x344a('0x3b')]=!![];agents[_0x188c6b['origtransfereruniqueid']]['transfertype']=_0x344a('0x46');agents[_0x188c6b[_0x344a('0x42')]]['transferexten']=_0x188c6b[_0x344a('0x4c')];agents[_0x188c6b['origtransfereruniqueid']][_0x344a('0x48')]=_0x188c6b[_0x344a('0x44')];}if(_0x188c6b[_0x344a('0x4d')]&&agents[_0x188c6b['transfertargetuniqueid']]){agents[_0x188c6b['transfertargetuniqueid']][_0x344a('0x4a')]=0x1;transfers[_0x188c6b[_0x344a('0x4d')]]=_[_0x344a('0x4e')](agents[_0x188c6b[_0x344a('0x4d')]]);transfers[_0x188c6b['transfertargetuniqueid']]['calleridnum']=agents[_0x188c6b[_0x344a('0x42')]][_0x344a('0xa')];transfers[_0x188c6b[_0x344a('0x4d')]]['calleridname']=agents[_0x188c6b[_0x344a('0x42')]][_0x344a('0x4f')];transfers[_0x188c6b['transfertargetuniqueid']][_0x344a('0x17')]=utils['now']();transfers[_0x188c6b[_0x344a('0x4d')]]['agentconnectAt']=utils['now']();transfers[_0x188c6b['transfertargetuniqueid']][_0x344a('0x23')]=0x0;transfers[_0x188c6b[_0x344a('0x4d')]][_0x344a('0x4a')]=0x2;}}}catch(_0xce0446){utils[_0x344a('0x1c')](util[_0x344a('0x4')]('[%s][agents][attendedtransfer]',_0x188c6b[_0x344a('0x42')]),_0xce0446);}};exports[_0x344a('0x50')]=function(_0x20a892){try{utils[_0x344a('0x13')](util[_0x344a('0x4')]('[%s][agents][hangup]',_0x20a892[_0x344a('0x15')]),_0x20a892);if(agents[_0x20a892[_0x344a('0x15')]]&&agents[_0x20a892['uniqueid']][_0x344a('0x22')]===_0x344a('0x21')){if(_0x20a892[_0x344a('0x51')]==='21'){agents[_0x20a892[_0x344a('0x15')]]['reason']=_0x344a('0x52');agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2f')]=_0x344a('0x52');}utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x53'),_0x20a892[_0x344a('0x15')],agents[_0x20a892['uniqueid']][_0x344a('0x8')],agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')],agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2f')]));writeDB(agents[_0x20a892[_0x344a('0x15')]]);var _0x212b08=unanswered[_0x344a('0x54')](_0x20a892['uniqueid']);if(_0x212b08>-0x1){unanswered[_0x344a('0x55')](_0x212b08,0x1);}}if(transfers[_0x20a892[_0x344a('0x15')]]){transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0xd')]=!![];transfers[_0x20a892['uniqueid']][_0x344a('0x36')]=utils[_0x344a('0x18')]();transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0x25')]=utils[_0x344a('0x35')](transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0x36')],transfers[_0x20a892[_0x344a('0x15')]]['agentconnectAt']);transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')]=_0x344a('0x56');transfers[_0x20a892[_0x344a('0x15')]]['lastevent']=_0x344a('0x37');utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x53'),_0x20a892[_0x344a('0x15')],transfers[_0x20a892[_0x344a('0x15')]]['membername'],transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')],transfers[_0x20a892[_0x344a('0x15')]]['lastevent']));writeDB(transfers[_0x20a892[_0x344a('0x15')]],!![]);}if(agents[_0x20a892[_0x344a('0x15')]]&&agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2d')]){agents[_0x20a892[_0x344a('0x15')]]['agentcomplete']=!![];agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x36')]=utils[_0x344a('0x18')]();agents[_0x20a892['uniqueid']][_0x344a('0x25')]=utils['diffTime'](agents[_0x20a892['uniqueid']][_0x344a('0x36')],agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2d')]);agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')]=agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x3b')]?_0x344a('0x3b'):'agent';agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2f')]='complete';utils['info'](util[_0x344a('0x4')](_0x344a('0x53'),_0x20a892[_0x344a('0x15')],agents[_0x20a892[_0x344a('0x15')]]['membername'],agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')],agents[_0x20a892[_0x344a('0x15')]]['lastevent']));writeDB(agents[_0x20a892[_0x344a('0x15')]]);}}catch(_0x1c50c3){utils[_0x344a('0x1c')](util['format'](_0x344a('0x57'),_0x20a892[_0x344a('0x15')]),_0x1c50c3);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 520e8b0..470d5ab 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 _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 +var _0x6c97=['destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','hangup','noop','execif','gotoif','[%s][calls][newexten]','lodash','util','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getUserByInternal','then','UserId','request','CreateVoiceCallReport','uniqueid','debug','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','transfer','accountcode','destinationchannel','answertime','disposition','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','starttime','billableseconds','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','xmd-originatecalleridnum','source','value','variable','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s'];(function(_0x35f08f,_0x379e38){var _0xb220b8=function(_0x32a0d2){while(--_0x32a0d2){_0x35f08f['push'](_0x35f08f['shift']());}};_0xb220b8(++_0x379e38);}(_0x6c97,0x16b));var _0x76c9=function(_0x50bb53,_0x145dbc){_0x50bb53=_0x50bb53-0x0;var _0x4ad8a7=_0x6c97[_0x50bb53];return _0x4ad8a7;};'use strict';var _=require(_0x76c9('0x0'));var util=require(_0x76c9('0x1'));var utils=require('./utils');var dispositions=[_0x76c9('0x2'),_0x76c9('0x3'),_0x76c9('0x3'),'NO\x20ANSWER',_0x76c9('0x2'),_0x76c9('0x2'),_0x76c9('0x4'),_0x76c9('0x5'),_0x76c9('0x3'),_0x76c9('0x3'),_0x76c9('0x3')];var channels={};function writeDB(_0x2bcc49){utils[_0x76c9('0x6')](util[_0x76c9('0x7')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x2bcc49['uniqueid'],_0x2bcc49[_0x76c9('0x8')],_0x2bcc49[_0x76c9('0x9')],_0x2bcc49[_0x76c9('0xa')],_0x2bcc49[_0x76c9('0xb')],_0x2bcc49[_0x76c9('0xc')],_0x2bcc49[_0x76c9('0xd')],_0x2bcc49[_0x76c9('0xe')]));if(_0x2bcc49['accountcode']){utils[_0x76c9('0xf')](_0x2bcc49['accountcode'])[_0x76c9('0x10')](function(_0x15c9d1){if(_0x15c9d1){_0x2bcc49[_0x76c9('0x11')]=_0x15c9d1['id'];}utils[_0x76c9('0x12')](_0x76c9('0x13'),_0x2bcc49);});}else{utils[_0x76c9('0x12')]('CreateVoiceCallReport',_0x2bcc49);}if(channels[_0x2bcc49[_0x76c9('0x14')]]){delete channels[_0x2bcc49[_0x76c9('0x14')]];}}exports['newchannel']=function(_0x300681){try{utils[_0x76c9('0x15')](util[_0x76c9('0x7')]('[%s][calls][newchannel]',_0x300681['uniqueid']),_0x300681);if(_0x300681[_0x76c9('0x14')]==_0x300681[_0x76c9('0x16')]&&_0x300681[_0x76c9('0x8')]!=_0x76c9('0x17')){utils[_0x76c9('0x6')](util['format'](_0x76c9('0x18'),_0x300681[_0x76c9('0x14')],_0x300681['context'],_0x300681[_0x76c9('0x19')]));channels[_0x300681['uniqueid']]={'uniqueid':_0x300681[_0x76c9('0x14')],'accountcode':_0x300681['accountcode'],'source':_0x300681['calleridnum'],'destination':_0x300681[_0x76c9('0x19')],'destinationcontext':_0x300681[_0x76c9('0x1a')],'channel':_0x300681[_0x76c9('0x8')],'starttime':utils[_0x76c9('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x1fd494){utils[_0x76c9('0x1c')](util['format'](_0x76c9('0x1d'),_0x300681[_0x76c9('0x14')]),_0x1fd494);}};exports[_0x76c9('0x1e')]=function(_0x2fec1a){try{utils[_0x76c9('0x15')](util[_0x76c9('0x7')](_0x76c9('0x1f'),_0x2fec1a['uniqueid']),_0x2fec1a);if(!_['isNil'](channels[_0x2fec1a[_0x76c9('0x14')]])&&_0x2fec1a[_0x76c9('0x20')]==0x6){utils['info'](util[_0x76c9('0x7')](_0x76c9('0x21'),_0x2fec1a[_0x76c9('0x14')],_0x2fec1a[_0x76c9('0x1a')],_0x2fec1a[_0x76c9('0x8')]));if(_[_0x76c9('0x22')](channels[_0x2fec1a[_0x76c9('0x14')]][_0x76c9('0x23')])){channels[_0x2fec1a['uniqueid']][_0x76c9('0x23')]=utils[_0x76c9('0x1b')]();}}else if(!_[_0x76c9('0x22')](channels[_0x2fec1a[_0x76c9('0x16')]])&&_0x2fec1a['channelstate']==0x6&&_0x2fec1a[_0x76c9('0x1a')]!=_0x76c9('0x24')){utils[_0x76c9('0x6')](util[_0x76c9('0x7')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x2fec1a[_0x76c9('0x14')],_0x2fec1a[_0x76c9('0x16')],_0x2fec1a['context'],_0x2fec1a['channel']));channels[_0x2fec1a[_0x76c9('0x16')]][_0x76c9('0x25')]=_0x2fec1a[_0x76c9('0x25')];channels[_0x2fec1a[_0x76c9('0x16')]][_0x76c9('0x26')]=_0x2fec1a['channel'];if(_[_0x76c9('0x22')](channels[_0x2fec1a[_0x76c9('0x16')]]['answertime'])){channels[_0x2fec1a[_0x76c9('0x16')]][_0x76c9('0x27')]=utils['now']();}channels[_0x2fec1a['linkedid']][_0x76c9('0x28')]=dispositions[_['toNumber'](_0x2fec1a['channelstate'])]||_0x76c9('0x4');}}catch(_0x12bc28){utils['error'](util[_0x76c9('0x7')](_0x76c9('0x1f'),_0x2fec1a[_0x76c9('0x14')]),_0x12bc28);}};exports['hangup']=function(_0x87a262){try{if(!_[_0x76c9('0x22')](channels[_0x87a262[_0x76c9('0x14')]])){utils[_0x76c9('0x15')](util[_0x76c9('0x7')]('[%s][calls][hangup]',_0x87a262[_0x76c9('0x14')]),_0x87a262);if(_['isNil'](channels[_0x87a262[_0x76c9('0x14')]][_0x76c9('0x29')])){channels[_0x87a262[_0x76c9('0x14')]][_0x76c9('0x29')]=_0x87a262[_0x76c9('0x2a')]+'\x20<'+_0x87a262[_0x76c9('0xc')]+'>';}utils['info'](util[_0x76c9('0x7')](_0x76c9('0x2b'),_0x87a262[_0x76c9('0x14')],channels[_0x87a262[_0x76c9('0x14')]][_0x76c9('0x29')],_0x87a262['cause-txt']));channels[_0x87a262['uniqueid']][_0x76c9('0x2c')]=utils['now']();channels[_0x87a262[_0x76c9('0x14')]][_0x76c9('0x2d')]=utils[_0x76c9('0x2e')](channels[_0x87a262[_0x76c9('0x14')]][_0x76c9('0x2c')],channels[_0x87a262['uniqueid']][_0x76c9('0x2f')]);channels[_0x87a262[_0x76c9('0x14')]][_0x76c9('0x30')]=channels[_0x87a262[_0x76c9('0x14')]]['answertime']?utils['diffTime'](channels[_0x87a262[_0x76c9('0x14')]][_0x76c9('0x2c')],channels[_0x87a262['uniqueid']][_0x76c9('0x27')]):0x0;writeDB(channels[_0x87a262[_0x76c9('0x14')]]);}}catch(_0x2473ef){utils[_0x76c9('0x1c')](util['format'](_0x76c9('0x31'),_0x87a262[_0x76c9('0x14')]),_0x2473ef);}};exports[_0x76c9('0x32')]=function(_0x1f1227){try{if(!_[_0x76c9('0x22')](channels[_0x1f1227[_0x76c9('0x33')]])){utils['debug'](util[_0x76c9('0x7')](_0x76c9('0x34'),_0x1f1227[_0x76c9('0x35')]),_0x1f1227);if(channels[_0x1f1227[_0x76c9('0x33')]]['channel']==_0x1f1227[_0x76c9('0x36')]){utils['info'](util[_0x76c9('0x7')](_0x76c9('0x37'),_0x1f1227[_0x76c9('0x35')],_0x1f1227[_0x76c9('0x33')],_0x1f1227['secondtransfererchannel']));channels[_0x1f1227[_0x76c9('0x33')]]['destinationchannel']=_0x1f1227['secondtransfererchannel'];channels[_0x1f1227[_0x76c9('0x33')]][_0x76c9('0x38')]=_0x76c9('0x39');}else if(channels[_0x1f1227[_0x76c9('0x33')]][_0x76c9('0x8')]=_0x1f1227[_0x76c9('0x3a')]){utils[_0x76c9('0x6')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x1f1227[_0x76c9('0x35')],_0x1f1227[_0x76c9('0x33')],_0x1f1227[_0x76c9('0x3b')]));channels[_0x1f1227[_0x76c9('0x33')]]['destinationchannel']=_0x1f1227[_0x76c9('0x3b')];channels[_0x1f1227[_0x76c9('0x33')]][_0x76c9('0x38')]='_attended';}}}catch(_0x5a091b){utils['error'](util[_0x76c9('0x7')](_0x76c9('0x34'),_0x1f1227[_0x76c9('0x35')]),_0x5a091b);}};exports[_0x76c9('0x3c')]=function(_0x38c0ac){try{if(!_[_0x76c9('0x22')](channels[_0x38c0ac[_0x76c9('0x14')]])){utils['debug'](util[_0x76c9('0x7')](_0x76c9('0x3d'),_0x38c0ac[_0x76c9('0x14')]),_0x38c0ac);channels[_0x38c0ac[_0x76c9('0x14')]][_0x76c9('0x3e')]=utils[_0x76c9('0x1b')]();utils['info'](util[_0x76c9('0x7')](_0x76c9('0x3f'),_0x38c0ac[_0x76c9('0x14')],channels[_0x38c0ac[_0x76c9('0x14')]][_0x76c9('0x3e')]));}}catch(_0x57d49b){utils[_0x76c9('0x1c')](util['format'](_0x76c9('0x3d'),_0x38c0ac['uniqueid']),_0x57d49b);}};exports['musiconholdstop']=function(_0x582821){try{if(!_['isNil'](channels[_0x582821[_0x76c9('0x14')]])){utils[_0x76c9('0x15')](util[_0x76c9('0x7')](_0x76c9('0x40'),_0x582821['uniqueid']),_0x582821);if(!_[_0x76c9('0x22')](channels[_0x582821[_0x76c9('0x14')]][_0x76c9('0x3e')])){channels[_0x582821[_0x76c9('0x14')]][_0x76c9('0x41')]+=utils[_0x76c9('0x2e')](utils['now'](),channels[_0x582821['uniqueid']][_0x76c9('0x3e')]);utils[_0x76c9('0x6')](util['format'](_0x76c9('0x42'),_0x582821[_0x76c9('0x14')],channels[_0x582821['uniqueid']][_0x76c9('0x41')]));delete channels[_0x582821[_0x76c9('0x14')]][_0x76c9('0x3e')];}}}catch(_0x2817e7){utils[_0x76c9('0x1c')](util[_0x76c9('0x7')](_0x76c9('0x40'),_0x582821[_0x76c9('0x14')]),_0x2817e7);}};exports[_0x76c9('0x43')]=function(_0x1bb971){try{if(!_[_0x76c9('0x22')](channels[_0x1bb971[_0x76c9('0x14')]])){utils['debug'](util[_0x76c9('0x7')]('[%s][calls][varset]',_0x1bb971[_0x76c9('0x14')]),_0x1bb971);if(!_[_0x76c9('0x22')](_0x1bb971['variable'][_0x76c9('0x44')])){utils['info'](util[_0x76c9('0x7')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x1bb971[_0x76c9('0x14')],_0x1bb971['value']));channels[_0x1bb971['uniqueid']][_0x76c9('0x45')]=_0x1bb971[_0x76c9('0x46')];}if(!_[_0x76c9('0x22')](_0x1bb971[_0x76c9('0x47')]['xmd-phone'])){utils[_0x76c9('0x6')](util[_0x76c9('0x7')](_0x76c9('0x48'),_0x1bb971[_0x76c9('0x14')],_0x1bb971[_0x76c9('0x46')]));channels[_0x1bb971[_0x76c9('0x14')]][_0x76c9('0x49')]=_0x1bb971[_0x76c9('0x46')];channels[_0x1bb971[_0x76c9('0x14')]][_0x76c9('0x29')]='\x22'+_0x1bb971[_0x76c9('0x46')]+_0x76c9('0x4a')+_0x1bb971[_0x76c9('0x46')]+'>';}if(!_[_0x76c9('0x22')](_0x1bb971[_0x76c9('0x47')][_0x76c9('0x4b')])||!_[_0x76c9('0x22')](_0x1bb971[_0x76c9('0x47')][_0x76c9('0x4c')])){utils[_0x76c9('0x6')](util[_0x76c9('0x7')](_0x76c9('0x4d'),_0x1bb971[_0x76c9('0x14')],!_[_0x76c9('0x22')](_0x1bb971[_0x76c9('0x47')][_0x76c9('0x4b')])?_0x76c9('0x4b'):_0x76c9('0x4c'),_0x1bb971['value']));channels[_0x1bb971['uniqueid']][_0x76c9('0x29')]=_0x1bb971[_0x76c9('0x46')];}if(!_['isNil'](_0x1bb971[_0x76c9('0x47')][_0x76c9('0x4e')])||!_[_0x76c9('0x22')](_0x1bb971[_0x76c9('0x47')]['xmcs-queue'])){utils[_0x76c9('0x6')](util[_0x76c9('0x7')](_0x76c9('0x4d'),_0x1bb971[_0x76c9('0x14')],!_[_0x76c9('0x22')](_0x1bb971['variable'][_0x76c9('0x4e')])?'xmd-queue':_0x76c9('0x4f'),_0x1bb971[_0x76c9('0x46')]));channels[_0x1bb971[_0x76c9('0x14')]][_0x76c9('0x50')]=_0x76c9('0x51');channels[_0x1bb971[_0x76c9('0x14')]][_0x76c9('0x52')]=_0x1bb971[_0x76c9('0x46')];channels[_0x1bb971[_0x76c9('0x14')]][_0x76c9('0x9')]=!![];}if(!_[_0x76c9('0x22')](_0x1bb971['variable'][_0x76c9('0x53')])){utils[_0x76c9('0x6')](util['format'](_0x76c9('0x54'),_0x1bb971[_0x76c9('0x14')],_0x1bb971[_0x76c9('0x46')]));channels[_0x1bb971[_0x76c9('0x14')]][_0x76c9('0x55')]=_0x1bb971[_0x76c9('0x46')];}if(!_[_0x76c9('0x22')](_0x1bb971['variable'][_0x76c9('0x56')])){utils[_0x76c9('0x6')](util[_0x76c9('0x7')](_0x76c9('0x57'),_0x1bb971[_0x76c9('0x14')],_0x1bb971[_0x76c9('0x46')]));channels[_0x1bb971[_0x76c9('0x14')]][_0x76c9('0x58')]=_0x1bb971[_0x76c9('0x46')];}if(!_[_0x76c9('0x22')](_0x1bb971[_0x76c9('0x47')][_0x76c9('0x59')])){utils[_0x76c9('0x6')](util[_0x76c9('0x7')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x1bb971[_0x76c9('0x14')],_0x1bb971[_0x76c9('0x46')]));channels[_0x1bb971[_0x76c9('0x14')]][_0x76c9('0x5a')]=_0x1bb971[_0x76c9('0x46')];}if(!_[_0x76c9('0x22')](_0x1bb971[_0x76c9('0x47')][_0x76c9('0x5b')])){utils['info'](util[_0x76c9('0x7')](_0x76c9('0x5c'),_0x1bb971[_0x76c9('0x14')],_0x1bb971[_0x76c9('0x46')]));channels[_0x1bb971[_0x76c9('0x14')]][_0x76c9('0x5b')]=_0x1bb971[_0x76c9('0x46')];}}}catch(_0x5585de){utils['error'](util[_0x76c9('0x7')](_0x76c9('0x5d'),_0x1bb971['uniqueid']),_0x5585de);}};exports[_0x76c9('0x5e')]=function(_0x43c44b){try{if(!_[_0x76c9('0x22')](channels[_0x43c44b[_0x76c9('0x14')]])){utils[_0x76c9('0x15')](util[_0x76c9('0x7')]('[%s][calls][newexten]',_0x43c44b[_0x76c9('0x14')]),_0x43c44b);utils[_0x76c9('0x6')](util[_0x76c9('0x7')](_0x76c9('0x5f'),_0x43c44b[_0x76c9('0x14')],_0x43c44b[_0x76c9('0x60')],_0x43c44b[_0x76c9('0x61')]));if(_0x43c44b[_0x76c9('0x60')][_0x76c9('0x62')]()=='set'&&_[_0x76c9('0x63')](_0x43c44b[_0x76c9('0x61')][_0x76c9('0x62')](),_0x76c9('0x64'))){var _0x42669b=_0x43c44b[_0x76c9('0x61')][_0x76c9('0x65')]('=');var _0x56aee5=_0x42669b[0x0][_0x76c9('0x66')](_0x42669b[0x0]['lastIndexOf']('(')+0x1,_0x42669b[0x0][_0x76c9('0x67')](')'));var _0x20a940=_0x42669b[0x1];channels[_0x43c44b['uniqueid']][_0x56aee5]=_0x20a940;}if(!_['includes']([_0x76c9('0x68'),_0x76c9('0x69'),_0x76c9('0x6a'),'set',_0x76c9('0x6b')],_0x43c44b['application']['toLowerCase']())){channels[_0x43c44b['uniqueid']][_0x76c9('0x50')]=_0x43c44b[_0x76c9('0x60')];channels[_0x43c44b['uniqueid']]['lastdata']=_0x43c44b[_0x76c9('0x61')];}}}catch(_0x3a136d){utils[_0x76c9('0x1c')](util[_0x76c9('0x7')](_0x76c9('0x6c'),_0x43c44b[_0x76c9('0x14')]),_0x3a136d);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 341de6d..d59c61a 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 _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 +var _0x8662=['fullybooted','[core]\x20fullybooted','error','managerevent','./utils','info','[core]\x20connected'];(function(_0x5be99a,_0x416aba){var _0x4786f7=function(_0x2def91){while(--_0x2def91){_0x5be99a['push'](_0x5be99a['shift']());}};_0x4786f7(++_0x416aba);}(_0x8662,0x185));var _0x2866=function(_0x1d5dc7,_0x266ee5){_0x1d5dc7=_0x1d5dc7-0x0;var _0x6cd4f2=_0x8662[_0x1d5dc7];return _0x6cd4f2;};'use strict';var utils=require(_0x2866('0x0'));exports['connect']=function(){utils[_0x2866('0x1')](_0x2866('0x2'));};exports['shutdown']=function(){utils[_0x2866('0x1')]('[core]\x20shutdown');};exports[_0x2866('0x3')]=function(){utils['info'](_0x2866('0x4'));};exports['error']=function(_0x4213eb){utils[_0x2866('0x5')]('[core]\x20error',_0x4213eb);};exports['close']=function(){utils[_0x2866('0x1')]('[core]\x20close');};exports[_0x2866('0x6')]=function(_0x3d1b8c){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 0edc17c..bdb131c 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 _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 +var _0x74e8=['connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','error','varset','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','isNil','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','ANSWER','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','calleridnum','calleridname','complete','duration','diffTime','billableseconds','endtime','lodash','util','./utils','info','uniqueid','channel','dialstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x74e8,0x191));var _0x874e=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x74e8[_0x28d18d];return _0x470640;};'use strict';var _=require(_0x874e('0x0'));var util=require(_0x874e('0x1'));var utils=require(_0x874e('0x2'));var dials={};function writeDB(_0x292c73){utils[_0x874e('0x3')](util['format']('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x292c73[_0x874e('0x4')],_0x292c73[_0x874e('0x5')],_0x292c73[_0x874e('0x6')],_0x292c73['calleridnum'],_0x292c73[_0x874e('0x7')],_0x292c73[_0x874e('0x8')]));utils[_0x874e('0x9')](_0x874e('0xa'),_0x292c73);delete dials[_0x292c73['uniqueid']];}exports[_0x874e('0xb')]=function(_0xf8ef1a){try{utils[_0x874e('0xc')](util[_0x874e('0xd')](_0x874e('0xe'),_0xf8ef1a['uniqueid']),_0xf8ef1a);utils[_0x874e('0x3')](util[_0x874e('0xd')](_0x874e('0xf'),_0xf8ef1a[_0x874e('0x4')],_0xf8ef1a[_0x874e('0x10')],_0xf8ef1a[_0x874e('0x11')]));if(_0xf8ef1a['application'][_0x874e('0x12')]()==_0x874e('0x13')&&_[_0x874e('0x14')](_0xf8ef1a['appdata']['toLowerCase'](),'cdr(routeid)')){var _0x5c6bd5=_0xf8ef1a['appdata'][_0x874e('0x15')]('=');dials[_0xf8ef1a[_0x874e('0x4')]]={'routeId':_0x5c6bd5[0x1]};}}catch(_0x51132e){utils[_0x874e('0x16')](util[_0x874e('0xd')]('[%s][dials][newexten]',_0xf8ef1a[_0x874e('0x4')]),_0x51132e);}};exports[_0x874e('0x17')]=function(_0x4a0ab4){try{utils['debug'](util[_0x874e('0xd')](_0x874e('0x18'),_0x4a0ab4[_0x874e('0x4')]),_0x4a0ab4);if(!_['isNil'](_0x4a0ab4[_0x874e('0x19')][_0x874e('0x1a')])){utils[_0x874e('0x3')](util[_0x874e('0xd')](_0x874e('0x1b'),_0x4a0ab4[_0x874e('0x4')],_0x4a0ab4[_0x874e('0x1c')]));dials[_0x4a0ab4[_0x874e('0x4')]]={'routeId':_0x4a0ab4[_0x874e('0x1c')]};}}catch(_0x37c463){utils[_0x874e('0x16')](util[_0x874e('0xd')](_0x874e('0x18'),_0x4a0ab4['uniqueid']),_0x37c463);}};exports[_0x874e('0x1d')]=function(_0x2543dc){try{if(!_[_0x874e('0x1e')](dials[_0x2543dc[_0x874e('0x4')]])){utils[_0x874e('0xc')](util['format']('[%s][dials][dialbegin]',_0x2543dc[_0x874e('0x4')]),_0x2543dc);dials[_0x2543dc[_0x874e('0x4')]]=_['assign'](dials[_0x2543dc[_0x874e('0x4')]],_0x2543dc);dials[_0x2543dc[_0x874e('0x4')]][_0x874e('0x1f')]=utils[_0x874e('0x20')]();dials[_0x2543dc[_0x874e('0x4')]][_0x874e('0x21')]=_0x874e('0x22');utils[_0x874e('0x3')](util[_0x874e('0xd')](_0x874e('0x23'),_0x2543dc[_0x874e('0x4')],dials[_0x2543dc[_0x874e('0x4')]][_0x874e('0x1f')]));}}catch(_0xb5e78d){utils[_0x874e('0x16')](util[_0x874e('0xd')](_0x874e('0x24'),_0x2543dc['uniqueid']),_0xb5e78d);}};exports[_0x874e('0x25')]=function(_0x32b66c){try{if(!_[_0x874e('0x1e')](dials[_0x32b66c['uniqueid']])){utils[_0x874e('0xc')](util[_0x874e('0xd')](_0x874e('0x26'),_0x32b66c[_0x874e('0x4')]),_0x32b66c);dials[_0x32b66c['uniqueid']][_0x874e('0x8')]=_0x32b66c[_0x874e('0x8')];if(_0x32b66c[_0x874e('0x8')]==_0x874e('0x27')){dials[_0x32b66c['uniqueid']]=_['assign'](dials[_0x32b66c[_0x874e('0x4')]],_0x32b66c);dials[_0x32b66c[_0x874e('0x4')]]['answertime']=utils[_0x874e('0x20')]();dials[_0x32b66c[_0x874e('0x4')]][_0x874e('0x21')]='connect';utils[_0x874e('0x3')](util['format'](_0x874e('0x28'),_0x32b66c[_0x874e('0x4')],_0x32b66c[_0x874e('0x8')],dials[_0x32b66c['uniqueid']][_0x874e('0x29')]));}else{utils[_0x874e('0x3')](util['format'](_0x874e('0x2a'),_0x32b66c[_0x874e('0x4')],_0x32b66c[_0x874e('0x8')]));}}}catch(_0x4de957){utils[_0x874e('0x16')](util['format'](_0x874e('0x26'),_0x32b66c[_0x874e('0x4')]),_0x4de957);}};exports[_0x874e('0x2b')]=function(_0x4167c6){try{if(!_['isNil'](dials[_0x4167c6[_0x874e('0x4')]])){utils[_0x874e('0xc')](util[_0x874e('0xd')]('[%s][dials][hangup]',_0x4167c6[_0x874e('0x4')]),_0x4167c6);utils[_0x874e('0x3')](util[_0x874e('0xd')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x4167c6[_0x874e('0x4')],_0x4167c6[_0x874e('0x2c')],_0x4167c6[_0x874e('0x2d')],_0x4167c6['cause-txt']));dials[_0x4167c6[_0x874e('0x4')]]=_['assign'](dials[_0x4167c6['uniqueid']],{'endtime':utils[_0x874e('0x20')](),'lastevent':_0x874e('0x2e')});dials[_0x4167c6[_0x874e('0x4')]][_0x874e('0x2f')]=utils['diffTime'](dials[_0x4167c6[_0x874e('0x4')]]['endtime'],dials[_0x4167c6['uniqueid']][_0x874e('0x1f')]);dials[_0x4167c6[_0x874e('0x4')]]['holdtime']=utils[_0x874e('0x30')](dials[_0x4167c6[_0x874e('0x4')]][_0x874e('0x29')]||dials[_0x4167c6[_0x874e('0x4')]]['endtime'],dials[_0x4167c6[_0x874e('0x4')]][_0x874e('0x1f')]);dials[_0x4167c6[_0x874e('0x4')]][_0x874e('0x31')]=dials[_0x4167c6['uniqueid']][_0x874e('0x29')]?utils[_0x874e('0x30')](dials[_0x4167c6[_0x874e('0x4')]][_0x874e('0x32')],dials[_0x4167c6[_0x874e('0x4')]]['answertime']):0x0;writeDB(dials[_0x4167c6[_0x874e('0x4')]]);}}catch(_0x12d6ae){utils['error'](util['format']('[%s][dials][hangup]',_0x4167c6[_0x874e('0x4')]),_0x12d6ae);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index a5d3c00..ddcc9de 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 _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 +var _0x3a39=['blindtransfer','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentconnect]','agentconnect','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]'];(function(_0x45157d,_0x3232cf){var _0x169cb7=function(_0x415e95){while(--_0x415e95){_0x45157d['push'](_0x45157d['shift']());}};_0x169cb7(++_0x3232cf);}(_0x3a39,0x9a));var _0x93a3=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3a39[_0x3bf83f];return _0x22c4a9;};var AsteriskManager=require('asterisk-manager');var config=require(_0x93a3('0x0'));var utils=require(_0x93a3('0x1'));var util=require(_0x93a3('0x2'));var isXDREnabled=config[_0x93a3('0x3')]&&config[_0x93a3('0x3')][_0x93a3('0x4')]?!config[_0x93a3('0x3')][_0x93a3('0x4')]:!![];var isProduction=config[_0x93a3('0x5')]===_0x93a3('0x6')||![];var isLocalAsterisk=config[_0x93a3('0x3')]&&config[_0x93a3('0x3')][_0x93a3('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x93a3('0x8')][_0x93a3('0x9')],config['asterisk']['ip'],config[_0x93a3('0x8')][_0x93a3('0xa')],config[_0x93a3('0x8')][_0x93a3('0xb')],!![]);ami[_0x93a3('0xc')]();if(!isXDREnabled){utils[_0x93a3('0xd')](_0x93a3('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x93a3('0xd')](_0x93a3('0xf'));}else{var agents=require(_0x93a3('0x10'));var calls=require('./calls.controller');var queues=require(_0x93a3('0x11'));var recordings=require(_0x93a3('0x12'));var members=require(_0x93a3('0x13'));var dials=require(_0x93a3('0x14'));var transfers=require(_0x93a3('0x15'));var core=require(_0x93a3('0x16'));ami['on']('connect',core['connect']);ami['on'](_0x93a3('0x17'),core['shutdown']);ami['on']('fullybooted',core[_0x93a3('0x18')]);ami['on'](_0x93a3('0x19'),core[_0x93a3('0x19')]);ami['on']('close',core[_0x93a3('0x1a')]);ami['on'](_0x93a3('0x1b'),core[_0x93a3('0x1b')]);ami['on'](_0x93a3('0x1c'),function(_0x49b408){try{utils[_0x93a3('0x1d')](util[_0x93a3('0x1e')](_0x93a3('0x1f'),_0x49b408[_0x93a3('0x20')]),_0x49b408);members[_0x93a3('0x1c')](_0x49b408);}catch(_0x1b3286){utils[_0x93a3('0x19')](util['format'](_0x93a3('0x1f'),_0x49b408[_0x93a3('0x20')]),_0x1b3286);}});ami['on'](_0x93a3('0x21'),function(_0x2cb8f){try{utils[_0x93a3('0x1d')](util[_0x93a3('0x1e')](_0x93a3('0x22'),_0x2cb8f[_0x93a3('0x23')]),_0x2cb8f);agents['agentcalled'](_0x2cb8f);}catch(_0x222420){utils[_0x93a3('0x19')](util[_0x93a3('0x1e')]('[%s][index][agentcalled]',_0x2cb8f[_0x93a3('0x23')]),_0x222420);}});ami['on'](_0x93a3('0x24'),function(_0x98c3e2){try{utils['debug'](util['format']('[%s][index][agentringnoanswer]',_0x98c3e2[_0x93a3('0x23')]),_0x98c3e2);agents['agentringnoanswer'](_0x98c3e2);}catch(_0xfdda38){utils[_0x93a3('0x19')](util[_0x93a3('0x1e')]('[%s][index][agentringnoanswer]',_0x98c3e2[_0x93a3('0x23')]),_0xfdda38);}});ami['on']('agentconnect',function(_0xdd288f){try{utils[_0x93a3('0x1d')](util[_0x93a3('0x1e')](_0x93a3('0x25'),_0xdd288f[_0x93a3('0x23')]),_0xdd288f);agents[_0x93a3('0x26')](_0xdd288f);queues['agentconnect'](_0xdd288f);}catch(_0x160906){utils[_0x93a3('0x19')](util['format'](_0x93a3('0x25'),_0xdd288f['uniqueid']),_0x160906);}});ami['on']('agentcomplete',function(_0xb2f280){try{utils[_0x93a3('0x1d')](util[_0x93a3('0x1e')](_0x93a3('0x27'),_0xb2f280[_0x93a3('0x23')]),_0xb2f280);agents[_0x93a3('0x28')](_0xb2f280);queues[_0x93a3('0x28')](_0xb2f280);members['agentcomplete'](_0xb2f280);}catch(_0x426ee8){utils[_0x93a3('0x19')](util[_0x93a3('0x1e')](_0x93a3('0x27'),_0xb2f280[_0x93a3('0x23')]),_0x426ee8);}});ami['on'](_0x93a3('0x29'),function(_0x40c652){try{utils[_0x93a3('0x1d')](util[_0x93a3('0x1e')](_0x93a3('0x2a'),_0x40c652[_0x93a3('0x23')]),_0x40c652);agents['queuecallerabandon'](_0x40c652);queues[_0x93a3('0x29')](_0x40c652);}catch(_0x33278d){utils[_0x93a3('0x19')](util[_0x93a3('0x1e')](_0x93a3('0x2a'),_0x40c652[_0x93a3('0x23')]),_0x33278d);}});ami['on'](_0x93a3('0x2b'),function(_0x251b96){try{utils['debug'](util[_0x93a3('0x1e')](_0x93a3('0x2c'),_0x251b96[_0x93a3('0x23')]),_0x251b96);queues['queuecallerjoin'](_0x251b96);recordings[_0x93a3('0x2b')](_0x251b96);}catch(_0x5759ce){utils[_0x93a3('0x19')](util['format'](_0x93a3('0x2c'),_0x251b96[_0x93a3('0x23')]),_0x5759ce);}});ami['on'](_0x93a3('0x2d'),function(_0x40e575){try{utils[_0x93a3('0x1d')](util['format'](_0x93a3('0x2e'),_0x40e575[_0x93a3('0x23')]),_0x40e575);queues['queuecallerleave'](_0x40e575);}catch(_0x3e351a){utils['error'](util['format']('[%s][index][queuecallerleave]',_0x40e575['uniqueid']),_0x3e351a);}});ami['on'](_0x93a3('0x2f'),function(_0x53520e){try{utils[_0x93a3('0x1d')](util['format'](_0x93a3('0x30'),_0x53520e[_0x93a3('0x23')]),_0x53520e);queues['musiconholdstart'](_0x53520e);calls[_0x93a3('0x2f')](_0x53520e);}catch(_0x514fe5){utils['error'](util[_0x93a3('0x1e')](_0x93a3('0x30'),_0x53520e[_0x93a3('0x23')]),_0x514fe5);}});ami['on']('musiconholdstop',function(_0x58c5f4){try{utils['debug'](util[_0x93a3('0x1e')](_0x93a3('0x31'),_0x58c5f4['uniqueid']),_0x58c5f4);queues[_0x93a3('0x32')](_0x58c5f4);calls['musiconholdstop'](_0x58c5f4);}catch(_0x42633f){utils['error'](util[_0x93a3('0x1e')](_0x93a3('0x31'),_0x58c5f4[_0x93a3('0x23')]),_0x42633f);}});ami['on'](_0x93a3('0x33'),function(_0x3d4f4e){try{utils['debug'](util[_0x93a3('0x1e')](_0x93a3('0x34'),_0x3d4f4e['uniqueid']),_0x3d4f4e);calls[_0x93a3('0x33')](_0x3d4f4e);recordings[_0x93a3('0x33')](_0x3d4f4e);}catch(_0x4b2440){utils[_0x93a3('0x19')](util[_0x93a3('0x1e')](_0x93a3('0x34'),_0x3d4f4e[_0x93a3('0x23')]),_0x4b2440);}});ami['on'](_0x93a3('0x35'),function(_0x59c2b0){try{utils[_0x93a3('0x1d')](util[_0x93a3('0x1e')]('[%s][index][hangup]',_0x59c2b0[_0x93a3('0x23')]),_0x59c2b0);calls[_0x93a3('0x35')](_0x59c2b0);recordings[_0x93a3('0x35')](_0x59c2b0);dials[_0x93a3('0x35')](_0x59c2b0);agents[_0x93a3('0x35')](_0x59c2b0);queues[_0x93a3('0x35')](_0x59c2b0);}catch(_0x311314){utils['error'](util[_0x93a3('0x1e')](_0x93a3('0x36'),_0x59c2b0['uniqueid']),_0x311314);}});ami['on']('cdr',function(_0xb8c750){try{utils[_0x93a3('0x1d')](util['format'](_0x93a3('0x37'),_0xb8c750['uniqueid']),_0xb8c750);members['cdr'](_0xb8c750);}catch(_0x127b1f){utils[_0x93a3('0x19')](util[_0x93a3('0x1e')]('[%s][index][cdr]',_0xb8c750[_0x93a3('0x23')]),_0x127b1f);}});ami['on'](_0x93a3('0x38'),function(_0xda727b){try{utils['debug'](util['format']('[%s][index][blindtransfer]',_0xda727b[_0x93a3('0x23')]),_0xda727b);queues['blindtransfer'](_0xda727b);agents[_0x93a3('0x38')](_0xda727b);transfers['blindtransfer'](_0xda727b);}catch(_0xcf8efc){utils[_0x93a3('0x19')](util[_0x93a3('0x1e')]('[%s][index][blindtransfer]',_0xda727b[_0x93a3('0x23')]),_0xcf8efc);}});ami['on'](_0x93a3('0x39'),function(_0x306ea2){try{utils[_0x93a3('0x1d')](util['format']('[%s][index][attendedtransfer]',_0x306ea2[_0x93a3('0x3a')]),_0x306ea2);queues['attendedtransfer'](_0x306ea2);transfers[_0x93a3('0x39')](_0x306ea2);agents['attendedtransfer'](_0x306ea2);calls[_0x93a3('0x39')](_0x306ea2);}catch(_0xd8aa8e){utils[_0x93a3('0x19')](util['format'](_0x93a3('0x3b'),_0x306ea2[_0x93a3('0x3a')]),_0xd8aa8e);}});ami['on'](_0x93a3('0x3c'),function(_0x5b0632){try{utils[_0x93a3('0x1d')](util['format']('[%s][index][varset]',_0x5b0632[_0x93a3('0x23')]),_0x5b0632);queues[_0x93a3('0x3c')](_0x5b0632);recordings[_0x93a3('0x3c')](_0x5b0632);calls[_0x93a3('0x3c')](_0x5b0632);dials[_0x93a3('0x3c')](_0x5b0632);}catch(_0x79956a){utils['error'](util[_0x93a3('0x1e')](_0x93a3('0x3d'),_0x5b0632[_0x93a3('0x23')]),_0x79956a);}});ami['on'](_0x93a3('0x3e'),function(_0x3ae738){try{utils[_0x93a3('0x1d')](util[_0x93a3('0x1e')](_0x93a3('0x3f'),_0x3ae738['uniqueid']),_0x3ae738);calls['newexten'](_0x3ae738);recordings[_0x93a3('0x3e')](_0x3ae738);dials['newexten'](_0x3ae738);}catch(_0x116b27){utils[_0x93a3('0x19')](util['format']('[%s][index][newexten]',_0x3ae738[_0x93a3('0x23')]),_0x116b27);}});ami['on'](_0x93a3('0x40'),function(_0xc2c43){try{utils['debug'](util['format'](_0x93a3('0x41'),_0xc2c43[_0x93a3('0x23')]),_0xc2c43);calls[_0x93a3('0x40')](_0xc2c43);recordings['newchannel'](_0xc2c43);}catch(_0xacb5b5){utils[_0x93a3('0x19')](util[_0x93a3('0x1e')](_0x93a3('0x41'),_0xc2c43['uniqueid']),_0xacb5b5);}});ami['on'](_0x93a3('0x42'),function(_0xb5315f){try{utils[_0x93a3('0x1d')](util['format']('[%s][index][dialbegin]',_0xb5315f[_0x93a3('0x23')]),_0xb5315f);dials[_0x93a3('0x42')](_0xb5315f);}catch(_0x176d67){utils[_0x93a3('0x19')](util[_0x93a3('0x1e')](_0x93a3('0x43'),_0xb5315f[_0x93a3('0x23')]),_0x176d67);}});ami['on'](_0x93a3('0x44'),function(_0x314ba2){try{utils['debug'](util[_0x93a3('0x1e')](_0x93a3('0x45'),_0x314ba2[_0x93a3('0x23')]),_0x314ba2);dials['dialend'](_0x314ba2);}catch(_0x548a43){utils[_0x93a3('0x19')](util['format'](_0x93a3('0x45'),_0x314ba2['uniqueid']),_0x548a43);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 79e6f0d..27c7ef9 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 _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 +var _0x91d0=['some','startsWith','devicestatechange','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','NOT_INUSE','isNil','exitAt','diffTime','enterAt','error','[%s][members][devicestatechange]','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','channel','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','util','./utils','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','data2','type','getUserByInterface','then','membername','name','internal','request','CreateMemberReport','split'];(function(_0x56ec48,_0x32fc3c){var _0x50953c=function(_0x2daf70){while(--_0x2daf70){_0x56ec48['push'](_0x56ec48['shift']());}};_0x50953c(++_0x32fc3c);}(_0x91d0,0xb6));var _0x091d=function(_0x58efa6,_0x2c00bd){_0x58efa6=_0x58efa6-0x0;var _0x5d643c=_0x91d0[_0x58efa6];return _0x5d643c;};'use strict';var _=require('lodash');var util=require(_0x091d('0x0'));var utils=require(_0x091d('0x1'));var members={};var exclude=['Local/_attended@transfer',_0x091d('0x2')];function writeDB(_0x55d26d){utils[_0x091d('0x3')](util[_0x091d('0x4')](_0x091d('0x5'),_0x55d26d[_0x091d('0x6')],_0x55d26d[_0x091d('0x7')],_0x55d26d['channel'],_0x55d26d[_0x091d('0x8')],_0x55d26d['membername'],_0x55d26d[_0x091d('0x9')]));if(_0x55d26d[_0x091d('0x7')]){utils[_0x091d('0xa')](_0x55d26d[_0x091d('0x7')])[_0x091d('0xb')](function(_0x53a64a){if(_0x53a64a){_0x55d26d[_0x091d('0xc')]=_0x53a64a[_0x091d('0xd')];_0x55d26d[_0x091d('0xe')]=_0x53a64a[_0x091d('0xe')];utils[_0x091d('0xf')](_0x091d('0x10'),_0x55d26d);}else{utils['getUserByName'](_0x55d26d[_0x091d('0x7')][_0x091d('0x11')]('/')[0x1])[_0x091d('0xb')](function(_0x200057){if(_0x200057){_0x55d26d[_0x091d('0xc')]=_0x200057[_0x091d('0xd')];_0x55d26d[_0x091d('0xe')]=_0x200057[_0x091d('0xe')];utils[_0x091d('0xf')](_0x091d('0x10'),_0x55d26d);}});}})['catch'](function(_0x16e8ed){utils['error'](util['format']('[%s][members][writeDB]',_0x55d26d[_0x091d('0x6')]),_0x16e8ed);});}delete members[_0x55d26d[_0x091d('0x7')]];}function startsWith(_0x4338c7,_0x564370){return _[_0x091d('0x12')](_0x4338c7,function(_0x31a577){return _[_0x091d('0x13')](_0x564370,_0x31a577);});}exports[_0x091d('0x14')]=function(_0x53e642){try{utils[_0x091d('0x15')](util['format']('[%s][members][devicestatechange]',members[_0x53e642[_0x091d('0x16')]]?members[_0x53e642[_0x091d('0x16')]][_0x091d('0x6')]:_0x53e642[_0x091d('0x16')]),_0x53e642);utils[_0x091d('0x3')](util[_0x091d('0x4')](_0x091d('0x17'),members[_0x53e642[_0x091d('0x16')]]?members[_0x53e642[_0x091d('0x16')]]['uniqueid']:_0x53e642['device'],_0x53e642[_0x091d('0x18')],_0x53e642[_0x091d('0x16')]));switch(_0x53e642['state']){case _0x091d('0x19'):case _0x091d('0x1a'):if(!startsWith(exclude,_0x53e642[_0x091d('0x16')])){members[_0x53e642['device']]={'channel':_0x091d('0x1b'),'interface':_0x53e642[_0x091d('0x16')],'type':_0x091d('0x1c'),'enterAt':utils[_0x091d('0x1d')](),'role':'agent'};}break;case _0x091d('0x1e'):if(!_[_0x091d('0x1f')](members[_0x53e642[_0x091d('0x16')]])){members[_0x53e642[_0x091d('0x16')]][_0x091d('0x20')]=utils[_0x091d('0x1d')]();members[_0x53e642[_0x091d('0x16')]]['duration']=utils[_0x091d('0x21')](members[_0x53e642[_0x091d('0x16')]][_0x091d('0x20')],members[_0x53e642[_0x091d('0x16')]][_0x091d('0x22')]);if(members[_0x53e642[_0x091d('0x16')]]['uniqueid']){writeDB(members[_0x53e642[_0x091d('0x16')]]);}}break;default:break;}}catch(_0x4fec4d){utils[_0x091d('0x23')](util[_0x091d('0x4')](_0x091d('0x24'),members[_0x53e642['device']]?members[_0x53e642[_0x091d('0x16')]][_0x091d('0x6')]:_0x53e642[_0x091d('0x16')]),_0x4fec4d);}};exports['agentcomplete']=function(_0x1a23a5){try{if(!_[_0x091d('0x1f')](members[_0x1a23a5['interface']])){utils[_0x091d('0x15')](util[_0x091d('0x4')](_0x091d('0x25'),_0x1a23a5['uniqueid']),_0x1a23a5);utils[_0x091d('0x3')](util[_0x091d('0x4')](_0x091d('0x26'),_0x1a23a5['uniqueid'],_0x1a23a5[_0x091d('0x7')],_0x1a23a5[_0x091d('0x27')]));members[_0x1a23a5['interface']]=_[_0x091d('0x28')](members[_0x1a23a5[_0x091d('0x7')]],{'data4':_0x1a23a5[_0x091d('0x27')],'uniqueid':_0x1a23a5['uniqueid']});}}catch(_0x100616){utils['error'](util[_0x091d('0x4')](_0x091d('0x25'),_0x1a23a5[_0x091d('0x6')]),_0x100616);}};exports[_0x091d('0x29')]=function(_0x4fb661){try{utils['debug'](util['format'](_0x091d('0x2a'),_0x4fb661['uniqueid']),_0x4fb661);if(_0x4fb661['channel']){var _0x4680fd=_0x4fb661[_0x091d('0x2b')][_0x091d('0x11')]('-')[0x0];if(!_[_0x091d('0x1f')](members[_0x4680fd])){members[_0x4680fd]=_['assign'](members[_0x4680fd],{'data1':members[_0x4680fd]['data1']||_0x4fb661['type'],'data2':members[_0x4680fd][_0x091d('0x8')]||_0x4fb661[_0x091d('0x2c')],'data3':members[_0x4680fd][_0x091d('0x2d')]||_0x4fb661[_0x091d('0x2e')],'uniqueid':members[_0x4680fd]['uniqueid']||_0x4fb661[_0x091d('0x6')]});utils[_0x091d('0x3')](util[_0x091d('0x4')](_0x091d('0x2f'),_0x4fb661[_0x091d('0x6')],members[_0x4680fd][_0x091d('0x30')],members[_0x4680fd][_0x091d('0x8')],members[_0x4680fd][_0x091d('0x2d')]));if(members[_0x4680fd][_0x091d('0x20')]){writeDB(members[_0x4680fd]);}}}if(_0x4fb661[_0x091d('0x31')]){var _0x594c30=_0x4fb661['destinationchannel'][_0x091d('0x11')]('-')[0x0];if(!_[_0x091d('0x1f')](members[_0x594c30])){members[_0x594c30]=_[_0x091d('0x28')](members[_0x594c30],{'data1':members[_0x594c30][_0x091d('0x30')]||_0x4fb661['type'],'data2':members[_0x594c30][_0x091d('0x8')]||_0x4fb661[_0x091d('0x2c')],'data3':members[_0x594c30][_0x091d('0x2d')]||_0x4fb661[_0x091d('0x2e')],'uniqueid':members[_0x594c30][_0x091d('0x6')]||_0x4fb661[_0x091d('0x6')]});utils[_0x091d('0x3')](util[_0x091d('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x4fb661[_0x091d('0x6')],members[_0x594c30][_0x091d('0x30')],members[_0x594c30][_0x091d('0x8')],members[_0x594c30][_0x091d('0x2d')]));if(members[_0x594c30][_0x091d('0x20')]){writeDB(members[_0x594c30]);}}}}catch(_0x3f636b){utils[_0x091d('0x23')](util[_0x091d('0x4')](_0x091d('0x2a'),_0x4fb661[_0x091d('0x6')]),_0x3f636b);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index c94cecc..7bfbd44 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 _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 +var _0x8d7b=['TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridname','queuecallerjoinAt','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','mohtime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','isNil','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','queuecallerleaveAt','holdtime','diffTime','count','connectedlinenum','connectedlinename','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','membername','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','reason','transfer'];(function(_0x53589e,_0x25aa75){var _0x3b3e0d=function(_0x1e0cc4){while(--_0x1e0cc4){_0x53589e['push'](_0x53589e['shift']());}};_0x3b3e0d(++_0x25aa75);}(_0x8d7b,0x15d));var _0xb8d7=function(_0x50cf73,_0x5501cb){_0x50cf73=_0x50cf73-0x0;var _0x4ec887=_0x8d7b[_0x50cf73];return _0x4ec887;};'use strict';var _=require(_0xb8d7('0x0'));var util=require(_0xb8d7('0x1'));var utils=require(_0xb8d7('0x2'));var queues={};function writeDB(_0x417581){utils[_0xb8d7('0x3')](util[_0xb8d7('0x4')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x417581[_0xb8d7('0x5')],_0x417581[_0xb8d7('0x6')],_0x417581['queue'],_0x417581[_0xb8d7('0x7')],_0x417581[_0xb8d7('0x8')],_0x417581[_0xb8d7('0x9')],_0x417581[_0xb8d7('0xa')]));if(_0x417581[_0xb8d7('0xb')]){utils[_0xb8d7('0xc')](_0x417581[_0xb8d7('0xb')])['then'](function(_0x887f52){if(_0x887f52){_0x417581[_0xb8d7('0xd')]=_0x887f52[_0xb8d7('0xd')];}utils[_0xb8d7('0xe')](_0xb8d7('0xf'),_0x417581);});}else{utils[_0xb8d7('0xe')]('CreateVoiceQueueReport',_0x417581);}if(_0x417581[_0xb8d7('0x10')]){delete queues[_0x417581[_0xb8d7('0x10')]];}else{delete queues[_0x417581[_0xb8d7('0x5')]];}}exports['queuecallerjoin']=function(_0x234340){try{utils[_0xb8d7('0x11')](util[_0xb8d7('0x4')](_0xb8d7('0x12'),_0x234340[_0xb8d7('0x5')]),_0x234340);utils[_0xb8d7('0x3')](util[_0xb8d7('0x4')](_0xb8d7('0x13'),_0x234340[_0xb8d7('0x5')],_0x234340[_0xb8d7('0xb')],_0x234340[_0xb8d7('0x14')]));queues[_0x234340[_0xb8d7('0x5')]]=_[_0xb8d7('0x15')](_0x234340,{'originalposition':_0x234340[_0xb8d7('0x14')],'queuecallerjoinAt':utils[_0xb8d7('0x16')](),'mohtime':0x0});}catch(_0x51973e){utils[_0xb8d7('0x17')](util[_0xb8d7('0x4')](_0xb8d7('0x12'),_0x234340['uniqueid']),_0x51973e);}};exports['hangup']=function(_0x298e67){try{if(!_['isNil'](queues[_0x298e67[_0xb8d7('0x5')]])){utils[_0xb8d7('0x11')](util[_0xb8d7('0x4')](_0xb8d7('0x18'),_0x298e67[_0xb8d7('0x5')]),_0x298e67);if(queues[_0x298e67[_0xb8d7('0x5')]]['queuecallerleaveAt']){if(!queues[_0x298e67[_0xb8d7('0x5')]][_0xb8d7('0x19')]&&!queues[_0x298e67['uniqueid']][_0xb8d7('0x1a')]){queues[_0x298e67[_0xb8d7('0x5')]]['queuecallercomplete']=!![];queues[_0x298e67['uniqueid']][_0xb8d7('0x1b')]=utils['now']();queues[_0x298e67[_0xb8d7('0x5')]][_0xb8d7('0xa')]=_0xb8d7('0x1c');}utils['info'](util[_0xb8d7('0x4')](_0xb8d7('0x1d'),_0x298e67[_0xb8d7('0x5')],queues[_0x298e67[_0xb8d7('0x5')]]['name'],queues[_0x298e67[_0xb8d7('0x5')]][_0xb8d7('0xa')]));writeDB(queues[_0x298e67['uniqueid']]);}else if(queues[_0x298e67[_0xb8d7('0x5')]][_0xb8d7('0x10')]){utils[_0xb8d7('0x3')](util[_0xb8d7('0x4')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x298e67[_0xb8d7('0x5')],queues[_0x298e67['uniqueid']][_0xb8d7('0x1e')],queues[_0x298e67[_0xb8d7('0x5')]]['transfereduniqueid']));queues[queues[_0x298e67[_0xb8d7('0x5')]]['transfereduniqueid']]=queues[_0x298e67['uniqueid']];queues[queues[_0x298e67[_0xb8d7('0x5')]][_0xb8d7('0x10')]][_0xb8d7('0x1f')]=0x2;delete queues[_0x298e67[_0xb8d7('0x5')]];}}}catch(_0x2c2c6c){utils['error'](util[_0xb8d7('0x4')](_0xb8d7('0x18'),_0x298e67[_0xb8d7('0x5')]),_0x2c2c6c);}};exports[_0xb8d7('0x20')]=function(_0x1be374){try{utils[_0xb8d7('0x11')](util[_0xb8d7('0x4')](_0xb8d7('0x21'),_0x1be374[_0xb8d7('0x5')]),_0x1be374);if(!_[_0xb8d7('0x22')](_0x1be374[_0xb8d7('0x23')][_0xb8d7('0x24')])&&_0x1be374[_0xb8d7('0x25')][_0xb8d7('0x26')]()!==_0xb8d7('0x27')){if(!_[_0xb8d7('0x22')](queues[_0x1be374[_0xb8d7('0x5')]])){queues[_0x1be374[_0xb8d7('0x5')]]['queuecallerabandon']=![];queues[_0x1be374[_0xb8d7('0x5')]][_0xb8d7('0x28')]=null;queues[_0x1be374['uniqueid']][_0xb8d7('0x1a')]=!![];queues[_0x1be374['uniqueid']]['queuecallerexitAt']=utils[_0xb8d7('0x16')]();queues[_0x1be374[_0xb8d7('0x5')]]['queuecallerexitreason']=_0x1be374[_0xb8d7('0x25')][_0xb8d7('0x26')]();utils[_0xb8d7('0x3')](util[_0xb8d7('0x4')](_0xb8d7('0x29'),_0x1be374[_0xb8d7('0x5')],queues[_0x1be374[_0xb8d7('0x5')]][_0xb8d7('0x1e')],_0x1be374['value'],queues[_0x1be374[_0xb8d7('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x1be374[_0xb8d7('0x5')]]);}}else if(!_['isNil'](_0x1be374['variable'][_0xb8d7('0x2a')])){if(!_[_0xb8d7('0x22')](queues[_0x1be374['uniqueid']])&&!queues[_0x1be374[_0xb8d7('0x5')]][_0xb8d7('0x19')]){queues[_0x1be374[_0xb8d7('0x5')]]['queuecallerabandon']=![];queues[_0x1be374['uniqueid']][_0xb8d7('0x28')]=null;queues[_0x1be374[_0xb8d7('0x5')]]['queuecallerexit']=!![];queues[_0x1be374[_0xb8d7('0x5')]][_0xb8d7('0x2b')]=utils[_0xb8d7('0x16')]();queues[_0x1be374[_0xb8d7('0x5')]][_0xb8d7('0xa')]=_0xb8d7('0x2c');utils[_0xb8d7('0x3')](util[_0xb8d7('0x4')](_0xb8d7('0x2d'),_0x1be374[_0xb8d7('0x5')],queues[_0x1be374[_0xb8d7('0x5')]][_0xb8d7('0x1e')],_0x1be374[_0xb8d7('0x25')],queues[_0x1be374[_0xb8d7('0x5')]][_0xb8d7('0xa')]));}}}catch(_0x113d1){utils[_0xb8d7('0x17')](util['format'](_0xb8d7('0x21'),_0x1be374[_0xb8d7('0x5')]),_0x113d1);}};exports[_0xb8d7('0x19')]=function(_0x5dde7){try{if(!_[_0xb8d7('0x22')](queues[_0x5dde7[_0xb8d7('0x5')]])){utils[_0xb8d7('0x11')](util[_0xb8d7('0x4')](_0xb8d7('0x2e'),_0x5dde7[_0xb8d7('0x5')]),_0x5dde7);queues[_0x5dde7[_0xb8d7('0x5')]][_0xb8d7('0x1a')]=![];queues[_0x5dde7[_0xb8d7('0x5')]]['queuecallerexitAt']=null;queues[_0x5dde7[_0xb8d7('0x5')]][_0xb8d7('0x19')]=!![];queues[_0x5dde7[_0xb8d7('0x5')]][_0xb8d7('0x28')]=utils['now']();queues[_0x5dde7['uniqueid']][_0xb8d7('0xa')]=_0xb8d7('0x2f');utils[_0xb8d7('0x3')](util[_0xb8d7('0x4')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x5dde7[_0xb8d7('0x5')],queues[_0x5dde7['uniqueid']][_0xb8d7('0x1e')],queues[_0x5dde7[_0xb8d7('0x5')]][_0xb8d7('0xa')]));}}catch(_0x2f7832){utils[_0xb8d7('0x17')](util[_0xb8d7('0x4')](_0xb8d7('0x2e'),_0x5dde7[_0xb8d7('0x5')]),_0x2f7832);}};exports[_0xb8d7('0x30')]=function(_0x13049f){try{if(!_['isNil'](queues[_0x13049f[_0xb8d7('0x5')]])){utils['debug'](util['format'](_0xb8d7('0x31'),_0x13049f[_0xb8d7('0x5')]),_0x13049f);utils[_0xb8d7('0x3')](util[_0xb8d7('0x4')](_0xb8d7('0x32'),_0x13049f[_0xb8d7('0x5')],queues[_0x13049f['uniqueid']]['name'],_0x13049f['connectedlinenum'],_0x13049f['connectedlinename']));queues[_0x13049f[_0xb8d7('0x5')]][_0xb8d7('0x30')]=!![];queues[_0x13049f[_0xb8d7('0x5')]][_0xb8d7('0x33')]=utils[_0xb8d7('0x16')]();queues[_0x13049f[_0xb8d7('0x5')]][_0xb8d7('0x34')]=utils[_0xb8d7('0x35')](queues[_0x13049f[_0xb8d7('0x5')]][_0xb8d7('0x33')],queues[_0x13049f[_0xb8d7('0x5')]]['queuecallerjoinAt']);queues[_0x13049f['uniqueid']][_0xb8d7('0x14')]=_0x13049f[_0xb8d7('0x14')];queues[_0x13049f['uniqueid']]['count']=_0x13049f[_0xb8d7('0x36')];queues[_0x13049f[_0xb8d7('0x5')]][_0xb8d7('0x37')]=_0x13049f['connectedlinenum'];queues[_0x13049f['uniqueid']][_0xb8d7('0x38')]=_0x13049f[_0xb8d7('0x38')];}}catch(_0x5e67ba){utils['error'](util[_0xb8d7('0x4')](_0xb8d7('0x31'),_0x13049f['uniqueid']),_0x5e67ba);}};exports['agentconnect']=function(_0x1c946e){try{if(!_[_0xb8d7('0x22')](queues[_0x1c946e[_0xb8d7('0x5')]])){utils[_0xb8d7('0x11')](util[_0xb8d7('0x4')](_0xb8d7('0x39'),_0x1c946e[_0xb8d7('0x5')]),_0x1c946e);utils[_0xb8d7('0x3')](util['format'](_0xb8d7('0x3a'),_0x1c946e[_0xb8d7('0x5')],queues[_0x1c946e[_0xb8d7('0x5')]]['name'],_0x1c946e['membername'],_0x1c946e[_0xb8d7('0x3b')]));queues[_0x1c946e['uniqueid']][_0xb8d7('0x19')]=![];queues[_0x1c946e[_0xb8d7('0x5')]][_0xb8d7('0x19')]=![];queues[_0x1c946e[_0xb8d7('0x5')]][_0xb8d7('0x28')]=null;queues[_0x1c946e[_0xb8d7('0x5')]]['queuecallerexit']=![];queues[_0x1c946e[_0xb8d7('0x5')]]['queuecallerexitreason']=null;queues[_0x1c946e[_0xb8d7('0x5')]][_0xb8d7('0x2b')]=null;queues[_0x1c946e[_0xb8d7('0x5')]][_0xb8d7('0x3c')]=!![];queues[_0x1c946e[_0xb8d7('0x5')]][_0xb8d7('0x9')]=_0x1c946e['destaccountcode'];queues[_0x1c946e[_0xb8d7('0x5')]]['lastAssignedTo']=_0x1c946e[_0xb8d7('0x3d')];}}catch(_0x1bd6cb){utils[_0xb8d7('0x17')](util[_0xb8d7('0x4')](_0xb8d7('0x39'),_0x1c946e[_0xb8d7('0x5')]),_0x1bd6cb);}};exports[_0xb8d7('0x3e')]=function(_0x11aeaf){try{if(!_[_0xb8d7('0x22')](queues[_0x11aeaf['uniqueid']])){if(queues[_0x11aeaf[_0xb8d7('0x5')]][_0xb8d7('0x33')]){utils[_0xb8d7('0x11')](util[_0xb8d7('0x4')](_0xb8d7('0x3f'),_0x11aeaf[_0xb8d7('0x5')]),_0x11aeaf);queues[_0x11aeaf[_0xb8d7('0x5')]]['queuecallerabandon']=![];queues[_0x11aeaf[_0xb8d7('0x5')]][_0xb8d7('0x19')]=![];queues[_0x11aeaf[_0xb8d7('0x5')]][_0xb8d7('0x28')]=null;queues[_0x11aeaf[_0xb8d7('0x5')]][_0xb8d7('0x1a')]=![];queues[_0x11aeaf[_0xb8d7('0x5')]][_0xb8d7('0x2b')]=null;queues[_0x11aeaf[_0xb8d7('0x5')]][_0xb8d7('0x3c')]=!![];queues[_0x11aeaf[_0xb8d7('0x5')]]['lastAssignedTo']=_0x11aeaf[_0xb8d7('0x3d')];queues[_0x11aeaf[_0xb8d7('0x5')]][_0xb8d7('0x40')]=!![];queues[_0x11aeaf[_0xb8d7('0x5')]][_0xb8d7('0x1b')]=utils[_0xb8d7('0x16')]();if(_0x11aeaf[_0xb8d7('0x41')]==_0xb8d7('0x42')){if(!queues[_0x11aeaf['uniqueid']]['transfer']){queues[_0x11aeaf['uniqueid']][_0xb8d7('0xa')]=_0xb8d7('0x43');}}else{queues[_0x11aeaf['uniqueid']]['queuecallerexitreason']=_0xb8d7('0x44')+_0x11aeaf[_0xb8d7('0x41')][_0xb8d7('0x26')]();}utils[_0xb8d7('0x3')](util[_0xb8d7('0x4')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x11aeaf[_0xb8d7('0x5')],queues[_0x11aeaf[_0xb8d7('0x5')]][_0xb8d7('0x1e')],_0x11aeaf[_0xb8d7('0x3d')],queues[_0x11aeaf[_0xb8d7('0x5')]][_0xb8d7('0xa')]));writeDB(queues[_0x11aeaf['uniqueid']]);}}}catch(_0x43648e){utils[_0xb8d7('0x17')](util['format'](_0xb8d7('0x3f'),_0x11aeaf[_0xb8d7('0x5')]),_0x43648e);}};exports[_0xb8d7('0x45')]=function(_0x1d4285){try{if(!_[_0xb8d7('0x22')](queues[_0x1d4285[_0xb8d7('0x46')]])){utils[_0xb8d7('0x11')](util['format'](_0xb8d7('0x47'),_0x1d4285['uniqueid']),_0x1d4285);queues[_0x1d4285['transfereeuniqueid']][_0xb8d7('0x42')]=!![];queues[_0x1d4285[_0xb8d7('0x46')]][_0xb8d7('0x48')]=_0xb8d7('0x49');queues[_0x1d4285['transfereeuniqueid']][_0xb8d7('0x4a')]=_0x1d4285[_0xb8d7('0x4b')];queues[_0x1d4285['transfereeuniqueid']][_0xb8d7('0x4c')]=_0x1d4285[_0xb8d7('0x46')];queues[_0x1d4285[_0xb8d7('0x46')]][_0xb8d7('0xa')]='BLINDTRANSFER';utils[_0xb8d7('0x3')](util['format'](_0xb8d7('0x4d'),_0x1d4285[_0xb8d7('0x5')],queues[_0x1d4285[_0xb8d7('0x46')]][_0xb8d7('0x1e')],_0x1d4285[_0xb8d7('0x46')],_0x1d4285['extension']));}}catch(_0x3eb097){utils['error'](util[_0xb8d7('0x4')]('[%s][queues][blindtransfer]',_0x1d4285[_0xb8d7('0x5')]),_0x3eb097);}};exports[_0xb8d7('0x4e')]=function(_0x27fa44){try{utils['debug'](util['format']('[%s][queues][attendedtransfer]',_0x27fa44[_0xb8d7('0x4f')]),_0x27fa44);if(_0x27fa44[_0xb8d7('0x4f')]==_0x27fa44[_0xb8d7('0x50')]){if(!_[_0xb8d7('0x22')](queues[_0x27fa44[_0xb8d7('0x51')]])){utils['info'](util[_0xb8d7('0x4')](_0xb8d7('0x52'),_0x27fa44['origtransfereruniqueid'],queues[_0x27fa44[_0xb8d7('0x51')]][_0xb8d7('0x1e')],_0x27fa44['origtransfererexten']));queues[_0x27fa44['secondtransfererlinkedid']][_0xb8d7('0x42')]=!![];queues[_0x27fa44['secondtransfererlinkedid']][_0xb8d7('0x48')]=_0xb8d7('0x53');queues[_0x27fa44[_0xb8d7('0x51')]]['transferexten']=_0x27fa44[_0xb8d7('0x54')];queues[_0x27fa44[_0xb8d7('0x51')]][_0xb8d7('0x4c')]=_0x27fa44[_0xb8d7('0x4f')];queues[_0x27fa44[_0xb8d7('0x51')]]['queuecallerexitreason']=_0xb8d7('0x55');}if(!_[_0xb8d7('0x22')](queues[_0x27fa44[_0xb8d7('0x50')]])){if(_0x27fa44[_0xb8d7('0x56')]&&queues[_0x27fa44[_0xb8d7('0x56')]]){queues[_0x27fa44[_0xb8d7('0x56')]]['queuecallerenterreason']=0x1;queues[_0x27fa44['transfereeuniqueid']]=_[_0xb8d7('0x57')](queues[_0x27fa44[_0xb8d7('0x56')]]);queues[_0x27fa44['transfereeuniqueid']][_0xb8d7('0x10')]=_0x27fa44['transfertargetuniqueid'];queues[_0x27fa44[_0xb8d7('0x46')]][_0xb8d7('0x1f')]=0x2;queues[_0x27fa44[_0xb8d7('0x46')]][_0xb8d7('0x8')]=queues[_0x27fa44['secondtransfererlinkedid']][_0xb8d7('0x8')];queues[_0x27fa44[_0xb8d7('0x46')]][_0xb8d7('0x58')]=queues[_0x27fa44[_0xb8d7('0x51')]][_0xb8d7('0x58')];queues[_0x27fa44['transfereeuniqueid']][_0xb8d7('0x59')]=utils[_0xb8d7('0x16')]();queues[_0x27fa44[_0xb8d7('0x46')]]['queuecallerleaveAt']=utils['now']();queues[_0x27fa44[_0xb8d7('0x46')]][_0xb8d7('0x34')]=0x0;queues[_0x27fa44['transfereeuniqueid']]['mohtime']=0x0;utils['info'](util[_0xb8d7('0x4')](_0xb8d7('0x5a'),_0x27fa44[_0xb8d7('0x4f')],queues[_0x27fa44[_0xb8d7('0x46')]][_0xb8d7('0x1e')],queues[_0x27fa44[_0xb8d7('0x46')]][_0xb8d7('0x8')],queues[_0x27fa44[_0xb8d7('0x46')]]['calleridname']));}else{utils[_0xb8d7('0x3')](util[_0xb8d7('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x27fa44['origtransfereruniqueid'],queues[_0x27fa44['origtransfererlinkedid']]['name'],_0x27fa44[_0xb8d7('0x51')]));queues[_0x27fa44[_0xb8d7('0x50')]]['transfereduniqueid']=_0x27fa44[_0xb8d7('0x51')];}}}else if(_0x27fa44[_0xb8d7('0x5b')]==_0x27fa44[_0xb8d7('0x51')]){if(!_[_0xb8d7('0x22')](queues[_0x27fa44[_0xb8d7('0x50')]])){utils[_0xb8d7('0x3')](util[_0xb8d7('0x4')](_0xb8d7('0x5c'),_0x27fa44[_0xb8d7('0x4f')],queues[_0x27fa44['origtransfererlinkedid']][_0xb8d7('0x1e')],_0x27fa44[_0xb8d7('0x5b')],_0x27fa44[_0xb8d7('0x5d')]));queues[_0x27fa44[_0xb8d7('0x50')]][_0xb8d7('0x42')]=!![];queues[_0x27fa44['origtransfererlinkedid']][_0xb8d7('0x48')]=_0xb8d7('0x53');queues[_0x27fa44[_0xb8d7('0x50')]][_0xb8d7('0x4a')]=_0x27fa44['secondtransfererexten'];queues[_0x27fa44['origtransfererlinkedid']][_0xb8d7('0x4c')]=_0x27fa44[_0xb8d7('0x5b')];queues[_0x27fa44['origtransfererlinkedid']][_0xb8d7('0xa')]=_0xb8d7('0x55');}if(!_[_0xb8d7('0x22')](queues[_0x27fa44['secondtransfererlinkedid']])){if(_0x27fa44[_0xb8d7('0x5e')]&&queues[_0x27fa44[_0xb8d7('0x5e')]]){queues[_0x27fa44[_0xb8d7('0x5e')]][_0xb8d7('0x1f')]=0x1;queues[_0x27fa44[_0xb8d7('0x5f')]]=_[_0xb8d7('0x57')](queues[_0x27fa44[_0xb8d7('0x5e')]]);queues[_0x27fa44[_0xb8d7('0x5f')]][_0xb8d7('0x10')]=_0x27fa44[_0xb8d7('0x5f')];queues[_0x27fa44[_0xb8d7('0x5f')]]['queuecallerenterreason']=0x2;queues[_0x27fa44[_0xb8d7('0x5f')]][_0xb8d7('0x8')]=queues[_0x27fa44['origtransfererlinkedid']][_0xb8d7('0x8')];queues[_0x27fa44[_0xb8d7('0x5f')]][_0xb8d7('0x58')]=queues[_0x27fa44[_0xb8d7('0x50')]][_0xb8d7('0x58')];queues[_0x27fa44[_0xb8d7('0x5f')]][_0xb8d7('0x59')]=utils[_0xb8d7('0x16')]();queues[_0x27fa44[_0xb8d7('0x5f')]][_0xb8d7('0x33')]=utils['now']();queues[_0x27fa44['transfertargetuniqueid']][_0xb8d7('0x34')]=0x0;queues[_0x27fa44[_0xb8d7('0x5f')]]['mohtime']=0x0;utils[_0xb8d7('0x3')](util[_0xb8d7('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x27fa44['origtransfereruniqueid'],queues[_0x27fa44[_0xb8d7('0x5f')]][_0xb8d7('0x1e')],queues[_0x27fa44[_0xb8d7('0x5f')]][_0xb8d7('0x10')],queues[_0x27fa44[_0xb8d7('0x5f')]][_0xb8d7('0x8')],queues[_0x27fa44['transfertargetuniqueid']]['calleridname']));}else{utils[_0xb8d7('0x3')](util[_0xb8d7('0x4')](_0xb8d7('0x60'),_0x27fa44['origtransfereruniqueid'],queues[_0x27fa44[_0xb8d7('0x51')]]['name'],_0x27fa44[_0xb8d7('0x50')]));queues[_0x27fa44[_0xb8d7('0x51')]]['transfereduniqueid']=_0x27fa44[_0xb8d7('0x50')];}}}}catch(_0x4d4da3){utils[_0xb8d7('0x17')](util['format'](_0xb8d7('0x61'),_0x27fa44[_0xb8d7('0x4f')]),_0x4d4da3);}};exports[_0xb8d7('0x62')]=function(_0x3eff6a){try{if(!_['isNil'](queues[_0x3eff6a[_0xb8d7('0x5')]])){utils[_0xb8d7('0x11')](util['format'](_0xb8d7('0x63'),_0x3eff6a[_0xb8d7('0x5')]),_0x3eff6a);queues[_0x3eff6a[_0xb8d7('0x5')]][_0xb8d7('0x64')]=utils[_0xb8d7('0x16')]();utils[_0xb8d7('0x3')](util[_0xb8d7('0x4')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x3eff6a[_0xb8d7('0x5')],queues[_0x3eff6a[_0xb8d7('0x5')]][_0xb8d7('0x1e')],queues[_0x3eff6a[_0xb8d7('0x5')]][_0xb8d7('0x64')]));}}catch(_0x293973){utils[_0xb8d7('0x17')](util['format'](_0xb8d7('0x63'),_0x3eff6a[_0xb8d7('0x5')]),_0x293973);}};exports['musiconholdstop']=function(_0x34987e){try{if(!_['isNil'](queues[_0x34987e['uniqueid']])){if(!_[_0xb8d7('0x22')](queues[_0x34987e[_0xb8d7('0x5')]][_0xb8d7('0x64')])){utils[_0xb8d7('0x11')](util[_0xb8d7('0x4')]('[%s][queues][musiconholdstop]',_0x34987e['uniqueid']),_0x34987e);queues[_0x34987e[_0xb8d7('0x5')]][_0xb8d7('0x65')]+=utils[_0xb8d7('0x35')](utils[_0xb8d7('0x16')](),queues[_0x34987e[_0xb8d7('0x5')]][_0xb8d7('0x64')]);utils[_0xb8d7('0x3')](util[_0xb8d7('0x4')](_0xb8d7('0x66'),_0x34987e[_0xb8d7('0x5')],queues[_0x34987e[_0xb8d7('0x5')]][_0xb8d7('0x1e')],queues[_0x34987e[_0xb8d7('0x5')]][_0xb8d7('0x65')]));delete queues[_0x34987e[_0xb8d7('0x5')]][_0xb8d7('0x64')];}}}catch(_0x1db3fc){utils['error'](util[_0xb8d7('0x4')](_0xb8d7('0x67'),_0x34987e[_0xb8d7('0x5')]),_0x1db3fc);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 3672f2a..0fd4a89 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 _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 +var _0xd98d=['find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','application','toLowerCase','startsWith','appdata','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','lodash','util','info','[%s][recordings][writeDB]','uniqueid','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','format','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV'];(function(_0x1eabab,_0x23edd2){var _0x1e1972=function(_0x4949d9){while(--_0x4949d9){_0x1eabab['push'](_0x1eabab['shift']());}};_0x1e1972(++_0x23edd2);}(_0xd98d,0xe5));var _0xdd98=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd98d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdd98('0x0'));var util=require(_0xdd98('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x4c1cae){utils[_0xdd98('0x2')](util['format'](_0xdd98('0x3'),_0x4c1cae[_0xdd98('0x4')]));if(_0x4c1cae[_0xdd98('0x5')]){utils['getUserByInternal'](_0x4c1cae[_0xdd98('0x5')])[_0xdd98('0x6')](function(_0x3a298f){if(_0x3a298f){_0x4c1cae[_0xdd98('0x7')]=_0x3a298f[_0xdd98('0x8')];_0x4c1cae[_0xdd98('0x9')]=_0x3a298f['id'];}utils[_0xdd98('0xa')]('CreateVoiceRecording',_0x4c1cae);});}else{utils[_0xdd98('0xa')](_0xdd98('0xb'),_0x4c1cae);}}exports[_0xdd98('0xc')]=function(_0x2b4860){try{utils[_0xdd98('0xd')](util['format'](_0xdd98('0xe'),_0x2b4860[_0xdd98('0x4')]),_0x2b4860);if(_0x2b4860[_0xdd98('0x4')]==_0x2b4860[_0xdd98('0xf')]){utils[_0xdd98('0x2')](util[_0xdd98('0x10')](_0xdd98('0x11'),_0x2b4860['uniqueid'],_0x2b4860[_0xdd98('0x12')],_0x2b4860[_0xdd98('0x13')]));recordings[_0x2b4860[_0xdd98('0x4')]]={'uniqueid':_0x2b4860['uniqueid'],'accountcode':_0x2b4860[_0xdd98('0x5')],'exten':_0x2b4860[_0xdd98('0x13')],'context':_0x2b4860[_0xdd98('0x12')],'channel':_0x2b4860[_0xdd98('0x14')],'monitors':[]};}}catch(_0x534df5){utils[_0xdd98('0x15')](util['format'](_0xdd98('0xe'),_0x2b4860[_0xdd98('0x4')]),_0x534df5);}};exports[_0xdd98('0x16')]=function(_0x3a6990){try{utils[_0xdd98('0xd')](util['format'](_0xdd98('0x17'),_0x3a6990[_0xdd98('0x4')]),_0x3a6990);if(!_[_0xdd98('0x18')](recordings[_0x3a6990['uniqueid']])&&_0x3a6990[_0xdd98('0x19')]==0x6){utils[_0xdd98('0x2')](util['format'](_0xdd98('0x1a'),_0x3a6990['uniqueid'],_0x3a6990[_0xdd98('0x12')],_0x3a6990[_0xdd98('0x14')]));}else if(!_[_0xdd98('0x18')](recordings[_0x3a6990[_0xdd98('0xf')]])&&_0x3a6990[_0xdd98('0x19')]==0x6&&_0x3a6990[_0xdd98('0x12')]!=_0xdd98('0x1b')){utils[_0xdd98('0x2')](util[_0xdd98('0x10')](_0xdd98('0x1c'),_0x3a6990[_0xdd98('0x4')],_0x3a6990[_0xdd98('0xf')],_0x3a6990[_0xdd98('0x12')],_0x3a6990['channel']));recordings[_0x3a6990['linkedid']][_0xdd98('0x5')]=_0x3a6990['accountcode'];}}catch(_0x12814c){utils['error'](util[_0xdd98('0x10')](_0xdd98('0x17'),_0x3a6990[_0xdd98('0x4')]),_0x12814c);}};exports[_0xdd98('0x1d')]=function(_0x52fa87){try{if(!_['isNil'](_0x52fa87[_0xdd98('0x1e')])&&!_['isNil'](_0x52fa87[_0xdd98('0x1e')][_0xdd98('0x1f')])){utils[_0xdd98('0xd')](util[_0xdd98('0x10')](_0xdd98('0x20'),_0x52fa87[_0xdd98('0x4')]),_0x52fa87);utils[_0xdd98('0x2')](util[_0xdd98('0x10')](_0xdd98('0x21'),_0x52fa87[_0xdd98('0x4')],_0x52fa87[_0xdd98('0x1e')],_0x52fa87[_0xdd98('0x22')]));if(_[_0xdd98('0x23')](_0x52fa87['value'],_0xdd98('0x24'))){_0x52fa87[_0xdd98('0x22')]=_0x52fa87[_0xdd98('0x22')][_0xdd98('0x25')](_0xdd98('0x24'),_0xdd98('0x26'));}if(recordings[_0x52fa87[_0xdd98('0xf')]]){var _0xb8e342=_[_0xdd98('0x27')](recordings[_0x52fa87[_0xdd98('0xf')]][_0xdd98('0x28')],{'value':_0x52fa87['value']});if(_[_0xdd98('0x18')](_0xb8e342)){recordings[_0x52fa87[_0xdd98('0xf')]]['monitors'][_0xdd98('0x29')]({'value':_0x52fa87[_0xdd98('0x22')]});}}}}catch(_0x146dbf){utils[_0xdd98('0x15')](util[_0xdd98('0x10')]('[%s][recordings][varset]',_0x52fa87[_0xdd98('0x4')]),_0x146dbf);}};exports[_0xdd98('0x2a')]=function(_0x2d3ea2){try{if(!_[_0xdd98('0x18')](recordings[_0x2d3ea2['uniqueid']])){utils['debug'](util[_0xdd98('0x10')](_0xdd98('0x2b'),_0x2d3ea2[_0xdd98('0x4')]),_0x2d3ea2);utils[_0xdd98('0x2')](util[_0xdd98('0x10')](_0xdd98('0x2c'),_0x2d3ea2[_0xdd98('0x4')],_0x2d3ea2[_0xdd98('0x2d')],_0x2d3ea2['calleridname'],_0x2d3ea2[_0xdd98('0x2e')]));recordings[_0x2d3ea2[_0xdd98('0x4')]][_0xdd98('0x2d')]=_0x2d3ea2[_0xdd98('0x2d')];recordings[_0x2d3ea2[_0xdd98('0x4')]][_0xdd98('0x2f')]=_0x2d3ea2[_0xdd98('0x2f')];recordings[_0x2d3ea2['uniqueid']][_0xdd98('0x30')]=_0x2d3ea2[_0xdd98('0x30')];recordings[_0x2d3ea2[_0xdd98('0x4')]][_0xdd98('0x31')]=_0x2d3ea2[_0xdd98('0x31')];if(recordings[_0x2d3ea2[_0xdd98('0x4')]][_0xdd98('0x32')]==_0xdd98('0x33')&&recordings[_0x2d3ea2['uniqueid']]['accountcode']){recordings[_0x2d3ea2[_0xdd98('0x4')]][_0xdd98('0x30')]=recordings[_0x2d3ea2[_0xdd98('0x4')]][_0xdd98('0x5')];recordings[_0x2d3ea2[_0xdd98('0x4')]][_0xdd98('0x31')]='';}recordings[_0x2d3ea2[_0xdd98('0x4')]][_0xdd98('0x28')][_0xdd98('0x34')](function(_0x3c49c4){var _0x4de337=_[_0xdd98('0x35')](recordings[_0x2d3ea2[_0xdd98('0x4')]]);_0x4de337[_0xdd98('0x22')]=_0x3c49c4[_0xdd98('0x22')];writeDB(_0x4de337);});delete recordings[_0x2d3ea2[_0xdd98('0x4')]];}}catch(_0x4c1d0d){utils[_0xdd98('0x15')](util['format']('[%s][recordings][hangup]',_0x2d3ea2['uniqueid']),_0x4c1d0d);}};exports[_0xdd98('0x36')]=function(_0x429bdd){try{if(!_[_0xdd98('0x18')](recordings[_0x429bdd[_0xdd98('0x4')]])){utils[_0xdd98('0xd')](util[_0xdd98('0x10')](_0xdd98('0x37'),_0x429bdd[_0xdd98('0x4')]),_0x429bdd);utils['info'](util[_0xdd98('0x10')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x429bdd[_0xdd98('0x4')],_0x429bdd[_0xdd98('0x38')],_0x429bdd['appdata']));if(_0x429bdd[_0xdd98('0x38')][_0xdd98('0x39')]()=='set'&&_[_0xdd98('0x3a')](_0x429bdd['appdata'][_0xdd98('0x39')](),'cdr')){var _0xde0f1c=_0x429bdd[_0xdd98('0x3b')][_0xdd98('0x3c')]('=');var _0x25e791=_0xde0f1c[0x0][_0xdd98('0x3d')](_0xde0f1c[0x0][_0xdd98('0x3e')]('(')+0x1,_0xde0f1c[0x0][_0xdd98('0x3e')](')'));var _0x4d327d=_0xde0f1c[0x1];recordings[_0x429bdd['uniqueid']][_0x25e791]=_0x4d327d;}}}catch(_0x4b085d){utils[_0xdd98('0x15')](util[_0xdd98('0x10')](_0xdd98('0x37'),_0x429bdd[_0xdd98('0x4')]),_0x4b085d);}};exports[_0xdd98('0x3f')]=function(_0x5c0003){try{if(!_['isNil'](recordings[_0x5c0003[_0xdd98('0x4')]])){utils[_0xdd98('0xd')](util[_0xdd98('0x10')]('[%s][recordings][queuecallerjoin]',_0x5c0003[_0xdd98('0x4')]),_0x5c0003);utils[_0xdd98('0x2')](util[_0xdd98('0x10')](_0xdd98('0x40'),_0x5c0003[_0xdd98('0x4')],_0x5c0003[_0xdd98('0x41')]));recordings[_0x5c0003[_0xdd98('0x4')]][_0xdd98('0x41')]=_0x5c0003['queue'];}}catch(_0x564bd1){utils[_0xdd98('0x15')](util[_0xdd98('0x10')](_0xdd98('0x42'),_0x5c0003[_0xdd98('0x4')]),_0x564bd1);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 9bf5479..90130c0 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 _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 +var _0x9c13=['transferercalleridnum','transferercalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','type','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','format','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x9c13,0x16a));var _0x39c1=function(_0xdeefbd,_0x9e1b3d){_0xdeefbd=_0xdeefbd-0x0;var _0x4ff63f=_0x9c13[_0xdeefbd];return _0x4ff63f;};'use strict';var _=require(_0x39c1('0x0'));var util=require(_0x39c1('0x1'));var utils=require(_0x39c1('0x2'));function writeDB(_0x402a1c){utils[_0x39c1('0x3')](util['format'](_0x39c1('0x4'),_0x402a1c['type']===_0x39c1('0x5')?_0x402a1c[_0x39c1('0x6')]:_0x402a1c['uniqueid'],_0x402a1c[_0x39c1('0x7')]));utils[_0x39c1('0x8')](_0x39c1('0x9'),_0x402a1c);}exports[_0x39c1('0xa')]=function(_0x4d9311){try{utils[_0x39c1('0xb')](util['format'](_0x39c1('0xc'),_0x4d9311[_0x39c1('0xd')]),_0x4d9311);utils[_0x39c1('0x3')](util[_0x39c1('0xe')](_0x39c1('0xf'),_0x4d9311[_0x39c1('0xd')],_0x4d9311[_0x39c1('0x10')],_0x4d9311[_0x39c1('0x11')],_0x4d9311['transfereecalleridnum'],_0x4d9311['transfereecalleridname']));_0x4d9311['type']=_0x39c1('0x12');writeDB(_0x4d9311);}catch(_0x22911a){utils[_0x39c1('0x13')](util[_0x39c1('0xe')](_0x39c1('0xc'),_0x4d9311[_0x39c1('0xd')]),_0x22911a);}};exports[_0x39c1('0x14')]=function(_0x316ea4){try{utils['debug'](util[_0x39c1('0xe')]('[%s][transfers][attendedtransfer]',_0x316ea4[_0x39c1('0x6')]),_0x316ea4);utils[_0x39c1('0x3')](util[_0x39c1('0xe')](_0x39c1('0x15'),_0x316ea4[_0x39c1('0x6')],_0x316ea4[_0x39c1('0x16')],_0x316ea4[_0x39c1('0x17')],_0x316ea4[_0x39c1('0x18')],_0x316ea4[_0x39c1('0x19')]));_0x316ea4=_['assign'](_0x316ea4,{'transfererchannel':_0x316ea4['origtransfererchannel'],'transferercalleridnum':_0x316ea4[_0x39c1('0x16')],'transferercalleridname':_0x316ea4['origtransferercalleridname'],'transfererconnectedlinenum':_0x316ea4['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x316ea4[_0x39c1('0x1a')],'transfereraccountcode':_0x316ea4[_0x39c1('0x1b')],'transferercontext':_0x316ea4[_0x39c1('0x1c')],'transfererexten':_0x316ea4[_0x39c1('0x1d')],'transfererlinkedid':_0x316ea4[_0x39c1('0x1e')],'context':_0x316ea4[_0x39c1('0x1f')],'extension':_0x316ea4[_0x39c1('0x20')],'type':_0x39c1('0x5')});if(_[_0x39c1('0x21')](_0x316ea4[_0x39c1('0x22')])){_0x316ea4=_[_0x39c1('0x23')](_0x316ea4,{'transfereechannel':_0x316ea4[_0x39c1('0x24')],'transfereecalleridnum':_0x316ea4[_0x39c1('0x18')],'transfereecalleridname':_0x316ea4['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x316ea4[_0x39c1('0x25')],'transfereeconnectedlinename':_0x316ea4['transfertargetconnectedlinename'],'transfereeaccountcode':_0x316ea4[_0x39c1('0x26')],'transfereecontext':_0x316ea4[_0x39c1('0x27')],'transfereeexten':_0x316ea4[_0x39c1('0x28')],'transfereelinkedid':_0x316ea4[_0x39c1('0x29')]});}writeDB(_0x316ea4);}catch(_0x1e1074){utils[_0x39c1('0x13')](util[_0x39c1('0xe')]('[%s][transfers][attendedtransfer]',_0x316ea4[_0x39c1('0x6')]),_0x1e1074);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index b38c76f..e99db6e 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 _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 +var _0x8598=['seconds','diffTime','diff','now','YYYY-MM-DD\x20HH:mm:ss','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','inspect','debug','error','then','catch','[utils][request]\x20name:%s','GetUser','internal','name','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','info','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]','request','GetVoiceQueue','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','add','format','subtractTime','subtract'];(function(_0x4917de,_0x4cca9b){var _0x11d892=function(_0x59848d){while(--_0x59848d){_0x4917de['push'](_0x4917de['shift']());}};_0x11d892(++_0x4cca9b);}(_0x8598,0x17f));var _0x8859=function(_0x4257cf,_0x3cd364){_0x4257cf=_0x4257cf-0x0;var _0x5394a3=_0x8598[_0x4257cf];return _0x5394a3;};'use strict';var BPromise=require(_0x8859('0x0'));var jayson=require(_0x8859('0x1'));var moment=require(_0x8859('0x2'));var util=require(_0x8859('0x3'));var client=jayson[_0x8859('0x4')][_0x8859('0x5')]({'port':0x2329});var logger=require(_0x8859('0x6'))('xdr');exports['info']=function(_0x2afb9b,_0x103c87){logger['info'](_0x2afb9b,_0x103c87?util[_0x8859('0x7')](_0x103c87,{'showHidden':![],'depth':null}):'');};exports[_0x8859('0x8')]=function(_0x32fd65,_0x1c7527){logger[_0x8859('0x8')](_0x32fd65,_0x1c7527?util['inspect'](_0x1c7527,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x460a7a,_0x5e6bb5){logger[_0x8859('0x9')](_0x460a7a,_0x5e6bb5?util['inspect'](_0x5e6bb5,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x86a3cb,_0x16da0b){return client['request'](_0x86a3cb,{'body':_0x16da0b})[_0x8859('0xa')](function(_0xa31c74){logger[_0x8859('0x8')]('[utils][request]\x20name:%s',_0x86a3cb,_0xa31c74?util['inspect'](_0xa31c74,{'showHidden':![],'depth':null}):'');})[_0x8859('0xb')](function(_0x3f0132){logger[_0x8859('0x9')](_0x8859('0xc'),_0x86a3cb,_0x3f0132?util['inspect'](_0x3f0132,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4876f7){return client['request'](_0x8859('0xd'),{'options':{'raw':!![],'attributes':['id',_0x8859('0xe'),_0x8859('0xf'),'interface'],'where':_0x4876f7,'limit':0x1}})[_0x8859('0xa')](function(_0x3f5ffb){logger['debug'](_0x8859('0x10'),JSON[_0x8859('0x11')](_0x4876f7),_0x3f5ffb?util[_0x8859('0x7')](_0x3f5ffb,{'showHidden':![],'depth':null}):'');return _0x3f5ffb[_0x8859('0x12')][_0x8859('0x13')]?_0x3f5ffb[_0x8859('0x12')][0x0]:null;});}exports[_0x8859('0x14')]=function(_0x30c7e2){return new BPromise(function(_0x537f0f,_0x3c34f7){if(_0x30c7e2){return getUser({'internal':_0x30c7e2})[_0x8859('0xa')](function(_0x26b1f2){logger[_0x8859('0x15')](_0x8859('0x16'),_0x30c7e2,_0x26b1f2?_0x8859('0x17'):_0x8859('0x18'));return _0x537f0f(_0x26b1f2);})['catch'](function(_0x28d9a0){logger[_0x8859('0x9')](_0x8859('0x19'),_0x28d9a0?util[_0x8859('0x7')](_0x28d9a0,{'showHidden':![],'depth':null}):'');return _0x537f0f(null);});}return _0x537f0f(null);});};exports[_0x8859('0x1a')]=function(_0x4f0b8c){return new BPromise(function(_0x1b5c65,_0x5a10c7){if(_0x4f0b8c){return getUser({'interface':_0x4f0b8c})[_0x8859('0xa')](function(_0xf9b3d1){logger[_0x8859('0x15')](_0x8859('0x1b'),_0x4f0b8c,_0xf9b3d1?_0x8859('0x17'):_0x8859('0x18'));return _0x1b5c65(_0xf9b3d1);})['catch'](function(_0x3503e0){logger[_0x8859('0x9')]('[utils][getUserByInterface]',_0x3503e0?util[_0x8859('0x7')](_0x3503e0,{'showHidden':![],'depth':null}):'');return _0x1b5c65(null);});}return _0x1b5c65(null);});};exports[_0x8859('0x1c')]=function(_0x204a11){return new BPromise(function(_0xbbfca7,_0x19b092){if(_0x204a11){return getUser({'name':_0x204a11})['then'](function(_0x287d08){logger[_0x8859('0x15')]('[utils][getUserByName]\x20name:%s\x20%s',_0x204a11,_0x287d08?_0x8859('0x17'):'notfound');return _0xbbfca7(_0x287d08);})[_0x8859('0xb')](function(_0x974217){logger[_0x8859('0x9')](_0x8859('0x1d'),_0x974217?util[_0x8859('0x7')](_0x974217,{'showHidden':![],'depth':null}):'');return _0xbbfca7(null);});}return _0xbbfca7(null);});};exports['getVoiceQueueByName']=function(_0x5ae03a){return new BPromise(function(_0x23e056,_0x5544d5){if(_0x5ae03a){return client[_0x8859('0x1e')](_0x8859('0x1f'),{'options':{'raw':!![],'attributes':['id',_0x8859('0xf'),'type',_0x8859('0x20'),_0x8859('0x21')],'where':{'name':_0x5ae03a},'limit':0x1}})[_0x8859('0xa')](function(_0x399013){logger['debug'](_0x8859('0x22'),_0x5ae03a,_0x399013?util[_0x8859('0x7')](_0x399013,{'showHidden':![],'depth':null}):'');logger['info'](_0x8859('0x23'),_0x5ae03a,_0x399013?_0x8859('0x17'):_0x8859('0x18'));return _0x23e056(_0x399013['result'][_0x8859('0x13')]?_0x399013['result'][0x0]:null);})[_0x8859('0xb')](function(_0x2de4f0){logger['error']('[utils][getVoiceQueueByName]',_0x2de4f0?util[_0x8859('0x7')](_0x2de4f0,{'showHidden':![],'depth':null}):'');return _0x23e056(null);});}return _0x23e056(null);});};exports['addTime']=function(_0x4a327d,_0x49d308){return moment(_0x4a327d)[_0x8859('0x24')](_0x49d308,'seconds')[_0x8859('0x25')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x8859('0x26')]=function(_0x3f917a,_0xc63ced){return moment(_0x3f917a)[_0x8859('0x27')](_0xc63ced,_0x8859('0x28'))[_0x8859('0x25')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x8859('0x29')]=function(_0xc068d6,_0x3dda26){return moment(_0xc068d6)[_0x8859('0x2a')](moment(_0x3dda26),_0x8859('0x28'));};exports['sumTime']=function(_0x43c595,_0x1e757b){return parseInt(_0x43c595,0xa)+parseInt(_0x1e757b,0xa);};exports[_0x8859('0x2b')]=function(){return moment()[_0x8859('0x25')](_0x8859('0x2c'));};exports[_0x8859('0x2d')]=function(_0x47708b,_0x37c125){if(_0x37c125){return moment(_0x47708b)[_0x8859('0x2d')](_0x37c125);}return!![];};exports[_0x8859('0x2e')]=function(_0x2858aa,_0x232249){if(_0x232249){return moment(_0x2858aa)[_0x8859('0x2e')](_0x232249);}else if(_0x2858aa){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 12260f3..fb4f665 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 _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 +var _0xad01=['catch','error','api','set','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','other','agent_id','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','util','fileLogger','safeTemplate','maskSensitiveData','/var','log','join','client','role','name','ensureDir','user','then','no-user','data','timestamp'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xad01,0xac));var _0x1ad0=function(_0x157527,_0x41f908){_0x157527=_0x157527-0x0;var _0x2d56a1=_0xad01[_0x157527];return _0x2d56a1;};var fs=require(_0x1ad0('0x0'));var _=require(_0x1ad0('0x1'));var ewinston=require(_0x1ad0('0x2'));var path=require(_0x1ad0('0x3'));var util=require(_0x1ad0('0x4'));var fileLogger=require('./loggers')[_0x1ad0('0x5')];var safeTemplate=require('./safe-template')[_0x1ad0('0x6')];var maskSensitiveData=require('./mask-sensitive-data')[_0x1ad0('0x7')];function ClientSideLogger(){function _0x34196a(_0x5211f2){var _0x2e12cd=path['join'](_0x1ad0('0x8'),_0x1ad0('0x9'),'xcally');var _0xdf2222=path[_0x1ad0('0xa')](_0x1ad0('0xb'),_0x5211f2[_0x1ad0('0xc')]+'-'+_0x5211f2[_0x1ad0('0xd')]);return fs[_0x1ad0('0xe')](path['join'](_0x2e12cd,_0xdf2222))['then'](function(){var _0x112aac=fileLogger(_0x1ad0('0xb'),path[_0x1ad0('0xa')](_0x2e12cd,_0xdf2222));return _0x112aac;})['catch'](function(_0x31b7f9){throw _0x31b7f9;});}this['log']=function(_0xd2f87e,_0x4b4029,_0x244d51,_0x1c96c4){return _0x34196a(_0xd2f87e[_0x1ad0('0xf')])['then'](function(_0x626332){var _0x3e41cd=_0x626332[_0x4b4029];return _0x3e41cd;})[_0x1ad0('0x10')](function(_0x2b3af6){var _0x48424d=_0xd2f87e['user']?_0xd2f87e[_0x1ad0('0xf')]['id']:_0x1ad0('0x11');var _0x3675ab=_0x1c96c4[_0x1ad0('0x12')];var _0x140176=_0x1c96c4[_0x1ad0('0x13')];var _0x2c13fa=new Date(Number(_0x140176));return _0x2b3af6(_0x48424d,_0x2c13fa,_0x244d51,_0x3675ab);})[_0x1ad0('0x14')](function(_0x306971){fileLogger(_0x1ad0('0xb'))[_0x1ad0('0x15')](_0x306971);});};}function setupLoggers(_0x53ecf7){return new Promise(function(_0x51bb54){var _0x164fd2=new ClientSideLogger();var _0x113f8c=fileLogger(_0x1ad0('0x16'));var _0x1eb6e1=fileLogger('auth');_0x53ecf7[_0x1ad0('0x17')](_0x1ad0('0x18'),_0x164fd2);_0x53ecf7['use'](ewinston[_0x1ad0('0x19')]({'winstonInstance':_0x113f8c,'meta':![],'statusLevels':!![],'msg':function(_0x48bb41,_0x34c02e){var _0x235c5a=_0x1ad0('0x1a');if(!_[_0x1ad0('0x1b')](_0x48bb41['body'])){_0x235c5a+='\x20body=%s';var _0x47abc3=_0x48bb41['body'];maskSensitiveData(_0x47abc3);}return safeTemplate(util['format'](_0x235c5a,_0x48bb41[_0x1ad0('0x1c')],_0x48bb41[_0x1ad0('0x1d')][_0x1ad0('0x1e')]?_0x48bb41[_0x1ad0('0x1d')]['x-forwarded-for']:_0x48bb41[_0x1ad0('0x1f')][_0x1ad0('0x20')]||_0x48bb41['ip'],_0x48bb41[_0x1ad0('0x21')],_0x34c02e[_0x1ad0('0x22')],_0x34c02e[_0x1ad0('0x23')],_0x48bb41[_0x1ad0('0xf')]?_0x48bb41['user']['id']:null,_0x48bb41[_0x1ad0('0xf')]?_0x48bb41[_0x1ad0('0xf')][_0x1ad0('0xd')]:null,_0x48bb41[_0x1ad0('0xf')]?_0x48bb41[_0x1ad0('0xf')][_0x1ad0('0xc')]:null,_0x47abc3?util[_0x1ad0('0x24')](_0x47abc3,![],null):''));}}));_0x53ecf7[_0x1ad0('0x25')](ewinston[_0x1ad0('0x19')]({'winstonInstance':_0x1eb6e1,'meta':![],'statusLevels':!![],'msg':function(_0x129a64,_0x2a8209){var _0xd7c928=_0x1ad0('0x26');if(_0x129a64[_0x1ad0('0x27')]&&_0x129a64[_0x1ad0('0x27')][_0x1ad0('0x28')]&&_0x129a64[_0x1ad0('0x27')]['agent_id']){_0xd7c928=_0x1ad0('0x29');}return util[_0x1ad0('0x2a')](_0xd7c928,_0x129a64[_0x1ad0('0x1c')],_0x129a64[_0x1ad0('0x1d')]['x-forwarded-for']?_0x129a64[_0x1ad0('0x1d')]['x-forwarded-for']:_0x129a64[_0x1ad0('0x1f')][_0x1ad0('0x20')]||_0x129a64['ip'],_0x129a64[_0x1ad0('0x21')],_0x2a8209[_0x1ad0('0x22')],_0x2a8209[_0x1ad0('0x23')],_0x129a64['user']?_0x129a64['user']['id']:null,_0x129a64[_0x1ad0('0xf')]?_0x129a64[_0x1ad0('0xf')][_0x1ad0('0xd')]:null,_0x129a64[_0x1ad0('0xf')]?_0x129a64[_0x1ad0('0xf')]['role']:null,_0x129a64[_0x1ad0('0x27')]&&_0x129a64[_0x1ad0('0x27')]['device']?_0x129a64[_0x1ad0('0x27')][_0x1ad0('0x28')]:_0x1ad0('0x2b'),_0x129a64[_0x1ad0('0x27')]&&_0x129a64[_0x1ad0('0x27')][_0x1ad0('0x2c')]?_0x129a64[_0x1ad0('0x27')][_0x1ad0('0x2c')]:'',_0x129a64[_0x1ad0('0x27')]&&_0x129a64[_0x1ad0('0x27')][_0x1ad0('0x2d')]?_0x129a64[_0x1ad0('0x27')][_0x1ad0('0x2d')]:'');},'ignoreRoute':function(_0x471edb){var _0x5e306b=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5e306b[_0x1ad0('0x2e')](_0x471edb[_0x1ad0('0x21')]);}}));return _0x51bb54();});}exports[_0x1ad0('0x2f')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index c9056e2..e5db77e 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0xf88e=['max','min','domCompare','monthCompare','test','length','padStart','iftime','lodash','moment-timezone','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','split','map','locale','weekdaysShort','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','toLowerCase','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','format','ddd','includes','dowCompare'];(function(_0x1d48d1,_0x1ef482){var _0xb793b9=function(_0x38fe16){while(--_0x38fe16){_0x1d48d1['push'](_0x1d48d1['shift']());}};_0xb793b9(++_0x1ef482);}(_0xf88e,0x7d));var _0xef88=function(_0x3e7818,_0xa326f8){_0x3e7818=_0x3e7818-0x0;var _0x216f7e=_0xf88e[_0x3e7818];return _0x216f7e;};var _=require(_0xef88('0x0'));var moment=require(_0xef88('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x50ab7d){return _0x50ab7d[_0xef88('0x2')];})[_0xef88('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xef88('0x4');var EINVALID_DATE=_0xef88('0x5');function throwIfDateNotValid(_0x246096){if(!_0x246096['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0xc3b597){var _0x4b175c=_0xc3b597[_0xef88('0x6')](':')[_0xef88('0x7')](function(_0x132cc8){return parseInt(_0x132cc8,0xa);});var _0x33f041=_0x4b175c[0x0];var _0x40da1e=_0x4b175c[0x1];if(_0x33f041<0x0||_0x33f041>0x17||_0x40da1e<0x0||_0x40da1e>0x3b){throw new Error(EINVALID_DATE);}return[_0x33f041,_0x40da1e];}function circularDoWInterval(_0x4dacfe,_0x34c983){if(_0x4dacfe===_0x34c983){return[_0x4dacfe];}else{var _0x2ab8ea=moment['locale']();moment[_0xef88('0x8')]('en');var _0x4813ce=moment[_0xef88('0x9')]()['map'](function(_0x53edd4){return _0x53edd4['toLowerCase']();});moment[_0xef88('0x8')](_0x2ab8ea);var _0x5a0852=_0x4813ce['indexOf'](_0x4dacfe);var _0x551233=_0x4813ce[_0xef88('0xa')](_0x34c983);if(_0x551233>_0x5a0852){return _0x4813ce[_0xef88('0xb')](_0x5a0852,_0x551233+0x1);}else{var _0x314699=_0x4813ce['slice'](0x0,_0x551233+0x1);var _0x458670=_0x4813ce['slice'](_0x5a0852);return _0x458670[_0xef88('0xc')](_0x314699);}}}module[_0xef88('0xd')][_0xef88('0xe')]=circularDoWInterval;function circularMonthInterval(_0x14fac8,_0x160cbe){if(_0x14fac8===_0x160cbe){return[_0x14fac8];}else{var _0xa2f321=moment[_0xef88('0x8')]();moment[_0xef88('0x8')]('en');var _0xe52ba0=moment[_0xef88('0xf')]()[_0xef88('0x7')](function(_0x1fa383){return _0x1fa383[_0xef88('0x10')]();});moment[_0xef88('0x8')](_0xa2f321);var _0x18a7f0=_0xe52ba0[_0xef88('0xa')](_0x14fac8);var _0x552fbf=_0xe52ba0[_0xef88('0xa')](_0x160cbe);if(_0x552fbf>_0x18a7f0){return _0xe52ba0['slice'](_0x18a7f0,_0x552fbf+0x1);}else{var _0x39dbd7=_0xe52ba0['slice'](0x0,_0x552fbf+0x1);var _0x1d6149=_0xe52ba0[_0xef88('0xb')](_0x18a7f0);return _0x1d6149[_0xef88('0xc')](_0x39dbd7);}}}module['exports'][_0xef88('0x11')]=circularMonthInterval;function parseDom(_0x2c044d){var _0x59aaef=parseInt(_0x2c044d,0xa);if(_0x59aaef<0x1||_0x59aaef>0x1f){throw new Error(EINVALID_DATE);}return _0x59aaef;}function timeCompare(_0x3f5056,_0x19eed4,_0x5a6d77){var _0x1a1a06=_0x3f5056[_0xef88('0x12')]();var _0x168dec=extractTime(_0x19eed4);var _0x123611=_0x168dec[0x0];var _0x45f64e=_0x168dec[0x1];var _0x485122=_0x3f5056[_0xef88('0x12')]()[_0xef88('0x13')](_0x123611)[_0xef88('0x14')](_0x45f64e);throwIfDateNotValid(_0x485122);var _0x6cc87=extractTime(_0x5a6d77);var _0x4fbbc3=_0x6cc87[0x0];var _0x2f2f71=_0x6cc87[0x1];var _0x539b5e=_0x3f5056['clone']()[_0xef88('0x13')](_0x4fbbc3)[_0xef88('0x14')](_0x2f2f71);throwIfDateNotValid(_0x539b5e);if(_0x539b5e[_0xef88('0x15')](_0x485122)){var _0x117543=_0x1a1a06[_0xef88('0x12')]()[_0xef88('0x16')](_0xef88('0x17'));var _0x675359=_0x1a1a06[_0xef88('0x12')]()[_0xef88('0x18')]('day');return _0x1a1a06[_0xef88('0x19')](_0x485122,_0x675359,undefined,'[]')||_0x1a1a06[_0xef88('0x19')](_0x117543,_0x539b5e,undefined,'[]');}else{return _0x1a1a06['isBetween'](_0x485122,_0x539b5e,undefined,'[]');}}module[_0xef88('0xd')][_0xef88('0x1a')]=timeCompare;function dowCompare(_0x2fd3ff,_0x33494e,_0xd7c890){var _0x557197=_0x2fd3ff[_0xef88('0x8')]('en')[_0xef88('0x1b')](_0xef88('0x1c'))[_0xef88('0x10')]();return circularDoWInterval(_0x33494e,_0xd7c890)[_0xef88('0x1d')](_0x557197);}module[_0xef88('0xd')][_0xef88('0x1e')]=dowCompare;function domCompare(_0x83fec9,_0x5ddb33,_0x52a48e){var _0x44787e=_0x83fec9['date']();if(_0x5ddb33===_0x52a48e){return _0x44787e===_0x5ddb33;}else{var _0x52dd0b=_0x83fec9['daysInMonth']();var _0x357246=_0x5ddb33<_0x52a48e;let _0x3acf9d=![];var _0x23835e=0x0;var _0x1543d0=0x0;if(_0x357246){_0x23835e=Math[_0xef88('0x1f')](0x1,_0x5ddb33);_0x1543d0=Math['min'](_0x52a48e,_0x52dd0b);_0x3acf9d=_0x44787e>=_0x23835e&&_0x44787e<=_0x1543d0;}else{_0x23835e=Math[_0xef88('0x20')](_0x5ddb33,_0x52dd0b);_0x1543d0=Math['max'](0x1,_0x52a48e);_0x3acf9d=_0x44787e>=_0x23835e||_0x44787e<=_0x1543d0;}return _0x3acf9d;}}module[_0xef88('0xd')][_0xef88('0x21')]=domCompare;function monthCompare(_0x4d793b,_0xa09ce6,_0x325c27){var _0x51b749=_0x4d793b[_0xef88('0x8')]('en')[_0xef88('0x1b')]('MMM')[_0xef88('0x10')]();return circularMonthInterval(_0xa09ce6,_0x325c27)[_0xef88('0x1d')](_0x51b749);}module[_0xef88('0xd')][_0xef88('0x22')]=monthCompare;function iftime(_0x4c4466,_0x26cbd2=moment['tz']['guess'](),_0x2320e8=moment()){if(!validateRx[_0xef88('0x23')](_0x4c4466)){throw new Error(EINVALID_STRING);}else{var _0xae73c3=(moment['isMoment'](_0x2320e8)?_0x2320e8[_0xef88('0x12')]():moment(_0x2320e8))['tz'](_0x26cbd2)[_0xef88('0x8')]('en');throwIfDateNotValid(_0xae73c3);var _0x34805c=_0x4c4466[_0xef88('0x6')](',');var _0x35d703=_0x34805c[0x0];var _0x3b6426=_0x34805c[0x1];var _0x2557fa=_0x34805c[0x2];var _0x2b8b06=_0x34805c[0x3];let _0x1a2857=!![];if(_0x35d703!=='*'){var _0x811300=_0x35d703['split']('-');var _0x18a381=_['padStart'](_0x811300[0x0],0x5,'0');var _0x55f712=_0x811300[_0xef88('0x24')]===0x2?_[_0xef88('0x25')](_0x811300[0x1],0x5,'0'):_0x18a381;_0x1a2857=timeCompare(_0xae73c3,_0x18a381,_0x55f712);}let _0x218e9f=!![];if(_0x3b6426!=='*'){var _0x8d6958=_0x3b6426[_0xef88('0x6')]('-');var _0x3de3bb=_0x8d6958[0x0];var _0x5171f=_0x8d6958['length']===0x2?_0x8d6958[0x1]:_0x3de3bb;_0x218e9f=dowCompare(_0xae73c3,_0x3de3bb,_0x5171f);}let _0x4ec62d=!![];if(_0x2557fa!=='*'){var _0x3e4893=_0x2557fa[_0xef88('0x6')]('-');var _0x217781=parseDom(_0x3e4893[0x0]);var _0x4d96cb=_0x3e4893[_0xef88('0x24')]===0x2?parseDom(_0x3e4893[0x1]):_0x217781;_0x4ec62d=domCompare(_0xae73c3,_0x217781,_0x4d96cb);}let _0x429cee=!![];if(_0x2b8b06!=='*'){var _0x41d15e=_0x2b8b06[_0xef88('0x6')]('-');var _0x8089a5=_0x41d15e[0x0];var _0x51ea4d=_0x41d15e[_0xef88('0x24')]===0x2?_0x41d15e[0x1]:_0x41d15e[0x0];_0x429cee=monthCompare(_0xae73c3,_0x8089a5,_0x51ea4d);}return _0x1a2857&&_0x218e9f&&_0x4ec62d&&_0x429cee;}}module[_0xef88('0xd')][_0xef88('0x26')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 7078c1d..a79f137 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x3a2b=['level','toUpperCase','meta','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','Logger','Console','transports','%s-%s','File','warn','consoleLogger','fileLogger','path','util','winston','../config/environment','debugLevel','redBG\x20white','red','bold\x20yellow','white','gray','bold\x20magenta','bold\x20blue','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','}}}'];(function(_0x2007a5,_0x3cb095){var _0x1d1261=function(_0x5b8c9d){while(--_0x5b8c9d){_0x2007a5['push'](_0x2007a5['shift']());}};_0x1d1261(++_0x3cb095);}(_0x3a2b,0xfc));var _0xb3a2=function(_0x207cb7,_0x1df34a){_0x207cb7=_0x207cb7-0x0;var _0x11581b=_0x3a2b[_0x207cb7];return _0x11581b;};'use strict';var path=require(_0xb3a2('0x0'));var util=require(_0xb3a2('0x1'));var moment=require('moment');var winston=require(_0xb3a2('0x2'));var config=require(_0xb3a2('0x3'));var debugLevel=config[_0xb3a2('0x4')]?config[_0xb3a2('0x4')]['toLowerCase']():'info';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':_0xb3a2('0x5'),'error':_0xb3a2('0x6'),'warn':_0xb3a2('0x7'),'info':_0xb3a2('0x8'),'print':'bold\x20white','success':'bold\x20green','http':_0xb3a2('0x9'),'verbose':_0xb3a2('0xa'),'debug':_0xb3a2('0xb'),'silly':'bold\x20cyan'};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x4a8bf3,_0x4441da,_0x4e2d0a){var _0x71d918=_0x4a8bf3||_0xb3a2('0xc');return path[_0xb3a2('0xd')](_0x71d918,util[_0xb3a2('0xe')](_0xb3a2('0xf'),_0x4441da,_0x4e2d0a));}function formatter(_0x1b5ee5,_0x27e98b){_0x27e98b[_0xb3a2('0x10')]=_0x27e98b[_0xb3a2('0x10')][_0xb3a2('0x11')](/@@{/g,_0xb3a2('0x12'))['replace'](/}@@/g,_0xb3a2('0x13'))[_0xb3a2('0x11')](/@{/g,'{{')[_0xb3a2('0x11')](/}@/g,'}}');return util[_0xb3a2('0xe')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xb3a2('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),_0x27e98b[_0xb3a2('0x14')][_0xb3a2('0x15')](),_0x1b5ee5,_0x27e98b[_0xb3a2('0x10')]);}function fileFormat(_0x4c91de,_0x4e0664){_0x4e0664['message']=_0x4e0664['message'][_0xb3a2('0x11')](/@@{/g,_0xb3a2('0x12'))['replace'](/}@@/g,_0xb3a2('0x13'))[_0xb3a2('0x11')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x267d59=_0x4e0664[_0xb3a2('0x16')]&&Object['keys'](_0x4e0664['meta'])[_0xb3a2('0x17')]?'\x0a\x09'+JSON['stringify'](_0x4e0664[_0xb3a2('0x16')]):'';return util['format'](_0xb3a2('0x18'),moment()[_0xb3a2('0xe')](_0xb3a2('0x19')),_0x4e0664[_0xb3a2('0x14')]['toUpperCase'](),_0x4c91de,_0x4e0664[_0xb3a2('0x10')],_0x267d59);}function consoleLogger(){var _0x51f844=new winston[(_0xb3a2('0x1a'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xb3a2('0x1b'))]({'level':'warn','json':![],'formatter':function(_0x16000e){return formatter('',_0x16000e);}})]});return _0x51f844;}function fileLogger(_0x1d46c9,_0x53c785){var _0x502e45=new winston[(_0xb3a2('0x1a'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xb3a2('0x1c'))]['File']({'name':util[_0xb3a2('0xe')](_0xb3a2('0x1d'),_0x1d46c9,'error'),'filename':getLogFileName(_0x53c785,_0x1d46c9,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4411ac){return fileFormat(_0x1d46c9,_0x4411ac);}}),new winston[(_0xb3a2('0x1c'))][(_0xb3a2('0x1e'))]({'name':util['format'](_0xb3a2('0x1d'),_0x1d46c9,debugLevel),'filename':getLogFileName(_0x53c785,_0x1d46c9,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x50aba9){return fileFormat(_0x1d46c9,_0x50aba9);}}),new winston[(_0xb3a2('0x1c'))][(_0xb3a2('0x1b'))]({'level':_0xb3a2('0x1f'),'json':![],'formatter':function(_0x49d537){return fileFormat(_0x1d46c9,_0x49d537);}})]});return _0x502e45;}exports[_0xb3a2('0x20')]=consoleLogger;exports[_0xb3a2('0x21')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 9e5449e..24b660d 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 _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 +var _0x57ca=['accesskeyid','secretaccesskey','key','user','accountSid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','@@{','replace','}@@','includes','exports','username','password','apiKey','firstName','lastName','street','phone','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessTokenSecret','authToken','consumerSecret','calleridname','calleridnum','vidaooApiKey','privateKey'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x57ca,0x108));var _0xa57c=function(_0x2129f6,_0x19070c){_0x2129f6=_0x2129f6-0x0;var _0x51a54d=_0x57ca[_0x2129f6];return _0x51a54d;};var _=require('lodash');var sensitiveFields=[_0xa57c('0x0'),_0xa57c('0x1'),'newPassword',_0xa57c('0x2'),_0xa57c('0x3'),_0xa57c('0x4'),_0xa57c('0x5'),_0xa57c('0x6'),'mobile',_0xa57c('0x7'),_0xa57c('0x8'),_0xa57c('0x9'),_0xa57c('0xa'),_0xa57c('0xb'),_0xa57c('0xc'),_0xa57c('0xd'),_0xa57c('0xe'),'token',_0xa57c('0xf'),'accessToken',_0xa57c('0x10'),_0xa57c('0x11'),'consumerKey',_0xa57c('0x12'),'membername',_0xa57c('0x13'),_0xa57c('0x14'),'exten',_0xa57c('0x15'),'clientEmail',_0xa57c('0x16'),_0xa57c('0x17'),_0xa57c('0x18'),_0xa57c('0x19'),_0xa57c('0x1a'),'pass',_0xa57c('0x1b'),'localstationid',_0xa57c('0x1c'),_0xa57c('0x1d'),_0xa57c('0x1e'),_0xa57c('0x1f')];function maskSensitiveData(_0x3238ff){const _0x37a323=/(?!^)[\s\S](?!$)/g;if(_[_0xa57c('0x20')](_0x3238ff)){for(const _0x4b4bdb in _0x3238ff){if(_[_0xa57c('0x21')](_0x3238ff[_0x4b4bdb])){for(let _0xdf7ff6=0x0;_0xdf7ff6<_0x3238ff[_0x4b4bdb][_0xa57c('0x22')];_0xdf7ff6++){maskSensitiveData(_0x3238ff[_0x4b4bdb][_0xdf7ff6]);}}else if(_['isPlainObject'](_0x3238ff[_0x4b4bdb])){maskSensitiveData(_0x3238ff[_0x4b4bdb]);}else if(_[_0xa57c('0x23')](_0x3238ff[_0x4b4bdb])){_0x3238ff[_0x4b4bdb]=_0x3238ff[_0x4b4bdb]['replace'](/{{{/g,_0xa57c('0x24'))[_0xa57c('0x25')](/}}}/g,_0xa57c('0x26'))[_0xa57c('0x25')](/{{/g,'@{')[_0xa57c('0x25')](/}}/g,'}@');if(_[_0xa57c('0x27')](sensitiveFields,_0x4b4bdb)){_0x3238ff[_0x4b4bdb]=_0x3238ff[_0x4b4bdb][_0xa57c('0x25')](_0x37a323,'*');}}}}}module[_0xa57c('0x28')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index c838581..811be9b 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 _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 +var _0x8603=['{\x20{\x20','\x20}\x20}','string','replace','isArray','keys','reduce','exports'];(function(_0x44fc8a,_0x3ddf68){var _0x114553=function(_0x576588){while(--_0x576588){_0x44fc8a['push'](_0x44fc8a['shift']());}};_0x114553(++_0x3ddf68);}(_0x8603,0x190));var _0x3860=function(_0x266247,_0x406437){_0x266247=_0x266247-0x0;var _0x335374=_0x8603[_0x266247];return _0x335374;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2f848f){return _0x2f848f==='{{'?_0x3860('0x0'):_0x3860('0x1');}function safeTemplate(_0x51bfda){var _0x4961d6=_0x51bfda;if(typeof _0x51bfda===_0x3860('0x2')){_0x4961d6=_0x51bfda[_0x3860('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x3860('0x4')](_0x51bfda)){_0x4961d6=_0x51bfda['map'](function(_0x2fc97a){return safeTemplate(_0x2fc97a);});}else if(_['isPlainObject'](_0x51bfda)){_0x4961d6=Object[_0x3860('0x5')](_0x51bfda)[_0x3860('0x6')](function(_0x1eca44,_0xd3ce26){_0x1eca44[_0xd3ce26]=safeTemplate(_0x51bfda[_0xd3ce26]);return _0x1eca44;},{});}return _0x4961d6;}module[_0x3860('0x7')]['safeTemplate']=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 353f418..6fe0ee7 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 _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 +var _0x990e=['info','writeJSON','resolve','exports','fs-extra','path','root','server/app.json','apps','findIndex','name','motion2','env','NODE_PATH','string','pathExists','then','readJSON','updated'];(function(_0x172f6b,_0x11669f){var _0x546c0f=function(_0x4a3171){while(--_0x4a3171){_0x172f6b['push'](_0x172f6b['shift']());}};_0x546c0f(++_0x11669f);}(_0x990e,0xc2));var _0xe990=function(_0x548a6c,_0x36f95a){_0x548a6c=_0x548a6c-0x0;var _0x29a0a2=_0x990e[_0x548a6c];return _0x29a0a2;};var fs=require(_0xe990('0x0'));var path=require(_0xe990('0x1'));var config=require('../config/environment');var root=config[_0xe990('0x2')];var APP_JSON_PATH=path['resolve'](root,_0xe990('0x3'));var NODEPATH=path['resolve'](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x5d78c5){let _0x11a8be=![];if(Array['isArray'](_0x5d78c5['apps'])){var _0x4ce8d8=_0x5d78c5[_0xe990('0x4')][_0xe990('0x5')](function(_0x2f82b4){return _0x2f82b4[_0xe990('0x6')]===_0xe990('0x7');});if(_0x4ce8d8>-0x1){var _0x2c886=_0x5d78c5[_0xe990('0x4')][_0x4ce8d8];if(typeof _0x2c886[_0xe990('0x8')][_0xe990('0x9')]!==_0xe990('0xa')){_0x2c886[_0xe990('0x8')][_0xe990('0x9')]=NODEPATH;_0x11a8be=!![];}}return{'appConfig':_0x5d78c5,'updated':_0x11a8be};}}function updateAppConfig(_0x47887e){return fs[_0xe990('0xb')](APP_JSON_PATH)[_0xe990('0xc')](function(_0x5d53a4){if(_0x5d53a4){return fs[_0xe990('0xd')](APP_JSON_PATH)[_0xe990('0xc')](function(_0x57c43b){var _0x714002=setLegacyLibsNodeEnvPath(_0x57c43b);if(_0x714002[_0xe990('0xe')]){_0x47887e[_0xe990('0xf')]('Updating\x20app.json');return fs[_0xe990('0x10')](APP_JSON_PATH,_0x57c43b,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0xe990('0x11')]();}});}module[_0xe990('0x12')]=updateAppConfig; \ No newline at end of file